akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;

#define MOD 1000000007

vector<pair<ll,ll>> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
 
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; }
 
#define MAX_N 100010
bool x[MAX_N];
ll num[MAX_N];
 
ll fibl[MAX_N]={0};
 
ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

int main(){
    ll x,y,ans=0;
    cin >> x >> y;
    if (x==1){
        ans+=300000;
    }else if (x==2){
        ans+=200000;
    }else if (x==3){
        ans+=100000;
    }
    if (y==1){
        ans+=300000;
    }else if (y==2){
        ans+=200000;
    }else if (y==3){
        ans+=100000;
    }
    if (x==1 && y==1)ans+=400000;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
n,m=map(int,input().split())
cityroads=[list() for x in range(n)]
for a in range(m):
    s,t=map(int,input().split())
    cityroads[s-1].append(t-1)
    cityroads[t-1].append(s-1)
for b in cityroads:
    print(len(b))

Measured memory_bytes: 3060
#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
typedef vector<int> vi;
#define all(x) x.begin(),x.end()
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define OO 1e9
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
typedef long long ll;
#define in_range(x, y, r, c) ((x >= 0 && x < r && y >= 0 && y < c))

const double eps=1e-9;
const  int MOD=1e10;
const int N=1e5+9;
const int inf = 1LL<<32;

template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <typename T> T exp(T b, T p){T x = 1;while(p){if(p&1)x=(x*b);b=(b*b);p=p>>1;}return x;}
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
int cnt=0,n;
bool check(int num){
    set<int> s;
    while(num){
        if(s.size()==3)break;
        s.insert(num%10),num/=10;
    }
    return s.size()==3;
}
void dfs(int num){
    if(num>n)return;
    if(check(num))
    cnt++;
    dfs(num*10+5);
    dfs(num*10+7);
    dfs(num*10+3);
}
int32_t main() {
    IOS;
cin>>n;
dfs(0);
cout<<cnt;
}

Measured memory_bytes: 256
N,A,B = list(map(int, input().split()))
s = 0

for i in range(1,N+1):
    k = i
    a = 0
    for l in range(len(str(i))):
        a += k%10
        k = int(k/10)
    if a >= A and a <= B:
        s += i

print(s)




Measured memory_bytes: 3060
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define cerr if(false) cerr
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
using namespace std;
using ll = long long;
using pii = pair<int,int>;
template<typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a){
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os, vector<T> v){
    for(auto x:v)os << x << ' ';
    return os;
}
void debug(){cerr << '\n';}
template<typename H, typename... T>
void debug(H a, T... b){
    cerr << a;
    if(sizeof...(b))cerr << ", ";
    debug(b...);
}
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(max({a,b,c}) == min({a,b,c})){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
X,N = map(int,input().split())
P = list(map(int,input().split()))
X2=X
c=-5000
d=-5000
b=0
for i in range(1000):
    if X+i not in P and X+i <= 200 :
        c=X+i
    if X-i not in P and X-i >= -100: 
        d=X-i
    if c!=-5000:
        if d!=-5000:
            print(d)
        else:
            print(c)
        break
    if d!=-5000:
        print(d)
        break


Measured memory_bytes: 9200
#include<iostream>
#include<cstdlib>

#include<cmath>
#include<map>
#include<string>
#include<vector>
#include<algorithm> 

using namespace std;

# define p(s) std::cout << s << endl;
# define printIf(j,s1,s2) std::cout << (j ? s1 : s2) << endl;
# define YES(j) std::cout << (j ? "YES" : "NO") << endl;
# define Yes(j) std::cout << (j ? "Yes" : "No") << endl;
# define rep(n,i) for(i = 0 ; i < n ; i++)

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

    int d[1000001]={};

    while(d[a*i]==0){
        d[a*i]++;
        if((a*i)%b==c){
            YES(1)
            return 0;
        }
        i++;
    }
    YES(0)
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
#define MOD 1000000007

int main(){
    int n;
    cin >> n;
    map<int,int> ma,mb;
    vi aa(n),bb(n);
    rep(i,n){
        int a;
        cin >> a;
        ma[a]++;
        aa[i]=a;
    }
    queue<int> que;
    rep(i,n){
        int b;
        cin >> b;
        mb[b]++;
        bb[i]=b;
    }
    for(auto x:ma){
        if(x.second+mb[x.first]>n){
            cout << "No" << endl;
            return 0;
        }
    }
    vi ans;
    cout << "Yes" << endl;
    int i=0;
    reverse(bb.begin(),bb.end());
    rep(i,n){
        if(i%3==0) que.push(bb[i]);
    }
    rep(i,n){
        if(i%3==1) que.push(bb[i]);
    }
    rep(i,n){
        if(i%3==2) que.push(bb[i]);
    }
    while(!que.empty()){
        if(que.front()!=aa[i]){
            ans.push_back(que.front());
            que.pop();
            i++;
        }else{
            que.push(que.front());
            que.pop();
        }
    }
    for(int x:ans) cout << x << " ";
    cout << endl;
}


Measured memory_bytes: 25284
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;

const lld N = 200043;
const lld MOD = 1000000007;

lld add(lld x, lld y)
{
    x += y;
    while(x >= MOD) x -= MOD;
    while(x < 0) x += MOD;
    return x;
}

lld mul(lld x, lld y)
{
    return (x * 1ll * y) % MOD;
}

lld binpow(lld x, lld y)
{
    lld z = 1;
    while(y)
    {
        if(y & 1) z = mul(z, x);
        x = mul(x, x);
        y >>= 1;
    }
    return z;
}

lld inv(lld x)
{
    return binpow(x, MOD - 2);
}

lld divide(lld x, lld y)
{
    return mul(x, inv(y));
}

// Combinations

/*
lld fact[N];

void precalc()
{
    fact[0] = 1;
    for(lld i = 1; i < N; i++)
        fact[i] = mul(fact[i - 1], i);
}

lld C(lld n, lld k)
{
    return divide(fact[n], mul(fact[k], fact[n - k]));
}
*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t,i,j;
    //cin>>t;
    t=1;
    while(t--)
    {
        lld a,b,c,k;
        cin>>a>>b>>c>>k;
        lld ans=0;

            ans+=min(k,a);
            k=k-min(k,a);
            if(k>0){

            ans+=0*min(k,b);
                        k=k-min(k,b);}
            if(k>0){
            ans=ans-min(k,c);
                        k=k-min(k,c);
}
 cout<<ans<<endl;

    }
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
const int INF = 101010;

int main(){
    vector<int> a(INF, 1);
  	a[0] = 0; a[1] = 0;
    for(int i=0; i<INF; ++i){
        if(!a[i]){continue;}
        for(int j=i*2; j<INF; j+=i){a[j] = 0;}
    }

    vector<int> like(INF, 0);
    for(int i=0; i<INF; ++i){
        if(i%2==0){continue;}
        if(a[i] && a[(i+1)/2]){like[i] = 1;}
    }
    vector<int> s(INF, 0);
    for(int i=0; i<INF; ++i){
        s[i+1] = s[i] + like[i];
      	
    }
  	
	
  	int q; cin >> q;
    for(int i=0; i<q; ++i){
        int l, r; cin >> l >> r;
        cout << s[r+1] - s[l] << endl;
    }

    return 0;
}

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

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

//status unsolved
struct UnionFind {
    private:vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    public: int group_count;
    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
        group_count=N;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
        group_count--;
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
    
};

bool cmp(pair<long long,int>L1,pair<long long,int>L2){
    return L1.first<L2.first;
}
int main(){

    int n;
    cin>>n;
    vector<pair<long long,int>>xd(n);
    vector<pair<long long,int>>yd(n);
    rep(i,n){
        long long x,y;
        cin>>x>>y;
        xd[i]=make_pair(x,i);
        yd[i]=make_pair(y,i);

    }
    //座標順にソート
    sort(xd.begin(),xd.end(),cmp);
    sort(yd.begin(),yd.end(),cmp);
    //<辺の長さ,<街の番号,街の番号>>edge
    multimap<long long,pair<int,int>>edge;
    rep(i,n-1){
        long long dx=xd[i+1].first-xd[i].first;
        edge.emplace(dx,make_pair(xd[i].second,xd[i+1].second));

        long long dy=yd[i+1].first-yd[i].first;
        edge.emplace(dy,make_pair(yd[i].second,yd[i+1].second));
    }

    UnionFind uf(n);
    long long ans=0;

    if(!edge.empty()){
        auto it=edge.begin();

        while(uf.group_count!=1){
            int one=it->second.first;
            int two=it->second.second;
            if(!uf.same(one,two)){
                ans+=it->first;
                uf.unite(one,two);
            }
            it++;
        }
    }
    cout<<ans<<endl;

    return 0;

}
/*


*/


Measured memory_bytes: 16640
N = int(input())
A = list(map(int, input().split()))

for i in range(N):
  if A[i] == 0:
    print(0)
    exit(0)

ans = 1
for i in range(N):
  if ans * A[i] > 1000000000000000000:
    ans = -1
    break
  ans *= A[i]
print(ans)

Measured memory_bytes: 21488
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<sstream>
#include<cstdio>
#include<algorithm>

using namespace std;
using ll = long long;

const int INF = 1001001001;
const int MOD = 1000000007;


int main() {
    ll N;cin >> N;
    string s = "abcdefghijklmnopqrstuvwxyz";
    string a = "";

    while(N > 0){
        N--;
        char tmp = s[N % 26];
        a += tmp;
        N /= 26;
    }

    reverse(a.begin(), a.end());
    cout << a << endl;
    return 0;
}

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

#define ll long long
#define pb push_back
#define eb emplace_back
//#define st first
#define sc second

using namespace std;

const ll mod = 1e9 + 7;
const int e = 55;
const int base = 311;

// dung inverse module de tinh nCk
// beginer 82
// mbeginer
// cach tao hoan vi tu n so : n*(n+1)/2;

//vector<pair<ll,ll>>adj[e];
//vector<ll>adj[e];

/*ll Pow(ll n, ll dem)
{
    if(dem == 0) return 1;
    if(dem == 1) return n ;
    ll t = Pow(n, dem/2);
    if(dem % 2 == 0) return (t*t);
    else return ((t * t) * n);
}*/

/*ll C(ll k, ll n)
{
    if(k == 0) return 1;
    if(n < k) return 0;
    return (gt[n]%mod * (igt[k]%mod * igt[n-k]%mod)%mod)%mod;
}*/


int main()
{
    int t;
    cin >> t;
    set<string>s;
    while(t -- )
    {
        string t;
        cin >> t;
        s.insert(t);
    }
    cout << s.size();
}
/*

*/


Measured memory_bytes: 19188
import java.util.Scanner;
import java.util.*;

public class Main {
	public static ArrayList <Integer>linkList[][];
	public static int dists[];
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		linkList = new ArrayList[N + 1][2];
		dists = new int[N + 1];
		
		for(int i = 0; i < N + 1; i++) {
			dists[i] = Integer.MIN_VALUE;
			linkList[i][0] = new ArrayList<Integer>();
			linkList[i][1] = new ArrayList<Integer>();
		}
		for(int i = 0; i < M; i++) {
			int l = sc.nextInt();
			int r = sc.nextInt();
			int d = sc.nextInt();
			linkList[l][0].add(r);
			linkList[l][1].add(d);
			linkList[r][0].add(l);
			linkList[r][1].add(-d);
		}
		for(int i = 0; i < N; i++){
			if(dists[i] != Integer.MIN_VALUE)continue;
			if(!dfs(i, 0)){
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
	public static boolean dfs(int i, int dist) {
		if(dists[i] != Integer.MIN_VALUE)return dists[i] == dist;
		dists[i] = dist;
		for(int j = 0; j < linkList[i][0].size(); j++) {
			if(!dfs(linkList[i][0].get(j), dist + linkList[i][1].get(j)))return false;
		}
		return true;
	}
}


Measured memory_bytes: 187708
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
bool prime[MAX];
ll sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
return 0;
}
/*int inv[1000001]={0};
void findinverse(){inv[1] = 1;for(int i = 2; i <=1e6 ; ++i)	inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;}
*/
using namespace std;
int solve()
{
	sieve();
	int n;
	cin>>n;
	int i=n;
	while(!prime[i]){
		i++;
	}
	cout<<i<<endl;
	return 0;
}
signed main()
{
	fastio;
//	test
		solve();
}







Measured memory_bytes: 4540
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

#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 sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

const int MOD = 1000000007;

int N,P[1001],X[5001];
pii dp[1001];
vi child[1001];

void solve(int x) {
    int sum = 0;
    bitset<5001> p; p[0] = 1;
    for (int c: child[x]) {
        pii a = dp[c];
        p = (p<<a.f)|(p<<a.s);
        sum += (a.f+a.s);
    }
    for (int i = X[x]; i >= 0; --i) if (p[i]) {
        dp[x] = {X[x],sum-i};
        return;
    }
    cout << "IMPOSSIBLE";
    exit(0);
}

int main() {
	ios_base::sync_with_stdio(0);cin.tie(0);
	cin >> N;
	FOR(i,2,N+1) {
	    cin >> P[i];
	    child[P[i]].pb(i);
	}
	FOR(i,1,N+1) cin >> X[i];
	FORd(i,1,N+1) solve(i);
	cout << "POSSIBLE";
}

// read!
// ll vs. int!

Measured memory_bytes: 384
def solve(edges, h):
    neighbors = [set() for x in range(len(h)+1)]
    for edge in edges:
        neighbors[edge[0]].add(edge[1])
        neighbors[edge[1]].add(edge[0])
    result = -1
    for i, node in enumerate(neighbors):
        height = h[i-1]
        good = True
        for neighbor in node:
            if height <= h[neighbor-1]:
                good = False
                break
        if good:
            result += 1
    return result


if __name__ == "__main__":
    n, m = map(int, input().split())
    h = [int(x) for x in input().split()]
    edges = [[int(x) for x in input().split()] for y in range(m)]
    print(solve(edges, h))

Measured memory_bytes: 55568
#include <iostream>
#include <string>
#include <cstring>
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
using namespace std;
int main(){
    vector<vector<int>> a(3,vector<int>(3));
    for(int i=0;i<3;i++){
        for(int j=0;j<3;j++){
            cin>>a.at(i).at(j);
        }
    }
    vector<int> b(2);
    b.at(0)=a.at(0).at(0)-a.at(0).at(1);
    b.at(1)=a.at(0).at(1)-a.at(0).at(2);
    vector<int> c(2);
    c.at(0)=a.at(1).at(0)-a.at(1).at(1);
    c.at(1)=a.at(1).at(1)-a.at(1).at(2);
    vector<int> d(2);
    d.at(0)=a.at(2).at(0)-a.at(2).at(1);
    d.at(1)=a.at(2).at(1)-a.at(2).at(2);
    bool k=(b[0]==c[0]&&c[0]==d[0]&&b[1]==c[1]&&c[1]==d[1]);
    b.at(0)=a.at(0).at(0)-a.at(1).at(0);
    b.at(1)=a.at(1).at(0)-a.at(2).at(0);
    c.at(0)=a.at(0).at(1)-a.at(1).at(1);
    c.at(1)=a.at(1).at(1)-a.at(2).at(1);
    d.at(0)=a.at(0).at(2)-a.at(1).at(2);
    d.at(1)=a.at(1).at(2)-a.at(2).at(2);
    bool l=(b[0]==c[0]&&c[0]==d[0]&&b[1]==c[1]&&c[1]==d[1]);
    if(k&&l)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cmath>

long long s,count=1,ss,re;

int main(){

    std::cin>>s;

    ss=sqrt(s);
    if(ss*ss>s)ss--;
    if(ss*ss==s){
        count=0;
        re=1;
        goto flag;
    }
    st:;

    for(long long i=sqrt((ss+count)*(ss+count)-s);i>=1;i--){
    if(((ss+count)*(ss+count)-s)%i==0){
        re=i;
        goto flag;
    }
    }
    count++;
    goto st;

    flag:;

    std::cout<<"0 0 "<<ss+count<<' '<<re<<' '<<((ss+count)*(ss+count)-s)/re<<' '<<ss+count<<std::endl;

    return 0;
}

Measured memory_bytes: 256
N = 55556
dp = [1] * (N+1)
dp[0] =  dp[1] =  0

for i in range(2,N+1):
    if dp[i]:
        for j in range(i*i, N+1, i):
            dp[j] = 0
five_prime = []
for i in range(N):
    if dp[i] == 1:
        if i%5==1:
            five_prime.append(str(i))
N = int(input())
print (' '.join(five_prime[:N]))


Measured memory_bytes: 3572
import sys
sys.setrecursionlimit(10000)
input = sys.stdin.readline

def chkprint(a):
	a_name = ''
	for k, v in globals().items():
		if id(v) == id(a):
			a_name = k
			break
	print(a_name+' = '+str(a), file=sys.stderr)

def mt(f):
	import time
	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		print(e - s, 'sec', file=sys.stderr)
		return ret
	return wrap

@mt
def slv():
	
	
	return 
	
N, M = [int(i) for i in input().split()]
K = [[int(i) for i in input().split()] for _ in range(N)]

count = 0
for i in range(1, M+1):
	a = True
	for Ki in K:
		if not i in Ki[1:]:
			a = False
	if a:
		count += 1

print(count)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using pp=pair<int,int>;
using ll=long long;

int main() {
  int N;
  cin >> N;
  vector<int> A(N+2, 0); 
  for (int i=1; i<=N; i++) {
    cin >> A[i];
  }
  
  int S=0;
  for (int i=0; i<=N+1; i++) {
    S+=abs(A[i]-A[i-1]);
  }
  
  for (int i=1; i<=N; i++) {
    int s=S-abs(A[i]-A[i-1])-abs(A[i+1]-A[i])+abs(A[i+1]-A[i-1]);
    cout << s << endl;
  }
  
}
 

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

int main()
{
	int A, B;
	cin >> A >> B;
	int ans = 0;
	if( A > B){ ans += A; --A; }
	else      { ans += B; --B; }
	if( A > B){ ans += A; --A; }
	else      { ans += B; --B; }
	cout << ans;
	return 0;
}




Measured memory_bytes: 3200
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
typedef long long ll;
#define N (1000000000+7)
#define INF (100000000)
ll dp[100010];
ll h[100010];
int main(void) {
	int n, a, b, p;
	cin >> n >> a >> b;
	int num1 = 0, num2 = 0, num3 = 0;
	for (int i = 0;i < n;i++) {
		cin >> p;
		if (p <= a)num1++;
		else {
			if (p <= b)num2++;
			else num3++;
		}
	}
	cout << min(num1, min(num2, num3)) << endl;
	return 0;
}

Measured memory_bytes: 256
"use strict";
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.trim().split(/ |\n/), cid = 0;

var mod = 998244353;
// mod < 2**30, N,M <= 2* 200000 < 2**18
// mod * N < 2**48 < 2**53-1 = Number.MAX_SAFE_INTEGER
// 乗算 with mod
function mul() {
    for (var a = arguments, r = a[0], i = a.length; --i;) {
        r = (((r >> 16) * a[i]) % mod * 65536 + (r & 65535) * a[i]) % mod;
    }
    return r;
}
// 累乗 with mod
function pow(x, y) {
    if (y == 0) return 1;
    if (y == 1) return x;
    let t = pow(x, y >> 1);
    t = mul(t, t);
    if (y & 1) t = mul(t, x);
    //console.log({ x, y, t });
    return t;
}
// 逆元 1/x == x^(mod-2) // 互いに素な場合
function inv(x) {
    if (x == 1) return 1;
    return pow(x, mod - 2);
}
function main() {
    let N = +cin.shift();
    let M = +cin.shift();
    let K = +cin.shift();
    // ans = M * Sigma (C(N-1,K)*(M-1)^(N-K) ) % mod_base
    let y = Array(K + 1).fill(1);
    let z = Array(N).fill(1);
    for (let i = 0; i < K; i++) {
        // y[i + 1] = (y[i] * (N - i - 1) / (i + 1) ) % mod_base;
        //console.log("inv:", i + 1, "->", j);
        y[i + 1] = mul(y[i], N - i - 1, inv(i + 1));
    }
    for (let i = N - 2; i >= 0; i--) {
        //z[N-1]=1, z[N-2]=M-1, z[N-2]=(M-1)**2, ..., z[i]=(M-1)**(N-i), ..., z[0]=(M-1)**N
        z[i] = mul(z[i + 1], M - 1);
    }
    //console.log({ y, z });
    let ans = 0;
    for (let i = 0; i < K + 1; i++) {
        ans += mul(y[i], z[i]);
        ans = ans % mod;
    }
    ans = mul(M, ans);
    console.log(ans);
}
main();


Measured memory_bytes: 41988
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
// const ll MOD = 1000000007;
const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'


signed main() {
    fio();
    int n;
    cin >> n;
    vi num(1000111);
    vi a(n);
    rep (i, n) {
        cin >> a[i];
        num[a[i]]++;
    }

    int ans = 0;
    rep (i, n) {
        if (num[a[i]] >= 2) continue;

        bool flag = true;
        for (int j = 1; j * j <= a[i]; j++) {
            if (a[i] % j == 0) {
                int x = j;
                int y = a[i] / j;
                int nn = num[x];
                if (x == a[i]) nn--;
                if (nn > 0) {
                    flag = false;
                    break;
                }
                nn = num[y];
                if (y == a[i]) nn--;
                if (nn > 0) {
                    flag = false;
                    break;
                }
            }
        }
        if (flag) {
            ans++;
            // DEBUG(a[i]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 12704
import sys
from io import StringIO
import unittest
import os
import heapq

# 再帰処理上限(dfs作成時に設定するのが面倒なので限度近い値を組み込む)
sys.setrecursionlimit(999999999)


# 実装を行う関数
def resolve(test_def_name=""):
    n, m = map(int, input().split())
    ab_s = [list(map(int, input().split())) for i in range(n)]

    # 支給日ごとの報酬(降順)をまとめたリストを作成する。
    # 支給日が1日後:10,4,2円・・ 支給日が3日後:100,50円・・の場合 =  1[2,4,10] 3[50,100]　という感じ。
    # 降順にしておけば、取り出したい値=最大値が末尾にくるので、
    # 後述のキュー処理に要する処理量を抑えることができる。(list.pop()を使えるので)
    ab_list = [[] for i in range(100001)]
    for i in ab_s:
        ab_list[i[0]].append(i[1])
    for i in ab_list:
        if len(i) == 0:
            continue
        i.sort()

    a = []
    heapq.heapify(a)

    ans = 0
    # 　最適なバイトを、制限の多い地点から決めていく。(今回は、日が進むごとに制限が増えるので、
    # 　最も制限の多い最終日->最も制限のない1日目の順に決める)
    for i in range(1, m + 1):
        # (給与,支給日)の形でキューに追加。
        if len(ab_list[i]) != 0:
            heapq.heappush(a, (-ab_list[i].pop(), i))

        if len(a) != 0:
            act_work = heapq.heappop(a)
            ans += -act_work[0]

            if len(ab_list[act_work[1]]) != 0:
                heapq.heappush(a, (-ab_list[act_work[1]].pop(), act_work[1]))

    print(ans)


# テストクラス
class TestClass(unittest.TestCase):
    def assertIO(self, assert_input, output):
        stdout, sat_in = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(assert_input)
        resolve(sys._getframe().f_back.f_code.co_name)
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, sat_in
        self.assertEqual(out, output)

    def test_input_1(self):
        test_input = """3 4
4 3
4 1
2 2"""
        output = """5"""
        self.assertIO(test_input, output)

    def test_input_2(self):
        test_input = """5 3
1 2
1 3
1 4
2 1
2 3"""
        output = """10"""
        self.assertIO(test_input, output)

    def test_input_3(self):
        test_input = """1 1
2 1"""
        output = """0"""
        self.assertIO(test_input, output)

    # 自作テストパターンのひな形(利用時は「tes_t」のアンダーバーを削除すること
    def test_original_1(self):
        test_input = """3 4
4 210
4 150
3 150"""
        output = """360"""
        self.assertIO(test_input, output)

    def test_original_2(self):
        test_input = """2 1
1 10
1 20
"""
        output = """20"""
        self.assertIO(test_input, output)

    def test_original_3(self):
        test_input = """1 2
1 10
"""
        output = """10"""
        self.assertIO(test_input, output)

    def test_original_4(self):
        test_input = """5 3
4 50
4 50
3 10
3 10
1 10
"""
        output = """20"""
        self.assertIO(test_input, output)


# 実装orテストの呼び出し
if __name__ == "__main__":
    if os.environ.get("USERNAME") is None:
        # AtCoder提出時の場合
        resolve()

    else:
        # 自PCの場合
        unittest.main()


Measured memory_bytes: 111012
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
//using System.Text;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
//using System.Numerics;
//using static System.Math;
//using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    readonly Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    void chmax<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? b : a; }
    void chmin<T>(ref T a, T b) where T : IComparable<T> { a = a.CompareTo(b) < 0 ? a : b; }

    void solve()
    {
        int N = cin.nextint;
        int T = cin.nextint;
        int A = cin.nextint;
        var H = cin.scanint;

        int ans = -1;
        double abs = int.MaxValue;
        for (int i = 0; i < N; i++)
        {
            double p = T - H[i] * 0.006;
            if (Math.Abs(p - A) < abs)
            {
                abs = Math.Abs(p - A);
                ans = i + 1;
            }
        }
        WriteLine(ans);
    }

}

class Scanner
{
    string[] s; int i;
    readonly char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan { get { return ReadLine().Split(); } }
    public int[] scanint { get { return Array.ConvertAll(scan, int.Parse); } }
    public long[] scanlong { get { return Array.ConvertAll(scan, long.Parse); } }
    public double[] scandouble { get { return Array.ConvertAll(scan, double.Parse); } }
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint { get { return int.Parse(next); } }
    public long nextlong { get { return long.Parse(next); } }
    public double nextdouble { get { return double.Parse(next); } }
    public void join<T>(IEnumerable<T> values) { WriteLine(string.Join(" ", values)); }
}

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

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

  int b = 0;
  int cnt = 1;

  for (int i = 0; i < n; i++)
  {
    int l;
    cin >> l;
    
    b+=l;
    if (b>x){
      cout << cnt << endl;
      return 0;
    }
    cnt++;
    
  }
  cout << cnt << endl;



}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <string>
#define MAXN (300000 + 5)
using namespace std;
int n, a[MAXN], f[MAXN], answ, anse, ans;
int main()
{
	string s;
	cin >> n >> s;
	for (int i = 0; i < n; i++)
		a[i + 1] = (s[i] == 'E' ? 1 : 0);
	for (int i = 2; i <= n; i++)
		anse += a[i];
	ans = anse;
	for (int i = 2; i <= n; i++)
	{
		if (!a[i - 1])
			++answ;
		if (a[i])
			--answ;
		ans = min(ans, anse + answ);
	}
	cout << ans << endl;
	return 0;
}

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

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

    vector<int> d(n);
    rep(i,n){
        cin >> d.at(i);
    }

    sort(d.begin(),d.end());
    reverse(d.begin(),d.end());
    
    int latest = 0,c = 0;
    rep(i,n){
        if( latest != d.at(i) ){
            c++;
        }
        latest = d.at(i);
    }
    cout << c << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <string>
#include <math.h>
#include <queue>
#include <list>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <ctime>
#include <iomanip>
#include <fstream>
using namespace std;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define IN(x,c) (find(c.begin(),c.end(),x) != (c).end())
#define REP(i,n) for (int i=0;i<(int)(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define INIT(a,v) memset(a,v,sizeof(a))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
template<class A, class B> A cvt(B x) { stringstream ss; ss<<x; A y; ss>>y; return y; }

#define SPC << " " <<
#define DEBUG(x) cerr << #x << " = "; cerr << x << endl;
#define DEBUG_ITER(x) cerr << #x << " = "; for (auto _ : x) cerr << _ << ' '; cerr << endl;

typedef pair<int,int> PII;
typedef long long int64;
typedef vector<int> VI;

int solve(int n) {
	if (n==0) return 0;
	int s=0,x=n;
	while (x!=0) {
		s+=x%2;
		x/=2;
	}
	return 1+solve(n%s);
}

int main() {
	int n;
	string s;
	cin >> n >> s;
	int q=0;
	REP (i,n) q+=s[i]=='1';
	int p=q-1,r=q+1;
	VI p2(n), q2(n), r2(n);
	p2[0]=q2[0]=r2[0]=1;
	FOR (i,1,n-1) {
		if (p!=0) p2[i]=(p2[i-1]*2)%p;
		if (q!=0) q2[i]=(q2[i-1]*2)%q;
		if (r!=0) r2[i]=(r2[i-1]*2)%r;
	}
	int xp=0, xq=0, xr=0;
	REP (i,n) {
		if (p!=0) xp=(xp+p2[n-1-i]*(s[i]=='1'))%p;
		if (q!=0) xq=(xq+q2[n-1-i]*(s[i]=='1'))%q;
		if (r!=0) xr=(xr+r2[n-1-i]*(s[i]=='1'))%r;
	}
	REP (i,n) {
		int a;
		int ones=q;
		if (s[i]=='1') ones--; else ones++;
		if (ones==0)  printf("%d\n",0);
		else {
			if (s[i]=='1') {a=(xp-p2[n-1-i]+p)%p; }
			else { a=(xr+r2[n-1-i]+r)%r; }
			printf("%d\n",1+solve(a));
		}
	}
	return 0;
}


Measured memory_bytes: 6028
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
      ArrayList<Integer> one = nextIntArray();
      int a = one.get(0);
      int b = one.get(1);
      myout((a + b + 1) / 2);
      
	}
	//Method addition frame start



	//Method addition frame end
}


Measured memory_bytes: 32508
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder2 {
	class Program {
		static void Main(string[] args) {
var inputArray = retreiveLongArray();
			var inputCount = 2;

			// 不正な入力は処理しない
			if (inputArray.Length != inputCount) {
				Console.WriteLine("invalid input");
				return;
			}
			int H = (int)inputArray[0];
			int W = (int)inputArray[1];

			var map = new bool[H, W];//trueの場合black

			for (int i = 0; i < H; i++) {
				var inpArray = retreiveStringArray()[0];
				for (int j = 0; j < W; j++) {
					map[i, j] = inpArray[j] == '#';
				}
			}

			var blackQue = new Queue<int[]>();//0-何回目の操作か 1-h 2-w
			
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					
					if (map[i, j]) {
						blackQue.Enqueue(new int[] { 0, i, j });
					}
				}
			}
			var count = 0;
			var ans = 0;
			while (blackQue.Count>0) {
				var cell = blackQue.Dequeue();
				count = cell[0] + 1;
				var i = cell[1];
				var j = cell[2];

				var kouhos = new List<int[]>();
				if (0<i) {
					kouhos.Add(new int[]{ count, i - 1, j});
				}
				if ( i < H-1) {
					kouhos.Add(new int[] { count, i + 1, j });
				}
				if (0 < j) {
					kouhos.Add(new int[] { count, i, j-1 });
				}
				if (j < W - 1) {
					kouhos.Add(new int[] { count, i, j+1 });
				}

				foreach (var kouho in kouhos) {
					if (!map[kouho[1],kouho[2]]) {
						ans = count;//実際に塗られて初めて答えとして有効となる
						map[kouho[1], kouho[2]] = true;
						blackQue.Enqueue(kouho);
					}
				}

			}

			//答えの出力
			Console.WriteLine(ans);

		}

		/// <summary>
		/// スペースで区切られた文字列配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static string[] retreiveStringArray() {
			var inputArray = Console.ReadLine().Split(' ');
			return inputArray;
		}

		/// <summary>
		/// スペースで区切られた整数配列の入力を受け取る
		/// </summary>
		/// <returns></returns>
		private static long[] retreiveLongArray() {
			var inputArray = Console.ReadLine().Split(' ');
			var longArray = inputArray.Select(s => long.Parse(s));
			return longArray.ToArray();
		}
	}
}

