akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define all(v)           ((v).begin()), ((v).end())
#define sz size()
#define clr(v,d)         memset(v,d,sizeof(v))
#define rep(i, v)        for(int i=0;i<(v).sz;++i)
#define lp(i, n)         for(int i=0;i<(int)(n);++i)
#define lpi(i, j, n)     for(int i=(j);i<(int)(n);++i)
#define lpd(i, j, n)     for(int i=(j);i>=(int)(n);--i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fi first
#define se second
#define sci(a)	scanf("%d",&a)
#define scii(a, b)	scanf("%d%d",&a, &b)
#define pri(a)	printf("%d\n",a)
#define prii(a, b)	printf("%d %d\n",a, b)
#define DB1(a)          std::cout<<#a<<"="<<(a)<<endl
#define DB2(a,b)        std::cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<endl
#define DB3(a,b,c)      std::cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<endl
#define DB4(a,b,c,d)    std::cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<endl
#define DB5(a,b,c,d,e)  std::cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<", "<<#e<<"="<<(e)<<endl
typedef pair<int, int> pii;
typedef long long ll;
const ll  inf = 1000000000000000000LL;
const double EPS = 1e-9;
const ll mod = 1000000007ll;
#define PI acos(-1)

const int maxn = 300500;

int a[maxn];

map<int, int> cnt;

int main(){
	int n, k; scii(n, k);
	lp(i, n) sci(a[i]);
	lp(i, n) cnt[a[i]]++;
	vector<pii> v;
	for (auto i : cnt) v.push_back({ i.second, i.fi });
	sort(v.begin(), v.end(), greater<pii>());
	int s = 0;
	for (int i = 0; i < k && i < v.size(); i++) s += v[i].first;
	pri(n - s);
}



Measured memory_bytes: 12536
import java.util.HashMap;
import java.util.Scanner;

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

        if(s.length() % 2 != 0){
            System.out.println("No");
            System.exit(0);
        }
        HashMap<String,Integer> map = new HashMap<>();
        StringBuilder sb = new StringBuilder();

        for(int i = 0;i < s.length();i++){
            sb.setLength(0);
            sb.append(s.charAt(i));
            if(map.get(sb.toString()) == null){
                map.put(sb.toString(),1);
            }
            else if(map.get(sb.toString()).intValue() < 2){
                map.put(sb.toString(),2);
            }
            else{
                System.out.println("No");
                System.exit(0);
            }
        }
        if(map.size() != s.length() / 2){
            System.out.println("No");
            System.exit(0);
        }
        else{
            System.out.println("Yes");
            System.exit(0);
        }
    }
}


Measured memory_bytes: 21844
#include <iostream>                                             
#include <vector>                                               
using namespace std;                                            
                                                                
int main() {                                                    
  int n, m;                                                     
  while (true) {                                                
    cin >> n;                                                   
    if (n==0) {                                                 
      break;                                                    
    }                                                           
    vector<char> from(n);                                       
    vector<char> to(n);                                         
    for (int i=0; i<n; i++) {                                   
      cin >> from[i] >> to[i];                                  
    }                                                           
    cin >> m;                                                   
    vector<char> v(m);                                          
    for (int i=0; i<m; i++) {                                   
      cin >> v[i];                                              
      for (int j=0; j<n; j++) {                                 
        if (v[i]==from[j]) {                                    
          v[i] = to[j];                                         
          break;                                                
        }                                                       
      }                                                         
    }                                                           
    for (int i=0; i<m; i++) {                                   
      cout << v[i];                                             
    }                                                           
    cout << endl;                                               
  }                                                             
  return 0;                                                     
}                                    

Measured memory_bytes: 3172
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N, D;
int C[1011][1011];

int F[1011][1011];
int dp[1011][1011];
int row[1011], col[1011];

bool ok(int mid) {
    LL q = (mid+1)/D;
    int r = (mid+1)%D;
    LL val[3];
    val[0] = q*q;
    val[1] = val[0] + q;
    val[2] = val[1] + q + 1;
    LL p = val[0] * (D-r)*(D-r) + val[1] * (D-r)*r*2 + val[2] * r*r;
    assert(p == (LL)(mid+1)*(mid+1));

    memset(row, 0, sizeof row);
    memset(col, 0, sizeof col);
    REP (i, D) REP (j, D) {
	REP (t, 4) {
	    if (t == 3) return false;
	    if (C[i][j] <= val[t]) {
		amax(row[i], t);
		amax(col[j], t);
		F[i][j] = t;
		break;
	    }
	}
    }
    memset(dp, 0, sizeof dp);
    REP (t, 4) REP (i, D) REP (j, D) {
	if (F[i][j] == 0 && row[i] < 2 && col[j] < 2) {
	    int mi = 1<<29;
	    int i2 = (i+D-1)%D;
	    int j2 = (j+D-1)%D;
	    amin(mi, dp[i2][j]);
	    amin(mi, dp[i][j2]);
	    amin(mi, dp[i2][j2]);
	    amax(dp[i][j], mi+1);
	}
    }

    int s = 0;
    REP (i, D) REP (j, D) amax(s, dp[i][j]);

    return s >= D-r;
}

