text stringlengths 59 71.4k |
|---|
//////////////////////////////////////////////////////////////////////
//// ////
//// fifoMux.v ////
//// ////
//// This file is part of the usbhos... |
#include <bits/stdc++.h> using namespace std; int n, u, r; int a[30], b[30], p[30], k[30]; long long res; bool first; void doit(int v[]) { long long tmp = 0; for (int i = 0; i < n; i++) { tmp += v[i] * k[i]; } res = max(res, tmp); if (first) { first = false; res = tmp; ... |
// file: clk_gen_83M_tb.v
//
// (c) Copyright 2008 - 2011 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is n... |
#include <bits/stdc++.h> using namespace std; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); mt19937 rnf(2106); const int N = 100005; bool c[(1 << 22)]; int d[(1 << 22)]; int p[(1 << 22)]; void solv0(int n) { vector<int> v; for (int x = 0; x < n; ++x) { for (int y = x... |
/**
* 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; long long a, b; int ans[60]; void dfs(int dep) { long long cur = ans[dep - 1]; long long x = cur << 1; long long y = cur * 10 + 1; if (x == b || y == b) { puts( YES ); cout << dep + 1 << endl; for (int i = 0; i < dep; i++) cout << a... |
#include <bits/stdc++.h> using namespace std; int main() { int n; int a, num, res; while (cin >> n) { num = 0; for (int i = 0; i < n; i++) { cin >> a; if (a % 2 == 0) { num++; } if (num % 2 == 1) { res = 1; } else { res = ... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; int n; string s; vector<string> precalced = { !x&x , !(x|y|z) , !x&!y&z , !x&!y , !x&!z&y , ... |
#include <bits/stdc++.h> using namespace std; string tolower(string str) { for (int i = 0; i < str.size(); i++) str[i] = tolower(str[i]); return str; } int main() { int n; cin >> n; vector<string> store; for (int i = 0; i < n; i++) { string str; cin >> str; store.push_b... |
#include <bits/stdc++.h> using namespace std; long long a[1010000]; inline bool read(long long &num) { char in; bool IsN = false; in = getchar(); if (in == EOF) return false; while (in != - && (in < 0 || in > 9 )) in = getchar(); if (in == - ) { IsN = true; num = 0; }... |
// file: pll_exdes.v
//
// (c) Copyright 2008 - 2011 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a ... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps / 1ps
`include "utils/bus_to_ip.v"
`include "i2c/i2c.v"
`include "i2c/i2c_cor... |
/**
* 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 isTandom(string s, int n) { if (n > s.size() / 2) return 0; for (int i = 0; i < n; i++) if (s[i + n] != && s[i] != s[i + n]) return 0; return 1; } int main() { string s; int k; cin >> s >> k; int len = s.size(); for (int... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017
// Date : Tue Oct 17 02:50:12 2017
// Host : Juice-Laptop running 64-bit major relea... |
/**
* 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... |
// (C) 2001-2011 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated doc... |
`timescale 1 ns / 1 ps
module axis_histogram #
(
parameter integer AXIS_TDATA_WIDTH = 16,
parameter integer BRAM_DATA_WIDTH = 32,
parameter integer BRAM_ADDR_WIDTH = 14
)
(
// System signals
input wire aclk,
input wire aresetn,
// Slave side
output wire... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: iob_jbi_rptr_0.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it an... |
`define bsg_dff_reset_macro(bits) \
if (harden_p && width_p==bits) \
begin: macro \
bsg_rp_tsmc_250_dff_nreset_s1_b``bits dff(.clock_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 law... |
/*******************************************************************************
* (c) Copyright 1995 - 2010 Xilinx, Inc. All rights reserved. *
* *
* This file contains confidential and proprietary information ... |
#include <bits/stdc++.h> using namespace std; long long n, fact[200001], a[200005]; long long power(long long a, long long b) { if (b == 0) return 1; long long p = power(a, b / 2); p = ((p % 1000000007) * (p % 1000000007)) % 1000000007; if (b & 1) { return (a * p) % 1000000007; } ret... |
//
// Copyright (c) 1999 Steven Wilson ()
//
// 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 int_t = long long int; template <typename T, typename FirstOp = std::plus<T>, typename SecondOp = std::multiplies<T>, typename UpdateOp = std::plus<T>> class SegmentTree { public: explicit SegmentTree(std::size_t size, FirstOp first_operation = FirstOp... |
#include <bits/stdc++.h> using namespace std; int gi() { char cc = getchar(); int cn = 0, flus = 1; while (cc < 0 || cc > 9 ) { if (cc == - ) flus = -flus; cc = getchar(); } while (cc >= 0 && cc <= 9 ) cn = cn * 10 + cc - 0 , cc = getchar(); return cn * flus; } const ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k, tlen = 0, dir, i; string temp; cin >> n >> m >> k; cin >> temp >> temp; if (temp == head ) dir = -1; else dir = 1; cin >> temp; if (m < k) m = 1; else m = n; for (i = 0; i < temp.... |
`timescale 1ns/100ps
/**
* `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 must be 1 10 or 100
* -base is the time base for each unit, ranging from seconds
* to femtoseconds, and must be... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:51:28 08/18/2015
// Design Name:
// Module Name: Comparator_Equal
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// R... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2014.4
// Copyright (C) 2014 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1ns/1p... |
/**
* 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 (c) 1999 Steven Wilson ()
//
// 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)
// ... |
//////////////////////////////////////////////////////////////////////
//// ////
//// eth_outputcontrol.v ////
//// ////
//// This file is part of the Ether... |
/**
* 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; map<int, int> mp; int fin(int rem) { for (auto p : mp) { if (p.first >= rem) return p.first; } return -1; } int main() { long long ans = 0, rem = 0, p, x, y, n, RES = 1e9; cin >> n >> x >> y; long long a[] = {x, x, x, x, y, y}; so... |
#include <bits/stdc++.h> using namespace std; vector<int> print; const int Maxn = int(1e2) + 10; int primes[20] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59}; int n, a[Maxn], xrn[60 + 10], dp[Maxn][(1 << 18) + 1000], adad[Maxn][(1 << 18) + 1000]; void xr() ... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_ebc_e
//
// Generated
// by: wig
// on: Mon Mar 22 13:27:59 2004
// cmd: H:\work\mix_new\mix\mix_0.pl -strip -nodelta ../../mde_tests.xls
//
// !!! Do not edit this file! Autogenerated by MIX !... |
#include <bits/stdc++.h> using namespace std; long long n, m, k; map<string, long long> mm; string a[100005]; long long c[100005]; long long min(long long a, long long b) { return a < b ? a : b; } int main() { cin >> n >> k >> m; for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int... |
#include <bits/stdc++.h> using namespace std; const int MAX = 2e5 + 10; int arr[MAX]; int n; vector<int> v[MAX]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { cin >> n; for (int i = 0; i < n; ++i) v[i].clear(); for (int i = 0; i <... |
#include <bits/stdc++.h> using namespace std; int main() { long long N, W; cin >> N >> W; long long lowest = 0, highest = W; long long current = 0, sum = 0; while (N--) { cin >> current; sum += current; lowest = max(lowest, -sum); highest = min(highest, W - sum); } ... |
#include <bits/stdc++.h> using namespace std; const int N = 1510, INF = 1e9 + 9; int n, s, m, k, last[N], a[N], dp[N][N]; bool check(int x) { memset(dp, 0, sizeof dp); for (int i = 0; i < n; i++) { int val = 0; for (int j = last[i]; j <= i; j++) val += a[j] <= x; for (int j = 1; j <= m... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; int a[MAXN]; int cnt[101][101]; int main() { int n, k; cin >> n >> k; for (int i = 1; i <= n; i++) { cin >> a[i]; cnt[i % k][a[i]]++; } int ans = 0; for (int i = 0; i < k; i++) { ans += min(cnt[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> #pragma comment(linker, /STACK:500000000 ) using namespace std; int A[105]; int f[105]; int main() { int n, i, p, x, y; cin >> n; for (i = 0; i < n; i++) cin >> A[i], f[A[i]] = i; int q; cin >> q; while (q--) { scanf( %d %d %d , &p, &x, &y); if (p ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// Copyright 2021 by Geza Lore. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0.
// SPDX-License-Identifier: LGPL-3.0-only... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2015.4
// Copyright (C) 2015 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
m... |
///////Courtsey: design from asic-world.com////////////
//-----------------------------------------------------
// Design Name : lfsr
// File Name : lfsr.v
// Function : Linear feedback shift register
// Coder : Deepak Kumar Tala
// Modified by : Deepak Unnikrishnan, UMass Amherst
//------------------------... |
/**
* 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... |
//#############################################################################
//# Function: A digital debouncer circuit #
//#############################################################################
//# Author: Andreas Olofsson #
... |
#include <bits/stdc++.h> using namespace std; int a[111]; char in[1000]; int main() { int t, m, i, j; scanf( %d%d , &t, &m); int aid = 1; while (t--) { scanf( %s , in); int k; if (in[0] == a ) { scanf( %d , &k); for (i = 0; i <= m - k; i++) { for (j =... |
#include <bits/stdc++.h> using namespace std; int N, Q, T; bool matr[300][300]; int amounts[300]; vector<int> chains[300]; bool was[300]; int sorted[300]; int s = 0; long long mas[2][100010]; void srt(int v) { was[v] = true; for (int i = 0; i < N; i++) if (!was[i] && matr[v][i]) srt(i)... |
#include <bits/stdc++.h> int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::string s; std::cin >> s; std::string_view view = s; size_t n = 0; while (!view.empty()) { const size_t id = view.find( > ) + 1; const auto tag = view.substr(0, id); view.re... |
module sys_command(input [47:0] cmd, input cl_size, input [15:0] o, r0, r1, r2, r3, r4, r5, r6, r7, flag, input en);
always @(posedge en) begin
case (cmd[39:36])
`CMD_TYPE_DFIN : begin
$finish();
end
`CMD_TYPE_DDIS1, `CMD_TYPE_DDIS2 : begin
case (cmd[35:32])
`CMDARG_DIS_C : begin
if (cl_s... |
#include <bits/stdc++.h> using namespace std; static const int INF = 500000000; template <class T> void debug(T a, T b) { for (; a != b; ++a) cerr << *a << ; cerr << endl; } long long int n; pair<long long int, int> factor[100]; long long int tot[100]; int m = 0; long long int ans; bool... |
#include <bits/stdc++.h> using namespace std; const int nm = 2e5 + 3; const long long mod = 1e9 + 7; int n; int pos[nm]; int main() { ios::sync_with_stdio(0), cin.tie(0); while (cin >> n) { for (int i = 0; i < n; i++) cin >> pos[i]; sort(pos, pos + n); int step = n / 2 - 1; i... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2009 Xilinx, Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ Version : 10.... |
#include <bits/stdc++.h> using namespace std; int ans[1000005]; int main() { int n; cin >> n; int a[n], b[n]; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n; i++) cin >> b[i]; int l = 0; for (int i = 0; i < n; i++) { for (int j = i; j < n; j++) { if (b[j] ... |
#include <bits/stdc++.h> using namespace std; const double pi = 2.0 * acos(0.0); const double eps = 1.0e-9; const int dr[] = {-1, 0, 1, 0}, dc[] = {0, 1, 0, -1}; const int dr6[] = {1, 1, 0, -1, -1, 0}, dc6[] = {0, 1, 1, 0, -1, -1}; const int dr8[] = {-1, -1, 0, 1, 1, 1, 0, -1}, dc8[] = {0, 1, 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 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; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int t; cin >> t; while (t--) { int n, a[100005]; cin >> n; for (int i = 0; i < n; ++i) cin >> a[i]; int MIN = INT_MAX, MAX = -100; f... |
// (C) 2001-2014 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated doc... |
// Copyright (c) 2016 CERN
// Maciej Suminski <>
//
// 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)
// any late... |
#include <bits/stdc++.h> using namespace std; const int sq = (int)sqrt((int)1e6); const int maxnb = (int)1e9 + 7; const double pi = acos(-1.0); const int maxnl = 100500; const double eps = 1e-9; set<pair<long long, int> > se; int n, pos[50500]; char c[50500]; long long price; string s; int main(... |
/**
* 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 N = 1000010; const int md = 1e9 + 7; int mul(int a, int b) { return (long long)a * b % md; } char s[N]; int n, m, nn, x[N], z[N]; bool start[N]; int main() { scanf( %d %d %s , &n, &m, s); nn = strlen(s); for (int i = 0; i < m; i++) { ... |
/* 同步 FIFO 4*128 */
// 一种4bit 128深度的 同步FIFO设计
// @`13
// 2017年6月6日
// 哈尔滨工业大学(威海) EDA课程设计
module fifo(clock, reset, read, write, fifo_in, digitron_out, fifo_empty, fifo_full);
parameter DEPTH = 128; // 128 深
parameter DEPTH_BINARY = 7; // 深度的二进制位数
parameter WIDTH = 4; // 4bit宽
par... |
// ps2mouse.v
// ps2 mouse model
// 2014,
module ps2mouse (
input wire clk,
input wire rst,
inout wire mclk,
inout wire mdat
);
//// constants ////
localparam [8-1:0]
PS2_SELFTEST = 8'haa,
PS2_ID00 = 8'h00,
PS2_ID03 = 8'h03,
PS2_ACK = 8'hfa;
//// bus tri-state buffers ////
reg mc... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i = 0; cin >> n; long long a; vector<long long> vc; while (n--) { cin >> a; vc.push_back(a); } sort(vc.begin(), vc.end()); i = vc.size(); long long ans = vc[i - 1]; for (int j = i - 2; j >= 0; j--) ... |
#include <bits/stdc++.h> using namespace std; int sta[10][100005]; int top[10]; int tail[10]; int a[100005][10]; int ans[10]; int main() { int n, m; int k; scanf( %d %d %d , &n, &m, &k); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { scanf( %d , &a[i][j]); ... |
#include <bits/stdc++.h> using namespace std; long long n, a, b; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b; if (a > b) { cout << b * (b + 1) / 2 << endl; } else { cout << a * (a - 1) / 2 + 1 << endl; } } } |
/**
* 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 1986-2014 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2014.1 (lin64) Build 881834 Fri Apr 4 14:00:25 MDT 2014
// Date : Mon May 26 11:11:49 2014
// Host : macbook running 64-bit Arch Linux
// ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:46:09 02/22/2015
// Design Name:
// Module Name: SpecialAdd
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depe... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; scanf( %d %d , &n, &m); vector<pair<int, int> > f(n); vector<int> b(m); vector<int> array(1000005, 0); for (int i = 0; i < n; i++) { int temp; scanf( %d , &temp); array[temp]++; f.push_back(make_pair... |
#include <bits/stdc++.h> const long double eps = 1e-9; const long long mod = 1e9 + 7, ll_max = (long long)1e18; const int MX = 2e5 + 10, int_max = 0x3f3f3f3f; using namespace std; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); long long n, k; long long arr[MX]; int solve() { ... |
#include <bits/stdc++.h> using namespace std; int n, m, ans, du[2010], d[2010], mx, sz, dp[2010]; int num, k, now, a[2010], dfn[2010], low[2010], st[2010], b[2010]; bool in[2010]; int cnt, head[2010], to[200010], nxt[200010]; vector<int> v[2010]; void add(int x, int y) { cnt++; to[cnt] = y; nx... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cout.tie(0); cin.tie(0); string s; cin >> s; long long dp[s.length() + 1], mod = 1e9 + 7, f = 0; dp[0] = 1; dp[1] = 1; if (s[0] == m || s[0] == w ) f = 1; for (long long i = 2; i <= s.... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; void fastio() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int main() { fastio(); int n, m, temp; cin >> n >> m; vector<int> boys(n); vector<int> girls(m); int hb; cin >> hb; ... |
/*
* Copyright (c) 2002 Stephen 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 maxn = 2e4 + 100; const int maxq = 2e4 + 100; const int maxd = 15; const int ha1 = 317, ha2 = 443, mod = 364417; struct Que_Typ { int y, id; Que_Typ(int a = 0, int b = 0) { y = a, id = b; } }; int N, Que; vector<Que_Typ> ope[maxn]; long... |
#include <bits/stdc++.h> using namespace std; struct Point { long double x, y; Point(){}; long double dist(Point b) { return sqrt((b.x - x) * (b.x - x) + (b.y - y) * (b.y - y)); } }; int main() { Point a, b, c; cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y; long double k = a.di... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2016 by Wilson Snyder.
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), (expv)); $stop; end while... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int key; vector<int> v; for (int i = 0; i < n; ++i) { cin >> key; v.push_back(key); } int max = v[0]; int min = v[0]; int amz = 0; for (int i = 1; i < n; ++i) { if (v[i] > max) { ... |
#include <bits/stdc++.h> using namespace std; template <typename T> void pr(vector<T> &v) { for (int i = 0; i < (int)(v).size(); i++) cout << v[i] << ; cout << n ; ; } template <typename T> void pr(vector<vector<T>> &v) { for (int i = 0; i < (int)(v).size(); i++) { pr(v[i]); }... |
#include <bits/stdc++.h> using namespace std; const long long maxn = (int)1e6; long long n, m, a; int main() { cin >> a; if (a == 1) { cout << 1 1 n 1 ; return 0; } cout << (a - 1) * 2 << << 2 << n ; cout << 1 2 ; } |
/**
* 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; map<long long, long long> s; long long n, b[500005], c[500005]; int main() { cin >> n; for (int i = 0; i < n; i++) { long long x; cin >> x; s[x]++; } long long m, mx1 = 0, mx2 = 0, index = 1; cin >> m; for (int i = 0; i < m;... |
#include <bits/stdc++.h> using namespace std; const int maxN = 110000; int t[4 * maxN], m; int get(int k) { int res = 0; for (int i = k; i >= 0; i = (i & (i + 1)) - 1) { res = max(res, t[i]); } return res; } void update(int k, int delta) { for (int i = k; i <= m; i |= (i + 1)) { ... |
#include<bits/stdc++.h> using namespace std; int main() { int t,n; cin >> t; while(t--) { cin >> n; int ans=0,k=n,p=n,h=0; while(ceil(sqrt(k))>=2 && k>2) { ans++; k=ceil(sqrt(k)); } cout << ans+n-2 << e... |
/**
* testbench.v
*
*/
module testbench();
localparam width_p = 32;
localparam ring_width_p = width_p + 1;
localparam rom_addr_width_p = 32;
logic clk;
logic reset;
bsg_nonsynth_clock_gen #(
.cycle_time_p(10)
) clock_gen (
.o(clk)
);
bsg_nonsynth_reset_gen #(
.reset_cycles_lo_p(4)
,.reset_cycles_hi_p(... |
/**
* 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 2013(c) Analog Devices, Inc.
// Author: Lars-Peter Clausen <>
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: jbi_jid_to_yid.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it an... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x, y; cin >> n >> x >> y; if ((x == n / 2 || x == n / 2 + 1) and (y == n / 2 || y == n / 2 + 1)) cout << NO << endl; else cout << YES << endl; return 0; } |
/*
* 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 long long N = 1e5 + 7; vector<long long> v[N]; long long vis[N], prt[N], bip[N], cs, ce; void dfs(long long ver, long long par) { bip[ver] = (!bip[par]); vis[ver] = 1; prt[ver] = par; for (auto it : v[ver]) { if (vis[it] == 2 || it == p... |
//=============================================================================
// Verilog module generated by IPExpress 08/21/2007 16:22:41
// Filename: USERNAME_bb.v
// Copyright(c) 2005 Lattice Semiconductor Corporation. All rights reserved.
//======... |
#include <bits/stdc++.h> using namespace std; int Read() { int x = 0; char ch = getchar(); while (!isdigit(ch)) ch = getchar(); while (isdigit(ch)) x = (x << 3) + (x << 1) + ch - 0 , ch = getchar(); return x; } void Write(int x) { if (x < 0) putchar( - ), x = -x; if (x == 0) putchar... |
/**
* 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.