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 law... |
#include <bits/stdc++.h> using namespace std; const int nMax = 100007; int parent[nMax]; vector<int> g[nMax]; bool used[nMax]; void dfs(int root, int parent, int& cnt, int b, bool& bad) { if (root == b) { bad = true; } used[root] = true; ++cnt; for (int i = 0; i < g[root].size(); +... |
#include <bits/stdc++.h> using namespace std; int main() { long long a = 1, b = 1; int n; cin >> n; for (int i = 1; i <= n; i++) { a = a * 27 % 1000000007; b = b * 7 % 1000000007; } cout << (a + 1000000007 - b) % 1000000007; return 0; } |
#include <bits/stdc++.h> #pragma GCC optimize ( O2,unroll-loops ) //#pragma GCC optimize( no-stack-protector,fast-math ) //#pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> pii; typed... |
#include <bits/stdc++.h> using namespace std; const int len = 3050; int d[len]; int ans(int n) { int sum = 0; while (true) { int i; if (!d[0]) break; for (i = 0; i < n;) { if (i == n - 1) { sum++; break; } if (i < n - 2 && d[i + 2]) ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2005 by Wilson Snyder.
`ifdef VERILATOR
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), (expv))... |
module Computer_Datapath_FunctionUnit(
output reg [WORD_WIDTH-1:0] FU_out,
output [FLAG_WIDTH-1:0] FLAG_bus_out,
input [WORD_WIDTH-1:0] ADDR_bus_in, DATA_bus_in,
input [CNTRL_WIDTH-1:0] CNTRL_bus_in
);
parameter WORD_WIDTH = 16;
parameter DR_WIDTH = 3;
parameter SB_WIDTH = DR_WIDTH;
parameter SA_WIDTH = DR_WIDTH... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-12; struct P { double x, y; P(double x = 0, double y = 0) : x(x), y(y){}; } a, b, c, o, p; P operator+(P a, P b) { return P(a.x + b.x, a.y + b.y); } P operator*(P a, double b) { return P(a.x * b, a.y * b); } inline double dis(P a,... |
#include <bits/stdc++.h> using namespace std; bool IsPrime(int x) { for (int i = 2; i * i <= x; i++) if (x % i == 0) return false; return true; } int modpow(int w, int p, int m) { if (p == 0) return 1; int x = modpow(w, p / 2, m); x = 1LL * x * x % m; if (p & 1) x = 1LL * x * w % m... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1010; int N; pair<int, int> point[MAXN]; int cntx[MAXN], cnty[MAXN], cnt1, cnt2; map<int, vector<pair<int, int> > > samex, samey; int fa[MAXN]; int find(int x) { return (x == fa[x]) ? x : fa[x] = find(fa[x]); } void merge(int u, int v) { ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1000000404; const long long MOD = 1000000007ll; const long double PI = acos(-1.0); const long double EPS = 1e-9; template <typename t1, typename t2> inline void upmax(t1 &a, t2 b) { a = max(a, (t1)b); } template <typename t1, typename t... |
/*------------------------------------------------------------------------------
* 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() { int n; char s[105]; cin >> n; cin >> s; vector<int> v; v.clear(); int cnt = 0; for (int i = 0; i < n; i++) { if (s[i] == B ) { ++cnt; } else { if (cnt != 0) { v.push_back(cnt); ... |
#include <bits/stdc++.h> using namespace std; int n, u, r; vector<long long> k; vector<int> a, b, p, tmp; vector<vector<int> > v; vector<int> w; void read(); int main() { ios_base::sync_with_stdio(false); read(); v.push_back(a); w.push_back(1); long long s = 0; if (u & 1) s... |
#include<bits/stdc++.h> #define ll long long int #define mk make_pair #define pb push_back #define INF (ll)1e18 #define pii pair<ll,ll> #define mod 1000000007 //998244353 #define f(i,a,b) for(ll i=a;i<b;i++) #define fb(i,a,b) for(ll i=a;i>b;i--) #define ff first #define ss second #define srt(v) i... |
#include <bits/stdc++.h> using namespace std; int n; string sherlock, moriarty; int algos(bool upper) { int res = 0; multiset<int> S; for (int i = 0; i < n; ++i) S.insert((int)moriarty[i]); for (int i = 0; i < n; ++i) { multiset<int>::iterator it; if (upper) it = S.upper_boun... |
// Implements I2C from the Zynq PS
module parallella_i2c
(/*AUTOARG*/
// Outputs
I2C_SDA_I, I2C_SCL_I,
// Inouts
I2C_SDA, I2C_SCL,
// Inputs
I2C_SDA_O, I2C_SDA_T, I2C_SCL_O, I2C_SCL_T
);
input I2C_SDA_O;
input I2C_SDA_T;
output I2C_SDA_I;
input I2C_SCL_O;
input I2C_SCL_... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11/02/2013 10:51:56 PM
// Design Name:
// Module Name: tag_manager
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
/... |
/*
* Copyright 2012, Homer Hsing <>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... |
/**
* 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; int main() { cin >> n; long long int summ = n + (n - 1); long long int wei = 0; while (summ != 0) { summ /= 10; wei++; } long long int stdl = 9; for (int i = 1; i < wei; i++) { stdl = stdl * 10 + 9; } ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int sum = 0; for (int i = 0; i < n; ++i) { int l, r; cin >> l >> r; sum += r - l + 1; } int ct = 0; while (sum % k != 0) { ct++; sum++; } cout << ct << endl; } |
// $Id: c_reverse.v 5188 2012-08-30 00:31:31Z dub $
/*
Copyright (c) 2007-2012, Trustees of The Leland Stanford Junior University
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistributions of... |
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T &a, const T &b) { return b > a ? a = b, true : false; } template <class T> inline bool chmin(T &a, const T &b) { return b < a ? a = b, true : false; } template <class T> using MaxHeap = priority_queue<T>; te... |
// file: clk_wiz_0.v
//
// (c) Copyright 2008 - 2013 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: ADC_ROM.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ================================... |
#include <bits/stdc++.h> using namespace std; int Distance(int x1, int y1, int x2, int y2) { return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); } int main() { int n, m, x1, y1, x2, y2, x3, y3, x4, y4, flag, dis1, dis2; while (~scanf( %d%d , &n, &m)) { flag = 0; if (m > n) { sw... |
//Legal Notice: (C)2017 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... |
#include <bits/stdc++.h> using namespace std; int N; int main() { cin >> N; cout << N / 2 << n ; for (int i = 0; i < N / 2 - 1; i++) { cout << 2 ; } if (N % 2 == 0) cout << 2 n ; else cout << 3 n ; return 0; } |
// megafunction wizard: %LPM_MULT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: lpm_mult
// ============================================================
// File Name: gsu_umult.v
// Megafunction Name(s):
// lpm_mult
//
// Simulation Library Files(s):
// lpm
// ===========================================... |
`include "gcd2.generated.vh"
`default_nettype none
module Gcd2 (input wire CLK, input wire nRST,
input wire request$say__ENA,
input wire [31:0]request$say$va,
input wire [31:0]request$say$vb,
output wire request$say__RDY,
output wire indication$gcd__ENA,
output wire [31:0]indication$gcd$v,
... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2008 by Lane Brooks.
//
// This implements a 4096:1 mux via two stages of 64:1 muxing.
// change these two parameters to see the speed differences
//`define DATA_WIDTH 12
//`define MU... |
module ARMAria
#(
parameter WORD_SIZE = 32,
parameter INSTRUCTION_WIDTH = 16,
parameter FLAG_COUNT = 5,
parameter IO_WIDTH = 16,
parameter SEGMENTS_COUNT = 7*8,
parameter OFFSET_WIDTH = 12
)(
input fast_clock, confirmation_button, reset_button,
input continue_button, request_os_button,
... |
// ----------------------------------------------------------------------
// Copyright (c) 2015, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:... |
//---------------------------------------------------------------------------------------
// baud rate generator for uart
//
// this module has been changed to receive the baud rate dividing counter from registers.
// the two registers should be calculated as follows:
// first register:
// baud_freq = 16*baud_rate /... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; const int maxN = 100000; int main() { cin.tie(0); ios_base::sync_with_stdio(0); int n, m; cin >> n >> m; int ok = 1; for (int i = 0; i < n; i++) { for (int k = 0; k < m; k++) { char c; cin >> c; ... |
`timescale 1ns/1ps
`default_nettype none
module button_debounce
#(
parameter CLK_FREQ = 10_000_000,
parameter DEBOUNCE_HZ = 2
) (
input wire clk,
input wire rst_n,
input wire btn_in,
output reg btn_out
);
localparam COUNT_MAX = CLK_FREQ / DEBOUNCE_HZ;
localparam S_WAIT = 0;
localparam S_FIRE =... |
// (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... |
/**
* 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; pair<int, int> p[100005], ans[100005]; int tot, start[100005], remain, now; int f[100005]; priority_queue<pair<int, int> > Q; int main() { cin >> n >> m; for (int i = 1; i <= m; i++) { scanf( %d%d , &p[i].first, &p[i].second); if ... |
`timescale 1ns / 1ps
module word(
output word,
input [3:0] row, col,
input [1:0] select
);
reg [15:0] line[15:0];
integer i;
always @(*)
begin
if (select == 1) begin
line[0] = 16'b0000000000000000;
line[1] = 16'b0000000000000000;
line[2] = 16'b0000111111110000;
line[3] = 16'b0001111111111000;
line[4] = 1... |
#include <bits/stdc++.h> using namespace std; struct __s { __s() { if (1) { ios_base::Init i; cin.sync_with_stdio(0); cin.tie(0); } } ~__s() { if (!1) fprintf(stderr, Execution time: %.3lf s. n , (double)clock() / CLOCKS_PER_SEC); ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, i, k, j, c; while (scanf( %d%d , &n, &m) != EOF) { c = 0; char a[990][101], x; for (i = 0; i < n; i++) scanf( %s , a[i]); for (i = 0; i < n; i++) { for (k = 0; k < m; k++) { x = a[i][k]; ... |
`timescale 1ns / 1ps
module jt12_test;
reg [9:0] phase;
reg rst,clk;
reg [2:0] alg;
`include "../common/dump.vh"
initial begin
clk = 0;
forever #10 clk=~clk;
end
wire signed [13:0] left, right;
wire signed [8:0] op_result;
wire clk6;
wire [9:0] eg_atten;
reg [2:0] ch;
reg [2:0] voice_fb;
always @(posedg... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; string s; cin >> s; if (n % 4 != 0) { cout << === ; return 0; } vector<long long> v(5, 0); for (long long i = 0; i < n; i++) { if (s[i] == A ) { v[0]++; } if (s[i... |
#include <bits/stdc++.h> using namespace std; long long f[61 + 1], g[61 + 1], x, k; int Q, op, pos; int main() { scanf( %d , &Q); f[0] = 1; for (int i = 1; i < 61; i++) f[i] = f[i - 1] * 2; while (Q--) { scanf( %d , &op); if (op == 1) { scanf( %I64d%I64d , &x, &k); fo... |
#include <iostream> #include <vector> using namespace std; int t,k,n,m; vector<int> a,b,v; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin>>t; while (t--) { cin>>k>>n>>m; a.resize(n); b.resize(m); for (int &x:a) cin>>x; ... |
#include <bits/stdc++.h> using namespace std; uint64_t l, r, s; set<uint64_t> S; void f(uint64_t x) { S.insert(x); if (x < r) f(x * 10 + 4), f(x * 10 + 7); } int main() { cin >> l >> r; for (f(0); l <= r;) { auto it = S.lower_bound(l); s += (min(r, *it) - l + 1) * *it; l = ... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; int dp[1001][2010]; int digit[1002], k; void init() { memset(dp, -1, sizeof dp); } int dfs(int pos, int dist, bool doing) { if (pos == -1) return dist == 0; if (!doing && dp[pos][dist] != -1) return dp[pos][dist]; int ans ... |
#include <bits/stdc++.h> const int P = 998244353; using namespace std; template <typename T> inline void ckmax(T &a, T b) { (a < b) && (a = b); } template <typename T> inline void ckmin(T &a, T b) { (a > b) && (a = b); } inline int mul(int a, int b) { return 1ll * a * b % P; } inline int add... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k; cin >> n >> m >> k; vector<int> arr(n); for (int i = 0; i < n; i++) cin >> arr[i]; vector<int> temp; for (int i = 1; i < n; i++) { int val = arr[i] - arr[i - 1] - 1; temp.push_back(val); } sort(temp.b... |
module top(
input wire clk,
input wire rx,
output wire tx,
input wire [15:0] sw,
output wire [15:0] led
);
localparam LOG2DELAY = 22;
reg [LOG2DELAY-1:0] counter0 = 0;
reg [LOG2DELAY-1:0] counter1 = 0;
reg [LOG2DELAY-1:0] counter2 = 0;
reg [LOG2DELAY-1:0] counter3 = 0;
... |
module xillybus_core
(
input M_AXI_ARREADY_w,
input M_AXI_AWREADY_w,
input [1:0] M_AXI_BRESP_w,
input M_AXI_BVALID_w,
input [31:0] M_AXI_RDATA_w,
input M_AXI_RLAST_w,
input [1:0] M_AXI_RRESP_w,
input M_AXI_RVALID_w,
input M_AXI_WREADY_w,
input [31:0] S_AXI_ARADDR_w,
input S_AXI_ARVALID_w,... |
/*
* 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; bool prime(long long int i) { if (i == 1) return false; if ((i == 2) || (i == 3)) return true; if ((i % 2 == 0) || (i % 3 == 0)) return false; else { for (long long int j = 5; j * j <= i; j += 6) if ((i % j == 0) || (i % (j + 2) == 0)... |
#include <bits/stdc++.h> using namespace std; void solve() { int a, b, ans; cin >> a >> b; int x = (a / 4) * 4; int i = x, val = 0; while (i < a) { val = val ^ i; i++; } if (val == b) { ans = a; } else if ((val ^ a) == b) { ans = a + 2; } else { ans ... |
#include <bits/stdc++.h> using namespace std; const int NMAX = 100000 + 5; const int MMAX = 2000 + 5; const int INF = 1000000000; const int BS = 1000000000 + 7; const long long INFLL = 1000000000ll * 1000000000ll; const long double eps = 1e-6; int main(int argc, char** argv) { if (argc > 1 && strcmp... |
/**
* 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 LIMIT = 1e7; int prime[LIMIT], palin[LIMIT]; int pr[LIMIT], pa[LIMIT]; int cnt_dig(int x) { if (x == 0) return 1; else { int ans = 0; while (x > 0) { x /= 10; ans++; } return ans; } } int main... |
#include <bits/stdc++.h> using namespace std; int main() { long long int x, y, z; cin >> x >> y >> z; cout << (x + y) / z << ; if (x / z + y / z < (x + y) / z) { cout << min(z - (x % z), z - (y % z)); } else { cout << 0 ; } } |
`default_nettype none
`define CLKFBOUT_MULT 2
// ============================================================================
module top
(
input wire clk,
input wire rst,
input wire [7:0] sw,
output wire [9:0] led,
inout wire io
);
localparam DATA_WIDTH = `DATA_WIDTH_DEFINE;
localparam DATA_RATE = `DATA_RATE... |
/**
* 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 N = 1000001; int n, kt[N], a[N], cnt, x[N]; long long k, s; long long cal(int i) { long long res = i; return res * (res + 1) / 2; } int main() { scanf( %d%lld , &n, &k); if (k < cal(n)) { printf( -1 ); 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; template <class T> T extgcd(T a, T b, T& x, T& y) { for (T u = y = 1, v = x = 0; a;) { T q = b / a; swap(x -= q * u, u); swap(y -= q * v, v); swap(b -= q * a, a); } return b; } template <class T> T mod_inv(T a, T m) { T x,... |
#include <bits/stdc++.h> using namespace std; const int maxN = 200005; const int inf = 214748364; int n, m, g[21][1 << 20], f[maxN], v[maxN], s[maxN]; int cost(int a, int b) { for (int i = m; i >= 0; --i) { if ((a & ((1 << i) - 1)) == (b >> (m - i))) return m - i; } } void init() { char ... |
#include <bits/stdc++.h> int main() { int i, j, k, l, p, q, m = 1, a = 0, b = 0, c = 0; char s[50001]; scanf( %s , s); l = strlen(s); i = 0; if (s[i] == a && l > 1) { for (j = i + 1; j < l; j++) { if (s[j] != a ) { if (s[j] == b ) { for (p = j + 1; p < l... |
#include <bits/stdc++.h> using namespace std; long long int mod = 998244353; long double eps = 1e-12; long long int dx[] = {0, 0, 1, -1, 1, 1, -1, -1}; long long int dy[] = {1, -1, 0, 0, 1, -1, 1, -1}; long long int n, res = 0, k = 0, h, ans = 0, m; long long int gcd(long long int a, long long int b) { ... |
#include <bits/stdc++.h> int m[6]; int w[6]; int x[6] = {0, 500, 1000, 1500, 2000, 2500}; double max(int i) { double a = 0.3 * x[i]; double b = (1 - m[i] * 1.0 / 250) * x[i] - 1.0 * 50 * w[i]; if (a > b) return a; return b; } int main() { int i, u, v; while (~scanf( %d%d%d%d%d , &m[1... |
// ***************************************************************************
// ***************************************************************************
// 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; char ch[55][55]; int main() { int n, m; cin >> n >> m; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) cin >> ch[i][j]; int ret = 0; for (int i = 0; i < n - 1; i++) for (int j = 0; j < m - 1; j++) { bool f = 0, a = 0, c ... |
// ***************************************************************************
// ***************************************************************************
// 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; long long a, fut, duim; int main() { cin >> a; a += 1; fut = a / 36; duim = round((a - fut * 36) / 3); cout << fut << << duim << endl; fclose(stdin); fclose(stdout); } |
/**
* 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 int intINF = 999999999; const long long i64INF = 99999999999999999ll; const double doubleINF = 9999999999.; using namespace std; int abs(int a) { if (a < 0) a *= -1; return a; } int max(int a, int b) { if (a < b) a = b; return a; } int main() { int x1... |
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; int power(int v, int u) { if (!u) return 1; int ok = power(v, u >> 1); if (u & 1) return (long long)ok * ok % mod * v % mod; return (long long)ok * ok % mod; } const int maxm = 2e5; int b[maxm + 10]; int main() { ... |
#include <bits/stdc++.h> using namespace std; const int oo = 1000000001; int dp[1200][1200], out[1200][5], pre[1200][1200], a[1200]; int i, j, last, n, mi; int main() { while (~scanf( %d , &n)) { for (i = 0; i < n; i++) scanf( %d , &a[i]); if (n == 1) { printf( %d n%d n , a[0], 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; int n, i; int fi = 0, se = 0, th = 0, fo = 0; int main() { cin >> n; cout << +------------------------+ << endl; if (n >= 3) { n--; th++; } while (n) { if (n) { fi++; n--; } if (n) { se++; ... |
#include <bits/stdc++.h> using namespace std; int n, m; vector<int> g[50005]; vector<int> t[50005]; int T; int col[1000005]; int team[50005]; mt19937 mt(1235577); int x[100005], y[100005]; int ans[50005]; int main() { scanf( %d%d , &n, &m); for (int i = 0; i < (int)(m); ++i) { int fr... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.3 (lin64) Build Wed Oct 4 19:58:07 MDT 2017
// Date : Tue Oct 17 19:49:37 2017
// Host : TacitMonolith running 64-bit Ubuntu 16.04.3... |
/**
* 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 event, ghotona; cin >> event; int hired = 0, untreated = 0; for (int i = 0; i < event; i++) { cin >> ghotona; hired += ghotona; if (hired < 0) { untreated++; hired = 0; } } cout << untreate... |
`timescale 1ns / 1ps
//Test Multiplicador de 32 bits con signo
module TestMultiplicador;
//Inputs
reg [31:0] a;
reg [31:0] b;
//Outputs
wire [31:0] Z;
wire ovf;
//Unit under test
Multiplicador uut(
.a(a),
.b(b),
.Z(Z),
.ovf(ovf)
);
initial begin
a = 32'b0;
b = 32'b0;
... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2012 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
//bug456
typedef logic signed [34:0] rc_t;
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;... |
#include <bits/stdc++.h> using namespace std; const int mod = 1000000007; struct Interval { long long a, b, ind; bool operator<(const Interval& ano) const { return b < ano.b; } } a[200010]; bool used[200010]; set<long long> st; struct SEG { long long sum[1600010], tg1[1600010], tg2[1600010]; ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int cnt, curk; int pos[N], fa[N]; struct Wall { int z, pos; int xmin, xmax, ymin, ymax; Wall() {} bool operator<(const Wall &x) const { return z < x.z; } } w[N]; struct Queries { int x, y; int pos; Queries() {... |
#include <bits/stdc++.h> using namespace std; const long long MOD = (1e9) + 7; const long double EPS = 0.0000001; int main(void) { ios_base::sync_with_stdio(false); cin.tie(NULL); string s; cin >> s; string t; cin >> t; int szs = s.size(); int szt = t.size(); int cur = 0; ... |
module mojo_top(
// 50MHz clock input
input clk,
// Input from reset button (active low)
input rst_n,
input inin,
// Outputs to the 8 onboard LEDs
output[7:0]data,
output[7:0]led
// cclk input from AVR, high when AVR is ready
/*input cclk,
// AVR SPI connections
output spi_miso,
... |
/**
* 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 sum[51], ind[51]; int main() { for (int i = 1; i <= 50; ++i) sum[i] = i * (i + 1) / 2; for (int i = 1; i <= 50; ++i) ind[i] = i; int n, temp, reqind; cin >> n; for (int i = 1; i <= 50; ++i) { if (n <= sum[i]) { temp = sum[i]; ... |
///////////////////////////////////////////////////////////////////////////////
//
// Module: fifo_4x32.v
// Project: CPCI (PCI Control FPGA)
// Description: Small 4 x 32-bit FIFO
//
// Change history:
//
///////////////////////////////////////////////////////////////////////////////
module fifo_4x32(
... |
#include <bits/stdc++.h> using namespace std; int i, j, k, l, x, y, z, m, n, ans; string s, a; int ara[10]; int main() { cin >> a >> s; for (int i = 0; i < s.size(); i++) { int x = s[i] - 0 ; ara[x]++; } for (int i = 0; i < a.size(); i++) { int x = a[i] - 0 ; for (int... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
//#############################################################################
//# Function: General Purpose Software Programmable IO #
//# (See README.md for complete documentation) #
//#############################################################################
... |
/**
* 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; const unsigned long long inf = 0x3f3f3f3f3f3f3f3f; const unsigned long long MAXN = 1e5 + 5; unsigned long long cnt[MAXN]; vector<unsigned long long> adj[MAXN]; vector<unsigned long long> vis(MAXN, 0); void dfs(unsigned long long v) { vis[v] = 1; if (ad... |
#include <bits/stdc++.h> using namespace std; int n; int a[510]; vector<pair<int, int> > edges; vector<int> leaf, nonleaf; int d = 0; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int i = 1; i <= n; i++) { if (a[i] == 1) leaf.push_back(i); ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, k, tot, i; cin >> n >> k; tot = n * (n - 1) / 2; if (tot <= k) { cout << no solution ; } else { for (i = 0; i < n; i++) { cout << 0 << << i << endl; } } return 0; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.