text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int a[100010]; inline int read() { char c = getchar(); int x = 0, flag = 1; while (!isdigit(c)) { if (c == - ) flag = -1; c = getchar(); } while (isdigit(c)) x = x * 10 + c - 0 , c = getchar(); return x * flag; } int main() { ... |
#include <bits/stdc++.h> using namespace std; struct Node { int d; struct Node *left, *right; }; int p[1000][1000] = {0}; string s, t; void dp(int i, int j) { if (j - i + 1 == t.size()) { int f = 1; for (int z = 0; z < t.size(); z++) { if (s[i + z] != t[z]) { f = 0;... |
#include <bits/stdc++.h> int a[100005]; inline int max(int x, int y) { return x > y ? x : y; } int main() { int ans = 0, n, Max, Min, Maxpos, Minpos; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); int l = 1, r = 1; while (r <= n && a[r] == a[1]) r++; if (r == n + 1) retu... |
//local memory controller
module lmcnt
(
input CLK,
input RESET_X,
//cpu
input SOFT_RESET,
input START,
output reg FINISH,
input [1:0] MSEL_INPUTA_SEL,
input [1:0] MSEL_INPUTB_SEL,
input [1:0] MSEL_OUTPUTC_SEL,
input [9:0] M1POS,
input [9:... |
/*
* 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() { int a, b; cin >> a >> b; a = abs(a - b); b = a / 2; a = a / 2 + (a & 1); cout << (a * a + a) / 2 + (b * b + b) / 2 << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; int arr[1003]; int main() { int n, x, ans, sum, t, ck; cin >> t; while (t--) { cin >> n >> x; for (int i = 1; i <= n; i++) cin >> arr[i]; sort(arr + 1, arr + n + 1); ck = 0; for (int i = 1; i <= n; i++) { if (arr[i] ==... |
`include "rv32_opcodes.vh"
`include "constants.vh"
`default_nettype none
module src_a_mux(
input wire [`SRC_A_SEL_WIDTH-1:0] src_a_sel,
input wire [`ADDR_LEN-1:0] pc,
input wire [`DATA_LEN-1:0] rs1,
output reg [`DATA_LEN-1:0] alu_src_a
... |
#include <bits/stdc++.h> using namespace std; long long dp[100003][3], ara[100003], mod = 1000000007, n, m; long long solve(long long idx, long long sta) { if (idx == n) { if (sta == 0 || sta == 2) return 1; else { return 0; } } else if (dp[idx][sta] != -1) return 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... |
//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... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, l = -1, j, p, m; long k; cin >> n >> k; long long a[k]; for (long i = 0; i < k; i++) { cin >> a[i]; j = n / a[i]; if ((j * a[i]) > l) { l = j * a[i]; p = i + 1; m = j; } } ... |
#include<bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define int long long #define line cout<< [At <<__LINE__<< ] <<endl; #define size(x) ((int)x.size()) namespace Debug{ void __print(signed x){cout << x;} void __print(long x){cout << 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 law... |
#include <bits/stdc++.h> using namespace std; inline long long Getint() { char ch = getchar(); long long x = 0, fh = 1; while (ch < 0 || ch > 9 ) { if (ch == - ) fh = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { (x *= 10) += ch ^ 48; ch = getchar(); } ... |
#include <bits/stdc++.h> using namespace std; const int inf = 0x7fffffff; long long a[510][510], n; int main() { while (~scanf( %I64d , &n)) { if (n == 1) { scanf( %I64d , &n); printf( 1 n ); continue; } for (int i = 1; i <= n; ++i) { for (int j = 1; j <= n;... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: ddr2um_fifo.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
// altera_mf
// ===============================... |
//*****************************************************************************
// (c) Copyright 2009 - 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 prope... |
/**
* 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> #pragma GCC optimize( O3 ) using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); long long rand_seed() { long long a = rng(); return a; } int t; int n; string s; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ... |
#include <bits/stdc++.h> using namespace std; int main() { int a, n; cin >> a >> n; int tilln = (1LL * n * (n - 1) / 2) % 1000000007, tilla = (1LL * a * (a + 1) / 2) % 1000000007; cout << ((((((1LL * tilln) % 1000000007) * tilla) % 1000000007) * n) % 1000000007 + ... |
#include <bits/stdc++.h> int main(void) { char s[30], t[30], s1[30], s2[30]; scanf( %s %s , s, t); int i = 0, c1 = 0, c2 = 0, c3 = 0; while (s[i] != | ) { s1[c1++] = s[i]; i++; } i++; while (s[i] != 0 ) { s2[c2++] = s[i]; i++; } i = 0; while (t[i++] !... |
`timescale 1ns / 1ps
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
* Copyright (C) 2007 Das Labor
*
* 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, ... |
#include <bits/stdc++.h> using namespace std; const bool ready = []() { ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(12); return true; }(); const double PI = acos(-1); using ll = long long; using pii = pair<ll, ll>; using pdd = pair<double, double>; using v... |
/*
Copyright (c) 2014-2018 Alex Forencich
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, publish, distri... |
#include <bits/stdc++.h> using namespace std; int gcd(int a, int b) { return a ? gcd(b % a, a) : b; } int main() { string s; cin >> s; int a[26] = {0}; for (int i = 0; i < s.length(); i++) a[s[i] - a ]++; string ans = s; for (int i = 0; i < s.length(); i++) ans[i] = # ; for (int i = ... |
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int Q; cin >> Q; while (Q-- > 0) { int n; cin >> n; vector<int> dp(2001, inf); dp[0] = 0; for (int i = 0; i < n; ++i) { int a... |
// 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 <bits/stdc++.h> using namespace std; const double PI = 2.0 * acos(0.0); const double EPS = 1e-9; const int MOD = 1000003; const int INF = 1000000000; const long long LINF = 1000000000000000000LL; vector<string> vs; bool row[500010], col[500010]; int main() { int n, m, ret = 1; cin >> ... |
/////////////////////////////////////////////////////////////////////
//// ////
//// or1200_fpu_intfloat_conv_except ////
//// ////
//// Author: Rudolf Usselmann ... |
`timescale 1ns / 1ps
// UART wants the LSB first
// RX modified to accept 40 MHz clock and receive at 115200 bps
// Note 40e6 / 115200 = and 347.2 / 2 = 173.6 ~= 174 cycles
// For 460800
// 40e6 / 460800 = 86.8 and 86.8 / 2 =~= 43
// For 230400
// 40e6 / 230400 = 173.6 and 173.6/2 = 86.8
// Modified for 460800 ... |
#include <bits/stdc++.h> using namespace std; char str[1000005]; int main() { while (scanf( %s , str) != EOF) { int i, len = strlen(str); long long m, l = 0, r = 0; for (i = 0; i < len; i++) if (str[i] == ^ ) m = i; for (i = 0; i < len; i++) if (str[i] >= 1 && str[i... |
// file: mmcm_mkid_tb.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... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, c, b; cin >> n >> c >> b; int a[n]; for (int i = 0; i < n; i++) { a[i] = i + 1; } if (n - 2 < c + b || abs(c - b) > 1) { cout << -1 ; } else { ... |
#include <bits/stdc++.h> using namespace std; const long long M = 4e5 + 10; long long t, n, k, p, a[M], dp[M], s[M], ans; long long bs(long long r, long long rem) { long long l = 0, mid; r++; while (r - l > 1) { mid = (r + l) / 2; if (s[mid] > rem) r = mid; else l =... |
// ----------------------------------------------------------------------
// Copyright (c) 2016, 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:... |
//////////////////////////////////////////////////////////////////////
//// ////
//// OR1200's reg2mem aligner ////
//// ////
//// This file is part of the OpenR... |
//////////////////////////////////////////////////////////////////////////////
//
// Xilinx, Inc. 2010 www.xilinx.com
//
// XAPP xxx - TMDS serial stream phase aligner
//
//////////////////////////////////////////////////////////////////////////////
//
// File name : phasealigner.v
//
// Descr... |
#include <bits/stdc++.h> using namespace std; int main() { int ppl, s = 0, maxn = 0; cin >> ppl; int wel[ppl]; for (int j = 0; j < ppl; j++) { cin >> wel[j]; if (maxn < wel[j]) { maxn = wel[j]; } } for (int i = 0; i < ppl; i++) { s = s + maxn - wel[i]; } ... |
#include <bits/stdc++.h> using namespace std; const int INF = 2123456789; int a, b, c; int n, m, k; int x, y; string s; int start[500]; int target[500]; vector<pair<int, int> > ops; int calendar[] = {0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; int search(int base, int val) { for... |
#include <bits/stdc++.h> using namespace std; const long long INF = 9223372036854775807LL; const long double PI = acos(-1); const int MAX_N = 1e+6; const string digits = 0123456789 ; const string alph = abcdefghijklmnopqrstuvwxyz ; void solve() { long long n, root, answer; cin >> n; for (lon... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-9; const int INF = (int)1e9 + 7; const long long linf = (long long)1e16 + 7; struct pnt { double x, y; pnt(double x, double y) : y(y), x(x) {} pnt() = default; }; int cmp(double a, double b) { if (abs(a - b) < eps) return ... |
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; int start; int tail; int head[150500], to[150500], nxt[150500], wei[150500], cost[150500], tot = 1; int dis[5050], pre[5050], pres[5050]; bool vis[5050]; queue<int> que; int n, sum, k; int used, flow; char str[105]; int nu... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; int arr[n]; set<int> s; for (int i = 0; i < n; i++) { int temp; cin >> temp; s.insert(temp); } if (s.size() != n) cout << ... |
/*
* 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 long long MOD = (long long)(1000000007); const double eps = 1e-9; const double pi = 3.1415926535897932384626; long long gcd(long long a, long long b) { return (b ? gcd(b, a % b) : a); } bool isprime(int n) { if (n == 1) return false; for (long long... |
#include <bits/stdc++.h> using namespace std; int N; int A[100005]; int main(int argc, char *argv[]) { scanf( %d , &N); for (int i = (1), _n = (N); i <= _n; i++) scanf( %d , &A[i]); int hi = -1; for (int i = (1), _n = (N); i <= _n; i++) hi = max(hi, A[i]); bool done[100005] = {false}; in... |
module Forward(
input EX2MEM_RegWrite,
input MEM2WB_RegWrite,
input [4:0] EX2MEM_Rd, // !!! AddrC i.e. EX2MEM_Rd
MEM2WB_Rd, // !!! AddrC i.e. MEM2WB_Rd
ID2EX_Rs,
IF2ID_Rs,
ID2EX_Rt,
IF2ID_Rt,
ID2EX_Rd,
output reg[1:0]... |
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2018, Darryl Ring.
//
// 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... |
#include <bits/stdc++.h> using namespace std; int an[101][21][21], n, k, md = 1e9 + 7, t[21][21]; vector<int> tr[101]; void go(int v = 1, int p = 0) { an[v][0][1] = an[v][1][0] = 1; for (int i = 0; i < (int)(tr[v].size()); ++i) { int u = tr[v][i]; if (u == p) continue; go(u, v); ... |
#include <bits/stdc++.h> using namespace std; string S; signed long long mo = 1000000007; int N; string qs[100005]; signed long long memo[20][100005]; signed long long dig[20][100005]; void solve() { int i, j, k, l, r, x, y; string s; cin >> qs[0]; cin >> N; N++; qs[0] = 0-> + ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, i; cin >> n; long long int a[n], p, b[100000], sum = 0, r = 0, c[n]; for (i = 0; i < n; i = i + 1) { cin >> a[i]; p = a[i]; b[p] = 0; c[i] = 1; } for (i = 0; i < n; i = i + 1) { p = a[i]... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; while (n--) { int a, b; cin >> a >> b; int sum = 0; int h; for (int i = 1; i < a; i++) { sum += i; if (sum >= b) { sum -= i; h = i - 1; break; }... |
#include <bits/stdc++.h> using namespace std; int n; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); int n, k; cin >> n >> k; vector<int> v(n); long long sum = 0; for (int i = 0; i < n; i++) { cin >> v[i]; sum += v[i]; } if (sum % k != 0) cout ... |
// bug637
module submod_a
(
//Inputs
input wire signed [15:0] serial_in,
//Outputs
output wire signed [15:0] parallel_out [0:7]
);
endmodule
module submod_b
(
//Inputs
input wire signed [15:0] parallel_out [0:7],
//Outputs
output wire signed [15:0] final_out [0:7]
);
endmodule
mod... |
/*
* 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; using namespace chrono; const int infinity = (int)1e9 + 42; const int64_t llInfinity = (int64_t)1e18 + 256; const int module = (int)1e9 + 7; const long double eps = 1e-8; mt19937_64 randGen(system_clock().now().time_since_epoch().count()); inline void raiseE... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; vector<vector<pair<long long, long long>>> adj; vector<long long> dist; vector<bool> visited; void djikstra(long long src) { priority_queue<pair<long long, long long>, vector<pair<long long, long long>>, grea... |
module data_receiver(iClock, iReset, iRxDone, iReceivedData, oResultData, oDoneReceiving);
parameter IDLE = 3'b000,
FETCH_FIRST_VALUE = 3'b001,
CHECK_VALUE = 3'b010,
RECEIVE_DATA = 3'b011,
EMIT_DONE_RECEIVING = 3'b100,
RECEIVING_DATA = 3'b101,
FETCH_VALUE_INC_COUNTER = 3'b110,
INPUT_MESSAGE = 2'b00,
C... |
#include <bits/stdc++.h> using namespace std; vector<long long int> g[200001], rg[200001]; bool vis[200001]; long long int par[200001]; long long int sz[200001], dnom[200001]; long long int ans = 0, no = 0; long long int n, m, S; deque<long long int> top; void dfs(long long int x) { vis[x] = 1; ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; long long dp[N], f[N], ok[N], p[N]; vector<long long> node[N]; long long cur, now; void dfs(long long u, long long p) { for (auto j : node[u]) { if (j == p) continue; dfs(j, u); if (f[j]) { dp[u] += dp[j] + 1;... |
#include <bits/stdc++.h> using namespace std; bool cmp(int a, int b) { return a > b; } int main() { string s; cin >> s; vector<int> a, b; vector<int> dec1, dec2; int sum1 = s[0] - 0 + (s[1] - 0 ) + (s[2] - 0 ); int sum2 = (s[3] - 0 ) + (s[4] - 0 ) + (s[5] - 0 ); if (sum1 == sum2... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: ccnu
// Engineer: Poyi Xiong
//
// Create Date: 01/13/2017 04:41:05 PM
// Design Name:
// Module Name: top_sr_tb
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependen... |
#include <bits/stdc++.h> long double pi = acos(-1); long long z = 1000000007; long long power(long long a, long long b) { if (b == 0) return 1; long long c = power(a, b / 2); if (b % 2 == 0) return c * c; else return c * c * a; } using namespace std; const int N = 1e6 + 7; void... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops,fast-math ) using namespace std; const double inf = 1e121; const double eps = 1e-10; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); long long randint(long long l, long long r) { long long out = rng... |
#include <bits/stdc++.h> using namespace std; int v[100005], u[100005], w[100005], dist[100005]; vector<pair<int, int> > edges[100005]; priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > pq; int main() { int n, m, s, l; while (cin >> n >> m >> s) ... |
//
// Copyright 2011 Ettus Research LLC
//
// 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 dis... |
//Com2DocHDL
/*
:Project
FPGA-Imaging-Library
:Design
Crop
:Function
Cropping images, depending on your top, bottom, left and right coordinate.
Give the first output after 1 cycle while the input enable.
:Module
Main module
:Version
1.0
:Modified
2015-05-25
Copyright (C) 2015 Tianyu Dai (dtysky) <>
This librar... |
#include <bits/stdc++.h> using namespace std; string rows[1000]; int dist[1000][1000]; bool disc[1000][1000]; int r, c; void bfs(int row, int col) { queue<pair<int, int> > q; q.push(make_pair(row, col)); while (!q.empty()) { pair<int, int> cur = q.front(); disc[cur.first][cur.second]... |
#include <bits/stdc++.h> using namespace std; int n, m; int r1, c1, r2, c2; char s[505][505]; bool dfs(int i, int j) { if (r2 == i && c2 == j && s[r2][c2] != . ) return 1; if (s[i][j] != . ) return 0; s[i][j] = X ; return dfs(i + 1, j) || dfs(i - 1, j) || dfs(i, j + 1) || dfs(i, j - 1); }... |
/*
`include "arbitor.v"
module test_arbitor_cell();
reg [2:0] priority;
reg [3:0] rmatrix0, rmatrix1, rmatrix2, rmatrix3, rmatrix4;
reg valid0, valid1, valid2, valid3, valid4;
reg [4:0] amatrix_o;
reg [14:0] rco;
wire [4:0] amatrix_n;
wire [14:0] rcn;
arbitor_cell ac(priority, ... |
/**
* 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... |
/**
* Hydra - An open source strand lighting controller
* (c) 2013-2014 Jon Evans <>
* Released under the MIT License -- see LICENSE.txt for details.
*
* strand_driver_tb.v - Testbench for WS2801/WS2811 driver state machine
*/
`timescale 1ns / 1ps
module strand_driver_tb;
parameter MEM_DATA_WIDTH = 24;
... |
#include <bits/stdc++.h> using namespace std; const int N = (int)1e4 + 10; struct Edge { int from, to, l, r, nxt; } e[N << 2]; int head[N], cnt = 0; int n, m, k, s1, s2, f, book[N]; long long d1[N], d2[N]; void add(int u, int v, int l, int r) { e[++cnt] = (Edge){u, v, l, r, head[u]}; head[u]... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; struct pt { int x, y; pt() {} pt(int x, int y) : x(x), y(y) {} }; int get_pos(int i, int n) { if (i >= n) i -= n; return ((i >= 0) ? i : n - i - 1); } void solve() { int n; cin >> n; vector<pt> v(n); for (int i = 0; i < n; ++i... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This test demonstrates an issue with sign extension.
// Assigning to localparms larger than 32 bits broke in 3.862
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2015 by Mike Thyer.
module t (/*AUTOARG*/
// Inputs
c... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long int n, r, an; cin >> n >> r; if (r < n) an = (r) * (r + 1) / 2; else { an = (n) * (n - 1) / 2; an++; } cout << an; cout << n ; } }... |
#include <bits/stdc++.h> #define int long long #define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) using namespace std; #define MOD 1000000007 #define nline n #define pb push_back #define mp make_pair #define fi first #d... |
#include <bits/stdc++.h> using namespace std; const int dx[] = {-1, 0, 1, 0}; const int dy[] = {0, -1, 0, 1}; inline int read() { int ans = 0; bool f = 1; char ch = getchar(); while (!isdigit(ch)) f ^= ch == - , ch = getchar(); while (isdigit(ch)) ans = ((ans << 2) + ans << 1) + (ch ^ 48), ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; const ll INF = 1e18; const ll MOD = 1e9 + 7; const ld EPS = 1e-10; const ld PI = acos(-1); vector<ll> po[2]; ll n, k; pair<ll, ll> CountHash(ll x, ll ind, ll q) { ll h1 =... |
#include <bits/stdc++.h> using namespace std; struct node { int x1, y1; } ar[500101]; bool cmp(node &b1, node &b2) { if (b1.x1 == b2.x1) return b1.y1 < b2.y1; return b1.x1 < b2.x1; } int main() { long long q, i, j, k, v, c = 0, p1, p2, t, n, x, y, p; cin >> n; for (i = 0; i < n; i++)... |
`include "hrfp_defs.vh"
module hrfp_mult_detect_round_overflow(input wire clk,
input wire [53:0] mantissa,
input wire [`EXPONENTBITS-1+1:0] precalculated_exponent4,
output reg [`MANTISSABITS-1:0] new_mantissa,
output reg [`EXPONENTBITS-1:0] new_exponent,
output ... |
// (C) 1992-2014 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 simulati... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; int n, m, q; long long ans, in[N], out[N]; vector<int> f[N]; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= m; ++i) { int x, y; scanf( %d%d , &x, &y); if (x > y) swap(x, y); f[x].push_back(y); ... |
/*
* 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, ans = 0; vector<int> a[100005]; int main() { cin >> n; for (int i = 1; i <= n; i++) { int k, x; cin >> k; while (k--) { cin >> x; a[i].push_back(x); } sort(a[i].begin(), a[i].end()); } a[0] = a[n];... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 5; int N, M; int arr[MAXN]; int dp[MAXN]; int main() { cin.tie(0); cin.sync_with_stdio(0); cin >> N >> M; int prv; cin >> prv; int lft = 1; for (int a = 2; a <= N; a++) { int cur; cin >> cur; i... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: pcx_databuf_pa.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 an... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2019 Xilinx, Inc.
// All Rights Reserved
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ Version : 1... |
#include <bits/stdc++.h> using namespace std; const int L = 2e5 + 7; long long out[L], a[L], counter[1000001], szs = 900; struct node { long long l, r, q; }; bool comp(node x, node y) { long long xx = x.l / szs, yy = y.l / szs; if (xx == yy) return x.r < y.r; return x.l < y.l; } long lon... |
#include <bits/stdc++.h> using namespace std; ifstream in; ofstream out; const long long kk = 1000; const long long ml = kk * kk; const long long mod = ml * kk + 7; const long long inf = ml * ml * ml + 7; long long n, i, j; vector<long long> m; vector<pair<long long, long long> > x; bool viv = fal... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 15:47:35 03/24/2015
// Design Name:
// Module Name: clk_divider
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
/... |
/*
* 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... |
`default_nettype none
// ============================================================================
module transmitter #
(
parameter WIDTH = 8,
parameter MODE = "SDR"
)
(
// Input clock and reset
input wire CLK,
input wire RST,
// Data for comparison
output wire O_STB,
output wire [WIDTH-1:0] O_DAT,
// Seriali... |
//Fake CPU
/* verilator lint_off MULTIDRIVEN */
module CPU (
input reset,
input clk_neg,
input clk_pos,
input ce_n,
input ce_p,
output [15:0] cpu_addr,
output [7:0] cpu_dout,
input [7:0] cpu_din,
output reg nMREQ,
output reg nIORQ,
input nINT,
output... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.