text stringlengths 59 71.4k |
|---|
/**
* 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... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. *
... |
/**
* 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; template <class T> void show(const vector<T> &a) { for (T x : a) cout << x << ; cout << n ; } const long long N = 1e5 + 10, oo = 1e18 + 500; const long long mod = 1e9 + 7; const long double eps = 1e-9, PI = 2 * acos(0.0); long long n, m, k; lo... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fll; const int MAXN = 510; char grid[MAXN][MAXN]; int n, k; int component[MAXN][MAXN]; int size[MAXN * MAXN]; int orig_size[MAXN * MAXN]; int last_taken[MAXN * MAXN]; int dr[] = {1, 0,... |
/* Author: QAQAutoMaton Lang: C++ Code: C.cpp Mail: lk@qaq-am.com Blog: https://www.qaq-am.com/ */ #include<bits/stdc++.h> #define debug(...) fprintf(stderr,__VA_ARGS__) #define DEBUG printf( Passing [%s] in LINE %d n ,__FUNCTION__,__LINE__) #define Debug debug( Passing [%s] in LINE %d n ,__FUNCTION... |
#include <bits/stdc++.h> using namespace std; template <typename t> t in(t q) { cin >> q; return q; } template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << [ ; for (int i = 0; i < ((int)size(v)); ++i) { os << v[i]; if (i != ((int)size(v)) - 1) os << ... |
/**
* 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)
// ... |
/*
* 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) 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... |
#include <bits/stdc++.h> int cmp(const void *a, const void *b) { return (*(int *)a - *(int *)b); } int main() { char str[100005]; int i, j, k; scanf( %s , str); int l = strlen(str); int cB = 0, cb = 0, cu = 0, ca = 0, cs = 0, cr = 0, cl = 0; for (i = 0; i < l; i++) { if (str[i] == B )... |
module autoinstparam_first ();
parameter BITSCHANGED;
parameter BITSA;
parameter type BITSB_t;
typedef [2:0] my_bitsb_t;
/* autoinstparam_first_sub AUTO_TEMPLATE (
.BITSA (BITSCHANGED),
); */
autoinstparam_first_sub
#(/*AUTOINSTPARAM*/
// Parameters
... |
#include <bits/stdc++.h> using namespace std; long long cyc[1000006][27], n, m; long long done[1000006]; string a, b; int main() { cin >> n >> m; cin >> a >> b; int s1 = a.size(); int s2 = b.size(); long long tot = s1 * n; memset(cyc, 0, sizeof(cyc)); memset(done, 0, sizeof(done));... |
#include <bits/stdc++.h> using namespace std; const int maxn = 105; map<string, int> H1[maxn], H2[maxn]; vector<char> ans; char getA(string a, string b) { int c[30]; for (int i = 0; i < 26; i++) c[i] = 0; for (int i = 0; i < a.size(); i++) c[a[i] - a ]++; for (int i = 0; i < b.size(); i++) c[... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:16:57 02/26/2016
// Design Name:
// Module Name: Register
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depend... |
#include <bits/stdc++.h> using namespace std; const int N = 5 * 1e5 + 5; const int M = 2e6 + 5; vector<int> a[M], b[M]; vector<int> c[M], d[M]; int vis[M]; int n, w, cnt; int main() { scanf( %d%d , &n, &w); w--; for (int i = 1; i <= n; i++) { int k; scanf( %d , &k); a[i].re... |
#include <bits/stdc++.h> using namespace std; vector<bool> prime(1001, true); void sieve() { prime[0] = false; prime[1] = false; for (int i = 2; i <= 1000; i++) { if (prime[i]) { int j = 2; while (i * j <= 1000) { prime[i * j] = false; j++; } } ... |
#include <bits/stdc++.h> using namespace std; const int INF = 2e9; const int MAXN = 900; const int MAXM = 1900000; int N, edges; int last[MAXN], preve[MAXM], head[MAXM]; int Cap[MAXM], Flow[MAXM]; int dist[MAXN]; int nextEdge[MAXN]; queue<int> Q; void init(int N) { edges = 0; memset(last, ... |
#include <bits/stdc++.h> using namespace std; string s1, s2; bool eq(int a1, int b1, int a2, int b2) { if ((b1 - a1) & 1) { while (a1 < b1) { if (s1[a1] != s2[a2]) return 0; ++a1; ++a2; } return 1; } int m1 = (a1 + b1) / 2; int m2 = (a2 + b2) / 2; retu... |
#include <bits/stdc++.h> using namespace std; int n; map<int, int, greater<int> > g; int a; int gcd(int a, int b) { while (b != 0) { a %= b; swap(a, b); } return a; } int main() { ios::sync_with_stdio(0); cin.tie(0); ; cin >> n; for (int(i) = (0); (i) < int(n * ... |
#include <bits/stdc++.h> using namespace std; int Day12[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int prime100[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103}; template <typename T> inline bool isLeap(T y) { ... |
#include <bits/stdc++.h> using namespace std; struct Tans { long a; long b; }; struct mstr { long num; long val; }; bool operator<(mstr a, mstr b) { return a.val < b.val; } bool operator>(mstr a, mstr b) { return a.val > b.val; } bool operator==(mstr a, mstr b) { return a.val == b.val; }... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100500; int a[maxn]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; long long k; cin >> n >> k; long long sm = 0; priority_queue<pair<int, int> > pq; for (int i = 0; i < n; ++i) { cin ... |
module ps2 (
input Rx,
input CLKOUT,
output reg Rx_error,
output [7:0] DATA,
output reg DONE
);
reg [8:0] regis;
reg [7:0] regis0;
reg [3:0] i;
reg [3:0] j;
reg [1:0] k;
reg init;
reg DoIt;
//reg NoDoIt;
//reg MakeIt=(DoIt && ~NoDoIt);
initial... |
#include <bits/stdc++.h> using namespace std; int main() { int n; char c[2] = { w , b }; cin >> n; if (n % 2 == 1) cout << -1 ; else { for (int i = 1; i <= n; i++) { for (int j = 0; j < n; j++) { for (int k = 0; k < n; k++) { if ((j / 2) % 2 == 0) ... |
/* HW4, Problem 24b */
module jerk_ct(output reg [7:0] count, input clk, reset);
reg [3:0] state; // 0 to 13 needed.
reg [7:0] icount;
always @(icount)
count <= { icount[0], icount[1], icount[2], icount[3],
icount[4], icount[5], icount[6], icount[7] };
always @(posedge clk) begin
if (reset == 1) begin
... |
//-------------------------------------------------------------------
//-- echo_tb.v
//-- Testbench for the simulation of the echo.v
//-------------------------------------------------------------------
//-- (c) BQ December 2015. Written by Juan Gonzalez (Obijuan)
//-----------------------------------------------------... |
// The MLAB
// --------
// In addition to Logic Array Blocks (LABs) that contain ten Adaptive Logic
// Modules (ALMs, see alm_sim.v), the Cyclone V/10GX also contain
// Memory/Logic Array Blocks (MLABs) that can act as either ten ALMs, or utilise
// the memory the ALM uses to store the look-up table data for general us... |
#include <bits/stdc++.h> using namespace std; const int M = 100000 + 5; map<long long int, int> mp; queue<int> Q; int vis[M]; long long int dk[M]; vector<long long int> step; long long int a[M]; int rch[M]; struct TREE { int lc; int rc; long long int l; long long int r; long long... |
/**
* 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-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Thu May 25 15:27:56 2017
// Host : GILAMONSTER running 64-bit major release (... |
module serial_rx #(
parameter CLK_PER_BIT = 50
)(
input clk,
input rst,
input rx,
output [7:0] data,
output new_data
);
// clog2 is 'ceiling of log base 2' which gives you the number of bits needed to store a value
parameter CTR_SIZE = $clog2(CLK_PER_BIT)... |
/*
* 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 INF = 1e9; const long long MOD = 1e9 + 7; const int MAXN = 705; const int bignumlen = 17; const int Blen = 8; const long long base = 100000000; struct bignum { int len; long long data[bignumlen]; long long &operator[](int x) { ret... |
#include <bits/stdc++.h> using namespace std; long long n, k, q, a, b, ans, t; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> q; while (q--) { cin >> k >> n >> a >> b; ans = a * n; if (b * n >= k) cout << -1 << n ; else { if... |
// NIOS_SYSTEMV3_tristate_bridge_ssram_pinSharer.v
// This file was auto-generated from altera_tristate_conduit_pin_sharer_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 13.0sp1 232 at 2015.10.23.09:55:04
`timescale 1 ps / 1 ps
module NIOS_SYSTEMV3_tristate_bridge_s... |
#include <bits/stdc++.h> using namespace std; void solve() { string s; cin >> s; int arr[26] = {}; int n = s.length(); int count = 0; for (int i = 0; i < n; i++) { arr[s[i] - a ]++; if (arr[s[i] - a ] == 2) { arr[s[i] - a ] = 0; count--; } else co... |
module alt_vipvfr131_common_avalon_mm_master
( clock,
reset,
// Avalon-MM master interface
av_clock,
av_reset,
av_address,
av_burstcount,
av_writedata,
av_readdata,
av_write,
av_read,
av_readdatavalid,
av_waitrequest,
// user algorithm interface
addr,
command,
is_bu... |
#include <bits/stdc++.h> using namespace std; int a, n, d, t, v; double ans[100001]; double gets_ans() { double t1 = v * 1.0 / a; if (0.5 * a * t1 * t1 <= d) return t + t1 + (d - 0.5 * a * t1 * t1) / v; return sqrt(2.0 * d / a) + t; } int main() { cin >> n >> a >> d; for (int i = 0; i < ... |
module bootloader
#(
parameter DATA_WIDTH = 32,
parameter ADDR_WIDTH = 20
)
(/*autoport*/
input clk,
input rst_n,
// boot memory ports interface
output reg boot_mem_rd_en,
output reg [ADDR_WIDTH-1:0] boot_mem_add... |
#include <bits/stdc++.h> using namespace std; class point { public: int x, y; point(int _x, int _y) { x = _x; y = _y; } string str() { stringstream ss; ss << ( << x << , << y << ) ; return ss.str(); } }; int main() { int n; cin >> n; point m... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2003 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
reg [7:0] cyc; initial cyc = 0;
reg ... |
#ifndef _MY #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC target( sse,sse2,sse3,ssse3,abm,mmx,tune=native ) #endif #include bits/stdc++.h #define int ll #define all(x) (x).begin(), (x).end() using namespace std; typedef long long ll; typedef long double ld; const... |
/**
* 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, k; cin >> n >> k; k--; int a[n]; int sum = 0; for (int i = 0; i < n; ++i) { cin >> a[i]; } if (a[k] == 1) sum++; for (int i = 1; i < n; ++i) { if (k - i < 0) { for (int j = k + i; j < n; ++j) { ... |
/*
Copyright (c) 2019 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, distribute,... |
`timescale 1ns/1ps
module SensorFSM #(
parameter DataWidth = 8
) (
input Reset_n_i,
input Clk_i,
// top level
input Enable_i,
output reg CpuIntr_o,
output [2*DataWidth-1:0] SensorValue_o,
// to/from Measure-FSM
... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2017 by Josh Redford.
// SPDX-License-Identifier: CC0-1.0
interface my_if;
logic valid;
logic [7:0] data ;
modport slave_mp (
input val... |
#include <bits/stdc++.h> using namespace std; int a[114514]; int l[114514], r[114514]; bool solve(int n) { int curr = a[1]; l[1] = a[1]; for (int i = 2; i <= n; i++) { if (a[i] < a[i - 1]) curr -= a[i - 1] - a[i]; if (curr < 0) return false; l[i] = curr; } return true; } ... |
/*
* 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... |
// megafunction wizard: %RAM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: memoria.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ================================... |
#include <bits/stdc++.h> using namespace std; int n, k; vector<int> adj[(int)1e5 + 7]; int vis[(int)1e5 + 7]; int deg[(int)1e5 + 7]; int cnt[(int)1e5 + 7]; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); ; scanf( %d %d , &n, &k); for (int i = 1; i <= n - 1; i++) { ... |
`timescale 1ns / 1ps
`include "asserts.vh"
module tx_DS_SE_tb();
reg [11:0] story_tb;
reg TxClk, TxReset, Tx1, Tx0;
wire D_o, S_o;
`DEFIO(TxClk,1,0)
`DEFASSERT0(D,o)
`DEFASSERT0(S,o)
tx_DS_SE transmitter(
.TxClk(TxClk),
.TxReset(TxReset),
.Tx1(Tx1),
.Tx0(Tx0),
.D(D_o),
.S(S_o)
);
initial b... |
/**
* 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; cin >> n; vector<long long> a(n); long long s = 0; long long l = 0; long long r = 1000000000000000; for (int i = 0; i < n; i++) { cin >> a[i]; s += a[i]; l = max(a[i], l); } long long is = r; ... |
/**
* 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 mod = 1e9 + 7; vector<long long int> graph[100007]; long long int vis[100007]; long long int mxm; void dfs(long long int u, long long int p, long long int d) { vis[u] = 1; mxm = max(mxm, d); for (long long int v : graph[u]) { df... |
/**
* 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 SIZE = 640; int h, w; int matr[SIZE][SIZE]; int main() { int q; scanf( %d , &q); for (int tt = 0; tt < q; tt++) { scanf( %d%d , &h, &w); for (int i = 0; i < h; i++) for (int j = 0; j < w; j++) scanf( %d , &matr[i][j]); ... |
#include <bits/stdc++.h> using namespace std; using namespace std; const int MaxN = 100005, NA = -1, MaxC = 0x3F3F3F3F; int a[MaxN]; int b[MaxN], c[MaxN]; bool f[MaxN]; int d, e, g, m, n; int main(void) { int i; while (scanf( %d %d , &n, &m) != EOF) { memset(b, 0, sizeof(b)); memset... |
#include <bits/stdc++.h> using namespace std; int sum[1000100]; int main() { string a, b; cin >> a >> b; int cnt = 0; for (int i = 0; i < b.size(); i++) { if (b[i] == 1 ) cnt++; } sum[0] = a[0] - 0 ; for (int i = 1; i < a.size(); i++) { sum[i] = sum[i - 1] + a[i] - 0 ; ... |
`include "hi_read_tx.v"
/*
pck0 - input main 24MHz clock (PLL / 4)
[7:0] adc_d - input data from A/D converter
shallow_modulation - modulation type
pwr_lo - output to coil drivers (ssp_clk / 8)
adc_clk - output A/D clock signal
ssp_frame - output SSS fram... |
#include <bits/stdc++.h> using namespace std; int main() { int n, sum; cin >> n >> sum; if (n == 0 || (sum == 0 && n > 1)) cout << -1 << << -1 << endl; else { int ma; string t = ; int x = sum; while (x > 0 && t.length() != n) { if... |
#include <bits/stdc++.h> using namespace std; void swap(long long int arr[], long long int x, long long int y) { long long int temp = arr[x]; arr[x] = arr[y]; arr[y] = temp; } void print_arr(long long int arr[], long long int n) { cout << n ; for (long long int i = 0; i < n; i++) { c... |
`include "top.vh"
`include "uart.vh"
module top_tb;
reg clk_i = 0;
reg rst_i = 1;
reg [4:0] rx_i_ctr = 0;
reg [19:0] rx_tmp = 20'b10100011101010010000;
reg tmp_rx_bit = 1;
wire [7:0] led_o;
wire clk_uart_tx;
wire clk_uart_rx, rs232_rx_i;
initial
begin
$... |
module ForwardingJudgment(
input [1:0] twobeforeop1,
input [2:0] twobeforeop2,twobeforecond,
input [3:0] twobeforeop3,
input [1:0] beforeop1,
input [2:0] beforeop2,beforecond,
input [3:0] beforeop3,
input [1:0] op1,
input [2:0] op2,cond,
input [3:0] op3,
... |
//-----------------------------------------------------------------
// AltOR32
// Alternative Lightweight OpenRisc
// V2.1
// Ultra-Embedded.com
// Copyright 2011 - 2014
//
// Email:
//
// ... |
#include <bits/stdc++.h> using namespace std; const int N = 1000100; const int MOD = 1000000007; vector<long long> al[N], sum[N]; vector<pair<int, int> > adj[N]; pair<int, int> p[N]; int cnt(int u, long long ls) { return upper_bound(al[u].begin(), al[u].end(), ls) - al[u].begin(); } long long hp(i... |
// P-K unit (control panel, heavily modified for the FPGA implementation)
`define FN_START 4'd0
`define FN_MODE 4'd1
`define FN_CLOCK 4'd2
`define FN_STOPN 4'd3
`define FN_STEP 4'd4
`define FN_FETCH 4'd5
`define FN_STORE 4'd6
`define FN_CYCLE 4'd7
`define FN_LOAD 4'd8
`define FN_BIN 4'd9
`define FN_OPRQ 4'd10
`de... |
/**
* 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 ibex_register_file (
clk_i,
rst_ni,
test_en_i,
raddr_a_i,
rdata_a_o,
raddr_b_i,
rdata_b_o,
waddr_a_i,
wdata_a_i,
we_a_i
);
parameter RV32E = 0;
parameter [31:0] DataWidth = 32;
input wire clk_i;
input wire rst_ni;
input wire test_en_i;
input wire [4:0] raddr_a_i;
output wire [(DataWidth - 1):0] ... |
#include <bits/stdc++.h> using namespace std; const int M = 998244353; const int N = 200005, E = 524288; int R[N * 4]; long long qpow(long long a, long long b) { long long ans = 1; while (b) { if (b & 1) ans = ans * a % M; a = a * a % M; b >>= 1; } return ans; } long long... |
#include <bits/stdc++.h> using namespace std; const int N = 500005; int n, K, a[N]; long long checkl(int x) { long long sum = 0; for (int i = 0; i < n; ++i) { sum += max(0, x - a[i]); } return sum; } long long checkr(int x) { long long sum = 0; for (int i = 0; i < n; ++i) { ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7, mod2 = 998244353; unsigned long long base = 131; const int w = 5e5 + 5; long long n, m; struct node { int x, y, z; } s[w]; int cmp(node x, node y) { if (x.x != y.x) return x.x > y.x; else return x.y > y.... |
#include <bits/stdc++.h> using namespace std; template <class T> struct vect { private: T *memory = new T[0]; unsigned int length; unsigned int sz; public: vect() { length = 0; sz = 0; } inline void incsize(const int len) { T *temp = new T[len]; length = le... |
#include <bits/stdc++.h> using namespace std; bool dp[1001][1001]; int data[1001]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; if (n > m) { cout << YES << n ; return 0; } else { for (int i = 1; i <= n; i++) { ci... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1000000007; const long long INF = 1000000000; template <class T> inline void read(T &x) { char c; int flag = 1; while ((c = getchar()) < 0 || c > 9 ) if (c == - ) flag *= -1; x = c - 0 ; while ((c = getchar()) >... |
#include <bits/stdc++.h> using namespace std; inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; } const int INF = (((1 << 30) - 1) << 1) + 1; const int nINF = 1 << 31; string s; vector<int> v[2], ans; int n, t; void print(vector<int>& vec) { for (int x : vec) cout << x << ; cout... |
/*
* 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 "ethmac_defines.v"
module ethmac
(
// WISHBONE common
wb_clk_i, wb_rst_i, wb_dat_i, wb_dat_o,
// WISHBONE slave
wb_adr_i, wb_sel_i, wb_we_i, wb_cyc_i, wb_stb_i, wb_ack_o, wb_err_o,
// WISHBONE master
m_wb_adr_o, m_wb_sel_o, m_wb_we_o,
m_wb_dat_o, m_wb_dat_i, m_wb_cyc_o,
m_wb_stb_o, m_w... |
/*
* 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... |
//////////////////////////////////////////////////////////////////////
//// ////
//// Generic Single-Port Synchronous RAM 32-bit Byte-Write ////
//// ////
//// This file is part of memory li... |
#include <bits/stdc++.h> using namespace std; int main() { long long int k, n, first = -1, sum = 0; cin >> n >> k; long long int a[n]; long long int ans = 0; for (long long int i = 0; i < n; ++i) cin >> a[i]; string s; cin >> s; int flag = 0; for (long long int i = 0; i < n; ++i)... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int n; cin >> n; long long int h[n]; long long int d[n]; long long int sum = 0; for (long long int i = 0; i < n; i++) { cin >> h[i]; d[i] = h[i] - i; ... |
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; const int maxn = 1e3 + 10; int n, m, mp[maxn][maxn], cnt, dx[] = {0, 1, 0, -1}, dy[] = {-1, 0, 1, 0}; bool vis[maxn][maxn]; vector<int> ans; void dfs(int x, int y) { if (vis[x][y] || x <= 0 || x > n || y <= 0 || y > m) return; ... |
#include <bits/stdc++.h> using namespace std; long long arr1[1000001]; template <typename T> T myMax(T x, T y) { return (x > y) ? x : y; } template <typename T> T myMin(T x, T y) { return (x < y) ? x : y; } template <typename T> T sum(T x, T y) { return (x + y); } template <typename ... |
//--------------------------------------------------------------------------------
// Project : SWITCH
// File : reset_sync.v
// Version : 0.2
// Author : Shreejith S
//
// Description: Synchronous Reset Generation - XILINX
//
//---------------------------------------------------------------------------... |
#include <bits/stdc++.h> using namespace std; const int rlen = 1 << 18 | 1; inline char gc() { static char buf[rlen], *ib, *ob; (ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)); return ib == ob ? -1 : *ib++; } inline int read() { int ans = 0; char ch = gc(); while (!isdigit... |
#include <bits/stdc++.h> using namespace std; double PI = 3.141592653589793; vector<complex<double> > duzywek; vector<complex<double> > duzyret[50][2]; void szykuj() { for (int j = 0; j < 22; j++) { for (int i = 1; i <= (1 << (21 - j)); i++) { duzyret[j][0].push_back(0); if (j) duzyr... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:09:25 11/06/2014
// Design Name:
// Module Name: addititon
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depen... |
// Implements a sinc^3 filter on a single-bit input. Useful for sigma-delta
// modulator outputs. Transfer function is:
//
// (1-z^-OSR)^3
// H(z) = ----------------
// (1-z^-1)^3
//
// This is very efficient for Xilinx FPGAs. Also near optimal for any device
// where long single-bit delay lines ca... |
#include <bits/stdc++.h> using namespace std; const int N = 1000000 + 5; vector<int> g[N], revg[N], cur; bool used[N], isans[N]; set<int> all; int n, m; int main() { scanf( %d %d , &n, &m); for (int i = 0; i < m; i++) { int u, v; scanf( %d %d , &u, &v); u--, v--; g[u].push_... |
#include <bits/stdc++.h> using namespace std; vector<pair<long long, long long> > V1, V2; int n, s; int main() { while (~scanf( %d%d , &n, &s)) { V1.clear(); V2.clear(); long long sum1 = 0; long long sum2 = 0; long long ans = 0; for (int i = 0; i < n; i++) { long ... |
#include <bits/stdc++.h> using namespace std; int n, k, tab[70], p; int main() { scanf( %d %d , &n, &k); for (int i = 0; i < n; i++) scanf( %d , &tab[i]); sort(tab, tab + n); if (k > n) { printf( -1 n ); return 0; } printf( %d %d n , tab[n - k], tab[n - k]); return 0; } ... |
#include <bits/stdc++.h> using namespace std; template <typename T> using minheap = priority_queue<T, vector<T>, greater<T>>; template <typename T> using maxheap = priority_queue<T>; template <typename T> using dpair = pair<T, T>; template <class T1, class T2> istream &operator>>(istream &is, pair<T1,... |
/**
* 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 cases(1), t; template <typename T> void binary(T n) { stack<int> st; while (n > 0) { st.push(n % 2); n /= 2; } while (!st.empty()) { cout << st.top(); st.pop(); } cout << n ; } vector<long long> factorize(lon... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2010 Xilinx, Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ Version : 11.... |
#include <bits/stdc++.h> using namespace std; const int modulo = 1e9 + 7; template <class __Ty> bool mini(__Ty& a, __Ty b) { return a > b ? ((a = b) | 1) : (0); } template <class __Ty> bool maxi(__Ty& a, __Ty b) { return a < b ? ((a = b) | 1) : (0); } template <class __Ty> __Ty add(__Ty a, _... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.