akhauriyash/Code-Regression huggingface dataset:
// Created by js0805
#include <bits/stdc++.h>
#include<algorithm>
#include<vector>
#include<string>
#define ll long long
#define fr(a,b) for(ll i=a;i<b;i++)
#define prDouble(x) cout << fixed << setprecision(10) <<x
using namespace std;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;
double dp[301][301][301];
double solve(int &n, int x, int y, int z) {
    if (x < 0 or y < 0 or z < 0) {
        return 0;
    }
    if (x == 0 and y == 0 and z == 0)
        return 0;
    if (dp[x][y][z] > -0.9) {
        return dp[x][y][z];
    }
    double exp = n + x * solve(n, x - 1, y, z) + y * solve(n, x + 1, y - 1, z) + z * solve(n, x, y + 1, z - 1);
    return dp[x][y][z] = exp / (x + y + z);

}
int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin >> n;
    memset(dp, -1, sizeof dp);
    int t;
    int one = 0, two = 0, three = 0;
    fr(1, n + 1) {
        cin >> t;
        if (t == 1) {
            one++;
        }
        else if (t == 2) {
            two++;
        }
        else
            three++;
    }
    prDouble (solve(n, one, two, three));
}

Measured memory_bytes: 216916
#include <bits/stdc++.h>
using namespace std;
using Int = unsigned long long;
typedef pair<int,int> P;
typedef priority_queue<int> Pr;
typedef vector<int> Vi;
typedef vector<P> Vp;
int const MOD = 1000000007;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define END cout<<ans<<'\n'
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

    int n; cin>>n; int a[n]; Vi o(n);
    for (int i = 0; i < n; i++){
        cin>>a[i]; o[i]=i;
    }
    sort(o.begin(),o.end(),[&](int x,int y){return a[x]>a[y];});
    Int ans=0; multiset<int> s;
    s.insert(-1); s.insert(-1); s.insert(n); s.insert(n);
    for (auto k:o){
        auto it=s.lower_bound(k);
        Int i3=*it; it++; Int i4=*it; it--; it--;
        Int i2=*it; it--; Int i1=*it;
        ans+=a[k]*((k-i2)*(i4-i3)+(i3-k)*(i2-i1));
        s.insert(k);
    }
    END;
}

