text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int n, k; int f[50005][65], a[50005], po[50005], cnt, tr[65][200005], la[65][200005]; void pushup(int num, int id) { tr[num][id] = max(tr[num][id << 1], tr[num][id << 1 | 1]); } void pushdo(int num, int id) { if (la[num][id] != 0) { la[num][id << 1... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; string s; cin >> s; map<string, int> gram; for (int i = 0; i < n - 1; i++) ++gram[s.substr(i, 2)]; int cnt = 0; string ans = ; for (aut... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; const long long INF = (long long)1e17 + 10; int n, m, s, t; int a[N], b[N], l[N]; struct edge { int to, cost; edge(int to, int cost) : to(to), cost(cost) {} }; vector<edge> e; vector<int> g[N]; vector<int> g2[N]; long lo... |
#include <bits/stdc++.h> using namespace std; inline double sq(double a) { return a * a; } int a, b; int n; complex<double> p1[1024], p2[1024]; double d[1024][1024]; int vis[1024]; double distanceSP(const complex<double>& s0, const complex<double>& s1, const complex<double>& p) { ... |
#include <bits/stdc++.h> using namespace std; template <class A, class B> inline bool mina(A &first, B second) { return (first > second) ? (first = second, 1) : 0; } template <class A, class B> inline bool maxa(A &first, B second) { return (first < second) ? (first = second, 1) : 0; } const int ... |
#include <bits/stdc++.h> using namespace std; using LL = long long; constexpr int N = 2e5 + 5; vector<int> E[N]; LL Size[N], Dep[N]; int ord[N]; int tourism[N]; void dfs(int x, int p, int lvl) { Size[x] = 1; Dep[x] = lvl; for (const int &to : E[x]) { if (to == p) continue; dfs(to... |
#include <bits/stdc++.h> using namespace std; const long long mod = 998244353; long long sum[55][100005], f[55][100005], t[100005]; int l[55], r[55]; int add(int p, int x, int y) { if (x < 0) return 0; if (y < 0) return sum[p][x]; return sum[p][x] - sum[p][y]; } long long solve1(int n, int m) ... |
#include <bits/stdc++.h> using namespace std; const long long N = 30; bool vis[N]; int id1 = -1, id2 = -1; char ch; int main() { ios_base::sync_with_stdio(0); cin.tie(0); string s; cin >> s; int n = 27; for (int i = 0; i < 27; i++) { if (vis[s[i] - A ]) { id2 = i; ... |
//Copyright (C) 1991-2003 Altera Corporation
//Any megafunction design, and related netlist (encrypted or decrypted),
//support information, device programming or simulation file, and any other
//associated documentation or information provided by Altera or a partner
//under Altera's Megafunction Partne... |
module ARM_ALU(input wire [31:0] A,B,input wire[4:0] OP,input wire [3:0] FLAGS,output wire [31:0] Out,output wire [3:0] FLAGS_OUT, input wire S,ALU_OUT);
parameter HIGHZ = 32'hzzzzzzzz;
reg [31:0] buffer,_A,_B;
reg [3:0] FLAGS_buff;
/*
STATUS REGISTER FLAGS
WE FETCH INSTRUCTIONS 8BITS AT A TIME 8BIT DATAPATH
31. Nega... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const long long logN = 20; const long long M = 1000000007; const long long INF = 1e12; const long long N = 100005; void solve() { long long n, k; cin >> n >> k; set<long long> s; while (s.size() < 30 and s.size() < (n - 1)) { long long i = ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e3 + 5, mod = 1e9 + 7; int n, m, k; long long fact[maxn], dp[maxn], inv[maxn]; long long qpow(long long n, int p) { long long res = 1; while (p) { if (p & 1) res = res * n % mod; n = n * n % mod; p >>= 1; } retur... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int main() { map<string, int> mp; int n, m; cin >> n >> m; int same = 0; for (int i = 0; i < n; i++) { string s; cin >> s; mp[s] = 1; } for (int i = 0; i < m; i++) { string s; cin >> s; if (mp[s]) same++; ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; vector<long long> fib = {1, 2}; map<pair<long long, long long>, long long> dp; long long f(long long n, int j) { if (fib[j] > n) return 0; if (fib[j] == n) return 1; long long tot = 0; for (int j2 = 0; j2 < j; j2++) { ... |
module testbench;
localparam width_lp = 4;
localparam els_lp = 2;
logic clk;
bsg_nonsynth_clock_gen #(
.cycle_time_p(1000)
) clock_gen (
.o(clk)
);
logic reset;
bsg_nonsynth_reset_gen #(
.num_clocks_p(1)
,.reset_cycles_lo_p(4)
,.reset_cycles_hi_p(4)
) reset_gen (
.clk_i(clk... |
#include <bits/stdc++.h> using namespace std; const int N = 200005, P = 1000000007; int n, l[N], r[N], p[N], p2[N], ans; int power(int a, int x) { int ans = 1; for (; x; x >>= 1, a = 1LL * a * a % P) if (x & 1) ans = 1LL * ans * a % P; return ans; } int main() { scanf( %d , &n); fo... |
#include <bits/stdc++.h> const long long MOD = 1e9 + 7; const long long MAXN = 35000 + 1; using namespace std; long long readInt() { bool minus1 = false; long long result = 0; char ch; ch = getchar(); while (true) { if (ch == - ) break; if (ch >= 0 && ch <= 9 ) break; c... |
// megafunction wizard: %ALTPLL%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altpll
// ============================================================
// File Name: clk_doubler.v
// Megafunction Name(s):
// altpll
// ============================================================
// ************************... |
#include <bits/stdc++.h> using namespace std; bool isPrime(int n) { if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; for (int i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; } void solve() { ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/* -------------------------------------------------------------------------------
* (C)2007 Robert Mullins
* Computer Architecture Group, Computer Laboratory
* University of Cambridge, UK.
* -------------------------------------------------------------------------------
*
* vc_input_port
*
* - Buffers incomin... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9, MOD = 1e9 + 7, N = 1e5 + 1, M = 20; void setIO(string name = ) { ios::sync_with_stdio(false); cin.tie(0); if (name.size()) { freopen((name + .in ).c_str(), r , stdin); freopen((name + .out ).c_str(), w , stdout); ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int n, t; bool ans = 0; vector<int> port; vector<bool> f; void dfs(int i) { if (i == t - 1) { ans = 1; return; } f[i] = 1; if (i != n - 1 && !f[i + port[i]]) dfs(i + port[i]); } int main() { cin >> n >> t; port.resize(n - ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// FP16 Regular/Relaxed version.
// TODO: Write tests and fix obvious bugs first.
module FP16RAddSubS0Of5(
input clk,
input rst,
input [15:0] arg_0,
input [15:0] arg_1,
input arg_2,
output [15:0] ret_0,
output [15:0] ret_1,
output ret_2,
output ret_3);
wire [15:0] x;... |
#include <bits/stdc++.h> using namespace std; inline char read() { static const int IN_LEN = 1000000; static char buf[IN_LEN], *s, *t; return (s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin), (s == t ? -1 : *s++) : *s++); } template <class T> inline void read(T &x) ... |
#include <bits/stdc++.h> using namespace std; char a; int n, sum, flag = 1; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a; if (a != 0 ) sum++, flag = 1; else if (flag == 1 && a == 0 ) { cout << sum; sum = 0; flag = 0; } else if (a... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7, inf = 1e17, N = 1e6 + 10; bool vowel(char che) { if (che == A || che == E || che == I || che == O || che == U || che == Y ) { return true; } else { return false; } } long long pw(long long a... |
/*
Copyright (c) 2014-2018 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int x = 1; while (x <= n) { if (x == n || x + 1 == n) { cout << 1 << n ; return 0; } if (x & 1) { x = x * 2 + 2; } else { ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); srand(time(NULL)); ; int T = 1; cin >> T; while (T--) { int n, r = 0, c = 0; string s; cin >> n >> s; for (int i = 0; i < int(n); i++) r += s[i]... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e6 + 10; const long long mod = 1e9 + 7; const long long INF = 1e18 + 10; int main() { long long n, m, i; string s; cin >> n; while (n--) { cin >> m >> s; if (s.size() < 11) cout << NO n ; else { ... |
#include <bits/stdc++.h> const int M = 1e5 + 5; int len; long long lsh[M * 3]; int n, m, k, p, t[M], v[M], nxt[M], pre[M]; long long CB[M * 3]; long long now, val[M], ans[M]; struct Query { int L, R, p, id; inline bool operator<(const Query& it) const { return p == it.p ? p & 1 ? R < it.R : ... |
#include <bits/stdc++.h> using namespace std; template <class T> void chmin(T &a, const T &b) { if (a > b) a = b; } template <class T> void chmax(T &a, const T &b) { if (a < b) a = b; } template <class T> using MaxHeap = priority_queue<T>; template <class T> using MinHeap = priority_queue<... |
#include <bits/stdc++.h> using namespace std; template <class T> using min_pq = priority_queue<T, vector<T>, greater<T>>; const int MAXN = 1e5 + 10, MAXQ = 3e5 + 10, MAXL = 20, ALP = 26, MOD = 1e9 + 7, MAXK = 17, INF = 1e9 + 10, MAXA = 30, MAXB = 24, MAXBB = (1 << MAXB); const string no = NO n , ... |
#include <bits/stdc++.h> using namespace std; int ans1, ans2; int t[4], v[4][10], T[10][10], A, B, C; map<string, int> mymap; const char *help[] = { Anka , Chapay , Cleo , Troll , Dracul , Snowy , Hexadecimal }; int countT() { int ret = 0; for (int k = 0; k < 3... |
#include <bits/stdc++.h> using namespace std; int row[1008], col[1008], n, m, a, b, cnt; int main() { cin >> n >> m; for (int i = 0; i < n + 1; i++) row[i] = col[i] = true; while (m--) { cin >> a >> b; row[a] = col[b] = false; } for (int i = 2; i < n; i++) cnt += (row[i] + col[i]);... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
module node(clk, rst, textfile, keyword, data_wr, key_en);
parameter data_size = 32;
input clk;
input rst;
input [data_size-1:0] textfile; // Input textfile from Scheduler for mapper submodule
input [data_size-1:0] keyword; // Input keyword from Scheduler for mapper submodule
input data_wr; ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100000; long long n, ans; int main() { while (~scanf( %lld , &n)) { n--; int l = 0; for (int i = 0; i < 50; i++) if ((1ll << i) & n) l = i; ans = n / 2 + n % 2; int f = l; for (; f > 0; f--) { ... |
`timescale 1ns/1ns
// RNG: generate tag response to query, query_rep, req_rn
// Copyright 2010 University of Washington
// License: http://creativecommons.org/licenses/by/3.0/
// 2008 Dan Yeager
// RNG reuses the crc algorithm
// The input is the lsb of the counter
// at each incoming bit from the reader.
// The RNG... |
#include <bits/stdc++.h> using namespace std; vector<int> graph[2001]; vector<int> level[2001]; int visited[2001]; int a, b; void dfs(int u, int depth) { visited[u] = 1; level[depth].push_back(u); for (int v : graph[u]) { if (!visited[v]) { dfs(v, depth + 1); } } } in... |
#include <bits/stdc++.h> using namespace std; const int N = 300010; int sufp[N], freq[N][2]; int mi = 0, ma = 0, par = 0; void add(int x) { if (x >= mi and x <= ma) { if (x % 2 == par) mi = 0; else mi = 1; } else if (x > ma) { mi = x - ma; } else { mi = mi -... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2011 Xilinx, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Mon Feb 13 12:46:23 2017
// Host : WK117 running 64-bit major release (build ... |
/// date: 2016/2/24
/// engineer: ZhaiShaoMIn
/// module name: fsm_download_flit(from IN_local fifos)
/// fsm for controlling datapath from IN_local to the regs
/// used to process rep msgs and req msgs.
module FSM_download_flit(
//input
req_flit,
... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/*
Copyright (c) 2014-2018 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... |
#include <bits/stdc++.h> using namespace std; int main() { int n; long long h[100000], ans[100000]; cin >> n; for (int i = 0; i < n; i++) cin >> h[i]; ans[n - 1] = 0; for (int i = n - 2; i >= 0; i--) { if (h[i] <= h[i + 1]) ans[i] = h[i + 1] - h[i] + 1; else ans[i... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, f, a, b; vector<pair<long long int, long long int> > v; cin >> n >> f; int i; for (i = 0; i < n; i++) { cin >> a >> b; v.push_back(make_pair(a, b)); } long long int ans = 0; vector<long long int> ... |
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int mod = 1000000007; const int N = 5e5 + 5; int n, m, q, ans[N]; struct node { int cnt, id; } c[N]; struct ask { int id; long long x; } Q[N]; int st[N << 2]; void update(int o, int l, int r, int pos) { ... |
//////////////////////////////////////////////////////////////////////
//// ////
//// OR1200's Data TLB ////
//// ////
//// This file is part of the OpenR... |
#include <bits/stdc++.h> using namespace std; int N, M, P[100005], R = 1, a, b; int findSet(int x) { if (P[x] == x) return x; else return (P[x] = findSet(P[x])); } void merge(int a, int b) { P[findSet(a)] = findSet(b); } int main() { scanf( %d%d , &N, &M); for (int i = 1; i <= N;... |
////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2013, University of British Columbia (UBC); All rights reserved. //
// //
// Redistribution and use in source and binary forms, w... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (--t >= 0) { long long a, b, c, d; cin >> a >> b >> c >> d; if (a <= b) { cout << b << endl; continue; } if (c <= d) { cout << -1 << endl; continue; } ... |
#include <bits/stdc++.h> using namespace std; bool cmp(const pair<int, int> &p1, const pair<int, int> &p2) { if (p1.first == p2.first) { return p1.second < p2.second; } return p1.first > p2.first; } int main() { int n, m, e, x, y; cin >> n >> m; std::vector<pair<int, int> > E; ... |
// Copyright (c) 2000-2012 Bluespec, Inc.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, pub... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int a, z, k, r; int v[109]; int ans[1000009]; int w[1000009][2]; int main() { scanf( %d , &a); k = 1; for (int i = 1; i < 1000001; i++) { z = i; while (z > 0) { if (z % 10 != 0 && z % 10 != 1) { z = -1; break; ... |
#include <bits/stdc++.h> int n, t1, t2; int num = 0; int dfs(int l, int r) { int k = (l + r) / 2; num++; if (t1 <= k && t2 > k) { return num; } if (t1 <= k && t2 <= k) { return dfs(l, k); } else { return dfs(k, r); } } int FastLog2(int x) { float fx; unsig... |
`timescale 1 ns / 1 ps
module axis_maxabs_finder #
(
parameter integer AXIS_TDATA_WIDTH = 16,
parameter integer CNTR_WIDTH = 32
)
(
// System signals
input wire aclk,
input wire aresetn,
input wire [CNTR_WIDTH-1:0] cfg_data,
// Slave side
output... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> #pragma GCC optimize( 03 ) using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << : << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char... |
#include <bits/stdc++.h> using namespace std; long long n, m; long long a[10001], f[10001]; int main() { int d, x, y; scanf( %I64d %I64d , &n, &m); f[0] = f[1] = 1; for (int i = 2; i <= n; i++) f[i] = f[i - 1] + f[i - 2], f[i] %= 1000000000LL; for (int i = 1; i <= n; i++) scanf( %I64d , &a[i... |
#include <bits/stdc++.h> using namespace std; template <class T> bool umin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template <class T> bool umax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } int arr[300009], b[300009]; vector<p... |
// REMEMBER USING MOD INVERSE WHILE DOING COMBINATORICS // REMEMBER using int32_t while typecasting size into int #include<bits/stdc++.h> using namespace std; #define pb push_back #define int long long #define all(x) x.begin(),x.end() #define nl n #define ok cout<< OK n #define ios ios_base::... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int tt; cin >> tt; while (tt--) { string s; cin >> s; reverse(s.begin(), s.end()); if (s.substr(0, 2) == op ) { cout << FILIPINO n ; } else if (s.substr(0, ... |
// DESCRIPTION: Verilator: Functionally demonstrate an array of interfaces
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2015 by Todd Strader.
interface foo_intf;
logic a;
modport source (
output a
);
modport sink (
input a
);
endinterface
functi... |
module axi_to_reg_bus
(
input reset,
input clk, //register bus clk
input s_axi_aclk, //axi interface clk
input s_axi_aresetn,
//------------------------------//
//AXI-lite Slave interface
//------------------------------//
// Write address ch... |
/////////////////////////////////////////////////////////////////////
//// ////
//// WISHBONE rev.B2 compliant I2C Master byte-controller ////
//// ////
//// ... |
#include <bits/stdc++.h> using namespace std; vector<long long int> sieve; vector<long long int> *Sieve(int N) { const long long int maxn = N; sieve.resize(maxn); for (long long int(i) = 0; (i) < (maxn); ++(i)) sieve[i] = 1; sieve[1] = 0; sieve[0] = 0; for (long long int(i) = 2; (i) <= (ma... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i, j; long long int x, y; cin >> n >> x >> y; y -= n; if (y < 0) cout << -1 << endl; else { x -= (n - 1); x -= (1 + y) * (1 + y); if (x > 0) cout << -1 << endl; else { cout << (1 +... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; struct node { int l, m, r; }; node t[3000005]; int arr[300005], n, m; long long a[300005]; int sign(long long x) { if (x > 0) return 1; if (x < 0) return -1; return 0; } void cal(int x, int l, int r) { int m = (l + r) / 2; t[x].m = ... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
* for EE577b Troy WideWord Processor Project
*/
`timescale 1ns/10ps
/**
* `timescale time_unit base / precision base
*
* -Specifies the time units and precision for delays:
* -time_unit is the amount of time a delay of 1 represents.
* The time unit ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:10:24 11/22/2016
// Design Name:
// Module Name: mouse_out
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depen... |
#include <bits/stdc++.h> using namespace std; const unsigned long long mod1 = 1000000007; const unsigned long long mod2 = 1073676287; const unsigned long long base1 = 1000000033; const unsigned long long base2 = 1190494759; vector<unsigned long long> base_pow(1000009); int main() { ios_base::sync_with... |
`include "parameters_rs232.v"
module sim_rs232;
// Inputs
reg reset_n;
reg clk;
reg [7:0] tx_data;
reg tx_start;
reg cts;
reg rxd;
reg rx_ack;
// Outputs
wire tx_ready;
wire txd;
wire rts;
wire [7:0] rx_data;
wire rx_ready;
wire [`rs232_state_tx_width-1:0] rs232_state_tx;
wire [`rs232_state_rx_wid... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } long long fac(long long n) { if (n == 1) return 1; return n * fac(n - 1); } long long power(long long x, long long y) { long long res = 1; for (long l... |
#include <bits/stdc++.h> using namespace std; int n, ans; int a[19]; int inv[2000009]; int f[17009]; int tag[19]; int qpow(int a, int b) { int ans = 1; for (; b; b >>= 1, a = (long long)a * a % 1000000007) if (b & 1) ans = (long long)ans * a % 1000000007; return ans; } void init() { ... |
#include <bits/stdc++.h> using namespace std; int pgcd(int a, int b) { if (a == 0) return b; return pgcd(b % a, a); } int nbNombres; int vals[300 * 1000]; int minRange[20][300 * 1000]; int pgcdRange[20][300 * 1000]; vector<int> possibles(int taille) { vector<int> sol; int etage = __built... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used *
* solely for design, simulation, implementation and creation of *
* design files limited to Xilinx devices or technologies. Use ... |
//
// Copyright (c) 2001 Steve Williams <>
//
// This source code is free software; you can redistribute it
// and/or modify it in source code form under the terms of the GNU
// General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option)
// ... |
#include <bits/stdc++.h> using namespace std; const int mod = 1000000007; inline int add(int a, int b) { if ((a += b) >= mod) a -= mod; return a; } inline int mult(int a, int b) { long long t = 1ll * a * b; if (t >= mod) t %= mod; return t; } inline int dec(int a, int b) { if ((a -... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); vector<long long> v; long long last; int q, a, b, lo, hi, one, two; long double aa, bb; cin >> q; cout << fixed; cout << setprecision(6); while (q--) { cin >> a; ... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:256000000 ) using namespace std; const double infd = 2e+9; const int infi = 1ll << 30; const long long infl = 1ll << 60; const int mod = 1e+9 + 7; template <class T> inline T sqr(T x) { return x * x; } int main() { string a, b; int... |
#include <bits/stdc++.h> int a, b, c, d, h; int main() { scanf( %d %d %d %d , &a, &b, &c, &d); h = a + 8 * c; if (h >= b) { printf( 0 ); return 0; } if (c <= d) { printf( -1 ); return 0; } printf( %d , (b - h) / (12 * (c - d)) + (((b - h) % (12 * (c - d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.