akhauriyash/Code-Regression huggingface dataset:
/*
auth - @sportykush
*/

#include <bits/stdc++.h>
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; 
// using namespace __gnu_pbds;

typedef long long int ll;
typedef long double ld;

//#define mp make_pair
#define bug(v)                    cerr<<#v<<" = "<<(v)<<endl;
#define bug2(v1,v2)               cerr<<#v1<<" = "<<(v1)<< ' ' << #v2<<" = "<<(v2)<<endl;
#define ERASE(x)                  x.erase(unique(x.begin(),x.end()),x.end())
#define pb                        emplace_back
#define vii                       vector<int>
#define vll                       vector<ll>
#define vpll                      vector< pair <ll,ll> >
#define pll                       pair <ll,ll>
#define pii                       pair <int,int>
#define pq                        priority_queue< int >
#define khtm                      "\n"
#define F                         first
#define S                         second
#define fr(i,a,n)                 for(i=a;i<n;i++)
#define mem(arr,l)                memset(arr,l,sizeof arr)
#define ALL(x)                    x.begin(), x.end()
#define frr(i,a,n)                for(i=n-1;i>=a;i--)
#define fast                      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define testcase                  ll T; cin>>T; while(T--)


const double pi = 3.14159265359;
const int MAX = 1e6 +2;
const ll inf =  1e18;
const int N = 1010;
const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
//const ll mod = 998244353;
const ll mod = 1000000007;
inline ll add(ll a,ll b){a+=b;if(a>=mod)a-=mod;return a;}
inline ll mul(ll a,ll b){return (((a+mod)%mod)*(b+mod)%mod)%mod;}
inline ll power(ll a,ll b){ll rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}
inline ll modInverse(ll n, ll p){ return power(n, p-2)%p; }

/*
important builtin functions
__gcd(value1, value2)
__builtin_ffs(x)
  Number of leading zeroes: __builtin_clz(x)
  Number of trailing zeroes : __builtin_ctz(x)
  Number of set bits: __builtin_popcount(x)
*/
 
void stArt()
{
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
}
void eNd()
{
	#ifndef ONLINE_JUDGE
  	cout<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s";
  	#endif
}

//////////////////// start /////////////////////////////////
 

ll i,j,k,l,m,r,n;
ll a[MAX],b[MAX];

int main()
{
 
stArt();
fast
//cout << setprecision(15) << fixed;

cin >> n >> k;
fr(i,1,1+n)
	cin >> a[i];
fr(i,1,1+n)
	cin >> b[i];

ll ans = -inf;
fr(i,1,1+n)
{
	ll sum = b[i];
	j = a[i];
	ll cnt = 1;
	while(j!=i)
	{
		sum+=b[j];
		j = a[j];
		cnt++;
	}
	ll cur = 0;
	l = k;
	if(sum>=0)
	{
		cur += (l/cnt)*sum;
		l%=cnt;
		if(!l)
			l+=cnt,cur-=sum;
	}
	else
		l = min(l,cnt);
	sum =0;
	ll x,mx = -inf;
	j = a[i];
	fr(x,1,1+l)
	{
		sum += b[j];
		mx = max(mx,sum);
		j = a[j];
	}	
	cur+=mx;
	ans = max(cur,ans);
}
cout << ans;


 eNd();
  return 0;
 
}

Measured memory_bytes: 3716
N = int(input())
WholeS = input()

ans = 0
for l in range(N):
    # Z-algorithm
    A = [-1]*(N-l)
    c = 0
    S = WholeS[l:]
    for i, s in enumerate(S):
        if i == 0:
            continue
        if c+A[c] > i+A[i-c]:
            A[i] = A[i-c]
        else:
            j = max(0, A[c]-i+c)
            while i+j < N-l and S[j] == S[i+j]:
                j += 1
            A[i] = j
            c = i
        ans = max(ans, A[i] if(i>A[i]) else i)

print(ans)


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

int n, y;
int main()
{
	int i, j, k;
	cin >> n >> y;
	for (i = 0; i <= n; i++) {
		for (j = 0; j <= n; j++) {
			k = (y - i * 10000 - j * 5000) / 1000;
			if (k >= 0 && i + j + k == n) {printf("%d %d %d", i, j, k); return 0;}
		}
	}
    cout << "-1 -1 -1" << endl;
    return 0;
}

Measured memory_bytes: 256
/*input

*/


// assic value of ('0'-'9') is(48 - 57) and (a-z) is (97-122) and (A-Z) is(65-90) and 32 for space
// #pragma GCC target ("avx2")
// #pragma GCC optimization ("O3")
// #pragma GCC optimization ("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define ll          long long int
#define pb          push_back
#define pii         pair<ll ,ll >
#define vpii        vector< pii >
#define vi          vector<ll >
#define vs			vector< string >
#define vvi         vector< vector< ll > >
#define inf			(ll)1e18
#define all(it,a)   for(auto it=(a).begin();it!=(a).end();it++) 
#define F           first
#define S           second
#define sz(x)       (ll )x.size()
#define rep(i,a,b)	for(ll  i=a;i<b;i++)
#define repr(i,a,b) for(ll  i=a;i>b;i--)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define mp          make_pair
#define whatis(x)   cout << #x << " is " << x << "\n";
#define graph(n)    adj(n,vector< ll > () )
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define debug(x)     cout << #x << " " << x << endl;
#define debug_p(x)   cout << #x << " " << x.F << " " << x.S << endl;
#define debug_v(x)   {cout << #x << " "; for (auto ioi : x) cout << ioi << " "; cout << endl;}
#define debug_vp(x)  {cout << #x << " "; for (auto ioi : x) cout << '[' << ioi.F << " " << ioi.S << ']'; cout << endl;}
#define debug_v_v(x) {cout << #x << "/*\n"; for (auto ioi : x) { for (auto ioi2 : ioi) cout << ioi2 << " "; cout << '\n';} cout << "*/" << #x << endl;}