Measured memory_bytes: 5760
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<climits>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int main(){
  int n; cin >> n;
  map<char,ll> mp;
  for(int i=0;i<n;i++){
    string s; cin >> s;
    if(s[0]=='M' || s[0]=='A' || s[0]=='R' || s[0]=='C' || s[0]=='H') mp[s[0]]++;
  }
  ll ans = 0;

  ans += mp['M']*mp['A']*mp['R'];
  ans += mp['M']*mp['A']*mp['C'];
  ans += mp['M']*mp['A']*mp['H'];
  ans += mp['M']*mp['R']*mp['C'];
  ans += mp['M']*mp['R']*mp['H'];
  ans += mp['M']*mp['C']*mp['H'];
  ans += mp['A']*mp['R']*mp['C'];
  ans += mp['A']*mp['R']*mp['H'];
  ans += mp['A']*mp['C']*mp['H'];
  ans += mp['R']*mp['C']*mp['H'];

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
main()
{
    int a, b, c, n, m, k, ans = 0;
    cin >> a >> b >> c;
    int ara[8] = {0};
    ara[a]++;
    ara[b]++;
    ara[c]++;
    if(ara[5] == 2 &&  ara[7] == 1)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using P = pair<lint, int>;

const lint INF = 1e18;

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  int n, m, s, t; cin >> n >> m >> s >> t;
  s--; t--;
  struct edge { int to, y, s; };
  vector< vector<edge> > G(n, vector<edge>());
  for (int i = 0; i < m; i++) {
    int u, v, a, b; cin >> u >> v >> a >> b;
    u--; v--;
    G[u].push_back(edge{v, a, b});
    G[v].push_back(edge{u, a, b});
  }
  
  vector<lint> dy(n, INF), ds(n, INF);
  priority_queue<P, vector<P>, greater<P> > pq;
  dy[s] = 0;
  pq.push(P(0, s));
  while (not pq.empty()) {
    P p = pq.top(); pq.pop();
    int v = p.second;
    if (dy[v] < p.first) continue;
    for (auto&& e : G[v]) {
      if (dy[v] + e.y < dy[e.to]) {
        dy[e.to] = dy[v] + e.y;
        pq.push(P(dy[e.to], e.to));
      }
    }
  }

  ds[t] = 0;
  pq.push(P(0, t));
  while (not pq.empty()) {
    P p = pq.top(); pq.pop();
    int v = p.second;
    if (ds[v] < p.first) continue;
    for (auto&& e : G[v]) {
      if (ds[v] + e.s < ds[e.to]) {
        ds[e.to] = ds[v] + e.s;
        pq.push(P(ds[e.to], e.to));
      }
    }
  }

  vector<lint> res(n);
  const lint N = 1e15;
  for (int i = 0; i < n; i++) {
    res[i] = N - dy[i] - ds[i];
  }
  for (int i = n - 2; i >= 0; i--) {
    res[i] = max(res[i], res[i + 1]);
  }
  for (int i = 0; i < n; i++) {
    cout << res[i] << '\n';
  }
  return 0;
}


Measured memory_bytes: 11252
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
using namespace std;

int main(int argc, char *argv[])
{
  int n;
  long sum;
  double ave, dis;
  while (1) {
    cin >> n;
    sum = 0;
    dis = 0;
    if(n == 0) break;
    vector<int> s(n);
    for(int i=0;i<n;i++){
      cin >> s.at(i);
      sum += s.at(i);
    }
    ave = (double)sum / n;
    for(int j=0;j<n;j++){
      dis += pow(((double)s.at(j)-ave), 2.0);
    }
    dis = sqrt(dis/n);
    cout << fixed << endl;
    cout << setprecision(9);
    cout << dis << endl;
  }

  return 0;
}



Measured memory_bytes: 3236
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
#include <numeric>
#include <queue>
#include <deque>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> vp;
typedef vector<PL> vpl;
typedef vector<vector<P>> vvp;
typedef vector<vector<PL>> vvpl;
const int INF = 1001001001;
const ll LINF = 1e18;
const double pi = 3.1415926535897932;
const string endstr = "\n";
#define FOR(i, a, b) for(ll i = (a); i < b; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define FORMAP(it, m) for(auto it = m.begin(); it != m.end(); it++)
#define ff first
#define ss second
#define pb push_back

template <typename T>
T gcd(T a, T b) {
    return (a == 0) ? b : gcd(b%a, a);
}
template <typename T>
T lcm(T a, T b) {
    return a / gcd(a, b) * b;
}

bool p_comp_fs(const PL p1, const PL p2){ return p1.first < p2.first;};
bool p_comp_fg(const PL p1, const PL p2){ return p1.first > p2.first;};
bool p_comp_ss(const PL p1, const PL p2){ return p1.second < p2.second;};
bool p_comp_sg(const PL p1, const PL p2){ return p1.second > p2.second;};
template <typename T>
vector<T> uniquen(vector<T> vec){
    vec.erase(unique(vec.begin(), vec.end()), vec.end());
    return vec;
}


string s;

bool solve_dp(vl& vs, ll goal){
    set<ll> sp;
    sp.insert(0);
    REP(i, vs.size()){
        set<ll> sn;
        for(ll cur_s : sp){
            sn.insert(cur_s+vs[i]);
            sn.insert(cur_s-vs[i]);
        }
        sp = std::move(sn);
    }
    return sp.count(goal) == 1;
}

int main(){
    cin >> s; s += "T";
    ll x, y; cin >> x >> y;
    vl xs, ys; bool isx = true; ll len = 0;
    REP(i, s.size()){
        if(s[i] == 'T'){
            isx ? xs.pb(len) : ys.pb(len);
            isx = !isx; len = 0;
            continue;
        }
        len++;
    }
    x -= xs[0]; xs.erase(xs.begin());
    bool ok = solve_dp(xs, x) && solve_dp(ys, y);
    cout << (ok ? "Yes" : "No") << endstr;
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = 1e+11;/* 1e+9a */
namespace utils{

    class Repeater{
        int st;
        int ed;
        int d;
    public:
        class rep_iterator{
            int i; int d;
        public:
            rep_iterator(int x, int pd) :i(x), d(pd) {}

            int& operator*(){ return i; }
            bool operator==(const rep_iterator& k) const { return i == k.i; }
            bool operator!=(const rep_iterator& k) const { return i != k.i; }
            rep_iterator& operator++(){ i+=d; return *this; }
        };

        Repeater(int N) :st(0), ed(N), d(1) {}
        Repeater(int b, int e) :st(b), ed(e), d(1) {if(st > ed){ st--; ed--; d = -1; } }

        rep_iterator begin() const{ return rep_iterator(st, d); }
        rep_iterator end() const{ return rep_iterator(ed, d); }

    };

    template<class T, class Compare> using p_queue = priority_queue<T, vector<T>, Compare>;
    template<class T> using min_queue = p_queue<T, greater<T>>;
    template<class T> using max_queue = p_queue<T, less<T>>;

    template<class T> bool min_update(T& X, const T& A){ if(X > A) {X = A; return true;} return false; }
    template<class T> bool max_update(T& X, const T& A){ if(X < A) {X = A; return true;} return false; }
#define ALL(x) begin(x), end(x)
#define rALL(x) rbegin(x), rend(x)
};
using namespace utils;


void sub_main(istream &cin) {
    ll N;
    cin >> N;
    if(!cin) return;
    vector<ll> A(N);
    ll sum = 0;
    ll negative_count = 0;
    ll minimum = INF;
    for (auto &&a : A) {
        cin >> a;
        if(a < 0) {
            negative_count++;
            a = -a;
        }
        sum += a;
        minimum = min(a, minimum);
    } // end a
    ll ans = sum - (negative_count % 2 == 1 ? 2 * minimum : 0);

    cout << ans << endl;

}

int main(int argc, char *argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    cerr << "DEBUG MODE" << endl;
    string test_cases = "test_D.txt";
    auto fs = fstream(test_cases, fstream::in);
    int lp = 0;
    while(fs) {
        lp++;
        cout << lp <<  "#------\n";
        sub_main(fs);
    }
    cout << "------#" << endl;
    if(lp <= 1) sub_main(cin);
#else
    sub_main(cin);
#endif
    return 0;
}


Measured memory_bytes: 1024
n = int(input())
res = 0
if n % 2 == 0:
  for i in range(1,30):
    p = n // (5 ** i)
    #print(i,p)
    if p % 2 == 1:
      res += (p-1) // 2
    else:
      res += p // 2
print(res)

Measured memory_bytes: 9172
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 string N;
  cin >> N;
  if (N[1]==N[2]){
  	if (N[0]==N[1] || N[1]==N[3]){
    cout << "Yes" << endl;
    }
    else {
    cout << "No" << endl;
    }
  }
  else if (N[1]!=N[2]) {
  cout << "No" << endl;
  }
}

Measured memory_bytes: 256
s=input()

lists=list(s)
sum=len(lists)

count=0

for i in range(sum):
  if i%2==0:
    if lists[i]=='R' or lists[i]=='U' or lists[i]=='D':
      count+=1
  else:
    if lists[i]=='L' or lists[i]=='U' or lists[i]=='D':
      count+=1

if count==sum:
  print('Yes')
else:
  print('No')



Measured memory_bytes: 38384
l, r = map(int, input().split())
if r - l >= 2019:
    print(0)
else:
    answer = float('inf')
    for i in range(l, r + 1):
        for j in range(i + 1, r + 1):
            answer = min(answer, (i * j) % 2019)
    print(answer)


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

typedef struct {
	int fromIdx;
	int nowIdx;
} S;
int main()
{
	int N;
	
	cin >> N;
	vector<vector<int>> v(N);
	for (int i = 0; i < N - 1; i++) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		v[a].emplace_back(b);
		v[b].emplace_back(a);
	}
	vector<int> dst_f(N);
	dst_f[0] = 0;
	
	queue<S> que;
	que.push(S{ 0, 0 });

	/* fennecからの距離 */
	while (que.size()) {
		S s = que.front();
		que.pop();
		int dst = dst_f[s.nowIdx] + 1;
		for (int i : v[s.nowIdx]) {
			if (s.fromIdx != i) {
				que.push(S{ s.nowIdx, i });
				dst_f[i] = dst;
			}
		}
	}
	/* snukeが近い箇所をカウント */
	int s_point = 1;
	dst_f[N - 1] = 0;
	que.push(S{ N - 1, N - 1 });
	while (que.size()) {
		S s = que.front();
		que.pop();
		int dst = dst_f[s.nowIdx] + 1;
		for (int i : v[s.nowIdx]) {
			if ((dst < dst_f[i]) && (s.fromIdx != i)) {
				que.push(S{ s.nowIdx, i });
				s_point++;
				dst_f[i] = dst;
			}
		}
	}
	if (2 * s_point >= N) {
		cout << "Snuke";
	} else {
		cout << "Fennec";
	}
}


