text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int mxn = 2e5 + 10; int sp[mxn], arr[mxn]; vector<int> required[mxn], bit[mxn]; int ask(int p, int x) { int idx = lower_bound(required[p].begin(), required[p].end(), x) - required[p].begin(); int ret = 0; while (idx > 0) ret = max(r... |
#include <bits/stdc++.h> using namespace std; bool deb_mode = 0; class debugger { vector<string> vars; public: template <typename T> debugger &operator,(const T v) { stringstream ss; ss << v, vars.push_back(ss.str()); return *this; } void printall() { int j = 0, 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 la... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, t; cin >> n >> t; long long arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } sort(arr, arr + n); float mxdif = INT_MIN; for (int i = 1; i < n; i++) { if (arr[i] - arr[i - 1] > mxdif) { m... |
#include <bits/stdc++.h> using namespace std; long long calc(int n, int k) { int c = n / k; long long ans = c; ans += (long long)(n - k) * c / 2; return ans; } int main() { int n; cin >> n; vector<long long> a; for (int i = 1; i * i <= n; i++) if (n % i == 0) { a.pu... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:66777216 ) using namespace std; int inf = 1e9 + 7; long long INF = 1e18; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int main() { ios_base::sync_with_stdio(false); int k; cin >> k; vector<long long> a; map<long long, pa... |
/*
* PicoSoC - A simple example SoC using PicoRV32
*
* Copyright (C) 2017 Clifford Wolf <>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies... |
//-----------------------------------------------------------------------------
//-- Baudrate generator
//-- It generates a square signal, with a frequency for communicating at the given
//-- given baudrate
//-- The output is set to 1 only during one clock cycle. The rest of the time is 0
//-- Once enabled, the pulse i... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; cin >> t; while (t--) { int n; cin >> n; if (n == 2) { cout << 2 n1 2 n ; continue; } vector<pair<int, int>> ans; ... |
#include <bits/stdc++.h> using namespace std; const int N = 105; vector<int> adj[N]; int a[N], d[N], din[N]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d %d , a + i, d + i); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (i == j) cont... |
#include <bits/stdc++.h> using namespace std; int n, k; bool check(int x) { int s[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; int t; while (x > 0) { t = x % 10; if (t <= k) s[t]++; x /= 10; } for (int i = 0; i <= k; i++) { if (s[i] == 0) return false; } return true; }... |
/**
* 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; int fact(int a) { int res = 1; while (a > 0) { res *= a--; } return res; } int main() { int a, b; cin >> a >> b; cout << fact(min(a, b)); 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 law... |
#include <bits/stdc++.h> static const int MAXN = 50004; static const int MAXE = 100004 * 2; static const int MAXL = 20; static const int MAXT = 1000005; int n, e; int head[MAXN], dest[MAXE], next[MAXE]; int l[MAXN], t[MAXN][MAXL]; int T = 0; int p[MAXN]; int conf[MAXN], team[MAXN]; int team_conf[M... |
//
// Copyright (c) 1999 Thomas Coonan ()
//
// This source code is free software; you can redistribute it
// and/or modify it in source code form under the terms of the GNU
// General Public License as published by the Free Software
// Foundation; either version 2 of the License, or (at your option)
// ... |
/**
* 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; int main() { int k, n; scanf( %d%d , &n, &k); vector<int> a(n), b(n), distributed(n), p(n); vector<vector<int> > cart(k); for (int i = 0; i < n; ++i) { scanf( %d%d , &a[i], &b[i]); distributed[i] = 0; p[i] = i; } for (int i ... |
#include <bits/stdc++.h> using namespace std; long long int pow_mod(long long int a, long long int b) { long long int res = 1; while (b != 0) { if (b & 1) { res = (res * a) % 1000000007; } a = (a * a) % 1000000007; b /= 2; } return res; } void solve() { long l... |
/*
Copyright 2018 Nuclei System Technology, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except i... |
#include <bits/stdc++.h> using namespace std; long long n; struct mat { long long** val; mat() { val = new long long*[6]; for (int i = 0; i < 6; i++) { val[i] = new long long[6]; for (int j = 0; j < 6; j++) val[i][j] = 0; val[i][i] = 1; } } mat(long long v... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of... |
#include <bits/stdc++.h> using namespace std; string a, ans; int b; string c; int main() { while (cin >> a >> b) { for (int i = 0; i < a.size(); i++) if (a[i] >= A && a[i] <= Z ) a[i] = a[i] - A + a ; for (int i = 0; i < a.size(); i++) { if ((int)a[i] < b + 97) { ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 28.06.2017 17:24:09
// Design Name:
// Module Name: dmem
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision... |
/*
* Milkymist SoC
* Copyright (C) 2007, 2008, 2009, 2010, 2011 Sebastien Bourdeauducq
*
* 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, version 3 of the License.
*
* This program is dis... |
#include <bits/stdc++.h> using namespace std; long long a[101000]; long long pre[101000]; map<long long, long long> Hash; int main() { int n, k; scanf( %d%d , &n, &k); for (int i = 1; i <= n; i++) scanf( %I64d , &a[i]); for (int i = 1; i <= n; i++) pre[i] = pre[i - 1] + a[i]; Hash[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... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////////////
// Company: Digilent Inc.
// Engineer: Andrew Skreen
//
// Create Date: 07/11/2012
// Module Name: two_bit_counter
// Project Name: PmodGYRO_Demo
// Target Devices: Nexys3
// Tool versions: ISE 14.1... |
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0, f = 1; char ch; while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } return f * x; } inlin... |
#include <bits/stdc++.h> using namespace std; inline int read() { register int x = 0, t = 1; register char ch = getchar(); while ((ch < 0 || ch > 9 ) && ch != - ) ch = getchar(); if (ch == - ) t = -1, ch = getchar(); while (ch <= 9 && ch >= 0 ) x = x * 10 + ch - 48, ch = getchar(); r... |
/**
* 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... |
/*
read_eeprom.v
High Level module to read data from an i2c eeprom device.
inputs are:
- eeprom chip i2c slave address [7 bit]
- memory address to read from [16 bit]
- number of bytes to read [8 bit]
- start flag to begin the read operation [1-bit]
outputs are:
- data_out [8-bits]
- byte-ready [1-bit]
The n... |
#include <bits/stdc++.h> using namespace std; int main() { vector<long long int> v; long long int n, num, max_ind = 0, max_num = -1; cin >> n; for (long long int i = 0; i < n; i++) { cin >> num; v.push_back(num); if (num > max_num) { max_num = num; max_ind = i; ... |
#include <bits/stdc++.h> using namespace std; long long mod = 1000000007; const int INF = 1e9; const long long LINF = 1e18; long long mod_sum() { return 0LL; } template <typename T, typename... Args> T mod_sum(T a, Args... args) { return ((a + mod_sum(args...)) % mod + mod) % mod; } long long mod_... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5; const int B = 350; int a[N]; int b[N]; int tot = 0; mt19937 rng(4112003); struct Node { Node *l, *r; Node *p; int key, pri; int nCh, cnt[B]; Node(int x = 0) : key(x), pri(rng() << 16 | rng()), nCh(1) { l = r = 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> #pragma GCC optimize( O3 ) using namespace std; void io() {} long long fast_exp(long long base, int exp, int m) { long long res = 1; while (exp > 0) { if (exp % 2 == 1) { res = (res * base) % m; } base = (base * base) % m; exp /= 2; } retu... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:64000000 ) using namespace std; const int inf32 = 1e9 + 9; const long long inf64 = 1e18 + 18; const int N = 6e5 + 5; const long long mod = 1e9 + 7; map<int, int> mp; vector<int> primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31}; int n, mx; voi... |
#include <bits/stdc++.h> using namespace std; int N[10]; string shirt[5] = { S , M , L , XL , XXL }; map<string, int> mp; int main() { int K, i, d; for ((i) = 0; (i) < (int)(5); (i)++) cin >> N[i]; cin >> K; for ((i) = 0; (i) < (int)(5); (i)++) mp[shirt[i]] = i; for ((i) = 0; (i) < (in... |
#include <bits/stdc++.h> using namespace std; long long int n, p, k; long long int cost[200010]; long long int price() { long long int dp[200010] = {0}; sort(cost, cost + n); long long int ans = 0; for (long long int i = 0; i < n; i++) { if (i < k - 1) { dp[i] = cost[i] + (i == 0 ?... |
#include <bits/stdc++.h> using namespace std; pair<long double, int> v[100005]; int n; long double minn = 2 * 3.14159265358979323846264338327950288419716939937510 + 1; int minPos; int main() { cin >> n; for (int i = 1; i <= n; i++) { int x, y; cin >> x >> y; long double angle = ata... |
#include <bits/stdc++.h> using namespace std; int x[1000], y[1000], k, n, m; bool chck(int xx) { vector<int> v; v.push_back(1); v.push_back(m); for (int i = 0; i < k; ++i) { v.push_back(max(1, x[i] - xx)); v.push_back(max(1, x[i] - xx - 1)); v.push_back(min(m, x[i] + xx)); ... |
//*****************************************************************************
// (c) Copyright 2008-2009 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
// ... |
#include <bits/stdc++.h> using namespace std; const unsigned long long x = 31; unsigned long long X[60000]; int Ql[20], Qr[20]; char str[60000], s[60000]; int N; map<unsigned long long, int> T[20]; map<unsigned long long, bool> A; void add(int index, unsigned long long H) { T[index][H] = T[index][H] +... |
/*
ORSoC GFX accelerator core
Copyright 2012, ORSoC, Per Lenander, Anton Fosselius.
PER-PIXEL COLORING MODULE, alpha blending
This file is part of orgfx.
orgfx is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Fo... |
/*
* 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 double eps = 1e-5; const int p = 131; const int inf = 0x3f3f3f3f; const long long mod = 1e9 + 7; const int N = 1e6 + 10; long long Hash[N], fac[N]; char s[N], ss[N]; long long get(int l, int r) { return (Hash[r] - Hash[l - 1] * fac[r - l + 1] % m... |
/**
* 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 comment(linker, /STACK:136777216 ) using namespace std; int bits(int x) { return x == 0 ? 0 : 1 + bits(x & (x - 1)); } int v[30][30]; int dp[2][26][111]; int main() { const int ninf = -1000000; for (int(i) = 0; (i) < (30); (i)++) for (int(j) = 0; (j) < (30); (... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Xilinx
// Engineer: Parimal Patel
// Create Date: 04/13/2017
// Module Name: fsm_controller
// Project Name: PYNQ
//////////////////////////////////////////////////////////////////////////////////
modul... |
module tb;
reg clk = 0;
reg rst = 1;
wire mm_we;
wire [0:11] mm_adr;
wire [0:17] mm_din;
wire [0:17] mm_dout;
wire [0:3] mm_unit;
reg [0:5] sw_sn = 6'b0;
reg [0:17] sw_tw = 18'o777777;
reg cntrl_stop = 0;
reg cntrl_halt = 0;
wire cntrl_paused;
wire [0:1] ... |
#include <bits/stdc++.h> using namespace std; int main() { int boxes; cin >> boxes; int arr[boxes]; for (int i = 0; i < boxes; i++) cin >> arr[i]; int shots; cin >> shots; int x, y; for (int i = 0; i < shots; i++) { cin >> x >> y; if (x == 1) { arr[x] += (arr[x - ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:43:45 02/20/2015
// Design Name:
// Module Name: Fetch
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependenc... |
/*
* RS-232 asynchronous TX module
* Copyright (C) 2010 Donna Polehn <>
*
* This file is part of the Zet processor. This processor is free
* hardware; 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... |
/**
* 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... |
// file: Clock48MHZ_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 discla... |
/*
* The MIT License (MIT)
*
* Copyright (c) 2015 Stefan Wendler
*
* 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 us... |
//код модуля на verilog
module ay_note_ram(addr, data);
input wire [6:0] addr;
output wire [11:0] data; //12 бит - максимум
reg [11:0] note_ram [0:127];
initial begin
note_ram[0] <= 12'd03977;
note_ram[1] <= 12'd03977;
note_ram[2] <= 12'd03977;
note_ram[3] <= 12'd03977;
note_ram[4] <= 12'd03977;
note_ram[5]... |
#include <bits/stdc++.h> using namespace std; vector<long long> translate; long long get(long long x) { return lower_bound(translate.begin(), translate.end(), x) - translate.begin(); } int main() { ios_base::sync_with_stdio(0); long long n; cin >> n; if (n == 1) { cout << 1 << endl; ... |
// $Header: /devl/xcs/repo/env/Databases/CAEInterfaces/verunilibs/data/spartan4/ODDR2.v,v 1.1 2004/06/21 21:45:36 wloo Exp $
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2004 Xilinx, Inc.
// All Right Reserved.
////////////////////////////////////////////////////... |
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t-- > 0) { int n; string s; cin >> n >> s; vector<int> a(n, 0), b(n, 0), c; int flag1 = 1, flag2 = 1; for (int i = 0; i < n - 1; i++) { if (s[i] == < ) { b[i] =... |
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); struct Aho { enum { ALPHA = 30 }; struct Node { int p = -1, link = -1, superLink = -1; int next[ALPHA], go[ALPHA]; bool leaf = false; vector<int> leaves; char ch... |
#include <bits/stdc++.h> using namespace std; const int N = 11; const int Inf = 1e9; vector<int> dx[3] = { {-1, 0, 0, 1}, {-1, -1, 1, 1}, {-1, 1, 2, 2, 1, -1, -2, -2}}; vector<int> dy[3] = { {0, -1, 1, 0}, {-1, 1, -1, 1}, {-2, -2, -1, 1, 2, 2, -1, 1}}; int n; pair<int, int> g[3][3][N][N][N][N]... |
#include <bits/stdc++.h> using namespace std; #define ll long long int const int N=1000005; //vector<int>prime; bool prime[N]; void sieve() { int k=sqrt(N-2); for(int i=1;i<=N-2;++i) prime[i]=true; for(int i=2;i<=k;++i) { if(prime[i]) { f... |
#include <bits/stdc++.h> using namespace std; int n, m, l, r, q; map<pair<int, int>, int> vi; int V[100005 << 2], ly[100005 << 2]; void push_down(int o) { if (ly[o]) { ly[o << 1] |= ly[o]; ly[o << 1 | 1] |= ly[o]; V[o << 1] |= ly[o]; V[o << 1 | 1] |= ly[o]; ly[o] = 0; } ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// UART RX Module
// Paul Mumby 2012
// Originally derived from code examples at:
// http://www.fpga4fun.com
//////////////////////////////////////////////////////////////////////////////////
module uart_rx(
clk, ... |
/*
* Copyright (c) 2002 Richard M. Myers
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* ... |
#include <bits/stdc++.h> using namespace std; struct edge { int t, f, w; bool operator<(const edge& e) const { return w > e.w; } edge(int from, int to, int weight) { t = to; f = from; w = weight; } }; const double EPS = (1e-9); class UnionFind { public: vector<int> p, ... |
module top;
reg pass = 1'b1;
wire [3:0] part_idx_up, part_idx_down, part_sel;
wire [3:0] ps_array [1:0];
// Check the positive indexed part select.
// assign part_idx_up[-1+:2] = 2'b01; // We do not currently support this!
assign part_idx_up[1+:2] = 2'b01;
assign part_idx_up[3+:2] = 2'b01;
assign part_i... |
module wb_mux_tb
(input wb_clk_i,
input wb_rst_i,
output done);
localparam NUM_SLAVES = 4;
localparam aw = 32;
localparam dw = 32;
localparam MEMORY_SIZE_WORDS = 32'h100;
localparam MEMORY_SIZE_BITS = 8;
/*TODO: Find a way to generate MATCH_ADDR and MATCH_MASK based on memory
... |
#include <bits/stdc++.h> using namespace std; bool check_lucky(long long num) { while (num) { if ((num % 10) == 8) return 1; num /= 10; } return 0; } int main() { long long num; cin >> num; int flag = 0, ans = 1, f2 = 0; if (num < 0) { flag = 1; num *= (-1); ... |
#include <bits/stdc++.h> using namespace std; int n, cnt = 0; map<int, int> mp; int main() { cin >> n; mp[n]++; cnt++; while (n) { n++; while (!(n % 10)) n /= 10; if (mp[n]) break; mp[n]++; cnt++; } cout << cnt << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long a; cin >> a; long long m = 0; vector<long long> c; long long b[a]; for (int i = 0; i < a; i++) { cin >> b[i]; } for (int y = 0; y < ... |
//faux_sata_hd_phy.v
/*
Distributed under the MIT license.
Copyright (c) 2011 Dave McCoy ()
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 ri... |
#include <bits/stdc++.h> using namespace std; struct circle { long double x, y, r; }; struct mod { long double theta, op; }; struct node { long double x, y, theta; }; int n, d, i, j, tot, S, ans, gg; circle c[20005]; mod l[2000005]; node A, B; long double D, k, t, L, R, dis1, dis2, d... |
// file: pll_exdes.v
//
// (c) Copyright 2008 - 2011 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5, maxm = 1e5 + 5; int first[maxn], n, k; struct edge { int to; int next; } E[maxm]; int vis[maxn]; int order[maxn], p; int a[maxn]; bool dfs(int u) { vis[u] = -1; for (int e = first[u]; e != -1; e = E[e].next) { ... |
#include <bits/stdc++.h> using namespace std; bool const TO_FILE = false; string const FILENAME = ; void prepare() { if (TO_FILE) { freopen((FILENAME + .in ).c_str(), r , stdin); freopen((FILENAME + .out ).c_str(), w , stdout); } } void solve() { int n, m, k; cin >> n >> m ... |
#include <bits/stdc++.h> using namespace std; int n, k, sum; string a; int main() { cin >> n >> k; for (int i = (0); i < (n); i++) { int l, r; cin >> l >> r; sum += (r - l + 1); } if (sum % k == 0) cout << 0 << endl; else { int u = sum; while (u % k) u++; ... |
`timescale 1ns/10ps
`include "pipeconnect.h"
/*
Notation:
_ low, 0
~ high, 1
/ posedge
\ negedge
. unknown,undetermined,unimportant
# valid data (held stable)
< changing
> --
*/
/*
Fasttarget presents the request address as the result data after one
cycle. Wait is never asserted.
WISHBONE - no... |
#include <bits/stdc++.h> char s[1005]; int a[25], mark[6071], dp[1005][6071], ch[6071][12], link[6071], tl, ans = 1e9, x, n; void insert(int len) { int rt = 0; for (int i = 1; i <= len; ++i) { if (!ch[rt][a[i]]) ch[rt][a[i]] = ++... |
/* SPDX-License-Identifier: MIT */
/* (c) Copyright 2018 David M. Koltak, all rights reserved. */
/*
* rcn bus buffered bridge.
*
*/
module rcn_bridge_buf
(
input rst,
input clk,
input [68:0] main_rcn_in,
output [68:0] main_rcn_out,
input [68:0] sub_rcn_in,
output [68:0] sub_rcn_out
);
... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { (i + j) % 2 ? cout << B : cout << W ; } cout << endl; } } |
#include <bits/stdc++.h> using namespace std; int n, d; int a[200]; int x[200], y[200]; int dis[200]; vector<pair<int, int> > edge[200]; int bellman_ford() { for (int i = 0; i < n; ++i) dis[i] = 1000000000; dis[0] = 0; for (int i = 1; i < n; ++i) { for (int j = 0; j < n; ++j) { f... |
/**
* 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: 17:39:25 01/29/2016
// Design Name: control_unit
// Module Name: /home/poche002/Desktop/ArqComp/Trabajo_final/arquitectura_tpf/control_unit_tb.v
// Project Name: arq... |
#include <bits/stdc++.h> using namespace std; int main() { long long a, n, b, x, y, s; int q; cin >> q; while (q--) { cin >> a >> b >> n >> s; long long ts = a * n + b; if (ts < s) { cout << NO n ; continue; } if (s % n > b) { cout << NO n ; ... |
`include "../RF/reg_32bits.v"
`include "../lib/mux32bits_32to1.v"
`include "../lib/dec_5to32.v"
module reg_file (
input [4:0] readReg1, readReg2, writeReg,
input [31:0] writeData,
input regWrite, clk,
output [31:0] readData1, readData2);
wire [31:0] regOutput0, regOutput1, regOutput2, regOutput3, regOutp... |
/*
* 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 law... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; assert(n >= 1 && n <= 10000 && m >= 1 && m <= 10); if (n == m && (n == 1 || n == 2)) cout << n << endl; else { if (n == m) cout << n << endl; else { int t2 = 0, t1 = 0; i... |
#include <bits/stdc++.h> using namespace std; double dist(double x1, double y1, double x2, double y2) { double dx = x1 - x2; double dy = y1 - y2; return sqrt(dx * dx + dy * dy); } double catet(double a, int b) { double z = a * a - b * b; if (z < 1e-12) z = 0; return sqrt(z); } int ma... |
/*
* c4puter northbridge - simple two-register Wishbone GPIO
* Copyright (C) 2017 Chris Pavlina
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at... |
#include <bits/stdc++.h> #define ll long long int #define vi vector<ll> #define vvi vector<vector<ll>> #define pii pair<ll, ll> #define pb push_back #define rep0(i, n) for(ll i = 0;i<n;i++) #define rep1(i, n) for(ll i = 1;i<n;i++) #define all(v) v.begin(),v.end() #define fast ... |
#include <bits/stdc++.h> using namespace std; bool viz[105][105]; int dx[4] = {0, 1, 0, -1}; int dy[4] = {1, 0, -1, 0}; int main() { cin.tie(0)->sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL); int T = 1; while (T--) { int n, m, x, y; cin >> n >> m >> x >> y; vector<pai... |
/**
* 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 comparator_counter(
input wire iCLOCK,
input wire inRESET,
//Main Counter
input wire iMTIMER_WORKING,
input wire [63:0] iMTIMER_COUNT,
//Timmer Settings
input wire iCONF_WRITE,
input wire iCONF_ENA,
input wire iCONF_IRQENA,
input wire iCONF_64MODE,
input wire iCONF_PE... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.