void MAIN() {
    scanf("%d%d", &N, &D);
    REP (i, N) {
	int x, y;
	scanf("%d%d", &x, &y);
	x %= D;
	y %= D;
	C[x][y]++;
    }

    int lo = -1, hi = 1;
    while (!ok(hi)) {
	lo = hi;
	hi += hi;
    }
    while (hi - lo > 1) {
	int mid = (hi + lo) / 2;
	(ok(mid)? hi: lo) = mid;
    }

    printf("%d\n", hi);
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



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

#define ll             long long
#define LL             long long
#define pii            pair<int, int>
#define pll            pair<ll, ll>
#define pil            pair<int, ll>
#define pli            pair<ll, int>
#define vi             vector<int>
#define vl             vector<ll>
#define vii            vector<pii>
#define vll            vector<pll>
#define vil            vector<pil>
#define vli            vector<pli>
#define pb             push_back
#define ppb            pop_back
#define mp             make_pair
#define ff             first
#define ss             second
#define sz(x)          (int)x.size()
#define TN             typename
#define all(v)         v.begin(), v.end()
#define fill(a, b)     memset(a, b, sizeof(a))
#define endl           '\n'

template <TN T> T gcd(T a, T b) {return !b ? a : gcd(b, a % b);}
template <TN T> T lcm(T a, T b) {return a * (b / gcd(a, b));}
template <TN T> T sqr(T a) {return a * a;}
template <TN T> T cube(T a) {return a * a * a;}
template <TN T> inline void smin(T &a, T b) {a = a < b ? a : b;}
template <TN T> inline void smax(T &a, T b) {a = a > b ? a : b;}

template <TN T> inline void Int(T &n) {
	n = 0; int f = 1; register int ch = getchar();
	for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
	for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
	n = n * f;
}

#define error(args...) {vector <string> _v = split(#args, ','); err(_v.begin(), args); cout << endl;}
vector <string> split(const string &s, char c) {
	vector <string> v;
	stringstream ss(s); string x;
	while (getline(ss, x, c)) v.emplace_back(x);
	return move(v);
}
void err(vector <string> :: iterator it) {}
template <typename T, typename... Args>
void err(vector <string> :: iterator it, T a, Args... args) {
	cout << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", ";
	err(++it, args...);
}

inline int in() {int n; scanf("%d", &n); return n;}
inline ll Lin() {ll n; scanf("%lld", &n); return n;}
inline double Din() {double n; scanf("%lf", &n); return n;}

inline int add(int a, int b, int mod) {a += b; return a >= mod ? a - mod : a;}
inline int sub(int a, int b, int mod) {a -= b; return a < 0 ? a + mod : a;}
inline int mul(int a, int b, int mod) {return (ll)a * b % mod;}

const int N          = 2e5 + 5;
const ll  Mod        = (ll)1e9 + 7;
const int inf        = (int)2e9;
const ll  Inf        = (ll)1e18;
const int mod        = (int)1e9 + 7;

int dp[1005][1005];
string s[1005];

int solve() {
	int h = in(), w = in();
	dp[0][0] = 1;
	for (int i = 0; i < h; i++) {
		cin >> s[i];
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (i > 0 && s[i][j] == '.' && s[i - 1][j] == '.') dp[i][j] = add(dp[i][j], dp[i - 1][j], mod);
			if (j > 0 && s[i][j] == '.' && s[i][j - 1] == '.') dp[i][j] = add(dp[i][j], dp[i][j - 1], mod);
		}
	}
	printf("%d\n", dp[h - 1][w - 1]);
	return 0;
}

int main() {
	int test = 1, tc = 0;
	//scanf("%d", &test);
	while (test--) {
		//printf("Case %d: ", ++tc);
		solve();
	}
	return 0;
}





Measured memory_bytes: 5248
import java.io.*;
class Main{
    public static void main(String[]args){
        BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
      	int x;
        try{
            x = Integer.parseInt(bf.readLine());
        }catch(Exception e){
          	x = 0;
        }
     	x = (int)Math.pow(x,3);
        System.out.println(x);
    }
}


Measured memory_bytes: 24424
N = int(input())

A = [1]

for i in range (1, 7):
	A.append(6**i)

for i in range (1, 6):
	A.append(9**i)
    
A = sorted(A)
import math
DP = [math.inf]*1000001
DP[0] = 0

for i in range (0, 1000001):
	for j in range (0, 12):
		if i+A[j] < 1000001:
			if  DP[i]+1 < DP[i+A[j]]:
				DP[i+A[j]] = DP[i]+1
print(DP[N])

Measured memory_bytes: 88980
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <cstdio>
#include <ctime>
#include <assert.h>
#include <chrono>
#include <random>
#include <numeric>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;

mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
ll myRand(ll B) {
    return (ull)rng() % B;
}

map<string,int> mp;

int h,w;
char fi[22][22];

int dx[]={1,1,1,0,0,-1,-1,-1};
int dy[]={-1,0,1,-1,1,-1,0,1};

void dfs(int sx,int sy,int x,int y,int k,string s){
	s+=fi[x][y];
	mp[s]++;
	int nx=(x+dx[k]+h)%h;
	int ny=(y+dy[k]+w)%w;
	if(nx==sx&&ny==sy)return;
	dfs(sx,sy,nx,ny,k,s);
}

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	while(cin >> h >> w,h){
		mp.clear();
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				cin >> fi[i][j];
			}
		}
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				for(int k=0;k<8;k++){
					dfs(i,j,i,j,k,"");
				}
			}
		}
		string res="";
		for(auto p:mp){
			if(p.second>=2){
				if(p.first.size()>res.size())res=p.first;
				else if(p.first.size()==res.size())res=min(res,p.first);
			}
		}
		cout << ((res.size()>=2)?res:"0") << endl;
	}
}



