text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int N = 1E5 + 9; vector<int> g[N]; int tin[N]; int tout[N]; int sz[N]; int tt; int toys[N]; bool root[N]; void dfs(int v) { tin[v] = tt++; sz[v] = 1; for (auto i : g[v]) { dfs(i); sz[v] += sz[i]; } tout[v] = tt++; ... |
module testbench();
reg tb_clk;
reg SCK;
reg MOSI;
reg SSEL;
wire MISO;
wire [7:0] MSG;
spi_slave spi1(.CLK(tb_clk),
.SCK(SCK),
.MOSI(MOSI),
.MISO(MISO),
.SSEL(SSEL),
.MSG(MSG));
initial
begin
$dumpfile("bench.vcd");
$dumpvars(0,testbench);
$display("starting te... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_memory_sync (reset, enable, start_addr, end_addr, r_clock, ren, raddr, rdata,
w_clock, wen, waddr, wdata, fire);
parameter severit... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:51:59 09/23/2013
// Design Name:
// Module Name: Main_Module
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
/... |
#include <bits/stdc++.h> using namespace std; long double pi = 3.141592653589793238; set<long long>::iterator it; multiset<long long>::iterator itr; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ; long long t; t = 1; while (t--) { long long n; cin >> n; ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; void qr(int &x) { scanf( %d , &x); } int n, sz[N], f[N], root, c[N]; long long k, mn, mx; struct edge { int y, next; } a[N * 2]; int len, last[N]; void ins(int x, int y) { a[++len] = (edge){y, last[x]}; last[x] = len; ... |
`timescale 1ns / 1ps
module mux_32to1_2b_tb;
// Inputs
reg [63:0] data_in;
reg [4:0] ctrl_sel;
// Outputs
wire [1:0] data_out;
// Variables
integer i = 0;
// Instantiate the Unit Under Test (UUT)
mux_32to1_2b uut (
.data_in(data_in),
.ctrl_sel(ctrl_sel),
.data_out(data_out)
);... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; long long powmod(long long a, long long b) { long long res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1) res = res * a % mod; a = a * a % mod; } return res; } int getid(string s... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e9 + 1; int a[201][201]; int cnt[10][10]; int calc(int x, int y) { if (x * 2 > y) return 500; else if (x * 4 > y) return 1000; else if (x * 8 > y) return 1500; else if (x * 16 > y) return 2000; else if ... |
#include <bits/stdc++.h> using namespace std; vector<int> g[500000]; bool visited[500000]; int n; unordered_map<int, int> m, p; vector<pair<int, int> > v; void check(int u) { visited[u] = true; for (auto v : g[u]) { if (!visited[v]) check(v); } } int main() { cin >> n; set<in... |
/*
Copyright (c) 2015-2018 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... |
#include <bits/stdc++.h> using namespace std; const long long N = 30000; long long t, n, a[N], l, r; bool possible() { if (l > r) return 1; long long o = a[l - 1]; a[l - 1] = 0; for (long long i = l; i <= r; i++) { long long v = max(a[i - 1], a[i] - o); if (v > a[r + 1]) return 0; ... |
(* -*- coding: utf-8 -*- *)
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *)
(* \VV/ ********************************************************... |
/**
* 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; bool secdes(const pair<long long, long long>& a, const pair<long long, long long>& b) { if (a.second == b.second) { return a.first > b.first; } else { return a.second > b.second; } } signed main() { ios::sync_with_stdio(fals... |
// (C) 2001-2015 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... |
(************************************************************************)
(* * The Coq Proof Assistant / The Coq Development Team *)
(* v * Copyright INRIA, CNRS and contributors *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(* \VV/ *********... |
/*****************************************************************************
* File : processing_system7_bfm_v2_0_reg_map.v
*
* Date : 2012-11
*
* Description : Controller for Register Map Memory
*
*****************************************************************************/
/*** WA for CR # 695818 ***/
`ifde... |
#include <bits/stdc++.h> using namespace std; int main() { int p[3500]; int n; cin >> n; bool b = 1; int j = 1; for (int i = 1; i <= n; i++) { cin >> p[i]; } sort(p + 1, p + n + 1); for (int i = 1; i <= n; i++) { if (p[i] != j) { cout << j; return 0; ... |
`timescale 1ns / 1ps
module AssembledLogicAnalyzer(input CLK, input RXD_START, input [7:0] RXD, input TXD_DONE, input [15:0] DATA_IN, output TXD_ENABLE,
output [15:0] TXD);
wire RST, WE;
wire [9:0] ADDR;
wire [15:0] RAM_DATA;
wire [15:0] DATA;
wire [9:0] READ_ADDR;
wire SEL;
wire [31:0] TRIG_DATA;
wire TRI... |
#include <bits/stdc++.h> using namespace std; long long max(long long a, long long b) { if (a > b) return a; else return b; } long long min(long long a, long long b) { if (a < b) return a; else return b; } int32_t main() { ios_base::sync_with_stdio(false), cin.tie... |
// Copyright 2006, 2007 Dennis van Weeren
//
// This file is part of Minimig
//
// Minimig 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 ve... |
#include <bits/stdc++.h> using namespace std; int n, k; long long a[300100], sum[300100]; int main() { scanf( %d%d , &n, &k); for (int i = 0; i < n; i++) scanf( %lld , &a[i]); for (int i = n - 1; i >= 0; i--) sum[i] = sum[i + 1] + a[i]; long long ans = sum[0]; sort(sum + 1, sum + n); for... |
/**
* 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 Header Begin ==========================================
//
// OpenSPARC T1 Processor File: dram_l2_buf2.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 and/... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f, MOD = 1e9 + 7; const int n_ = 1e5 + 1000; const long double PI = acos(-1.0); long long gcd(long long a, long long b) { return (a ? gcd(b % a, a) : b); } long long power(long long a, long long n) { long long p = 1; while (n > 0... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; void _print(long long int t) { cerr << t; } void _print(int t) { cerr << t; } void _print(string t) { cerr << t; } void _print(char t) { cerr << t; } void _print(long double t) { cerr << t; } void _print(double t) { cerr << t; }... |
`include "datapath/alu.v"
`include "datapath/comp.v"
`include "datapath/CoProcessor0RF.v"
`include "datapath/dm.v"
`include "datapath/ext.v"
`include "datapath/im.v"
`include "datapath/mux.v"
`include "datapath/npc.v"
`include "datapath/pc.v"
`include "datapath/rf.v"
`include "control/ctrl.v"
module mips (clk, rst);
... |
#include <bits/stdc++.h> using namespace std; int nbPairs[5001][5001]; const int MOD = 1e9 + 7; int main() { char s[5001], t[5001]; scanf( %s%s , &s, &t); int ss = strlen(s), st = strlen(t); for (int is = ss - 1; is >= 0; is--) for (int it = st - 1; it >= 0; it--) { if (s[is] == t[... |
#include <bits/stdc++.h> using namespace std; void reverseQueue(queue<long long int>& q) { if (q.empty()) return; long long int data = q.front(); q.pop(); reverseQueue(q); q.push(data); } int main() { ios_base::sync_with_stdio(0); int n, k; cin >> n >> k; vector<long long int... |
/**
* 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 MAXN = 300010; vector<long long> arr[MAXN]; vector<pair<long long, long long>> holdqs[MAXN]; bool visited[MAXN]; long long answer[MAXN]; long long temp[MAXN]; long long n; void dfs(long long curr, long long par, long long level, long long a... |
/*
* MBus Copyright 2015 Regents of the University of Michigan
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12:06:28 09/07/2015
// Design Name:
// Module Name: Ninth_Phase_M
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies: ... |
`timescale 1ns / 1ps
module text_editor_keyboard_controller(
input sys_Clk,
input PS2_Clk,
input Reset,
inout PS2KeyboardData,
inout PS2KeyboardClk,
output reg [7:0] KeyData,
output reg KeyReleased
);
/************************************************************************
* ... |
/**
* 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, m; int ans[100100]; struct by { int l, r, id, i, num; } a[100100 * 2]; bool cmp(by a, by b) { if (a.r != b.r) return a.r < b.r; return a.id < b.id; } struct byy { int i, l; byy() {} byy(int i, int l) : i(i), l(l) {} bool op... |
#include<bits/stdc++.h> using namespace std; int main() { int n,i,j,cnt,ara2[20000],m; string ss; cin>>m; for(i=0;i<m;i++) { cin>>n; cin>>ss; if((ss[0]== 2 )&&(ss[n-1]== 0 )&&(ss[n-2]== 2 )&&(ss[n-3]== 0 )) { cout<< Yes <<endl; } el... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; map<int, int> A; for (int i = 0; i < n; i++) { int x; cin >> x; A[x]++; } int mx = 0; for (auto x : A) { if (x.second > mx) mx = x.second; } cout << mx; } |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2017 by Wilson Snyder.
module t (/*AUTOARG*/);
reg [5:0] addr;
parameter BANKS = 6;
parameter ROWS = 8;
wire [2:0] bank;
wire [2:0] row;
integer a;
integer ... |
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int N = 2100; int a[N][N], b[N][N], d[N][N]; int c[N], n, tag = -1, res[N]; void print() { cout << -1; exit(0); } int cnt = 0; void solve(int id, int T) { if (T) { for (int i = 1; i <= n; i++) { i... |
#include <bits/stdc++.h> using namespace std; signed main() { string s; cin >> s; long long n = s.size(); long long sum = 0; for (long long i = 0; i < n; i++) { sum += s[i] - 0 ; } string a = s; for (long long i = n - 2; i >= 0; i--) { if (s[i] != 0 ) { string p... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; string s; cin >> s; int mark = 1; for (int i = 1; i < s.size(); i++) { if (s[i] != s[i - 1]) { mark = -1; break; } } if (mark == 1) { cout << s; for (int i = 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; char _buf[100000], *_op(_buf), *_ed(_buf); inline int getint() { int _s = 0, _f = 1; char _ch = (_op == _ed && (_ed = (_op = _buf) + fread(_buf, 1, 100000, stdin), _op == _ed) ? EOF : *_op+... |
#include <bits/stdc++.h> const int MAX = 1000010; const long long MOD = 1e9 + 7; const int INF = 0x3f3f3f3f; const long long LLINF = 0x3f3f3f3f3f3f3f3f; const long double EPS = 1e-6; const long double PI = acos(-1.0); using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NU... |
#include <bits/stdc++.h> using namespace std; int n, m, t, x, y, ed, pt, bcc, done, cnt, cycl; int qd[400005], qn[400005], l[400005], v[400005], w[400005], vv[400005], d[400005], AP[400005], p[400005], vis[400005]; int col[400005], par[400005], L[400005], C[400005], cc[400005], vc[400005], pp[400005... |
#include <bits/stdc++.h> using namespace std; struct node { int a; string type; node() {} node(int x, const char *s) { a = x; type = s; } }; map<string, node> h; char str[100]; int main() { int n; scanf( %d , &n); char a[100], b[100]; int x, y; h[ 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... |
/*
* 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 2009 - 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
/... |
#include <bits/stdc++.h> using namespace std; int main() { int W, H; while (cin >> W >> H) { vector<pair<int, int>> pset; for (int dy = 0; dy < (int)(2); ++dy) for (int dx = 0; dx < (int)(2); ++dx) { if (dx <= W && dy <= H) pset.push_back(pair<int, int>(dx, dy)); } ... |
/*
* Copyright 2012, Homer Hsing <>
*
* 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... |
// 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:25 2017
// Host : TheMosass-PC running 64-bit major release ... |
// opedTop.v - Top Level Verilog wrapper for NETFPGA10G "OPED" component
// Copyright (c) 2010 Atomic Rules LLC, ALL RIGHTS RESERVED
// 2010-10-31 ssiegel Creation with WCI::AXI only
// 2010-11-02 ssiegel Made debug a 32b vector
// 2010-11-22 ssiegel Minor noodling
module opedTop(
// Outward-Facing Direct Connecti... |
// (c) Copyright 1995-2017 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 license and does not grant ... |
#include <bits/stdc++.h> using namespace std; int main() { stringstream ss; string x, s1, s2, s3; long long int a1 = 0, a2 = 0, a3 = 0, sum = -1, q = 0; cin >> x; int z = x.size(); for (int i = 1; i < (z - 1); i++) { for (int j = 1; j < (z - i); j++) { q = 0; stringstre... |
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; long long dp[511][511]; long long tol[511]; int main() { int n, k, i, j, p; scanf( %d%d , &n, &k); for (i = 1; i <= n; ++i) dp[0][i] = 1; for (i = 1; i <= n; ++i) { for (j = 1; j <= n; ++j) { for (p = max(i ... |
#include <bits/stdc++.h> using namespace std; bitset<4096> f[100020]; int a[13][100005], b[100005][13], now; bool cmp(int x, int y) { return a[x][now] == a[y][now] ? x > y : a[x][now] > a[y][now]; } int main() { int n, q, k, cnt, op, x, y; scanf( %d%d%d , &n, &k, &q); cnt = k; for (int 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... |
#include <bits/stdc++.h> using namespace std; vector<int> status(26); vector<vector<int> > adjList(200000); vector<string> names(100); vector<int> ts; vector<int> processing(26); void dfs(int u, bool &valid) { status[u] = 1; processing[u] = true; for (int j = 0; j < adjList[u].size(); j++) { ... |
#include <bits/stdc++.h> using namespace std; long long C[4003 + 2][4003 + 2]; void pascal() { for (int i = 0; i < 4003; ++i) C[i][i] = C[i][0] = 1; for (int i = 2; i < 4003; ++i) { for (int j = 1; j < i; ++j) C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % 1000000007LL; } } long long pd... |
module ghrd_10m50da_top (
//Clock and Reset
input wire clk_50,
//input wire clk_ddr3_100_p,
input wire fpga_reset_n,
//QSPI
output wire qspi_clk,
inout wire[3:0] qspi_io,
output wire qspi_csn,
//ddr3
//output wire [13:0] mem_a,
//output wire [2:0] mem_ba,
... |
/**
* 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; struct inf { long long t, w; }; struct djk { long long n, v; bool operator>(const djk &i) const { return v < i.v; } bool operator<(const djk &i) const { return v > i.v; } } n; struct edge { long long n1, n2, t; bool operator<(const edge &... |
#include <bits/stdc++.h> using namespace std; char a[20][20], ans[20]; int n, m; bool isValid() { for (int i = 2; i <= n; i++) { int c = 0; for (int j = 1; j <= m; j++) c += (ans[j] != a[i][j]); if (c > 1) return false; } return true; } void fun() { cin >> n >> m; for (... |
/**
* 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 gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } const int MAXN = 1000000; int n; char s[MAXN + 1]; int pac[MAXN], npac; int ast[MAXN], nast; int prvpac[MAXN], prvast[MAXN]; int mxpos[MAXN]; bool canrgt[MAXN]; int calcmxpo... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-10; int n, m, Q, a[300006][2], fa[300006], dep[300006], siz[300006], b[300006], D; bool vis[300006]; map<int, int> mp[300006]; vector<int> v[300006], s[300006]; const double pi = acos(-1.0); void df5(int te, int la) { vis[te] = 1; ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; template <typename... T> void rd(T&... args) { ((cin >> args), ...); } template <typename... T> void wr(T... args) { ((cout << args << ), ...); cout << endl; } int main() { ios::sync_wi... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Mon Jun 05 01:41:24 2017
// Host : GILAMONSTER running 64-bit major release (... |
`include "defs.v"
// Bundling CPU and ICache together
module toycpu(
input clk, // clock
input rst, // reset
// Memory bus
input [31:0] bus_data_in, // bus data in
input bus_data_in_ready, // bus data ready
in... |
// (C) 1992-2015 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 simulati... |
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { string p, h; int w = 0; cin >> p >> h; sort(p.begin(), p.end()); if (h.size() >= p.size()) { for (int i = 0; i < (h.size() - p.size() + 1); i++) { string sub = ... |
#include <bits/stdc++.h> int n, k, pos[1000005]; char s[1000005]; struct ac_automaton { int ch[1000005][26], fail[1000005], arr[1000005], cnt[1000005], totc; int fir[1000005], nxt[1000005], to[1000005], tot, in[1000005], out[1000005], block; void line(int x, int y) { nxt[++tot] = fir[x];... |
#include <bits/stdc++.h> using namespace std; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long x) { cerr << x; } void __prin... |
// DESCRIPTION: Verilator: Test generate index usage.
//
// The code illustrates a problem in Verilator's handling of constant
// expressions inside generate indexes.
//
// This is a regression test against issue 517.
//
// **If you do not wish for your code to be released to the public
// please note it here, otherwis... |
/*
* 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> int dx[] = {-1, -1, -1, 0, 0, 0, 1, 1, 1}; int dy[] = {-1, 0, 1, -1, 0, 1, -1, 0, 1}; using namespace std; void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } long long to_int(string s) { long long ans = 0; for (int i = 0; i < s.size(... |
#include <bits/stdc++.h> using namespace std; const int M = 1000100; struct node { int w, flag; int a, b; int id; long long num; } a[M]; int n, pos[M], m, s[M]; bool cmp(const node &x, const node &y) { if (x.w == y.w) return x.flag > y.flag; return x.w < y.w; } int fa[M]; bool ... |
#include <bits/stdc++.h> using namespace std; struct _ { _() { ios_base::sync_with_stdio(0); } } _; template <class A, class B> ostream &operator<<(ostream &o, pair<A, B> t) { o << ( << t.first << , << t.second << ) ; return o; } template <class T> string tostring(T first, int len = 0,... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, a; cin >> n >> m; a = n % m; for (int i = 1; i <= m; i++) { if (a > 0) { cout << n / m + 1 << ; a--; } else { cout << n / m << ; } } } |
// ==============================================================
// 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 1 ns / 1 ps
m... |
#include <bits/stdc++.h> using namespace std; priority_queue<long long> Q[3]; int K[4], T[5]; int n; void gao() { int i, j; for (i = 0; i < 3; ++i) { for (j = 0; j < K[i]; ++j) Q[i].push(-1); } long long ans = 0; while (n--) { int ti; scanf( %d , &ti); long long now... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2015; const int inf = 1 << 29; int n, h, a[maxn], l[maxn], r[maxn]; double p, dp[maxn][maxn][2][2]; int main() { cin >> n >> h >> p; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); for (int i = 0; i < n; i+... |
// Copyright (C) 2020-2021 The SymbiFlow Authors.
//
// Use of this source code is governed by a ISC-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/ISC
//
// SPDX-License-Identifier:ISC
module top (
input clk,
output [3:0] led,
inout out_a,
output [1:0]... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_ba
//
// Generated
// by: wig
// on: Tue Jun 27 05:12:12 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../verilog.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Author: w... |
#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, , ); ... |
// DEFINES
`define BITS 8 // Bit width of the operands
`define B2TS 16 // Bit width of the operands
module bm_functional_test(clock,
reset_n,
a_in,
b_in,
c_in,
d_in,
e_in,
f_in,
out0,
out1,
counter
);
// SIGNAL DECLARATIONS
input clock;
input reset_n;
input [`BITS-1:0] 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 law... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count()); const double PI = 2 * acos(0.0); const string DIGITS = 0123456789 ; const string ALPH = abcdefghijklmnopqrstuvwxyz ;... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; char arr1[n][m]; char arr2[m][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { char a; cin >> a; arr1[i][j] = a; arr2[j][i] = a; } } string ans =... |
#include <bits/stdc++.h> using namespace std; bool endline = false; template <class T> istream& operator>>(istream& inp, vector<T>& v) { for (auto& it : v) inp >> it; return inp; } template <class T> ostream& operator<<(ostream& out, vector<T>& v) { for (auto& it : v) out << it << (endline ? ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e5 + 5; int N, M, K; int A[MAXN]; long long P, H; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> N; for (int i = 1; i <= N; i++) { cin >> P; A[i] = A[i - 1] + __builtin_popcountll(P); ... |
#include <bits/stdc++.h> bool V[11][11]; int T[11][11]; int R = 0, C = 0, N = 0, K = 0, t1 = 0, t2 = 0; int W = 0; int main() { scanf( %d%d%d%d , &R, &C, &N, &K); for (int i = 1; i <= N; i++) { scanf( %d%d , &t1, &t2); V[t1][t2] = true; } for (int i = 1; i <= R; i++) for (int... |
#include <bits/stdc++.h> using namespace std; long long lv[100001], lf[100001], par[100001], n; vector<long long> con[100001], cld[100001]; long long get_leaf(long long id) { if (cld[id].size() == 0) { lf[1]++; return 1; } long long x = 0, i; for (i = 0; i <= cld[id].size() - 1; i++)... |
#include <bits/stdc++.h> using namespace std; int main() { double x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; double vmax, t0, vx, vy, wx, wy; cin >> vmax >> t0 >> vx >> vy >> wx >> wy; double dx = (x2 - x1); double dy = (y2 - y1); double l = 0, r = 1e16; double ans = 1e16; for ... |
#include <bits/stdc++.h> using namespace std; int N; char S[1010]; int E[1010], F[1010][2]; int main() { scanf( %d , &N); scanf( %s , S); memset(E, 0, sizeof(E)); for (int i = 0; i < N; i++) { E[i + 1] = S[i] - 0 ; F[i + 1][0] = F[i + 1][1] = 0x3f3f3f3f; } F[0][0] = F[0][1... |
// ----------------------------------------------------------------------------
// Module: porf_gen.v
// Project: MOS 6502 Processor
// Author: George Castillo <>
// Date: 09 July 2017
//
// Description: Synchronous reset module which synchronizes the assertion (and
// most importantly) the deassertion of a reset ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.