text stringlengths 59 71.4k |
|---|
module vga_bw
(
CLOCK_PIXEL,
RESET,
PIXEL,
PIXEL_H,
PIXEL_V,
VGA_RED,
VGA_GREEN,
VGA_BLUE,
VGA_HS,
VGA_VS
);
input CLOCK_PIXEL;
input RESET;
input PIXEL; // black (0) or white (1)
output [10:0] PIXEL_H;
output... |
// -*- Mode: Verilog -*-
// Filename : sonic_single_port.sv
// Description : basic PHY with gearbox and blocksync
// Author : Han Wang
// Created On : Fri Apr 25 21:17:48 2014
// Last Modified By: Han Wang
// Last Modified On: Fri Apr 25 21:17:48 2014
// Update Coun... |
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995-2010 Xilinx, Inc. All rights reserved.
////////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor: Xilinx
// \ \ \/ Version : ... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:256000000 ) using namespace std; const int maxN = 110; int n, k, a[maxN]; void solve() { vector<vector<double> > d[2]; int u = 0, v = 1; d[u].assign(maxN, vector<double>(maxN, 0.0)); for (int i = 1; i <= n; ++i) { for (int j = i + ... |
#include <bits/stdc++.h> using namespace std; int b[101]; int main() { int n, x; cin >> n >> x; int a[n + 1]; for (int i = 1; i <= n; i++) { cin >> a[i]; b[a[i]]++; } int t = 0; for (int i = 0; i < x; i++) { if (b[i] == 0) { t++; } } if (b[x] == ... |
#include <bits/stdc++.h> using namespace std; using s64 = long long; const int M = 1000000007; int add(int a, const int &b) { a += b; return a >= M ? a - M : a; } int sub(int a, const int &b) { a -= b; return a < 0 ? a + M : a; } int mul(const int &a, const int &b) { return (s64)a * b % ... |
// Copyright (C) 1991-2013 Altera Corporation
// 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 from any of the foregoing
// (including device programming or simulation files), and any
// associated d... |
#include <bits/stdc++.h> using namespace std; bool arr[1001][1001]; struct node { int ct; int lastind; }; struct node1 { int ct; int lastind; }; node row[1001]; node1 col[1001]; int main() { vector<int> a; int n, i, x, y, j, temp; scanf( %d , &n); for (i = 0; i < n - 1;... |
#include <bits/stdc++.h> using namespace std; int const N = 1e5 + 13; int n, m; set<int> e[N]; set<pair<int, int> > q; int p[N]; int tin[N], cnt, w[N], ans; int gcd(int a, int b) { return (!a ? b : gcd(b % a, a)); } void init() { for (int i = 0; i < N; ++i) p[i] = i; } int find(int u) { if... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using PII = pair<ll, ll>; using piii = pair<pii, pii>; using Pi = pair<int, pii>; using Graph = vector<vector<int>>; const int dx[4] = {0, -1, 1, 0}; const int dy[4] = {-1, 0, 0, 1}; bool check(int x, 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 law... |
#include <bits/stdc++.h> using namespace std; int n; int main() { cin >> n; if (n <= 2) cout << -1; else while (n--) cout << n + 1 << ; return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { long long temp = 0; string s; cin >> s; for (int i = 0; i < s.length(); i++) { temp = temp * 16; if (s[i] == > ) temp += 8; else if (s[i] == < ) temp += 9; else if (s[i] == + ) temp += 10; ... |
// psi2c_readback.v
`timescale 1 ps / 1 ps
module psi2c_readback
(
input clk,
input sync,
input reset,
input go,
input rda,
input sync2,
input i2c_send,
output [31:0]d
);
reg rdaff;
always @(posedge clk or posedge reset) rdaff <= reset ? 0 : rda;
wire nto; // not timeout
wire last;
wire running;
... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2013(c) Analog Devices, Inc.
// Author: Lars-Peter Clausen <>
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, ... |
#include <bits/stdc++.h> using namespace std; int countbit(int n) { return (n == 0) ? 0 : (1 + countbit(n & (n - 1))); } int lowbit(int n) { return (n ^ (n - 1)) & n; } const double pi = acos(-1.0); const double eps = 1e-11; template <class T> T sqr(T x) { return x * x; } int n, m, k; int c[101]... |
`timescale 1ns / 1ps
module Controlador_Menu_Editor(
clk,
reset,
boton_arriba_in,
boton_abajo_in,
boton_izq_in,
boton_der_in,
boton_elige_in,
//boton_arriba, boton_abajo, boton_izq, boton_der, boton_elige,
text_red,
text_green,
text_blue,
char_scale,
es_mayuscula,
text_red_temp... |
#include <bits/stdc++.h> using namespace std; const long long MXN = 80 + 10; const long long MX5 = 4e5 + 10; const long long MX6 = 1e6 + 10; const long long LOG = 20; const long long INF = 8e18; const double eps = 1e-9; const long long MOD = 1e9 + 7; long long power(long long a, long long b, long long... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e5; long long pref1[N + 5]; long long pref2[N + 5]; long long ans; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, m, type, l, r; cin >> n; n++; int arr[n]; for (int i = 1;... |
#include <bits/stdc++.h> using namespace std; const int N = 4e5 + 10; int mod = 1e9 + 7; int qpow(int a, int b) { int ans = 1; for (; b >= 1; b >>= 1, a = (long long)a * a % mod) if (b & 1) ans = (long long)ans * a % mod; return ans; } long long ans[32]; int main() { int t; scanf... |
#include <bits/stdc++.h> using namespace std; string s[70010]; map<pair<int, int>, int> m; pair<int, int> ans[70010]; int main() { int k = 64, p = 5; int n, i, j, l; cin >> n; for (i = 1; i <= n; i++) cin >> s[i]; for (i = 1; i <= n; i++) for (j = 0; j < 9; j++) { int x = 0; ... |
`define ADDER_WIDTH 014
`define DUMMY_WIDTH 128
`define 3_LEVEL_ADDER
module adder_tree_top (
clk,
isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1,
sum,
);
input clk;
input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,... |
#include <bits/stdc++.h> using namespace std; char s[200010]; int n, k; int sa[200010]; int ra[200010], tr[200010]; int lcp[200010]; int l[200010], r[200010]; stack<int> ls, rs; set<long long> ss; bool CmpSa(int a, int b) { if (ra[a] != ra[b]) return ra[a] < ra[b]; int aa = a + k < n ? ra[a ... |
module bram1 #(
parameter ABITS = 8, DBITS = 8, TRANSP = 0
) (
input clk,
input [ABITS-1:0] WR_ADDR,
input [DBITS-1:0] WR_DATA,
input WR_EN,
input [ABITS-1:0] RD_ADDR,
output [DBITS-1:0] RD_DATA
);
localparam [ABITS-1:0] INIT_ADDR_0 = 1234;
localparam [ABITS-1:0] INIT_ADDR_1 = 4321;
localparam [ABITS-1:0] 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... |
/**
* 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; long long h, w, n; pair<long long, long long> a[2005]; long long fact[200005]; long long ifact[200005]; long long dp[2005]; long long exp(long long a, long long b) { if (b == 0) return 1; if (b == 1) return a; if (b % 2 == 0) { long long r = ... |
#include <bits/stdc++.h> using namespace std; struct node { long long s, mn, mx; }; node T[303030]; node operator+(node l, node r) { node x; x.s = l.s + r.s; x.mn = min(l.mn, l.s + r.mn); x.mx = max(l.mx, l.s + r.mx); return x; } int A[100009]; void init(int idx, int s, int e) { ... |
`timescale 1ns / 1ps
module Print(
input clk, // ʱÖÓÐźÅ
input [15:0] num, // ÒªÏÔʾµÄ4λÊý
input [3:0] flash, // 4λ, ÊÇ·ñÉÁ˸, 1 => true, 0 => false
output reg [7:0] display, // Êä³ö, 8λ¶ÎÑ¡¶Ë(CA, CB, CC, CD, CE, CF, CG, DP)
output reg [3:0] an // Êä³ö, 4λλѡ¶Ë
... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 00:24:21 12/06/2016
// Design Name:
// Module Name: vga_sync
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:... |
//--------------------------------------------------------------------------
// --
// OneWireMaster --
// A synthesizable 1-wire master peripheral --
// Copyrig... |
module top;
reg passed;
reg signed[95:0] m_one, m_two, zero, one, two;
// Both argument positive.
reg signed[95:0] rem;
wire signed[95:0] wrem = two / one;
// First argument negative.
reg signed[95:0] rem1n;
wire signed[95:0] wrem1n = m_two / one;
// Second argument negative.
reg signed[95:0] re... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t-- > 0) { int n; cin >> n; int a; int f[51] = {0}; for (int i = 0; i < 2 * n; i++) { cin >> a; if (f[a] == 0) { f[a]++; cout << a << ; } ... |
#include <bits/stdc++.h> using namespace std; int main() { int i, j, n, m, k; int h; while (scanf( %d%d%d , &n, &m, &h) != EOF) { int sum1, sum2; sum1 = sum2 = 0; for (i = 1; i <= m; i++) { scanf( %d , &k); if (i == h) sum1 = k; else sum2 += ... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2013 Altera Corporation, San Jose, California, USA. *
... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2017 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc=0;
reg [63:0] crc;
reg [63:0] sum;
// Take CRC data and apply ... |
#include <bits/stdc++.h> using namespace std; const int INF = int(1e9); const double EPS = 1e-5; const long long mod = ((long long)1e18) - 131; int n, m, ans = 0; set<string> h; string s; int main() { cin >> s; for (int i = 0; i < s.length(); i++) for (int j = i; j < s.length(); j++) { ... |
// Lab 4
// Created by David Tran
// Last Modified 02-05-2014
// extras
`timescale 1 ms /1 us
`include "four_bit_adder.v"
// Testbench Module
module four_bit_adder_tb (A0, A1, A2, A3, B0, B1, B2, B3,
output A0, A1, A2, A3, B0, B1, B2, B3, C0;
reg A0, A1, A2, A3, B0, B1, B2, B3, C0;
wire D0, D1, D2, D3, D4;
... |
#include <bits/stdc++.h> using namespace std; void prepare() {} void solve() { string s; cin >> s; set<int> ss[26]; for (int i = 0; i < s.size(); ++i) ss[s[i] - a ].insert(i); int i = 25; int cur = -1; while (i != -1) { if (ss[i].empty()) { --i; continue; }... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, m; cin >> n >> m; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int num : a) { m -= num; } if (m != 0) cout << NO << en... |
/*
# ZUMA Open FPGA Overlay
# Alex Brant
# Email:
# 2012
# LUTRAM wrapper
*/
`include "def_generated.v"
module elut_custom #(
parameter used = 0,
parameter [0:2**6-1] LUT_MASK={2**6{1'b0}}
) (
a,
d,
dpra,
clk,
we,
dpo,
qdpo_clk,
qdpo_rst,
qdpo);
input [5 : 0] a;
input [0 : 0] d;
input [5 : 0] dpra;
in... |
module top;
/***********
* Check parameters.
***********/
// Check parameter/parameter name issues.
parameter name_pp = 1;
parameter name_pp = 0;
parameter name_pl = 1;
localparam name_pl = 0;
localparam name_lp = 0;
parameter name_lp = 1;
localparam name_ll = 1;
localparam name_ll = 0;
... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2013(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// ar... |
//////////////////////////////////////////////////////////////////////////////
/// Copyright (c) 2012, Jahanzeb Ahmad
/// All rights reserved.
///
/// Redistribution and use in source and binary forms, with or without modification,
/// are permitted provided that the following conditions are met:
///
/// * Redistribu... |
#include <bits/stdc++.h> using namespace std; struct Team { string name; int fi, se, th; } t[60]; int cmp(Team a, Team b) { if (a.fi != b.fi) return a.fi > b.fi; else if (a.se != b.se) return a.se > b.se; else return a.th > b.th; } int main() { int n; cin >> n; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: TU Darmstadt
// Engineer: Florian Beyer
//
// Create Date: 17:38:52 02/23/2017
// Design Name:
// Module Name: tb_SpongentHash
// Project Name:
// Target Devices:
// Tool versions:
... |
#include <bits/stdc++.h> using namespace std; int main() { int A[101]; int B[101]; int n, k; cin >> n >> k; for (int i = 0; i < n; i++) cin >> A[i]; int t = n / k; for (int i = 0; i < k; i++) { int max1 = 0; int max2 = 0; for (int j = 0; j < t; j++) if (A[i + j ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; int a[11], b[11]; scanf( %d %d , &n, &m); for (int i = 0; i < n; i++) { scanf( %d , a + i); } for (int i = 0; i < m; i++) { scanf( %d , b + i); } sort(a, a + n); sort(b, b + m); for (int i = 0; i... |
#include <bits/stdc++.h> using namespace std; void CP() { ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL); return; } int main() { ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL); int n, m; cin >> n >> m; int a[n + 1]; a[1] = 1; for (i... |
#include <bits/stdc++.h> using namespace std; int read() { int x = 0, flag = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) flag = -1; ch = getchar(); } while (isdigit(ch)) { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar(); } return x * flag; ... |
`timescale 1 ns / 1 ps
module elink2_tb;
reg aclk;
reg aresetn;
reg start;
wire csysreq = 1'b0;
wire [1:0] done;
wire [1:0] error;
// Create an instance of the example tb
elink_testbench dut
(.aclk (aclk),
.aresetn (aresetn),
.csysreq ... |
/*
* 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> const size_t max_vertices = 1 << 16; int degree[max_vertices], xor_sum[max_vertices]; std::queue<int> queue; std::vector<std::pair<int, int>> result; int main() { int vcount = 0; std::cin >> vcount; for (int i = 0; i < vcount; i++) { std::cin >> degree[i] >> xor_sum[... |
#include <bits/stdc++.h> const int N = 65550; int ru[N], sum[N]; int n; int s[N], t[N], cc = 0; int main() { int i; scanf( %d , &n); for (i = 0; i < n; i++) scanf( %d%d , &ru[i], &sum[i]); for (i = 0; i < n; i++) { int now = i; while (ru[now] == 1) { cc++; s[cc] = n... |
// ctorng 2/22/2017
//
// 1 read-port, 1 write-port ram
//
// reads are synchronous
//
// Ports for tsmc16_2rw (sram_2p_uhde)
//
// CLK // in
// AA // in
// CENA // active low
// QA // out
//
// AB // in
// DB // in
// CENB // active low
// WENB // active low
//
// STOVAB// 1'b0 (is r... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[100 + 10][100 + 10]; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { cin >> a[i][j]; } } int sum = 0; for (int i = 0; i < n; i++) { sum += a[i][i]; } for (int i... |
// ICNBC functions
// Copyright (c) 2014 Dominic Spill, Tariq Bashir
// This file is part of Unambiguous Encapsulation
// License: GPL v2
//
`timescale 1ns/1ps
module tb_icnbc;
parameter N = 8;
parameter MIN_LD = 2;
parameter MEM_DEPTH=256;
reg clk;
reg rst;
reg [N-1:0] n;
reg start;
reg [N... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int gi() { int x = 0, o = 1; char ch = getchar(); while (!isdigit(ch) && ch != - ) ch = getchar(); if (ch == - ) o = -1, ch = getchar(); while (isdigit(ch)) x = x * 10 + ch - 0 , ch = getchar(); return x * o; } in... |
#include <bits/stdc++.h> using namespace std; template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << ; cerr << endl; } int main() { for (long long N, M; cin >> N >> M;) { for (int i = 0; i < (int)(N); ++i) { long long S, F, T; cin >> S >> F >> T; ... |
#include <bits/stdc++.h> using namespace std; int d[1005], s[1005], sufmax[1005], mxpos[1005], pred[1005]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, k; cin >> n >> k; ++n; for (int i = 1; i < n; ++i) cin >> d[i]; for (int i = 1; i < n; ++i) cin >> s[i]; for (int... |
//altera message_off 10230
module alt_mem_ddrx_list
# (
// module parameter port list
parameter
CTL_LIST_WIDTH = 3, // number of dram commands that can be tracked at a time
CTL_LIST_DEPTH = 8,
CTL_LIST_INIT_VALUE_TYPE = "INCR", // INCR, ZE... |
#include <bits/stdc++.h> using namespace std; int main() { double x, y; cin >> x >> y; double ans = (x * x + y * y) / (x * 2); ans -= x; printf( %.12lf , ans); return 0; } |
#include <bits/stdc++.h> using namespace std; int solveA(vector<int> a, vector<int> b) { int n = (int)((a).size()); vector<int> m(n); for (int i = (0); i <= ((n)-1); i++) m[b[i]] = i; for (int i = (0); i <= ((n)-1); i++) a[i] = m[a[i]]; b[0] = a[0]; for (int i = (1); i <= ((n - 1)); i++) b[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; struct Root { int p, c; long long e, x; vector<int> v; Root(int p, long long e) : p(p), e(e) {} }; const int MAXN = 200200; bool oncirc[MAXN]; vector<pair<int, long long> > e[MAXN]; vector<Root> circ; long long ans[MAXN]; bool mark[MAXN]; ... |
#include <bits/stdc++.h> using namespace std; long long i, j, k, l, n, m, s, sum, K; double an; const long long N = 1020; long long f[N][N], lu[N][N], ld[N][N], ru[N][N], rd[N][N]; long long Lu[N][N], Ld[N][N], Ru[N][N], Rd[N][N]; int hang[N], lie[N]; char a[N][N]; void work(long long x, long long y) ... |
module IMUL2
(input wire [15:0] iSourceData0, iSourceData1,
output reg [31:0] oResult
);
wire [31:0] oMux1, oMux2, oMux3, oMux4, oMux5, oMux6,oMux7,oMux8;
wire [31:0]cero, uno, dos, tres;
assign cero = 0;
assign uno = iSourceData0;
assign dos = iSourceData0<<1;
assign tres = (iSourceData0<<1) + iSourceData0;
MUX... |
#include <bits/stdc++.h> #pragma GCC optimize -O3 using ll = long long; using ull = unsigned long long; using ld = long double; using namespace std; const int MX = 7007; ll f[MX]; bool better(ll x, ll y) { return ((x ^ y) & x) != 0; } ll x[MX], y[MX]; bool ok[MX]; int main() { ios_base::sync... |
/*
File: debouncer.v
This file is part of the Parallella FPGA Reference Design.
Copyright (C) 2013 Adapteva, Inc.
Contributed by Roman Trogan <>
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 F... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 1e5 + 1; long long gcd(long long a, long long b) { long long r; while (b > 0) { r = a % b; a = b; b = r; } return a; } int main() { long long n, k, a, b, maxkq = 0, minkq = 1e18, l, kq, g, tmp; cin >... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14.06.2017 19:13:32
// Design Name:
// Module Name: Prueba_codigos_teclado
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies... |
`include "bch_defs.vh"
module xilinx_error_one #(
parameter T = 2,
parameter DATA_BITS = 5,
parameter BITS = 1,
parameter PIPELINE_STAGES = 0
) (
input clk_in,
input in,
output reg out = 0
);
`include "bch_params.vh"
localparam TCQ = 1;
localparam P = bch_params(DATA_BITS, T);
localparam M = `BCH_M(P);
lo... |
module probador(clk, rw, addr, data_in, data_out, ack, req, reset);
//Salidas y entradas
parameter data_witdh = 32;
parameter addr_witdh = 5;
parameter reg_witdh = 28;
output clk;
output rw;
reg rw;
output req;
reg req;
input ack;
wire ack;
output [a... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int i; int main() { string s; cin >> s; int k; i = 0; while (s[i] == 0 ) { i++; } int f = 0, v = 0; bool b = false; while (i != s.size()) { if (s[i] == 4 ) f++; else if (s[i] == 7 ) v++; i+... |
///////////////////////////////////////////////////////
// Copyright (c) 2010 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
//
// http://www.apache.org... |
//======================================================================
//
// sha512_h_constants.v
// ---------------------
// The H initial constants for the different modes in SHA-512.
//
//
// Author: Joachim Strombergson
// Copyright (c) 2014 Secworks Sweden AB
// All rights reserved.
//
// Redistribution and use ... |
#include <bits/stdc++.h> using namespace std; struct node { int point, w; } p[30][30]; int n, m; int s[30][30], w[30][30], Min[30], f[3000000]; int Get() { char c = getchar(); while (!isalpha(c)) c = getchar(); return c; } void init(int x, int y) { int t1 = 0, t2 = 0, mx = 0; for... |
#include <bits/stdc++.h> using namespace std; int n, m, sz1, sz2, val; int d1[200005], d2[200005], d[200005]; int main() { scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %d , &val); if (val != 0) d1[sz1++] = val; } for (int i = 0; i < n; i++) { scanf( %d , &val); 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> const double Pi = 3.14159265; const int N = 2e5 + 10; const unsigned long long base = 163; const int INF = 0x3f3f3f3f; const int mod = 1e9 + 7; const double eps = 1e-10; const double pi = acos(-1); using namespace std; long long inv[N]; long long dp[N]; int main() { lo... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } vector<int> t(n); for (int i = 0; i < n; i++) { cin >> t[i]; } a.push_back((int)... |
//#############################################################################
//# Purpose: SPI slave IO state-machine #
//# NOTE: only cpol=0, cpha=0 supported for now!! #
//#############################################################################
... |
#include <bits/stdc++.h> using namespace std; const int maxn = 345; int ai[maxn]; int bi[maxn]; bool used[maxn]; int m, r, t; void init() { for (int i = 1; i <= m; i++) { scanf( %d , &ai[i]); ai[i]++; } } vector<int> V; void play() { memset(bi, 0, sizeof(bi)); memset(used... |
#include <bits/stdc++.h> using namespace std; pair<long long, long long> p1[1005]; pair<long long, long long> p2[1005]; vector<long long> v; int main() { long long i, j, n, x, y, a, b; cin >> n; for (i = 0; i < n; i++) cin >> p1[i].first >> p1[i].second; for (i = 0; i < n; i++) cin >> p2[i].fi... |
// (c) Copyright 1995-2016 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> const int MAXN = 1e5 + 19; int qpow(int a, int b, int p) { int res = 1; while (b) { if (b & 1) res = (long long)res * a % p; a = (long long)a * a % p, b >>= 1; } return res; } int n, m, k, p; int fa[MAXN], size[MAXN]; int getf(int node) { return fa[no... |
/*
* Copyright 2018-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 to in... |
#include <bits/stdc++.h> using namespace std; char str[100010]; int ct[100010][4]; int main() { int N, x[5], R, L, M; scanf( %s , str); N = strlen(str); for (int i = 1; i <= N; i++) { for (int j = 0; j < 3; j++) ct[i][j] = ct[i - 1][j]; ct[i][str[i - 1] - x ]++; } scanf( %d ... |
#include <bits/stdc++.h> using namespace std; string a, b; int main() { cin >> a >> b; if (a == b) { cout << a << endl; return 0; } else { cout << 1 << endl; } return 0; } |
#include <bits/stdc++.h> using namespace std; int compare(const void* a, const void* b) { return (*(int*)a - *(int*)b); } int main() { int n; long long k, sum2, sum3; int a[100005], c[100005]; long long b[100005]; int i, j, count; cin >> n; cin >> k; for (i = 0; i < n; i++) scanf( ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 5; int n, q; vector<pair<int, int> > query[maxn]; vector<int> G[maxn]; long long ans[maxn]; long long add[maxn]; void dfs(int v, int p, int d, long long sum) { for (auto p : query[v]) { int l = d; int r = d + p.first + ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); for (int i = 1; i <= 2 * n / 3; i++) printf( %d %d n , i, 1); for (int i = 1; i <= n - 2 * n / 3; i++) printf( %d %d n , i * 2, 4); return 0; } |
//Legal Notice: (C)2016 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 do... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2014 Xilinx, Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ Vers... |
//#############################################################################
//# Function: Isolation (Low) buffer for multi supply domains #
//#############################################################################
//# Author: Andreas Olofsson #
... |
#include <bits/stdc++.h> using namespace std; unsigned long long get_idx(int p) { int idx = 1; while (idx < p) idx *= 2; return idx; } void update(vector<unsigned long long> &tree, unsigned long long idx, unsigned long long val) { tree[idx] = val; idx /= 2; while (idx) { ... |
#include <bits/stdc++.h> using namespace std; const int N = 3000020, M = 120; int L, R, p, ans, tot, cnt, g[N], f[N], P[M]; bool buc[N], vis[M]; void dfs(int k, int res) { g[++cnt] = res; for (int i = k; i <= tot; i++) { if (1ll * P[i] * res <= 1ll * R) dfs(i, res * P[i]); } } signed mai... |
// megafunction wizard: %LPM_CLSHIFT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: lpm_clshift
// ============================================================
// File Name: arithshiftbidir.v
// Megafunction Name(s):
// lpm_clshift
// ==============================================... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.