text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int n, a[400 + 2], ans = 1 << 30; int main() { cin >> n; for (register int i = 1; i <= n; i++) cin >> a[i]; for (int i = n; i >= 2; i--) { if (a[i] >= ans) break; for (int j = i; j <= n; j++) { register int num = a[i - 1] - 1, x = 1, t;... |
// parallel to bsg_counter_clear_up
// set occurs before down, and both events can take place in the same cycle.
// we do not output an overflow flag because there is no == that we would
// want to amortize the cost of
`include "bsg_defines.v"
module bsg_counter_set_down #(parameter `BSG_INV_PARAM(width_p), parameter... |
#include <bits/stdc++.h> #pragma warning(disable : 4244 4267 4018 4996 4800) using namespace std; istream& in = std::cin; ostream& out = std::cout; int n, m, total; int xstart = -1, ystart; vector<vector<char>> p; int res = -1; bool ones(int x1, int y1, int x2, int y2) { for (int i = x1; i <= x2; ... |
#include <bits/stdc++.h> using namespace std; const int MAX = 100005; bool black[MAX]; vector<int> vec[MAX]; bool old_black[MAX]; const int MAX_BLOCK_SIZE = 600; int t[MAX], v[MAX]; bool used[MAX]; vector<pair<pair<int, int>, int>> v2[MAX]; int push[MAX]; bool clear[MAX]; void dfs_1(int pos, int... |
#include <bits/stdc++.h> using namespace std; int a[10000000], b[10010000]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; b[i] = a[i]; } int p = 0; sort(a, a + n); for (i... |
#include <bits/stdc++.h> using namespace std; struct dame { int b, i, r; dame() {} dame(int b_, int i_, int r_) : b(b_), i(i_), r(r_) {} }; bool greater_compare(dame A, dame B) { return A.b > B.b || A.b == B.b && A.i < B.i || A.b == B.b && A.i == B.i && A.r < B.r; } bool by_i(dame... |
/*
* period_check_tb.v: Test bench for period_check.v
* author: Till Mahlburg
* year: 2019
* organization: Universität Leipzig
* license: ISC
*
*/
`timescale 1 ns / 1 ps
module period_check_tb ();
reg RST;
reg PWRDWN;
reg clk;
reg [31:0] period_length;
wire period_stable;
integer pass_count;
integer f... |
//=======================================================================
// Created by :
// Filename :cache.v
// Author :(RDC)
// Created On :2014-04-28 10:57
// Last Modified :
// Update Count :2014-04-28 10:57
// Description :
//
// ... |
#include <bits/stdc++.h> using namespace std; int n, m, t, i, j, k; long long a[2000005]; long long ans, sum; int main() { scanf( %d%d , &n, &m); for (i = 1; i <= m * 2; i++) { scanf( %d , &t); a[t]++; } for (i = 1; i <= n; i++) ans += a[i] * (n - 1 - a[i]); printf( %lld n , (l... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) f = -1; ch = getchar(); } while (isdigit(ch)) { x = (x << 1) + (x << 3) + ch - 0 ; ch = getchar(); } return ... |
#include <bits/stdc++.h> using namespace std; int x, y, z, inf = 1e9, f[210][210], n, m, Max[210]; pair<pair<int, int>, int> p[40010]; pair<int, int> q[210]; void read(int &x) { char ch = getchar(); int mark = 1; for (; ch != - && (ch < 0 || ch > 9 ); ch = getchar()) ; if (ch == - ... |
/*
* 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 uint = unsigned int; using cat = long long; using dbl = long double; constexpr dbl pi = 3.14159265358979323846; using namespace std; cat pw(cat a, cat e, cat mod) { if (e <= 0) return 1; cat x = pw(a, e / 2, mod); x = x * x % mod; return (e & 1) ? x * a % mod :... |
//-------------------------------------------------------------------
//-- fsmtx_tb.v
//-- Banco de pruebas para la tranmision de datos
//-------------------------------------------------------------------
//-- BQ September 2015. Written by Juan Gonzalez (Obijuan)
//-----------------------------------------------------... |
/*
* 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() { int n, k; cin >> n >> k; deque<int> dq; map<int, int> freq; for (int i = 0; i < n; i++) { int x; cin >> x; if (freq[x] == 0) { if ((int)dq.size() < k) dq.push_front(x); else { dq.push... |
`timescale 1ns / 1ps
`include "def.v"
module Controller(clk, reset,
memdata, memaddr, ireg_d0_lsb,
instr0, instr1, current_state,
cr, pc,
pc_update_req, pc_update_addr);
//
input clk, reset;
input [31:0] memdata;
input ireg_d0_lsb;
input pc_update_req;
input [15:0] pc_update_addr;
output reg [15:0] memadd... |
#include <bits/stdc++.h> using namespace std; int ipow(int base, int exp) { int result = 1; for (;;) { if (exp & 1) result *= base; exp >>= 1; if (!exp) break; base *= base; } return result; } void show(int a[], int array_size) { for (int i = 0; i < array_size; ++i) c... |
#include <bits/stdc++.h> using namespace std; const int N = 505; const int mod = 998244353; long long n, k, ans; long long dp[N][N], dp2[N]; signed main() { cin >> n >> k; dp[0][0] = 1; for (long long i = 1; i <= n; i++) { for (long long j = 1; j <= i; j++) { for (long long l = 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... |
`timescale 1ns/100ps
module assign_test;
reg clk;
reg cat1;
reg cat2;
reg cat3;
reg cat4;
reg foo1;
reg foo2;
reg foo3;
reg foo4;
reg bar1;
reg bar2;
reg bar3;
reg bar4;
initial begin
clk = 0;
#100 $finish;
end
always begin
clk = 0;
#50;
clk... |
/*
* 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; vector<long long> vec; int main(void) { long long n1, n2, i, j, k, n, d; cin >> n >> d; for (i = 0; i < n; i++) vec.push_back(i + 1); long long Min, Max = 0, sum; do { sum = 0; for (i = 0; i < n; i++) { for (j = i; j < n; j++) {... |
#include <bits/stdc++.h> int main() { char n[101], a[4] = 127 , b[6] = 32767 , c[11] = 2147483647 , d[20] = 9223372036854775807 ; int i, l, count, mark; while (~scanf( %s , n)) { l = strlen(n); if (l < 3) { printf( byte n ); continue; } if (l ==... |
/*
CLK es el reloj de la maquina de estados con un periodo de 1ns
TRANSMIT son los 3 bits del registro TRANSMIT que indican si se ha solicitado un hard reset o cable reset
Hard_Reset_sent,Cable_Reset_sent son entradas q indican si ya se envio la solicitod de hard reset o cable reset
*/
module hardReset(output wire Sta... |
#include <bits/stdc++.h> using namespace std; int main() { int t, a, b, c, arr[5], count = 0; cin >> t; for (int i = 0; i < t; i++) { cin >> arr[0] >> arr[1] >> arr[2]; sort(arr, arr + 3); c = arr[0]; b = arr[1]; a = arr[2]; if (a > 0) { a--; count++; ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int T, n, m, u, v, sum, ans; int col[N]; bool vis[N]; int cnt, head[N]; struct edge { int next, to; } e[N << 1]; inline void add(int u, int v) { cnt++; e[cnt].next = head[u]; e[cnt].to = v; head[u] = cnt; } qu... |
module word(
input [4:0] row, col,
input [1:0] select,
output word
);
reg [19:0] data;
always @(row,col,select,data[19:0])
begin
case (select)
2'b00: case(row) // waiting to start.
5'b00000: data = 20'b00000000000000000000;
5'b00001: data = 20'b00000111111111100000;
5'b00010: data = 20'b0001100000000... |
// -*- Mode: Verilog -*-
// Filename : adxl362_system_controller.v
// Description : ADXL362 System Controller
// Author : Philip Tracton
// Created On : Thu Jun 23 20:54:55 2016
// Last Modified By: Philip Tracton
// Last Modified On: Thu Jun 23 20:54:55 2016
// Upd... |
`timescale 1 ns / 1 ps
module adc10cs022(
output wire DIG_ADC_CS,
output wire DIG_ADC_IN,
input wire DIG_ADC_OUT,
output wire DIG_ADC_SCLK,
output reg [9:0] adc_in,
input wire [2:0] adc_chan,
output reg adc_valid,
input wire adc_go,
input wire clk_3p2MHz,
input... |
/**
* 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> const int N = (int)1e5 + 7; const int MOD = (int)1e9 + 7; const long long INF = (long long)1e18; using namespace std; bool solve(vector<int> &A, int n) { for (int i = 1; i < n; i++) { if (A[i] > A[i - 1]) { return true; } } for (int i = 1; i < n; i++) {... |
#include <bits/stdc++.h> int main() { long long int a, b; double n = 1.000000011, g, h; scanf( %lld %lld , &a, &b); g = pow(n, b); h = a * g; printf( %.10lf , h); return 0; } |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 7; const int inf = INT_MAX; const long long inff = 1e18; const long long mod = 1e9 + 7; int p[30]; int n; string s; int used[40]; int Find(int x) { return p[x] == x ? x : p[x] = Find(p[x]); } void Union(int x, int y) { p[Find(x)]... |
#include <bits/stdc++.h> template <class T> inline void read(T &res) { char ch; while (ch = getchar(), !isdigit(ch)) ; res = ch ^ 48; while (ch = getchar(), isdigit(ch)) res = res * 10 + ch - 48; } template <class T> inline void put(T x) { if (x > 9) put(x / 10); putchar(x % 10 +... |
/**
* 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 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... |
// Accellera Standard V2.5 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2010. All rights reserved.
`ifdef OVL_XCHECK_OFF
//Do nothing
`else
`ifdef OVL_IMPLICIT_XCHECK_OFF
//Do nothing
`else
wire valid_sample_event;
wire valid_state_expr;
wire valid_check_value;
assign valid_sa... |
#include <bits/stdc++.h> using namespace std; using LL = long long; constexpr int maxn = 100; int a[maxn]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int t; for (cin >> t; t; t -= 1) { int n, x, am = 0, ok = 0; cin >> n >> x; for (int a... |
#include <bits/stdc++.h> using namespace std; int arr[15], cnt[7] = {0}, ans = 0; int j, hr = 0, mi = 0; int se[100] = {0}; vector<int> na, ma; void rec(int pos, int a) { int i; if (pos == -1) { ans++; return; } if (pos == mi - 1) { for (i = 0; i <= na[pos]; i++) { ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MOD = 1e9 + 7, N = 1e5 + 10; const ll MX = 1e8; int32_t main() { ios::sync_with_stdio(false); cin.tie(NULL); string s; cin >> s; ll ans = 0; for (ll i = 0; i < MX; i += 25) { string k = to_string(i); ... |
#include <bits/stdc++.h> using namespace std; void solve() { long long N, K; string X; cin >> N >> K; cin >> X; string foo = X; for (long long i = 0; i + K < foo.size(); i++) { foo[i + K] = foo[i]; } if (foo >= X) { cout << foo.size() << endl; cout << foo << 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 law... |
#include <bits/stdc++.h> using namespace std; int main() { std::ios_base::sync_with_stdio(false); long long n, h, a, b, k; cin >> n >> k >> a >> b >> k; while (k--) { long long tower1, tower2, source, destination; cin >> tower1 >> source >> tower2 >> destination; long long ans = 0;... |
/// date:2016/3/9
/// engineer: ZhaiShaoMin
module i_m_areg(//input
clk,
rst,
i_flits_m,
v_i_flits_m,
mem_done_access,
//output
i_m_areg_flits,
v_i_areg_m_flits
... |
#include <bits/stdc++.h> using namespace std; const int MAX = 1e6 + 5; struct T { int l, r, i; bool operator<(T const& other) { return (l == other.l ? r < other.r : l < other.l); } }; int con[MAX][2]; pair<int, int> num[2 * MAX]; int main() { ios_base::sync_with_stdio(false); cin... |
#include <bits/stdc++.h> using namespace std; int gcd(int f, int s) { if (s == 0) return f; else return gcd(s, f % s); } int const N = 1000006; long long const M = 1020; long double const ep = .000000000000000001; long long arr[N], arr1[N]; int main() { int n, m; scanf( %d , ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b, x, y; cin >> a >> b >> x >> y; if (a == x || b == y) { cout << abs(x - a) + abs(b - y) << n ; goto v; } else cout << abs(a - x) + abs(b - y) + 2 << n ; ... |
#include <bits/stdc++.h> using namespace std; const int N = 5005; int gcd[N]; int GCD(int a, int b) { return b ? GCD(b, a % b) : a; } vector<int> primes; void Calc() { for (int i = 2; i * i <= 1000000000; i++) { bool is_prime = true; for (int p : primes) { if (p * p > i) { ... |
// 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 : Wed Mar 01 09:52:03 2017
// Host : GILAMONSTER running 64-bit major release (... |
/**
* 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 = 0, k = 0; bool ip[100010][32]; int main() { n = 0, k = 0; cin >> n >> k; for (int i = 0; i < n; i++) { int a = 0, b = 0, c = 0, d = 0; scanf( %d.%d.%d.%d , &a, &b, &c, &d); int l = 31; while (d) { ip[i][l--] = d % ... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2015.1
// Copyright (C) 2015 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1ns/1ps
modul... |
/********************************************************************
* TEST BENCH FOR PROTECTION CELLS *
********************************************************************
* Laboratory : Robotics and Embedded System Technology
* Engineer : Hanjara Cahya Adhyatma
* C... |
// $Id: c_lfsr.v 5188 2012-08-30 00:31:31Z dub $
/*
Copyright (c) 2007-2012, Trustees of The Leland Stanford Junior University
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of so... |
/*
* 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() { int n; cin >> n; long long int p = 1; for (int i = 0; i < 5; i++) { p *= n - i; } cout << p * (p / 120); return 0; } |
// Library - static, Cell - th34w3, View - schematic
// LAST TIME SAVED: May 23 17:03:47 2014
// NETLIST TIME: May 23 17:04:07 2014
`timescale 1ns / 1ns
module th34w3 ( y, a, b, c, d );
output y;
input a, b, c, d;
specify
specparam CDS_LIBNAME = "static";
specparam CDS_CELLNAME = "th34w3";
specpar... |
#include <bits/stdc++.h> using namespace std; bool comp(int a, int b) { return (a < b); } int max(int a, int b) { if (a > b) return a; return b; } int min(int a, int b) { if (a < b) return a; return b; } long long power(long long a, int x) { while (x--) { a *= a; } return... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; using ll = long long; using ull = unsigned long long; using db = double; using ld = long double; template <type... |
/*
* Copyright (c) 2013, Quan Nguyen
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditi... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_ed_e
//
// Generated
// by: wig
// on: Mon Apr 10 13:26:55 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../bitsplice.xls
//
// !!! Do not edit this file! Autogenerated by MIX ... |
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; while (q--) { map<char, long long int> d; string p; int n, m; cin >> n >> m; cin >> p; vector<map<char, long long int>> x(n + 2); for (int i = 0; i < n; i++) { x[i][p[i]]++; ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 02:23:31 03/06/2017
// Design Name: NOR
// Module Name: D:/Projects/XilinxISE/HW1/Homework1/testNOR.v
// Project Name: Homework1
// Target Device:
// Tool versions... |
/*******************************************************************************
* 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 with non-Xilinx ... |
#include <bits/stdc++.h> using namespace std; const int INF = 2147483647; const int N = 200005; int vis[N], tab[N], i, a, b, sum, n, m, vis0[N], vis1[N]; vector<int> graf0[N], graf1[N]; string s; bool cyc(int w) { vis[w] = 1; for (auto& w2 : graf0[w]) if (vis[w2] == 1) return true; ... |
// -*- Mode: Verilog -*-
// Filename : ram_axi4_lite.v
// Description : Simple RAM with AXI4 Lite Interface
// Author : Philip Tracton
// Created On : Fri Nov 25 22:12:00 2016
// Last Modified By: Philip Tracton
// Last Modified On: Fri Nov 25 22:12:00 2016
// Updat... |
/*
Copyright 2018 Nuclei System Technology, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except i... |
/*
* Sequencer controller for VGA
* Copyright (C) 2010 Zeus Gomez Marmolejo <>
*
* VGA FML support
* Copyright (C) 2013 Charley Picker <>
*
* This file is part of the Zet processor. This processor is free
* hardware; you can redistribute it and/or modify it under the terms of
* the GNU General... |
#include <bits/stdc++.h> using namespace std; vector<long long int> v, v1, v2; multiset<long long int> mss; multiset<long long int>::iterator it; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long int a, b, c, d, i, j, z = 0, k, w = 1, q = 0, cnt = 0, x = 0, p = 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 la... |
#include <bits/stdc++.h> using namespace std; string s; int main() { long long n, q, x, y; cin >> n >> q; for (long long i = 1; i <= q; i++) { cin >> x >> y; if ((x + y) % 2 == 0) { if (n % 2 == 0) { long long linie = n / 2; long long first = linie * (x - 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... |
#include <bits/stdc++.h> using namespace std; const long long oo = 1e18; struct Data { long long v; int x, y; Data() {} Data(long long tv, int tx, int ty) { v = tv; x = tx; y = ty; } }; int a[2010], b[2010]; Data mp1[4000010], mp2[4000010]; long long gabs(long long x)... |
#include <bits/stdc++.h> template <class T> bool setmax(T &_a, T _b) { if (_b > _a) { _a = _b; return true; } return false; } template <class T> bool setmin(T &_a, T _b) { if (_b < _a) { _a = _b; return true; } return false; } const int N = 200010; int a[N... |
module main;
typedef struct packed {
logic [3:0] high;
logic [3:0] low;
} word;
typedef word [1:0] dword;
dword foo;
int idx;
initial begin
foo[0].low = 1;
foo[0].high = 2;
foo[1].low = 3;
foo[1].high = 4;
$display("foo = %h", foo);
if (foo !== 16'... |
#include <bits/stdc++.h> using namespace std; map<int, int> mp; int f[210000 * 4], mn[210000 * 4]; void add(int u, int L, int R, int l, int r, int k) { l = max(l, L); r = min(r, R); if (l >= r) return; if (l == L && R == r) { mn[u] += k; f[u] += k; return; } add(u * 2, ... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2010 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 Header Begin ==========================================
//
// OpenSPARC T1 Processor File: sparc_exu_ecl_cnt6.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 i... |
/*
########################################################################
EPIPHANY eMesh Arbiter
########################################################################
This block takes three FIFO inputs (write, read request, read response)
and the DMA channel, arbitrates between the active channels, and forw... |
#include <bits/stdc++.h> using namespace std; mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count()); int main() { ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); int n; cin >> n; vector<int> a(n); for (int& i : a) cin >> i; int M = *min_element((a).begin(), (a)... |
#include <bits/stdc++.h> using namespace std; int n, u, v, c, a[100005], b[100005]; vector<int> adj[100005]; int mod_pow(int a, int b) { int rtn = 1; while (b) { if (b & 1) rtn = (1ll * rtn * a) % 1000000007; a = 1ll * a * a % 1000000007; b /= 2; } return rtn; } void dfs(in... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int maxn = 3e6; const double eps = 0.00000001; long long ksm(long long a, long long n) { long long ans = 1; while (n) { if (n & 1) ans = ans * a % mod; a = a * a % mod; n >>= 1; } return ans; } i... |
#include <bits/stdc++.h> using namespace std; struct BIT { long long T[1000100]; long long ALL; BIT() { ALL = 0; } void add(int pos, long long w) { ++pos; ALL += w; for (; pos < 1000100; pos += (pos & (-pos))) T[pos] += w; } long long all_from(int pos) { long long ret... |
/**
* 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(0); cin.tie(nullptr); int n, k, left = 0, i; long long int temp; cin >> n >> k; vector<int> task(k, 0); vector<pair<int, int>> idl(n, make_pair(0, 0)); for (i = 0; i < n; i++) { cin >> temp; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); long long n, k; cin >> n >> k; long long r = max(n - 2 * k, 0LL); cout << n * (n - 1) / 2 - r * (r - 1) / 2; return 0; } |
`timescale 1ns / 1ps
/*
Group Members: Thomas Hudson and Warren Seto
Lab Name: Combinational Logic
Project Name: eng312_proj2
Design Name: dec_4_to_16.v
Design Description: Verilog Module for 4 to 16 Decoder
*/
module dec_4_to_16
(
input [3:0] ADDR,
output [15:0] DEC
);
// Every output wil... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:35:43 10/10/2015
// Design Name:
// Module Name: master_wb
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
... |
/**
* 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; constexpr int kN = int(3E2 + 10), kC = int(2E6 + 10); vector<pair<int, int>> v[kC], nv[kC]; int ans[kC], a[kN][kN], pos[kN][kN], p[kN * kN], up[kN * kN], dwn[kN * kN], lft[kN * kN], rht[kN * kN], nans[kC]; bool have[kN * kN]; int Find(int n) { return p[n] ... |
#include <bits/stdc++.h> using namespace std; struct node { bool visited; short prex; short prey; short val; node() { visited = false; } void print() { cout << visited << ( << prex << , << prey << ) << val << endl; } }; struct coord { int x, y; coord(int x, int... |
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995-2013 Xilinx, Inc. All rights reserved.
////////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor: Xilinx
// \ \ \/ Version : ... |
//****************************************************************************************************
//*----------------Copyright (c) 2016 C-L-G.FPGA1988.Roger Wang. All rights reserved------------------
//
// -- It to be define --
// -- ... |
/**
* 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> int main() { int n, m; int r = 0, a = 0, v = 0; double es = 0.0; scanf( %d%d , &n, &m); r = 2 * n; v = 5 * n; a = 8 * n; es = (double)r / m; r = r / m; if (es - r != 0.00) { r++; } es = (double)v / m; v = v / m; if (es - v != 0.00)... |
#include <bits/stdc++.h> using namespace std; int main() { int i, n, flag = 0; cin >> n; int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 1) flag = 1; } if (flag) cout << -1 << endl; else cout << 1 << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; const int N = 600010, inf = N; int n, m; int head[N], cnt = 1; struct edge { int to, next; } e[N << 1]; void adde(int a, int b) { e[++cnt].to = b; e[cnt].next = head[a]; head[a] = cnt; } int nxt[N], st[N], vis[N], top, mn, mx, in[N]; void... |
/**
* 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.