Measured memory_bytes: 38148
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader buff = null;
		buff = new BufferedReader(new InputStreamReader(System.in));

		int N = Integer.parseInt(buff.readLine());
		int[] num_box = new int[N];
		int[] bucket = new int[101];
		for(int i = 0; i < N; ++i){
			num_box[i] = Integer.parseInt(buff.readLine());
			bucket[num_box[i]] = 1;
		}

		int count = 0;
		for(int i = 0; i < 101; ++i){
			if(bucket[i] == 1){
				count++;
			}
		}
		System.out.println(count);
	}

	static long f() {
		long ans = 0;


		return ans;
	}
}

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

#define rep(i,n) for(int i=0;i<(int)n;++i)
#define all(c) (c).begin(),(c).end()
#define mp make_pair
#define pb push_back
#define each(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define dbg(x) cerr<<__LINE__<<": "<<#x<<" = "<<(x)<<endl

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

constexpr int inf = (int)1e9;
constexpr double INF = 1e12, EPS = 1e-9;
constexpr int MX = 2010;
constexpr int mod = inf + 7;

int n, m, q, a[MX];
int L[MX][MX], R[MX][MX];
int memo[MX][MX];

int main() {
  int N;
  cin >> N;
  rep(i,N) {
    cin >> a[i];
  }

  int diff{0};
  bool aturn{true};

  rep(i,N) {
    int max_i;
    int max = -1;
    rep(j,N) {
      if (a[j] > max) {
        max_i = j;
        max = a[j];
      }
    }

    if (aturn) {
      diff += max;
    } else {
      diff -= max;
    }

    a[max_i] = -1;
    aturn = !aturn;
  }

  cout << diff << endl;
}

Measured memory_bytes: 384
/*
How to lambda
  ex) sort(ALL(cont),[](dat a,dat b){return a.l<b.l;});
lower_bound/upper_bound
  1 2 2 2 3 3 
    ^lb   ^ub */
#include <bits/stdc++.h>
#define BR "\n"
#define REP(i,n) for(int (i)=0;(i)<(n);++(i))
#define ALL(cont) begin(cont),end(cont)
#define AS_MOD(a,b) ((((a) % (b) ) + (b)) % (b))
#define FEACH(it,cont) for(auto (it) = begin(cont); it!=end(cont);++it)
#define FEACHR(it,cont) for(auto (it) = rbegin(cont); it!=rend(cont);++it)
#define pb push_back
#define fi first
#define se second
#define getll() ([](){ll s;scanf("%lld", &s);return s;})()
#define getld() ([](){ld s;scanf("%Lf", &s);return s;})()
#define prl(P) printf("%lld", P)
#define prd(P) printf("%.10Lf", P)
#define pr(P) printf(P)
using namespace std;
typedef long long ll;
typedef long double ld;
int N;
string S;

int main() {
  cout << fixed << setprecision(10);
  cin >> N >> S;
  int Q;
  cin >> Q;
  REP(cnt,Q) {
    int k;
    cin >> k;
    ll countM=0,countC=0,lastPair=0;
    int r=0;
    ll ans=0;
    for(int i=0;i<N;++i) {
      if (S[i]!='D') {
        if (S[i]=='M') {
          lastPair -= countC;
          countM--;
        }
        if (S[i]=='C') {
          countC--;
        }
        lastPair=max(lastPair,0ll);
        countM=max(countM,0ll);
        countC=max(countC,0ll);
        continue;
      }
      if (r<i) {
        r=i+1;
        lastPair=0;countM=0;countC=0;
      }
      for(r=r;r<i+k && r<N;++r) {
        if (S[r]=='M') {
          countM++;
        }
        if (S[r]=='C') {
          lastPair+=countM;
          countC++;
        }
      }
      ans += lastPair;
    }
    cout << ans << endl;
  }
  return 0;
}


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

using namespace std;
int main()
{
    long long n, k;
    long long i = 0;
    long long mod = 1000000007;
    
    cin >> n;
    cin >> k;
    if(n>k){
        cout << "safe";
    }
    else{
        cout << "unsafe";
    }

}

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

#define int long long
#define fast_io(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i,a,b) for(int i=a;i<b;i++)
#define all(x) x.begin(),x.end()
#define us unordered_set
#define um unordered_map
#define ms multiset
#define mm multimap
#define pb push_back
#define pf push_front
#define ins insert
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define _max max_element
#define _min min_element
#define tc(T) int T; cin>>T; while(T--)
#define q(q) int q; cin>>q; while(q--)
#define pi 3.1415926535897932384626433832
const int pinf=((int)2e18);
const int ninf=((int)-2e18);
const int mod=1000000007;

using namespace std;

int32_t main()
{
    fast_io();

    //FILE *fptr1=freopen("in.txt","w",stdout);
    //FILE *fptr2=freopen("out.txt","w",stdout);

    string s;
    cin>>s;
    int mx=0;
    for(int i=0;i<3;)
    {
        if(s[i]=='R'){
        int j=i;
        int c=0;
        while(j<3 and s[j]=='R')
        {
            c++;
            j++;
        }
        i=j;
        mx=max(mx,c);}
        else i++;
    }
    cout<<mx;


    return 0;
}


