text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 5; long long mod = 1000000007; vector<long long> gr[200001]; vector<long long> grev[200001]; long long a[200005]; void solve() { long long n, d, a, b; cin >> n >> d >> a >> b; vector<pair<long long, long long> > ans; for ... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
* for EE577b Troy WideWord Processor Project
*/
// Behavioral model for the register file
module RegFileWW (rd1data,rd2data,wrdata,rd1addr,rd2addr,wraddr,
rd1en,rd2en,wren,wrbyteen,clk);
// Definitions for the constants the advanced register file
/... |
// onchip_ram_256b_mm_interconnect_0_avalon_st_adapter.v
// This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 15.1 185
`timescale 1 ps / 1 ps
module onchip_ram_256b_mm_interconnect_0_avalon_st_adapter #(
para... |
// -------------------------------------------------------------
//
// File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\velocityControlHdl\velocityControlHdl_Control_Current.v
// Created: 2014-08-25 21:11:09
//
// Generated by MATLAB 8.2 and HDL Coder 3.3
//
// ---------------------------------------------------... |
#include <bits/stdc++.h> using namespace std; double ans = 1111111111; int ap[111111], bp[111111], bt[111111], n, m, a, b, l, r, m1, m2, minap, minbp; double dist(double ax, double ay, double bx, double by) { return sqrt((bx - ax) * (bx - ax) + (by - ay) * (by - ay)); } double f(int i, int j) { retu... |
#include <bits/stdc++.h> using namespace std; const int N = 100 * 1000 + 5; int n, m, cnt; short int mark[N]; bool visited[N]; vector<int> in[N], out[N], comp[N]; void input() { cin.tie(0); cin >> n >> m; int v, u; for (int i = 0; i < m; i++) { cin >> v >> u; v--, u--; ou... |
`include "sdio_defines.v"
module sdio_device_phy (
//input clk,
input rst,
//Configuration
input spi_phy,
input sd1_phy,
input sd4_phy,
//Data Link Interface
output cmd_phy_idle,
output reg cmd_phy,
output... |
#include <bits/stdc++.h> using namespace std; template <typename S, typename T> ostream& operator<<(ostream& out, pair<S, T> const& p) { out << ( << p.first << , << p.second << ) ; return out; } template <typename T> ostream& operator<<(ostream& out, vector<T> const& v) { long long l = v.s... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////
//
// This file is part of Descrypt Ztex Bruteforcer
// Copyright (C) 2014 Alexey Osipov <giftsungiv3n at gmail dot com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of ... |
//# 3 inputs
//# 6 outputs
//# 14 D-type flipflops
//# 44 inverters
//# 75 gates (31 ANDs + 9 NANDs + 16 ORs + 19 NORs)
module dff (CK,Q,D);
input CK,D;
output Q;
wire NM,NCK;
trireg NQ,M;
nmos N7 (M,D,NCK);
not P3 (NM,M);
nmos N9 (NQ,NM,CK);
not P5 (Q,NQ);
not P1 (NCK,CK);
endmodule
module s298(GND,... |
//
// Copyright (c) 2001 Steve 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)
// a... |
// Test mixed type/width case expressions inside a constant function
module constfunc13();
function [2:0] lookup1(input signed [2:0] value);
begin
case (value)
4'sb0100 : lookup1 = 1;
3'sb100 : lookup1 = 2;
2'sb10 : lookup1 = 3;
default : lookup1 = 4;
endcase
$display("case = %d", lookup1);
... |
#include <bits/stdc++.h> using namespace std; vector<pair<double, double> > a; pair<double, double> cur; double r; void findmax(pair<double, double> p) { double y = sqrt(2 * r * 2 * r - abs(p.first - cur.first) * abs(p.first - cur.first)); y += p.second; cur.second = max(cur.second, y); ... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2.1 (win64) Build Wed Aug 9 16:32:24 MDT 2017
// Date : Fri Sep 22 14:40:47 2017
// Host : EffulgentTome running 64-bit major re... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long inf = 4e18; const long double pai = acos(-1); int n, q, ans; set<pair<pair<int, int>, int> > s; int main() { scanf( %d%d , &n, &q); ans = n; s.insert({{1, n}, 1}); while (q--) { int l, r, x; ... |
#include <bits/stdc++.h> using namespace std; const int inf = (int)1e9; const long long llinf = (long long)3e18; const int N = (int)1e6 + 111; const long double PI = (long double)acos(-1); int cnt1[N], cnt[N]; int main() { int t, x, mx = 0, len = 0, n, m; scanf( %d , &t); for (int i = 0; i < t... |
#include <bits/stdc++.h> using namespace std; template <class T> inline void Read(T &x) { int f = 1; char t = getchar(); while (t < 0 || t > 9 ) { if (t == - ) f = -1; t = getchar(); } x = 0; while (t >= 0 && t <= 9 ) { x = x * 10 + t - 0 ; t = getchar(); ... |
/* Made by brandon for brandon.
* I guarantee absolutely nothing and am not liable for any damages.
*/
//=======================================================
// This code is generated by Terasic System Builder
//=======================================================
module DE0_Nano(
//////////// CLOCK ////... |
/**
* 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 l { int index; int depth; int color; }; int a[100001]; struct BFSearch { vector<pair<l, vector<int> > > adj; queue<l> k; void clear1() { for (int i = 0; i < adj.size(); i++) { adj[i].first.color = 0; adj[i].firs... |
// (C) 2001-2017 Intel Corporation. All rights reserved.
// Your use of Intel 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 docum... |
#include <bits/stdc++.h> using namespace std; int main() { string str, s = QWERTYUIOPASDFGHJKLZXCVBNM ; cin >> str; set<char> m; long long result = 1; for (int i = 0; i < str.size(); i++) { if (str[i] == ? ) { if (i == 0) { result *= 9; } else result *... |
/**
* 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)
// ... |
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, fl = 1; char st = getchar(); while (st < 0 || st > 9 ) { if (st == - ) fl = -1; st = getchar(); } while (st >= 0 && st <= 9 ) x = x * 10 + st - 0 , st = getchar(); return x * fl; } const 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... |
//////////////////////////////////////////////////////////////////
////
////
//// AES CORE BLOCK
////
////
////
//// This file is part of the APB to I2C project
////
//// http://www.opencores.org/cores/apbi2c/
////
////
////
//// Description
////
//// Implementation of APB IP core according to
////
//... |
/*
* 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... |
`timescale 1 ns / 1 ps
`include "example_core_lite_v1_0_tb_include.vh"
// lite_response Type Defines
`define RESPONSE_OKAY 2'b00
`define RESPONSE_EXOKAY 2'b01
`define RESP_BUS_WIDTH 2
`define BURST_TYPE_INCR 2'b01
`define BURST_TYPE_WRAP 2'b10
// AMBA AXI4 Lite Range Constants
`define S00_AXI_MAX_BURST_LENGTH 1
`... |
#include <bits/stdc++.h> using namespace std; const int Mod = 1000000007; int N; struct M { int a[250][250]; M() { memset(a, 0, sizeof(a)); } }; M I() { M res; for (int i = 0; i < N; i++) res.a[i][i] = 1; return res; } M operator*(const M& a, const M& b) { M ans; for (int i =... |
//----------------------------------------------------------------------------
// Copyright (C) 2009 , Olivier Girard
//
// 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 re... |
#include <bits/stdc++.h> long long prod_dig(long long n) { long long prod = 1; int a; while (n) { a = n % 10; if (a) { prod *= a; } n /= 10; } return prod; } int arr[10][1000000 + 1]; int main() { int t; for (int i = 1; i <= 1000000; i++) { t = i... |
#include <bits/stdc++.h> using namespace std; int n, l, v1, v2, k; int main() { cin >> n >> l >> v1 >> v2 >> k; long double T = 0; long double S = l, t1, t2, d; int m = ((n + k - 1) / k); S = S / ((long double)(m) - ((long double)(m - 1) * (v2 - v1)) / (v2 + v1)); t1 = S / v2; t2 = (S ... |
module ADT7310 (
(* intersynth_port="Reset_n_i" *)
input Reset_n_i,
(* intersynth_port="Clk_i" *)
input Clk_i,
(* intersynth_port="ReconfModuleIn_s", intersynth_conntype="Bit" *)
input Enable_i,
(* intersynth_port="ReconfModuleIRQs_s", intersynth_conntype="Bit" *)
output CpuIntr_o,
(* intersynth_p... |
/////////////////////////////////////////////////////////////////////////
// Copyright (c) 2008 Xilinx, Inc. All rights reserved.
//
// XILINX CONFIDENTIAL PROPERTY
// This document contains proprietary information which is
// protected by copyright. All rights are reserved. This notice
... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: bomb.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===================================... |
#include<bits/stdc++.h> using namespace std; const int P=1e9+7,N=209,iv=P+1>>1; int f[N][N],ans[N][N],d[N],sz[N],fa[N]; basic_string<int>g[N]; void dfs(int x,int y){ sz[x]=1,fa[x]=y; for(int i:g[x])if(i!=y)d[i]=d[x]+1,dfs(i,x),sz[x]+=sz[i]; } int qp(int a,int b){ int r=1; for(;b;b>>=1,a=a*1ll*... |
`include "defines.v"
module regfile (
input wire rst,
input wire clk,
input wire we,
input wire[`RegAddrBus] waddr,
input wire[`RegBus] wdata,
input wire re1,
input wire[`RegAddrBus] raddr1,
output reg[`RegBus] rdata1,
input wire re2,
input wire[`RegAddrBus] raddr2,
output reg... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { unsigned long long int mino = LONG_MAX; unsigned long long int minc = LONG_MAX; unsigned long long int ans = 0; unsigned long long int n; cin >> n; unsigned long long int o[n], c... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2015.4
// Copyright (C) 2015 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1ns/1ps
modul... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i, sum; int xx[10005], yy[10005], a[10005]; while (scanf( %d , &n) != EOF) { sum = 0; for (i = 0; i <= n; i++) { scanf( %d %d , &xx[i], &yy[i]); } for (i = 0; i < n; i++) { if (xx[i] == xx[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> struct DSU { long long M[400005]; DSU(long long n) { for (long long i = 0; i < n; i++) { M[i] = i; } } long long find(long long x) { while (M[x] != x) { long long p = M[x]; M[x] = M[p]; x = p; } return x; } ... |
#include <bits/stdc++.h> const long long INF = 1e18; void swap(long long &a, long long &b) { long long temp; temp = a; a = b; b = temp; } using namespace std; void solve() { long long n, k, ans; cin >> n >> k; ans = n; for (long long i = 1; i <= sqrt(n); i++) { if (n % i ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; long long int arr[100005]; map<long long int, int> m; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %I64d , &arr[i]); } for (int i = 1; i <= n; i++) { arr[i] += arr[i - 1]; m[arr[i]]++; } 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... |
/**
* 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; int node[101], h[101], perm[101], fav[101]; int getP(int c) { int p = node[c]; if (p < 0) return c; while (node[p] > 0) p = node[p]; return node[c] = p; } void join(int a, int b) { if (0) printf( join %d %d n , a, b); int pa = getP... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, q = 1, i, res = 1; cin >> n >> m; for (i = 0; i < m; i++) { q = (q << 1); q %= 1000000009; } q--; for (i = 0; i < n; i++) { res *= (q - i); if (res <= 0) { cout << 0 ; return 0... |
#include <bits/stdc++.h> using namespace std; char s[1010]; int main() { int n; scanf( %d , &n); scanf( %s , s); int a0 = 0; int a1 = 0; int b0 = 0; int b1 = 0; for (int i = 0; i < n; i++) { if (s[i] == 0 ) { if (i % 2) b0++; else a0++; ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; long long a[300010], cnt[300010]; long long n, k, maxx; int main() { ios_base::sync_with_stdio(false); cin >> n >> k; for (int i = 1; i <= n; ++i) { cin >> a[i]; maxx = max(maxx, a[i]); } int pos = 1, ... |
module ad9777_spi(
output reg sdio,
output reg csb,
input rst,
input clk,
output reg spi_ok
);
wire [6:0] lut_index=7'd5;
////////////////////////////////////////////
function [15:0] lut_data;
input [5:0] addr;
begin
case(addr)////[15]:R/W=0,[14:13]:N1 N0=0,[12:8]:A4~A0,[7:0]:D7~D0
6'd0 :lut_data=16'b0_00_00000_... |
#include <bits/stdc++.h> using namespace std; enum faces { Tetrahedron = 4, Cube = 6, Octahedron = 8, Dodecahedron = 12, Icosahedron = 20 }; int main() { int n; cin >> n; long long total = 0; for (int i = 0; i < n; ++i) { string s; cin >> s; if (s == Tetrah... |
/**
* 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 alt_mem_ddrx_buffer
# (
// module parameter port list
parameter
ADDR_WIDTH = 3,
DATA_WIDTH = 8
)
(
// port list
ctl_clk,
ctl_reset_n,
// write interface
write_valid,
write_address,
write_data,
// read interface
read_valid,
read_address... |
// -----------------------------------------------------------------------------
// -- --
// -- (C) 2016-2022 Revanth Kamaraj (krevanth) --
// -- ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:40:48 05/22/2016
// Design Name:
// Module Name: Decodificador_2
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies... |
/*
* keyboard.v - Keyboard interface for CPC
*
* Connects to the support CPU to set the appropriate keys.
* Note this is POSITIVE logic, rather than negative logic of the CPC keyboard
* Set a key bit to 1 to indictate 'down' or 0 for 'up'
*
* Part of the CPC2 project: http://intelligenttoasters.blog
*
* Copyri... |
// Copyright 2020-2022 F4PGA 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
#include <bits/stdc++.h> using namespace std; const int N = 100; int gi() { int w = 0; bool q = 1; char c = getchar(); while ((c < 0 || c > 9 ) && c != - ) c = getchar(); if (c == - ) q = 0, c = getchar(); while (c >= 0 && c <= 9 ) w = w * 10 + c - 0 , c = getchar(); return q ... |
module x;
reg [31:0] mb_reg_output;
// 16 registers max, register 15 is always the version number, so 15 are useable
// NOTE: number_interface_regs must be the maximum (or 16 in this case) to get the version register
parameter NUMBER_INTERFACE_REGS = 16;
parameter MB_... |
(* An example showing that prop-extensionality is incompatible with
powerful extensions of the guard condition.
Unlike the example in guard2, it is not exploiting the fact that
the elimination of False always produces a subterm.
Example due to Cristobal Camarero on Coq-Club.
Adapted to nested types by B... |
#include <bits/stdc++.h> using namespace std; long long ax, ay, bx, by, tx, ty; int n; long long x[110000]; long long y[110000]; long double solve(int cnt) { long double res = 0; int p = 0; long double v = sqrt((x[0] - ax) * (x[0] - ax) + (y[0] - ay) * (y[0] - ay)) - sqrt((x[... |
//////////////////////////////////////////////////////////////////////
//// ////
//// readUSBWireData.v ////
//// ////
//// This file is part of the usbhos... |
#include <bits/stdc++.h> using namespace std; string st[5050]; int fr[27]; int main() { memset(fr, 0, sizeof(fr)); ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k; cin >> k >> n; for (int i = 0; i < k; i++) { cin >> st[i]; } string res = st[0]; memset(fr,... |
#include <bits/stdc++.h> using namespace std; int n = 8; struct point { int x; int y; }; bool f(point a, point b) { if (a.x != b.x) return a.x > b.x; return a.y > b.y; } int main() { point a[8]; for (int i = 0; i < n; i++) cin >> a[i].x >> a[i].y; int t1 = 0, t2 = 0; for (i... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); long long n, m; cin >> n >> m; map<long long, set<long long>> adj; for (long long i = 0; i < m; i++) { long long a, b; cin >> a >> b; adj[a].ins... |
#include <bits/stdc++.h> #pragma comment(linker, /stack:64000000 ) using namespace std; const double PI = 2 * acos(0.0); const double eps = 1e-9; template <class T> T jog(T a, T b) { return a + b; } template <class T> T bog(T a, T b) { return a - b; } template <class T> T gon(T a, T b) ... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017
// Date : Tue Sep 19 09:41:24 2017
// Host : DarkCube running 64-bit major release ... |
`include "sccu_dataflow.v"
`include "cla32.v"
`include "alu.v"
`include "regfile.v"
module sccpu_dataflow(clock, resetn, inst, memout, pc, wmem, aluout, data2mem, reg_addr, reg_out );
input [31:0] inst, memout;
input clock, resetn;
output [31:0] pc, aluout, data2mem;
output wmem;
input [4:0]reg_addr;
o... |
#include <bits/stdc++.h> using namespace std; namespace jumpmelon { long long divfloor(long long a, long long b) { long long k = a / b; if (k * b > a) k--; return k; } long long divceil(long long a, long long b) { long long k = a / b; if (k * b < a) k++; return k; } void work() { ... |
#include <bits/stdc++.h> using namespace std; long long mysqrt(long long x) { long long l = 0; long long r = 1; while (r * r <= x) r *= 2; while (r - l > 1) { long long m = (l + r) / 2; if (m * m <= x) l = m; else r = m; } return l; } int main() { lo... |
// 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;
integer _mode; initial _mode=0;
reg... |
`include "alu4bit.v"
module tb4alu;
reg [3:0] A, B;
reg CIN, BINV;
reg [1:0] OP;
wire COUT;
wire [3:0] Y;
alu4bit alu4bit00 (A, B, CIN, BINV, OP, COUT, Y);
initial begin
A = 4'b0000;
B = 4'b0000;
CIN = 1'b0;
BINV = 1'b0;
OP = 2'b00;
#10
A = 4'b0101;
B = 4'... |
/*
* Copyright 2013, 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 ... |
#include <bits/stdc++.h> using namespace std; int nbVoyages, coutSimple, coutLiaison, maxCartes, coutCarte; map<pair<string, string>, int> routes; int main() { ios_base::sync_with_stdio(false); cin >> nbVoyages >> coutSimple >> coutLiaison >> maxCartes >> coutCarte; long long total = 0; string d... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; const long long INF = 1e17, LINF = 1e12; int n, m, q, x, y; vector<int> g[N], s[N]; int top[N], p[N], dp[N], son[N], sz, d[N]; int tin1[N], tin2[N], tout[N], timer, num[N]; pair<long long, int> og[N]; pair<long long, int> t[4 * N]; ... |
/**
* 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... |
// 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... |
#include <bits/stdc++.h> using namespace std; long long n, k; void In() { cin >> n >> k; } void Solve() { k--; while (k--) { int largest = INT_MIN, smallest = INT_MAX; for (long long copy = n; copy; copy /= 10) { int r = copy % 10; largest = max(r, largest); smallest ... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:102400000,102400000 ) using namespace std; const int maxn = 300 + 10, maxm = 4e4 + 10; const int dir[4][2] = {0, 1, 0, -1, 1, 0, -1, 0}; const int INF = 0x3f3f3f3f; struct Graph { int ndn, edn, last[maxn]; int u[maxm], v[maxm], flw[maxm], cap[... |
#include <bits/stdc++.h> using namespace std; int a[200005], b[200005]; int nx[500005]; int n, m; void getnext() { nx[0] = -1; int j = 0, k = -1; while (j < m) { if (k == -1 || b[j] == b[k]) nx[++j] = ++k; else k = nx[k]; } } int KMP() { int ret = 0; int... |
#include <bits/stdc++.h> using namespace std; int T, a[260]; int main() { scanf( %d , &T); while (T--) { int s = 0; int ct = 0; for (int i = 0; i < 250; i++) { scanf( %d , &a[i]); s += a[i]; } double ave = s / 250.0; for (int i = 0; i < 250; i++) { ... |
//wb_bram.v
/*
Distributed under the MIT license.
Copyright (c) 2011 Dave McCoy ()
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
u... |
/*
* 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 (C) 2014, VIPcore Group, Fudan University
//
// THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WITHOUT THE
// EXPRESSED WRITTEN CONSENT OF VIPcore Group
//
// VIPcore : http://soc.fudan.edu.cn/vip
// IP Owner : Yibo FA... |
#include <bits/stdc++.h> using namespace std; long long int d[300002]; int safe[300002]; bool solve() { long long int n, k, l, i; cin >> n >> k >> l; for (i = 1; i <= n; i++) cin >> d[i]; int tide, dir, mtide; tide = k; dir = -1; for (i = 1; i <= n; i++) { if (d[i] + k <= l) ... |
#include <bits/stdc++.h> const unsigned int M = 1000000007; long long power(long long x, long long y) { long long res = 1; while (y > 0) { if (y & 1) res = x * res; y = y >> 1; x = x * x; } return res; } long long power(long long x, long long y, long long mod) { long long r... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; int n, t; int TM[maxn], wait, ans; priority_queue<int> in; int main() { scanf( %d%d , &n, &t); for (int i = 1; i <= n; ++i) scanf( %d , &TM[i]); for (int i = 1; i <= n + 1; ++i) { wait = t - i; if (wait < 0) bre... |
// ----------------------------------------------------------------------
// Copyright (c) 2015, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; vector<string> vec_splitter(string s) { s += , ; vector<string> res; while (!s.empty()) { res.push_back(s.substr(0, s.find( , ))); s = s.substr(s.find( , ) + 1); } return res; } void debug_out(vector<stri... |
#include <bits/stdc++.h> using namespace std; struct data { int val; int col; vector<int> vec; } arr[100005]; void connect(int a, int b) { arr[a].vec.push_back(b); arr[b].vec.push_back(a); } int goal[100005]; vector<int> ans; void dfs(int n, int fl, int flip, int flip1) { arr[n].... |
#include <bits/stdc++.h> using namespace std; long long a, s, d[500002][3], f, g, h, j, k, l, i, n, m; long long inf = 100000000000000000ll; pair<long long, int> p[500003], p1; int main() { cin >> n; for (i = 1; i <= n; i++) { scanf( %d , &a); d[i][0] = a; d[i][1] = i - 1; d[i]... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2011 Xilinx Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
//
// ____ ___
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ Versi... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; const int MOD = 1e9 + 7; long long dp[N][2]; void solve() { memset(dp, 0, sizeof(dp)); string a, b; cin >> a >> b; (a == b ? dp[0][1] = 1 : dp[0][0] = 1); int k; cin >> k; long long way_good = 0, way_bad = 0; ... |
#include <bits/stdc++.h> using namespace std; inline int read() { char ch = getchar(); int res = 0, flag = 1; while (ch < 0 || ch > 9 ) { if (ch == - ) flag = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { res = res * 10 + ch - 0 ; ch = getchar(); } r... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<long> v(n); long mul = 1; for (int i = 0; i < n; ++i) cin >> v[i]; if (n > 1000) { cout << 0 n ; return 0; } for (int i = 0; i < n - 1; ++i) for (int j = i + 1; j < n; ++j) ... |
//*****************************************************************************
// DISCLAIMER OF LIABILITY
//
// This file contains proprietary and confidential information of
// Xilinx, Inc. ("Xilinx"), that is distributed under a license
// from Xilinx, and may be used, copied and/or disclosed only
// pursuant to the... |
`include "bsg_mem_1r1w_sync_macros.vh"
module bsg_mem_1r1w_sync
#(parameter `BSG_INV_PARAM(width_p)
, parameter `BSG_INV_PARAM(els_p)
, parameter read_write_same_addr_p=0
, parameter addr_width_lp=`BSG_SAFE_CLOG2(els_p)
, parameter harden_p=1
, parameter disable_collision_warning_p=0
, param... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.