akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define For(i, begin, end) for(int i=begin;i<end;i++)
#define Rep(i, n) For(i,0,n)
#define Sort(v) sort(v.begin(),v.end())
using namespace std;

int main(){
  int a, b; cin >> a >> b;
  if(a <= 0 && b >= 0)
    cout << "Zero";
  else if(a > 0)
    cout << "Positive";
  else if((b - a) % 2 == 0)
    cout << "Negative";
  else
    cout << "Positive";

  return 0;
}

Measured memory_bytes: 256
import Control.Applicative ((<$>))
import Data.Maybe (fromJust)
import qualified Data.ByteString.Char8 as B

readInts :: IO [Int]
readInts = map (fst . fromJust . B.readInt ) . B.words <$> B.getLine

main :: IO ()
main = do
  (x:y:z:_) <- readInts
  if x < y && y < z then putStrLn "Yes"
                    else putStrLn "No"


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define pconent(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int FFTMOD = 1007681537;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cerr << #x << " = " << (x) << " ";
#define endln cerr << "\n";

void solve() {
    long long x, y; cin >> x >> y;
    int res = 1;
    while (x * 2 <= y) {
        x <<= 1;
        res++;
    }
    cout << res << "\n";
}

int main(int argc, char* argv[]) {
    ios_base::sync_with_stdio(0), cin.tie(0);
    if (argc > 1) {
        assert(freopen(argv[1], "r", stdin));
    }
    if (argc > 2) {
        assert(freopen(argv[2], "wb", stdout));
    }
    solve();
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
}


Measured memory_bytes: 256
n = int(input())
t_li = [list(map(int,input().split())) for _ in range(n)]

s_x = 0
s_y = 0
s_t = 0

for i in range(n):
    t = t_li[i][0]
    x = t_li[i][1]
    y = t_li[i][2]
    
    s = abs(x-s_x)+abs(y-s_y)
    
    if s > t or (t-s_t-s)%2 == 1:
        print("No")
        exit()
        
    s_x = x
    s_y = y
    s_t = t
        
print("Yes")

Measured memory_bytes: 27380
#include<cstdio>
#include<algorithm>
using namespace std;
int n, w[24], o[24], T[25], res;
void DFS(int pv) {
	if (pv == n + 1) {
		for (int i = 0; i <= n; i++)T[i] = w[i];
		sort(T, T + n + 1);
		int r = 1e9;
		for (int i = 0; i < n; i++)r = min(r, T[i + 1] - T[i]);
		r = min(r, 24 - T[n]);
		res = max(res, r);
		return;
	}
	w[pv] = o[pv];
	DFS(pv + 1);
	if (o[pv] != 12 && o[pv] != 0) {
		w[pv] = 24 - o[pv];
		DFS(pv + 1);
	}
}
int main() {
	int i;
	scanf("%d", &n);
	if (n >= 24) {
		puts("0");
		return 0;
	}
	for (i = 1; i <= n; i++) {
		scanf("%d", &o[i]);
	}
	DFS(1);
	printf("%d\n", res);
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#define INF 10000000000ll
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define DUMP(a) for(long long dump=0; dump<(ll)a.size(); dump++) { cout<<a[dump]; if(dump!=(ll)a.size()-1) cout<<" "; else cout<<endl; }
#define ALL(v) v.begin(),v.end()
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;
using namespace std;

int main(){
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int x = abs(a-c);
	int y = abs(b-d);
	REP(i, x) cout << "R";
	REP(i, y) cout << "U";
	REP(i, x) cout << "L";
	REP(i, y) cout << "D";
	cout << "L";
	REP(i, y+1) cout << "U";
	REP(i, x+1) cout << "R";
	cout << "DR";
	REP(i, y+1) cout << "D";
	REP(i, x+1) cout << "L";
	cout << "U" << endl;
	return 0;
}


Measured memory_bytes: 256
from sys import stdin


def fetch_one_line():
    return stdin.readline().rstrip()


def fetch_int_input():
    return [int(s) for s in fetch_one_line().split()]


def fetch_inputs(times):
    return [fetch_one_line() for _ in range(times)]


def fetch_int_inputs(times):
    return [[int(s) for s in fetch_one_line()] for _ in range(times)]


def fetch_ints_inputs(times):
    return [fetch_int_input() for _ in range(times)]


N, M = fetch_int_input()

answer = ["No", "Yes"]

print(answer[int(N == M)])


Measured memory_bytes: 38256
#include<iostream>
#include<string>
#include<algorithm>

using namespace std;

int main(){int A,B; cin >> A >> B;
int cnt = 0;
for(int i = A; i <= B; i++){ string S = to_string(i);
                            string T = S; reverse(S.begin(),S.end()); if(S == T){cnt++;}}
           
           cout << cnt << endl;
           
           return 0;}
         

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include<iomanip>
#include<functional>

using namespace std;
typedef long long ll;

// a と b の最大公約数を返す関数
long long GCD(long long a, long long b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}

int main() {
    int A, B, C;
    cin >> A >> B >> C;
    bool ans = false;
    for (int i = A; i <= B * A; i += A) {
        if (i % B == C) {
            ans = true;
        }
    }
    if (ans) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 3604
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){
    int N;
    vector<int> X, tempX;
    cin >> N;
    
    int temp;
    
    for(int i = 0; i < N; i++){
        cin >> temp;
        X.push_back(temp);
        tempX.push_back(temp);
    }
    
    sort(tempX.rbegin(), tempX.rend());
    int l = N - 1;
    for(int i = 0; i < N; i++){
        if(X[i]  > tempX[N/2])
            cout << tempX[l/2 + 1] << endl;
        else
            cout << tempX[l/2] << endl;
    }
}


Measured memory_bytes: 3948
num, limit = gets.chomp.split(" ").map(&:to_i)
drafts = $stdin.readlines

drafts.map! do | draft | 
  draft.chomp!
  draft = draft.split(" ")
end

drafts.each do | draft |
  draft.map!(&:to_i)
end

costs = drafts.map do | draft |
  draft[0] if draft[1] <= limit
end

costs.compact!
if  costs.length != 0
  puts costs.min
else
  puts "TLE"
end


Measured memory_bytes: 1788
#pragma comment(linker, "/STACK:512000000")
#define _CRT_SECURE_NO_WARNINGS
//#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

#define all(a) a.begin(), a.end()
typedef long long li;
typedef long double ld;
void solve(bool);
void precalc();
clock_t start;
int main() {
#ifdef AIM
  freopen("/home/alexandero/ClionProjects/ACM/input.txt", "r", stdin);
  //freopen("/home/alexandero/ClionProjects/ACM/output.txt", "w", stdout);
  //freopen("out.txt", "w", stdout);
#else
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
#endif
  start = clock();
  int t = 1;
  cout.sync_with_stdio(0);
  cin.tie(0);
  precalc();
  cout.precision(10);
  cout << fixed;
  //cin >> t;
  int testNum = 1;
  while (t--) {
    //cout << "Case #" << testNum++ << ": ";
    //cerr << testNum << endl;
    solve(true);
    //cerr << testNum - 1 << endl;
  }
  cout.flush();
#ifdef AIM1
  while (true) {
      solve(false);
  }
#endif

#ifdef AIM
  cerr << "\n\n time: " << (clock() - start) / 1.0 / CLOCKS_PER_SEC << "\n\n";
#endif

  return 0;
}

//BE CAREFUL: IS INT REALLY INT?

template<typename T>
T binpow(T q, T w, T mod) {
  if (!w)
    return 1 % mod;
  if (w & 1)
    return q * 1LL * binpow(q, w - 1, mod) % mod;
  return binpow(q * 1LL * q % mod, w / 2, mod);
}

template<typename T>
T gcd(T q, T w) {
  while (w) {
    q %= w;
    swap(q, w);
  }
  return q;
}
template<typename T>
T lcm(T q, T w) {
  return q / gcd(q, w) * w;
}

void precalc() {

}

template<typename T>
void relax_min(T& cur, T val) {
  cur = min(cur, val);
}

template<typename T>
void relax_max(T& cur, T val) {
  cur = max(cur, val);
}

//#define int li
//const int mod = 1000000007;

vector<vector<int>> g;

int dfs(int v, int p) {
  int res = 0;
  for (int to : g[v]) {
    if (to == p) {
      continue;
    }
    res ^= (1 + dfs(to, v));
  }
  return res;
}

void solve(bool read) {
  int n;
  cin >> n;
  g.resize(n);
  for (int i = 1; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int res = dfs(0, 0);
  if (res) {
    cout << "Alice\n";
  } else {
    cout << "Bob\n";
  }

}

Measured memory_bytes: 10368
import java.util.Scanner;


public class Main{
    public static Scanner scan  = new Scanner(System.in);
    public static void main(String[]args){
        int a = nextInt();
        int b = nextInt();
        print(a*b);
        
    }

    public static int nextInt(){
        return Integer.parseInt(scan.next());
    }
    public static long nextLong(){
        return Long.parseLong(scan.next());
    }
    public static String next(){
        return scan.next();
    }
    public static double nextDouble(){
        return Double.parseDouble(scan.next());
    }
    public static float nextFloat(){
        return Float.parseFloat(scan.next());
    }

    //Yes or No
    public static void yesNo(boolean flag){
        if(flag) System.out.println("Yes");
        else System.out.println("No");
    }

    //print
    public static void print(Object a){
        System.out.println(a);
    }


    //gcd
    public static int gcd (int a, int b){
        int tmp;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return b;
    }


    //lcm
    public static int lcm(int a,int b){
        int tmp;
        long c = a;
        c *= b;
        while((tmp = a%b) != 0){
            a = b;
            b = tmp;
        }
        return (int)(c/b);
    }
}

Measured memory_bytes: 35724
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
typedef long long ll;
int cmp(const void *a, const void *b)
{
	return *(ll *)a-*(ll *)b;
}
int main()
{
	ll N,C,K,T[100005];
	ll p_num,i,j,bus_num;
	scanf("%lld %lld %lld",&N,&C,&K);
	for (i=0;i<N;i++) {
		scanf("%lld",&T[i]);
	}
	qsort(T,N,sizeof(T[0]),cmp);
	bus_num=0;
	for (i=0;i<N;i++) {
		j=T[i]+K;
		p_num=0;
		while (T[i]<=j&&i<N) {
			p_num++;
			i++;
			if (p_num==C)
				break;
		}
		i--;
		bus_num++; 
	}
	printf("%lld\n",bus_num);
	return 0;
 } 

Measured memory_bytes: 1788
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int N = stdIn.nextInt();
        int M = stdIn.nextInt();
        stdIn.close();

        int Count = ((N * (N - 1)) + (M * (M - 1))) / 2;

        System.out.println(Count);
    }
}

Measured memory_bytes: 23636
import java.util.Scanner;

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

        int n = scanner.nextInt();

        int negatives = 0;
        int minAbs = Integer.MAX_VALUE;
        boolean hasZero = false;

        long sum = 0;

        for (int i = 0; i < n; i++) {
            int a = scanner.nextInt();
            if (a < 0) negatives++;
            if (a == 0) hasZero = true;
            sum += Math.abs(a);
            minAbs = Math.min(minAbs, Math.abs(a));
        }

        if (hasZero || negatives % 2 == 0) {
            System.out.println(sum);
        } else {
            System.out.println(sum - 2 * minAbs);
        }
    }
}

