text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; namespace IO { template <typename T> inline void read(T &x) { x = 0; long long f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == - ) f = -f; ch = getchar(); } while (isdigit(ch)) { x = x * 10 + ch - 48; ch ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 50 + 10; int a[maxn][maxn]; int dx[10] = {0, 2, 1, 0, -1, -2}; int dy[10] = {2, 0, 1, -2, -1, 0}; int sx, sy; struct Node { int x, y; }; int main() { int n; scanf( %d , &n); memset(a, -1, sizeof(a)); a[1][1] = 1; 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... |
#include <bits/stdc++.h> using namespace std; const int inf = (int)1e9; const double pi = acos(-1.0); const double eps = 1e-9; long long x, second, res, xx, first; int main() { cin >> second >> x; xx = x; if ((second & 1) != (x & 1)) { cout << 0; return 0; } res = 1; whil... |
//-----------------------------------------------------------------------------
// module_1_stub.v
//-----------------------------------------------------------------------------
module module_1_stub
(
processing_system7_0_MIO,
processing_system7_0_PS_SRSTB_pin,
processing_system7_0_PS_CLK_pin,
... |
#include <bits/stdc++.h> using namespace std; string s; int ans; map<int, int> f; int main() { cin >> s; int n = s.length(); f[0] = 1; int cur = 0; for (int i = 1; i < n; i++) { if (s[i] == s[i - 1]) { f[cur]++; } else { f[i]++; cur = i; } } ... |
/*
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 a[4], i, j, s; int main() { for (i = 0; i < 4; i++) { scanf( %d , &a[i]); s += a[i]; } for (i = 0; i < 4; i++) { if (a[i] == s - a[i]) { puts( YES ); return 0; } for (j = i + 1; j < 4; j++) if (a[i]... |
//
// Copyright (c) 2014 Jan Adelsbach <>.
// 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 Foundation, either version 3 of the License, or
// (at your optio... |
/*
* 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... |
//-----------------------------------------------------
// Design Name : pri_encoder_using_assign
// File Name : pri_encoder_using_assign.v
// Function : Pri Encoder using assign
// Coder : Deepak Kumar Tala
//-----------------------------------------------------
module pri_encoder_using_assign (
binary_out ... |
#include <bits/stdc++.h> using namespace std; const long long N = 102, M = 200001; long long a[N], mem[M][N]; long long dp(long long n, long long k) { if (n < M && mem[n][k] != -1) return mem[n][k]; if (k == 0) return n; if (n == 0) return 0; if (n < M) return mem[n][k] = dp(n, k - 1) - dp... |
// 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;
logic use_AnB;
logic [1:0] act... |
#include <bits/stdc++.h> using namespace std; int main() { string a; cin >> a; int i, flag = 0; for (i = 1; i < a.size(); i++) { if (a[i] == 1 ) { flag = 1; break; } } i = (a.size()) / 2; if (flag == 1 && a.size() % 2 == 1) i++; cout << i; } |
#include <bits/stdc++.h> using namespace std; stack<int> S; int a[1005], n; bool judge() { for (int i = 0; i < n; i++) if (a[i] != i) return 0; return 1; } int main() { cin >> n; for (int i = 0; i < n; i++) scanf( %d , &a[i]); for (int i = 0; i <= n; i++) { if (judge()) { ... |
#include <bits/stdc++.h> using namespace std; struct Edge { int u, v, w; }; const int N = 500005; int n, m, q; Edge edge[N]; vector<int> sorted_edge[N]; vector<pair<int, vector<int>>> query[N]; bool npos[N]; int par[N], rnk[N]; vector<int> rnk_roll, par_roll; void init() { for (int i = 1... |
#include <bits/stdc++.h> using namespace std; int n, m, k; string s; vector<string> t; vector<pair<pair<int, int>, int> > cro; bool cmp(const pair<pair<int, int>, int> &x, const pair<pair<int, int>, int> &y) { if (x.second == y.second) { if (x.first.first == y.first.first) return x.firs... |
//
// 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... |
`include "alink_define.v"
module rxc(
input clk ,
input rst ,
input reg_flush ,
input [31:0] reg_mask ,
input [31:0] reg_busy ,
input rx_almost_full ,
input t... |
#include <bits/stdc++.h> using namespace std; using ll = long long; int const nmax = 1000; int const modulo = 1000000007; int dp[1 + nmax][1 + nmax]; int sum[1 + nmax][1 + nmax]; int main() { int n, m, cond; cin >> n >> m >> cond; if (m < n) { cout << 0; return 0; } dp[0][0... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100010; bool vis[MAXN]; char str[MAXN]; int main() { gets(str); int len = strlen(str); char maxch = 0; memset(vis, false, sizeof(vis)); for (int i = len - 1; i >= 0; i--) { if (str[i] >= maxch) vis[i] = true; maxch ... |
/**
* 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 = 3e5 + 100; long long n, x, y; int a[maxn]; vector<long long> v[maxn]; int vis[maxn]; int flag; void dfs(int u) { int i, j; vis[u] = 1; if (u == y) { flag = 1; return; } for (i = 0; i < v[u].size(); i++) { ... |
#include <bits/stdc++.h> using namespace std; inline int read() { char c = getchar(); int x = 0, f = 1; for (; !isdigit(c); c = getchar()) if (c == - ) f = -1; for (; isdigit(c); c = getchar()) x = x * 10 + c - 0 ; return x * f; } const int MAXN = 1e5 + 5; int N, M, ans; int nxt[... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 4; int n, m, a, b, ay[N], by[N], l[N], linkY[N << 1]; void read() { cin >> n >> m >> a >> b; for (int i = 1; i <= n; ++i) { cin >> ay[i]; } for (int i = 1; i <= m; ++i) { cin >> by[i]; } for (int i = 1; i <= m;... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > seg[2]; int n, m, k, x, y, dX, dY; bool flag = 0; long long ans; void add(int tx, int ty) { seg[0].push_back(pair<int, int>(tx - ty, tx)); seg[1].push_back(pair<int, int>(tx + ty, tx)); } void reflect() { int fc; if (d... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const int N = 20500; int A[N]; int n; int B[N]; int get(int k) { if (n / k < 3) return -1e9; for (int i = 0; i < k; i++) B[i] = 0; for (int i = 0; i < n; i++) B[i % k] += A[i]; int ans = -1e9; for (int i = 0; i < k; i++) ans = max(ans, B[i]);... |
/*
Copyright (C) 2014 Adapteva, Inc.
Contributed by Fred Huettig <>
Contributed by Andreas Olofsson <>
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... |
#include <bits/stdc++.h> using namespace std; long long read() { char ch = getchar(); long long f = 1, x = 0; 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... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10, Mod = 1e9 + 7; int n, m, k, A[N], P[N]; map<int, int> M; long long tot; int main() { scanf( %d%d , &n, &k); m = (1 << k) - 1; for (int i = 1; i <= n; i++) scanf( %d , &A[i]), P[i] = P[i - 1] ^ A[i], M[min(P[i], m - P[i])... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; pair<int, int> a[1010]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; ++i) { scanf( %d%d , &a[i].second, &a[i].first); if (a[i].first < a[i].second) swap(a[i].first, a[i].second); } sort(a, a + n); vector<int> ans; ... |
#include <bits/stdc++.h> using namespace std; int a[100005], f[100005]; int l[100005], r[100005]; int main() { int n; while (cin >> n) { memset(a, 0, sizeof(a)); memset(f, 0, sizeof(f)); for (int i = 0; i < n; i++) { cin >> a[i]; } int m; cin >> m; for (... |
#include <bits/stdc++.h> using namespace std; vector<vector<int> > c(6, vector<int>(4, 0)); bool full[6]; bool polu[6]; int main() { ios_base::sync_with_stdio(0); cin.tie(nullptr); for (int i = 0; i < 6; ++i) { bool was[7] = {}; for (int j = 0; j < 4; ++j) { cin >> c[i][j]; ... |
#include <bits/stdc++.h> using namespace std; long long cc = 1e9 + 7; map<int, int> A; map<int, int>::iterator itr, it; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { string s; cin >> s; int nn = s.size(); vector<int> p; for (int j = 0; j < nn; j++) { ... |
//
// Generated by Bluespec Compiler, version 2019.05.beta2 (build a88bf40db, 2019-05-24)
//
//
//
//
// Ports:
// Name I/O size props
// mv_read O 32
// mav_write O 32
// CLK I 1 clock
// RST_N ... |
#include <bits/stdc++.h> using namespace std; int main() { int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; int ans; int a = abs(x1 - x2); int b = abs(y1 - y2); ans = max(a, b); cout << ans << endl; return 0; } |
#include <bits/stdc++.h> using namespace std; const int maxn = 16; signed main() { ios_base::sync_with_stdio(false); cin.tie(0); vector<int> ans(maxn, -1); ans[0] = 0; for (int i = 1; i < maxn; ++i) { for (auto j : vector<int>{4, 6, 9}) { if (i >= j && ans[i - j] != -1) { ... |
#include <bits/stdc++.h> using namespace std; int P[111111]; int sz[111111]; int find(int x) { return (P[x] == x ? x : P[x] = find(P[x])); } void Union(int x, int y, int type) { x = find(x), y = find(y); if (sz[x] < sz[y]) swap(x, y); if (x == y) { if (type == -1) P[x] = 0; return; ... |
#include <bits/stdc++.h> using namespace std; int main() { int test; cin >> test; while (test--) { int i, n, k; string s; cin >> n; cin >> s; vector<pair<string, int> > ans; for (i = 0; i < n; i++) { string sl = s.substr(0, i); string sr = s.substr(i, ... |
// (c) Copyright 1995-2017 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 license and does not grant ... |
#include <bits/stdc++.h> using namespace std; struct point { long long x, y, index; point(long long x, long long y, long long index) : x(x), y(y), index(index) {} long long operator*(const point p) { return x * p.x + y * p.y; } long long operator^(const point p) { return x * p.y - y * p.x; } boo... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 10; int n; vector<int> g[MAXN]; int d[MAXN]; int bio[MAXN]; void dfs(int x, int dep) { d[x] = dep; bio[x] = 1; for (int i : g[x]) if (!bio[i]) dfs(i, dep + 1); } int main() { scanf( %d , &n); int a, b; f... |
module DelayCalculator(Clk_100MHz, rst, StartCounting, StopCounting, DelaySum, LastSlaveIDPlus1,
RegLoopDelay, AveTransDelay, AveLogicDelay, AveSlaveDelay);
input Clk_100MHz;
input rst;
input StartCounting;
input StopCounting;
input [15:0] DelaySum;
in... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:40:05 03/11/2015
// Design Name: Control_Unit
// Module Name: F:/ISE/work/cpu/cpu/Ctrl_Test.v
// Project Name: cpu
// Target Device:
// Tool versions:
// Desc... |
#include <bits/stdc++.h> int main() { int n, o, i, k, m; scanf( %d%d , &n, &o); scanf( %d%d , &k, &m); int a[n], b[o]; for (i = 0; i < n; i++) scanf( %d , &a[i]); for (i = 0; i < o; i++) scanf( %d , &b[i]); if (a[k - 1] < b[o - m]) printf( YES ); else printf( NO ); retu... |
#include <bits/stdc++.h> using namespace std; int n, m; char a[505][505]; long long int ans, mod; namespace tree { int edge[505][505]; long long int a[505][505]; inline void init() { memset(edge, 0, sizeof(edge)); } inline long long int qpow(long long int x, long long int y) { long long int ans = ... |
module ADT7310P32S32 (
(* intersynth_port="Reset_n_i" *)
input Reset_n_i,
(* intersynth_port="Clk_i" *)
input Clk_i,
(* intersynth_port="ReconfModuleIn_s", intersynth_conntype="Bit" *)
input Enable_i,
(* intersynth_port="ReconfModuleIRQs_s", intersynth_conntype="Bit" *)
output CpuIntr_o,
(* inters... |
#include <bits/stdc++.h> using namespace std; template <class T> inline void rd(T &x) { char ch; x = 0; bool fl = false; while (!isdigit(ch = getchar())) (ch == - ) && (fl = true); for (x = (ch ^ 0 ); isdigit(ch = getchar()); x = x * 10 + (ch ^ 0 )) ; (fl == true) && (x = -x); }... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; vector<int> g(n), v(m), b(m); for (auto &i : g) cin >> i; for (auto &i : v) cin >> i; for (auto &i : b) cin >> i; int res = 0; ve... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int n; int main() { int s = 0, i; cin >> n; while (n != 0) { s = 0; for (i = 0;; ++i) { s += (1 << i); if (s >= n) break; } if (s == n) { cout << i + 1 << ; n -= (1 << i); } else { co... |
#include <bits/stdc++.h> using namespace std; struct Arc { int f, s, prev; } arr[400005]; Arc nbr[400005]; Arc br[400005]; int beg[400005]; int kol = 0; void add_arc(int f, int s) { arr[kol].f = f; arr[kol].s = s; arr[kol].prev = beg[f]; beg[f] = kol++; arr[kol].f = s; arr[ko... |
#include <bits/stdc++.h> int main() { int sum, n, i, t, p, sum1; char z[260]; scanf( %d , &n); getchar(); for (i = 0; i < n; i++) { scanf( %c , &z[i]); } getchar(); sum = 0; sum1 = 0; p = 0; t = 0; for (i = 0; i < n; i++) { if (z[i] >= a && z[i] <= z ) { ... |
/**
* 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; scanf( %d , &n); set<pair<int, int> > st; for (int i = 0; i < n; ++i) { int x; scanf( %d , &x); st.insert({x, i}); } int x = -1; vector<int> ans; while (x >= -1) { auto it = st.lower_bound({x + ... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: one_new2.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===========================... |
Require Import Bag.
Require Import Proofs.
Require Import Proofs.Data.Foldable.
Require Import ListUtils.
Require Import Coq.Lists.List.
Import ListNotations.
Open Scope program_scope.
From Coq Require Import ssreflect ssrfun ssrbool.
Set Bullet Behavior "Strict Subproofs".
(* From Bag.hs:171-176, in the comments *... |
#include <bits/stdc++.h> using namespace std; int ans, t, p, q, i, j, n, m, k, l, r, br1, br0; bool b[36][36]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cin >> t; while (t--) { cin >> n >> m; ans = 0; vector<pair<int, int> > v; for ... |
#include <bits/stdc++.h> using namespace std; long long a[100000]; int main() { long long n; long long cnt = 0; scanf( %I64d , &n); for (long long i = 0; i < n; i++) { scanf( %I64d , &a[i]); for (long long j = 0; j < i; j++) if (a[j] > a[i]) cnt++; } cout << (cnt % 2 + ... |
#include <bits/stdc++.h> using namespace std; char buffer[1048576]; int main() { scanf( %s , buffer); string dat(buffer); int n = dat.length(); int Q; scanf( %d , &Q); int lgstep = 1; while ((1 << lgstep) <= n) lgstep++; while (Q--) { int k, d; scanf( %d%d , &k, &d); ... |
//#############################################################################
//# Function: Dual data rate output buffer #
//#############################################################################
//# Author: Andreas Olofsson #
... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; int dp[N][3][2]; string a; int n; int solve(int x, int state, int start) { if (x >= n) return 0; if (dp[x][state][start] != -1) return dp[x][state][start]; int res = 0; if (state == 0) { if (start == a[x]) re... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017
// Date : Thu Oct 26 22:45:02 2017
// Host : Juice-Laptop running 64-bit major relea... |
// ctr_encoder.v
// cal-trg-res encoder
`timescale 1 ns / 1 ps
module ctr_encoder
(
input clk,
input sync,
input reset,
input cal, // send calibrate
input trg, // send trigger (maskable by trg_veto)
input res_roc, // send ROC reset (maskable by res_veto)
input res_tbm, // send TBM reset (maskable... |
/*
* Copyright (c) 2011-2012 Travis Geiselbrecht
*
* 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, m... |
// simulate together CPU, DRAM and VIDEO FETCH
`include "../include/tune.v"
module tb_cdv;
reg rst_n;
reg clk;
wire zclk,zclk_out;
wire mreq_n,iorq_n,rd_n,wrbad_n,m1_n,rfsh_n;
reg wr_n;
tri [7:0] zdata;
wire [15:0] zaddr;
wire [7:0] ramout;
wire ram_ena;
wire [4:0] rompg;
wire romoe_n,romwe_n,csrom;
... |
`default_nettype none
module original_gate (clk, ctrl, din, sel, dout);
input wire clk;
input wire [4:0] ctrl;
input wire [1:0] din;
input wire [0:0] sel;
output reg [31:0] dout;
always @(posedge clk)
case (({(ctrl)*(sel)})+(0))
0:
dout[31:0] <= din;
1:
dout[31:1] ... |
#include <bits/stdc++.h> using namespace std; bool comp(string s, string t, vector<int> rows) { int i = 0; int m = s.size(); while (i < m && (s[i] == t[i] || (find(rows.begin(), rows.end(), i) != rows.end()))) i++; if (i == m) return false; return s[i] < t[i]; } int main() {... |
#include <bits/stdc++.h> using namespace std; long long mod; long long binPow(long long a, long long q) { a %= mod; if (q == 0) return 1; if (q % 2 == 1) return a * binPow(a * a, q / 2) % mod; else return binPow(a * a, q / 2) % mod; } bool prime(int x) { if (x % 2 == 0) return ... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2012.2
// Copyright (C) 2012 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
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 la... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Mon Jun 05 00:51:00 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; int N; vector<int> rating; void reading() { cin >> N; rating.resize(N); for (int i = 0; i < N; i++) cin >> rating[i]; } void processing() { for (int i = 0; i < N; i++) { int res = 0; for (int j = 0; j < N; j++) if (rating[i] <... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100; long long n, k; int a[15]; long long rc[15], p[15], ans; void solve() { scanf( %d%d , &n, &k); k++; scanf( %d , &a[1]); rc[1] = 1; long long now = 1, tmp; int ss = 0; for (int i = 2; i <= n; i++) { scanf( %... |
/*
* Copyright (c) 2003 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 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 law... |
#include <bits/stdc++.h> using namespace std; long double esp = 1e-11; const long double PI = acos(-1.0); const long long int INF = 0x3f3f3f3f; const long long int MOD = 1000000007; const int maxn = 10010; const int NUM = 25; long long int wn[NUM]; long long int mu(long long int a, long long int b, lo... |
/*
* 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 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string op; int x = 0; for (int k = 0; k < n; k++) { cin >> op; if (op == ++X || op == X++ ) { x++; } else if (op == --X || op == X-- ) { x--; } } cout << x << endl; ... |
/*+--------------------------------------------------------------------------
Copyright (c) 2015, Microsoft Corporation
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 ... |
module InstructionMemory(output reg[WORD_WIDTH-1:0] INSTR_out, input[WORD_WIDTH-1:0] INSTR_in);
parameter WORD_WIDTH = 16;
parameter DR_WIDTH = 3;
parameter SB_WIDTH = DR_WIDTH;
parameter SA_WIDTH = DR_WIDTH;
parameter OPCODE_WIDTH = 7;
parameter INSTR_WIDTH = WORD_WIDTH;
/*
0000 LDI R0,3
0001 LDI R1,7
0002 MOVA R2... |
//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... |
/**
* 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:
// Engineer: Muhammad Ijaz
//
// Create Date: 08/10/2017 09:26:11 AM
// Design Name:
// Module Name: MULTIPLEXER_16_TO_1
// Project Name: RISC-V
// Target Devices:
// Tool Versions: ... |
#include <bits/stdc++.h> using namespace std; struct Edge { int to, w, type; Edge() {} Edge(int _to, int _w, int _type) : to(_to), w(_w), type(_type) {} bool operator<(const Edge other) { return type < other.type; } }; const long long N = 1e5 + 5, oo = 1e18; long long n, m, k, dist[N], res; ... |
/**
* 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 N = 200005; int arr[N], f[N]; int main() { int n; scanf( %d , &n); set<int> st; for (int i = 1; i <= n; ++i) { st.insert(i); scanf( %d , arr + i); } st.insert(n + 1); int q; scanf( %d , &q); int t, x, v; ... |
#include <bits/stdc++.h> using namespace std; long long const INF = (long long)1e9; long long const INF64 = (long long)4e18; long long const v10e5 = (long long)100000; long long const v10e6 = (long long)1000000; long long const v10e9 = (long long)1000000000; long long const s10e5 = (long long)100000 + 10;... |
`define SMV
`include "ovl_next_wrapped.v"
`include "ovl_ported/ovl_next.v"
/*
* File: ovl_next_wrapped_tb.v
* Test bench for ovl_next_wrapped.v
* Configuration values for ovl_next_wrapped must match the
* hard-coded values used here.
* Includes assertions for verification.
* Created 2013-10-16
*
*/
modul... |
#include <bits/stdc++.h> using namespace std; ifstream fin( A.in ); ofstream fout( A.out ); long long r, h; int main() { cin >> r >> h; if (h % r == 0) { cout << (h / r) * 2 + 1; return 0; } double d = double(h) / double(r); int z = h / r; double dd = z + 0.5; if (d >= ... |
/*
Teak synthesiser for the Balsa language
Copyright (C) 2007-2010 The University of Manchester
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 opti... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> A, B; for (int i = 1; i <= n; i++) A.push_back(i); long long sum = 0; for (int i = 2; i < n; i++) sum += i * (i + 1); cout << sum << n ; } |
#include <bits/stdc++.h> using namespace std; const int MAXN = 500 + 10; const int P = 998244353; int N, X, f[MAXN][MAXN], pw[MAXN][MAXN], binom[MAXN][MAXN]; void add(int& a, int b) { a = a + b >= P ? a + b - P : a + b; } int dif(int a, int b) { return a - b < 0 ? a - b + P : a - b; } int main() { for... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; int x; cin >> x; vector<int> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; } if (n == 1) { cout << 0 << n ; return 0; ... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long INF = 1e18; const int MAXN = 3e5 + 10; const int MAXM = 1e4 + 500; const int N = 5600 + 15; const double EPS = 1e-9; double len(complex<long long> a) { return sqrt(a.real() * a.real() + a.imag() * a.imag());... |
/*
*
* Clock, reset generation unit for ML501 board
*
* Implements clock generation according to design defines
*
*/
//////////////////////////////////////////////////////////////////////
//// ////
//// Copyright (C) 2009, 2010 Authors and OPENCORES.O... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.