Measured memory_bytes: 3648
#[allow(unused_imports)]
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

#[allow(unused_macros)]
macro_rules! echo {
    ($($e:expr),+) => ( { $(println!("{}", $e))+ } );
}

fn main() {
    input! {
        a: usize,
        b: usize,
    }

    echo!(a * b);
}


Measured memory_bytes: 2172
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
ll A[100000];
ll B[100000];
ll d[100000];
int main() {
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> B[i];
	}
	vector<ll> plus;
	ll minus = 0;
	int ans = 0;
	ll sum = 0;
	for (int i = 0; i < N; i++) {
		d[i] = A[i] - B[i];
		sum += d[i];
		if (d[i] < 0) {
			minus += d[i];
			ans++;
		}
		if (d[i] > 0) plus.push_back(d[i]);
	}
	sort(plus.begin(), plus.end(), greater<int>());
	if (sum < 0) {
		cout << -1 << endl;
		return 0;
	}
	for (int i = 0; i < plus.size(); i++) {
		if (minus >= 0) break;
		minus += plus[i];
		ans++;
	}
	cout << ans << endl;
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
typedef double DOUBLE;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

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

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const ll LL_INF = 1e17 + 10;
const int INF = 1e9 + 10;
const ll MOD = 1e9 + 7;

const int MAXN = 200 + 5;

int ans[MAXN];

int used[MAXN];
int n;

int ask() {
	printf("?");
	REP(i, 0, 2 * n) {
		if (used[i]) {
			printf(" %d", i + 1);
		}
	}
	putchar('\n');
	fflush(stdout);
	
	char t[10];
	scanf("%s", &t[0]);
	return t[0];
}

void solve(){
	scanf("%d", &n);
	
	REP(i, 0, n) {
		used[i] = 1;
	}
	
	int ans_l = ask();
	
	int l = 0, r = n;
	while(l + 1 < r) {
		int mid = (l + r) >> 1;
		REP(i, 0, 2 * n) {
			used[i] = 0;
			if (i >= mid && i < mid + n) {
				used[i] = 1;
			}
		}
		int cur = ask();
		if (cur == ans_l) {
			l = mid;
		} else {
			r = mid;
		}
	}
	
	int l_ind = l, r_ind = n + l;
	ans[l_ind] = ans_l;
	ans[r_ind] = 'R' + 'B' - ans_l;
	
	REP(i, 0, 2 * n) {
		used[i] = 0;
		if (i > l_ind && i < r_ind) {
			used[i] = 1;
		}
	}
	
	REP(i, 0, 2 * n) {
		if (i < l_ind || i > r_ind) {
			used[i] = 1;
			ans[i] = ask();
			used[i] = 0;
		}
	}
	
	REP(i, 0, 2 * n) {
		used[i] = 0;
		if (i < l_ind || i > r_ind) {
			used[i] = 1;
		}
	}
	
	REP(i, 0, 2 * n) {
		if (i > l_ind && i < r_ind) {
			used[i] = 1;
			ans[i] = ask();
			used[i] = 0;
		}
	}
	
	printf("! ");
	REP(i, 0, 2 * n) {
		putchar(ans[i]);
	}
	putchar('\n');
	fflush(stdout);
}   

int main(){
    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 724
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
ll p = 1e9 + 7;
ll fpm(ll a, ll b){
    ll res = 1;
    while(b){
        if(b & 1){
            res *= a;
            res %= p;
        }
        a *= a;
        a %= p;
        b >>= 1;
    }
    return res;
}
ll odw(ll a){
    return fpm(a, p-2);
}
main(){
    ll n,a,b,c;
    cin >>  n >> a >> b >> c;
    ll monz = 1;
    //if(c){
        monz = odw(100-c);
        monz *= 100;
        monz %= p;
    //}
    ll oab = odw(a+b); 
    ll A = a * oab;
    A %= p;
    ll B = b * oab;
    B %= p;
    assert((A+B)%p == 1);
    vector <ll> sil(2*n+2, 1);
    for(int i = 2; i <= 2*n; ++i){
        sil[i] = sil[i-1]*i;
        sil[i] %= p;
    }
    ll ans = 0;
    for(int i = 0; i < n; ++i){
        ll s = sil[n+i - 1];
        s *= odw(sil[n - 1]);
        s %= p;
        s *= odw(sil[i]);
        s %= p;
        s *= (n+i);
        s %= p;
        ll t1 = s, t2 = s;
        t1 *= fpm(A, i);
        t1 %= p;
        t1 *= fpm(B, n);
        t1 %= p;
        ans += t1;
        ans %= p;

        t2 *= fpm(B, i);
        t2 %= p;
        t2 *= fpm(A, n);
        t2 %= p;
        ans += t2;
        ans %= p;
    }
    ans *= monz;
    ans %= p;
    cout << ans << '\n';
}

Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;


int main(){
	int a, b;
	cin >> a >> b;
	if (a%2 && b%2) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}




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

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
    //a^tを求める
    //例：d[i] = mint(k/i).pow(n);
    //mint(2).pow(n); 2^n
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


int main() {
  ll n,k;
  cin>>n>>k;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];
  mint dp[n+1][k+1];
  rep(i,k+1)dp[0][i]=0;
  dp[0][0]=1;

  rep(i,n){
    //j以下かつ　a[i]以下のz
    //z以下全ての和、
   vector<mint> sum(100005,0);
   rep(z,k+1){
     sum[z+1]=sum[z]+dp[i][z];
   }
   rep(j,k+1){
     dp[i+1][j]+=sum[j+1]-sum[max(ll(0),j-a[i])];
  //   cout<<sum[j+1]<<" "<<sum[max(ll(0),j-a[i])]<<endl;
  //   cout<<dp[i+1][j]<<"i"<<i<<"j"<<j<<endl;
   }
  }
cout<<dp[n][k]<<endl;
}