Measured memory_bytes: 49608
import math
n = int(input())
t, a = map(int, input().split())
h = [int(_) for _ in input().split()]

t_list = []
for i in range(n):
    t_list.append(math.fabs(t-h[i]*0.006 - a))

sol = min(t_list)
for i in range(n):
    if t_list[i] == sol:
        print(i+1)
        exit()


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{   int n,a[100010],mixn=0x7fffffff;
    cin>>n;
    for(int i=1;i<=n;++i)
        cin>>a[i];
    for(int i=n;i>=1;--i)
    {
    	mixn=min(mixn,a[i]);
    	if(a[i]-mixn>1)
    	{
    		cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
} 

Measured memory_bytes: 640
#include <stdio.h>

int main(){
  int n,m;
  scanf("%d %d\n",&n,&m);
  int food[m];
  int num;
  int like;
  for(int i = 0; i < m; ++i) food[i] = 0;
  for(int i = 0; i < n; ++i){
    scanf("%d",&num);
    for(int j = 0; j < num; ++j){
      scanf("%d",&like);
      food[like-1]++;
    }
    scanf("\n");
  }
  int like_num = 0;
  for(int i = 0; i < m; ++i) if(food[i] == n) like_num++;
  printf("%d\n",like_num);
  return 0;
}

Measured memory_bytes: 128
inp = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n')
inp = inp.shift().split(" ").map((x) => +x)
A = inp.shift()
B = inp.shift()
H = inp.shift() 
M = inp.shift()

p = 10e10

h = H / 12 * 360 + M / 60 * 360 / 12
h = h * (Math.PI / 180)  
m = M / 60 * 360
m = m * (Math.PI / 180)  

t = function(n) {
    return Math.round(n * p) / p
}

ax = A * t(Math.cos(h))
ay = A * t(Math.sin(h))
bx = B * t(Math.cos(m))
by = B * t(Math.sin(m))

c = Math.sqrt((ax - bx)*(ax - bx) + (ay - by)*(ay - by))

console.log(c)


Measured memory_bytes: 29640
#include <bits/stdc++.h> 
using namespace std;  
int main() {
int a,b,c;
cin>>a>>b>>c;
if(a==b&&b==c)   {
cout  <<  "1"  <<  endl; 
}
else if(a==b||a==c||b==c){
 cout << "2" <<endl;
}
else {
cout <<"3"<<endl;
}
}


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

int main() {
  vector<char> a(3);
  rep(i,3) cin >> a[i];
  int cnt = 0;
  rep(i,3) if(a[i] == '1') cnt++;
  cout << cnt;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <list>
#include <tuple>
#include <bitset>
#include <ciso646>
#include <cassert>

using namespace std;

#define int long long
#define double long double

typedef pair<int, int> P;
typedef tuple<int, int, int> T;

template<class T> string tostr(T x){stringstream o;o<<x;return o.str();}
template<class T> T sqr(T x){return x*x;}
template<class T> T mypow(T x,int n){T r=1;while(n>0){if(n&1)r=r*x;x=x*x;n>>=1;}return r;}

int toint(string s){int v; stringstream i(s);i>>v;return v;}
bool check(int y, int x, int h, int w){return y>=0&&x>=0&&y<h&&x<w;}
int gcd(int a,int b){return b ? gcd(b, a%b) : a;}
int lcm(int a,int b){return a / gcd(a, b) * b;}

#define REP(i,a,b)	for(int (i) = (a);i < (b);(i)++)
#define rep(i,n)	REP(i,0,n)
#define PER(i,a,b)	for(int (i) = (a-1);i >= (b);(i)--)
#define per(i,n)	PER(i,n,0)
#define each(i,n)	for(auto &i : n)
#define clr(a)		memset((a), 0 ,sizeof(a))
#define mclr(a)		memset((a), -1 ,sizeof(a))
#define all(a)		(a).begin(),(a).end()
#define sz(a)		(sizeof(a))
#define dump(val) 	cerr << #val " = " << val << endl;
#define dum(val)	cerr << #val " = " << val;
#define Fill(a,v)	fill((int*)a,(int*)(a+(sz(a)/sz(*(a)))),v)

const int dx[8] = { +1,+0,-1,+0,+1,+1,-1,-1 };
const int dy[8] = { +0,-1,+0,+1,-1,+1,-1,+1 };
const int mod = 1e9 + 7;
const int INF = 1e17 + 9;

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

	int n, m;
	cin >> n >> m;

	int d[10][10];
	clr(d);

	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		d[a][b] = d[b][a] = 1;
	}

	function<int(int, set<int>)> dfs = [&](int now, set<int> se) {
		if (se.size() == n)return 1ll;
		int count = 0;
		rep(to, n) {
			if (d[now][to] && se.count(to) == false) {
				auto next_se = se;
				next_se.insert(to);
				count += dfs(to, next_se);
			}
		}
		return count;
	};

	cout << dfs(0, set<int>({0})) << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>

#define NBUF (100005)
int N;
int a[NBUF];

void input(void){
	scanf("%d",&N);
	for(int i=0;i<N;i++) scanf("%d",&a[i]);
}

int main(void){
	input();
	std::sort(a,a+N);
	//for(int i=0;i<N;i++)printf("%d ",a[i]);
		
	int max=0;
//	int X=-1;
	int lower;
	int upper;
	for(int i=0;i<N;i++){
		lower = i;
		upper = N;
		int index;
		while(1){
			index = (lower+upper)/2;
			//printf("i %d index %d",i,index);
			if(a[index]-a[i]<3){
				if(index==N-1)break; 
				if(a[index+1]-a[i]>2)break;
				lower = index;	
			}else
			{
				upper = index;
			}
		}
		int cnt = index-i+1;
		if(max<cnt){
			max = cnt;
			if(cnt>N-i) break;
			//X=a[i]+1;
		}
	}

	printf("%d\n",max);
	return 0;
}


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

typedef long long ll;
#define int ll
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

#define int ll

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define ALL(s) (s).begin(),(s).end()
#define ALLn(s,n) s,s+n
#define F first
#define S second
#define pb push_back
#define tc(t) int t; cin >> t; while(t--)
#define _ ios_base::sync_with_stdio(false); cin.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n"; }

const ll MOD = 1e9 + 7;
const ll MAXN = 1e6 + 7;
const ll INF = LONG_LONG_MAX;


void solve() {
	string s;
	cin >> s;

	int cnt = 0, ans = 0;

	F0R(i,3) {
		if(s[i] == 'R') cnt++;
		else {
			ans = max(ans, cnt);
			cnt = 0;
		}
	}

	ans = max(ans, cnt);
	cout << ans;
}

int32_t main() {_
	
#ifndef ONLINE_JUDGE
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
#endif

	// tc(t)
		solve();
	cerr << "[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
}

Measured memory_bytes: 3784
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
 
using namespace std;
int main(void){
  int n,k,i;
  cin>>n>>k;
  vector<int> a;
  int maxt,mint;
  maxt=0;
  mint=1111111111;
  int gu,ki;
  gu=0;
 
  for(i=0;i<n;i++){
    int t;
    cin>>t;
    maxt=max(maxt,t);
    mint=min(mint,t);
 
    a.push_back(t);
    if(t==k) gu=1;
    if(mint==1) gu=1;
  }
  sort(a.begin(),a.end());
  for(i=0;i<n;i++){
    if(abs(a[i]-a[i-1])==1) gu=1;
    if(abs(a[i]-a[i-1])==0) continue;
    if(!i==0) mint=min(mint,abs(a[i]-a[i-1]));
  }
  if(maxt<k){
    cout<<"IMPOSSIBLE"<<endl;
    return 0;
  }
  if(gu==1){cout
      <<"POSSIBLE"<<endl;
    return 0;
  }
  if(mint!=0){
    if(k%mint==0){
      cout<<"POSSIBLE"<<endl;
      return 0;
    }
  }
  bool flag=true;
  for(i=0;i<n;i++){
    if(mint==0) continue;
    if(a[i]%mint!=0) {
      flag=false;
      break;
    }
  }
  if(flag) cout<<"IMPOSSIBLE"<<endl;
  else cout<<"POSSIBLE"<<endl;
  return 0;
}

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

#define INF INT_MAX
#define UINF UINT_MAX
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()

typedef long long ll;
typedef std::pair<int,int> pii;

using namespace std;

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

    ll x,y,a,b,c;
    cin >> x >> y >> a >> b >> c;
    vector<ll> aa(a),bb(b),cc(c);
    REP(i,a)cin >> aa[i];
    REP(i,b)cin >> bb[i];
    REP(i,c)cin >> cc[i];

    sort(all(aa),greater<ll>());
    sort(all(bb),greater<ll>());
    sort(all(cc),greater<ll>());
    
    ll ans = 0;
    ll a_index = 0,b_index = 0,c_index = 0;
    REP(i,x+y){
        if(b_index >= y || (a_index < x && aa[a_index] > bb[b_index])){
            if(c_index >= c || aa[a_index] > cc[c_index]){
                ans += aa[a_index++];
            }else{
                ans += cc[c_index++];
            }
        }else{
            if(c_index >= c || bb[b_index] > cc[c_index]){
                ans += bb[b_index++];
            }else{
                ans += cc[c_index++];
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2560
import java.io.*;
import java.util.*;
public class Main {
  public static void main(String[] args) throws Exception {
    String line = null;
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int aa = Integer.parseInt(br.readLine());
    int bb = Integer.parseInt(br.readLine());
    int cc = Integer.parseInt(br.readLine());
    int xx = Integer.parseInt(br.readLine());
    int count = 0;
    for (int i = 0; i <= aa; i ++) {
      if (500 * i > xx) continue;
      for (int j = 0; j <= bb; j ++) {
        if ((500 * i + 100 * j) > xx) continue;
        for (int k = 0; k <= cc; k ++) {
          int val = 500 * i + 100 * j + 50 * k;
          if (val == xx ) count = count + 1;
          //System.out.println(i + "," + j + "," + k + "," + val + "," + count);
        }
      }
    }
    System.out.println(count);
  }
}

Measured memory_bytes: 22868
#include<stdio.h>
long c[100000];
int main(int argc, char const *argv[]){
	long n,m,i,a,b;
	scanf("%ld %ld",&n,&m);
	for(i=0;i<m;i++){
		scanf("%ld %ld",&a,&b);
		c[a-1]++;
		c[b-1]++;
	}
	for(i=0;i<n;i++){
		if(c[i]%2!=0){
			printf("NO\n");
			return 0;
		}
	}
	printf("YES\n");
	return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)   FOR(i,0,n)
#define ALL(a)     (a).begin(),(a).end()
#define VI         vector<int>
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e19;
//const int INF=(1<<30);


int main(){
  int n;
  cin >> n;
  set<string> st;
  REP(i,n){
    string s;
    cin >> s;
    st.insert(s);
  }
  cout << st.size() << endl;
}



Measured memory_bytes: 19256
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <string>
#include <stdexcept>
using namespace std;

int main() {
  int A, B, C;
  cin >> A >> B >> C;
  int max;
  if(A>B)
    max = A;
  else
    max = B;
  if(max < C)
    max = C;

  if(max == A) {
    cout << A*10 + B + C<< endl;
    return 0;
  }
  else if(max == B) {
    cout << B*10 + A + C << endl;
    return 0;
  }
  else
    cout << C*10 + A + B << endl;
}


Measured memory_bytes: 256
from collections import deque
from heapq import heapify,heappop,heappush,heappushpop
from copy import copy,deepcopy
from itertools import product,permutations,combinations,combinations_with_replacement
from collections import defaultdict,Counter
from bisect import bisect_left,bisect_right
# from math import gcd,ceil,floor,factorial
# from fractions import gcd
from functools import reduce
from pprint import pprint

def myinput():
    return map(int,input().split())

def mylistinput(n):
    return [ list(myinput()) for _ in range(n) ]

def mycol(data,col):
    return [ row[col] for row in data ]

def mysort(data,col,reverse_flag):
    data.sort(key=lambda x:x[col],reverse=reverse_flag)
    return data

def mymax(data):
    M = -1*float("inf")
    for i in range(len(data)):
        m = max(data[i])
        M = max(M,m)
    return M

def mymin(data):
    m = float("inf")
    for i in range(len(data)):
        M = min(data[i])
        m = min(m,M)
    return m

def myoutput(ls,space=True):
    if space:
        if len(ls)==0:
            print(" ")
        elif type(ls[0])==str:
            print(" ".join(ls))
        elif type(ls[0])==int:
            print(" ".join(map(str,ls)))
        else:
            print("Output Error")
    else:
        if len(ls)==0:
            print("")
        elif type(ls[0])==str:
            print("".join(ls))
        elif type(ls[0])==int:
            print("".join(map(str,ls)))
        else:
            print("Output Error")

x = int(input())

N = 1000
for a in range(N):
    for b in range(-1*N,N):
        m = a**5 - b**5
        # print(m)
        if x==m:
            print(a,b)
            exit()
        else:
            pass

Measured memory_bytes: 68620
#include <bits/stdc++.h>
 
#define ff first
#define ss second
#define mp make_pair
 
using namespace std;
 
typedef long long ll;

pair<int,int> v[200005];
ll st[800005];  

void update(int i, int L, int R, ll num, int p) {
    if(L == R) st[p] = max(st[p], num);
    else if(i < L or i > R) return;
    else {
        int M = (L+R)/2;
        update(i,L,M,num,2*p);
        update(i,M+1,R,num,2*p+1);
        st[p] = max(st[2*p], st[2*p+1]); 
    }
}

ll query(int i, int j, int L, int R, int p) {
    if(L > j or R < i) return 0;
    if(L >= i and R <= j) return st[p];
    int M = (L+R)/2;
    return max(query(i,j,L,M,2*p), query(i,j,M+1,R,2*p+1));
}

int main() {
    int n;
	scanf("%d", &n);
    
    for(int i = 0; i < n; i++)
        scanf("%d", &v[i].ff);
    for(int i = 0; i < n; i++)
        scanf("%d", &v[i].ss);

    ll ans = 0;
    
    for(int i = 0; i < n; i++) {
        ll cand = v[i].ff > 1 ? query(1, v[i].ff-1, 1, n, 1) : 0;
        cand += v[i].ss;
        ans = max(ans, cand);
        update(v[i].ff, 1, n, cand, 1);
    }

    printf("%lld\n", ans);
	
    return 0;
}

Measured memory_bytes: 7936
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n;
	ll stock=0LL;
	ll has=0LL;

	ll yen=1000LL;
	cin >>n;
	V a(n);
	rep(i,n){
		cin>>a[i];
	}
	pair<ll,ll>data;
	vector<pair<ll,ll>>log;
	data=mp(INF,-INF);
	rep(i,n){
		if(data.F >a[i]){
			if (data.F != INF and data.S != -INF)
			{
				log.push_back(data);
				
			}
			data = mp(INF, -INF);
			data.F=a[i];
		}else if(data.S <a[i]){
			data.S=a[i];
		}else{
			if (data.F != INF and data.S != -INF)
			{
				log.push_back(data);
			}
			data=mp(INF,-INF);
			data.F=a[i];
		}
	}
	if(data.F!=INF and data.S!=-INF){
		log.push_back(data);
	}
	repi(itr,log){
	//	clog<<(itr->F)<<" "<<(itr->S)<<endl;
		yen+=((itr->S)-(itr->F))*(yen/(itr->F));
	}
	cout<<yen<<endl;
}
/*
7
100 130 130 130 115 115 150

(10)
0
0
100 30 -> 10 -> 1300
115 35  -> 11 -> 1300+ 385 = 1685
*/

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ld long double
#define F first
#define S second
#define pii pair<ll,ll>

using namespace :: std;

const ll maxn=5009;
const ll inf=1e9+500;
const ll mod=1e9+7;
const ll rad=5e5;

ll f(ll b,ll n){
    if(n<b){
        return n;
    }
    return f(b,n/b)+(n%b);
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    ll n,s;
    cin>>n>>s;
    if(s>n){
        cout<<-1;
        return 0;
    }
    if(s==n){
        cout<<n+1;
        return 0;
    }
    for(ll i=2;i<=rad;i++){
        if(f(i,n)==s){
            cout<<i;
            return 0;
        }
    }
    ll v=n-s;
    vector<ll> vec;
    for(ll i=1;i*i<=v;i++){
        if(v%i==0){
            vec.pb(i);
            vec.pb(v/i);
        }
    }
    sort(vec.begin(),vec.end());
    for(auto u:vec){
        if(f(u+1,n)==s){
            cout<<u+1;
            return 0;
        }
    }
    cout<<-1;
    return 0;
}


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

int main() {
  int n, l, r;
  int count = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l >> r;
    count += r - l + 1;
  }
  cout << count << endl;
}

Measured memory_bytes: 3636
def main():
    n = int(input())
    p = [2]
    for i in range(2,55556):
        for j in p:
            if i%j == 0:
                break
        else:
            p.append(i)
    l = []
    for i in p:
        if i%5 == 1:
            l.append(i)
    ans_list = [str(i) for i in l[:n]]
    print(" ".join(ans_list))
    
if __name__ == '__main__':
    main()

Measured memory_bytes: 39280
import java.util.*;
import java.io.*;

class Main{
    public static void main(String[] args){
        FastScanner fsc=new FastScanner();
        int x=fsc.nextInt();
        int y=fsc.nextInt();
        int z=fsc.nextInt();
        x-=z;
        y+=z;
        fsc.close();
        System.out.println(x/y);
    }
    static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte(){
            if(ptr<buflen) return true;
            else{
                ptr = 0;
                try{
                    buflen = in.read(buffer);
                }
                catch(IOException e){
                    e.printStackTrace();
                }
                if(buflen<=0) return false;
            }
        return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) throw new NumberFormatException();
            while(true){
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                }
                else if(b == -1 || !isPrintableChar(b)) return minus ? -n : n;
                else throw new NumberFormatException();
                b = readByte();
            }
        }
        public int nextInt() {
            long nl = nextLong();
            if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
            return (int) nl;
        }
        public double nextDouble() { return Double.parseDouble(next());}
        public void close(){
            try{in.close();}
            catch(IOException e){e.printStackTrace();}
        }
    }
}