int solve()
{
	double r;cin>>r;
	cout<<setprecision(25)<<2*acos(-1)*r<<"\n";
	return 0;
}

int main()
{
	auto start = chrono::high_resolution_clock::now();

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

	ll test_cases=1;
	//cin>>test_cases;
	while(test_cases--)
		solve();

	auto stop = chrono::high_resolution_clock::now();
	auto duration = chrono::duration_cast<chrono::milliseconds>(stop-start);
	//cout<<"\nduration: "<<(double)duration.count()<<" milliseconds";
}

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

int main() {
  string s;
  cin >> s;
  int s0 = 0, s1 = 0;
  for(auto x : s) {
    if(x == '0')
      s0++;
    else
      s1++;
  }
  cout << min(s0, s1) * 2 << endl;
}


Measured memory_bytes: 512
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# 解説に従い実装

N=int(input())

for i in range(N):
    ti,ai = map(int,input().split())
    if i == 0:
        t,a = ti,ai
    else:
        # t <= n * ti and a <= n * ai を満たす最小のnを求める
        n = max((t + ti - 1) // ti, (a + ai - 1) // ai)
        t = n * ti
        a = n * ai

print(a+t)


Measured memory_bytes: 3064
import sys

p = sys.stdin.readlines()
r = 0
for i in p:
	n,x = map(int,i.split())
	if n==0 and x==0:
		break
	else:
		for a in range(1,n+1):
			for b in range(1,n+1):
				if a==b:
					break
				else:
					for c in range(1,n+1):
						if a==c or b==c:
							break
						elif a+b+c==x:
							r+=1
	print r
	r = r*0

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

int main(){
  int n, k, xi;
  int ans = 0;
  cin >> n >> k;

  rep(i, n){
    cin >> xi;
    if(xi < k - xi){
      ans += xi;
    }
    else{
      ans += (k - xi );
    }
  }

  cout << ans * 2 << endl;


}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int N;
	cin >> N;
	int a[109];
	for (int i = 0; i < N; i++) {
		cin >> a[i];
	}
	sort(a,a+N);
	cout << a[N - 1] - a[0] << endl;
}

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

#define DEBUG 0

#if DEBUG
  #define DLOG(...) fprintf(stderr, __VA_ARGS__)
#else
  #define DLOG(...)
#endif

void debug(auto f) {
#if DEBUG
  f();
#endif
}

ll N, M;
vector<ll> vecA;

bool sat(ll m) {
  ll left = 2*m;
  ll right = 2*N - 1;
  while (left < right) {
    if (vecA.at(left) + vecA.at(right) < M)  return false;
    left ++;
    right --;
  }
  return true;
}

ll binsch(ll l, ll r) {
  while (l + 1 < r) {
    ll mid = (l + r) / 2;
    if (sat(mid))  r = mid;
    else           l = mid;
  }
  return r;
}

ll calc(ll left, ll right, ll shift, ll res) {
    while (left < right) {
      ll v = vecA.at(left) + vecA.at(right) - shift;
      DLOG("v %lld", v);
      if (res < v)  res = v;
      left++;
      right--;
    }
    return res;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> N >> M;
  vecA.resize(2*N);
  for (ll i = 0; i < 2*N; i++)  cin >> vecA.at(i);
  sort(vecA.begin(), vecA.end());
  ll border = binsch(-1, N);
  DLOG("border %lld\n", border);
  ll ans = calc(0, 2*border-1, 0, 0);
  ans = calc(2*border, 2*N-1, M, ans);
  cout << ans << endl;
  
  return 0;
}



Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
#define rep(i, n) for(int i=0;i<(n);i++)
#define all(v) v.begin(), v.end()
#define MOD 1e7
const long long INF = 1LL<<60;

void fast() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
int main() {
    fast();
    ll n;
    cin>>n;
    ll a[n];
    rep(i, n)
        cin>>a[i];
    ll m=a[0], ans=0;
    for(int i=1;i<n;i++) {
        if(a[i] < m) {
            ans += m-a[i];
        }
        m = max(m, a[i]);
    }
    cout<<ans;
    return 0;
}

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

int main() {
  int w,h;
  int x,y;
  cin >> w >> h;
  cin >> x >> y;
  double wd,wh,s;
  int p;
  
  p = 0;
  
  if(w % 2 == 0 && h % 2 == 0 && x == w / 2 && y == h / 2 ){
    p = 1;  
  }
  
  wd = (double) w;
  wh = (double) h;
  s = wd * wh;
  s = s / 2;
  cout << fixed << setprecision(10) << s << " " << p << endl; 
 
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		char[] c = s.toCharArray();
		int ans = 0;
		int l = 0;
		boolean flag = false;
		for(int i = 0; i < c.length; i++) {
			if(c[i] == 'A' || c[i] == 'C'
					|| c[i] == 'G' || c[i] == 'T') {
				l++;
				flag = true;
			}else {
				if(flag && ans <= l)ans = l;
				flag = false;
				l = 0;
			}
		}
		if(flag && ans <= l)ans = l;
		System.out.println(ans);
	}

}

