text stringlengths 59 71.4k |
|---|
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under The Creative Commons Public Domain, for
// any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
`timescale 1ns/1ps
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
... |
`default_nettype none
// ============================================================================
module rom
(
input wire CLK,
input wire RST,
input wire RD,
output wire [7:0] O
);
// ============================================================================
reg [7:0] rom[0:31];
initial begin
rom[ 0... |
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> inline void smin(T &a, U b) { if (a > b) a = b; } template <typename T, typename U> inline void smax(T &a, U b) { if (a < b) a = b; } int val[501000], deg[501000]; vector<int> adj[501000]; int main() { int n,... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, x = 0, i, j; vector<pair<int, int> > v; map<int, vector<int> > mp; map<int, vector<int> >::iterator it; scanf( %d %d , &n, &m); for (i = 0; i < m; i++) { int x, y; scanf( %d %d , &x, &y); x--; y--; ... |
#include <bits/stdc++.h> using namespace std; int n, m, k; vector<vector<pair<long long, long long> > > g; void fun() { cin >> n >> m >> k; g.resize(n); map<pair<int, int>, int> index; for (long long i = 0; i < m; i++) { long long x, y, z; cin >> x >> y >> z; x--; y--; ... |
`timescale 1ns / 1ns
module eth_crc32
(input c, // clock
input r, // reset
input dv, // data-valid
input [7:0] d, // data
output [31:0] crc);
// buffer everything here to help it make timing.
wire dv_d1;
r #(1) dv_d1_r(.c(c), .d(dv), .rst(1'b0), .en(1'b1), .q(dv_d1));
wire [7:0] A; // latched input data
r #(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 law... |
// File ../../vhdl/src/pc_unit.vhd translated with vhd2vl v2.5 VHDL to Verilog RTL translator
// vhd2vl settings:
// * Verilog Module Declaration Style: 1995
// vhd2vl is Free (libre) Software:
// Copyright (C) 2001 Vincenzo Liguori - Ocean Logic Pty Ltd
// http://www.ocean-logic.com
// Modifications Copyrigh... |
/**
* 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 1 ns / 1 ps
module axis_red_pitaya_adc #
(
parameter integer ADC_DATA_WIDTH = 14,
parameter integer AXIS_TDATA_WIDTH = 32
)
(
// System signals
input wire aclk,
// ADC signals
output wire adc_csn,
input wire [ADC_DATA_WIDTH-1:0] adc_dat_a,
... |
#include <bits/stdc++.h> using namespace std; int main() { long long t = 0; cin >> t; long long a = 0, b = 0; for (int i = 0; i < t; i++) { cin >> a >> b; long long dif = abs(a - b); long long res = dif / 5; dif = dif % 5; res += dif / 2; dif %= 2; res += di... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: pkt_length_fifo.v
// Megafunction Name(s):
// scfifo
//
// Simulation Library Files(s):
// altera_mf
// ===========================... |
#include <bits/stdc++.h> using namespace std; float S, a, b, c; int main() { ios ::sync_with_stdio(false); cin >> S >> a >> b >> c; float sum = a + b + c; if (sum == 0) cout << 0 0 0 ; else printf( %.12f %.12f %.12f , a * S / sum, b * S / sum, c * S / sum); return 0; } |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_r_frf.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 redistribute it and/or
/... |
`timescale 1ns / 1ps
/*******************************************************************************
* Engineer: Robin zhang
* Create Date: 2016.09.10
* Module Name: spi_slave_b2b
* this module will get 64 bytes and then return the count 64 at next clks
*************************************************************... |
module fifo # (parameter abits = 10, dbits = 8)(
input reset, clock,
input rd, wr,
input [dbits-1:0] din,
output [dbits-1:0] dout,
output empty,
output full,
output reg ledres
);
wire db_wr;
wire db_rd;
reg dffw1, dffr1;
reg [dbits-1:0] out;
initial ledres = 0;
reg [1:0] count;
reg... |
/*
:Project
FPGA-Imaging-Library
:Design
ColorRGB16toRGB24
:Function
Covert 16bits-RGB to 24bits-RGB.
:Module
Main module
:Version
1.0
:Modified
2015-05-12
Copyright (C) 2015 Tianyu Dai (dtysky) <>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General ... |
//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 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, s, ll, v[100011]; int dp[100011]; const int oo = 1 << 28; int seg[400001]; int at, l, r; void add(int n, int s, int e) { if (at < s || at > e || s > e) return; if (s == e) { seg[n] = dp[s]; return; } add(n * 2, s, (s + e) / 2... |
module image_processor (
input [7:0] iR,
input [7:0] iG,
input [7:0] iB,
input iHSync,
input iVSync,
input iLineValid,
input iFrameValid,
input ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const int oo = 1e9; const int MOD = 1000000007; const int N = 100010; vector<int> g[N]; multiset<int> seg[4 * N], stk; int n, u, v, sz[N], st[N], ed[N], bk[N], cnt = 1, res[N]; void dfs(int u, int p) { sz[u] = 1, bk[cnt] = u, st[u] = cnt++; for (int ... |
#include <bits/stdc++.h> using namespace std; int odd[2000], even[2000]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin >> n; for (int i = 1; i <= n * n; i += 2) { odd[(i - 1) / 2] = i; } for (int i = 2; i <= n * n; i += 2) { even[i / 2 - ... |
/////////////////////////////////////////////////////////////////////
//// ////
//// WISHBONE revB.2 compliant I2C Master controller Top-level ////
//// ////
//// ... |
/**
* 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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2004 by Wilson Snyder.
module t (/*AUTOARG*/
// Outputs
outc_w30, outd_w73,
// Inputs
clk, ina_w1, inb_w61
);
input clk;
input ina_w1;
input [60:0] ... |
// Multicycle MIPS processor
module mips(input clk, reset,
output [31:0] adr, writedata,
output memwrite,
input [31:0] readdata);
wire zero, pcen, irwrite, regwrite,
alusrca, iord, memtoreg, regdst;
wire [1:0] alusrcb;
wire [1:0] pcsrc;
... |
#include <bits/stdc++.h> using namespace std; struct Q { int r, c, id; } q[100001]; int m, n; bool cmph(Q a, Q b) { if (a.r != b.r) return a.r < b.r; return a.c < b.c; } bool cmps(Q a, Q b) { if (a.c != b.c) return a.c < b.c; return a.r < b.r; } bool cmpp(Q a, Q b) { if (a.r + ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long n, k; cin >> n >> k; long long arr[n], arr1[n], arr2[n]; long long F1 = INT_MIN, F2 = INT_MIN; for (int i = 0; i < n; ++i) { cin >> arr[i]; F1 = max(F1, arr[i... |
#include <bits/stdc++.h> using namespace std; int main() { int c = 0; long long t = 0; string s, s2; cin >> s >> s2; int n = s2.size() - s.size(); for (int i = 0; i < n; i++) { c += s2[i] - 0 ; } for (int i = 0; i < s.size(); i++) { c += s2[i + n] - 0 ; if (i) 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 law... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; vector<int> basis; void add(int x) { for (int& a : basis) if (a & -a & x) x ^= a; if (x == 0) return; for (int& a : basis) if (x & -x & a) a ^= x; basis.emplace_back(x); } int main() { ios_base::sync_with_st... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK: 2000000 ) using namespace std; int main(void) { srand(time(0)); cout << fixed << setprecision(7); cerr << fixed << setprecision(7); int n; ios_base ::sync_with_stdio(0); cin.tie(0); cin >> n; function<int(int)> ok = [&](int ... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:36777216 ) using namespace std; long long pow_mod(long long x, long long y, long long z) { long long res = 1; while (y) { if (y & 1) res *= x, res %= z; x *= x, x %= z, y >>= 1; } return res % z; } void ext_gcd(long long a, l... |
#include <bits/stdc++.h> using namespace std; char s[111][3]; int main() { char t[3]; scanf( %s , t); int n; scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %s , s[i]); } for (int i = 0; i < n; i++) { if (t[0] == s[i][0] && t[1] == s[i][1]) { puts( YES ); ... |
#include <bits/stdc++.h> using namespace std; int main() { string s, val = ><+-.,[] ; cin >> s; long long int size = 0; for (int i = 0; i < s.size(); i++) { size = (size * 16 + val.find(s[i]) + 8) % 1000003; } cout << size; } |
#include <bits/stdc++.h> using namespace std; const int N = 250001; long long po[N]; long long n, p; int main() { cin >> n >> p; po[0] = 1; for (int i = 1; i <= n; i++) { po[i] = 1LL * po[i - 1] * i % p; } int ans = 0; for (int i = 1; i <= n; i++) { int s = 1ll * po[n - i] ... |
#include <bits/stdc++.h> using namespace std; int main() { std::ios_base::sync_with_stdio(false); long long A, B, n; cin >> A >> B >> n; for (int i = 0; i < n; ++i) { long long l, t, m; cin >> l >> t >> m; if (A + (l - 1) * B > t) { cout << -1 n ; } else { lo... |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MAX = 1e5 + 100; const ll inf = 1e9; const ll mod = 998244353; ll a[MAX], c[MAX], t[MAX]; string b[] = { 50 , 25 , 75 , 00 }; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ll tc = 1, n, m, ans = 0... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of reallity
//
// Generated
// by: lutscher
// on: Fri Jun 26 13:24:43 2009
// cmd: /tools/mix/1.9//mix_1.pl -vinc global_project.i -nodelta LP-blue-pin-list.xls LP-paris-pin-list.xls LP-reallity-pin-l... |
/*
* 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, a[1111], f[1111]; int main() { cin >> n; for (int i = 0; i < n; ++i) cin >> a[i]; for (int day = 1000; day >= 1; --day) { for (int i = 0; i < n; ++i) f[i] = 0; f[0] = (day <= a[0]); for (int i = 1; i < n; ++i) { if (day > a... |
#include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #include<string> #include<vector> #include<stack> #include<bitset> #include<cstdlib> #include<cmath> #include<set> #include<list> #include<deque> #include<map> #include<queue> #define rep(i, a, n) for (ll i=a;i<=... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:17:38 02/18/2017
// Design Name: bin2sevenSeg
// Module Name: /home/aaron/Git Repos/CSE311/lab3/bin2sevenSeg_tb.v
// Project Name: lab3
// Target Device:
// Too... |
/**
* 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 t; cin >> t; while (t--) { int a, b, c; cin >> a >> b >> c; int diff = INT_MAX; int a1, b1, c1; for (int i = 1; i <= 10000; i++) { for (int j = i; j <= 20000; j += i) { for (int k = j; k <= 500... |
/*****************************************************************************
* *
* Module: Altera_UP_PS2 *
* Description: *
* ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; long long N, K; int M; vector<long long> special; int sol = 0; int main() { scanf( %lld %d %lld , &N, &M, &K); for (int i = 0; i < M; i++) { long long v; scanf( %lld , &v); special.push_back(v); } ... |
#include <bits/stdc++.h> using namespace std; const int INF = (int)2E9; const long long LINF = (long long)9E18; const long double PI = acos(-1.0); const long double EPS = 1E-11; template <typename T> inline T sqr(const T x) { return x * x; } template <typename T> T gcd(T a, T b) { return (b ... |
#include <bits/stdc++.h> using namespace std; bool maze[3][100001]; int judge(int r, int c) { if (r == 1) { if (c == 100000) return maze[2][99999] + maze[2][100000]; return maze[2][c - 1] + maze[2][c] + maze[2][c + 1]; } else { if (c == 1) return maze[1][1] + maze[1][2]; if (c == 1... |
#include <bits/stdc++.h> using namespace std; void solve() { int n, m; cin >> n >> m; string s; cin >> s; char arr[26]; map<int, int> mmap; for (int i = 0; i < 26; i++) { mmap[i] = i; arr[i] = i; } for (int i = 0; i < m; i++) { char pr, nx; cin >> pr >> nx... |
/**
* 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; #pragma optimize( -O3 ) #define f first #define s second #define pb push_back #define endl n map<vector<int>, int>ma; map<vector<int>, bool>che; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); queue<v... |
#include<bits/stdc++.h> #define ll long long using namespace std; int main() { ll T,N,K,i,j,k,l,ans; string S; cin>>T; while (T--) { cin>>N>>K; cin>>S; ans=1; for(i=0;S[i]!= * ;i++); for(j=S.length()-1;S[j]!= * ;j--); if(... |
#include <bits/stdc++.h> using namespace std; int n, m, k; long long ans; int main() { cin >> n >> m >> k; if (k > n + m - 2) { cout << -1 << endl; return 0; } if (n >= m) swap(n, m); if (k <= m - 1) { ans = (long long)(m / (k + 1)) * n; } else { ans = (long lon... |
#include <bits/stdc++.h> using namespace std; inline long long ispossible(vector<long long>& b, vector<long long>& p, int k, long long a) { int n = b.size(); if (k > p.size()) return -1; long long c = 0, s = 0, extra = 0; for (int i = n - k; i < n; i++) { c += p[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; int dcmp(double x, double y) { return fabs(x - y) <= 1e-9 ? 0 : x < y ? -1 : 1; }; vector<long long> holder; void dfs(long long num, int i) { if (i == 10) { if (num) holder.push_back(num); return; } dfs(num * 10 + 4, i + 1); dfs(num... |
module IntegerDivision(
input [63:0] Dividend,
input [31:0] Divisor,
output[63:0] quotient,
output[31:0] remainder,
input start,
input clk
);
reg [8:0] count;
reg [96:0] tmp;
reg oldStart;
wire [33:0] nDivisor;
wire [33:0] pDivisor;
wire [63:0] result;
wire [33:0] addend;
initial begin
count <= 129;
... |
//************************************
// Designed by: Wenyi Xu
// Last updated: 15/10/21
//************************************
module letter_div(clk, rst, data_in, data_wr, write_free, letter_out, out_en);
parameter data_size = 32;
// Parameters for FSM
parameter START = 4'b0000;
parameter IDLE = 4'b000... |
/*
This file was generated automatically by the Mojo IDE version B1.3.6.
Do not edit this file directly. Instead edit the original Lucid source.
This is a temporary file and any changes made to it will be destroyed.
*/
/*
Parameters:
SIZE = DATA_IN_SIZE
DEPTH = 16
*/
module async_fifo_39 (
... |
`ifdef __ICARUS__
`define SUPPORT_CONST_OUT_OF_RANGE_IN_IVTEST
`endif
module top;
reg pass;
wire [2:-1] vec1;
wire [2:-1] vec2;
wire [2:-1] vec3;
wire [2:-1] vec4;
wire [2:-1] vec5;
wire [2:-1] vec6;
assign vec1 = 4'bxxxx;
assign vec2 = 4'bxxxx;
assign vec3 = 4'bxxxx;
assign vec4 = 4'bxxxx;
... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[3000]; int ert = 0, at = 0, as = 0; int k = 1; while (k < 3000) { ert++; if (ert % 10 == 0) at++; if (ert % 10 == 0 and at % 10 == 0) as++; if (k <= 9) { a[k] = ert % 10; ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2004 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc; initial cyc=1;
reg [31:... |
`timescale 1 ns / 1 ps
module axis_iir_filter
(
// System signals
input wire aclk,
input wire aresetn,
input wire [31:0] cfg_data,
// DSP signals
output wire [15:0] dsp_a_a,
input wire [32:0] dsp_a_p,
output wire [24:0] dsp_b_a,
output wire [41:0] dsp_b_c,
input wire [41:0] d... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int test = 1; for (; test > 0; --test) { long long int n, a, b, c, d, c1 = 1, c2, c3, c4; cin >> n >> a >> b >> c >> d; c2 = c1 + b - c; c3 = c2 + a - d; ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(); int n; cin >> n; vector<pair<int, int> > arr[1001]; for (int i = 1; i <= n; i++) { int x, y; cin >> x >> y; arr[x / 1000].push_back(make_pair(y, i)); } for (int i = 0... |
#include <bits/stdc++.h> using namespace std; const int N = 10101; char s[N], t[N * 100]; int ne[N][26]; int main() { scanf( %s , s); int lens = strlen(s); for (int i = lens; i >= 0; --i) { for (int d = 0; d < (26); ++d) ne[i][d] = i == lens ? lens : ne[i + 1][d]; if (i != lens) ne[i][... |
#include <bits/stdc++.h> using namespace std; int a[105], b[105]; long long tinh(long long x, int n, int nc) { long long i, cnt = 0; for ((i) = (1); (i) <= (n); (i)++) { cnt += (((long long)a[i] * x) / b[i]) + 1; if (cnt > nc) return 1001001001; } return cnt; } void input() { i... |
#include <bits/stdc++.h> using namespace std; const long long int inf = 1e9 + 7; const long long int inf2 = inf * inf; priority_queue<long long int, vector<long long int>, greater<long long int>> mnheap; long long int gcd(long long int x, long long int y) { if (x == 0) return y; return gcd(y % x... |
#include <bits/stdc++.h> using namespace std; struct Position { int r, c, t; Position(int r, int c, int t) { this->r = r; this->c = c; this->t = t; } }; int main() { vector<string> board; vector<pair<int, int> > s; for (int r = 0; r < 8; r++) { string line; ... |
#include <bits/stdc++.h> using namespace std; long long f[3], x, y, z, k; int main() { long long a, b, c; long long r; cin >> f[0] >> f[1] >> f[2] >> k; sort(f, f + 3); k += 3; k = min(k, f[0] + f[1] + f[2]); a = f[0] * 3 <= k ? f[0] : k / 3; r = k - a; b = f[1] * 2 <= r ? f[1]... |
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 5; const long long inf = 0x3f3f3f3f3f; long long a[1010][1010]; long long n, k; int main() { cin >> n >> k; long long cnt = 0; for (int i = 1; i <= n; i++) { for (int j = n; j >= k; j--) { a[i][j] = n * n - cnt; ... |
#include <bits/stdc++.h> using namespace std; const int MAX = 2e5 + 100, inf = 0x3f3f3f3f; const int mod97 = 1e9 + 7, mod33 = 998244353; const int drc[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}}; struct edge { int to, cap, dis, nt; } e[MAX]; int tot, head[555]; int MinCost, MaxFlow; int n, m, K, Q,... |
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 10; int n, k; struct st { int v, p; }; bool cmp(st a, st b) { return a.v < b.v; } st a[MAX]; void solve() { sort(a + 1, a + n + 1, cmp); int t = 0; for (int i = 2; i <= n; ++i) { if (a[i].p == a[i - 1].p + 1) { ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, k, i, j; long long int flag = 0; cin >> n >> k; long long int m = n * n; long long int p; char a[1000][1000]; if (m % 2 == 0) { p = m / 2; } else { p = (m + 1) / 2; } if (k > p) { co... |
#include <bits/stdc++.h> using namespace std; int main() { int n, cnt = 0, i, l; cin >> n; for (i = 1; i <= n; i++) { cin >> l; if (l == 1) { cnt += 1; } } if (cnt > 0) { cout << HARD ; } else { cout << EASY ; } } |
#include <bits/stdc++.h> using namespace std; int INF = 0x3f3f3f3f; int INF2 = 0x7fffffff; long long LNF = 0x3f3f3f3f3f3f3f3f; long long LNF2 = 0x7fffffffffffffff; long long n, k, M, D; long long ans; int main() { scanf( %I64d%I64d%I64d%I64d , &n, &k, &M, &D); for (int i = (1); i <= (D); ++i) { ... |
#include<bits/stdc++.h> #define ll long long #define MAX 1000006 #define gcd(a, b) __gcd(a, b) #define lcm(a, b) ((a)*((b)/gcd(a,b))) using namespace std; //******************* my code starts here ********************************** int main() { int t; cin>>t; get... |
// 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() { long long int n, res; cin >> n; while (1) { if (n % 3 != 0) { res = (n / 3) + 1; break; } n = n / 3; } cout << res; return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { int n, q, x; vector<int> v; cin >> n; for (int i = 1; i <= n; i++) { cin >> x; v.push_back(x); } sort(v.begin(), v.end()); cin >> q; while (q--) { cin >> x; int ans = upper_bound(v.begin(), v.end(), x)... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; #define ar array #define ll long long const int MAX_N = 1e5 + 1; const int m = 1e9 + 7; const int INF = 1e9; const ll LINF = 1e18; int main() { int t=1; cin>>t; int n; while(t--) { cin>>n; int A[n]; for(int i=0;i<n;i+... |
//////////////////////////////////////////////////////////////////////
//// ////
//// uart_fifo.v ////
//// ////
//// ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ll t; cin >> t; while (t--) { ll n, m, k; cin >> n >> m >> k; k--; k--; if (m > n * (n - 1) / 2 || m < n - 1) { cout << nO << n ; continue; } if (k > 1) { ... |
#include <bits/stdc++.h> using namespace std; long long ans[1000005], anss[1000005][10]; int make(int n) { long long g = 1; if (n % 10 != 0) g = g * (n % 10); n = n / 10; while (n > 0) { if (n % 10 != 0) g = g * (n % 10); n = n / 10; } return g; } long long bit[1000005][11]... |
#include <bits/stdc++.h> #pragma GCC optimize(3) using namespace std; const double PI = acos(-1.0); const double eps = 1e-6; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch... |
#include <bits/stdc++.h> using namespace std; const int mod = 1000000007; const vector<int> mods = {998244353, 1000000007, 1000000009}; const long long inf = 3e18; const double pi = acos(-1.0); const double eps = 0.0000001; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template <c... |
#include <bits/stdc++.h> using namespace std; const int N = 200005; vector<int> g[N]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, s; cin >> n >> s; for (int i = 0; i < n - 1; ++i) { int a, b; cin >> a >> b; g[a].push_back(b); g[b].push_back(a); }... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`ifdef OVL_ASSERT_ON
wire xzcheck_enable;
`ifdef OVL_XCHECK_OFF
assign xzcheck_enable = 1'b0;
`else
`ifdef OVL_IMPLICIT_XCHECK_OFF
assign xzcheck_enable = 1'b0;
`else
assign xzcheck_e... |
`default_nettype none
module load_store_pipe_arbiter(
output wire oLDST_REQ,
input wire iLDST_BUSY,
output wire [1:0] oLDST_ORDER, //00=Byte Order 01=2Byte Order 10= Word Order 11= None
output wire [3:0] oLDST_MASK,
output wire oLDST_RW, //0=Read 1=Write
output wire [13:0] oLDST_ASID,
output wire [1:0] ... |
`timescale 1ns/10ps
/**
* `timescale time_unit base / precision base
*
* -Specifies the time units and precision for delays:
* -time_unit is the amount of time a delay of 1 represents.
* The time unit must be 1 10 or 100
* -base is the time base for each unit, ranging from seconds
* to femtoseconds, and must be:... |
//----------------------------------------------------------------------------
//-- Unidad de recepcion serie asincrona
//------------------------------------------
//-- (C) BQ. October 2015. Written by Juan Gonzalez (Obijuan)
//-- GPL license
//--------------------------------------------------------------------------... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e6; vector<int> g[MAXN], g1[MAXN]; int n, p, mp, m, all_n; void add(int t1, int t2) { g[t1 ^ 1].push_back(t2); g1[t2].push_back(t1 ^ 1); g[t2 ^ 1].push_back(t1); g1[t1].push_back(t2 ^ 1); } vector<int> order; bool vis[MAXN];... |
#include <bits/stdc++.h> using namespace std; int n, m; int f[300000]; int a[40]; int add(int a, int b) { return (a + b >= m) ? a + b - m : a + b; } void inc(int& a, int b) { a = (a + b >= m) ? a + b - m : a + b; } int main(void) { scanf( %d%d , &n, &m); for (int i = 0; i < n; i++) scanf( %d , &a[... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Wed Mar 01 09:53:17 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int a[N], b[N], len; bool vis[N]; int xx(int x) { if (x & 1) return x / 2; else return x / 2 - 1; } int main() { int t; cin >> t; while (t--) { len = 0; memset(vis, 0, sizeof vis); int n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.