Measured memory_bytes: 22996
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int N, a[4][14], b[9];
char T[15] = "-A23456789TJQK";
char U[5] = "SCHD";
string S; pair<int, int>d[5];
int poker() {
	int e[14], f[9];
	int g[14], h[9];
	for (int i = 0; i < 14; i++) { e[i] = 0; g[i] = 0; }
	for (int i = 0; i < 9; i++) { f[i] = 0; h[i] = 0; }
	for (int i = 0; i < 5; i++) {
		e[d[i].first]++;
		f[d[i].second]++;
	}
	for (int i = 0; i < 14; i++) { g[e[i]]++; }
	for (int i = 0; i < 4; i++) { h[f[i]]++; }
	if (h[5] == 1) {
		if (d[0].first != 1) { goto E; }
		if (d[1].first != 10) { goto E; }
		if (d[2].first != 11) { goto E; }
		if (d[3].first != 12) { goto E; }
		if (d[4].first != 13) { goto E; }
		return 8; E:;
		for (int i = 1; i < 5; i++) {
			if (d[i].first != d[i - 1].first + 1) {
				goto F;
			}
		}
		return 7; F:;
		return 4;
	}
	if (g[4] == 1) { return 6; }
	if (g[2] == 1 && g[3] == 1) { return 5; }
	for (int i = 1; i < 5; i++) {
		if (d[i].first != d[i - 1].first + 1) {
			goto G;
		}
	}
	return 3; G:;
	if (d[0].first != 1) { goto H; }
	if (d[1].first != 10) { goto H; }
	if (d[2].first != 11) { goto H; }
	if (d[3].first != 12) { goto H; }
	if (d[4].first != 13) { goto H; }
	return 3; H:;
	if (g[3] == 1) { return 2; }
	if (g[2] == 2) { return 1; }
	if (g[2] == 1) { return 0; }
	return 9;
}
int main() {
	int cnt = 0;
	while (cin >> N) {
		if (cnt) { cout << endl; }
		cnt++;
		for (int i = 0; i < 4; i++) {
			for (int j = 1; j <= 13; j++) {
				cin >> a[i][j];
			}
		}
		for (int i = 0; i < 9; i++) { cin >> b[i]; }
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < 5; j++) {
				cin >> S;
				for (int k = 0; k < 14; k++) {
					if (T[k] == S[0]) { d[j].first = k; }
				}
				for (int k = 0; k < 4; k++) {
					if (U[k] == S[1]) { d[j].second = k; }
				}
			}
			sort(d, d + 5);
			int A = b[poker()];
			int B = 0;
			for (int j = 0; j < 5; j++) {
				B += a[d[j].second][d[j].first];
			}
			cout << A*B << endl;
		}
	}
}