Measured memory_bytes: 23252
N,M = map(int,input().split())

A_li = [0]*M

for i in range(N):
    A = list(map(int,input().split()))  
    K = A.pop(0)
    for j in range(K):
        A_li[A[j]-1] += 1


ans = 0
for i in range(M):
    if(A_li[i]==N):
        ans +=1
print(ans)

Measured memory_bytes: 38384
//By: Luogu@rui_er(122461)
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6+5;

bool _;
int k, md, i = 1;
int book[N];

int main() {
	scanf("%d", &k);
	md = 7 % k;
//	printf("%d\n", md);
	while(!book[md]) {
		if(!md) {
			_ = true;
			break;
		}
		book[md] = 1;
		md = (md * 10 + 7) % k;
//		printf("%d\n", md);
		++i;
	}
	if(!_) {
		puts("-1");
	}
	else {
		printf("%d\n", i);
	}
	return 0;
}

Measured memory_bytes: 7728
from math import ceil
D,G=map(int,input().split())
pc=[]
ans=[]
for _ in range(D):
    pc.append(list(map(int,input().split())))

for n in range(2**D):
    X=format(n,'b').zfill(D)
    Sum=0
    solved=0
    for k in range(D):
        if X[k]=="1":
             Sum+=100*(k+1)*pc[k][0]+pc[k][1]
             solved+=pc[k][0]
    if Sum>=G:
        ans.append(solved)
    else:
        for i in range(D):
            if X[D-i-1]=="1":
                pass
            else:
                if Sum+(pc[D-i-1][0]-1)*100*(D-i)<G:
                    pass
                else:
                    ans.append(solved+ceil((G-Sum)/(100*(D-i))))

print(min(ans))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
    int x;
    char c;
    int f=1;
    while((c=getchar())!='-' && (c>'9' || c<'0'));
    if(c=='-') f=-1,c=getchar();
    x=c^'0';
    while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
    return x*f;
}
inline ll readll(){
    ll x;
    char c;
    int f=1;
    while((c=getchar())!='-' && (c>'9' || c<'0'));
    if(c=='-') f=-1,c=getchar();
    x=c^'0';
    while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
    return x*f;
}
const int maxn=1e5+10;
int a[maxn];
int main(){
    int n=read(),m=read();
    printf("%d\n",(n-m)/(m-1)+1+((n-m)%(m-1)>0));
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int A[4];
    rep(i, 4) {
        A[3-i] = N % 10;
        N /= 10;
    }
    rep(i, 8) {
        int tmp = i + 1;
        int ans = A[0];
        rep(j, 3){
            if (tmp % 2 == 0) ans += A[j+1];
            else ans -= A[j+1];
            tmp /= 2;
        }


        if (ans == 7) {
            tmp = i+1;
            cout << A[0];
            rep(j, 3) {
                if (tmp % 2 == 0) cout << "+";
                else cout << "-";
                tmp /= 2;
                cout << A[j+1];
            }
            cout << "=7" << endl;
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-03-13 02:32:36
**/

#include <iostream>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
#include <bitset>
#include <cassert>
#include <cctype>
#include <iomanip>
#include <random>
#include <utility>
#include <chrono>

using namespace std;

using int64 = long long;

template<class T> using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) { os << '{'; size_t n = vec.size(); for (size_t i = 0; i < n; ++i) { os << vec[i]; if (i != n - 1) os << ','; } os << '}'; return os; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) { return os << '{' << p.first << " " << p.second << '}'; }
template<class T, class U> std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) { os << '{'; for (auto it = mp.begin(); it != mp.end(); ++it) { os << '{' << it->first << ':' << it->second << '}'; if (it != --mp.end()) os << ','; } os << '}'; return os; }
template<class T> std::ostream& operator<<(std::ostream& os, const std::set<T>& st) { os << '{'; for (auto it = st.begin(); it != st.end(); ++it) { os << *it; if (it != --st.end()) os << ','; } os << '}'; return os; }
template<class T> std::istream& operator>>(std::istream& is, std::vector<T>& vec) { size_t n = vec.size(); for (size_t i = 0; i < n; ++i) is >> vec[i]; return is; }

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...) 1728
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

using graph = std::vector<std::vector<int>>;

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

  int n, q; cin >> n >> q;
  graph g(n);

  for (int i = 0; i < n - 1; ++i) {
    int a, b; cin >> a >> b; --a; --b;
    g[a].emplace_back(b);
    g[b].emplace_back(a);
  }

  stack<int> st;
  vector<int> visited(n, 0);
  vector<int> counter(n, 0);

  for (int i = 0; i < q; ++i) {
    int p, x; cin >> p >> x;
    --p;
    counter[p] += x;
  }

  st.emplace(0);
  visited[0] = 1;

  while (!st.empty()) {
    int cur = st.top(); st.pop();
    for (int next : g[cur]) {
      if (visited[next]) continue;
      visited[next] = 1;
      counter[next] += counter[cur];
      st.emplace(next);
    }
  }

  for (int i = 0; i < n; ++i) {
    cout << counter[i] << " ";
  }
  cout << '\n';

  return 0;
}

Measured memory_bytes: 16372
#include <iostream>

using namespace std;

int n,c,ans = 1000000000;
int d[1001][1001];
int cc[501][501];
int co[3][31];