Measured memory_bytes: 6272
import java.util.*;

public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main() {
		new B().doIt();
	}
	
	class B{
		
		String input;
		char type;
		
		void solve(){
			Data d = new Data(input);
//			System.out.println(Arrays.toString(d.input));
			if(type=='U')System.out.println(d.toU());
			else if(type=='L')System.out.println(d.toL());
			else if(type=='D')System.out.println(d.toD());
		}
		
		void doIt(){
			while(in.hasNext()){
				input = in.next();
				type = in.next().charAt(0);
				if(type=='X')break;
				solve();
			}
		}
		class Data{
			String[] input;
			int n;
			public Data(String a) {
				String[] test = a.split("_");
				if(test.length==1){
					String b = a.charAt(0)+"";
					for(int i=1;i<a.length();i++){
						if(Character.isUpperCase(a.charAt(i)))b+=" ";
						b+=a.charAt(i);
					}
					input = b.split(" ");
					n = input.length;
				}else{
					input = a.split("_");
					n = test.length;
				}
			}
			
			String toU(){
//				System.out.println(Arrays.toString(input));
//				System.out.println(n);
				String result = "";
				for(int i=0;i<n;i++){
					result += Character.toUpperCase(input[i].charAt(0));
					for(int s=1;s<input[i].length();s++)result += input[i].charAt(s);
				}
				return result;
			}
			
			String toL(){
				String result = toU();
				String result2 = Character.toLowerCase(result.charAt(0))+"";
				for(int i=1;i<result.length();i++)result2+=result.charAt(i);
				return result2;
			}
			
			String toD(){
				String result = Character.toLowerCase(input[0].charAt(0))+input[0].substring(1,input[0].length());
				for(int i=1;i<n;i++){
//					System.out.println(input[i]);
					result += "_";
					for(int s=0;s<input[i].length();s++){
//						System.out.println(result);
						result += Character.toLowerCase(input[i].charAt(s));
					}
				}
				return result;
			}
			
		}
	}
	

//	class B{
//		int n,a,b;
//
//		void solve(){
//			
//		}
//
//		void doIt(){
//			while(in.hasNext()){
//				n = in.nextInt();
//				a = in.nextInt();
//				b = in.nextInt();
//				if(n+a+b==0)break;
//				solve();
//			}
//		}
//	}
//
}

Measured memory_bytes: 17752
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define first f
#define second s
#define long long ll
#define Max 100005

//int arr[]
//char s[]