Measured memory_bytes: 1204
def solve_eq(a,b,c):
    return (-b-(b**2-4*a*c)**0.5)/(2*a),(-b+(b**2-4*a*c)**0.5)/(2*a)

def ret_line(x1,y1,x2,y2):
    k = (y1-y2)/(x1-x2)
    d = y1-k*x1
    return k,d
    
x,y,r = map(float,input().split())
q = int(input())
x1,y1,x2,y2 = [],[],[],[]
for i in range(q):
    arr = list(map(float,input().split()))
    x1.append(arr[0])
    y1.append(arr[1])
    x2.append(arr[2])
    y2.append(arr[3])

for i in range(q):
    if x1[i] != x2[i]:
        k,d = ret_line(x1[i],y1[i],x2[i],y2[i])
        p1,p2 = solve_eq(1+k**2,2*k*d-2*k*y-2*x,x**2+y**2+d**2-2*y*d-r**2)
        print(p1,k*p1+d,p2,k*p2+d)
    if x1[i] == x2[i]:
        p1,p2 = solve_eq(1,-2*y,y**2+(x1[i]-x)**2-r**2)
        print(x1[i],p1,x1[i],p2)

Measured memory_bytes: 7932
#!/usr/bin/env python3

K = int(input())

l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(l[K-1])


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
const int N = 1e8 + 10;
using ll = long long;
using ull = unsigned long long;
const ll mod = 1e9 + 7;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int a, b;
	cin >> a >> b;
	cout << (b < 100 ? b : 101) * int(ceil(pow(100, a)));
}


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

