text stringlengths 59 71.4k |
|---|
/**
* 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; cin >> n; int arr[n], brr[n]; for (int i = 0; i < n; ++i) { cin >> arr[i] >> brr[i]; } for (int i = 0; i < n; ++i) { if (arr[i] != brr[i]) { cout << rated ; return 0; } } for (int i =... |
`include "StateTable.v"
module L1_Cache_Controller (
input clk,
input rst,
// Interface to CPU-side components.
input cache_cs,
input cache_we,
output cache_ack,
// Interface to the internal components.
input cache_hit,
output reg sram_we,
input cache_valid,
input cache_dirty_i,
output... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } long long s = 0; for (int i = 0; i < n; i++) { s = s + a[i]; if (s < 0) s = ... |
#include <bits/stdc++.h> int main() { int arr[1000], n, i, j, k, counter = 99999999, x, y; scanf( %d , &n); for (i = 0; i < n; ++i) { scanf( %d , &arr[i]); } for (j = 1; j < n; ++j) { for (k = j - 1; k < j; ++k) { if (abs(arr[j] - arr[k]) < counter) { counter = abs(ar... |
/**
* 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... |
// --------------------------------------------------------------------------------
//| Avalon Streaming Channel Adapter
// --------------------------------------------------------------------------------
`timescale 1ns / 100ps
module ik_swift_master_0_p2b_adapter (
// Interface: clk
input ... |
//altpll bandwidth_type="AUTO" CBX_DECLARE_ALL_CONNECTED_PORTS="OFF" clk0_divide_by=10000 clk0_duty_cycle=50 clk0_multiply_by=1 clk0_phase_shift="0" compensate_clock="CLK0" device_family="Cyclone IV E" inclk0_input_frequency=20000 intended_device_family="Cyclone IV E" lpm_hint="CBX_MODULE_PREFIX=brightness_clk_2hz" ope... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2015 Xilinx, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//... |
#include <bits/stdc++.h> using namespace std; long long po(long long a, long long x, long long m) { if (x == 0) { return 1; } long long ans = 1; long long k = 1; while (k <= x) { if (x & k) { ans = ((ans * a) % m); } k <<= 1; a *= a; a %= m; } ... |
#include <bits/stdc++.h> using namespace std; int n, m, q; int arr[26]; string s; long long dp[1001][1001]; int mn = 1 << 20, mx = 0; long long solve(int idx, int sz, int mn) { if (sz > mn) return 0; mx = max(mx, sz); if (idx == n) return 1; if (dp[idx][sz] != -1) return dp[idx][sz] % 1000... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Case Western Reserve University
// Engineer: Matt McConnell
//
// Create Date: 00:28:00 01/29/2017
// Project Name: EECS301 Digital Design
// Design Name: Lab #4 Project
// Module Name: ... |
// Three basic tests in here:
// 1. byte must be initialised before any initial or always block
// 2. assignments to (unsigned) bytes with random numbers
// 3. assignments to (unsigned) bytes with random values including X and Z
module ibyte_test;
parameter TRIALS = 100;
parameter MAX = 'h7fffffff_ffffffff;
reg... |
//*****************************************************************************
// (c) Copyright 2008-2009 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
// ... |
/* ****************************************************************************
This Source Code Form is subject to the terms of the
Open Hardware Description License, v. 1.0. If a copy
of the OHDL was not distributed with this file, You
can obtain one at http://juliusbaxter.net/ohdl/ohdl.txt
Description: mor1kx ... |
/*
* 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> long long n, t, ans; short i, j, k; char cnt, l; long long C[43][43]; int main() { scanf( %I64d %I64d , &n, &t); for (i = 0; (1ll << i) < t; ++i) ; if ((1ll << i) ^ t) { puts( 0 ); return 0; } k = i + 1; for (i = 0; i < 43; ++i) C[0][i] = 1ll;... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n, ar[N]; char mark[N] = {}; int sz[N] = {}; priority_queue<pair<int, int>, vector<pair<int, int> > > pq; int main(void) { cin.tie(0); ios::sync_with_stdio(0); cin >> n; for (int i = 0; i < n; ++i) cin >> ar[i]; f... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e2 + 10; bool vis[maxn]; int main() { int n, k; cin >> n >> k; for (int i = 0; i < n; i++) { int x; cin >> x; vis[x] = true; } int ans = 0; for (int i = 0; i < k; i++) if (!vis[i]) ans++; if (vis[... |
#include <bits/stdc++.h> using namespace std; template <int MOD_> struct modnum { static constexpr int MOD = MOD_; static_assert(MOD_ > 0, MOD must be positive ); private: using ll = long long; int v; static int minv(int a, int m) { a %= m; assert(a); return a == 1 ? 1... |
//
// Author: Pawel Szostek ()
// Date: 01.08.2011
`timescale 1ns/1ps
module count_ones_v(input [15:0] vec, output reg [4:0] count);
integer i;
integer result;
always @(vec) begin
result = 0;
for (i=15; i>=0; i=i-1) begin
if(vec[i] == 1'b1) begin
result = result ... |
/* SD Card controller module. Allows reading from and writing to a microSD card
through SPI mode.
// MicroSD SPI/SD Mode/Nexys 4
// 1: Unused / DAT2 / SD_DAT[2]
// 2: CS / DAT3 / SD_DAT[3]
// 3: MOSI / CMD / SD_CMD
// 4: VDD / VDD / ~SD_RESET
// 5: SCLK / SCLK / SD_SCK
// 6: GND / GND / -
// 7: MISO / DAT0 / ... |
/*
* 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> #define LL long long #define ULL unsigned long long #define P pair<int,int> #define PI acos(-1.0) #define ls o<<1 #define rs o<<1|1 using namespace std; const int mod=1e9+7; const int base=19260817; const LL INF=1e18; const int maxn=2e5+10; const double eps=1e-8; i... |
#include <bits/stdc++.h> using namespace std; int used[110]; int v[110][110]; vector<int> ans; int main() { int n, x; memset(used, 0, sizeof(used)); cin >> n; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { cin >> x; if (x == 1) { used[i] = 1; ... |
#include <bits/stdc++.h> using namespace std; long long int arrx[100]; long long int arry[100]; long long int arr[10000]; map<long long int, bool> M; void parr(long long int a[], long long int n); int main() { long long int x, y, l, r, ss, siz, sizx, sizy, mulx, muly, start, ans, fin, ran, tem... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: franp.com
// Engineer: Fran Pregernik <>
//
// Create Date: 12/30/2016 10:48:02 AM
// Design Name:
// Module Name: azimuth_signal_generator
// Project Name:
// Target Devices:
// Tool Versions:
// Descrip... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1000000001; const long long maxg = 4444444444LL; vector<long long> g; void recurs(int d, int len, long long z) { if (d == len) g.push_back(z); else { recurs(d + 1, len, z * 10 + 4); recurs(d + 1, len, z * 10 + 7); ... |
#include <bits/stdc++.h> using namespace std; int n, leaf; vector<int> vt[100005]; int ara[100005], chk[100005], level[100005], child[100005]; map<int, int> mp; void bfs() { int i, j, k; queue<int> qu; qu.push(0); chk[0] = 1; level[0] = 0; while (!qu.empty()) { k = qu.front(); ... |
`timescale 1ps / 1ps
module select
#(
parameter M =128,
parameter W =7
)
(
clk,
rst,
read_adr,
read_data,
write_adr,
write_data,
write_en,
write_adr2,
write_data2,
write_en2,
write_adr3,
write_data3,
write_en3
);
function integer log2;
input [31:0] value;
reg [31:0] temp;
b... |
#include <bits/stdc++.h> using namespace std; int main() { int m; cin >> m; int c[m]; int sum1 = 0; for (int i = 0; i < m; i++) { cin >> c[i]; sum1 += c[i]; } int x, y; cin >> x >> y; int flag = 0; int k = 1; int sum2 = 0; if (sum2 >= x && sum2 <= y && sum... |
#include <bits/stdc++.h> using namespace std; struct vac { int l, r, cost, duration; vac() : cost(-1) {} vac(int l, int r, int cost) : l(l), r(r), cost(cost), duration(r - l + 1) {} }; vector<vector<vac> > lifes(200001, vector<vac>(0)), deaths(200001, vector<vac>(0)); vector<vac> cheapest(20... |
module note_pitch2dds(clk, note, pitch, lfo_sig, lfo_depth, lfo_depth_fine, adder);
input wire clk;
input wire [6:0] note;
input wire [13:0] pitch;
input wire [7:0] lfo_sig;
input wire [6:0] lfo_depth;
input wire [6:0] lfo_depth_fine;
output reg [31:0] adder;
//нота 7 нот. добавим еще 8 байт под дробную часть. 7+8 =... |
/**
* 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 int Nmax = 2e5 + 5; int A[Nmax], start[Nmax]; long long cnt[Nmax]; bool cycle[Nmax]; int go[Nmax], where[Nmax], visited[Nmax]; vector<int> active[Nmax], when[Nmax]; int zz[Nmax], ans[Nmax]; int nrcomp, n, q, Nr; vector<int> cyc[Nmax]; vector<int>... |
#include <bits/stdc++.h> using namespace std; const long long INF = 0x3f3f3f3f; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long test; test = 1; while (test--) { int a, b, c, d; cin >> a >> b >> c >> d; int misha = max((3 * a) / 10.0... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017
// Date : Fri Mar 24 22:16:07 2017
// Host : LAPTOP-IQ9G3D1I running 64-bit major releas... |
`include "defines.v"
module age_incr(
input `control_w control0_in,
input `control_w control1_in,
input `control_w control2_in,
input `control_w control3_in,
input `control_w control4_in,
input control4_ready,
input c... |
/**
* 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... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:01:37 04/27/2014
// Design Name: Image_viewer_top
// Module Name: /home/student/Dropbox/EE 201 Final Project/SynchronousRead/top_tb.v
// Project Name: Synchronous... |
/*
** -----------------------------------------------------------------------------**
** sensdcclk.v
**
** Frame-synchronous DC-DC converter clock
**
** Copyright (C) 2002 Elphel, Inc
**
** -----------------------------------------------------------------------------**
** This file is part of X313
** X313 i... |
#include <bits/stdc++.h> using namespace std; int in() { int a; scanf( %d , &a); return a; } double din() { double a; scanf( %lf , &a); return a; } int gcd(int a, int b) { while (b) { a %= b; swap(a, b); } return a; } int lcm(int a, int b) { return a / gcd... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: HW_SW.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ==================================... |
#include <bits/stdc++.h> using namespace std; #pragma GCC target( avx2 ) #pragma GCC optimization( O3 ) #pragma GCC optimization( unroll-loops ) bool isPrime(long long int n) { for (long long int i = 2; i * i <= n; i++) { if (n % i == 0) { return false; } } return true; } b... |
/*------------------------------------------------------------------------------
* 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... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; int n, t; cin >> t; while (t--) { cin >> n; for (int i = 0; i < n; i++) { cout << n - i << ; } cout << n ; } } |
//`include "../../firmware/include/fpga_regs_common.v"
//`include "../../firmware/include/fpga_regs_standard.v"
module rx_buffer_inband
( input usbclk,
input bus_reset,
input reset, // DSP side reset (used here), do not reset registers
input reset_regs, //Only reset registers
output [15:0] usbdata,
... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); long long q; cin >> q; for (long long t = 0; t < q; t++) { long long n, k; cin >> n >> k; vector<vector<long long>> adj((size_t)n); map<pair<long long, long long... |
/*
* 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 ... |
#include <bits/stdc++.h> using namespace std; const int N = 1500 + 5, INF = 2000 * 1000 * 1000; vector<pair<int, int> > li[N]; vector<int> adj[N]; pair<pair<int, int>, int> po[N]; pair<int, int> J; int d[N], out[N]; void dfs(const int &v, const int &pa) { d[v] = 1; for (int i = 0; i < (int)(adj[... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k, m, t; cin >> n >> k >> m >> t; while (t--) { int x, y; cin >> x >> y; if (x == 1) { if (y <= k) k++; n++; } else { if (y... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; for (int i = 0; i < k; i++) { if (n % 10 == 0) n = n / 10; else n--; } cout << n; } |
#include <bits/stdc++.h> using namespace std; int main() { int n, ans(0); cin >> n; int h[n], a[n]; for (int i = 0; i < n; i++) { cin >> h[i] >> a[i]; } for (int b = 0; b < n; b++) { for (int c = 0; c < n; c++) { if (c != b) { if (h[b] == a[c]) ans++; } ... |
#include <bits/stdc++.h> using namespace std; int main() { map<int, int, greater<int>> input; map<int, int, greater<int>> output; map<int, int, greater<int>> input_reverse; map<int, int, greater<int>> output_reverse; int N; scanf( %d , &N); ; int i = N; int index = 1; while (... |
#include <bits/stdc++.h> #pragma GCC optimize( fast-math ) #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC diagnostic ignored -Woverflow using namespace std; const short INF16 = ~(1 << 15); const int INF32 = 2e9 + 11; const int SZ = 4e5 + 11; const int SZ2 = int(1e6 + ... |
#include <bits/stdc++.h> using namespace std; const int N = 200005; struct node { int to, next; } p[N << 2]; int head[N], tot, n, now[N], du[N]; bool vis[N], isok; vector<pair<int, int> > a; void add(int x, int y) { p[++tot] = (node){y, head[x]}; head[x] = tot; p[++tot] = (node){x, head[... |
/**
* 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; double pi = acos(-1); void Open() {} long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } void PrintNumber(int n, int len) { if (!len) return; cout << (n & 1); } void PrintAllSubset(int n) { for (int i = 0; i < (1 << 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... |
/*
* 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; struct wall { double x, y; wall() {} wall(double x, double y) : x(x), y(y) {} }; struct tx { double d; int v; tx() {} tx(double d, int v) : d(d), v(v) {} }; bool cmp2(const tx& p1, const tx& p2) { return p1.d < p2.d; } bool cmp(cons... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used solely *
* for design, simulation, implementation and creation of design files *
* limited to Xilinx devices or technologies. Use with non-Xilinx ... |
/*
* Copyright (c) 2015-2016 The Ultiparc Project. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int a[N]; int main() { int T; scanf( %d , &T); while (T--) { int n; scanf( %d , &n); for (int i = 1; i <= n; ++i) { scanf( %d , &a[i]); } sort(a + 1, a + n + 1); int ans = a[1]; for... |
/**
* bsg_mem_1rw_sync_banked.v
*
* This module has the same interface/functionality as
* bsg_mem_1rw_sync.
*
* This module can be used for breaking a big SRAM block into
* smaller blocks. This might be useful, if the SRAM generator does not
* support sizes of SRAM that are too wide or too deep.
* It is... |
/*
* 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 sm (/*AUTOARG*/);
//==================== Constant declarations ==============
`include "autoasciienum_param.v"
//==================== Intermediate Variables =============
reg [3:0] /* synopsys enum En_C14ChipNum */ chip_r;
//==================== DEBUG ASCII CODE =================... |
#include <bits/stdc++.h> using namespace std; long long a[10], rest[10]; int n, res = 1e9, pre[10], tmp, size[10], flag = 0; vector<int> ve[10]; map<long long, long long> mp; int count(long long x) { if (mp[x]) return mp[x]; long long tmp = x; long long res = 0; for (long long i = 2; i * i <... |
#include <bits/stdc++.h> using namespace std; int main() { int n, minx = 999999, ans, df1, df2; char s[51]; scanf( %d , &n); getchar(); scanf( %s , s); for (int i = 0; i < n - 3; i++) { int t = 0; ans = 0; while (t <= 3) { int x = i + t; if (t == 0) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int pb, mb, bb, m; cin >> pb >> mb >> bb >> m; int s1 = 2 * pb; int temp = 2 * m; if (2 * m >= s1) { cout << -1 << endl; return 0; } int s2 = 2 * mb; if (2 * m >= s2) { cout << -1 << 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... |
#include <bits/stdc++.h> using namespace std; int a[1000000], psum[1000000]; map<long long, long long> mp, pp; vector<long long> v; int main() { std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; long long t; cin >> t; while (t--) { int n, k; cin >> n >> ... |
///////////////////////////////////////////////////////////////////////////////
// vim:set shiftwidth=3 softtabstop=3 expandtab:
// $Id: firewall 2014-07 $
//
// Module: firewall.v
// Project: Firewall DDoS
// Description: Modulo encargado de la deteccion y respuesta defensiva
// contra ataques DDoS HTTP G... |
#include <bits/stdc++.h> using namespace std; const int inf = 1 << 30; const int md = 1e9 + 7; const int N = 1e5 + 10; int n, m; int T; int k; long long p; long long q[N]; long long ar[N]; int now = -1; set<long long> se[N]; inline long long up(long long x, long long y) { long long re = x ... |
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 10; int mapp[110][110]; int b[110][110]; int main() { int Cas = 1; scanf( %d , &Cas); while (Cas--) { int n, m; scanf( %d%d , &n, &m); memset(mapp, 0, sizeof(mapp)); for (int i = 1; i <= n; i++) for... |
#include <bits/stdc++.h> using namespace std; int nx[10000][26], al[26], l1, l2; string s1, s2; int main() { cin >> s1 >> s2; l1 = s1.size(); l2 = s2.size(); for (int i = 0; i < l1; i++) fill(nx[i], nx[i] + 26, -1); fill(al, al + 26, -1); for (int i = l1 - 1; i >= 0; i--) al[s1[i] - a ]... |
#include <bits/stdc++.h> using namespace std; pair<int, int> dataarr[502]; int main() { int n; cin >> n; int minin = n, maxin = 0; for (int i = 1; i <= n; i++) { cin >> dataarr[i].first; dataarr[i].second = i; if (dataarr[i].first < minin) { ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1 + 9e6; const int inf = 0x3f3f3f; vector<bool> dp[24]; int n; int a[23]; vector<pair<int, int> > pre[23]; int ans; int main() { ios_base::sync_with_stdio(0); cin.tie(); cout.tie(); cin >> n; for (int i = 0; i < n; ++i)... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2009 by Iztok Jeras.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
localparam NO = 7; // number of access events
// packed structures
struct packed {
... |
`default_nettype none
`define WIDTH 16
module j4(
input wire clk,
input wire resetq,
output wire io_rd,
output wire io_wr,
output wire [15:0] mem_addr,
output wire mem_wr,
output wire [`WIDTH-1:0] dout,
input wire [`WIDTH-1:0] io_din, //note: this is always a cycle late, as io_addr_ is registered b... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> vt; for (int i = 0; i < n; i++) { int v; cin >> v; vt.push_back(v); } sort(vt.begin(), vt.end()); int ans = 0; int prev = vt[0]; for (int i = 1; i < n; i++) { int cur =... |
/*
* 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 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification... |
#include <bits/stdc++.h> int main() { long long int k, b, n, t, i; scanf( %I64d %I64d %I64d %I64d , &k, &b, &n, &t); double x = 1; for (i = 0; i < n && x <= t; i++) { x = k * x + b; } if (x > t) { printf( %I64d , n - i + 1); } else { printf( %I64d , n - i); } retu... |
//Legal Notice: (C)2006 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... |
#include <bits/stdc++.h> long long a[100][100]; using namespace std; struct DynamicDisjointSetDS { std::unordered_map<int, int> parent, degree; int N; DynamicDisjointSetDS(int n) { N = n; } int getParent(int vertex) { if (parent.find(vertex) != parent.end()) { if (parent[vertex] != v... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Muhammad Ijaz
//
// Create Date: 05/15/2017 11:04:33 AM
// Design Name:
// Module Name: FORWARDING_UNIT
// Project Name: RISC-V
// Target Devices:
// Tool Versions:
// ... |
#include <bits/stdc++.h> using namespace std; int arr[1000010]; char ch[1000010]; map<int, int> mp, mp1; vector<int> vec(1000010); int main() { int i, j, k, n, m, t, p, cas = 1; memset(arr, 0, sizeof arr); vec.clear(); mp.clear(); mp1.clear(); int cnt = 0, l = 0, r = 0; stack<int... |
#include <bits/stdc++.h> using namespace std; const long long INF = 9e18; const long long N = 2e5 + 5; const long long M = 1e9 + 7; bool chk(vector<long long> a, long long x, long long y) { long long A = 0, B = 0; for (long long i = 2; i < a.size(); i++) if (a[i] > a[i - 1] && a[i] > a[i + 1]) ... |
#include <bits/stdc++.h> using namespace std; const int N = 132674 + 10; int n, len[2]; int R[2][2 * N]; vector<pair<int, int> > open[2 * N], clos[2 * N]; struct Cord { int x1, asdioayseiowqe12, x2, y2; Cord() {} Cord(int x1, int asdioayseiowqe12, int x2, int y2) : x1(x1), asdioayseiowqe... |
#include <bits/stdc++.h> using namespace std; int N, K, P[2100], S[2100], ans[(int)4e6 + 100], cost = 0; int abs(int a) { return a > 0 ? a : -a; } void swap(int i, int j) { cost += abs(i - j); ans[++K] = i; ans[++K] = j; P[i] ^= P[j]; P[j] ^= P[i]; P[i] ^= P[j]; } stack<int> box; i... |
#include <bits/stdc++.h> using namespace std; const int N = (int)1e6 + 3; const long long INFF = (long long)1e18; int cnt[N]; bool ck[N]; int main() { for (int i = 2; i < N; i++) { if (ck[i]) continue; for (int j = i; j < N; j += i) ck[j] = true; cnt[i]++; if (i <= 1000) { ... |
#include <bits/stdc++.h> using namespace std; bitset<1005> b[1005]; int n, m; bool ok2(int r, int c) { if (r + 2 > n || c + 2 > n) return false; for (int i = r; i < r + 3; i++) for (int j = c; j < c + 3; j++) { if (!b[i].test(j)) return false; } return true; } bool ok(int r, ... |
/*
In this test a single IOBUF is controlled by switches. There is also one
input (connected to a LED) and one oputput (controlled by a switch) that.
can be used for verification of 3-state I/O.
This test requires a physical jumper to be installed on the Basys3 board.
Depending on which pins are connected we have diff... |
#include <bits/stdc++.h> using namespace std; int num[100010]; int l[100010], r[100010]; int tree[100010 << 2]; int lazy[100010 << 2]; vector<int> v[100010]; void build(int l, int r, int rt) { if (l == r) { tree[rt] = num[l]; lazy[rt] = 0; return; } int m = l + r >> 1; bu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.