int main ()
{
    int n, k;
    cin >> n >>k;
    int e = n - k;
    if (k > 1) printf ("%d", e);
    else printf ("0");
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
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);i>=0;--i)
#define int long long
#define itn int
#define pb push_back
#define m_p make_pair
#define m_t meke_tuple
#define p_p(a,b) pb(m_p(a,b))
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(all(a));reverse(all(a))
#define UNIQUE(a) a.erase(unique(all(a)),a.end())
#define SZ(a) (ll)(a.size())
#define ENDL cout<<endl
#define debg(a) cout<<#a<<" "<<a<<endl;
#define call(a) for(auto i:a)cout<<i<<" ";cout<<endl
#define show(a) rep(ghf,SZ(a)){rep(kjh,SZ(a[ghf])){cout<<(a[ghf][kjh]<10?" ":"")<<a[ghf][kjh]<<" ";}ENDL;}
#define out(a) cout<<(a)<<endl
#define fi first
#define se second
#define Vec vector
#define P pair
typedef long long ll;
typedef string str;
typedef vector<ll> V;
typedef pair<ll,ll> Pi;
typedef vector<Pi> VP;
const long long INF = 1LL<<60;
const long long MOD = 1e9+7;
int gcd(int a,int b){if(b==0)return a;return gcd(b,a%b);}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int max(int a,int b){if(a>b)return a; return b;}
int min(int a,int b){if(a>b)return b; return a;}
void Yes(){cout<<"Yes"<<endl;}
void No(){cout<<"No"<<endl;}
void YN(bool b){cout<<(b?"Yes":"No")<<endl;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin>>n;
  Vec<str> s(n);
  rep(i,n)cin>>s[i];
  int res=0;
  rep(i,n){
    rep(j,SZ(s[i])-1){
      if(s[i][j]=='A' && s[i][j+1]=='B')res++;
    }
  }
  int Aonly=0,Bonly=0,AB=0;
  rep(i,n){
    if(s[i][0]=='B' && s[i][SZ(s[i])-1]=='A')AB++;
    else if(s[i][0]=='B')Bonly++;
    else if(s[i][SZ(s[i])-1]=='A')Aonly++;
  }

  if(AB>0 && Aonly>0 && Bonly>0){
    res+=AB+1;
    Aonly--;
    Bonly--;
    res+=min(Aonly,Bonly);
  }
  else if(AB>0 && Aonly>0 && Bonly==0){
    res+=AB;
  }
  else if(AB>0 && Aonly==0 && Bonly>0){
    res+=AB;
  }
  else if(AB>0 && Aonly==0 && Bonly==0){
    res+=AB-1;
  }
  else if(AB==0 && Aonly>0 && Bonly>0){
    res+=min(Aonly,Bonly);
  }
  out(res);
  
  
  
  return 0;
}



Measured memory_bytes: 768
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pl;
const ll INF = 1000000000000000;
const int MAX = 310;
vector<pair<ll,ll>> G[MAX];//（行き先,cost）
priority_queue<Pl,vector<Pl>,greater<Pl>> que;//(count,energy,位置)
ll ans[310][310];
void dijkstra(int s,int l){
	que.push({{0,-l},s});
	while(!que.empty()){
		Pl p = que.top();
		que.pop();
		ll x = p.second;
		ll cnt = p.first.first,en = -(p.first.second);
		if(ans[s][x]!=INF) continue;
		ans[s][x] = cnt;
		for(P e: G[x]){
			if(ans[s][e.first]!=INF) continue;
			if(en>=e.second){
				que.push({{cnt,-(en - e.second)},e.first});
			}else{
				que.push({{cnt + 1,-(l - e.second)},e.first});
			}
		}
	}
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int i,j,n,m,q;
	ll l;
	cin >> n >> m >> l;
	for(i=0;i<m;i++){
		int a,b,c;
		cin >> a >> b >> c; a--; b--;
		if(c>l) continue;
		G[a].push_back({b,c});
		G[b].push_back({a,c});
	}
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			ans[i][j] = INF;
		}
	}
	for(i=0;i<n;i++){
		dijkstra(i,l);
	}
	cin >> q;
	for(i=0;i<q;i++){
		int s,t; cin >> s >> t; s--; t--;
		if(ans[s][t]<INF) cout << ans[s][t] << endl;
		else cout << -1 << endl;
	}
}

Measured memory_bytes: 5124
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=17,M=(1<<N);
const ll P=1e9+7;
ll fc[M],iv[M];
ll A(int n,int m){
	if(m<0 || m>n) return 0;
	return fc[n]*iv[n-m]%P;
}
ll fpw(ll a,ll x){
	ll s=1;
	for(;x;x>>=1,(a*=a)%=P) if(x&1) (s*=a)%=P;
	return s;
}
int n,m,a[N],p[N];
ll f[N][M],ans;
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	fc[0]=1; for(int i=1;i<M;i++) fc[i]=fc[i-1]*i%P;
	iv[M-1]=fpw(fc[M-1],P-2);
	for(int i=M-2;~i;i--) iv[i]=iv[i+1]*(i+1)%P;
	cin>>n>>m; p[0]=1; for(int i=1;i<=n;i++) p[i]=(p[i-1]<<1);
	for(int i=1;i<=m;i++) scanf("%d",&a[i]);
	reverse(a+1,a+m+1); f[0][0]=1;
	for(int i=0;i<m;i++){
		for(int j=0;j<p[n];j++) if(f[i][j]){
			//printf("i=%d j=%d f=%lld\n",i,j,f[i][j]);
			ll x=f[i][j]; int s=0;
			for(int k=0;k<n;k++) if(j&p[k]) s+=p[k];
			(f[i+1][j]+=x)%=P;
			for(int k=0;k<n;k++) if(!(j&p[k])){
				//cout<<k<<" "<<x*A(p[n]-a[i+1]-s,p[k]-1)%P*p[k]<<endl;
				(f[i+1][j+p[k]]+=x*A(p[n]-a[i+1]-s,p[k]-1)%P*p[k])%=P;
			}
		}
	}
	for(int i=0;i<p[n];i++){
		int s=0,t=1;
		for(int j=0;j<n;j++){
			if(!(i&p[j])) s+=p[j];
			else t=-t;
		}
		(ans+=P+fc[s]*f[m][i]%P*t)%=P;
	}
	cout<<ans*p[n]%P<<endl;
	return 0;
}