using ll=long long;

int main() {
  string S; cin >>S;
  int ans=0;
  if (count(S.begin(),S.end(),'R')==3) {
    ans=3;
  } else if ( (S[0]=='R' and S[1]=='R') or (S[1]=='R' and S[2]=='R') ) {
    ans=2;
  } else if ( (count(S.begin(),S.end(),'R')==2) or (count(S.begin(),S.end(),'R')==1) ) {
    ans=1;
  }
  cout <<ans <<endl;
  return 0;
}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		long N = sc.nextLong();
		long S = sc.nextLong();
		System.out.println(solve(N, S));
	}

	static long solve(long N, long S) {
		for (long b = 2; b * b <= N; ++b) {
			long sum = 0;
			long v = N;
			while (v > 0) {
				sum += v % b;
				v /= b;
			}
			if (sum == S) {
				return b;
			}
		}
		long ans = Long.MAX_VALUE;
		for (long i = 1; i * i <= N - S; ++i) {
			if ((N - S) % i != 0) continue;
			long x = i;
			long b = (N - S) / i + 1;
			long y = N - x * b;
			if (0 <= y && y < b) {
				ans = Math.min(ans, b);
			}
		}
		if (N == S) {
			ans = Math.min(ans, N + 1);
		}
		return ans == Long.MAX_VALUE ? -1 : ans;
	}

}