int main()
{
  

  cin >> n >> c;

  for(int i = 1;i <= c;i++){
    for(int j = 1;j <= c;j++){
      cin >> d[i][j];
    }
  }

  for(int i = 1;i <= n;i++){
    for(int j = 1;j <= n;j++){
      cin >> cc[i][j];
      co[(i+j)%3][cc[i][j]]++;
    }
  }

  for(int i = 1;i <= c;i++){
    for(int j = 1;j <= c;j++){
      for(int k = 1;k <= c;k++){
	if(i == j || j == k || k == i) continue;
	int ai = 0,aj = 0,ak = 0;
	for(int a = 1;a <= c;a++){
	  ai += co[0][a] * d[a][i];
	  aj += co[1][a] * d[a][j];
	  ak += co[2][a] * d[a][k];
	}
	if(ans > ai + aj + ak)
	  ans = ai + aj + ak;
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define rep(i, ns, ne) for (int i = ns; i < ne; ++i)
using namespace std;

// pair(y,x)と同じ
struct P {
  int y;
  int x;
  P(int _y, int _x) : y(_y), x(_x) {}
  // LHS = left-hand side RHS = right-hand side
  bool operator<(const P &rhs) const {
    // y の値を優先してソートするなら
    return y != rhs.y ? y < rhs.y : x < rhs.x;
  }
};

int main() {

  // 入力
  int H, W, M;
  cin >> H >> W >> M;

  vector<int> hs(H), ws(W);
  set<P> sp;

  rep(i, 0, M) {
    int y, x;
    cin >> y >> x;
    --y, --x;
    hs[y]++, ws[x]++;
    sp.emplace(y, x); //物がある座標
  }

  // 縦横の最大値
  int maxH = *max_element(hs.begin(), hs.end());
  int maxW = *max_element(ws.begin(), ws.end());

  // 縦最大だけのy座標
  vector<int> maxhs;
  rep(i, 0, H) {
    if (maxH == hs[i]) {
      maxhs.emplace_back(i);
    }
  }

  // 横最大だけのx座標
  vector<int> maxws;
  rep(i, 0, W) {
    if (maxW == ws[i]) {
      maxws.emplace_back(i);
    }
  }

// 縦最大と横最大の交点を確認
  int ans = maxH + maxW;
  for (auto yy : maxhs) {
    for (auto xx : maxws) {

      // 交点に物があるか確認
      if (sp.count(P(yy, xx))) {
        continue;
      }
      //交点に物が無い場所があったら終了
      cout << ans << endl;
      return 0;
    }
  }

  //交点に物が無い場所が無い場合は交差する1点を引く
  ans--;
  cout << ans << endl;
  getchar();
}


Measured memory_bytes: 23800
#include <stdio.h>

int main(){
  int i,j,n,q,sum=0;
  int S[10000];
  int T[500];

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }

  scanf("%d",&q);
  for(j=0;j<q;j++){
    scanf("%d",&T[j]);
  }
    for(j=0;j<q;j++){
       for(i=0;i<n;i++){
         if(S[i]==T[j]){
      	  sum++;
	  break;
      }
    }
  }
  printf("%d\n",sum);

  return 0;
}
  

Measured memory_bytes: 640
a,b,c,d=map(int,input().split())

index=0
for i in range(1000):
	if index==0:
		c=c-b
		if c<=0:
			print("Yes")
			break
		else:
			index=1
	else:
		a=a-d
		if a<=0:
			print("No")
			break
		else:
			index=0
			


Measured memory_bytes: 61592
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
template<typename T> inline void debug(const vector<T> &xs){
#ifdef DEBUG
	pr(xs);
#endif
}

int N, M;
vector<vector<int>> graph;
ll dfs(int u, int s){
	debug(any{u, s});
	s += 1<<u;
	if(s == (1<<N)-1) return 1;
	int r = 0;
	for(int v: graph[u]){
		if((s>>v)&1) continue;
		r += dfs(v, s);
	}
	return r;
}

int main(){
	cin >> N >> M;
	graph.assign(N, {});
	for(int i=0; i<M; i++){
		int a, b;
		cin >> a >> b;
		a--; b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}

	cout << dfs(0, 0) << endl;;

	return 0;
}


Measured memory_bytes: 256
from math import factorial as f
def comb(n, k):
  return f(n)//f(k)//f(n-k)

n, a, b = map(int, input().split())
V = sorted(map(int, input().split()))
s = sum(V[-a:]) / a
print(s)
small = V[-a]
cnt = V[-a:].count(small)
total = V.count(small)
if V[-1] != small:
  ans = comb(total, cnt)
else:
  ans = 0
  for i in range(a, min(b, total)+1):
    ans += comb(total, i)
print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;

int main(){
    bool rate[8];
    int count;
    int top_level;
    int N,a,i;

    for(i=0;i<8;i++){
        rate[i] = false;
    }
    top_level = 0;
    cin >> N;
    for(i=0;i<N;i++){
        cin >> a;
        if( a >= 3200){
            top_level++;
        }else{
            rate[a / 400] = rate[a/400] | 0x01;
        }
    }
    count = 0;
    for(i=0;i<8;i++){
        count += rate[i];
    }
    if(count > 0 ){
        cout << count << " " << count + top_level << endl;
    }else{
        cout << 1 << " " << top_level << endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll MOD = 924844033;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef long double ld;
typedef complex<ld> Point;
const ld eps = 1e-11;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;
typedef pair<ld, ld> LDP;
int main() {
	int n, x; cin >> n >> x;
	if (x == 1 || x == 2 * n - 1) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
		int now = x - n + 1;
		int m = 2 * n - 1;
		rep(i, m) {
			int out = (now + m) % m;
			if (out == 0)out = m;
			cout << out << endl;
			now++;
		}
	}
	return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>

int max(int a, int b, int c) {
    int p = a;
    if( p < b) { p = b; } 
    if( p < c) { p = c; }
    return p;
}

int min(int a, int b, int c) {
    int p = a;
    if( p > b) { p = b; }
    if( p > c) { p = c; }
    return p;
}

int main(void) {
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    printf("%d\n", max(a,b,c) - min(a,b,c));
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mod 1000000007
#define FT() int t; scanf("%d",&t); while(t--)
#define pb push_back
#define nl printf("\n")
#define fi(i,start,end) for(int i=start; i < (int)end ; ++i)
#define ip(n)   scanf("%d",&n)
#define mz(a)   memset(a,0,sizeof(a))
#define inpArr(A,n) fi(i,0,n)   ip(A[i]);
#define print(a)  for(auto i : a)   cout<<i<<" "; nl;
#define Fastio ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
ll max(ll a,ll b) { return a>b?a:b;}
ll min(ll a,ll b) { return a<b?a:b;}
void solve()
{   
}
int main() {
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif
    
    int n;
    cin>>n;
    int a[n];
    ll t = 0;
    fi(i,0,n)
        {cin>>a[i];
         t^=a[i];}
    fi(i,0,n)
        cout<<(t^a[i])<<" ";

    #ifndef ONLINE_JUDGE
    cout<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s";
    #endif
    return 0;
}


Measured memory_bytes: 4368
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int N;
    while(cin >> N){
        vector<int> pos(N);
        for(int i=0;i<N;i++){
            int t; cin >> t;
            pos[t-1] = i;
        }
        int res = 0;
        int len = 0;
        int pre = -1;
        for(auto& t : pos){
            if(t < pre) len = 1;
            else ++len;
            res = max(res, len);
            pre = t;
        }
        cout << N - res << endl;
    }
}

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

int main(){
    int H, W;
    cin >> H >> W;
    vector<string> mp(H);
    int x[4] = {-1, 0, 1, 0};
    int y[4] = {0, 1, 0, -1};
    bool flag;
    for(int i=0; i<H; i++){
	cin >> mp[i];
    }

    for(int i=0; i<H; i++){
	for(int j=0; j<W; j++){
	    if(mp[i][j]=='#'){
		flag = false;
		for(int k=0; k<4; k++){
		    if(i+y[k]<0 || j+x[k]<0 ||j+x[k]>=W || i+y[k]>=H )
			continue;
		    if(mp[i+y[k]][j+x[k]] == '#')
			flag=true;
		}
		if(!flag){
		    cout << "No" <<endl;
		    return 0;
		}
	    }

	}
    }
    cout << "Yes" <<endl;
    
}




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

#ifdef LOCAL_PC
	#define debug(args...) { cout.flush(); fflush(stdout); fprintf(stderr, args); }
#else
	#define debug(args...) ; /*  */
#endif
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define fi first
#define se second
using ll = long long;
using pii = pair<int, int>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class Ty> Ty rnd(Ty a, Ty b) { return uniform_int_distribution<Ty>(a, b)(rng); }

template<class num> inline void rd(num &x) {
	char c; while(isspace(c = getchar()));
	bool neg = false;
	if(!isdigit(c)) neg = (c == '-'), x = 0;
	else x = c - '0';
	while(isdigit(c = getchar()))
		x = (x << 3) + (x << 1) + c - '0';
	if (neg) x = -x;
} template <class T, class... Args> inline void rd(T& x, Args&... args) { rd(x); rd(args...); }

const int MAXN = 2e5 + 5, INF = 0x3f3f3f3f;

int main() {
	ios::sync_with_stdio(false); cin.tie(NULL);
	string s; cin >> s;
	if (s == "ABC") cout << "ARC" << endl;
	else cout << "ABC" << endl;
}



Measured memory_bytes: 3600
N, K = map(int, input().split())
A = [0] + list(map(int, input().split()))

cnt = {}
for i in range(1, N+1):
    cnt[i] = 0

root = [0]
loop = []
now = 1
tmp = 0
amari = 0
while cnt[now] != 2:
    cnt[now] += 1
    root.append(now)
    if cnt[now] == 2:
        tmp = now
        break
    amari += 1
    now = A[now]

while cnt[tmp] == 2:
    loop.append(tmp)
    tmp = A[tmp]
    cnt[tmp] += 1

amari -= len(loop)

if K <= amari:
    ans = root[K+1]
else:
    ind = amari + (K-amari)%len(loop) + 1
    ans = root[ind]

print(ans)



Measured memory_bytes: 40244
n, a, b = map(int, input().split())
p = 10**9+7

g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]

for i in range(2, 2 * (10 ** 5) + 1):
    g1.append((g1[-1] * i) % p)
    inverse.append((-inverse[p % i] * (p//i)) % p)
    g2.append((g2[-1] * inverse[-1]) % p)


def comb(n, a):
    ans = 1
    for i in range(1, a + 1):
        ans = ans * (n - i + 1) % p
    return ans * g2[a] % p


ans = (pow(2, n, p)-1-comb(n, a)-comb(n, b)) % p
print(ans)


Measured memory_bytes: 27120
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::collections::HashMap;
use std::cmp::{max,min};
fn main(){
    input!{
        a:i64,
        b:i64,
    }
    let mut ans = 0;
    let mut i = 1;
    while i < b {
        i -= 1;
        i += a;
        ans += 1;
    }
    println!("{}",ans);
}


fn is_prime(x:i64) -> bool {
    if x == 2 {return true;}
    if x < 2 || x % 2 == 0 {return false;}
    let mut j = 3;
    while j <= (x as f64).sqrt() as i64 {
        if x % j == 0 {
            return false;
        }
        j += 2;
    }
    true
}


Measured memory_bytes: 4352
/*
*
*	AUTHOR :- @soham01
*		// "WORK HARD AND NEVER GIVE UP" //
*
*/
#include "bits/stdc++.h"

using namespace std;

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> //find_by_order(), order_of_key()
#define pb push_back
#define mp make_pair 
#define vi vector<long long int >
#define vb vector<bool>
#define vs vector<string>
#define vd vector<double>
#define vvi vector<vector<long long int> >
#define vp vector<pair<long long int , long long int > >
#define seti set<long long int >
#define setc set<char>
#define setd set<double>
#define mod 1000000009
#define endl '\n'
typedef long long int lli;

// ITS MY REQUEST TO PLEASE PLEASE DO LOOK AT THE CONSTRAINS GIVEN CAREFULLY
// DO CHECK FOR CORNER CASES

/*-------LET THE GAME BEGIN-----------*/

void solve()
{
	int s;
	cin>>s;
	double l,h,b;
	l=(double)(s/3.0);
	b=((double)(s-l)/2.0);
	h=(double)(s-l-b);
	printf("%.12lf",(l*b*h));
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
		solve();
	return 0;
}





Measured memory_bytes: 256
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    s = S()
    s.append("o")
    a = s.count("o")-1
    print(700+a*100)
    return

#B
def B():
    n, x = LI()
    m = IR(n)
    m.sort()
    msum = sum(m)
    print(n + (x - msum) // m[0])
    return

#C
def C():
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    B()


Measured memory_bytes: 38512
#include <stdio.h>
#include <stdlib.h>

int main(void){

  char str[3];

  int i;
  scanf("%c %c %c",&str[0],&str[1],&str[2]);

  i = atoi(str);
  

  if(i%4 == 0){
    printf("YES");
  }else{
    printf("NO");
  }

  return 0;

}

Measured memory_bytes: 128
import java.util.Scanner;

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

            String[] s = new String[] { "dream", "dreamer", "erase", "eraser", };

            for (int index = S.length(); index > 0;) {
                String match = find(S, index, s);

                if (match == null) {
                    System.out.println("NO");
                    return;
                }

                index -= match.length();
            }

            System.out.println("YES");
        }
    }

    private static String find(String S, int index, String[] s) {
        for (String dream : s) {
            if (S.substring(0, index).endsWith(dream)) {
                return dream;
            }
        }
        return null;
    }
}


Measured memory_bytes: 47576
#include<bits/stdc++.h>
using namespace std;
typedef int sign;
typedef long long ll;
#define For(i,a,b) for(register sign i=(sign)(a);i<=(sign)(b);++i)
#define Fordown(i,a,b) for(register sign i=(sign)(a);i>=(sign)(b);--i)
const int N=3e3+5;
template<typename T>bool cmax(T &a,T b){return (a<b)?a=b,1:0;}
template<typename T>bool cmin(T &a,T b){return (a>b)?a=b,1:0;}
template<typename T>T read()
{
	T ans=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)&&ch!='-')ch=getchar();
	if(ch=='-')f=-1,ch=getchar();
	while(isdigit(ch))ans=(ans<<3)+(ans<<1)+(ch-'0'),ch=getchar();
	return ans*f;
}
template<typename T>void write(T x,char y)
{
	if(x==0)
	{
		putchar('0'),putchar(y);
		return;
	}
	if(x<0)
	{
		putchar('-');
		x=-x;
	}
	static char wr[20];
	int top=0;
	for(;x;x/=10)wr[++top]=x%10+'0';
	while(top)putchar(wr[top--]);
	putchar(y);
}
void file()
{
#ifndef ONLINE_JUDGE
	freopen("F.in","r",stdin);
	freopen("F.out","w",stdout);
#endif
}
int n,a[N];
vector<int>E[N];
#define pb push_back
int f[N],d[N];
void input()
{
	int x,y;
	n=read<int>();
	For(i,1,n)a[i]=read<int>();
	For(i,2,n)
	{
		x=read<int>(),y=read<int>();
		if(a[x]>a[y])E[y].pb(x),d[x]++;
		else if(a[x]<a[y])E[x].pb(y),d[y]++;
	}
}
queue<int>q;
void work()
{
	For(i,1,n)if(!d[i])q.push(i);
	int u;
	while(!q.empty())
	{
		u=q.front();q.pop();
		for(int v:E[u])
		{
			f[v]|=(!f[u]);
			if(!--d[v])q.push(v);
		}
	}
	For(i,1,n)if(f[i])write(i,' ');
}
int main()
{

	input();
	work();
	return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};


int main(){
    string s, t;
    cin >> s >> t;
    string ans = "No";
    rep(i, s.size()) {
        if (s==t) ans = "Yes";
        char c = s[0];
        s.erase(s.begin());
        s += c;
    }
    
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = (1 << 29);
const long long INFL = (1LL<<60);
const double eps = (1e-9);

int main(int argc, char* argv[])
{
  int n;
  cin >> n;
  map<ll, bool> m;

  rep(i, n) {
    ll tmp;
    cin >> tmp;
    if (m[tmp]) {
      m[tmp] = false;
    } else {
      m[tmp] = true;
    }
  }

  int ans = 0;
  for (auto itr = m.begin(); itr != m.end(); itr++) {
    if (itr->second) {
      ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define INF 1e9
using namespace std;

#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(a)  (a).begin(),(a).end()
#define endl "\n"

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
typedef long long ll;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

void solve() {
    int N,M;
    cin >> N >> M;
    cout << max(N*(N-1)/2,0)+max(M*(M-1)/2,0) << endl;
}

int main() {
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int H, N;
  cin >> H >> N;
  vector<int> A(N);
  rep(i, N) {
    cin >> A[i];
    H -= A[i];
  }
  bool bl = H <= 0;
  if (bl) puts("Yes");
  else puts("No");
  return 0;
}

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

using namespace std;

int main() {
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n;
    cin >> n;
    int ans = n / 2;
    if(n % 2 == 0)
        ans --;
    cout << ans;


    return 0;
}


Measured memory_bytes: 256
/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <unordered_map>
#include <queue>
#define   mod  998244353
#define   int  long long 
#define   ld   long double
#define   pb   push_back
#define   vi  vector<int> 
#define   dbg(x)  cerr << #x << " = " << x << '\n'
#define   sz(x)  (int)x.size()
#define   all(a) (a.begin(),a.end())
#define   ff   first
#define   ss   second
#define   pii  pair<int,int> 
#define   lcm(a,b) (a*b)/__gcd(a,b) 
using namespace std;

inline void solve(){
    int n,m,x; cin>>n>>m>>x; 
    int a[n][m+1],ans=1000000000;
    for (int i=0;i<n;i++)
        for (int &j: a[i]) cin>>j;
    for (int i=0;i<(1<<n);i++){
        vi h(m+1,0); int cnt=0;
        for (int j=0;j<n;j++){
            if ((i>>j)&1){
                for (int k=0;k<=m;k++){
                    if (k==0) cnt += a[j][0];
                    else h[k] += a[j][k];
                }
            }
        }
        if (cnt<ans){
            bool flag=true;
            for (int j=1;j<=m;j++){
                if (h[j]<x) flag=false;
            }
            if (flag) ans=cnt;
        }
    }
    cout << ((ans==1000000000)?-1:ans) << endl;
}

signed main()
{
    int n=1; // cin>>n;
    while (n--) solve();
    return 0;
}


Measured memory_bytes: 3644
s = int(input())

def myfnc(input):

    if input % 2 == 0:
        return input // 2
    else:
        return (3 * input) + 1

answer = list()
answer.append(s)
for i in range(2, 1000000):
    ret = myfnc(answer[-1])

    if ret in answer:
        print(i)
        exit(0)
    else:
        answer.append(ret)



Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <set>
#include <deque>
#include <map>
#include <iomanip>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <utility>
using namespace std;
int ky[8] = {-1,1,-2,2,-2,2,-1,1}; 
int kx[8] = {-2,-2,-1,-1,1,1,2,2};
int dy[4] = {-1,0,1,0};
int dx[4] = {0,1,0,-1};
int ddy[8] = {-1,0,1,-1,1,-1,0,1};
int ddx[8] = {-1,-1,-1,0,0,1,1,1};
typedef long long ll;
#define pi pair
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define rep1(i,a,b) for(int i = a; i < b; i++)
#define rep2(i,a,b) for(int i = a; i <= b; i++) 
#define LB lower_bound
#define UP upper_bound
#define INF 999999999999
const double PI = acos(-1.0);
int n;
ll ans;
ll a[100000];
ll LIMIT = 1e18;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    cin >> n;
    rep1(i,0,n){
        cin >> a[i];
        if(!a[i]){
            cout << 0;
            return 0;
        }
    }

    ans = 1;
    rep1(i,0,n){
        if(ans > LIMIT/a[i]){
            cout << -1;
            return 0;
        }
        ans *= a[i];
    }

    cout << ans;
    return 0;   
}



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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int n, r;
  cin >> n >> r;
  int x = r + max(0, 100 * (10 - n));
  cout << x << endl;
}

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

#define SZ(x) (((int)x.size()))
#define all(x) (x).begin(), (x).end()
#define pb push_back

typedef long long ll;
typedef long double ld;

using namespace std;

int a, b, c, k;

int main()
{
    cin >> a >> b >> c >> k;
    if (k <= a)
        cout << k;
    else if (k <= a + b)
        cout << a;
    else
        cout << a - (k - (a + b));
	return 0;
}


Measured memory_bytes: 3624
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arrA = new int[n + 1];
		int[] arrB = new int[n + 1];
		for (int i = 1; i <= n; i++) {
		    int x = sc.nextInt();
		    arrA[x] = i;
		    arrB[x] = i;
		}
		for (int i = 1; i < n; i++) {
		    arrA[i + 1] += arrA[i];
		    arrB[n - i] += arrB[n - i + 1];
		}
		StringBuilder sbA = new StringBuilder();
		StringBuilder sbB = new StringBuilder();
		for (int i = 1; i <= n; i++) {
		    if (i != 1) {
		        sbA.append(" ");
		        sbB.append(" ");
		    }
		    sbA.append(arrA[i]);
		    sbB.append(arrB[i]);
		}
		System.out.println(sbA);
		System.out.println(sbB);
   }
}




Measured memory_bytes: 45012
#define _USE_MATH_DEFINES 
#include<iomanip> 
#include<cmath>  
#include<iostream>
#include<fstream>
#include<vector>
#include<algorithm>
#include<numeric>
#include<bitset>
#include<map>
#include<unordered_map>
#include<set>
#include<unordered_set>
#include<queue>
#include<deque>
#include<stack>
using namespace std;
typedef long long ll;
#define repi(i,a,b) for(ll i = (ll)(a) ; i < (ll)(b) ; i++)
#define repd(i,a,b) for(ll i = (ll)(a) ; i > (ll)(b) ; i--)
#define rd(x) cin >> x
#define wr(x)  cout << x
#define wrln(x) cout << x << endl
#define wl() cout << endl
const ll MAX_10p5 = 100010;
const ll MAX_10p9 = 1000000010;
const ll MAX_10p18 = 1000000000000000010;
const ll MOD = 1000000007;
const ll m4x[4] = { 1,0,-1,0 };
const ll m4y[4] = { 0,1,0,-1 };
const ll m8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const ll m8y[8] = { 0,1,1,1,0,-1,-1,-1 };
const ll m9x[9] = { 1,1,0,-1,-1,-1,0,1,0 };
const ll m9y[9] = { 0,1,1,1,0,-1,-1,-1,0 };

struct edge {
	ll from, to, cost;
	bool operator<(const edge& right) const {
		return cost < right.cost;
	}
};
struct point {
	ll x, y;
	bool operator<(const point& right) const {
		return x == right.x ? y < right.y : x < right.x;
	}
};

///////////////////////////////////////////////////////////////////////////////////////

ll N, A, ans;
ll x[60], dp[60][60][3600];

int main() {
	cin >> N >> A;
	repi(i, 0, N) rd(x[i]);
	// dp[i][j][k]: i-1番目まで見てj個選んで和がkである(O(N^4))
	repi(i, 0, N) dp[0][0][0] = 1;
	repi(i, 0, N) {
		repi(j, 0, N) {
			repi(k, 0, 2500 + 1) {
				dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
				dp[i+1][j][k] += dp[i][j][k];
			}
		}
	}
	repi(j, 1, N + 1) {
		repi(k, 1, 2500 + 1) {
			if ((k%j == 0) && (k / j == A)) ans += dp[N][j][k];
		}
	}
	wrln(ans);
	return 0;
}


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

int main(){
  int A,B,C;
  cin >> A >> B >> C;
  if(A>B){
    if(A>C && C>B)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
  else{
    if(B>C && C>A)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  }
}

Measured memory_bytes: 256
x = int(input())
if 400 <= x <= 599:
    print(8)
elif 600 <= x <= 799:
    print(7)
elif 800 <= x <= 999:
    print(6)
elif 1000 <= x <= 1199:
    print(5)
elif 1200 <= x <= 1399:
    print(4)
elif 1400 <= x <= 1599:
    print(3)
elif 1600 <= x <= 1799:
    print(2)
elif 1800 <= x <= 1999:
    print(1)

Measured memory_bytes: 9108
#include<bits/stdc++.h>
#define re register
inline int read(){
	re int t=0;re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
	return t;
}
using namespace std;
int n,m,a,b,k;
int main(){
	n=read();m=read();
	a=read();b=read();k=read();
	printf("%d",max((a-n)*60+b-m-k,0));
}

Measured memory_bytes: 3764
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define M 1000000007
bool comp(pair<string,long int> a,pair<string,long int>  b)
{
    
    if(a.first==b.first && a.second>b.second)
    {
        return true;
    }
    
    return a.first<b.first;
    
}
int main()
{
    ll n;cin>>n;
    vector<pair<string,long int>>a;
    map<pair<string,long int>,long int > mp;
    for(long int i=0;i<n;i++)
    {
        long int t2;
        string t1;
        cin>>t1>>t2;
        a.push_back({t1,t2});
        mp[{t1,t2}]=i+1;
    }
    sort(a.begin(),a.end(),comp);
	for(long int i=0;i<n;i++)
    {
      //  cout<<a[i].first<<" "<<a[i].second<<" ";
        cout<<mp[{a[i].first,a[i].second}]<<endl;
    }
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,n;
    cin>>x>>n;
    vector<int>v;
    for(int i=0;i<n;i++)
    {
        int z;
        cin>>z;
        v.push_back(z);
    }
    int count=0;
    int c=0,ans=0;
    sort(v.begin(),v.end());
   for(int i=0;i<1000;i++)
   {
       int c1=x+i;
       int c2=x-i;
       int z=binary_search(v.begin(),v.end(),c1);
       int z1=binary_search(v.begin(),v.end(),c2);
       if(z1==0)
       {
           ans=c2;
           break;
       }
       if(z==0)
       {
           ans=c1;
           break;
       }
   }
   cout<<ans;

    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    int n, m;
    string s;
    cin >> n >> m >> s;

    vector<int> as(n), bs(n);

    vector<set<int>> edges(n);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        edges[a].insert(b);
        edges[b].insert(a);
    }

    set<int> q;

    rep(i, n) {
        for (int e: edges[i]) {
            if (s[e] == 'A') as[i]++;
            else bs[i]++;
        }
        if (as[i] == 0 || bs[i] == 0)q.insert(i);
    }

    int lef = n;
    while (q.size()) {
        int x = *q.begin();
        q.erase(q.begin());

        lef--;

        for (int e : edges[x]) {
            if (e == x)continue;
            edges[e].erase(x);
            if (s[x] == 'A') as[e]--;
            else bs[e]--;
            if (as[e] == 0 || bs[e] == 0) q.insert(e);
        }
    }

    string ans = lef == 0 ? "No" : "Yes";
    cout << ans << endl;

}


Measured memory_bytes: 33924