Measured memory_bytes: 114308
#include<bits/stdc++.h>
using namespace std;
double cuberoot(double x){
  double s, prev;
  int positive;
  if(x == 0) return 0;
  if(x > 0){
    positive = 1;
  }else{
    positive = 0;
    x = -x;
  }
  if(x > 1){
    s = x;
  } else {
    s = 1;
  }
  do {
    prev = s;
    s = (x / (s * s) + 2 * s) / 3;
  } while(s < prev);
  if(positive) return prev;
  else return -prev;
}
vector< double > cardano(double a, double b, double c, double d){
  double p, q, t, a3, b3, x1, x2, x3;
  vector< double > ret;

  b /= 3 * a;
  c /= a;
  d /= a;
  p = b * b - c / 3;
  q = (b * (c - 2 * b * b) - d) / 2;
  a = q * q - p * p * p;
  if(a == 0){
    q = cuberoot(q);
    x1 = 2 * q - b;
    x2 = -q - b;

    ret.push_back(x1), ret.push_back(x2), ret.push_back(x2);
  } else if(a > 0){
    if(q > 0) a3 = cuberoot(q + sqrt(a));
    else a3 = cuberoot(q - sqrt(a));
    b3 = p / a3;
    x1 = a3 + b3 - b;
    x2 = -0.5 * (a3 + b3) - b;
    x3 = fabs(a3 - b3) * sqrt(3.0) / 2;
    
    ret.push_back(x1);
  } else {
    a = sqrt(p);
    t = acos(q / (p * a));
    a *= 2;
    x1 = a * cos(t / 3) - b;
    x2 = a * cos((t + 2 * M_PI) / 3) - b;
    x3 = a * cos((t + 4 * M_PI) / 3) - b;
    
    ret.push_back(x1), ret.push_back(x2), ret.push_back(x3);
  }
  return ret;
}