Measured memory_bytes: 9680
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;

public class Main {

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

		int n = Integer.parseInt(br.readLine());
		ArrayList<Integer> list = new ArrayList<>();

		for (int i = 1; i <= n; i++) {
			if (n - i < i) {
				list.add(i);
				n -= i;
				break;
			} else {
				list.add(i);
				n -= i;
			}
		}

		for (int i = 0; i < list.size(); i++) {
			if (i == list.size() - n)
				System.out.println(list.get(i) + n);
			else
				System.out.println(list.get(i));
		}
	}
}


Measured memory_bytes: 34956
#include <iostream>
using namespace std;
int main(){
  int n=0;
  for(int i=0;i<3;i++){
    int a;cin>>a;
    n+=a;
  }
  if(n>=22){
    cout << "bust" <<endl;
  }else{
    cout << "win" <<endl;
  }
}

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

if N%10 == 2 or N%10 == 4 or N%10 == 5 or  N%10 == 7 or N%10 == 9:
  print("hon")
  
elif N%10 == 0 or N%10 == 1 or N%10 == 6 or N%10 == 8:
  print("pon")
  
else:
  print("bon")

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  string s;
  ll n, q;
  cin >> n >> q >> s;
  
  vector<ll> a(n);
  rep(i, 0, n-1) {
    if(s[i]=='A' and s[i+1]=='C')
      a[i]++;
  }
  vector<ll> wa(n+1, 0);
  rep(i, 0, n) {
    wa[i+1] = wa[i] + a[i];
  }
  
  rep(i, 0, q) {
    ll l, r;
    cin >> l >> r;
    ll ret = wa[r]-wa[l-1];
    cout << (wa[r-1] < wa[r] ?ret-1 :ret) << "\n";    
  }
}

