text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; const int maxN = 1 << 18; template <class T1, class T2> inline void remax(T1& a, T2 b) { a = max(a, (T1)b); } int deg[maxN], fat[maxN]; vector<int> G[maxN]; queue<int> Q; long long w[maxN]; pair<long long, int> leg[2][max... |
// (c) Copyright 1995-2015 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 n, a, b; int check(int p) { int res; res = a / p + b / p; if (a / p == 0 || b / p == 0) return 0; if (res >= n) return 1; else return 0; } int main() { int l, r, mid; scanf( %d%d%d , &n, &a, &b); r = a + b; l = 1... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_ad
//
// Generated
// by: wig
// on: Thu Apr 26 09:40:09 2007
// cmd: /home/wig/work/MIX/mix_0.pl -nodelta ../../verilog.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Author:... |
#include <bits/stdc++.h> using namespace std; const int N = 200005; int n, a[N], place[N], BIT[N]; long long inverse, res[N]; set<int> firstHalf, secondHalf; long long sumFirst = 0, sumSecond = 0; long long fenwickGet(int x) { long long res = 0; for (; x <= n; x += x & -x) res += BIT[x]; retur... |
#include <bits/stdc++.h> using namespace std; int main() { string s; for (int i = 1; i <= 400; i++) s += to_string(i); int n; cin >> n; cout << s[n - 1]; } |
// dtb_daq.v
`timescale 1 ns / 1 ps
module dtb_daq
(
input clk_daq,
input clk_sys,
input [7:0]sclk,
input reset,
input sync,
// control
input [1:0]ctrl_adc_address,
input ctrl_adc_write,
input [15:0]ctrl_adc_writedata,
input ctrl_adc_read,
output [15:0]ctrl_adc_readdata,
input [3:0]ctrl_deser160,
... |
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); const double EPS = 1e-9; const int oo = 210000000; int n; vector<int> p[4]; vector<int> g[201]; int solve(int x) { bool used[201]; for (int i = 1; i <= n; i++) used[i] = 0; int ans = 0, m = 0; while (m < n) { ... |
module RegisterTestBench;
parameter sim_time = 750*2; // Num of Cycles * 2
reg [31:0] test_in,test_in2;
reg test_clk,test_reset,test_load,test_load2;
wire [31:0] test_out;
//module Register2(input [31:0] IN,IN2,input Clk, Reset,Load,Load2,output [31:0] OUT);
Register2 test_reg(.IN(test_in),
.IN2(test_in2),
... |
#include <bits/stdc++.h> using namespace std; int n, type[100001], a[100001], lead[100001], cur[100001]; bool vs[100001]; void input() { scanf( %d , &n); for (int i = 1, _b = n; i <= _b; i++) scanf( %d , &type[i]); int x; memset(lead, 0, sizeof(lead)); memset(a, 0, sizeof(a)); for (int i... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; string out, chr; cin >> n >> k; for (int i = 0; i < k; ++i) chr += a + i; for (int i = 0; i < n; ++i) out += chr[i % k]; cout << out; return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int tt; cin >> tt; while (tt--) { int k; cin >> k; string s, a, b; cin >> s >> a >> b; int n = (int)(s).size(); vector<int> x; vecto... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6 + 5; int n, k; int v[MAXN], c[MAXN], a[MAXN]; double f[MAXN]; int rv[MAXN][20], rc[MAXN][20]; inline int GetV(int l, int r) { int x = log2(r - l + 1); return max(rv[l][x], rv[r + 1 - (1 << x)][x]); } inline int GetC(int l, int ... |
#include <bits/stdc++.h> using namespace std; long long int diff(long long int x, long long int y) { if (x > y) { return x - y; } else { return y - x; } } int main() { long long int n; cin >> n; long long int arr[n]; for (long long int i = 0; i < n; i++) { cin >> ar... |
#include <bits/stdc++.h> using namespace std; struct point { int i; int j; }; int main() { vector<char> s; int n, m; char c; char a[102][102]; point first; first.i = -1; point last; memset(a, 0, sizeof(a)); scanf( %d %d %c , &n, &m, &c); getchar(); 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 la... |
module test;
integer i;
reg [7:0] c;
reg [31:0] fd[15:0];
initial begin
// Open some MCDs and FD's to play with
$display("Open some files");
for (i = 0; i < 4; i = i+1) begin
fd[i] = $fopen("/dev/null");
$display("open MCD returned %x", fd[i]);
... |
//////////////////////////////////////////////////////////////////////
//// ////
//// syncflop.v ////
//// ////
//// ... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.1
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1ns/1ps
... |
#include <bits/stdc++.h> using namespace std; #define ll long long #define pi pair<int, int> #define pll pair<long long, long long> #define vi vector<int> #define vll vector<long long> #define vpi vector<pair<int, int>> #define vvi vector<vector<int>> #define mii map<int, int> #define mmii multim... |
#include <bits/stdc++.h> using namespace std; long long x[5003], a[5003], b[5003], c[5003], d[5003]; vector<int> path; long long weight[5003][5003]; long long edge(int i, int j) { long long ans = abs(x[i] - x[j]); if (j < i) ans += (c[i] + b[j]); if (i < j) ans += (d[i] + a[j]); return ans; ... |
//#############################################################################
//# Function: Statically configured arbiter #
//#############################################################################
//# Author: Andreas Olofsson #
... |
/*
* File: lsu_mem2reg.v
* Project: pippo
* Designer: fang@ali
* Mainteiner: fang@ali
* Checker:
* Description:
* MUX for load data
*/
// synopsys translate_off
`include "timescale.v"
// synopsys translate_on
`include "def_pippo.v"
module lsu_mem2reg(addr, lsu_op, memdata, regdata);
param... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const int Max_N(1050); int N; double P[Max_N][Max_N], F[Max_N], G[Max_N], V[Max_N]; bool done[Max_N]; int main() { scanf( %d , &N); for (int i = 1; i <= N; ++i) { V[i] = 1.0; for (int j = 1; j <= N; ++j) scanf( %lf , P[i] + j), P[i][j] /= 100... |
/*
* 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() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int x, y, idx; cin >> x >> y >> idx; if (idx == 0) cout << x << endl; else if (idx == 1) cout << y << endl; else { idx -= 2; int z; while (tr... |
#include <bits/stdc++.h> const int N = 810; const int M = 10; int mod[N][M]; int ans[N], inv[N], a[N]; int n; void print() { if (ans[1] > n / 2) { for (int i = 1; i <= n; ++i) { ans[i] = n + 1 - ans[i]; } } printf( ! ); for (int i = 1; i <= n; ++i) { printf( %d , a... |
#include <bits/stdc++.h> using namespace std; int who(int n) { if (n < 5) { return n; } else { n -= 5; return who(n / 2); } } int main(int argc, char** argv) { int n, m; cin >> n >> m; vector<vector<char> > snake(n, vector<char>(m, # )); for (int i = 1; i < n; i +=... |
#include <bits/stdc++.h> using namespace std; int a[205], b[205]; long long dp[205][205], k; int n, m; char ans[205]; bool cmp(int x, int y) { return a[x] < a[y]; } int main() { scanf( %d%d , &n, &m); cin >> k; int t = n + m - 1; for (int i = 0; i < t; i++) { a[i] = n * m; b[i]... |
/*------------------------------------------------------------------------------
* This code was generated by Spiral Multiplier Block Generator, www.spiral.net
* Copyright (c) 2006, Carnegie Mellon University
* All rights reserved.
* The code is distributed under a BSD style license
* (see http://www.opensource.or... |
// (C) 2001-2016 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; vector<int> adj[1000000 + 342]; set<int> ans; bool incl[1000000 + 342]; bool isleader[1000000 + 342]; map<pair<int, int>, bool> egd; int main() { ios::sync_with_stdio(false); int n, m, x, y; cin >> n >> m; for (int i = 0; i < m; i++) { ci... |
`include "tx.v"
`include "hardReset.v"
`include "registers.v"
`include "reg_interface.v"
module tcpci(output wire Start_tHardResetComplete_timer,
output wire Request_PHY_to_Send_Hard_Reset,
output wire Request_PHY_to_Send_Cable_Reset,
output wire Stop_PHY_attempting_to_send_Hard_Reset,
output wire Stop... |
//Legal Notice: (C)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 associate... |
/**
* 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> long long RemoveZeros(long long a) { long long temp; long long x = 0; long long i = 10; while (a > 0) { if (a % 10 != 0) { temp = (a % 10) * i; x += temp; i *= 10; } a /= 10; } return x / 10; } using namespace std; int ma... |
/*
* PicoSoC - A simple example SoC using PicoRV32
*
* Copyright (C) 2017 Clifford Wolf <>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies... |
/* ********************************************************************************************* */
/* * Activity Indicator LED Module * */
/* * Authors: * */
/* * André Bannw... |
module tb_SystolicDataSetupRow #(
parameter DATA_BITS = 8,
parameter MATRIX_SIZE = 8,
parameter OUTPUT_SIZE = 2*MATRIX_SIZE-1
) ();
reg clock;
reg reset;
integer count;
reg [DATA_BITS-1:0] data_in [0:MATRIX_SIZE-1][0:MATRIX_SIZE-1];
wire [DATA_BITS-1:0] data_out [0:OUTPUT_SIZE-1][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 law... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, pair<int, int> > > V; const int maxn = 1010; int n, N; int a[maxn][maxn], r[maxn], c[maxn]; void sr(int x, int y) { if (x == y) return; V.push_back(make_pair(1, pair<int, int>(x, y))); for (int i = 1; i <= N; ++i) swap(a[x][i], a[y][... |
module test;
reg clk = 0;
reg reset = 1;
wire [31:0] io_in_bits;
wire [7:0] io_in_bits_l2Protocol;
wire [7:0] io_in_bits_eth_l3Type;
wire [7:0] io_in_bits_ipv4_ttl;
initial begin
reset = 1;
#250 reset = 0;
end
always #100 clk = ~clk;
Top
Top(
.clk(clk),
.reset(rese... |
#include <bits/stdc++.h> using namespace std; int m[1000][1000]; int main() { m[0][0] = 1; m[0][1] = 2; m[1][0] = 2; m[1][1] = 3; m[2][0] = 3; m[2][1] = 1; int n; scanf( %d , &n); int g = 4; int d = 2; int cur = 0; while (g <= n) { m[cur][d] = g; ++g; ... |
/**
* 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; namespace fgraph { const int MAXV = 50; const int MAXE = 10 * MAXV * MAXV; const int INF = (1 << 30); struct edge { int to, cap, flow, cost; edge *nxt, *rev; } edges[MAXE + 5], *adj[MAXV + 5], *cur[MAXV + 5], *ecnt = edges; void addedge(int u, int v,... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:44:06 07/28/2013
// Design Name:
// Module Name: SimpleQuadratureCounter
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depe... |
#include <bits/stdc++.h> using namespace std; int ans[200010]; int main() { int n; cin >> n; if (n & 1) { puts( YES ); bool f = true; for (int i = 0; i < n; i++) { if (f) ans[i + n] = (i + 1) * 2, ans[i] = (i + 1) * 2 - 1; else ans[i] = (i + 1) * 2... |
#include <bits/stdc++.h> using namespace std; const long long int mod = 1000000007; const long long int p = 27; string s; long long int hashnum(int lw, int up) { if ((up - lw) % 2 == 0) return (((hashnum(lw, (lw + up) / 2) * p) % mod + 1) * ((hashnum((lw + up) / 2, up) * p) % mod + 1))... |
#include <bits/stdc++.h> using namespace std; char str[110]; int n, ans, len; bool arr[110][220][55][2]; int main() { scanf( %s%d , str + 1, &n); len = strlen(str + 1); arr[0][100][0][0] = true; for (int i = 1; str[i]; ++i) for (int j = 100 - i; j <= 100 + i; ++j) for (int k = 0;... |
#include <bits/stdc++.h> using namespace std; int n, k, a[200005 / 2], ans = -1, cnt = 0; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; cin >> n >> k; for (int i = 1; i <= n + 1; i++) { if (i < n + 1) cin >> a[i]; else a[i] = a[i - 1]; ... |
#include <bits/stdc++.h> using namespace std; using lint = long long; const lint linf = 1e18 + 7; const lint inf = 1e9 + 7; const int MOD = 1000000007; void press(vector<long long>& x) { map<int, int> memo; int n = x.size(); for (int i = 0; i < n; ++i) { memo[x[i]] += 1; } int cur ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
module fft32( CLK ,RST ,ED ,START ,DReal ,DImag ,RDY ,DOReal ,DOImag, ifft ); //Add overflow , check weather shift & ADDR is needed
parameter total_bits = 32;
input CLK;
input RST;
input ED;
input START;
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... |
/*
* 8-bit rotate module for Zet
* Copyright (C) 2008-2010 Zeus Gomez Marmolejo <>
*
* 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 Public License as published by the Free Software
* Foundation; eit... |
/***********************************************************************
Single Port RAM that maps to a Xilinx/Lattice BRAM
This file is part FPGA Libre project http://fpgalibre.sf.net/
Description:
This is a program memory for the AVR. It maps to a Xilinx/Lattice
BRAM.
This version can be modified by th... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, q; cin >> n >> m >> q; int a[n][m]; struct a { int o; int p; } arr[q]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> a[i][j]; } } int fo[n]; for (int i = 0; i... |
#include <bits/stdc++.h> using namespace std; const long long Maxn = 1e5 + 7; const long long Max = 1e3 + 7; const long long Mod = 1e9 + 7; const long long Inf = 1e9 + 7; string s[Maxn], V[Maxn]; long long ans[5]; long long check(char t) { if (t == u || t == o || t == a || t == i || t == e ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e+5; char str[2 * maxn + 5]; int main() { int cishu; cin >> cishu; while (cishu--) { int n; cin >> n; for (int a = 0; a < n - 1; a++) cin >> str[a]; str[n - 1] = 0 ; int tmp = n; for (int i = 0; i < ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); int num; while (n--) { scanf( %d , &num); printf( %d n , num > 2 ? num - 2 : 0); } } |
// 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_test_expr;
wire valid_start_state;
wire valid_next_state;
assign valid_test_ex... |
/**
* 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) 2000 Chris Lattner <>
*
* 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; int div1(int a, int b) { if (a % b == 0) return a / b; else return a / b + 1; } int main() { int k, n, s, p; while (scanf( %d%d%d%d , &k, &n, &s, &p) != EOF) { int ever_need = div1(n, s); int ans = div1(ever_need * k, p); ... |
#include <bits/stdc++.h> using namespace std; const int N = 203; const int mod = 1e9 + 7; vector<int> g[N]; int dp[N]; int ans, n; int len1, len2; void cal(int u, int fa, int &len) { dp[u] = 0; int &mx1 = dp[u], mx2 = 0; int v; for (__typeof((g[u]).begin()) v = (g[u]).begin(); v != (g[u]... |
#include <bits/stdc++.h> using namespace std; int n, a[10000], m, x, v[10000], sol[10000]; void g(int n) { for (int i = 2; i <= 1000; i++) { for (int q = i; q <= 1000; q++) { if (q % i != 0 && i * q <= 1000) v[i * q] = 1; } } } int main() { int k = 0; cin >> n; g(n); ... |
#include <bits/stdc++.h> using namespace std; long long N, K; long long Top, Bot, H[200005], cnt[200005]; long long hcnt[200005]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> N >> K; Top = 0, Bot = 2e5; for (int i = 0; i <= N - 1; i++) { cin >> H[i]; cnt[H[i]]++... |
#include <bits/stdc++.h> using namespace std; const long long N = 1100; const long long M = 260; const long long mod = 998244353; const long long MOD = 998244353; const long double eps = 0.000000001; const long long P = 1336; const long long inf = 1e16; mt19937 gen(chrono::high_resolution_clock::now()... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:41:32 06/24/2014
// Design Name:
// Module Name: seg_scroll
// 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... |
//-----------------------------------------------------------------------------
// Copyright (C) 2014 iZsh <izsh at fail0verflow.com>
//
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
// at your option, any later version. See the LICENSE.txt file for the text of
// the license.
//--------... |
`default_nettype none
`define CLKFREQ 36000000 // frequency of incoming signal 'clk'
`define BAUD 115200
// Simple baud generator for transmitter
// ser_clk pulses at 115200 Hz
module baudgen(
input wire clk,
output wire ser_clk
);
localparam lim = (`CLKFREQ / `BAUD) - 1;
localparam w = $clog2(li... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a[20000], i, j, s = 1; cin >> n; for (i = 0; i < n; i++) { cin >> a[i]; } for (i = 0; i < n; i++) { if (a[i] % 2) { printf( %d n , (s + a[i]) / 2); s *= -1; } else printf( %d n , a[i] / 2)... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<int> tree[n + 1]; for (int i = 2; i <= n; i++) { int p; cin >> p; tree[p].push_back(i); } bool is_spruce = true; for (int i = 1; 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; int main() { int n, k; cin >> n >> k; vector<pair<int, int> > v; for (int i = 0; i < n; i++) { int a; cin >> a; v.push_back(make_pair(a, i)); } sort(v.begin(), v.end()); int cur = 0; vector<int> ans; for (int i = 0; ... |
#include <bits/stdc++.h> using namespace std; struct trip { int a, b, c; }; const int MAXINT = 100; int n, temp; vector<int> pos, neg; bool zeros = false; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> temp; if (temp > 0) pos.push_back(temp); else if (t... |
/*
Copyright (c) 2016-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; long long iHateGeometry[100001]; int main() { int N; scanf( %d , &N); long long maxi = -1, sum = 0; for (int i = 0; i < N; i++) { scanf( %lld , &iHateGeometry[i]); sum += iHateGeometry[i]; maxi = max(maxi, iHateGeometry[i]); } ... |
#include <bits/stdc++.h> using namespace std; long long find_smallest_number_with_cumulative_sum_greater_or_equal_than_sum( long long sum) { long long lower = 0, upper = (long long)15E8, mid; while (lower < upper) { mid = (lower + upper) / 2; if (mid * (mid + 1) / 2 >= sum) upper =... |
//From: "Chris Kappler" <>
//Verilint 440 off // WARNING: Clock is used as a reset
//Verilint 394 off // WARNING: Multiple clocks in the always block
//Verilint 71 off // WARNING: Case statement without default clause
module x (/*AUTOARG*/
// Outputs
a, b, c,
// Inputs
clk, re... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; const int maxm = 2000005; const int inf = 0x3f3f3f3f; const int mod = 1000000000 + 7; void init() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); }; int n, m; vector<int> v[100005]; vector<int> vv[100005]; i... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using vpi = vector<pair<int, int>>; using pi = pair<int, int>; const int nax = 1e5 + 7; const int mod = 1e9 + 7; const int inf = numeric_limits<int>::max() - (int)9e6; struct monotonic_queue { queue<int> qu... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100100; int N, M; int app[MAXN]; char type[MAXN]; int P[MAXN]; bool check(int leader) { set<int> users; users.insert(leader); for (int i = 0; i < M; i++) { if (type[i] == + ) users.insert(P[i]); else us... |
(
input rst_b,
input p1_clk,
input p1_select,
input p1_rdnw,
input p2_clk,
input p2_select,
input p2_rdnw,
output p2_data_available,
output p1_full
);
// Initial state: 0 = empty; 1 = full
parameter init = 0;
reg req;
reg req_s1;
reg req_s2;
reg ack;
reg ack_s1... |
#include <bits/stdc++.h> using namespace std; int p[] = {0, 5, 7, 5}; int main() { for (int k = 1; k <= 3; k++) { string s; getline(cin, s); int tot = 0; for (int i = 0; i < s.size(); i++) if (s[i] == a || s[i] == e || s[i] == i || s[i] == o || s[i] == u ) ... |
#include <bits/stdc++.h> using namespace std; inline void read(int &x) { x = 0; int f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } x ... |
/**
* 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 n; long long int u; string s; int q; int count(long long int number) { if (!number) return 0; int result = 0; while (number % 2 == 0) { result++; number >>= 1; } return result; } long long int solve(long long int... |
#include <bits/stdc++.h> using namespace std; const int N = 400010; const int P = 1000000007; int m, n, mi[N], l[N], r[N]; char a[N], ans[N]; bool Check(int t, int x) { if (++t < x) return 0; return ((r[t] - r[t - x] * mi[x]) * mi[t - x] == l[t] - l[t - x]); } bool Dfs(int k, bool has) { if ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: franp.com
// Engineer: Fran Pregernik <>
//
// Create Date: 01/06/2017 05:35:32 AM
// Design Name:
// Module Name: clk_divider_15_1_mhz
// Project Name:
// Target Devices:
// Tool Versions:
// Description... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; template <class T> void rd(T &x) { x = 0; int f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) x = (x << 3) + (x << 1) + ch - 0 , ch = getchar(... |
/**
* 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... |
//Legal Notice: (C)2011 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associate... |
////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2012, Ameer M. Abdelhadi; . All rights reserved. //
// //
// Redistribution and use in source and binary forms, with or with... |
`define bsg_dff_reset_macro(bits) \
if (harden_p && width_p==bits) \
begin: macro \
bsg_rp_tsmc_40_dff_nreset_s1_b``bits dff(.clk_i \
... |
#include <bits/stdc++.h> struct IO { static const int L = 1000000; char a[L], b[L], *s, *t, *p, c; IO() : p(b) {} ~IO() { fwrite(b, 1, p - b, stdout); } char gc() { if (s == t) t = (s = a) + fread(a, 1, L, stdin); return *s++; } void gs(char* st) { for (c = gc(); !isgraph... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.