text stringlengths 59 71.4k |
|---|
//=======================================================================
// Filename :cloz.v
// Author :(RDC)
// Created On :2014-04-28 09:31
// Last Modified :
// Update Count :2014-04-28 09:31
// Description :To Count the number of leading ones/zero in a word
// ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100; const int maxm = 100; const int maxlen = maxn + maxm - 1; struct point { int ind, p; bool operator<(const point& b) const { return p < b.p; } } cell[maxlen]; char state[maxlen]; int n, m; long long k; int p; long long dp[m... |
#include <bits/stdc++.h> using namespace std; int main() { int a = 1, b, c = 0, d = 0, e = 0, f, i = 0, k = 0, j = 0, n = 0, t = 0, l = 0, m = 0, h[3000] = {0}; string s, x; cin >> t; n = 1000000; for (i = 0; i < t; i++) { cin >> b; j = max(j, min(b - 1, 1000000 - b)); } ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 3006; struct arr { int x, y, i; } a[maxn]; int r, c, n, K; int pos[maxn], L[maxn], R[maxn]; long long ans; bool cmpx(arr x, arr y) { if (x.x == y.x) return x.y < y.y; return x.x < y.x; } bool cmpy(arr x, arr y) { if (x.y ... |
`timescale 1ns / 1ps
module uart_tx(
input CLK,
input RST,
input EN,
input [DATAWIDTH - 1 : 0] DATA,
input DATARDY,
output READ,
output TX
);
parameter DATAWIDTH = 8;
p... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 100; int m, n, h; int t[maxn]; int first[maxn * 2], nxt[maxn * 2], des[maxn * 2], tot; int dfn[maxn], low[maxn], dft; bool d[maxn]; int flag[maxn], cnt[maxn], scc; stack<int> stk; inline void add(int x, int y) { tot++; des[... |
#include <bits/stdc++.h> using namespace std; long long n, x, ans, kiri, kanan, sum, i, pos; long long a[300007], dua[300007]; int main() { scanf( %lld , &n); dua[0] = 1; for (i = 1; i <= 300000; i++) dua[i] = (dua[i - 1] * 2) % 1000000007; x = 1; scanf( %lld , &a[0]); pos = -1; for ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, a, b, sum = 0, sum1 = 0; cin >> n >> m >> a >> b; sum = n / m; sum1 = n - (sum * m); if (sum * b < n * a) { cout << min((sum * b + sum1 * a), ((sum + 1) * b)); } if (sum * b >= n * a) { cout << n * a; } ... |
#include <bits/stdc++.h> using namespace std; int main() { int k; cin >> k; if (k < 25) { cout << -1 << endl; } else { int r = 0, c = 0; for (int i = 5; i <= sqrt(k); i++) { if (k % i == 0) { r = i; c = k / i; break; } } if ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; scanf( %d , &t); for (int tt = 0; tt < t; tt++) { vector<vector<int> > A(9, vector<int>(9)); for (int i = 0; i < 9; i++) { int q; scanf( %d , &q); for (int j = 0; j < 9; j++) { A[i][8 - j] = 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; const int N = 1e5 + 7; int n, a[N], pre[N], suf[N]; char ans[N]; struct Fenwick { int n, c[N]; void init(int _n) { n = _n; memset(c, 0, sizeof(c[0]) * (n + 1)); } void upd(int i, int v) { while (i <= n) { c[i] = max(c[i], ... |
#include <bits/stdc++.h> using namespace std; bool isprime(long long n) { if (n == 2) return true; if (n < 2 || n % 2 == 0) return false; for (long long i = 3; i * i <= n; i += 2) { if (n % i == 0) return false; } return true; } int main() { ios_base::sync_with_stdio(0), cin.tie(0)... |
`timescale 1ns / 1ps
// nexys3MIPSSoC is a MIPS implementation originated from COAD projects
// Copyright (C) 2014 @Wenri, @dtopn, @Speed
//
// 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, ... |
#include <bits/stdc++.h> using namespace std; int dp[105][105][12]; int main() { int n, C, q; scanf( %d%d%d , &n, &q, &C); for (int i = 1; i <= n; i++) { int a, b, c; scanf( %d%d%d , &a, &b, &c); dp[a][b][c]++; } for (int i = 1; i <= 100; i++) for (int j = 1; j <= 100; ... |
//=======================================================
// This code is generated by Terasic System Builder
//=======================================================
//`define ENABLE_HPS
module DE0_NANO_SOC_Default(
//////////// ADC //////////
output ADC_CONVST,
output ADC_SCK,
outpu... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
`include "../include/tune.v"
// Pentevo project (c) NedoPC 2010-2011
//
// mix up border and pixels, add palette and blanks
//
module video_palframe(
input wire clk, // 28MHz clock
input wire hpix,
input wire vpix,
input wire hblank,
input wire vblank,
input wire [ ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:01:05 04/13/2015
// Design Name:
// Module Name: Sieve
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// R... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout << setprecision(20) << fixed; long long t; cin >> t; while (t--) { long long n; cin >> n; long long a[n]; vector<long long> b, c; long long s = 0... |
#include <bits/stdc++.h> using namespace std; namespace sat { const int MAX = 200010; bool vis[MAX]; vector<int> ed[MAX], rev[MAX]; int n, m; vector<int> order; int comp[MAX]; inline int inv(int x) { return ((x) <= n ? (x + n) : (x - n)); } void init(int vars) { n = vars, m = vars << 1; for ... |
/**
* 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 node { int data; long int sum; struct node *left, *right; struct node* next; }; struct node* newNode(int data) { struct node* Node = new (struct node); Node->data = data; Node->left = Node->right = Node->next = NULL; return (No... |
`timescale 1ns/1ps
module key_gen(
clk,
reset,
p2k_valid,
p2k_ingress,
p2k_rloc_src,
p2k_eid_dst,
p2k_metadata,
mode, //1 ceng die wang ;
k2m_metadata_valid,
k2m_metadata
);
input clk;
input reset;
input p2k_valid;
input [7:0] p2k_ingress;
input [127:0] p2k_rloc_src;
input [127:0] p2k_eid_dst;
input [7:0] p2k_... |
/**
* 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 int maxn = 1e6 + 7; long long t, n, k, temp; int main(int argc, char* argv[]) { cin >> t; while (t--) { cin >> n >> k; long long cnt = 0; while (n > 0) { if (n % k != 0) { cnt += n % k; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int t = 1; cin >> t; while (t--) { long long int i, j, k, n, m = 1e10, f = 1; cin >> n; vector<long long int> a(n), b(n), in, val; for (i = 0; i < n; i++)... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100 + 10; int n, m, k; string l[maxn]; int t[maxn], T; int w[5][3]; vector<pair<int, int> > v; pair<pair<int, int>, pair<int, int> > a[maxn]; int vis[24 * 30 * 60 + 10]; int cor[24 * 30 * 60 + 10]; int dp[maxn][24 * 30 * 60 + 10]; in... |
//
// Paul Gao 08/2019
//
//
`include "bsg_noc_links.vh"
module bsg_fifo_1r1w_small_hardened_test_node
#(parameter `BSG_INV_PARAM(num_channels_p )
,parameter `BSG_INV_PARAM(channel_width_p )
,parameter is_client_node_p = 0
,localparam width_lp = num_channels_p * channel_width_p
,localpara... |
/*
* 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; unsigned long long int dp[1001], sum[1001]; unsigned long long int nCrModp(unsigned long long int n, unsigned long long int r) { unsigned long long int p = 1000000007; n = n + r - 1; r = r - 1; unsigned long long int C[... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: DynamicDelay_Start.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =========... |
#include <bits/stdc++.h> using namespace std; struct node { int x, y; } arr[104]; vector<int> graph[105]; int visited[105] = {0}; void dfs(int i) { visited[i] = 1; int j = 0; while (j < graph[i].size()) { if (visited[graph[i][j]] == 0) { dfs(graph[i][j]); } j++; ... |
// (C) 2001-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 doc... |
#include <bits/stdc++.h> using namespace std; const int N = 2005; const long double ep = 1e-10; struct pnt { long double x, y; pnt() { x = y = 0; } pnt(long double xx, long double yy) { x = xx, y = yy; } pnt operator+(pnt a) { return pnt(x + a.x, y + a.y); } void in() { int xx, yy; ... |
/**
* 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 mul(long long a, long long b) { if (!b) return 1; long long k = mul(a, b / 2); if (b & 1) return k * k % 998244353 * a % 998244353; return k * k % 998244353; } int n, k, N; long long A[200010], B[200010], C[200010], a, b, c, sum; long l... |
#include <bits/stdc++.h> using namespace std; int n, k, i; int oma = 0, omi = 0, ma, mi; int a[101]; string s; int main() { cin >> n >> k; for (i = 1; i <= n; i++) { cin >> s; a[s.size()]++; } cin >> s; for (i = 1; i < s.size(); i++) omi = omi + a[i]; mi = omi; ma = o... |
#include <bits/stdc++.h> using namespace std; const int N = 100005, S = 100; int L[N], R[N], bel[N], to[N]; long long a[N], b[N], taga[N], tagb[N]; long double slope(int x, int y) { if (a[x] == a[y]) { if (b[x] == b[y]) return 1; return b[x] < b[y] ? 1e18 : -1e18; } return (long double... |
/*
* 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 law... |
`timescale 1ns / 1ps
/*
-- Module Name: output_control_unit
-- Description: Unida de control para el bloque de salida de la interfaz
de red. Este bloque se encarga de organizar la salida
de paquetes desde el nodo de procesamiento en direccion
al router de la NoC.
El control de creditos para el contro... |
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; int base = sqrt(n); if (base * base == n) { cout << base << << 1 << endl; return; } n = n - base * base; if (n <= base + 1) { cout << n << << base + 1 << endl; } else cout <<... |
// (C) 2001-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 doc... |
#include <bits/stdc++.h> using namespace std; struct abc { int p, q, idx; }; bool compareTwoStudents(abc a, abc b) { if (a.p != b.p) return a.p < b.p; return (a.q < b.q); } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int i, j, k, m, n, t, u, v, w, p = 0, q, flag = 0... |
#include <bits/stdc++.h> int main() { int n, m; int sum = 0; int a, b; int i = 0; int x[1010] = {0}, y[1010] = {0}; scanf( %d %d , &n, &m); while (m-- > 0) { scanf( %d %d , &a, &b); y[a] = 1; x[b] = 1; } for (i = 2; i <= n - 1; i++) { if (x[i] == 0) sum++; ... |
#include <bits/stdc++.h> using namespace std; const int N = 1000 + 10; char ch[N]; int a[N][N]; int h[N], l[N]; int n, m; int main() { cin >> n >> m; int tot = 0; for (int i = 1; i <= n; i++) { scanf( %s , ch + 1); for (int j = 1; j <= m; j++) { a[i][j] = ch[j] == * ? 1 :... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: fifo_256_134.v
// Megafunction Name(s):
// scfifo
//
// Simulation Library Files(s):
// altera_mf
// ==========================================... |
#include <bits/stdc++.h> using namespace std; int main(int argc, const char* argv[]) { int n; cin >> n; int a[n]; int b[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; } long long mx = 0; for (int i = 0; i < n; i++) { ... |
#include<bits/stdc++.h> using namespace std; #define ll long long template <typename Arg1> //print with endl void pn(Arg1&& arg1) { cout<<arg1<< n ;} template <typename Arg1, typename... Args> void pn(Arg1&& arg1, Args&&... args) { cout<<arg1<< n ; pn(args...); } //print with space template <ty... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo_mixed_widths
// ============================================================
// File Name: playback_fifo.v
// Megafunction Name(s):
// dcfifo_mixed_widths
//
// Simulation Library Files(s):
//
// ========================... |
// Copyright (c) 2015 CERN
// Maciej Suminski <>
//
// 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)
// any late... |
`timescale 1ns / 1ps
//__________________________________________________uart_tx
`define RDY 2'b11
`define LOAD_BIT 2'b01
`define SEND_BIT 2'b00
`define STOP 2'b10
//__________Test Bench
`define BIT_TMR_MAX 10'd869 // test bench <-- 115200 : tb #1738
//`define BIT_TMR_MAX 4'd10417//14'b101000101... |
#include <bits/stdc++.h> using namespace std; string s; vector<int> v; set<double> S; set<double>::iterator it, it2; int main() { int n, k; cin >> n >> k; cin >> s; for (int i = 0; i < s.size(); i++) if (s[i] == 0 ) v.push_back(i + 1); int i = 0, j = 0; for (i = 0; i <= k; i++... |
module serial_rx #(
parameter CLK_PER_BIT = 50,
parameter CTR_SIZE = 6
)(
input clk,
input rst,
input rx,
output [7:0] data,
output new_data
);
localparam STATE_SIZE = 2;
localparam IDLE = 2'd0,
WAIT_HALF = 2'd1,
WAIT_FULL = 2'd2,
WAIT_HIGH = 2'd3;
reg [CTR_SIZE-1:0] ctr_d, ctr_q;
reg [... |
`timescale 1ns / 1ps
module clock_tb();
parameter DELAY = 10;
parameter TIME = 1000;
reg clk_src, power, enable, reset;
reg [2:0] add_time, sub_time;
reg timing_clock_switch;
wire alarm, timing_clock_alarm;
wire [7:0] anodes, cnodes;
clock #(32, 0, 5, 4, 3, 5, 5) DUT (
.c... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = long unsigned long; using ld = double long; template <class T, int N, int B> struct asym_ra { T a[N + 1]; T b[N / B + 2]; T get(int r) { if (r <= 0) return T(); if (r > N) r = N; return a[r] + b[r /... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
module testbench ();
reg clk = 0;
reg rst = 1;
reg req3 = 0;
reg req2 = 0;
reg req1 = 0;
reg req0 = 0;
wire gnt3;
wire gnt2;
wire gnt1;
wire gnt0;
// Clock generator
always #1 clk = ~clk;
int... |
// (C) 1992-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 simulati... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; vector<string> a; vector<string> ra; cin >> n >> m; for (int i = 0; i < n; ++i) { string s; cin >> s; a.push_back(s); reverse(s.begin(), s.end()); ra.push_back(s); } vector<int> selected; ... |
#include <bits/stdc++.h> using namespace std; int main() { int a[200010], s[200010], b[200010]; int n; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; s[a[i]] = i; } int j = 0; for (int i = 1; i <= n; i++) { cin >> b[i]; int ans = s[b[i]] - j; if (ans ... |
#include <bits/stdc++.h> using namespace std; int main() { vector<int> v[1001]; int n, k, r; while (scanf( %d , &n) != EOF) { for (int i = 1; i <= n; i++) { v[i].clear(); scanf( %d , &k); while (k--) { scanf( %d , &r); v[i].push_back(r); } ... |
/*
** -----------------------------------------------------------------------------**
** macros353.v
**
** I/O pads related circuitry
**
** Copyright (C) 2002 Elphel, Inc
**
** -----------------------------------------------------------------------------**
** This file is part of X353
** X353 is free software - hardw... |
#include <bits/stdc++.h> using namespace std; int main() { int x1, y1, x2, y2, x3, y3, x4, y4; cin >> x1 >> y1 >> x2 >> y2; int x_diff = x1 - x2; int y_diff = y1 - y2; if (x_diff != 0 and y_diff != 0) { x3 = x1; y3 = y2; x4 = x2; y4 = y1; } else if (x_diff != 0) { ... |
#include <bits/stdc++.h> using namespace std; bool nextper(int num[], int n) { int i; for (i = n - 1; i > 0; i--) { if (num[i] > num[i - 1]) { for (int j = n - 1; j >= i; j--) { if (num[j] > num[i - 1]) { int t = num[j]; num[j] = num[i - 1]; num[i ... |
#include <bits/stdc++.h> using namespace std; const int nax = 5005; const int mod = 1e9 + 7; const int inf = 1e9 + 120; int t[nax]; char sl[nax]; int pref[nax][nax]; int nxt[nax][nax]; int cmp(int i, int j) { if (t[i] < t[j]) return -1; if (t[i] > t[j]) return 1; return 0; } int dp(int... |
/**
* 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) 2000-2012 Bluespec, Inc.
// 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, pub... |
#include <bits/stdc++.h> using namespace std; long long n, p[200005]; int pn; int main() { scanf( %I64d , &n); n *= 2; for (int k = 0; k < 60; ++k) { long long a = (1LL << (k + 1)) - 3; long long l = 0, r = 2000000000; if (a > 1) r = min(r, n / a + 1); while (r - l > 1) { ... |
# include <algorithm> # include <iostream> # include <numeric> # include <vector> # include <set> using namespace std; int main() { int n, a, b; while (cin >> n >> a >> b) { string s; cin >> s; set<char> chars_set; for (char c : s) { chars_set.insert(c); }... |
// Accellera Standard V2.5 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2010. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_even_parity (clock, reset, enable, test_expr, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter width = 1;
parameter property... |
/*
- This is a material implementd for google summer of code 2017.
- I built this module to be more familiar with the design required, start edit, re-implement the whole thing
- The mentor feedback would really help me getting more and more clear vision about this project
-----------------------------------------------... |
#include <bits/stdc++.h> using namespace std; int main() { int a[16] = {15, 14, 12, 13, 8, 9, 10, 11, 0, 1, 2, 3, 4, 5, 6, 7}; int n; cin >> n; cout << a[n]; return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, k, a[10000]; cin >> n; cin >> m; string s[1000], f[1000]; for (int i = 0; i < n; i++) { cin >> s[i]; } for (int i = 0; i < m; i++) { cin >> f[i]; } cin >> k; for (int i = 0; i < k; i++) { c... |
Require Export Iron.Language.SimpleData.SubstExpExp.
Require Export Iron.Language.SimpleData.Step.
Require Export Iron.Language.SimpleData.Exp.
Require Import Iron.Language.SimpleData.Preservation.
Require Import Iron.Language.SimpleData.TyJudge.
(* Big Step Evaluation
This is also called 'Natural Semantics'.
... |
#include <bits/stdc++.h> using namespace std; const int Maxn = 40005; int n, m, c, s, t, ct, cnt, ans, b[Maxn], dis[Maxn], head[Maxn], cur[Maxn], a[205][205], id[205][205]; long long tot; bool vis[Maxn]; struct edg { int nxt, to, w; } edge[10 * Maxn]; void add(int x, int y, int w) { edge[+... |
// 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 : Tue Jun 06 02:47:14 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; const int M = 1000000007; const int N = 100003; int ld[N]; int a[N]; void sieve() { for (int i = 2; i * i < N; ++i) if (ld[i] == 0) for (int j = i * i; j < N; j += i) if (ld[j] == 0) ld[j] = i; for (int i = 2; i < N; ++i) if... |
/*
* 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 License, or (at your option)
* ... |
#include <bits/stdc++.h> using namespace std; inline void out(int a) { printf( %d n , a); } inline void out(int a, int b) { printf( %d %d n , a, b); } inline void outf(double a) { printf( %3.lf n , a); } inline void outf(double a, double b) { printf( %3.lf %3.lf n , a, b); } inline void base() { ios_bas... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; if (m - 1 >= n - m) m - 1 == 0 ? cout << m << endl : cout << m - 1 << endl; else cout << m + 1; 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; ifstream fin( A.in ); ofstream fout( A.out ); int n, m, i, j, a, b, y, minv = 1000000000, t = 0, ok, nr; char cor[256], s[1001][1001]; int wh[1001][1001]; int viz[1001 * 1001], pred[1001 * 1001], best[1001 * 1001], good[1001 * 1001], st[1001 * 1001]; q... |
// 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 : Fri Oct 27 00:02:34 2017
// Host : Juice-Laptop running 64-bit major relea... |
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000; const long long mod = 998244353; inline long long add(long long v1, long long v2) { v1 += v2; if (v1 >= mod) v1 -= mod; if (v1 < 0) v1 += mod; return v1; } inline long long mul(long long v1, long long v2) { return v1 *... |
#include <bits/stdc++.h> using namespace std; int main() { int N, M; char eat; cin >> N >> M; scanf( %c , &eat); char temp[5000]; vector<vector<bool>> grid(N, vector<bool>(M)); for (int r = 0; r < N; r++) { scanf( %s , temp); for (int c = 0; c < M; c++) grid[r][c] = (temp[c] ... |
// hub_mem
/*
-------------------------------------------------------------------------------
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 Ge... |
#include <bits/stdc++.h> using namespace std; int main() { vector<int> a(26), a2(26), a3(26); string s1, s2, s3; char ss1[100001], ss2[100001], ss3[100001]; scanf( %s%s%s , ss1, ss2, ss3); s1 = ss1; s2 = ss2; s3 = ss3; for (int i = 0; i < s1.size(); i++) a[s1[i] - a ]++; for (in... |
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995-2013 Xilinx, Inc. All rights reserved.
////////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor: Xilinx
// \ \ \/ Version: P.20... |
#include <bits/stdc++.h> //--------------------------------------------------- #define l_int long long int #define double long double #define inf INT64_MAX #define mod 100000 #define fo(i,a,b) for(l_... |
`timescale 1 ns / 1 ps
module elink2_tb;
reg aclk;
reg aresetn;
reg start;
wire csysreq = 1'b0;
wire reset = ~aresetn;
wire [11:0] param_coreid = 12'h810;
wire [2:0] done;
wire [2:0] error;
// Create an instance of the example tb
elink_testbench dut
(.aclk (ac... |
/**
* 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... |
// RS-232 RX module
// (c) fpga4fun.com KNJN LLC - 2003, 2004, 2005, 2006
module async_receiver(clk, RxD, RxD_data_ready, RxD_data, RxD_endofpacket, RxD_idle);
input clk, RxD;
output RxD_data_ready; // onc clock pulse when RxD_data is valid
output [7:0] RxD_data;
parameter ClkFrequency = 50000000; // 50MHz
... |
#include <bits/stdc++.h> using namespace std; struct piece { int x, y; char p[20][20]; piece(int _x, int _y) : x(_x), y(_y) {} bool operator<(const piece& rhs) const { if ((x * y) != (rhs.x * rhs.y)) return (x * y) < (rhs.x * rhs.y); else return x < rhs.x; } }; st... |
//--------------------------------------------------------------------------------
//
// timer.v
// Copyright (C) 2011 Ian Davis
//
// 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; eit... |
/**
* 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.