text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> long long int dx[] = {-2, -2, -1, 1, 2, 2, 1, -1}; long long int dy[] = {-1, 1, 2, 2, 1, -1, -2, -2}; using namespace std; bool comp(long long int x, long long int y) { return abs(x) > abs(y); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int te... |
/**
* 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... |
// Constructs a frame given the data to transmit. Saves writing this
// assignment in three separate places.
//
function [10:0] framed;
input [7:0] data;
// One START bit, LOW. 8 data bits and two STOP bits, HIGH. LSB on RHS
framed = {2'b11, data, 1'b0};
endfunction
module UART (
clk,
reset, // To ... |
#include <bits/stdc++.h> using namespace std; string s; char ok[100] = { A , H , I , M , O , T , U , V , W , X , Y }; int main() { while (cin >> s) { if (s.length() == 1) { int flag = 0; for (int i = 0; i <= 10; i++) { if (s[0] == ok[i]) { puts( YES ); ... |
/**
* 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, K, P[105]; int main() { scanf( %d %d %d , &N, &M, &K); for (int i = 0; i < K; i++) scanf( %d , &P[i]); int ans = 0; for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { int x; scanf( %d , &x); int idx; ... |
/*******************************************************************************
* 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 ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2014 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
reg [63:0] crc;
... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, ans = 0; cin >> n >> m; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { int a, b; cin >> a >> b; ; if (a == 1 || b == 1) ans++; } cout << ans; return 0; } |
#include <bits/stdc++.h> #define ll long long int #define ii pair<int,int> #define int long long int using namespace std; const int inf = 0x3f3f3f3f; int32_t main() { int t; scanf( %lld ,&t); while(t--) { int n, m, x; scanf( %lld%lld%lld ,&n,&m,&x); --x; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m, b, mn1 = 1000000, mn2 = 0, temp; cin >> n >> m >> b; for (int i = 0; i < n; i++) { int x; cin >> x; mn1 = min(mn1, x); } for (int i = 0; i < m... |
#include <bits/stdc++.h> using namespace std; int main() { int t_; cin >> t_; while (t_--) { int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } int turns = 0; int alice = 0; int bob = n - 1; int alice_candies = 0;... |
// file: dcm.v
//
// (c) Copyright 2008 - 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
// laws.
//
// DISCLAIMER
// This disclaimer is not a licens... |
//****************************************************************************/
// Arty CM0 "DesignStart"
// RTL IMPLEMENTATION, Synchronous Version
//
// Copyright (C) yyyy Ronan Barzic -
// Date : Tue Nov 17 16:37:55 2015
//
// This program is free software; you can redistribute it and/or
// modif... |
#include <bits/stdc++.h> using namespace std; long long n, m, a[1000005], ans = 0; inline long long read() { long long red = 0, f_f = 1; char ch = getchar(); while (ch > 9 || ch < 0 ) { if (ch == - ) f_f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) red = red * 10 + ch... |
/**
* 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... |
//altiobuf_out CBX_AUTO_BLACKBOX="ALL" CBX_SINGLE_OUTPUT_FILE="ON" DEVICE_FAMILY="Cyclone V" ENABLE_BUS_HOLD="FALSE" NUMBER_OF_CHANNELS=1 OPEN_DRAIN_OUTPUT="FALSE" PSEUDO_DIFFERENTIAL_MODE="TRUE" USE_DIFFERENTIAL_MODE="TRUE" USE_OE="FALSE" USE_OUT_DYNAMIC_DELAY_CHAIN1="FALSE" USE_OUT_DYNAMIC_DELAY_CHAIN2="FALSE" USE_TE... |
#include <bits/stdc++.h> using namespace std; template <typename _T> inline void read(_T &f) { f = 0; _T fu = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) { fu = -1; } c = getchar(); } while (c >= 0 && c <= 9 ) { f = (f << 3) + (f << ... |
#include <bits/stdc++.h> using namespace std; void c_p_c() {} int main(int argc, char const *argv[]) { c_p_c(); ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int n; string arr; cin >> n >> arr; int cnt = 0; if (n == 1) { cout << cnt << endl; cout << arr <<... |
//======================================================================
//
// blockmem2r1w.v
// --------------
// Synchronous block memory with two read ports and one write port.
// The data size is the same for both read and write operations.
//
// The memory is used in the modexp core.
//
//
// Author: Joachim Strom... |
/**
* 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 M = (int)1e5 + 5; int n; int a[M]; int q, ans[M]; vector<pair<int, int> > ps[M]; int pas[M], las[M], llas[M], mfr[M]; struct SEGMENT1 { int val[M * 4]; void update(int L, int R, int p, int l, int r, int v) { if (L == l && R == r) { ... |
module test ;
wire a;
reg sel,in0, in1;
reg error;
assign a = sel ? in1 : in0 ;
initial
begin
error = 0;
#1;
sel = 0;
in0 = 0;
in1 = 0;
#1;
if(a !== 0)
begin
$display("FAILED - (1) Mux error sel=0, in0=in0=0 yet out != 0");
$display("sel=%b,in0=%b,in1=%b,out=%... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 17; int n; vector<int> adj[(1 << MAX_N) + 9]; bool used[(1 << MAX_N) + 9]; int cnt[(1 << MAX_N) + 9]; vector<int> vRoot; vector<int> ans; void buildCnt(int x) { used[x] = true; cnt[x] = 1; for (int y : adj[x]) { if (!use... |
#include <bits/stdc++.h> int main(void) { int n, m; char g[1000][1000]; int min_row = 1000, max_row = -1; int min_col = 1000, max_col = -1; scanf( %d %d , &n, &m); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { scanf( %c , &g[i][j]); if (g[i][j] == B ) { ... |
`ifndef _SPI_MASTER_V
`define _SPI_MASTER_V
module spi_master #(
parameter CLK_DIVIDE=3 // divide clk by 2^CLK_DIVIDE to get spi_sclk
) (
input clk, // 50 MHz system clk
input reset,
input spi_start,
input [7:0] spi_data,
output spi_fin,
output spi_csn,
output spi_sdo,
... |
#include <bits/stdc++.h> int main() { int t, s, q; scanf( %d %d %d , &t, &s, &q); int j = 0; while (s < t) { s *= q; j++; } printf( %d n , j); return 0; } |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5; vector<int> G[MAXN + 5]; int maxFrom[MAXN + 5], down[MAXN + 5], up[MAXN + 5]; int id[MAXN + 5], sz[MAXN + 5], diam[MAXN + 5]; bool flag[MAXN + 5]; int ID; int n, m, Q; map<int, int> cnt; vector<int> accSum[MAXN + 5]; vector<double... |
#include <bits/stdc++.h> using namespace std; void solve() { long long int n, m, k, kk, x, y; cin >> n >> m >> k; kk = k; long long int a[m]; for (long long int i = 0; i < m; i++) a[i] = 9999999999; for (long long int i = 0; i < n; i++) { cin >> x >> y; a[x - 1] = min(a[x - 1], y... |
#include <bits/stdc++.h> using namespace std; long long int gcd(long long int a, long long int b) { return b == 0 ? a : gcd(b, a % b); } long long int power(long long int x, long long int n) { long long int result = 1; while (n > 0) { if (n % 2 == 1) result = (result * x) % 1000000007; x... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n; cin >> n; vector<pair<long long, long long> > p; for (long long i = 0; i < n; i++) { double x, y; cin >> x >> y; p.push_back(make_pair(x, y)); } ... |
module mojo_top(
// 50MHz clock input
input clk,
// Input from reset button (active low)
input rst_n,
// cclk input from AVR, high when AVR is ready
input cclk,
// Outputs to the 8 onboard LEDs
output[7:0]led,
// AVR SPI connections
output spi_miso,
input spi_ss,
input sp... |
#include <bits/stdc++.h> using namespace std; struct masivs { long long in; long long out; long long poz; }; masivs mas[100005]; long long i, j, k, n, m, a, b, c; vector<pair<pair<long long, long long>, long long> > ab; int main() { std::cin.sync_with_stdio(false); std::cin.tie(0); ... |
#include <bits/stdc++.h> using namespace std; int n; vector<int> v[1010]; int main() { scanf( %d , &n); for (int i = 0; i < n; ++i) { int aux, aux2; scanf( %d , &aux); for (int j = 0; j < aux; ++j) { scanf( %d , &aux2); v[i].push_back(aux2); } sort(v[i].begi... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const int N = 1e5 + 1; int n, m; vector<int> adj[N]; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int rand(int x) { return uniform_int_distribution<int>(0, x - 1)(rng); } int d[N]; bool inq[N]; bool ... |
#include <bits/stdc++.h> using namespace std; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); mt19937 rnf(2106); const int N = 1000006, INF = 1000000009; int n; int a[N]; int dp[N][2]; int p[N][2]; void minh(int& x, int& px, int y, int u) { if (y < x) { x = y; px =... |
/*
* 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 mod = 998244353; const int N = 132007; int n, a, b; int rev[N], fac[N], finv[N], f[N], g[N], h[N]; inline int qpow(int x, int k, int r = 1) { for (; k; k >>= 1, x = 1ll * x * x % mod) if (k & 1) r = 1ll * r * x % mod; return r; } inli... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast,unroll-loops,no-stack-protector ) using namespace std; int n, k, nrr = 1, t[502 * 1005]; string s; struct point { double x, y; int ind; point() {} point(const point& a) { x = a.x, y = a.y; ind = a.ind; } point(double _x, ... |
#include <bits/stdc++.h> using namespace std; const long double EPS = 1E-9; const int INF = (int)1E9; const long long INF64 = (long long)1E18; const long double PI = 2 * acos(.0); int main() { bool cumple[1005]; for (int i = 0; i < (int)(1005); i++) cumple[i] = false; string word; cin >> wor... |
//-----------------------------------------------------
// Design Name : hw1_A_testbench
// File Name : hw1_A_testbench.v
// Function : This program will test hw1_A.v
// Coder : hydai
//-----------------------------------------------------
`timescale 1 ns/1 ns
`include "hw1_A.v"
module hw1_A_testbench ;
reg [15:0] ... |
module top;
reg pass = 1'b1;
reg in;
wire bf1, bf2, nt1, nt2, pd1, pd2, pu1, pu2;
initial begin
// $monitor(bf1, bf2,, nt1, nt2,, pd1, pd2,, pu1, pu2,, in);
#1;
if (bf1 !== 1'bx && bf2 !== 1'bx) begin
$display("Buffer failed, expected 2'bxx, got %b%b", bf1, bf2);
pass = 1'b0;
end
... |
#include <bits/stdc++.h> inline long long read() { char c; long long x; for (c = getchar(); !isdigit(c); c = getchar()) ; for (x = 0; isdigit(c); c = getchar()) { x = x * 10 + c - 0 ; } return x; } const int N = 2e5 + 5; int n, q, d[N], f[N]; long long a[N], b[N], c[N], s[... |
// Double-input register (Reconfigurable Computing Lab 0 Problem 3)
// Author: Mark Blanco
// Date: 8/4/2017
module register(
ridxA,
widxA,
wdataA,
weA,
ridxB,
widxB,
wdataB,
weB,
clk,
reset,
rdataA,
rdataB
);
// Inputs:
input wire [4:0] ridxA; // Read index
input wire [4:0] wi... |
#include <bits/stdc++.h> using namespace std; int fastMax(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ y; } int fastMin(int x, int y) { return (((y - x) >> (32 - 1)) & (x ^ y)) ^ x; } void solve() { long long int x, y, z; cin >> x >> y >> z; long long int x1, y1, z1; cin >> x1 >> y... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
#include <bits/stdc++.h> using namespace std; int f[100001], d[40], sor[100001]; int n, kq; bool solve(int a, int b, int &x, int &y) { if (a % 2 != b % 2) return false; y = (a + b) / 2; x = (a - b) / 2; return true; } int main() { scanf( %d , &n); kq = -1; for (int i = 3; i < n +... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e6 + 7; struct node { long long l, r, i; }; bool cmp(node &a, node &b) { return a.l < b.l; } int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long t; t = 1; cin >> t; while (t--) { ... |
#include <bits/stdc++.h> using namespace std; vector<string> s; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; s.resize(n); for (int i = 0; i < n; i++) { cin >> s[i]; } int ans = 0; for (int i = 0; i < 7; i++) { int cnt = 0;... |
#include <bits/stdc++.h> using namespace std; void think() { long long n, m; cin >> n >> m; vector<long long> v(n); for (long long i = 0; i < n; i++) { cin >> v[i]; } long long ans = 0; for (long long i = 0; i < m; i++) { long long x, y; cin >> x >> y; ans += min(... |
// part of NeoGS project
//
// (c) NedoPC 2007-2013
//
// this is dma "one-shot" fifo: after each 512 bytes both written and read back, it must be initialized by means of 'init'
//
module dma_fifo_oneshot(
input wire clk,
input wire rst_n,
input wire wr_stb, // write strobe: writes data from wd to ... |
#include <bits/stdc++.h> using std::cin; using std::cout; struct Item { int parent; int count; }; int Find(int x, std::vector<Item>* items) { if (items->at(x).parent == x) { return x; } return items->at(x).parent = Find(items->at(x).parent, items); } void Unite(int x, int y, std:... |
// Name: WcaReadByteReg.v
//
// Copyright(c) 2013 Loctronix Corporation
// http://www.loctronix.com
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the Lice... |
// MBT 7/7/2016
//
// 1 read-port, 1 write-port ram
//
// reads are synchronous
//
// although we could merge this with normal bsg_mem_1r1w
// and select with a parameter, we do not do this because
// it's typically a very big change to the instantiating code
// to move to/from sync/async, and we want to reflect this.
... |
// megafunction wizard: %RAM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: memoria.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ============================... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 09:28:18 08/24/2011
// Design Name:
// Module Name: q15_add
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depende... |
/*
* 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; int ls, cc; char s[1111111], a[1111111]; int main() { gets(s), ls = strlen(s), cc = 0, a[0] = # ; for (int i = 0; i < ls; ++i) { a[++cc] = s[i]; while (cc > 1 && a[cc - 1] != a[cc]) cc -= 2; } for (int i = 1; i <= cc; ++i) putchar(a[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; const int MAXN = 2e5 + 10; long long spf[MAXN]; long long min1[MAXN]; long long min2[MAXN]; void sieve() { spf[1] = 1; for (int i = 2; i < MAXN; i++) spf[i] = i; for (int i = 4; i < MAXN; i += 2) spf[i] = 2; for (int i = 3; i * i < MAXN; i++) { ... |
#include <bits/stdc++.h> using namespace std; const long long MAXN = 1e5 + 5; char C[MAXN][20][20]; long long aans[MAXN]; struct node { long long u, v, val, way; node() {} node(long long a, long long b, long long c) { u = a; v = b; val = c; } }; vector<node> v; vector<i... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12:59:33 04/09/2015
// Design Name:
// Module Name: GCD
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Rev... |
#include <bits/stdc++.h> using namespace std; const int N = 2005; bool can = 1; char arr[N][N]; int n, m, vis[N][N], dp[N][N]; bool valid(pair<int, int> a) { return min(a.first, a.second) > -1 && a.first < n && a.second < m && arr[a.first][a.second] != # ; } pair<int, int> get_next(pair<... |
#include <bits/stdc++.h> using namespace std; const int INF = 2e9; int n; pair<int, int> p[25]; int dis[25][25]; int dp[1 << 24 | 1]; int pre[1 << 24 | 1]; int main() { scanf( %d%d%d , &p[0].first, &p[0].second, &n); for (int i = 1; i <= n; ++i) { scanf( %d%d , &p[i].first, &p[i].second); ... |
#include <bits/stdc++.h> using namespace std; struct point { double x, y; point() { x = y = 0.0; } point(double A, double B) { x = A, y = B; } double operator*(point B) { return x * B.x + y * B.y; } point turn(double A) { return point(x * cos(A) - y * sin(A), y * cos(A) + x * sin(A)); ... |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright 2010-2012 by Michael A. Morris, dba M. A. Morris & Associates
//
// All rights reserved. The source code contained herein is publicly released
// under the terms and conditions of the GNU Lesser Public License. No part of... |
#include <bits/stdc++.h> using namespace std; const long long maxx = 1e6 + 7; const long long maxn = 1e6 + 7; const long long mod = 998244353; const long long maxs = 500000 + 7; const long long maxm = 400000 + 7; const long long maxk = 1008 + 7; const long long maxw = 100 + 7; const long long maxh = 1... |
//----------------------------------------------------------------------
// Title : Demo testbench
// Project : Virtex-5 Embedded Tri-Mode Ethernet MAC Wrapper
// File : configuration_tb.v
// Version : 1.8
//-----------------------------------------------------------------------------
//
// (c) Copyrig... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long a[n]; for (int i = 0; i < n; ++i) { cin >> a[i]; while (a[i] % 2 == 0) a[i] /= 2; while (a[i] % 3 == 0) a[i] /= 3; } int flag = 0; for (int i = 1; i < n; ++i) { if (a[i] != a[0])... |
#include <bits/stdc++.h> using namespace std; long n, k, ar[200000]; long long reach[777777]; long long q; long long ans[777777]; multiset<long long> bst; multiset<long long>::iterator it; int main() { ios_base::sync_with_stdio(0); cin >> n >> k; for (int i = 1; i <= n; i++) cin >> ar[i]; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); string s1; cin >> s1; string s2; cin >> s2; string s3; cin >> s3; vector<pair<char, int> > cnt(26); for (int i = int(0); i < int(int(s1.size())); i++) { char c = s1[i]; ... |
//-------------------------------------------------------------------
//
// COPYRIGHT (C) 2011, VIPcore Group, Fudan University
//
// THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WI... |
/**
* 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; void hi() { static long long i = 0; cout << Check Point : << ++i << n ; return; } signed main() { ios::sync_with_stdio(0); cin.tie(0); long long t; t = 1; while (t--) { string str; cin >> str; long long n = str.... |
// This tests SystemVerilog casting support
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Iztok Jeras.
// Extended by Maciej Suminski
module test();
// variables used in casting
byte var_08;
shortint var_16;
int var_32;
longint var_64... |
/**
* 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 ans, heavy; string s; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> s; for (int i = 0; i <= (int)s.size() - 5; i++) { if (s.substr(i, 5) == heavy ) { heavy++; } else if (s.substr(i, ... |
#include <bits/stdc++.h> using namespace std; long long n, pos, ans = 10000000000000000; long long a[3000 + 5], b[3000 + 5], f[3000 + 5][3000 + 5], Min[3000 + 5]; long long read() { char c; long long x = 0, f = 1; c = getchar(); while (c > 9 || c < 0 ) { if (c == - ) f = -1; c = ... |
#include <bits/stdc++.h> using namespace std; long long inf = 2147483647; const long long ll = 9223372036854775807, ninf = 1000000000; const double eps = 1e-6; const long long nll = 1000000000000000000; vector<int> node[200005]; vector<int> num; int deg[200005] = {}; void dfs(int x) { for (int i =... |
/*
*
* Copyright (c) 2013
*
*
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the ... |
// 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9
// 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0 5 0
//----------------------------------------------------------------------------------------
//
// The MIT License (MIT)
// Copyright (c) 20... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n + n - 1); int sum = 0; for (int i = 0; i < n + n - 1; i++) { cin >> a[i]; sum += a[i]; } sort(a.begin(), a.end()); for (int i = 0; i < n + n - 2; i += 2) { if (a[i] < 0 && a[... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_io_ddr_impctl_pulldown.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 redistr... |
#include <bits/stdc++.h> using namespace std; int mod; struct EDGE { int to, nxt; } box[101000 * 2]; int h[101000], top, f1[101000], f2[101000]; void add(int u, int v) { box[top].to = v; box[top].nxt = h[u]; h[u] = top++; } int dp[610][610]; int dfs(int a, int b) { if (dp[a][b] + 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; struct edge { long long a, b, w, ind; }; const int LEN = 100100; const long long INF = 100000000000000; int n, m, s, t, use[LEN], use1[LEN], ans[LEN], timer, tin[LEN], fup[LEN]; vector<edge> ar[LEN], ar1[LEN], ar2[LEN]; edge ed[LEN]; long long dist[LEN... |
#include <bits/stdc++.h> using namespace std; int main() { int a[3], b[3]; int k, d; cin >> a[0] >> a[1] >> a[2] >> k; for (int i = 0; i < 3; i++) { a[i]--; b[i] = 0; } sort(a, a + 3); for (int i = 0; i < 3; i++) { d = k / (3 - i); for (int j = i; j < 3; j++) { ... |
/**
* 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.02.2016 16:25:28
// Design Name:
// Module Name: SPI_SLAVE
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Rev... |
#include <bits/stdc++.h> using namespace std; int l[50000]; int p[50000]; pair<pair<double, int>, int> prod[50000]; int main() { std::ios_base::sync_with_stdio(false); int n; cin >> n; for (int i = 0; i < n; i++) { cin >> l[i] >> p[i]; if (p[i] == 100) prod[i].first.first =... |
// Copyright (c) 2000-2012 Bluespec, Inc.
// 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, pub... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); long long n; cin >> n; vector<pair<long long, long long>> a((size_t)n); for (long long i = 0; i < n; i++) { cin >> a[i].first; a[i].second = i; } sort(a.rbegin()... |
/*
########################################################################
MASTER ENABLE, CLOCKS, CHIP-ID
########################################################################
*/
`include "elink_regmap.v"
module ecfg_elink (/*AUTOARG*/
// Outputs
txwr_gated_access, etx_soft_reset, erx_soft_reset, clk_c... |
module sram_ctrl_a(
input clk,
input clr,
input go,
input halt,
output reg we,
output [17:0] sram_addr,
output [2:0] pattern,
output reg en
);
reg[2:0] state;
parameter START = 4'b0000, ADDROUT = 4'b0001, DATAOUT = 4'b0010,
WRITE = 4'b0011, TEST1 = 4'b0100, WAIT_AND_GO = 4'b0101, READ = 4'b0110,
TEST2 = 4'b0... |
/**
* 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 maxn = 5e5 + 5; int n, k, a[maxn], b[maxn]; void work(long long g); long long as, ct; int main() { scanf( %d%d , &n, &k); for (int i = 1; i <= n; i++) scanf( %d , a + i); for (int i = 1; i <= n; i++) scanf( %d , b + i); long long l = 0,... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:20:54 03/06/2016
// Design Name: sumcomp4
// Module Name: C:/XilinxP/Practica1/sumcomp4_test.v
// Project Name: Practica1
// Target Device:
// Tool v... |
#include <bits/stdc++.h> using namespace std; int N; pair<int, int> P[105]; int main() { cin >> N; for (int i = 1; i <= N; i++) cin >> P[i].first >> P[i].second; int K; cin >> K; for (int i = 1; i <= N; i++) if (K >= P[i].first && K <= P[i].second) { cout << N - i + 1 << n ; ... |
module tb_comm_fpga_fx2_v1_stub;
reg clk_in;
reg reset_in;
wire fx2FifoSel_out;
reg [7:0] fx2Data_in;
wire [7:0] fx2Data_out;
wire fx2Data_sel;
wire fx2Read_out;
reg fx2GotData_in;
wire fx2Write_out;
reg fx2GotRoom_in;
wire fx2PktEnd_out;
wire [6:0] chanAddr_out;
wire [7:0] h2fData_out;
wire h2fValid_out;
reg h2fReady... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.