Measured memory_bytes: 17664
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  int h, w;
    cin >> h >> w;
  int cnt[h][w];
  char mine[h][w];
    for(int i=0; i<h; i++)
      for(int j=0; j<w; j++){
        cin >> mine[i][j];
        cnt[i][j] = 0;
      }

    for(int i=0;i<h; i++)
      for(int j=0; j<w; j++){
        if(mine[i][j]=='#'){
          cnt[i][j] = -1;
          for(int p=-1; p<=1; p++){
            for(int q=-1; q<=1; q++){
              if(0<=i+p && i+p<h && 0<=j+q && j+q<w && cnt[i+p][j+q]!=-1)
                cnt[i+p][j+q] += 1;
            }
          }
        }
      }

      for(int i=0; i<h; i++){
        for(int j=0; j<w; j++){
          if(cnt[i][j]<0) cout << '#';
          else cout << cnt[i][j];
        }
        cout << endl;
      }

}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int n;
	int i;
	int number[10000],walk1[10000],walk2[10000];
	int max = -1;
	int sum[10000];
	int x;
	while(scanf("%d",&n)){
		if(n == 0){
			break;
		}
		for(i = 0;i < n;i++){
			scanf("%d %d %d",&number[i],&walk1[i],&walk2[i]);
			sum[i] = walk1[i] + walk2[i];
			if(max < sum[i]){
				x = number[i];
				max = sum[i];
			}
		}
		printf("%d %d\n",x,max);
		max = -1;
	}
	return 0;
}

Measured memory_bytes: 716
#include <bits/stdc++.h>
using namespace std;
 
int main(void){
  long long a, b, c;
  cin >> a >> b >> c;
  long long d = c - a - b;
  if(d < 0) cout << "No";
  else if(d * d > 4 * a * b) cout<< "Yes";
  else cout <<  "No";
  return 0;
}


Measured memory_bytes: 256
using System;

namespace ConsoleApplication26
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            string A = Console.ReadLine();
            int q = int.Parse(A);
            string Point = null;
            string order = null;
            string p = null;
            for (int i = 0; i < q; i++)
            {
                string[] Order = Console.ReadLine().Split(); ;
                order = Order[0].ToString();
                int a = int.Parse(Order[1]);
                int b = int.Parse(Order[2]);

                if (order == "print")
                {
                    Console.WriteLine(str.Substring(a, b - a + 1));
                }
                else if (order == "reverse")
                {
                    for (int j = b; j >= a; j--)
                    {
                        char point = str[j];
                        Point = Point + point;
                    }
                    str = str.Substring(0, a) + Point + str.Substring(b + 1);
                    Point = string.Empty;
                }
                else if (order == "replace")
                {
                    p = Order[3].ToString();
                    str = str.Substring(0, a) + p + str.Substring(b + 1);
                }
            }
        }
    }
}

Measured memory_bytes: 9492
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...)name
#define _rep(i,n)repi(i,0,n)
#define repi(i,a,b)for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define MSVC_UNKO(x)x
#define rep(...)MSVC_UNKO(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define all(c)c.begin(),c.end()
#define write(x)cout<<(x)<<'\n'
using namespace std; typedef long long ll; template<class T>using vv = vector<vector<T>>;
template<class T>auto vvec(int n, int m, T v) { return vv<T>(n, vector<T>(m, v)); }
constexpr int INF = 1 << 29, MOD = int(1e9) + 7; constexpr ll LINF = 1LL << 60;
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(10); }; }aaaa;

int main() {
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i, N) cin >> A[i];

    constexpr int Amax = 2e3;
    constexpr int Nmax = 2e3;
    bitset<Amax * Nmax + 1> bs;
    bs[0] = 1;
    rep(i, N) bs |= bs << A[i];
    
    int sum = accumulate(all(A), 0);
    rep(i, (sum + 1) / 2, Amax * Nmax + 1) {
        if (bs[i]) {
            write(i);
            return 0;
        }
    }
}

Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan=new Scanner(System.in);
		int a=scan.nextInt();
		String S=scan.next();
		
		if(a>=3200)
		{
			System.out.println(S);
		}
		else
		{
			System.out.println("red");
		}
	}

}

Measured memory_bytes: 35744
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<tuple>
#include<set>
#include<map>
#include<cctype>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
#define tget(a,b) get<a>(b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;
const int MOD = 1e9 + 7;
pair < ll, ll > dp[55];

ll N, K, h[100005];
ll cnt(ll N,ll K) {
	if (N == 1) {
		if (K <= 1) { K = 0; return 0; }
		else { K--; ll unko = K; K = 0; return min(unko, ll(3)); }
	}

	ll ans = 0;
	if (K == 1) { return ans; }
	K--;
	if (K < dp[N - 1].first) {return ans+cnt(N - 1,K); }
	else {
		ans += dp[N - 1].second;
		K -= dp[N - 1].first;
		}
	if (K == 0) return ans;
	K--; ans++;
	if (K == 0) return ans;
	if (K < dp[N - 1].first) { return ans+cnt(N - 1,K); }
	else {
		ans += dp[N - 1].second;
		K -= dp[N - 1].first;
	}
	return ans;
	}