Measured memory_bytes: 2640
#include <set>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

int m, d, res = 0;

int main() {

	scanf("%d %d", &m, &d);

	for (int i = 1; i <= m; i++) {
		for (int j = 1; j <= d; j++) {
			int x = j / 10;
			int y = j % 10;
			if (x >= 2 && y >= 2 && x * y == i) res++;
		}
	}

	printf("%d\n", res);

	return 0;

}

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

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

    if (a + b >= c)
    cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int exceedhalf(int a[], int rlimit, int n)
{
  int dp[301][50000] = { };
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < rlimit + 1; j++) {
      if (j < a[i]) {
        dp[i + 1][j] = (2 * dp[i][j] % 998244353 + dp[i][0]) % 998244353;
      } else {
        dp[i + 1][j] = (2 * dp[i][j] % 998244353 + dp[i][j - a[i]]) % 998244353;
      }
    }
  }
  return dp[n][rlimit];
}

int exactlyhalf(int a[], int rest, int n)
{
  int dp[301][50000] = { };
  dp[0][0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < rest + 1; j++) {
      if (j >= a[i]) {
      	dp[i + 1][j] = (dp[i][j] + dp[i][j - a[i]]) % 998244353;
      } else {
        dp[i + 1][j] = dp[i][j];
      }
    }
  }
  return dp[n][rest];
}

int main()
{
  int n, a[300], sum = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  int limit = (sum + 1) / 2;
  int total = 1;
  for (int i = 0; i < n; i++) {
    total += 2 * total % 998244353;
    total %= 998244353;
  }
  for (int i = 0; i < 3; i++) {
  	total -= exceedhalf(a, limit, n);
    if (total < 0) total += 998244353;
    total %= 998244353;
  }
  if (sum % 2 == 0) {
    for (int i = 0; i < 3; i++) {
      total += exactlyhalf(a, sum / 2, n);
      total %= 998244353;
    }
  }
  printf("%d\n", total);
  return 0;
}


Measured memory_bytes: 59008
import core.bitop;
import std.algorithm;
import std.ascii;
import std.bigint;
import std.conv;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.random;
import std.typecons;

alias sread = () => readln.chomp();
alias Point2 = Tuple!(long, "y", long, "x");

T lread(T = long)()
{
    return readln.chomp.to!T();
}

T[] aryread(T = long)()
{
    return readln.split.to!(T[])();
}

void scan(TList...)(ref TList Args)
{
    auto line = readln.split();
    foreach (i, T; TList)
    {
        T val = line[i].to!(T);
        Args[i] = val;
    }
}

void minAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) min(dst, src);
}

void maxAssign(T, U = T)(ref T dst, U src)
{
    dst = cast(T) max(dst, src);
}

enum MOD = (10 ^^ 9) + 7;

void main()
{
    long K, S;
    scan(K, S);
    long ans;
    foreach (x; 0 .. K + 1)
        foreach (y; 0 .. K + 1)
        {
            if (x + y <= S && S - (x + y) <= K)
            {
                ans++;
            }
        }
    writeln(ans);
}


