text stringlengths 59 71.4k |
|---|
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2018.2
// Copyright (C) 1986-2018 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale ... |
/*
* 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 = 1e5 + 1; namespace fastinput { inline int readChar(); template <class T = int> inline T readInt(); template <class T> inline void writeInt(T x, char end = 0); inline void writeChar(int x); inline void writeWord(const char *s); static cons... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n; cin >> n; vector<long long> vec(n, 0); for (long long i = 0; i < n; i++) cin >> vec[i]; long long mn = 10e9 + 1, mx = -1, count = 0; for (long long i = 1; i < n; i++) { if (vec[i] == -1 && vec[i - 1] != -1) { ... |
#include <bits/stdc++.h> using namespace std; int main() { unsigned long long int n, m, a, b; cin >> n >> m >> a >> b; if (n % m == 0) { cout << 0 ; return 0; } else if (n > m) { unsigned long long int p = (n / m) + 1; unsigned long long int c = (m * p - n) * a; unsign... |
#include <bits/stdc++.h> using namespace std; int n, m, q, ans; map<int, int> boss[100010]; map<pair<int, int>, int> mp; vector<pair<int, int> > vt[100010]; int findf(int x, int col) { if (!boss[col].count(x) || x == boss[col][x]) { boss[col][x] = x; return x; } return boss[col][x] =... |
#include <bits/stdc++.h> using namespace std; const int64_t INF = 0x7FFFFFFF; const int MAX = 1; unordered_map<int, int> maps; unordered_map<int, int> cnt; int main(int argc, char* args[]) { int n; scanf( %d , &n); for (int(i) = (0), _n = (n - 1); (i) <= _n; (i)++) { int x; scanf( %d... |
// test taken from systemcaes from iwls2005
module subbytes_00(clk, reset, start_i, decrypt_i, data_i, ready_o, data_o, sbox_data_o, sbox_data_i, sbox_decrypt_o);
input clk;
input reset;
input start_i;
input decrypt_i;
input [31:0] data_i;
output ready_o;
output [31:0] data_o;
output [7:0] sbox_data_o;
input [7:0] s... |
#include <bits/stdc++.h> using namespace std; long long p[1000100], h[1000100], g[1000100], ans; int main() { int m, n, x, y; cin >> n >> m; for (int i = 0; i <= n; i++) p[i] = (i ? p[i - 1] * 9 : 1); while (m--) { scanf( %d%d , &x, &y); h[x] += p[y]; h[y] += p[x]; } for ... |
#include <bits/stdc++.h> using namespace std; int bits(int num) { int c = 0; while (num > 0) { c++; num = num / 2; } return c; } int main() { int t; cin >> t; while (t--) { long long int n; cin >> n; long long int i; long long int a[n]; for (... |
#include <bits/stdc++.h> using namespace std; long long x, y; string tt(long long a) { string ans = ; while (a != 0) ans += (a % 10) + 0 , a /= 10; int p = ans.length(); for (int i = 0; i * 2 < p; ++i) swap(ans[i], ans[p - i - 1]); return ans; } int main() { cin >> x >> y; strin... |
// This file is the testbench for D_memory.v
module memory_tb;
parameter ASIZE=16;
parameter DSIZE=16;
reg clk;
reg rst;
reg wen;
reg [ASIZE-1:0] address;
reg [DSIZE-1:0] data_in;
wire [DSIZE-1:0] data_out;
reg [3:0] fileid;
`define TEST_LIMIT 100
memory d0 (
.clk(clk),
.rst(rst),
.wen(wen),
.addr(address),
... |
// -*- Mode: Verilog -*-
// Filename : testbench.v
// Description : VScale RiscV WV SoC Testbench
// Author : Philip Tracton
// Created On : Tue Dec 6 21:11:19 2016
// Last Modified By: Philip Tracton
// Last Modified On: Tue Dec 6 21:11:19 2016
// Update Count ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(); int N, ans = 0; string s; cin >> N >> s; for (int i = 0, j; i < N;) { if (s[i] == ? ) { for (j = i; j < N && s[j] == ? ; j++) ; if (j - i > 1 || !i || j == N ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2016/05/24 18:32:41
// Design Name:
// Module Name: bcdto7segment_dataflow
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2009 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
reg [6:0] mem1d;
... |
/**
* 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 maxn = 1e6 + 7; char s[maxn]; char ans[maxn]; int sum[maxn]; int n; int check() { for (int i = 0; i < n / 2;) { int l = i, r = n - 1 - i; if (sum[l] == sum[r]) i++; else if (sum[l] == sum[r] + 1 || sum[l] == sum[r] + 11)... |
#include <bits/stdc++.h> using namespace std; const int MaxN = 1e5 + 10; const int MaxL = 18; const int INF = 1e9; const int MOD = 1e9 + 7; int up[MaxN][MaxL], ds[MaxN]; vector<int> graph[MaxN]; int n, m, sz[MaxN]; long long sum[MaxN], ups[MaxN]; void dfsLca(int v, int p) { up[v][0] = p; for... |
#include <bits/stdc++.h> using namespace std; void Fast() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } void File() {} using ll = long long; using ull = unsigned long long; ll gcd(ll a, ll b) { return !b ? a : gcd(b, a % b); } const int N = 100001; bool prime[N]; int n,... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; set<string> st; while (n--) { cin >> s; if (st.count(s)) { cout << YES ; } else { cout << NO ; st.insert(s); } cout << endl; } } |
`default_nettype none
package testcase_pkg;
typedef int unsigned uint;
localparam uint SIZE = 8;
typedef enum {ENUM1, ENUM2} enum_t;
endpackage
module testcase_top
(
input testcase_pkg::enum_t top_enum,
input logic [testcase_pkg::SIZE-1:0] top_in,
output logic [testcase_pkg::SIZE-1:0] top_out
... |
`timescale 1ns / 1ps
module selector_mode_tb();
reg [31:0]clk;
reg start, power, mode_ch;
reg [1:0]washing_machine_running;
wire push;
wire [2:0]sel_value;
parameter TIME = 1000;
selector_mode #(0,5) MODE_SEL (.clk(clk),
.switch_power(power),
... |
//
// 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)
// ... |
module vga_sync_generator(
input reset,
input vga_clk,
output blank_n,
output reg [10:0] next_pixel_h,
output reg [10:0] next_pixel_v,
output reg [31:0] next_pixel_addr,
output HS,
output VS
);
/*
--VGA Timing
--Horizontal :
-- ______________ ____________... |
#include <bits/stdc++.h> using namespace std; int dp[81][81][81], n, m, i, j, k, ans, inf = 1000007, x, y, l, len; pair<int, int> p; vector<pair<int, int> > g[82]; int main() { cin >> n >> m; if (m > n) { cout << -1 << endl; return 0; } cin >> k; for (i = 0; i < k; i++) { ... |
#include <bits/stdc++.h> using namespace std; int n, m, s, tot; int a[5005], b[5005], c[5005], last[5005]; vector<int> edge[5005]; int cmp(int i, int j) { return c[i] > c[j]; } long long dp[5005][5005]; int main() { scanf( %d%d%d , &n, &m, &s); int temp = s; for (int i = 1; i <= n; i++) { ... |
`timescale 1ns / 1ns
//////////////////////////////////////////////////////////////////////////////////
// Company: franp.com
// Engineer: Fran Pregernik <>
//
// Create Date: 12/29/2016 07:30:24 PM
// Design Name:
// Module Name: radar_statistics_sim
// Project Name:
// Target Devices:
// Tool Versions:
// Descri... |
#include <bits/stdc++.h> using namespace std; int n, ans1, ans2, nr, x; vector<int> v; int main() { cin >> n; for (int i = 1; i <= n; ++i) { cin >> nr; for (int j = 1; j <= nr; ++j) { cin >> x; if (nr % 2 == 1 && j == (nr + 1) / 2) { v.push_back(-x); conti... |
/*
* Copyright 2020-2022 F4PGA 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:06:52 06/28/2009
// Design Name:
// Module Name: dcm
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// R... |
#include <bits/stdc++.h> using namespace std; bool solve(long long a, long long b) { if (a > b) { return solve(b, a); } if (a == 0) { return false; } bool next = solve(b % a, a); if (!next) { return true; } long long c = (b / a); if ((a % 2 == 1)) { return... |
`begin_keywords "1364-2005"
/*
* Copyright (c) 2002 Stephen Williams ()
*
* 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 Lice... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2010 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc=0;
reg [89:0] in;
/*AUTOWIRE*/
// Beginning of automatic wires (... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_ecc_e
//
// Generated
// by: wig
// on: Mon Mar 22 13:27:29 2004
// cmd: H:\work\mix_new\mix\mix_0.pl -strip -nodelta ../../mde_tests.xls
//
// !!! Do not edit this file! Autogenerated by MIX !... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) f = -1; ch = getchar(); } while (isdigit(ch)) { x = x * 10 + ch - 48; ch = getchar(); } return x * f; } l... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 2e5 + 9; vector<long long> g[maxn]; long long n, m, a, b; bool used[maxn]; pair<long long, long long> dfs(long long v, long long u) { used[v] = 1; pair<long long, long long> ans(1, v == u); for (long long to : g[v]) { if ... |
#include <bits/stdc++.h> using namespace std; template <typename T> void vout(T x) { cout << x << endl; exit(0); } int gcd(int a, int b) { while (a && b) { if (a > b) a %= b; else b %= a; } return a + b; } const long long inf = -1e18; const long long mod =... |
#include <bits/stdc++.h> using namespace std; char a[100020]; char b[100020]; int zf[100020]; int zb[100020]; int main() { scanf( %s , a); scanf( %s , b); int la = strlen(a); int lb = strlen(b); zf[0] = 0; zb[la] = lb; for (int i = 1; i <= la; i++) { if (a[i - 1] == b[zf[i ... |
#include <bits/stdc++.h> using namespace std; inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; } int n, m, c; int A[1111]; int pref = 0, post = 0; bool end() { bool ans = true; for (int(i) = 0; (i) < (n); (i)++) if (A[i] == -1 || (i < n - 1 && A[i + 1] < A[i])) ans = false; ... |
#include <bits/stdc++.h> using namespace std; const int N = 7005; const int M = 200000; struct state { int l, r, val; state() {} state(int l, int r, int val) { this->l = l; this->r = r; this->val = val; } }; int n, m, dl[M], dr[M]; vector<state> v[N]; int solve(int d, i... |
#include <bits/stdc++.h> using namespace std; const int M = 200009; int n, q, k, x, s; vector<pair<int, int> > p; vector<vector<int> > pb; set<int> last; void solve() { cin >> n; p.resize(n + 1); pb.resize(n + 1); for (int i = 0; i < n; i++) { cin >> x >> s; p[i] = {x, s}; ... |
`timescale 1ps/1ps
`default_nettype none
/* Change parameters using this online C code: http://goo.gl/Os0cKi */
module clock_generator
(// Clock in ports
input wire CLK_IN1,
input wire CPUContention,
input wire [2:0] pll_option,
input wire [1:0] turbo_enable,
// Clock out ports
output wir... |
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class t, class u> void chmax(t& first, u second) { if (first < second) first = second; } template <class t, class u> void chmin(t& first, u second) { if (second < first) first = second; } template <class t> using v... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int main() { int t, n; string a; cin >> t; while (t--) { cin >> n; cin >> a; int l = 0, r = n - 1; while (a[l] == a[r] && l <= r) l++, r--; if (l > r) cout << 0 << endl; else { ... |
// (C) 2001-2016 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated docum... |
// Check the various variable bit selects (LSB > MSB).
module top;
parameter [-4:-1] ap = 4'h1;
parameter [-4:-1] bp = 4'he;
parameter [-3:0] cp = 4'h1;
parameter [-3:0] dp = 4'he;
reg passed;
wire [-4:-1] a = 4'h1;
wire [-4:-1] b = 4'he;
wire [0:0] s0 = 0;
wire [1:0] s1 = 0;
wire [2:0] s2 = 0;
... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are... |
module tester;
reg rrst ;
reg [63:0] rdata ;
reg [31:0] rparameter_Block ;
reg [63:0] rparameter_Block2 ;
reg [7:0] rbmRequestType ;
reg [7:0] rbRequest ;
reg [15:0] rwValue ;
reg [15:0] rwIndex ;
reg [15:0] rwLength ;
reg renable ;
wire wbusy ;
wire [31:0] wdata_out;
wire [63:0] wdata_out2;... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); long long n, m; cin >> n >> m; vector<long long> col(m); for (long long i = 0; i < m; i++) { cin >> col[i]; } vector<long long> suf(m, 0); suf[m - 1] = 0; for (long long ... |
/**
* 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... |
// (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... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.2
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale ... |
//-----------------------------------------------------------------------------------------------------------------------------
//
// COPYRIGHT (C) 2011, VIPcore Group, Fudan University
// ... |
#include <bits/stdc++.h> long long CMB[50][50]; void computeCMB() { for (long long i = 0; i < 50; ++i) { CMB[i][0] = 1; for (long long j = 1; j <= i; ++j) { CMB[i][j] = CMB[i - 1][j - 1] + CMB[i - 1][j]; } } } long long n; long long pathsFrom(long long i, long long j) { l... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int arr[n + 1]; for (int i = 0; i < n; i++) cin >> arr[i]; sort(arr, arr + n); for (int i = n - 1; i >= 0; i--) { if (k % arr[i] == 0) { cout << (k / arr[i]) << endl; break; } ... |
#include <bits/stdc++.h> const long long M = 1e9 + 7; const double pi = 3.14159265358979323846; using namespace std; long long ans = 1; vector<long long> adj[2005]; long long vis[200005] = {0}; void dfs(long long x) { vis[x] = 1; for (long long i = 0; i < adj[x].size(); i++) { if (vis[adj[x]... |
/*
* yosys -- Yosys Open SYnthesis Suite
*
* Copyright (C) 2012 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.
*
* T... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-6; void __print(int x) { cerr << x; } void __print(long x) { cerr << x; } void __print(long long x) { cerr << x; } void __print(unsigned x) { cerr << x; } void __print(unsigned long x) { cerr << x; } void __print(unsigned long long 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... |
module tb_fpga();
// Test ports
reg A, B;
reg carryin;
wire out;
wire testout;
wire carryout;
// Configuration ports
reg [899:0] brbselect;
reg [1727:0] bsbselect;
reg [79:0] lbselect;
reg [29:0] leftioselect;
reg [29:0] rightioselect;
reg [29:0] topioselect;
reg [29:0] bottomioselect;
wire [4:0] left, ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:35:35 05/12/2015
// Design Name:
// Module Name: exin
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependenci... |
#include <bits/stdc++.h> using namespace std; vector<int> by; vector<int> sl; int main() { long long int a, b, c, d, m, n, ck = 0, ans, s, r; cin >> n >> m >> r; for (int i = 0; i < n; i++) { cin >> s; by.push_back(s); } sort(by.begin(), by.end()); for (int j = 0; j < m; j++)... |
// (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; long long int arr[200005]; pair<long long int, long long int> even[200005]; pair<long long int, long long int> odd[200005]; int main() { long long int n; cin >> n; for (long long int i = 1; i <= n; i++) cin >> arr[i]; even[2] = make_pair(0, 2); ... |
#include <bits/stdc++.h> using namespace std; const int N = 3005; int n, a[N]; int main() { scanf( %d , &n); for (int i = 0; i < n; ++i) { scanf( %d , a + i); } int ans = 0; for (int i = 0; i < n; ++i) { for (int j = 0; j < i; ++j) { if (a[j] > a[i]) { ++ans; ... |
#include <bits/stdc++.h> using namespace std; vector<int> eg[400005]; long long dep[400005]; int dfn[400005], sz[400005]; int a[400005]; int p[400005], w[400005]; int dfcnt = 0; int fa[400005][20]; void dfs(int a) { sz[a] = 1, dfn[a] = ++dfcnt; for (auto v : eg[a]) { if (v == p[a]) conti... |
#include <bits/stdc++.h> using namespace std; int main() { long long t; cin >> t; while (t--) { long long n, f = 0; cin >> n; vector<char> v1, v2; for (int i = 0; i < n; i++) { char a; cin >> a; v1.push_back(a); } for (int i = 0; i < n; i++) { ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 500; char s[N]; int son[N][26]; int fail[N], pos[N]; int n, m; int cnt; inline void insert(char s[], int n, int id) { int i, cur = 0; for (i = 1; i <= n; i++) { if (!son[cur][s[i] - a ]) son[cur][s[i] - a ] = ++cnt; ... |
#include <bits/stdc++.h> using namespace std; int N, M; vector<int> adj[100002], f, radj[100002]; queue<int> Q1, Q2; vector<int> vis; int main(int argc, char **argv) { cin >> N >> M; f = vector<int>(N); for (int i = (0); i < (N); ++i) cin >> f[i]; for (int i = (0); i < (M); ++i) { int ... |
// 21 Jul 2021
//
// Multiply-add often takes more than one cycle of time.
// This module provides a mechanism for indicating the degree
// of pipelining required. The implementation still relies upon
// retiming support from the cad tools. The basejump_stl
// /hard mechanisms allows for platform-specific implementatio... |
#include <bits/stdc++.h> using namespace std; using namespace std; const long long N = 4e7 + 5, N_ = 4e6 + 5; int cnt = 0, prime[N_]; bitset<N> vis; void pre() { for (int i = 2; i < N; ++i) { if (!vis[i]) prime[cnt++] = i; for (int j = 0; i * prime[j] < N; ++j) { vis[i * prime[j]] = ... |
/*
* 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 std; const long long mod2 = 998244353; long long fpow(long long x, long long y, long long p = 1000000007) { x = x % p; long long sum = 1; while (y) { if (y & 1) sum = sum * x; sum %= p; y = y >> 1; x = x * x; ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1100; int n, a[maxn], ans, t; void go(int lim) { int ret = 0; for (int i = 1; i <= n; i++) ret += min(abs(a[i] - lim), min(abs(a[i] - (lim + 1)), abs(a[i] - (lim - 1)))); if (ret < ans) ans = ret, t = lim; } int main(... |
// ----------------------------------------------------------------------
// Copyright (c) 2015, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; int inv[25]; long long a[25]; int power(int a, int b) { int c = 1; for (; b; b >>= 1) { if (b & 1) c = (long long)c * a % mod; a = (long long)a * a % mod; } return c; } int C(long long y, int x) { if (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 la... |
#include <bits/stdc++.h> using namespace std; long long n, m, x, y, z, flag = 0; vector<long long> sum(200005), mx(200005, INT_MIN); vector<int> adj[200005 + 1]; vector<int> pl(200005 + 1); map<int, int> vis; void dfs(int a) { vis[a] = 1; for (int i = 0; i < adj[a].size(); i++) { if (vis[adj... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; int dist[10010], DD[30][30]; int s[10010]; vector<int> all; vector<int> a; queue<int> q; int dp[1 << 20]; int n; void calc(int x) { memset(dist, -1, sizeof(dist)); q.push(x), dist[x] = 0; while (!q.empty()) { ... |
#include <bits/stdc++.h> int main() { int n; int64_t res1 = 0, res2 = 0, sum = 0; bool is; std::cin >> n; std::vector<int> m(n); for (int i = 0; i < n; i++) { std::cin >> m[i]; sum += m[i]; } is = sum % n != 0; sum /= n; for (int i = 0; i < n; i++) { if (m[i] ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2005 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
parameter CNT = 5;
... |
#include <bits/stdc++.h> int main() { int n; scanf( %d , &n); int a[n], i, s = 0; for (i = 0; i < n; i++) { scanf( %d , &a[i]); s = s + a[i]; } if (s == 0) printf( EASY n ); else printf( HARD n ); return 0; } |
/*
* Copyright (c) 1998 Philips Semiconductors ()
*
* 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 optio... |
#include <bits/stdc++.h> using namespace std; void boost() { ios_base::sync_with_stdio(false); cin.tie(NULL); } void free() { freopen( A.in , r , stdin); freopen( A.out , w , stdout); } int a[100001]; int main() { boost(); int n; cin >> n; for (int i = 0; i < n; i++) cin ... |
#include <bits/stdc++.h> char map[1005][1005]; int main() { int n, m; scanf( %d %d , &n, &m); for (int r = 0; r < n; r++) scanf( %s , map[r]); int row[1005] = {0}; int col[1005] = {0}; for (int r = 0; r < n; r++) { int count = 0; for (int c = 0; c < m; c++) if (map[r][c] ... |
#include <bits/stdc++.h> using namespace std; const int mn = 500005; int n, fp, ln; pair<double, double> inp[mn]; bool f(double mid) { double ma = -(int)1e9; for (int i = fp; i < ln + 1; i++) { double pos = inp[i].first + mid * inp[i].second; if (inp[i].second < 0) { if (pos <= ma)... |
// (C) 2001-2016 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated docum... |
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); long long broj = 3; int i; for (i = 0; i < 3 * n - 1; i++) { broj *= 3; broj %= 1000000007; } long long broj1 = 7; for (i = 0; i < n - 1; i++) { broj1 *= 7; broj1 %= 1000000007;... |
// -*- verilog -*-
// Copyright (c) 2012 Ben Reynwar
// Released under MIT License (see LICENSE.txt)
// A single stage for a FFT.
module stage
#(
parameter N = 8,
parameter LOG_N = 3,
parameter WIDTH = 32
)
(
input wire clk,
input wire rst_n,
// Input to the... |
/**
* 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; namespace WorkSpace { const double pi = acos(-1.0); int N; double r, v; bool Check(double mid, double l) { double len = 2 * pi * r; double ang = mid / len * 2 * pi; double A = r - r * (cos(ang)); double B = r * sin(ang); return sqrt(A * A + B... |
// NeoGeo logic definition (simulation only)
// Copyright (C) 2018 Sean Gonsalves
//
// 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) an... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> num(n + 1); for (int i = 1; i <= n; i++) cin >> num[i]; if (num[1] % 2 == 0 || n % 2 == 0 || num[n] % 2 == 0) { cout << No ; return 0; } cout << Yes ; return 0; } |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; inline int add(int x, int y) { x += y; if (x >= mod) x -= mod; return x; } inline int mul(int x, int y) { return ((long long)x) * y % mod; } const int N = 1e6 + 5; int fac[N + 5], ifac[N + 5], p[N + 5]; int Pow(int a, int... |
#include <bits/stdc++.h> using namespace std; long long getLL() { long long ret = 0; char c; while (1) { c = getchar(); if (c >= 0 && c <= 9 ) break; } while (1) { ret = ret * 10 + c - 0 ; c = getchar(); if (c < 0 || c > 9 ) break; } return ret; } ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 7; const long long INFL = 1e18 + 123; const double PI = atan2(0, -1); mt19937 tw(960172); long long rnd(long long x, long long y) { static uniform_int_distribution<long long> d; return d(tw) % (y - x + 1) + x; } const int MAXV =... |
// -------------------------------------------------------------
//
// File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\controllerHdl\controllerHdl_Reset_Delay_block.v
// Created: 2014-09-08 14:12:04
//
// Generated by MATLAB 8.2 and HDL Coder 3.3
//
// -----------------------------------------------------------... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.