int main(void) {
	dp[1].first = 5; dp[1].second = 3;
	FOR(i, 2, 51) {
		dp[i].first = 2*dp[i - 1].first + 3;
		dp[i].second = 2 * dp[i - 1].second + 1;
	}
	cin >> N>>K;

	ct(cnt(N,K));
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a != 2 && b != 2){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 23764
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():




    n = I()
    d = LI()
    mod = 998244353
    
    dcnt = [0]*(max(d)+1)
    

    for x in d:
        dcnt[x] += 1

    nexist = d[0]!=0 or 0 in dcnt or 0 in d[1:]
    if nexist:
        print(0)
        exit(0)

    
    ans = 1

    for i in range(1, len(dcnt)):
        ans *= pow(dcnt[i-1], dcnt[i], mod)
        ans %= mod

    print(ans)
                    


main()


Measured memory_bytes: 21488
#include <atcoder/maxflow>
#include <cstdio>
#define rep(i, j, n) for (int i = 0; i < n; ++i)

int n, m;
char g[100][101];
int dx[4]{0, 0, 1, -1};
int dy[4]{1, -1, 0, 0};
int main() {
  scanf("%d%d", &n, &m);
  rep(i, 0, n) scanf("%s", g[i]);

  int s = n * m;
  int t = n * m + 1;
  atcoder::mf_graph<int> mf(n * m + 2);
  rep(y, 0, n) rep(x, 0, m) if ((x + y) % 2 == 0 && g[y][x] == '.')
    rep(k, 0, 4) {
    int ny = y + dy[k];
    int nx = x + dx[k];
    if (0 <= nx && nx < m && 0 <= ny && ny < n && g[ny][nx] == '.')
      mf.add_edge(y * m + x, ny * m + nx, 1);
  }
  rep(y, 0, n) rep(x, 0, m) {
    if ((x + y) % 2 == 0)
      mf.add_edge(s, y * m + x, 1);
    else
      mf.add_edge(y * m + x, t, 1);
  }

  int c = mf.flow(s, t);
  for (auto e : mf.edges()) {
    if (e.flow == 1) {
      int a = e.to;
      int b = e.from;
      if (a > b) std::swap(a, b);
      if (b >= n * m) continue;
      if (a / m == b / m) {
        g[a / m][a % m] = '>';
        g[b / m][b % m] = '<';
      } else {
        g[a / m][a % m] = 'v';
        g[b / m][b % m] = '^';
      }
    }
  }
  printf("%d\n", c);
  rep(i, 0, n) printf("%s\n", g[i]);
}

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

int main() {
    int x;
    cin >> x;
    if(x==1) x=0;
    else x=1;
    cout << x << endl;
    return 0;
}

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

const int MOD = 1e9 + 7;

int main() {
    int n, s, i, x;
    long long ans = 0;

    cin >> n >> s;
    for (i = 1; i < n; i++) {
        cin >> x;
        ans += (long long)x * (long long)s % MOD;
        s += x;
        if (s >= MOD) s-= MOD;
    }
    cout << ans % MOD<< "\n";
    return 0;
}


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

int main()
{
  int64_t ans = 0, as = 0;
  string S;
  cin >> S;
  if (S.size() >= 3)
  {
    for (int i = 0; i < S.size() - 2; i++)
    {
      if (S[i] == 'A')
        as++;
      else
        as = 0;
      if (S[i] == 'A' && S[i + 1] == 'B' && S[i + 2] == 'C')
      {
        ans += as;
        string str1 = "BC", str2 = string(as, 'A');
        str1.append(str2);
        S.replace(i - as + 1, str1.size(), str1);
        as--;
        i++;
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#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 get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
int main() {
    ll n;
    cin >> n;
    ll ans = LINF;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i) continue;
        chmin(ans, i + n / i);
    }
    cout << ans - 2 << endl;
}

Measured memory_bytes: 256
def primes_sieve(limit):
    a = [True] * limit
    a[0] = False

    for (i, is_prime) in enumerate(a):
      p = i+1
      if is_prime:
        yield p
        for n in range(p, limit, p):
          a[n-1] = False
                
def trial_division(n):
    if n < 2:
        return set()
    prime_factors = set()
    for p in primes_sieve(int(n**0.5)):
      if p*p > n: break
      while n % p == 0:
        prime_factors.add(p)
        n //= p
    if n > 1:
        prime_factors.add(n)
    return prime_factors

A, B = map(int, input().split())
Ap = trial_division(A)
ans = [i for i in Ap if B % i == 0]
print(len(ans)+1)

Measured memory_bytes: 10868
#include <iostream>
//#include <iomanip>
#include <string>
//#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <bitset>
//#include <math.h>
using namespace std ;
//using ll = long long ;
//using ld = long double ;
//using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;

//ll mod = 1000000007 ;
//long double pie = acos(-1) ;

//string yorn(bool a){if(a) return"Yes" ; return "No" ;}
//string YorN(bool a){if(a) return"YES" ; return "NO" ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}

int main(){
	string s ; cin >> s ;
	string sub = "CODEFESTIVAL2016" ;
	int cnt = 0 ;
	for(int i=0;i<16;i++) if(s.at(i)!=sub.at(i)) cnt++ ;
	cout << cnt << endl ;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;

int main(){
    int n;
    cin >> n;
    REP(i,n){
	int m;
	cin >> m;
	int a;
	int ansh = 0;
	int ansl = 0;
	cin >> a;
	REP(i,m-1){
	    int temp;
	    cin >> temp;
	    ansh = max(temp-a,ansh);
	    ansl = min(temp-a,ansl);
	    a = temp;
	}
	cout << ansh << " " << abs(ansl) << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
#define MAXN 3010010
#define Max 25
using namespace std;
 
int arr[MAXN];
int BitCount[Max];

int main()
{	
		   // freopen("in.txt" , "r" , stdin);
	       int a , b , c , d;
	       cin >> a >> b >> c >> d;
	       if(abs(c - a) <= d) cout << "Yes" << endl;
	       else if(abs(c - b) <= d && abs(b - a) <= d) cout << "Yes" << endl;
	       else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    int N;
    cin >> N;
    int ans = 0;
    for ( int i = 1; i <= N; i += 2 ) {
        int cnt = 0;
        for ( int j = 1; j <= i; j++ ) {
            if ( i%j == 0 ) { cnt++; }
        }
        if ( cnt == 8 ) { ans++; }
    }
    cout << ans << endl;

    return 0;
}

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

int main(){
  int n;
  int count=0;
  int maxhen;
  int soeji;
  int nihen;
  cin >> n;
  vector<long long> l(n);
  for(int i=0;i<n;i++){
    cin >> l.at(i);
  }

  for(int i=0;i<n-2;i++){
    for(int j=i+1;j<n-1;j++){
      for(int k=j+1;k<n;k++){
        if((l.at(i)==(l.at(j))||(l.at(i)==l.at(k))||(l.at(j)==l.at(k)))){
          continue;
        }
        if(l.at(i)>=l.at(j)){
          maxhen=l.at(i);
          soeji=i;
        }else{
          maxhen=l.at(j);
          soeji=j;
        }
        if(l.at(k)>=maxhen){
          maxhen=l.at(k);
          soeji=k;
        }

        if(soeji==i){
          nihen=l.at(j)+l.at(k);
        }else if(soeji==j){
          nihen=l.at(i)+l.at(k);
        }else{
          nihen=l.at(i)+l.at(j);
        }

        if(maxhen<nihen){
          count++;
        }

      }
    }
  }
  cout << count << endl;

  return(0);
}


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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;

//status unsolved
bool exist[1000010]={};

long long ans=0;

bool check(long long a){
    
    for(long long i=1;i<=sqrt(a);i++){
        if(a%i==0 && (exist[i] || exist[a/i])){
            return false;
        }
    }
    return true;
}

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

    vector<long long>A(n);
    map<long long,int>mp;
    
    rep(i,n){
        cin>>A[i];
        
        if(mp.find(A[i])==mp.end()){
            mp.insert(make_pair(A[i],1));
        }
        else{
            mp[A[i]]++;
        }
        
    }   

    sort(A.begin(),A.end());
    bool ok[1000010]={};
    rep(i,n){
        if(check(A[i])){
            ans++;
            ok[A[i]]=true;
        }
        exist[A[i]]=true;
    }
    
    for(auto it:mp){
        if(it.second>=2 && ok[it.first]){
            ans--;
        }
    }
    
    cout<<ans<<endl;

    
    return 0;

}
/*

5
2 2 3 4 5
*/


Measured memory_bytes: 18448
//
// Created on 2020/09/13.
//


#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
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; }
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;



int main() {
    ll a,b,c,d;
    cin>>a>>b>>c>>d;

    ll ans = -1 * LINF;
    chmax(ans,a*c);
    chmax(ans,a*d);
    chmax(ans,b*c);
    chmax(ans,b*d);
    cout<<ans<<endl;


    return 0;
}


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

using namespace std;
using ll = long long;

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

    int x;
    cin >> x;

    if(x >= 1800) printf("1\n");
    else if(x >= 1600) printf("2\n");
    else if(x >= 1400) printf("3\n");
    else if(x >= 1200) printf("4\n");
    else if(x >= 1000) printf("5\n");
    else if(x >= 800) printf("6\n");
    else if(x >= 600) printf("7\n");
    else if(x >= 400) printf("8\n");

    return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <list>
#include <stack>
#include <string>
#include <tuple>
#include <functional>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <map>
#include <random>
#include <cstdlib>
#define INT_MAX 2147483647
#define Loop(i, n) for(int i = 0; i < (int)n; i++)
#define Loop1(i, n) for(int i = 1; i < (int)n; i++)
#define Loopr(i, n) for(int i= (int)n - 1; i >= 0; i--)
using namespace std;
typedef long long int ll;


struct node {
	int key;
	node *left, *right;
};

node* NIL = (node*)malloc(sizeof(node));
node* root;
int k;

void insert(node** focus) {
	if (*focus == NIL) {
		node* buf = (node*)malloc(sizeof(node));
		buf->key = k;
		buf->left = NIL;
		buf->right = NIL;
		*focus = buf;
	}
	else if (k < (*focus)->key) insert(&((*focus)->left));
	else insert(&((*focus)->right));
}
void print_in(node* focus) {
	if (focus == NIL) return;
	print_in(focus->left);
	printf(" %d", focus->key);
	print_in(focus->right);
}

void print_pre(node* focus) {
	if (focus == NIL) return;
	printf(" %d", focus->key);
	print_pre(focus->left);
	print_pre(focus->right);
}

void print() {
	print_in(root);
	printf("\n");
	print_pre(root);
	printf("\n");
}

int main() {
	int m;
	root = NIL;
	cin >> m;
	string query;
	Loop(i, m) {
		cin >> query;
		if (query == "insert") {
			scanf("%d", &k);
			insert(&root);
		}
		else print();
	}
	return 0;
}

Measured memory_bytes: 18924
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
	int N; cin >> N;
	string S;
	vector<string> Slist;
	for(int i=0; i<N; ++i){
	    cin >> S;
	    Slist.push_back(S);
	}
	string T; cin >> T;
	int min=1, max=N+1;
	for(int i=0; i<N; ++i){
	    string Sa, Sz;
	    for(int j=0; j<Slist[i].size(); ++j){
	        if(Slist[i][j]=='?'){
	            Sa += 'a';
	            Sz += 'z';
	        }
	        else{
	            Sa += Slist[i][j];
	            Sz += Slist[i][j];
	        }
	    }
	    if(Sz<T) ++min;
	    if(T<Sa) --max;
	}
	for(int i=min; i<=max; ++i){
	    cout << i;
	    if(i<max) cout << ' ';
	}
	cout << endl;
	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
 
using namespace std;
 
int main(){
	
	long long int n;
	cin>>n;
	
	int p=(63-__builtin_clzll(n));
  	long long ans = 1LL<<p;
	cout<<(2*ans-1);
	
	return 0;		
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll, vl/*, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll a, b;
  cin >> a >> b;
  cout << max(a+b, max(a-b, a*b)) << newl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
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; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    int n;
    cin >> n;
    vector<int> a(n), b(n);
    REP(i, n) cin >> a[i] >> b[i];

    bool res = false;

    for(int i = 0; i < n; i++) {
        if (i+2 > n-1) break;

        if (a[i] == b[i] && a[i+1] == b[i+1] && a[i+2] == b[i+2]) {
            res = true;
        }
    }
    
    cout << (res ? "Yes" : "No") << endl;

    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <map>
#include <set>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;

	bool yaku = false;

	for (int i = 1; i <= b; i++) {
		if (b % a == 0) {
			yaku = true;
			break;
		}
	}

	if (yaku) cout << a + b << endl;
	else cout << b - a << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Node{
    int parent,left,right;
    Node(){
        parent=-1;left=-1;right=-1;
    }
};

int node_depth(Node T[],int D[],int node){
    if(D[node]!=-1)return D[node];
    if(T[node].parent==-1)D[node]=0;
    else D[node]=1+node_depth(T,D,T[node].parent);
    return D[node];
}


int main(){
    int n;cin>>n;
    Node Tree[n];
    int id,k,children,prec;
    int Depth[n];
    for(int i=0;i<n;i++)Depth[i]=-1;
    for(int i=0;i<n;i++){
        scanf("%d %d",&id,&k);
        if(k>0){
            scanf("%d",&children);
            Tree[id].left=children;
            Tree[children].parent=id;
        }
        for(int j=1;j<k;j++){
            prec=children;
            scanf("%d",&children);
            Tree[prec].right=children;
            Tree[children].parent=id;
        }
    }
    for(int i=0;i<n;i++){
        printf("node %d: parent = %d, ",i,Tree[i].parent);
        printf("depth = %d, ",node_depth(Tree,Depth,i));
        if(Tree[i].parent==-1)printf("root");
        else{
            if(Tree[i].left==-1)printf("leaf");
            else printf("internal node");
        }
        printf(", [");
        int j=Tree[i].left;
        while(j!=-1){
            if(j!=Tree[i].left)printf(", ");
            printf("%d",j);
            j=Tree[j].right;
        }
        printf("]\n");
    }
}


Measured memory_bytes: 4728
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <climits>

#define size_t int

using namespace std;

int main(int argc, char const *argv[]) {
  int N;
  scanf("%d", &N);
  int r;
  if (N%2) {
    r = (N/2) * ((N+1)/2);
  } else {
    r = (N/2) * (N/2);
  }
  printf("%d\n", r);
  return 0;
}


Measured memory_bytes: 128
N = gets.to_i
l_list = gets.split(' ').take(N).map(&:to_i).sort_by { |n| -n }
max_l = l_list.first
rest_l_list = l_list.drop(1)
rest_l_sum = rest_l_list.reduce(0) { |acc, n| acc + n }
ans = max_l < rest_l_sum ? 'Yes' : 'No'
puts ans


Measured memory_bytes: 1788
#include <iostream>
#include <algorithm>
using namespace std;
const int N = 102;

int main() {
    int n; cin >> n;
    int p[N+1], m[N+1][N+1];
    for(int i=1;i<=n;i++) cin >> p[i-1] >> p[i];
    for(int i=1;i<=n;i++) m[i][i] = 0;
    for(int l=2;l<=n;l++) {
        for(int i=1;i<=n-l+1;i++) {
            int j = i + l - 1;
            m[i][j] = (1 << 21);
            for(int k=i;k<=j-1;k++) {
                m[i][j] = min(m[i][j],m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j]);
            }
        }
    }
    cout << m[1][n] << endl;
    return 0;
}



Measured memory_bytes: 3128
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef vector<LL> 		VL;
typedef unsigned long long int ULL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//Works for forward as well as backward iteration

#define gu getchar
#define pu putchar
#define si(n) cin>>n
#define dout(n) cout<<n<<"\n"
//# define M_PI           3.14159265358979323846264338327950288

#define DRT() int t; si(t); while(t--)

#define PlUSWRAP(index,n) index = (index+1)%n		//index++; if(index>=n) index=0
#define MINUSWRAP(index,n) index = (index + n -1)%n 	//index--; if(index<0) index=n-1
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)	//Round off d to nearest integer

#define FLUSHN while(gu()!='\n')
#define FLUSHS while(gu()!=' ')

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.
LL n,m,k;
VL arr,brr;
bool f(LL mid){
	LL minC = 1e18;
	for(int i=max((LL)0,mid - m);i<=min(n,mid);i++){
		LL c = arr[i];
		c += brr[mid - i];
		minC = min(minC, c);
	}
	return (minC <= k);
}
int main() {
	#ifndef ONLINE_JUDGE
    freopen("../input.txt", "r", stdin);
    freopen("../output.txt", "w", stdout);
	#endif
	srand(chrono::steady_clock::now().time_since_epoch().count());
	off;
	cin>>n>>m>>k;
	arr.resize(n+1);
	brr.resize(m+1);
	arr[0] = 0;
	brr[0] = 0;
	rep(i,1,n+1){
		cin>>arr[i];
	}
	rep(i,1,m+1){
		cin>>brr[i];
	}
	rep(i,2,n+1){
		arr[i] += arr[i-1];
	}
	rep(i,2,m+1){
		brr[i] += brr[i-1];
	}
	// search number of books
	LL l = 1, h = n+m;
	LL ans = 0;
	while(l <= h){
		LL mid = l + (h - l)/2;
		if(f(mid)){
			ans = mid;
			l = mid+1;
		}
		else{
			h = mid -1;
		}
	}
	cout<<ans;
  	return 0;
}

Measured memory_bytes: 6424
#include <stdio.h>

int main(void)
{
    int N, c;
    long long ans = 0;
    scanf("%d", &N);
    for (c = 1; c <= N; ++c)
    {
        if (c % 3 != 0 && c % 5 != 0)
        {
            ans += c;
        }
    }
    printf("%ld", ans);
    return 0;
}

Measured memory_bytes: 1688