Measured memory_bytes: 83284
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,a[300005],cnt[300005];
ll rui[300005],num[300005];
int main(){
	scanf("%d",&n);
	rep(i,n){ scanf("%d",&a[i]); cnt[a[i]]++; }
	rep(i,300005){
		rui[cnt[i]]+=cnt[i];
		num[cnt[i]]++;
	}
	for(int i=1;i<=300004;i++){
		rui[i] += rui[i-1];
		num[i] += num[i-1];
	}
	repn(k,n){
		int lb = 0, ub = n/k+1;
		while(ub-lb > 1){
			int mid = (lb+ub)/2;
			ll sum = rui[mid] + (num[300004]-num[mid]) * mid;
			if(sum >= mid * k) lb = mid;
			else ub = mid;
		}
		printf("%d\n",lb);
	}
}

Measured memory_bytes: 7936
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <algorithm>
const int mod=1e9+7;
using LL=long long;
using std::cout;using std::endl;using std::cin;
using std::vector;using std::string;using std::set;using std::multiset;
using std::pair;using std::map;
using std::min;using std::max;
using std::make_pair;
std::ostream& operator<<(std::ostream& os,std::map<int,int>& obj){for(std::map<int,int>::iterator itr=obj.begin();itr!=obj.end();itr++){os<<itr->first<<"^"<<itr->second<<" ";}return os;}
std::ostream& operator<<(std::ostream& os,std::vector<std::map<int,int>>& obj){for(auto itr=obj.begin();itr!=obj.end();itr++){os<<*itr<<std::endl;}return os;}
std::ostream& operator<<(std::ostream& os,std::vector<int>& obj){for(auto itr=obj.begin();itr!=obj.end();itr++){os<<*itr<<endl;}return os;}

namespace ndifix{
template<class T>void sort(T &v){std::sort(v.begin(),v.end());}
}

