text stringlengths 59 71.4k |
|---|
/* lab2_part4.v
*
* Copyright (c) 2014, Artem Tovbin <arty99 at gmail dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope tha... |
#include <bits/stdc++.h> using namespace std; int n, m, k, a[2005][2005], ans, p; int main() { cin >> n >> m >> k; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { char c; c = getchar(); while (c != . && c != * ) c = getchar(); a[i][j] = c; if (c... |
// Attention!! Кеши важны и тут
// "FPGAs are very good at streaming models,
// while GPUs are better at burst mode models."
// Choose:
// http://electronics.stackexchange.com/questions/56302/how-to-access-ram-for-use-with-an-fpga-for-high-performance-computing
// https://www.altera.com/en_US/pdfs/literature/hb/nios2... |
// Copyright (C) 2020-2021 The SymbiFlow Authors.
//
// Use of this source code is governed by a ISC-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/ISC
//
// SPDX-License-Identifier:ISC
module top (
(* CLOCK_SIGNAL = "yes", WAVEFORM = "0 5" *)
input clk,
in... |
`include "assert.vh"
module cpu_tb();
reg clk = 0;
//
// ROM
//
localparam MEM_ADDR = 4;
localparam MEM_EXTRA = 4;
reg [ MEM_ADDR :0] mem_addr;
reg [ MEM_EXTRA-1:0] mem_extra;
reg [ MEM_ADDR :0] rom_lower_bound = 0;
reg [ MEM_ADDR :0] rom_upper_bound = ~0;
wire [2... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 15:11:22 11/09/2016
// Design Name:
// Module Name: background_painter
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; const long long MAX = 1e6 + 5; bool cmp(const pair<long long, long long> &a, const pair<long long, long long> &b) { if (a.first < b.first) return true; else if (a.first == b.first) { if (b.second > a.s... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:01:22 04/21/2015
// Design Name:
// Module Name: e_finder
// 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 la... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline T sqr(const T& a) { return a * a; } template <typename T> inline int sign(const T& a) { return a < 0 ? -1 : a > 0; } void task(); int main() { ios_base::sync_with_stdio(0); task(); return 0; } int h, q; ... |
/**
* 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 n, m, q; long long b[100000 + 1]; long long suma; long long sums; long long sum[100000 + 1]; long long sign(long long i) { return ((i & 1) ? 1 : (-1)); } inline long long poz(long long a) { return (a > 0 ? a : (-a)); } void readFile() { scanf... |
#include <bits/stdc++.h> using namespace std; const int XI = INT_MAX, NI = INT_MIN, MOD = 1e9 + 7; string s; int a[400]; int main() { cin >> s; for (int i = 0; i < 26; i++) { a[s[i]]++; } for (int i = 25; i < s.length(); i++) { bool k = 1; int cnt = 0; string second = ... |
`include "constants.vh"
//`default_nettype none
module alloc_issue_ino #(
parameter ENTSEL = 2,
parameter ENTNUM = 4
)
(
input wire clk,
input wire reset,
input wire [1:0] reqnum,
input wire [ENTNUM-1:0] busyvec,
input wire [ENTNUM-1:0] prbusyvec_next,
... |
module dcache_top
(
// System clock, reset and stall
clk_i,
rst_i,
// to Data Memory interface
mem_data_i,
mem_ack_i,
mem_data_o,
mem_addr_o,
mem_enable_o,
mem_write_o,
// to CPU interface
p1_data_i,
p1_addr_i,
p1_MemRead_i,
p1_MemWrite_i,
p1_data_o,
p1_stall_o
);
//
// System ... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int maxn = 1010; int Dp[maxn][maxn], dp[maxn][maxn], f[maxn][maxn], g[maxn][maxn]; int a[maxn][maxn]; int n, m; int main() { while (~scanf( %d%d , &n, &m)) { for (int i = 1; i <= n; ++i) for (int j = 1; j <= ... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: rom_botao.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ==========================... |
#include <bits/stdc++.h> const int INF = 0x3f3f3f3f; const int N = 579; const long long P = 1000000007; int n, b[N]; long long d[N][N]; long long solve(int l, int r) { if (l == r) return 1; static bool used[N][N]; static long long ans[N][N]; if (used[l][r]) return ans[l][r]; used[l][r] =... |
#include <bits/stdc++.h> using namespace std; vector<long long int> prm(1000010, 1); long long int P = 1e9 + 7; long long int M = 998244353; char adjlist[1001][1001]; bool visited[1000001] = {false}; long double pi = 3.14159265358979323846264338327950; map<int, int> visit; map<int, set<int>> g; int ... |
#include <bits/stdc++.h> using namespace std; signed main() { std::ios::sync_with_stdio(false); cin.tie(NULL); long long n, k; cin >> n >> k; string s; cin >> s; s = 0 + s + 0 ; for (long long i = 0; i < s.length() - 1; i++) { if (k == 0) break; if (s[i] == 4 && s[i ... |
#include <bits/stdc++.h> using namespace std; struct InputReader { char buf[1000001]; int p; inline InputReader() { p = 1000001; } inline void Flush() { p = 0; fread(buf, 1, 1000001, stdin); } inline char C() { if (p >= 1000001) Flush(); return buf[p++]; } inl... |
/******************************************************************************
This Source Code Form is subject to the terms of the
Open Hardware Description License, v. 1.0. If a copy
of the OHDL was not distributed with this file, You
can obtain one at http://juliusbaxter.net/ohdl/ohdl.txt
Description: True du... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int t; cin >> t; vector<int> a(7); while (t--) { long long k; cin >> k; int sum = 0; for (int i = 0; i < 7; i++) { cin >> a[i]; ... |
#include <bits/stdc++.h> using namespace std; inline int read() { register int x = 0, f = 1; register char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) f = 0; ch = getchar(); } while (isdigit(ch)) { x = x * 10 + (ch ^ 0 ); ch = getchar(); } return f ? x ... |
#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 ans[200200], vst[200200], pos[200200], neg[200200]; set<int> s[200200]; pr... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 00:29:45 11/23/2014
// Design Name:
// Module Name: ssg_display
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
/... |
module stack(DataIO, Reset, Push, Pop,
SP, Full, Empty, Err);
// declare input, output and inout ports
inout [3:0] DataIO;
input Push, Pop, Reset;
output Full, Empty, Err;
output [2:0] SP;
// Declare registers
reg Full, Empty, Err;
reg [2:0] SP;
reg [3:0] Stack [7:0];
reg [3:0] Data... |
// Copyright (c) 2013, Simon Que
// 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 source code must retain the above copyright notice, this
// list of conditions and the... |
#include <bits/stdc++.h> using namespace std; int main() { long long N, M, K, L; cin >> N >> M >> K >> L; long long max = N / M; long long ans = 1; bool f1 = true, f2 = true, f3 = true; if (max < 1) f1 = !f1; if (max * M - K < L) f3 = !f3; if (f1 && f2 && f3) { ans = (L + K) / ... |
/**
* 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 2012 by Alastair M. Robinson
//
// This file is part of Minimig
//
// Minimig 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 ve... |
// MBT 11/9/2014
//
// Synchronous 1-port ram.
// Only one read or one write may be done per cycle.
//
// NOTE: Users of BaseJump STL should not instantiate this module directly
// they should use bsg_mem_1rw_sync.
`include "bsg_defines.v"
module bsg_mem_1rw_sync_synth
#(parameter `BSG_INV_PARAM(width_p)
, para... |
#include <bits/stdc++.h> using namespace std; int main() { int T; scanf( %d , &T); while (T--) { int x, n, m; scanf( %d%d%d , &x, &n, &m); while (n-- && x >= 20) x = floor(1.0 * x / 2) + 10; while (m--) x -= 10; printf(x <= 0 ? YES n : NO n ); } return 0; } |
#include <bits/stdc++.h> using namespace std; const long long maxn = 1000 * 101; const long long INF = 1e18; long long n, a[maxn]; vector<pair<char, long long> > ans1; vector<pair<long long, long long> > ans; queue<long long> bra; int main() { std::ios::sync_with_stdio(0); cin.tie(0); cout.t... |
/*
Module for converting input RAW data to RGB values.
The input data presents the 'Bayer patter' i.e. There are 4 different
components (G1-R-B-G2) that form a square: The upper row contains the
first green component (G1) and the red one; and the lower row contains
the blue component and the second green one (G2). How... |
#include <bits/stdc++.h> using namespace std; const int N = 20, K = (1 << 16) + 5, M = 2005, mod = 998244353; int k, sum, a[N], b[N]; bitset<M> f[K]; inline void dfs(register int s, register int now) { if (!s) return; register int i; for (; now * k <= sum && f[s][now * k]; now *= k) for (i =... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-10; pair<double, double> za, zb, zc, zd; pair<double, double> a, b, c, d, e; pair<double, double> A, B, C, D; double cha(pair<double, double> a, pair<double, double> b, pair<double, double> c) { return (b.first - a.first) *... |
/*
* 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... |
module dummy;
parameter [TSTBITS-1:0] // synopsys enum tstate_info
TIDLE = 3'b000,
TCN1 = 3'b001,
TCN2 = TCN1+1, // must be numbered consecutively
TCN3 = TCN2+1,
TCN4 = TCN3+1,
TCN5 = TCN4+1,
IOCLR = TCN5+1,
TUNU1 = 3'b111;
// state and output logic
... |
#include <bits/stdc++.h> using namespace std; long long pi = 1, sum = 0, n, k, a[200100], pos[200100]; const long long inf = (long long)1e19; int main() { scanf( %I64d %I64d , &n, &k); for (int i = 1; i <= n; i++) { scanf( %I64d , &a[i]); pos[i] = (a[i - 1] != 1 ? i - 1 : pos[i - 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; long long l, r, k, x, y; int main() { scanf( %lld%lld%lld , &l, &r, &k), x = 1; if (k == 1 || l == r || (r - l == 1 && l % 2 && (l ^ r) >= l)) return printf( %lld n1 n%lld n , l, l), 0; for (int i = 0;; i++) { if (x > l) { y = i; ... |
#include <bits/stdc++.h> using namespace std; int main() { long long q, t, v, u, w; map<long long, long long> cost; cin >> q; while (q--) { cin >> t; if (t == 1) { cin >> v >> u >> w; while (v != u) { while (u > v) { cost[u] += w; u >>= 1... |
#include <bits/stdc++.h> using namespace std; struct order { int num; int pos; }; bool fun(order a, order b) { return (a.num < b.num); } int main() { int n, k, i, j; cin >> n >> k; vector<order> a(n); for (i = 0; i < n; i++) { cin >> a[i].num; a[i].pos = i + 1; } se... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 300000000; const int BLOCK = 100000; const int NUM = 3000; const int num[] = { 4784, 4194, 4003, 3920, 3831, 3791, 3726, 3667, 3669, 3591, 3642, 3612, 3532, 3554, 3507, 3500, 3517, 3449, 3496, 3432, 3462, 3406, 3394, 3376, 3378, ... |
#include <bits/stdc++.h> using namespace std; inline int read() { static int r; static char c; r = 0, c = getchar(); while (c < 0 || c > 9 ) c = getchar(); while (c >= 0 && c <= 9 ) r = r * 10 + (c - 0 ), c = getchar(); return r; } template <typename T> inline void print(T* a, 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> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx ) #pragma GCC optimize( unroll-loops ) using namespace std; using ll = long long; using ld = long double; using pii = pair<int, int>; using vi = vector<int>; const ld PI = acos(-1); ... |
//
// Copyright (c) 1999 Steven Wilson ()
//
// 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 (C) 2014 iZsh <izsh at fail0verflow.com>
//
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
// at your option, any later version. See the LICENSE.txt file for the text of
// the license.
//--------... |
/*
----------------------------------------------------------------------------------
Copyright (c) 2013-2014
Embedded and Network Computing Lab.
Open SSD Project
Hanyang University
All rights reserved.
----------------------------------------------------------------------------------
Redistribution and use ... |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2014 Francis Bruno, All Rights Reserved
//
// 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 Found... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, count, area; cin >> a >> b; area = a * b; if (area < 2) cout << 0 << endl; else { while (area >= 2) { count++; area -= 2; } cout << count << endl; } return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { vector<unsigned long long> v; char x2[] = 47 ; do { v.push_back(stoi(x2)); } while (next_permutation(x2, x2 + 2)); char x4[] = 4477 ; do { v.push_back(stoi(x4)); } while (next_permutation(x4, x4 + 4)); char x6[]... |
#include <bits/stdc++.h> #pragma comment(linker, /stack:256000000 ) using namespace std; int main() { int n; cin >> n; if (n % 2 == 0) { puts( -1 ); } else { for (int(i) = 0; (i) < (n); (i)++) printf( %d , i); printf( n ); for (int(i) = 0; (i) < (n); (i)++) printf( %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 la... |
#include <bits/stdc++.h> using namespace std; struct a1 { int value, freq; } arr[101]; bool compare(a1 lhs, a1 rhs) { return lhs.freq > rhs.freq; } int main() { int temp = 0, j, n, num = 0, m, i, a[101], ans = 0; scanf( %d %d , &n, &m); int b[n], c[n]; memset(a, 0, sizeof(a)); for (i =... |
#include <bits/stdc++.h> using namespace std; int main() { int n, pos, lo, hi; while (cin >> n >> pos >> lo >> hi) { int cnt = 0; if (lo == 1 && hi == n) { cout << 0 << endl; continue; } int xlo = abs(pos - lo); int xhi = abs(pos - hi); if (lo - 1 >= 1 &... |
#include <bits/stdc++.h> int main() { unsigned long long n; unsigned long long answer; scanf( %I64u , &n); if (n < 3) { printf( %lu , n); return 0; } if (n % 2 == 1) { answer = (n) * (n - 1) * (n - 2); } else if (n % 3 != 0) { answer = n * (n - 1) * (n - 3); } e... |
/**
* 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 INF = 0x3f3f3f3f; const long long INFF = 0x3f3f3f3f3f3f3f3fll; const long long M = 1e9 + 7; const long long maxn = 1e6 + 107; const double pi = acos(-1.0); const double eps = 0.0000000001; long long gcd(long long a, long long b) { return b ? gcd(b,... |
// (C) 2001-2011 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 doc... |
// (C) 2001-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 doc... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int a[m][n]; for (int i = 0; i < m; i++) for (int j = 0; j < n; j++) cin >> a[i][j]; int ans[n]; memset(ans, 0, sizeof(ans)); int k = 0; int x = 0, y = 0; int ma = INT_MIN; for (int i = ... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017
// Date : Sat Sep 23 13:25:27 2017
// Host : DarkCube running 64-bit major release ... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const long long INF = 1000000007; const long long INF2 = 1000000007LL * 1000000007LL; const long double EPS = 1e-9; const int SIZE = 1001000; int n, a, b; string fn[SIZE]; int val[SIZE], ans[SIZE]; int z[SIZE]; vector<int> g... |
#include <bits/stdc++.h> using namespace std; void PLAY() { cout << fixed << setprecision(10); ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int max(int a, int b) { if (a > b) return a; return b; } int min(int a, int b) { if (a < b) return a; return b; } long long f... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5; static int comp[maxn]; static int pr[maxn]; static int n; void make_set() { for (int i = 0; i < n; ++i) { pr[i] = i; comp[i] = 1; } } int find_set(int a) { if (pr[a] == a) return a; return pr[a] = find_set(pr... |
// Copyright (c) 2014 Takashi Toyoshima <>.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
`timescale 100ps/100ps
module RegisterFileTest;
wire [15:0] w_rf2mc_pc;
wire [ 7:0] w_rf2mc_a;
wire [ 7:0] w_rf2mc_x;
wire [ 7:0] w_rf2mc_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; bool isPrime(long long n) { if (n <= 1) return false; if (n <= 3) return true; if (n % 2 == 0 || n % 3 == 0) return false; for (long long i = 5; i * i <= n; i = i + 6) if (n % i == 0 || n % (i + 2) == 0) return false; return true; } long lo... |
// megafunction wizard: %LPM_MULT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: lpm_mult
// ============================================================
// File Name: acl_int_mult64s.v
// Megafunction Name(s):
// lpm_mult
//
// Simulation Library Files(s):
// lpm
// =====================================... |
module asr(value1, value2, shift_hex, value_out, EN);
input [31:0] value1, value2;
input [3:0] shift_hex;
output [31:0] value_out;
input EN;
wire or_unary = |value2[31:5];
wire value2_shrink = value2[4:0];
wire [4:0] shift_amt = (value2_shrink== 32'b0) ?
( {1'b0, shift_hex} + 5'b1) : (value2_shrink + {1'b0,... |
`include "defines.v"
module ctrl(
input wire rst,
input wire[31:0] excepttype_i,
input wire[`RegBus] cp0_epc_i,
input wire stallreq_from_id,
//À´×ÔÖ´Ðн׶εÄÔÝÍ£ÇëÇó
input wire stallreq_from_ex,
input wire branch_from_i... |
// mbt 11-10-14
//
// bsg_two_buncher
//
// see also serial_in_parallel_out
//
// this module takes an incoming stream of words.
// if the output is read every cycle, the data passes
// straight through without latency. if the output
// is not read, then one element is buffered internally
// and either one or two elem... |
/////////////////////////////////////////////////////////////////////
// This file is part of the GOST 28147-89 CryptoCore project //
// //
// Copyright (c) 2016 Dmitry Murzinov () //
//////////////////////////////////////////////////////////////... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int nax = 1e6 + 10; vector<int> tree(4 * nax); long long i, j, x, y, k; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; long long n, t; cin >> t; while (t--) { cin >> n; ... |
// dig
/*
-------------------------------------------------------------------------------
Copyright 2014 Parallax Inc.
This file is part of the hardware description for the Propeller 1 Design.
The Propeller 1 Design is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public ... |
//////////////////////////////////////////////////////////////////////
//// ////
//// Generic 32x32 multiplier ////
//// ////
//// This file is part of the OpenR... |
#include <bits/stdc++.h> using namespace std; int aa[105][105]; pair<int, int> pos[105][105]; int main() { int n, m, q; scanf( %d %d %d , &n, &m, &q); for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { pos[i][j] = {i, j}; aa[i][j] = INT_MAX; } } for (in... |
#include <bits/stdc++.h> const int MAXN = 1e5 + 5; const long long MOD = 998244353; const int INF = 0x3f3f3f3f; const long long LL_INF = 0x3f3f3f3f3f3f3f3f; const double PI = acos(-1); const double ERR = 1e-10; const int L = 40; const int M = 30; using namespace std; long long mx = -1e18; long lon... |
#include <bits/stdc++.h> using namespace std; struct edge { edge(int to, int back, int orient = 0) : to(to), back(back), orient(orient) {} int to; int back; int orient; }; class Tarjan { public: vector<vector<int> > adj; vector<int> comp; int nb_cfc; private: vector<int>... |
/*------------------------------------------------------------------------------
* 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... |
/***************************************************************************************************
** fpga_nes/hw/src/cpu/apu/apu_frame_counter.v
*
* Copyright (c) 2012, Brian Bennett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provid... |
//Legal Notice: (C)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
//simulation files), and any associated do... |
// Driver for WS2812 LED strips.
// Serializes data to an LED strip.
// Copyright (c) 2013 Jared Boone, ShareBrained Technology, Inc.
//
// This file is part of the Medusa project.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as publ... |
///////////////////////////////////////////////////////////////////////////////
// vim:set shiftwidth=3 softtabstop=3 expandtab:
//
// Module: oq_header_parser.v
// Project: NF2.1
// Description: finds the destination port in the module headers and puts it in fifo
//
/////////////////////////////////////////////... |
//Legal Notice: (C)2010 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 law... |
// (C) 2001-2011 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... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2 * (100000) + 5; int a[MAXN], b[MAXN]; int main() { int n; cin >> n; for (int i = 0; i < n; ++i) cin >> a[i]; for (int i = 0; i < n; ++i) cin >> b[i]; int res = 0; int j = 0; for (int i = 0; i < n && j < n; ++i) { ... |
#include <bits/stdc++.h> long long mpow(long long a, long long n, long long mod) { long long ret = 1; long long b = a; while (n) { if (n & 1) ret = (ret * b) % mod; b = (b * b) % mod; n >>= 1; } return (long long)ret; } using namespace std; int n, m, s; pair<int, int> bug... |
//////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2009 Xilinx, Inc.
// This design is confidential and proprietary of Xilinx, All Rights Reserved.
//////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / ... |
/**
* 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 n, i, n1, output = 0; cin >> n; if (n % 2 == 0) cout << n / 2 - 1; else cout << n / 2; } |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int a, b; cin >> a >> b; a--; string l = to_string(a); string r = to_string(b); long long int ans1; if (l.length() == 1) { ans1 = a; ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
//-----------------------------------------------------
// This is my second Verilog Design
// Design Name : first_counter
// File Name : first_counter.v
// Function : This is a 4 bit up-counter with
// Synchronous active high reset and
// with active high enable signal
//-----------------------------------------------... |
#include <bits/stdc++.h> using namespace std; int n, m, i, j, k, l, art[505][505], low[505][505], used[505][505], ans, cn, t, x, y, z, mx, mn, s, timer, vis[505][505]; char c[505][505], d[1000009], ch; void dfs(int row, int col) { timer++; used[row][col] = 1; if ((row - 1 >= 0) && (used[row - ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.