text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> int main() { int n; std::scanf( %d , &n); for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { std::printf( %d , j * n + (j % 2 == 0 ? i : n - i - 1) + 1); } std::printf( n ); } return 0; } |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: Test.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =======================... |
#include <bits/stdc++.h> using namespace std; const int kMod = 1e9 + 7; const int kNmax = 2e5 + 10; int n, v[kNmax], sub[kNmax], up[kNmax][2], down[kNmax][2], res, res_even; vector<int> g[kNmax]; void dfs(int node, int father = 0) { sub[node] = 1; down[node][0] = 1; int ways = (1LL * n * n) % kM... |
/**
* 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... |
/**
* 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 = 2005, maxm = 200005; vector<int> g[maxn]; int tmp, vis[maxn], dis[maxn], mp[maxn][maxn]; int n, m, ans, cnt, tot, res, ecnt, info[maxn], nx[maxm], v[maxm]; int id, en, dfn[maxn], low[maxn], ori[maxn], sta[maxn], outd[maxn]; void add(int u1, in... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000000 + 7; const int N = 100000 + 50; vector<int> a; int val[N]; int p[N]; int rp[N]; int avl[N]; pair<int, int> dp[N]; int curn; pair<int, int> bit[N]; vector<vector<int> > fa; void clear_bit(int n) { for (int i = 0;... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, f[6]; cin >> a >> b >> c; f[0] = a + b + c; f[1] = a + b * c; f[2] = a * b + c; f[3] = a * b * c; f[4] = (a + b) * c; f[5] = a * (b + c); sort(f, f + 6); cout << f[5]; return 0; } |
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; long long x, k; long long qow(long long a, long long b) { long long ans = 1; a = a % mod; while (b) { if (b % 2 == 1) { ans = (ans * a) % mod; } a = (a * a) % mod; b /= 2; } retur... |
#include <bits/stdc++.h> bool fine(int v) { int z = 0, s = 0; while ((v & 1) == 0) { z++; v >>= 1; } while ((v & 1) == 1) { s++; v >>= 1; } return v == 0 && z == s - 1; } int main() { int n; scanf( %d , &n); for (int i = n; i >= 1; i--) { if (n % i... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/**
* 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 anc[200007]; int sz[200007]; int x[200005], y[200005]; vector<int> g[200005]; int get_set(int v) { if (v == anc[v]) { return v; } return anc[v] = get_set(anc[v]); } void unite_sets(int u, int v) { u = get_set(u); v = get_set(v);... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0, f = 1; char c = getchar(); while (!isdigit(c)) { if (c == - ) f = -1; c = getchar(); } while (isdigit(c)) { x = (x << 3) + (x << 1) + (c ^ 48); c = getchar(); } return f == -... |
#include <bits/stdc++.h> using namespace std; struct Node { int l, r; Node(int l, int r) : l(l), r(r) {} bool operator<(const Node &o) const { return r - l == o.r - o.l ? r > o.r : r - l > o.r - o.l; } }; vector<int> event; int arr[200000]; map<int, int> matching; map<int, int> cloak... |
#include <bits/stdc++.h> using namespace std; const long long Mo = 1e9 + 7; int cnt[1 << 6], sz; void add(long long &x, long long y) { x += y; x %= Mo; } void gao(int n, int C, int R, vector<vector<long long>> &Ma) { int loop = 1 << R; for (int i = 0; i < sz; i++) { int c = i / loop, r... |
#define _CRT_SECURE_NO_WARNINGS #include <vector> #include <string> #include <map> #include <queue> #include <unordered_map> #include <unordered_set> #include <cassert> #include <complex> #include <cstdio> #include <iostream> #include <iomanip> #include <cmath> #include <functional> #include... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
//Legal Notice: (C)2020 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... |
// -*- verilog -*-
//
// USRP - Universal Software Radio Peripheral
//
// Copyright (C) 2003 Matt Ettus
//
// 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... |
`timescale 1ns / 1ns
`define MOD_OSRAM
module tb_fmrv32im_artya7;
reg sim_end;
reg RST_N;
reg CLK;
wire uart_txd_in;
wire uart_rxd_out;
wire [3:0] led;
initial begin
sim_end = 1'b0;
RST_N = 1'b0;
CLK = 1'b0;
force u_fmrv32im_artya7.RST_N = 1'b0;
/*
`ifdef MOD_OSRA... |
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); int dx[] = {1, -1, 0, 0, -1, 1, -1, 1}; int dy[] = {0, 0, 1, -1, -1, -1, 1, 1}; void file() {} int main() { cout << setprecision(20) << fixed; ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int k; cin >> k... |
`define WIDTH_P 3
/**************************** TEST RATIONALE *******************************
1. STATE SPACE
The number of possible inputs for each WIDTH_P is very large and moreover,
the implementation of the DUT itself is independent of the value of input.
So thermometer codes are used as test inputs, thus l... |
/* indicators.v */
module indicators (
// system
input wire clk, // clock
input wire rst, // reset
// inputs
input wire [ 8-1:0] track, // floppy track number
input wire f_wr, // floppy fifo write
input wire f_rd, // f... |
//Legal Notice: (C)2015 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associated do... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; int n, m; vector<pair<int, int> > e[N]; vector<int> ans[2]; bool fla[2], flag; int E[N], d[N]; vector<int> cnt[2]; void DFS(int first, int o, int res) { if (flag) return; d[first] = o; cnt[o].push_back(first); for (aut... |
// ==============================================================
// RTL 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 1 ns / 1 ps
... |
// #include<bits/stdc++.h> #include<iostream> #include<algorithm> #include<cmath> /* #include<vector> #include<set> #include<map> #include<unordered_map> #define umap unordered_map #include<unordered_set> #define uset unordered_set */ #define pii pair<int,int> #define F first #define S sec... |
#include <bits/stdc++.h> using namespace std; char s[105]; int main() { int n; cin >> n; cin >> s; int flag = 0; for (int i = 1; i < n; i++) { if (s[i] != ? && s[i] == s[i - 1]) { flag = 1; break; } } if (flag) cout << No << endl; else { ... |
`include "defines.vh"
module primogen_tb;
reg clk = 0;
wire rst;
reg go = 0;
wire gen_ready;
wire gen_error;
wire [15:0] gen_res;
localparam N = 50;
reg [15:0] primes [N - 1:0];
integer i;
por pos_inst(
.clk(clk),
.rst(rst));
primogen gen(
.clk(clk),
.go(go),
.rst(rst),
.ready(gen_ready),
.error(ge... |
module L1_Cache
(
input clk,
input rst,
input [31:0] addr,
input cs,
input we,
input [31:0] data_i,
output reg [31:0] data_o,
output reg stall
);
//wire [31:0] mem_addr_bus = addr_i;
wire [21:0] mem_tag = addr[31:10];
wire [4:0] mem_index = addr[9:5];
wire [4:0] mem_offset = addr[4:0];
... |
module REGISTERTEST;
reg clock, write, reset;
reg [2:0] address1, address2, writeAddress;
reg [15:0] writeData;
wire [15:0] data1, data2;
parameter STEP = 2;
Register r (clock, write, reset, address1, address2, writeAddress, writeData, data1, data2);
always begin
clock = 0; #(STEP / 2);... |
/*
* 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 2018 Nuclei System Technology, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except i... |
//
// Copyright 2014 Ettus Research LLC
//
// Not necessarily that useful in general, but a good test block
//
// rfnoc-neuralnet: Pulled into fpga-src and exposed the pkt_size as an input parameter
// (I'm not really too sure what it's doing, but at least it makes sure tlast is aligned properly)
// Also, changed t... |
#include <bits/stdc++.h> using namespace std; bool iguales(vector<string>& x, vector<string>& y) { for (int i = (int)0; i < (int)x.size(); i++) { if (x[i] == T || y[i] == T ) continue; if (!(x[i] == y[i])) return false; } return true; } int main() { map<string, vector<vector<strin... |
module x;
always @(/*AUTOSENSE*/arb_select_f or octet_idx) begin
octet_flag[0] = |arb_select_f[ 7: 0];
octet_flag[1] = |arb_select_f[15: 8];
octet_flag[2] = |arb_select_f[23:16];
octet_flag[3] = |arb_select_f[31:24];
octet_flag[4] = |arb_select_f[39:32];
octet_f... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 123; int n, t, label[N], times = 0; vector<int> e[N]; vector<pair<int, int> > res; void newLabel(int u) { res.push_back(make_pair(u, times)); label[u] = times; } void dfs(int u, int backLabel = -1, int p = 0) { newLabel(u); ... |
#include <bits/stdc++.h> using namespace std; int mini[10], maxi[10], dist[10]; int main() { int n, i, total; scanf( %d , &n); total = 0; for (i = 0; i < 3; ++i) { scanf( %d %d , &mini[i], &maxi[i]); total += mini[i]; dist[i] = mini[i]; } i = 0; while (n - total > 0) ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ii = pair<int, int>; const int MAXN = 5 + 300000; const int MAXB = 21; int n, arr[MAXN], nxt[MAXN][MAXB], memo[MAXN][MAXB]; int dp(int i, int k) { if (i == n) return n; int& ans = memo[i][k]; if (ans == -1) { if (n... |
#include <bits/stdc++.h> using namespace std; const int MAX = 200; int num[MAX], vis[MAX]; int main() { int n, m, a; while (scanf( %d %d , &n, &m) == 2) { memset(vis, 0, sizeof(vis)); for (int i = 0; i < m; i++) { scanf( %d , &a); for (int i = a; i <= n; i++) if (!v... |
module bus_arb (
clk,
reset_,
mcs_addr,
mcs_ready,
mcs_wr_data,
mcs_wr_enable,
mcs_rd_data,
mcs_rd_enable,
mcs_byte_enable,
addr,
rnw,
req,
wr_data,
gpio_cs,
gpio_rd_data,
gpio_rdy,
disp_cs,
disp_rd_data,
disp_rdy,
uart_cs,
uart_rd_data,
uart_rdy);
i... |
#include <bits/stdc++.h> using namespace std; int main() { cout.precision(30); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<pair<long long, long long>> ps(n); for (int i = 0; i < n; i++) { cin >> ps[i].first >> ps[i].second; } sort(ps.b... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1005; int b[maxn]; int c[maxn]; bool visit[maxn]; int n, k; int main() { int i, p; while (scanf( %d%d , &n, &k) != EOF) { for (i = 1; i <= n; i++) scanf( %d , &b[i]); memset(c, 0, sizeof(c)); memset(visit, false, size... |
#include <bits/stdc++.h> using namespace std; long long n, m, k; void nhap() { cin >> n >> m >> k; } long long tinh(long long x) { if (x > k) return -1e19 + 10; long long r = n / (x + 1); long long h = k - x; long long d = m / (h + 1); return r * d; } void xuli() { if (n - 1 + m - 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... |
/**
* bsg_cache_to_axi.v
*
* @author tommy
*/
`include "bsg_defines.v"
`include "bsg_cache.vh"
module bsg_cache_to_axi
import bsg_cache_pkg::*;
#(parameter `BSG_INV_PARAM(addr_width_p)
,parameter `BSG_INV_PARAM(block_size_in_words_p)
,parameter `BSG_INV_PARAM(data_width_p)
,parameter `BSG_IN... |
module Alu(input[31:0] op1,
input[31:0] op2,
input[3:0] f,
output reg[31:0] result,
output zero);
always @(op1, op2, f)
case (f)
0: result = op1 + op2;
1: result = op1 - op2;
2: result = op1 & op2;
3: result = op1 | op2;
4: result = op1 ~| op2;
... |
#include <bits/stdc++.h> using namespace std; const int N = 1000010; int t, sp[N]; map<int, int> n, m, s; vector<pair<int, int> > _n, _m, _s; long long n_val, m_val, s_val; void sieve(void) { for (int i = 2; i * i < N; ++i) { if (sp[i]) continue; sp[i] = i; for (int j = i * i; j < N;... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; char cur = s[0]; int count = 1; for (int i = 1; i < s.length(); i++) { if (cur == s[i]) { count++; if (count == 7) { cout << YES << endl; return 0; } } else { ... |
#include <bits/stdc++.h> inline int lb(int a) { return a & (-a); } long long a[100100], bit[7][15][100100]; int n, m, t; inline void adj(int z, int zm, int pos, long long val) { for (int i = pos; i <= n; i += lb(i)) bit[z][zm][i] += val; } inline long long qry(int z, int zm, int pos) { if (pos <= 0)... |
#include <bits/stdc++.h> using namespace std; int n, t; char G[500005]; int solve(int k) { int last = n, i; int hs, ss; hs = ss = 0; for (i = 1; i <= n; i++) { if (G[i] == H ) hs++; if (G[i] == S ) ss++; if (G[i] == H ) last = i; if (hs - ss >= k && G[i] != . ) last =... |
/*
* 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; int MSB1(long long x) { int d = 0; while ((1LL << d) <= x) d++; return d; } int main() { int n, m; cin >> n >> m; struct Elm { int l, r, x; }; vector<vector<Elm>> vals(n); while (m--) { int op; cin >> op; i... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:36:55 06/27/2013
// Design Name: qmult
// Module Name: I:/Projects/xilinx/FPInterface/Tester/Tran3005/Test_mult.v
// Project Name: Trancendental
// Targ... |
/**
* 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... |
/*
* BCH Encode/Decoder Modules
*
* Copyright 2014 - Russ Dill <>
* Distributed under 2-clause BSD license as contained in COPYING file.
*/
`timescale 1ns / 1ps
`include "config.vh"
`include "bch_defs.vh"
/*
* Tradition chien search, for each cycle, check if the
* value of all the sumuations is zero, if so, th... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); ; int n, m; cin >> n >> m; int dem = 0; if (m % n != 0) { cout << -1; return 0; } int sum = m / n; while (sum % 2 == 0) { sum /= 2; dem++; } while (sum % 3 == 0... |
#include <bits/stdc++.h> using namespace std; string s; vector<int> v; int main(int argc, char const *argv[]) { cin >> s; int n = s.size(); sort(s.begin(), s.end()); for (int i = 0; i < n; i++) { if (s[i] > 0 ) { swap(s[0], s[i]); break; } } string q; cin... |
#include <bits/stdc++.h> using namespace std; const int N = (int)1e5 + 10; const long long INF = (long long)1e9; struct Point { long long x, y; Point() : x(), y() {} void scan() { scanf( %lld%lld , &x, &y); } bool operator<(const Point &a) const { return y < a.y || (y == a.y && x < a.x); ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; char buf[1 << 15], *fs, *ft; inline char getc() { return (ft == fs && (ft = (fs = buf) + fread(buf, 1, 1 << 15, stdin), ft == fs)) ? 0 : *fs++; } template <typename T> inline void read(T ... |
//lpm_divide CBX_SINGLE_OUTPUT_FILE="ON" LPM_DREPRESENTATION="UNSIGNED" LPM_HINT="MAXIMIZE_SPEED=6,LPM_REMAINDERPOSITIVE=TRUE" LPM_NREPRESENTATION="UNSIGNED" LPM_PIPELINE=5 LPM_TYPE="LPM_DIVIDE" LPM_WIDTHD=25 LPM_WIDTHN=64 aclr clken clock denom numer quotient remain
//VERSION_BEGIN 16.0 cbx_mgl 2016:07:21:01:49:21:SJ ... |
#include <bits/stdc++.h> using namespace std; vector<int> fibonacci; void createFibbo(int num); int main() { int num; cin >> num; if (num == 0) cout << 0 0 0 n ; else if (num == 1) cout << 0 0 1 n ; else if (num == 2) cout << 0 1 1 n ; else if (num == 3) cout <... |
#include <bits/stdc++.h> using namespace std; const int N = 512345, lgN = 20, rootN = 1123; const double eps = 1e-11; vector<int> cities; int root = -1; int dp[N]; bool visited[N], rem[N]; vector<int> adj[N]; void dfsTree(int v) { int sum = 0; auto it = lower_bound(cities.begin(), cities.end()... |
// trick: сперва писать в тестбенче, а потом выделить модуль
//
// vlog *.v; vsim -t ns work.test_math; do waves.do
//
`timescale 10ns/1ps
//`default_nettype none
//=================== int ariphm 2001 ==============
// fixme: px to unsigned for calc? How?
// Verilog:
// http://www.uccs.edu/~gtumbush/published_paper... |
#include <bits/stdc++.h> using namespace std; using namespace std; const int N = 3030; const int INF = (int)2e9; int n, m; int len[N]; int f[N][N]; vector<int> g[N]; vector<int> gr[N]; vector<pair<int, int> > have[N]; vector<pair<int, int> > gave[N]; queue<int> q; void bfs(int v) { for (in... |
#include<bits/stdc++.h> using namespace std; const int N=17; int n,p[1<<N];bool used[1<<N]; struct Edge{int nxt,to;}e[N*(1<<N)];int fir[1<<N]; void add(int u,int v,int i){e[i]=(Edge){fir[u],v},fir[u]=i;} int col[1<<N]; void solve(){ cin>>n; for(int i=0;i<(1<<n);++i){ used[i]=0,p[i]=fir[i]=col[i]... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2003 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
reg [39:0] con1,con2, con3;
reg [31:... |
#include <bits/stdc++.h> #define mid (tl+tr)/2 #define mod 1000000007 #define fain(arr) for(ll i=0;i<n;i++)cin>>arr[i]; #define all(x) x.begin(),x.end() #define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define bugv(n1) if(DEBUG)cout<<#n1<< is <<n1<< n ; #define buga(A) cout<<#A<< is... |
#include <bits/stdc++.h> using namespace std; const long long maxn = 100000 + 5; const long long inf = 9e17; long long ans = inf, l, r, mid1, mid2; vector<long long> g[maxn], v; long long n, m; inline long long cost(long long mid) { long long cnt = mid - g[0].size(), tmp = 0; v.clear(); for (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... |
//==================================================================================================
// Filename : submidRecursiveKOA.v
// Created On : 2016-10-27 23:28:55
// Last Modified : 2016-10-28 08:59:19
// Revision :
// Author : Jorge Esteban Sequeira Rojas
// Company : Institut... |
///////////////////////////////////////////////////////////////////////////////
//
// 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... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: progmem.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ================================... |
#include <bits/stdc++.h> using namespace std; int main() { string x; cin >> x; int i, j; int len = x.size(); int count = 0; for (i = 0; i < len; i++) { for (j = 1; j <= len - i; j++) { string z = x.substr(i, j); if (z == Danil || z == Olya || z == Slava || z == 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 Maxn = 2005; int n; int p[Maxn], b[Maxn]; int inb[Maxn]; int res; int best[Maxn]; vector<pair<int, int> > seq; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &p[i]); for (int i = 1; i <= n; i++) { scanf( ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// 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; void solve(){ int n; scanf( %d , &n); if (n == 2){ printf( 1 n2 1 n1 n2 1 n ); } else if (n == 3){ printf( 5 n2 3 1 n2 n1 3 n2 3 n ); } else { long long t = 0; vector<int> ans; v... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e4 + 7; const int inf = 0x3f3f3f3f; int a[maxn]; char s[150]; int main() { int t; cin >> t; while (t--) { int n; cin >> n; scanf( %s , s); int x = 0, y = 0; for (int i = 0; i < n; i++) { if (s[i... |
#include <bits/stdc++.h> using namespace std; int main() { long long int i, t, c, sum = 0; cin >> t; long long int a[t]; for (i = 0; i < t; i++) { cin >> a[i]; } for (i = 0; i < t; i++) { sum += a[i]; } if (sum % 2 == 0) { cout << sum << endl; } else { lon... |
#include <bits/stdc++.h> using namespace std; bool not_prime[100000]; long long int primes[100000]; int p, prime_factors[100000], pf_count[100000], q; int a[10000]; void find_primes() { long long int i, j; p = 0; for (i = 2; i < 100000; i++) { if (not_prime[i] == false) { primes[p+... |
#include <bits/stdc++.h> using namespace std; int n, a[111111]; int isp2[222222]; int main() { scanf( %d , &n); for (int i = 0; i < n; ++i) { scanf( %d , &a[i]); } for (int i = 1, p = 1; i < 222222; i *= 2, ++p) { isp2[i] = p; } sort(a, a + n); int ans = 1e9; for (int... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, s = 2, ans = 0, i; cin >> n; if (n < 2) { cout << 0; return 0; } for (i = 1; i <= 1e6; ++i) { if (s > n) break; if ((n - s) % 3 == 0) ++ans; s += 3 * i + 2; } cout << ans; } |
module tester(
clk,
rst
);
parameter end_simulation = 32'hffff;
output clk,rst;
reg clk, rst;
integer clk_count;
integer tests_done;
integer tests_failed;
initial begin
forever begin
#10 clk <= ~clk;
if(clk) clk_count = clk_count + 1;
if(clk_count == end_simulation) begin
... |
/**
* 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> int Cmp(const void *a, const void *b); int main(void) { int i, n, x, w, gpos = -2 * 1000000000, ans = 0, grange[200000][2]; scanf( %d , &n); for (i = 0; i < n; i++) { scanf( %d%d , &x, &w); grange[i][0] = x - w; grange[i][1] = x + w; } qsort(grange, n, ... |
#include <bits/stdc++.h> using namespace std; int N, ans = 0, overtake = 0, pspeed, plimit = 1000; stack<int> signs; int main() { cin >> N; for (int i = 0, a, b; i < N; i++) { cin >> a; if (a == 1) { cin >> b; pspeed = b; while (!signs.empty()) { if (signs.t... |
#include <bits/stdc++.h> using namespace std; inline void io() { freopen( input.txt , r , stdin); freopen( output.txt , w , stdout); } long long I() { long long a; cin >> a; return a; } void PV(vector<long long> v) { for (long long i = 0; i < (long long)v.size(); i++) cout << v[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 law... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int n, m, s, t, ds, dt, cnt, f; vector<pair<int, int>> ans; vector<int> G[N]; pair<int, int> xx[N], yy[N]; bool vi[N]; void dfs(int u) { vi[u] = true; for (int v : G[u]) if (!vi[v]) { ans.push_back({u, v}); ... |
//-----------------------------------------------------------------
// AltOR32
// Alternative Lightweight OpenRisc
// V2.1
// Ultra-Embedded.com
// Copyright 2011 - 2014
//
// Email:
//
// ... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1000, INDEX = 1; int n, type[MAX_N + INDEX]; string team[MAX_N + INDEX], city[MAX_N + INDEX]; bool isUsed[MAX_N + INDEX]; void get(int ind) { isUsed[ind] = true; for (int i = 1; i <= n; i++) { if (i != ind) { if (team[i][0... |
#include <bits/stdc++.h> using namespace std; struct comp { bool operator()(long long int a, long long int b) { return a > b; } }; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int n, k; cin >> n >> k; vector<pair<long long int, long long int> > po... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:256000000 ) using namespace std; struct circle { double x, y, r; circle() {} circle(double x, double y, double r = 0) : x(x), y(y), r(r) {} circle operator+(circle b) { return circle(x + b.x, y + b.y); } circle operator-(circle b) { retu... |
module fifo # (parameter abits = 20, dbits = 8)(
input reset, clock,
input rd, wr,
input [dbits-1:0] din,
output [dbits-1:0] dout,
output empty,
output full,
output reg ledres
);
wire db_wr;
wire db_rd;
reg dffw1, dffr1;
reg [dbits-1:0] out;
initial ledres = 0;
reg [1:0] count;
reg... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17.10.2017 11:51:09
// Design Name:
// Module Name: srio_testbench
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Depende... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.