Measured memory_bytes: 256
"use strict"
function main(arg) {
    var data = arg.trim().split("\n")[1].split(" ").map(Number)
    var N = data.length
    var current = 1
    var sum = 0
    for (var i = 0; i < N; i++) {
        if (data[i] === current) {
            sum++
            current++
        }
    }
    if (sum === 0) {
        console.log(-1)
    } else {
        console.log(N - sum)
    }
}

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

Measured memory_bytes: 22244
// Problem : A - Remaining Balls
// Contest : AtCoder Beginner Contest 154
// URL : https://atcoder.jp/contests/abc154/tasks/abc154_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/coder3101/cp-editor)

#include<bits/stdc++.h>
#define pb emplace_back
#define int long long
#define vi vector<int>
#define pii pair<int,int>
#define m_p(x,y) make_pair(x,y)
#define vp vector<pair<int,int>>
#define setbits(x) __builtin_popcountll(x)
#define f first
#define se second
#define iniz(n) memset(n,0,sizeof(n))
#define inin(n) memset(n,-1,sizeof(n))
#define inf LLONG_MAX
using namespace std;
template<typename T1,typename T2>istream &operator>>(istream &is, vector<pair<T1,T2>> &v) { for (pair<T1,T2> &t : v) is >> t.f>>t.se; return is; }
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
double pi=acos(-1.0);
int md=1000000007;
int abst(int a)
{return a<0?-a:a;}
struct HASH{
  size_t operator()(const pii &x)const{
    return (size_t) x.first * 37U + (size_t) x.second;}};

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int Pow(int n,int x){int ans=1;
 while(x>0)
 {if(x&1)ans=(ans*n)%md;n=(n*n)%md;x=x>>1;}
 return ans;}

 vi fact,inv;
void inverse(int n)
{inv.resize(n+1);inv[0]=1;
for(int i=1;i<=n;i++)inv[i]=Pow(fact[i],md-2);}
void factorial(int n)
{fact.resize(n+1);fact[0]=1;
for(int i=1;i<=n;i++)fact[i]=(fact[i-1]*i)%md;}

int max(int a,int b){return a>b?a:b;}
int min(int a,int b){return a<b?a:b;}

void solve()
{
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string s,t;cin>>s>>t;
int a,b;cin>>a>>b;
string s1;cin>>s1;
if(s1==s)a--;else b--;
cout<<a<<" "<<b;
}

int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
int t=1;
//cin>>t;
while(t--)
{
    solve();
}
}


Measured memory_bytes: 256
import sys
#import numpy as np
import math
#from fractions import Fraction
#import itertools
#from collections import deque
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
n=int(input())
a=list(map(int,input().split()))
M=max(a)
m=min(a)
resm=m
resM=M
c_M=False
c_m=False
ans=[]
for i in range(n):
    if a[i]==M and c_M==False:
        c_M=True
        continue
    elif a[i]==m and c_m==False:
        c_m=True
        continue
    if a[i]>0:
        ans.append((resm,a[i]))
        resm=resm-a[i]
    else:
        ans.append((resM,a[i]))
        resM=resM-a[i]
print(resM-resm)
for i in ans:
    print(*i)
print(resM,resm)


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

using namespace std;
using ll = long long;

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

  int n, k;
  cin >> n >> k;
  string s;
  cin >> s;

  // char prev = '_';
  // int cnt = 0;
  // for (auto c : s) {
  //   if (prev != c) {
  //     cnt++;
  //   }
  //   prev = c;
  // }
  // cout << (n - max(1, cnt - 2 * k)) << endl;

  int x = 0;
  int y = 0;
  for (int i = 0; i < n - 1; i++) {
    if (s[i] == 'R' && s[i + 1] == 'L')
      x++;
  }
  if (s[0] == 'L')
    y++;
  if (s[n - 1] == 'R')
    y++;

  int tmp = min(x, k);
  x -= tmp;
  k -= tmp;
  tmp = min(y, k);
  y -= tmp;
  k -= tmp;
  cout << min(n - 1, (n - 2 * x - y)) << endl;

  return 0;
}


Measured memory_bytes: 3776
from collections import Counter

n = int(input())
a = [int(x) for x in input().split()]
cnt = [0] * (10**6 + 1)

dic = Counter(a)

for i in set(a):
    if 1 < dic[i]:
        cnt[i] += 1
        
a = list(set(a))
a_max = max(a)
for i in a:
    for j in range(1, 10**6 + 1):
        if a_max < i * j:
            break
        
        cnt[i * j] += 1

ans = 0
for i in range(len(a)):
    if cnt[a[i]] == 1:
        ans += 1
        
print(ans)

Measured memory_bytes: 53152
N = int(input())
A = list(sorted(list(set(map(int, input().split())))))
while True:
    n = len(A)
    if n == 1 or A[0] == 1:
        break
    B = {A[0]}
    for j in range(1, n):
        m = A[j] % A[0]
        if m != 0:
            B.add(m)
    A = list(sorted(list(B)))
print(A[0])


Measured memory_bytes: 25288
#include<iostream>
#include<algorithm>
using namespace std;
const int maxn = 100000 + 5;
int A[maxn];
int main()
{
	int n, a, b,sum;
	while (cin>>n)
	{
		
		sum = 0;
		for (int i = 0; i < n; i++)
		{
			cin >> A[i];
		}
		sort(A, A + n);
		a = A[0];
		b = 1;
		A[n] = 0;
		for(int i = 1; i <= n; i++)
		{
			if (a == A[i])
			{
				b++;
			}
			else
			{
				a = A[i];
				sum += b % 2;
				b = 1;
			}
		}
		cout << sum << endl;
	}
	return 0;
}

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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    ll n;
    cin>>n;
    ll a[5];
    ll mi = LLONG_MAX;
    for(int i = 0; i < 5; i++)
    {
        cin>>a[i];
        mi = min(mi,a[i]);
    }
    ll ans = (n+mi-1)/mi + 4;
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256