int main(){
  string s;cin>>s;
  int ans=0;
  for(int i=0;i<4;i++)if(s[i]=='2')ans++;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long

const int N = 4005;

int n;
char s[N];
int a[N];
int pref[N][5], suf[N][5];

int32_t main()
{
	IOS;
	cin >> n;
	for(int i = 1; i <= n; i++)
	{
		cin >> s[i];
		if(s[i] == 'R')
			a[i] = 0;
		else if(s[i] == 'G')
			a[i] = 1;
		else
			a[i] = 2;
	}
	for(int i = 1; i <= n; i++)
	{
		for(int j = 0; j <= 2; j++)
			pref[i][j] = pref[i - 1][j];
		pref[i][a[i]]++;
	}
	int ans = pref[n][0] * pref[n][1] * pref[n][2];
	for(int i = 2; i < n; i++)
	{
		int k = 1;
		while(i - k >= 1 && i + k <= n)
		{
			map<int, int> f;
			f[a[i]]++;
			f[a[i - k]]++;
			f[a[i + k]]++;
			if(f.size() == 3)
				ans--;
			k++;
		}
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 3844
#include "iostream"
#include "vector"
#include "map"
using namespace std;

int main() {
    map <string, int> mp;
    int n;
    cin >> n;
    for (int i=0; i<n; i++) {
        string s;
        cin >> s;
        mp[s] += 1;
    }
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
}


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

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

  vector<ll> B(N);
  rep(i, N) {
    B[i] = A[i] - (i + 1);
  }

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

  ll b = 0;
  if (N % 2 != 0) {
    b = B[N / 2];
  } else {
    b = (B[N / 2] + B[N / 2 - 1]) / 2;
  }

  ll ans = 0;
  rep(i, N) {
    ans += abs(B[i] - b);
  }

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

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

using namespace std;

const int N = 1e5 + 5;
int a[N] , n;
long long c[N] , k;

pair<bool , long long> can (int m) {
    long long g = 0 , g_cnt = 0 , ge_cnt = 0;
    for (int i = 0 ;i < n ;i++) {
        int ind = upper_bound(a , a + n , m - a[i]) - a;

        int len = n - ind;
        g_cnt += len;
        g += a[i] * 1ll * len + c[ind];

        ind = lower_bound(a , a + n , m - a[i]) - a;
        ge_cnt += n - ind;
    }

    if (ge_cnt >= k)
        return {1 , g + (k - g_cnt) * m};

    return {0 , 0};
}

int main() {
    cin >> n >> k;
    for (int i = 0 ;i < n ;i++)
        cin >> a[i];

    sort(a , a + n);

    for (int i = n - 1 ;i >= 0 ;i--)
        c[i] = a[i] + c[i + 1];

    long long ans = -1;
    int l = 2 , r = 2e5 + 5;
    while (l <= r) {
        int mid = (l + r) / 2;
        auto g = can(mid);
        if (g.first) {
            ans = g.second;
            l = mid + 1;
        } else {
            r = mid - 1;
        }
    }

    cout << ans;
}


Measured memory_bytes: 4736
module Main where

import qualified Data.ByteString.Char8 as BS
import Data.Maybe
import Control.Monad
import Data.List

main :: IO ()
main = do
    [a,b,c,k] <- map (fst.fromJust.BS.readInt).BS.words <$> BS.getLine
    let one = if k < a then k else a 
    let zero = if (k-one) < b then k-one else b
    let minus = k - one - zero
    putStr $ show (one-minus)

Measured memory_bytes: 3776
#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>

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

  std::vector<int> A(N);
  for (int i = 0; i < N; ++i)
    std::cin >> A[i];

  std::vector<std::tuple<int, int>> W(N);
  for (int i = 0; i < N; ++i)
    W[i] = std::make_tuple(A[i], i);

  std::sort(W.begin(), W.end());
  for (int i = 0; i < N; ++i)
    std::cout << std::get<1>(W[i]) + 1 << " ";

  return 0;
}


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

using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif

int main()
{

    lint k;
    cin >> k;
    lint a, b;
    cin >> a >> b;
    FOR(i,a,b+1){
        if(i%k==0)
        {
            cout << "OK" << "\n";
            return 0;
        }
    }    
    cout <<"NG" <<"\n";

    return 0;
}

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

signed main(void)
{
	string s, t;
	long long cnt;
	int len;

	cin >> s;
	cnt = 0;
	rep(i, s.size())
	{
		len = 1;
		while(s.substr(i, len) == t && i + len < s.size())
		{
			len++;
		}
		if (t != s.substr(i, len))
			cnt++;
		t = s.substr(i, len);
		i += len - 1;
	}
	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <utility>

using namespace std;

constexpr int MAXC = 1000000000;

long route_cost(int pos, int R, long cost_now, int count,
                vector<bool> &reached, vector<vector<int>> &rtotal) {
    if (count + 1 == R) {
        return cost_now;
    }

    reached[pos] = true;
    int min_cost = MAXC;
    for (int i = 0; i < R; i++) {
        if (reached[i] || rtotal[pos][i] == MAXC) continue;
        reached[i] = true;
        long next_cost = route_cost(i, R, cost_now + rtotal[pos][i], count + 1,
                                    reached, rtotal);
        reached[i] = false;
        if (next_cost < min_cost) {
            min_cost = next_cost;
        }
    }
    reached[pos] = false;
    return min_cost;
}

int main() {
    int N, M, R;
    cin >> N >> M >> R;
    vector<int> town(R);
    for (int i = 0; i < R; i++) {
        cin >> town[i];
    }
    vector<vector<int>> total(N + 1, vector<int>(N + 1, MAXC));
    for (int i = 0; i < M; i++) {
        int a, b, c;
        scanf("%d %d %d", &a, &b, &c);
        total[a][b] = c;
        total[b][a] = c;
    }

    for (int route = 1; route <= N; route++) {
        int sum;
        for (int start = 1; start <= N; start++) {
            for (int goal = 1; goal <= N; goal++) {
                if (start == goal) continue;
                if (total[start][route] == MAXC || total[route][goal] == MAXC) continue;
                sum = total[start][route] + total[route][goal];
                if (sum < total[start][goal]) {
                    total[start][goal] = sum;
                    total[goal][start] = sum;
                }
            }
        }
    }

    vector<vector<int>> rtotal(R, vector<int>(R, MAXC));
    for (int sid = 0; sid < R; sid++) {
        int start = town[sid];
        for (int gid = 0; gid < R; gid++) {
            if (sid == gid) continue;
            int sgcost = total[start][town[gid]];
            rtotal[sid][gid] = sgcost;
            rtotal[gid][sid] = sgcost;
        }
    }

    long ans = MAXC;
    vector<bool> reached(R, false);
    for (int i = 0; i < R; i++) {
        long ret = route_cost(i, R, 0, 0, reached, rtotal);
        if (ret < ans) {
            ans = ret;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int limit=10000000;
ll n,check1[limit],check2[limit],check3[limit],rainbowpower[limit][5];
int main()
{
    ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    cin>>n;
    for(ll i=1;i<=n;i++)
    {
        cin>>check1[i]>>check2[i]>>check3[i];
    }
    rainbowpower[1][1]=check1[1];rainbowpower[1][2]=check2[1];rainbowpower[1][3]=check3[1];
    for(ll i=2;i<=n;i++)
    {
        rainbowpower[i][1]+=max(rainbowpower[i-1][2],rainbowpower[i-1][3])+check1[i];
        rainbowpower[i][2]+=max(rainbowpower[i-1][1],rainbowpower[i-1][3])+check2[i];
        rainbowpower[i][3]+=max(rainbowpower[i-1][1],rainbowpower[i-1][2])+check3[i];
    }
    cout<<max(rainbowpower[n][3],max(rainbowpower[n][1],rainbowpower[n][2]));
    return 0;
}



Measured memory_bytes: 14592
#include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
typedef pair<ll, ll> P;
const ll INF = (1LL<<58);

template<class T> bool chmin(T &a, const T &b){
    if(a > b) {a = b; return true;}
    else return false;
}
template<class T> bool chmax(T &a, const T &b){
    if(a < b) {a = b; return true;}
    else return false;
}

int main() {
    cin>>N>>K;
    vec num(N, 0), p(N), c(N);
    mat score(N, vec(0));
    rep(i,N){cin>>p[i]; --p[i];}
    rep(i,N) cin>>c[i];
    ll res = *max_element(ALL(c));
    rep(i,N){
        ll temp = c[p[i]], now = p[i];
        score[i].push_back(0);
        score[i].push_back(temp);
        ++num[i];
        while(now != i){
            ++num[i];
            now = p[now];
            temp += c[now];
            score[i].push_back(temp);
        }
        if(score[i][num[i]] > 0){
            ll roop_num = K / num[i] - 1;
            if(roop_num >= 0){
                temp = score[i][num[i]] * roop_num;
                temp += *max_element(ALL(score[i]));
                chmax(res, temp);
            }
            ++roop_num;
            temp = score[i][num[i]] * roop_num;
            temp += *max_element(score[i].begin(), score[i].begin() + (K % num[i]) + 1);
            chmax(res, temp);
        }else{
            chmax(res, *max_element(score[i].begin() + 1, score[i].end()));
        }
    }
    cout<<res<<endl;
}

Measured memory_bytes: 218940
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
#define MD 1000000007
#define INF 1ll<<60
const double PI=3.141592653589;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

int main(){
    double r;
    cin>>r;
    cout<<2.0*r*PI<<endl;
    return 0;
}


Measured memory_bytes: 3788
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
const int mod=1000000007;
int n;
int arr[22][22];
int dp[22][1<<22];
int f(int u,int mask){
	if(u==n)return mask==(1<<n)-1;
	int &ans=dp[u][mask];
	if(~ans)return ans;
	ans=0;
	for(int i=0;i<n;i++){
		if(arr[u][i] && !(mask&(1<<i))){
			ans+=f(u+1,mask|(1<<i));
			if(ans>=mod)ans-=mod;
		}
	}
	return ans;
}


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	memset(dp,-1,sizeof dp);
	cin>>n;
	for(int i=0;i<n;i++)for(int j=0;j<n;j++)cin>>arr[i][j];
	cout<<f(0,0)<<endl;
	return 0;
}

Measured memory_bytes: 360704
extern crate core;

use std::io::{self, Read};

#[macro_use]
mod parser {
    macro_rules! input {
    ($s:expr=>$($t:tt)*) => {
        let mut lines=$s.split("\n");
        $(
            line_parse!(lines,$t);
        )*
    };
    }

    macro_rules! line_parse {
    ($lines:expr,($($name:ident:$t:tt)*)) => {
        let mut line=$lines.next().unwrap().split_whitespace();
        $(value_def!(line,$name,$t);)*
    };

    //複数行
    ($lines:expr,{$n:expr;$name:ident:$t:tt}) => {
        values_def!($lines,$n,$name,$t);
    };
    }

    macro_rules! value_def {
        ($line:expr, $name:ident, $t:tt) => {
            let $name = value!($line, $t);
        };
    }

    macro_rules! values_def {
        ($lines:expr, $n:expr, $name:ident, $t:tt) => {
            let $name = {
                let mut vec = Vec::new();
                for i in 0..$n {
                    let mut next = $lines.next().unwrap().split_whitespace();
                    vec.push(value!(next, $t));
                }
                vec
            };
        };
    }

    macro_rules! value {
    //配列
    ($line:expr,[$t:tt]) => {
        $line.map(|x|{
        let mut iter=::std::iter::once(x);
        value!(iter,$t)
        }).collect::<Vec<_>>()
    };
    //タプル
    ($line:expr,($($t:tt),*)) => {
        ($(value!($line,$t),)*)
    };
    //文字列
    ($line:expr,#) => {
        $line.next().unwrap()
    };
    //単一値
    ($line:expr,$t:ty) => {
        $line.next().unwrap().parse::<$t>().unwrap()
    };
    }
}

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = solve(input.trim().to_string());
    println!("{}", output);
}

fn solve(input: String) -> String {
    input!(input=>(x:i64));
    //6,5,6,5...
    let a = (x / 11) * 2;
    let r = x % 11;
    (if r == 0 {
        0
    } else if r <= 6 {
        1
    } else {
        2
    } + a)
        .to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!($output.trim().to_string(),super::solve($input.trim().to_string()));
                }
            )*
        }
    }
}

