text stringlengths 59 71.4k |
|---|
`timescale 1ns / 1ns
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12/06/2013 07:10:19 PM
// Design Name:
// Module Name: main_sim
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// R... |
#include <bits/stdc++.h> using namespace std; const int N = 330, INF = 1000010000; int n, m, u, x, y, z, I, ans; int r[N], l[N], X[N], W[N], a[N], b[N], f[N], g[N][N], h[N][N]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d%d , &X[i], &W[i]); b[++m] = X[i], b[++m] =... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x, y; cin >> n >> m >> x >> y; int vis[105][105]; int i, j; for (i = 0; i < 105; i++) for (j = 0; j < 105; j++) vis[i][j] = 0; vis[x][y] = 1; cout << x << << y << endl; cout << x << << m << endl; f... |
/*
* 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... |
module adio_codec (
output oAUD_DATA,
output oAUD_LRCK,
output reg oAUD_BCK,
input key1_on,
input [1:0] iSrc_Select,
input iCLK_18_4,
input iRST_N,
input [15:0] sound1
);
parameter REF_CLK = 18432000; // 18.432 MHz
parameter SAMPLE_RATE = 48000; // 48 KHz
parameter DATA_WIDTH = 16; // 16 ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 505; const int MAXQ = 5000005; int n, m, X1[MAXQ], X2[MAXQ], Y1[MAXQ], Y2[MAXQ]; bool ans[MAXQ]; bitset<MAXN> dp1[MAXN][MAXN], dp2[MAXN][MAXN], temp; char board[MAXN][MAXN]; void dnc(int r1, int r2, vector<int> &que) { if (que.empty() ||... |
module mandlebrot(
input clk,
input [WIDTH - 1 : 0] re_i,
input [WIDTH - 1 : 0] im_i,
input [WIDTH - 1 : 0] re_c,
input [WIDTH - 1 : 0] im_c,
output [WIDTH - 1 : 0] re_o,
output [WIDTH - 1 : 0] im_o,
output escaped,
input valid_i,
output valid_o
);
paramet... |
#include <bits/stdc++.h> using namespace std; char str[105]; int main() { int n; scanf( %d , &n); scanf( %s , str); vector<int> g; int sum = 0; for (int i = 0; i < n; i++) { if (str[i] == B ) { sum++; } else { if (sum) g.push_back(sum); sum = 0; }... |
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << : << arg1 << endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, , ); ... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; int n, m; char ch[20][120]; int l[20], r[20], visit[20], dp[20][2]; int main() { while (~scanf( %d%d , &n, &m)) { memset(visit, 0, sizeof visit); memset(r, 0, sizeof r); memset(l, 0, sizeof l); for (int i =... |
//#############################################################################
//# Function: Clock synchronizer #
//#############################################################################
//# Author: Andreas Olofsson #
... |
#include <bits/stdc++.h> using namespace std; int c1; struct state { int h1, a1, h2, a2, level; int laststate; state() {} state(int a, int b, int c, int d, int e, int f) : h1(a), a1(b), h2(c), a2(d), level(e), laststate(f) {} }; int main() { ios_base::sync_with_stdio(0), cin.tie(0)... |
#include <bits/stdc++.h> using namespace std; int n, m, c[23][23], d[23], u[23]; int main() { scanf( %d%d , &n, &m); for (int xt, yt, i = 1; i <= m; ++i) { scanf( %d%d , &xt, &yt); if (c[xt][yt] || xt == yt) continue; ++d[xt], ++d[yt]; c[xt][yt] = c[yt][xt] = 1; } for (int ... |
#include <bits/stdc++.h> using namespace std; const int N = 4010; const int T = 20010; int n, p, q, c[N], h[N], t[N], cs[T], cd[T], b[T], rez[T]; int d[10010][N]; vector<int> v[T], v2[T], v3[T]; void sol(int pozs) { int pozd = min(T - 1, pozs + 2 * p), mid = pozs + p; vector<int>::iterator it; ... |
#include <bits/stdc++.h> using namespace std; template <class T> T sq(T x) { return x * x; } const long long inf = 2147383647; const double pi = 2 * acos(0.0); const double eps = 1e-9; const long long maxint = 2147483647; const long long minint = -2147483648; int n, m; long long arr[100010], b... |
#include <bits/stdc++.h> using namespace std; bool changed[222222]; pair<int, int> edges[222222]; set<pair<int, int> > adj[111111]; bool visited[111111]; deque<pair<int, int> > to_connect; vector<int> Harry; char outbuf[12000000]; char* out = outbuf; int moves = 0; void flush_harry() { out += ... |
#include <bits/stdc++.h> using namespace std; const long long N = 3e5 + 5; vector<long long> adj[N]; vector<pair<long long, long long> > lol[N]; long long x[N], y[N], z[N], vis[N], tin[N], low[N], bridge[N], comp[N], artificat[N], depth[N], par[N], path[N], timer, cur; void dfs1(long long node, long l... |
#include <bits/stdc++.h> using namespace std; const int N = 6e6 + 500; int pt[N << 1], tn, m; pair<int, pair<int, int> > seg1[N], seg2[N]; int n1, n2; int getdep(const pair<int, int> &u) { return u.first + u.second; } int lowbit(const int &x) { if (!x) return 1 << 30; return x & -x; } pair<int... |
#include <bits/stdc++.h> using namespace std; long long n, i, j, k, l, sum = 0, flag = 0, t, a[200005], ans = 0; vector<int> tree[800005]; void build(int node, int low, int high) { if (low == high) { tree[node].push_back(a[low]); return; } int mid = (low + high) / 2; build(2 * node, ... |
/*
* Copyright (c) 2000 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)
* ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2004 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
reg [255:0] a;
reg [60:0] diviso... |
//======================================================================
//
// sha1.v
// ------
// Top level wrapper for the SHA-1 hash function providing
// a simple memory like interface with 32 bit data access.
//
//
// Author: Joachim Strombergson
// Copyright (c) 2013 Secworks Sweden AB
//
// Redistribution and u... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2008 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
reg [63:0] crc;
... |
#include <bits/stdc++.h> const int N = 1e5 + 2, p = 1e9 + 7; int siz[N], f[N]; int n, m, x, y, z, i, c; inline void read(int &x) { c = getchar(); while ((c < 48) || (c > 57)) c = getchar(); x = c ^ 48; c = getchar(); while ((c >= 48) && (c <= 57)) { x = x * 10 + (c ^ 48); c = get... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long inf = 0x3f3f3f3f3f3f3f3f; const int maxn = 1005; int main() { int N; cin >> N; cout << 2 * N - 1 << << 2 << endl; cout << 1 << << 2 << 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 la... |
`timescale 1 ns / 100 ps
`include "sm_cpu.vh"
module sm_testbench;
// simulation options
parameter Tt = 20;
parameter Ncycle = 120;
reg clk;
reg rst_n;
reg [ 4:0] regAddr;
wire [31:0] regData;
// ***** DUT start ************************
//instruction memor... |
#include <bits/stdc++.h> using namespace std; bool essentiallyEqual(float a, float b) { return fabs(a - b) <= ((fabs(a) > fabs(b) ? fabs(b) : fabs(a)) * 1e-6); } struct TVector { long long x, y; TVector operator+(TVector q) const { return {x + q.x, y + q.y}; } TVector operator-(TVector q) const ... |
#include <bits/stdc++.h> using namespace std; void readi(int &x) { int v = 0, f = 1; char c = getchar(); while (!isdigit(c) && c != - ) c = getchar(); if (c == - ) f = -1; else v = v * 10 + c - 0 ; while (isdigit(c = getchar())) v = v * 10 + c - 0 ; x = v * f; } void ... |
#include <bits/stdc++.h> using namespace std; const int INF = (int)2e9; const long long INFL = (long long)9e18; const int MAXINT = ((~0) ^ (1 << 31)); const long long MAXLL = ((~0) ^ ((long long)1 << 63)); template <class T> inline T pow2(T a) { return a * a; } template <class T> inline bool min... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 1e6 + 5; long long n, m, i, t, j, k, l, x, y, z, s, e, p, q; long long dg(long long s, long long e) { if (e % 2) return 1 - s % 2; if (s > e / 2) return s % 2; if (s > e / 4) return 1; return dg(s, e / 4); } int main() { ... |
/*
Copyright 2018 Nuclei System Technology, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except i... |
module io1_sub(
/*AUTOARG*/
// Outputs
sec_out, lower_out,
// Inouts
sec_io, lower_io,
// Inputs
sec_ina, lower_ina
);
/*AUTOINPUT*/
// Beginning of automatic inputs (from unused autoinst inputs)
input lower_ina; // To instio of instio.v
inp... |
#include <bits/stdc++.h> using namespace std; int Max = INT_MIN, Min = INT_MAX; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; int n, m, mx = 0; cin >> n >> m; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 0; i < n - 1; i++) { ... |
#include <bits/stdc++.h> using namespace std; char s[200]; vector<pair<int, int> > v; int main() { scanf( %s , s); int len = strlen(s); pair<int, int> cur(0, 0); v.push_back(cur); for (int i = 0; i < len; i++) { if (s[i] == L ) { cur.first--; } else if (s[i] == R ) { ... |
// 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 : Tue May 30 22:30:26 2017
// Host : GILAMONSTER running 64-bit major release (... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2004 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc; initial cyc=1;
reg [255... |
module ram0(
// Read port
input rdclk,
input [8:0] rdaddr,
output reg [63:0] do);
(* ram_style = "block" *) reg [63:0] ram[0:511];
genvar i;
generate
for (i=0; i<512; i=i+1)
begin
initial begin
ram[i] <= i | i << 16 | i << 32 | i << 48;
... |
#include <bits/stdc++.h> using std::sort; struct Edge { int v, w, next; } e[200002]; int ecnt, h[100002]; inline void add_edge(int u, int v, int w) { e[++ecnt] = {v, w, h[u]}; h[u] = ecnt; e[++ecnt] = {u, w, h[v]}; h[v] = ecnt; } int size[100002], dis1[100002], dis2[100002], dp[100002]... |
#include <bits/stdc++.h> template <class T> T abs(T x) { return (x > 0) ? x : (-x); } template <class T> T ceil(T a, T b) { return a / b + (a % b != 0); } int n, t[125][5], cnt[5], l, r, mid; int a[6] = {1, 2, 4, 8, 16, 32}; std::set<int> s; int score(int x, int y) { int s = y / x, i; ... |
#include <bits/stdc++.h> using namespace std; #pragma comment(linker, /STACK:64000000 ) template <class T> inline T sqr(T x) { return x * x; } int n, k; int a[1 << 17]; map<int, int> d; set<pair<int, int> > s; int main() { scanf( %d%d , &n, &k); for (int i = 0; i < n; ++i) scanf( %d , &... |
#include <bits/stdc++.h> using namespace std; template <typename T> class fenwick_tree { private: int n; vector<T> fenw; public: fenwick_tree(int _n) : n(_n) { fenw.resize(n); } size_t size() { return n; } void update(int x, T val) { while (x < n) { fenw[x] += val; ... |
`include "MU/Register.v" //`
module Register32(Bus_out,clk,reset,R_in,R_out,Bus_in);
input [31:0] Bus_in;
input clk,reset;
input R_in;
input R_out;
output [31:0] Bus_out;
reg [31:0] Temp_Bus_out;
Register R1(Bus_in[0],clk, reset,R_in, R_out, Bus_out[0]);
Register R2(Bus_in[1],clk, reset,R_in, R_out, Bus_out[1]);
... |
#include <bits/stdc++.h> using namespace std; int main() { int n = 0, m = 0, temp = 0; cin >> n >> m; int arr[n + 1]; fill(arr, arr + n + 1, -1); for (int i = 1; i <= m; i++) { cin >> temp; int k = temp; while (k <= n && arr[k] == -1) { arr[k] = temp; k++; ... |
#include <bits/stdc++.h> using namespace std; char a[300099]; char ans[300099]; int c[200000]; int b; int main() { while (~scanf( %s , a)) { memset(c, 0, sizeof(c)); scanf( %d , &b); int len = strlen(a); for (int i = 0; i < b; i++) { int pt; scanf( %d , &pt); ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 9e2 + 1; int n, m, g[maxn], G, o1[maxn], o2[maxn], deg[maxn]; vector<int> e[maxn], e_s[maxn], r_e_s[maxn], topo, ans, wow[maxn]; vector<pair<int, int> > edge, res; bool mark[maxn]; map<int, int> is[maxn]; void dfs(int v) { mark[v] = 1; ... |
// $File: //acds/rel/14.1/ip/sopc/components/altera_avalon_dc_fifo/altera_dcfifo_synchronizer_bundle.v $
// $Revision: #1 $
// $Date: 2014/10/06 $
// $Author: swbranch $
//-------------------------------------------------------------------------------
`timescale 1 ns / 1 ns
module altera_dcfifo_synchronizer_bun... |
module rx_sm #(
parameter STATE_IDLE = 3'h0,
parameter STATE_PREAMBLE = 3'h1,
parameter STATE_DATA = 3'h2,
parameter STATE_OK = 3'h3,
parameter STATE_DROP = 3'h4,
parameter STATE_ERROR = 3'h5,
parameter ... |
#include <bits/stdc++.h> using namespace std; int N, S, L, A[100009]; int c[100009], dp[100009]; deque<pair<int, int>> s, t, u; int main() { scanf( %d%d%d , &N, &S, &L); for (int i = 1; i <= N; i++) dp[i] = 1e6; for (int i = 1, ptr = 1; i <= N; i++) { scanf( %d , &A[i]); while (s.size(... |
/*
* 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 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 Feb 02 02:37:11 2017
// Host : TheMosass-PC running 64-bit major release ... |
#include <bits/stdc++.h> using namespace std; bool notis[30] = {false}, mayis[30] = {false}; string str; int main() { int n, flag = 0, cnt = 0, tem, i, j; char p; std::ios::sync_with_stdio(false); cin >> n; for (i = 0; i < n; i++) { cin >> p >> str; if (flag && (p == ! || 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 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; using ll = long long; using ld = long double; int main() { ios_base::sync_with_stdio(0); cin.tie(0); ; int n; cin >> n; vector<int> dem(1000); int maxx = INT_MIN; for (int i = 0; i < n; ++i) { int u; cin >> u; dem[--... |
/**
* 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[101][101]; long long b[101]; int main() { int m, n; cin >> m >> n; for (int i = 0; i < m; i++) for (int j = 0; j < n; j++) cin >> a[i][j]; for (int i = 0; i < m; i++) { long long minn = 100000000000000; for (int j = 0; j... |
#include <bits/stdc++.h> using namespace std; inline const int getint() { int r = 0, k = 1; char c = getchar(); for (; c < 0 || c > 9 ; c = getchar()) if (c == - ) k = -1; for (; c >= 0 && c <= 9 ; c = getchar()) r = r * 10 + c - 0 ; return k * r; } long long ans, a1, b1, a2, b... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; void solve() { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); for (auto i : a) { cout << i << ; } } int main() { ios_base::sync_with_stdio(false); ... |
// ==============================================================
// RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2018.2
// Copyright (C) 1986-2018 Xilinx, Inc. All Rights Reserved.
//
// ===========================================================
`timescale 1 ns /... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 1; const int MOD = 1e9 + 7; class Problem { public: int N, Q, t, k, d; char ch; string S; void solve(std::istream& input, std::ostream& output); }; void Problem::solve(std::istream& input, std::ostream& output) { inp... |
/*
* 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... |
`define OVL_ASSERT_ON
`define OVL_INIT_MSG
`include "assert_always.vlib"
module four_phase_assertion(/*AUTOARG*/
// Inputs
req, ack, rstn
);
input req;
input ack;
input rstn;
assert_always #(
`OVL_ERROR , // severity_level
`OVL_ASSERT , // prope... |
#include <bits/stdc++.h> using namespace std; int a, b, maxa; void use_battery(int s) { if (s == 1) a = min(a + 1, maxa); --b; } void use_accum() { --a; } int main() { int ans = 0; int n; cin >> n >> b >> a; maxa = a; vector<int> s(n); for (int i = 0; i < n; i++) cin >> s[i];... |
#include <bits/stdc++.h> using namespace std; double tick() { static clock_t oldt, newt = clock(); double diff = 1.0 * (newt - oldt) / CLOCKS_PER_SEC; oldt = newt; return diff; } inline long long int read() { long long int f = 1, x = 0; char ch = getchar(); while (ch < 0 || ch > 9... |
#include <bits/stdc++.h> using namespace std; int a[101]; int main() { bool f = false; int n, counter = 1; long long ans = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0 && f) counter++; if (a[i] == 1 && !f) f = true, ans = 1; else if (a[i... |
#include <bits/stdc++.h> using namespace std; long long n, m, c, p, y, k, x, h, t, q; string s; vector<long long> v; map<long long, long long> ma; void input() {} struct node { map<string, node*> child; map<string, long long> ispresent; string name; bool isfile = 0; }; pair<long long, ... |
#include <bits/stdc++.h> using namespace std; long long arr[200005]; long long n; map<long long, long long> ans; bool debug = false; long long rec(long long node) { if (debug) cout << entering << node << endl; if (node == 1) return 1000000000000; if (node <= 0 || node > n) return 0; 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... |
#include <bits/stdc++.h> using namespace std; class Solution { public: void solve(std::istream& in, std::ostream& out) { int T; in >> T; for (int _t = 0; _t < (int)(T); ++_t) { int n, s, t; in >> n >> s >> t; int res = n - min(s, t) + 1; out << res << endl; ... |
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn=200010; int a[maxn],f[maxn]; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int t,n; cin>>t; while(t--){ memset(f,0,sizeof(f)); cin>>n; for(int i=0;i<n;i++)... |
#include <bits/stdc++.h> using namespace std; int main() { cout << fixed; double d, L, v1, v2; cin >> d >> L >> v1 >> v2; cout << setprecision(8) << (L - d) / (v1 + v2) << endl; } |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2017 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
reg [63:0] c... |
module RegisterFile(Read1, Read2, Writedata, Raddr1, Raddr2, Waddr, RegWr, CLK, RESET);
output [31:0] Read1;
output [31:0] Read2;
input [31:0] Writedata;
input [4:0] Raddr1, Raddr2, Waddr;
input RegWr, CLK, RESET;
reg [31:0] registers [0:31];
always @(posedge RESET)
begin
registers[0]=0;
... |
// ZX-Evo Base Configuration (c) NedoPC 2008,2009,2010,2011,2012,2013,2014
//
// just DOS signal control
/*
This file is part of ZX-Evo Base Configuration firmware.
ZX-Evo Base Configuration firmware is free software:
you can redistribute it and/or modify it under the terms of
the GNU General Public L... |
/*
* 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<int> adj[100010], ans; bool vis[100010]; bool c[100010]; void find(int v) { vis[v] = true; bool del = true; for (int u : adj[v]) { del &= c[u]; if (!vis[u]) find(u); } if (c[v] && del) ans.push_back(v); } int main() { ... |
// date:2016/3/16
// engineer:ZhaiShaoMin
// project:multicore ring based project
// module function: testbench for ic_download
`timescale 1ns/1ps
//`include "constants.v"
module tb_ic_download();
//inputs
reg clk;
reg rst;
reg [15:0] rep_flit_ic;
reg ... |
#include <bits/stdc++.h> long long max(long long a, long long b) { return a > b ? a : b; } long long min(long long a, long long b) { return a < b ? a : b; } void swap(long long &a, long long &b) { long long tmp = a; a = b; b = tmp; } long long lowbit(long long &x) { return x & (-x); } void read(... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.2
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1 ns / 1 ... |
/*
Copyright (C) 2013 Adapteva, Inc.
Contributed by Roman Trogan <>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.... |
#include <bits/stdc++.h> using namespace std; const int N = 105; int n, m, grid[N][N]; int val[N][N]; bool vis[105][105]; int a[105]; int b[105]; int dp[105][105]; int tot; int main() { scanf( %d%d , &n, &m); for (int i = 0; i < n; i++) scanf( %d , a + i), tot ^= a[i]; int tmp = 0; f... |
/**
* 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... |
//////////////////////////////////////////////////////////////////////////////////
// d_partial_FFM_gate_6b.v for Cosmos OpenSSD
// Copyright (c) 2015 Hanyang University ENC Lab.
// Contributed by Jinwoo Jeong <>
// Ilyong Jung <>
// Yong Ho Song <>
//
// This file is part of Cosmos OpenSS... |
/**
* 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... |
(* abc9_box, lib_whitebox *)
module \$__ICE40_CARRY_WRAPPER (
(* abc9_carry *)
output CO,
output O,
input A, B,
(* abc9_carry *)
input CI,
input I0, I3
);
parameter LUT = 0;
parameter I3_IS_CI = 0;
wire I3_OR_CI = I3_IS_CI ? CI : I3;
SB_CARRY carry (
.I0(A),
.I1(B),
.CI(CI),
.CO(CO)
);
SB_LUT4 #(
... |
#include <bits/stdc++.h> using namespace std; int main() { int n, t; cin >> t; while (t--) { cin >> n; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } int mx, x; mx = 0; for (int i = 1; i < n; i++) { if (arr[i] < arr[i - 1]) { ... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1e15; long long l, r; void Input() { cin >> l >> r; } void Solve() { if (r <= 10) { long long Res = 0; for (long long a = l; a <= r; ++a) { for (long long b = l; b <= a; ++b) Res = max(Res, a % b); } cout <... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n{0}, a{0}, m{0}, s{0}; cin >> n; for (long long int i = 1; i <= n; i++) { cin >> a; s += a; m = max(m, a); } if (s % 2 == 1 || s < 2 * m) { cout << NO ; return 0; } cout << YES ; ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long inf = 0x3f3f3f3f; const long long llinf = 1e18; const long long nax = 0; int n, m, batas; vector<pair<int, int>> shift; set<char> simpen; map<char, bool> sabi; int main() { ios_base::sync_with_stdio(0); ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; if (n == 5) { cout << 2 << << 4 << n ; } else cout << 2 << << n / 2 << n ; } 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 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 const maxn = 1e5 + 5; int ans[maxn], used[maxn]; inline int oks(vector<int> a) { for (int i = 0; i < (int)a.size(); ++i) if (a[i] == i + 1 || (a[i] & (i + 1)) == 0) return 0; return 1; } int main() { ios_base::sync_with_stdio(0); cin.ti... |
// file: clk_wiz_0.v
//
// (c) Copyright 2008 - 2013 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... |
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
(* \VV/ **************************************************************)
(* // * Th... |
module top;
lower #(1, 2, 3) dut();
endmodule
module lower;
parameter one = 1; // This should be 'sd1
parameter two = 2; // This should be 'sd2
parameter three = 0; // This should be 'sd3
parameter local1 = one - two; // This should be -'sd1
para... |
#include <bits/stdc++.h> using namespace std; using LL = long long; constexpr int maxn = 2200; LL a[maxn * 2], b[maxn * 2]; using PII = pair<int, int>; constexpr int inf = 1000000000; struct SSPA { struct Edge { int u, v, f, c; }; int n, s, t; vector<Edge> edges; vector<vector<in... |
#include <bits/stdc++.h> using namespace std; int n; const int N = 2e5; int dep[N], fa[N], cnt[N], ans; int main() { ios ::sync_with_stdio(0); cin >> n; ans = 1; for (int i = 2; i <= n; ++i) { cin >> fa[i]; dep[i] = dep[fa[i]] + 1; cnt[dep[i]] ^= 1; } for (int i = 1; ... |
#include <bits/stdc++.h> using namespace std; const int MOD = (int)1e9 + 7; const int AL = 26; const int N = (int)1e6 + 9; int powr(int n, int k) { if (k == 0) return 1; int v = powr(n, k / 2); v = (v * 1ll * v) % MOD; if (k & 1) v = (v * 1ll * n) % MOD; return v; } int cnt[AL]; int ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.