int main(){
  int n;
  double a, b, c, d;
  cin >> n;
  while(n--){
    cin >> a >> b >> c >> d;
    vector< double > get = cardano( a, b, c, d);
    int sei = 0, hu = 0;
    for(int i = 0; i < get.size(); i++){
      if(fabs(get[i]) < 1e-10) continue;
      if(get[i] > 0) sei++;
      else  hu++;
    }
    cout << sei << " " << hu << endl;
  }
}

Measured memory_bytes: 1336
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cstdio>
#define LL long long
#define pb push_back
#define mp make_pair
#define INF (LL)(4e18)
#define F first
#define S second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,b,a) for(int i=(b);i>=(a);i--)
#define forn(i,n) rep(i,1,n)
#define rep0(i,n) rep(i,0,n-1)
using namespace std;
typedef pair<int,int>pii;
#define mod 1000000007
using namespace std;
int n,f[100010],s[100010];
LL a,b,x[100010];
int get(int l,int r){
	if(l>r)return 0;
	if(!l)return s[r];
	else return (s[r]-s[l-1]+mod)%mod;
}
int main(){
	cin>>n>>a>>b;
	if(a<b)swap(a,b);
	for(int i=1;i<=n;i++)cin>>x[i];
	x[0]=-INF,x[n+1]=INF;
	f[0]=s[0]=1;
	int l=0,r=0;
	for(int i=1;i<=n+1;i++){
		while(r+1<i&&x[i]-x[r+1]>=a)r++;
		if(i>=2&&x[i-1]-x[i-2]<b)l=i-2;
		if(x[i]-x[i-1]>=a)f[i]=f[i-1];
		f[i]=(f[i]+get(l,min(i-2,r)))%mod;
		s[i]=s[i-1];
		if(x[i+1]-x[i-1]>=b)s[i]=(s[i]+f[i])%mod;
	}
	cout<<f[n+1]<<endl;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;

template <typename Tp> inline void getint(Tp &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

int L, V, E = 0;
struct edge {int u, v, w;} ed[65];

int main(){
	getint(L);
	for(V = 1; (1 << V) <= L; V++){
		ed[++E] = (edge){V, V + 1, 0};
		ed[++E] = (edge){V, V + 1, 1 << (V - 1)};
	}
	for(register int i = V - 2, w = 1 << (V - 1); i >= 0; i--)
		if(L & (1 << i)) ed[++E] = (edge){i + 1, V, w}, w += 1 << i;
	printf("%d %d\n", V, E);
	for(register int i = 1; i <= E; i++) printf("%d %d %d\n", ed[i].u, ed[i].v, ed[i].w);
	return 0;
}

Measured memory_bytes: 256
while(n=gets.to_i)>0
	idx=[]
	m=[]
	n.times{m<<gets.split.map(&:to_i);idx<<[0]*n}
	m.size.times{|i|idx[i][m[i].each_with_index.min[1]]+=1}
	m.size.times{|i|idx[m.transpose[i].each_with_index.max[1]][i]+=2}
	k=0
	n.times{|i|n.times{|j|k=m[i][j] if idx[i][j]==3}}
	p k
end

Measured memory_bytes: 6116
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace  std;

#define ll long long
#define ull unsigned long long
#define f first
#define s second
typedef pair<int , int > pii;
typedef pair<ll,ll> pll;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
// erase,insert same as normal set

const ll MOD = 1e9+7;


void min_self(ll &a , ll b){a=min(a,b);}
void max_self(ll &a, ll b){a=max(a,b);}
ll add(ll x, ll y){return (x + y) % MOD;}
ll sub(ll x, ll y){return add(x, MOD - y);}
ll mul(ll x, ll y){return (x * 1ll * y) % MOD;}
ll binpow(ll x, ll y)
{
    ll z = 1;
    while(y > 0)
    {
        if(y % 2 == 1)
            z = mul(z, x);
        x = mul(x, x);
        y /= 2;
    }
    return z;
}
ll inv(ll x){return binpow(x, MOD - 2);}
const int MXN = 1e6+10;
ll fact[MXN];
void fac_pre()
{
    fact[0]=1;
    for(ll i=1; i<MXN; i++){
        fact[i]=mul(fact[i-1],i);
    }
}
ll C(ll n, ll k)
{
    return mul(fact[n], inv(mul(fact[k], fact[n - k])));
}

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
///--//
int  main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    /* KEEP IN MIND
     * take care when sorting a 1 based indexed vector
     * const int N is defined way above in the starting
    */
    int l,r,d; cin>>l>>r>>d;
    int ans=r/d;
    ans-=(l-1)/d;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3648
import sys
input = sys.stdin.readline

n = int(input())
v = [int(_) for _ in input().split()]
oddcnt = [[0, i] for i in range(10**5+1)]
evencnt = [[0, i] for i in range(10**5+1)]

for i, j in enumerate(v):
    if i % 2 == 0:
        oddcnt[j][0] += 1
    else:
        evencnt[j][0] += 1

oddcnt = sorted(oddcnt, key=lambda x: (-x[0], x[1]))
evencnt = sorted(evencnt, key=lambda x: (-x[0], -x[1]))

if oddcnt[0][1] != evencnt[0][1]:
    print(n-oddcnt[0][0]-evencnt[0][0])
elif oddcnt[0][0] > evencnt[0][0]:
    print(n-oddcnt[0][0]-evencnt[1][0])
elif oddcnt[0][0] < evencnt[0][0]:
    print(n-oddcnt[1][0]-evencnt[0][0])
elif oddcnt[1][0] > evencnt[1][0]:
    print(n-oddcnt[1][0]-evencnt[0][0])
else:
    print(n-oddcnt[0][0]-evencnt[1][0])

Measured memory_bytes: 45844
n = gets.chomp.to_i
h = gets.split.map(&:to_i)

def split(ary)
  s = []
  a = []
  ary.each do |e|
    if e == 0
      s.push(a) unless a.empty?
      a = []
    else
      a.push(e)
    end
  end
  s.push(a)
  s
end

def dfs(ary, sum)
  return 0 if ary.empty?
  return sum if ary.all? { |e| e == 0 }
  if ary.any? { |e| e == 0 }
    split(ary).map { |a| dfs(a, 0) }.inject(:+) + sum
  else
    water = ary.min
    ary = ary.map{ |e| e - water }
    sum += water
    dfs(ary, sum)
  end
end

puts dfs(h, 0)


Measured memory_bytes: 2044
#include <stdio.h>
int main(void) {
	int s[10000], t, n, q, i, num_intersection = 0;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%d", s+i);
	}
	scanf("%d", &q);
	while (q--) {
		scanf("%d", &t);
		for (i = 0; i < n; i++) {
			if (t == s[i]) {
				s[i] = -1;
				num_intersection++;
				break;
			}
		}
	}
	printf("%d\n", num_intersection);
	return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vii = vector<vi>;
using vs = vector<string>;
using in6 = int64_t;
using ind = double;
using pii = pair<int,int>;
using psi = pair<string,int>;
using vpi = vector<pii>;
using vps = vector<psi>;
#define rep(i, n) for (in6 i = 0; i < (in6)(n); i++)
#define repa(i,a,n) for(in6 i = a; i < (in6)(n); i++)
#define repdown(i,n) for(in6 i = n; i > 0; i--)
#define kyun ios::sync_with_stdio(false)
#define hinata cout << "\n"
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define inf 2147483647
#define dset(n) cout << fixed << setprecision(n)

void yes() {
  cout << "Yes";
}

void no() {
  cout << "No";
}

in6 outi(in6 x) {
  in6 ret = 0;
  repa(i,1,sqrt(x)+1) {
    if(x % i == 0) ret = i;
  }
  return ret;
}

int main() {
  kyun;
  in6 n;
  cin >> n;
  in6 i,j;
  i = outi(n);
  j = n / i;
  in6 ans = i+j-2;
  cout << ans;
  hinata;
}

Measured memory_bytes: 256
#  --*-coding:utf-8-*--

import math

def f(A,B,X):
    S = X/A

    if S > A*B/2:
        h = 2*S/A - B
        return math.degrees(math.atan((B-h)/A))
    else:
        w = 2*S/B
        return math.degrees(math.atan(B/w))

                    

def main():
    A,B,X = map(int, input().split())
    
    print('{:9f}'.format(f(A,B,X)))




if __name__ == '__main__':
    main()


Measured memory_bytes: 3060