tests! {
    test1: "7" => "2",
    test2: "149696127901" => "27217477801",
}


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

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    ll n, a, b, ans = 0;
    cin >> n >> a >> b;
    ll c = b - a;
    if(c % 2 == 0){
        ans = c / 2;
    }else{
        ll d = min(a - 1, n - b) + 1;
        ans = d + (b - a - 1) / 2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, n) for (int i = 1; i <= (int)(n); i++)
using vi=vector<int>;  using vs=vector<string>;

int main() {
    int n; cin>>n;
    vi vec(n+1); 
    rep2(i,n) cin>>vec.at(i);

    int k=1,t=vec.at(1);
    rep(i,n){
        if(t==2){
            cout<<k<<endl;
            goto end;
        }
        k++;
        t=vec.at(t);
    }
    cout<<"-1"<<endl;
    end:;
}


Measured memory_bytes: 640
#include<iostream>

using namespace std;

#define REP(i, nn) for(int i=0; i<nn; i++)
#define ll long long

ll N;
ll h, n, w;
int main(){
    cin >> N;

    bool flag = false;
    REP(i, 3501){
        REP(j, 3501){
            if(i==0 || j==0) continue;

            h = i;
            n = j;
            ll e = N*h*n;
            ll f = 4*h*n;
            ll wu = f - (N*n) - (N*h);
            if(wu>0 && e % wu == 0){
                w = e / wu;
                flag = true;
                break;
            }
        }
        if(flag) break;
    }

    cout << h << " " << n << " " << w << endl;
}


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

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	if( a <= 0 && b >= 0 ) puts("Zero");
	else if( a > 0 ) puts("Positive");
	else {
		int cnt = b-a+1;
		puts( cnt & 1 ? "Negative" : "Positive" );
	}
	return 0;
}


Measured memory_bytes: 256
def dfs(i,f):
  if i == n-1:
    return(sum(list(map(int,f.split("+")))))
  return dfs(i+1,f+s[i+1]) + dfs(i + 1, f + "+" + s[i + 1])


s=input()
n=len(s)
print(dfs(0, s[0]))

Measured memory_bytes: 38896
#include<bits/stdc++.h>
using namespace std;
int main() {
  int a,b,k;
  cin>>a>>b>>k;
  int div=1;
  int counter=0;
  vector<int>divisors;
  while(true){
    if(a%div==0&&b%div==0){
        divisors.push_back(div);
    }
    if(div==min(a,b)){
        break;
    }
       div++;
  }
  int x = 0;
  for(int i=divisors.size()-1;i>=0;i--){
    x++;
    if(x==k){
        cout<<divisors[i]<<endl;
        return 0;
    }
  }
  return 0;
}


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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int main()
{
    int n, W; cin >> n >> W;
    ll w[n], v[n];
    rep(i,n) cin >> w[i] >> v[i];

    ll dp[n+1][W+1];
    rep(j,W+1) dp[0][j] = 0;
    
    rep(i,n) rep(j,W+1){
        if(j<w[i]) dp[i+1][j] = dp[i][j];
        else{
            dp[i+1][j] = max(dp[i][j], dp[i][j-w[i]]+v[i]);
        }
    }

    cout << dp[n][W] << endl;
}

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

void bubblesort(int A[], int N) {
    bool flg = true;
    int cnt = 0;
    while (flg) {
        flg = false;
        for (int j = N - 1; j > 0; j--) {
            if (A[j] < A[j-1]) {
                flg = true;
                cnt++;
                int tmp = A[j-1];
                A[j-1] = A[j];
                A[j] = tmp;
            }
        }
    }
    for (int i = 0; i < N; i++) {
        printf("%d", A[i]);
        if (i != N - 1) {
            printf(" ");
        } else {
            printf("\n");
        }
    }
    printf("%d\n", cnt);
}

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

    int A[N];
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }

    bubblesort(A, N);
    
    return 0;
}


Measured memory_bytes: 3220
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int main(void){
long long int n,k;
scanf("%lld %lld",&n,&k);
long long int asd=n%k;

if(asd>=llabs(asd-k)){printf("%lld\n",llabs(asd-k));}
else{printf("%lld\n",asd);}
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

ll n;
ll a[404],sum[404];
ll dp[404][404];

ll dfs(ll l,ll r){
  if(l+1==r)return 0;
  if(dp[l][r]!=-1)return dp[l][r];
  ll res=INF;
  repl(i,l+1,r){
    ll wl=sum[i]-sum[l];
    ll wr=sum[r]-sum[i];
    minch(res,dfs(l,i)+dfs(i,r)+wl+wr);
  }
  return dp[l][r]=res;
}

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

  cin>>n;
  rep(i,n)cin>>a[i];
  rep(i,n)sum[i+1]=sum[i]+a[i];
  memset(dp,-1,sizeof(dp));

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

  return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;


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



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
    long long n,ans=3;
    cin>>n;
    string s1,s2;
    cin>>s1>>s2;
    bool tate=true;
    if(s1[0]==s2[0])tate=true;
    else ans*=2,tate=false;
    for(int i=1;i<n;i++){
        if(i==1&&tate==false)i++;
        if(s1[i]==s2[i]){
            if(!tate){
                tate=true;
                continue;
            }
            tate=true;
            ans*=2;
 
        }else{
            if(tate)ans*=2;
            else ans*=3;
            tate=false;
            i++;
        }
    }
    cout<<(ans)%1000000007<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define lson l,mid,o<<1
#define rson mid+1,r,o<<1|1
using namespace std;
typedef long long LL;
typedef unsigned long long uLL;
typedef pair<int, int> P;
typedef pair<P, int> PII;
const LL INF = 0x3f3f3f3f;
const int N = 1e5 + 10;
const int M = 31;
const int NM = N * M;
const LL mod = 1e9 + 7;
const double PI=acos(-1);


int main()
{
    int n, a, b, be = 1, en;
    cin >> n >> a >> b;
    if((n + a - 1) / a > b || b > n - a + 1){
        puts("-1");
        return 0;
    }
    for(int i = 1; i <= a; ++i){
        en = min(n - (a - i), be + b - 1);
        for(int j = en; j >= be; --j){
            printf("%d ", j);
        }
        be = en + 1;
    }
    return 0;
}


Measured memory_bytes: 2176