text stringlengths 59 71.4k |
|---|
(** * Extraction: Extracting ML from Coq *)
(* ################################################################# *)
(** * Basic Extraction *)
(** In its simplest form, extracting an efficient program from one
written in Coq is completely straightforward.
First we say what language we want to extract into. ... |
// Copyright 1986-2018 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2018.2 (win64) Build Thu Jun 14 20:03:12 MDT 2018
// Date : Tue Sep 17 19:44:45 2019
// Host : varun-laptop running 64-bit Service Pac... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2000 + 20; int a[maxn]; int main() { int n, k; cin >> n >> k; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); int ans = 0; for (int i = n - 1; i >= 0; i -= k) { ans += 2 * (a[i] - 1); } co... |
// Permuter Block
`include "globalVariable.v"
module permuterBlock (inFlit0, inFlit1, stage, position, portStatus, outFlit0, outFlit1);
input stage, position;
input [4*`PORT_STAT_SIZE-1:0] portStatus;
input [`IN_ROUTER_SIZE-1:0] inFlit0,inFlit1;
output [`IN_ROUTER_SIZE-1:0] outFlit0, outFlit1;
wire wi... |
//
// Copyright 2011 Ettus Research LLC
//
// 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) any later version.
//
// This program is dis... |
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-5; const int MOD = int(1e9) + 7, MX = int(5e4) + 1; long long memo[100][3001][2]; int n, l; pair<int, int> A[101]; long long dp(int i, int len, int f) { if (len == l) return 1; if (i == n || len > l) return 0; long long &ret =... |
// (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; int main() { long long int n, k; cin >> n >> k; if (n == k || k == 0) cout << 0 << << 0; else { long long int min = 1, max; if (2 * k + k < n) max = 2 * k; else max = n - k; cout << min << << max; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long int b, g, n; cin >> b >> g >> n; cout << min(g, n) - max(0LL, n - b) + 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 law... |
`timescale 1ns/10ps
module AluSim;
reg clock;
reg reset;
reg [11:0] inst;
reg inst_en;
wire [7:0] result;
initial begin
#0 $dumpfile(`VCDFILE);
#0 $dumpvars;
#1000 $finish;
end
initial begin
#0 clock = 1;
forever #2 clock = ~clock;
end
... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016
// Date : Wed Sep 20 15:37:03 2017
// Host : vldmr-PC running 64-bit Service Pack 1 ... |
#include <bits/stdc++.h> #pragma warning(disable : 4996) using namespace std; const int maxn = 100010; int n, m, k, t, t1, t2, t3, t4; struct node { int x, y; int xd, xx, yd, yx; } a[maxn]; int main() { scanf( %d , &t); while (t--) { scanf( %d , &n); for (int i = 0; i < n; i++)... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; if (n > m) swap(m, n); long long cc = 0; for (int i = 1; i <= n; i++) { cc += (m + i) / 5 - i / 5; } cout << cc << endl; 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; int t; double pi = acos(-1.0); double d, h, v, e; int main() { scanf( %lf%lf%lf%lf , &d, &h, &v, &e); double r = d / 2; if (pi * r * r * e > v) cout << NO << endl; else { double s = (pi * r * r * h) / (v - pi * r * r * e); cout ... |
#include <bits/stdc++.h> using namespace std; long long int visited1[200005], visited2[200005], step1[200005], step2[200005], ar[200005]; long long int n; void fill_array(long long int ar[], long long int value, long long int size) { for (long long int i = 0; i < size; i++) ar[i] = value; } long l... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); string s; cin >> s; int count = 0; while (s.size() != 1) { int sum = 0; for (int i = 0; i < s.size(); i++) sum += s[i] - 48; string res = ; while (sum) { ... |
////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2014, University of British Columbia (UBC); All rights reserved. //
// //
// Redistribution and use in source and binary forms, w... |
#include <bits/stdc++.h> using namespace std; char mat[55][55]; int n; int A[] = {-1, 0, 1, 0}; int B[] = {0, 1, 0, -1}; vector<pair<int, int> > ilha1, ilha2; void flood_fill(int i, int j, bool prima) { if (i < 0 or j < 0 or i >= n or j >= n or mat[i][j] != 0 ) return; mat[i][j] = 1 ; if (pr... |
`timescale 1ns / 1ps
module vga640x480(
input wire clk50,
input wire pclk, //pixel clock: 25MHz
input wire clr, //asynchronous reset
output wire hsync, //horizontal sync out
output wire vsync, //vertical sync out
output wire vblank,
output reg [12:0] front_vram_addr,
inout wire [7:0] front_vr... |
#include <bits/stdc++.h> using namespace std; int v[100010]; int j[100010]; string ss; bool haha; int m; void jump(int n) { if (n < 0 || n >= m) { haha = true; return; } else if (j[n] == 1) { haha = false; return; } else { int p; if (ss[n] == < ) p ... |
#include <bits/stdc++.h> using namespace std; long long n, l, v1, v2, k; long double dn, dl, dv1, dv2, dk; long long times; long double x; double T; int main() { scanf( %lld%lld%lld%lld%lld , &n, &l, &v1, &v2, &k); dn = n; dl = l; dv1 = v1; dv2 = v2; dk = k; times = (n - 1) / k... |
#include <bits/stdc++.h> using namespace std; bool cmp(pair<int, int> a, pair<int, int> b) { return abs(a.first) + abs(a.second) < abs(b.first) + abs(b.second); } int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<pair<int, int>> q1; vector<pair<int, i... |
#include <bits/stdc++.h> using namespace std; const int inf = 1000000000; const int maxn = 100010; int a[maxn]; int max(int a, int b) { return a > b ? a : b; } int min(int a, int b) { return a > b ? b : a; } int main() { int n, l, r, i, j; string s; while (cin >> n) { for (i = 0; i < n; ... |
/* This file is part of JT12.
JT12 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) any later version.
JT12 program is distribu... |
/**
* 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 main() { int n; scanf( %d , &n); int people_in_queue[n]; for (int i = 0; i < n; i++) { scanf( %d , &people_in_queue[i]); } int num_of_product[n][100], sum[n]; for (int i = 0; i < n; i++) { sum[i] = 0; for (int j = 0; j < people_in_queue[i]; j... |
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); long long int a[n + 2]; for (int i = 1; i <= n; i++) { scanf( %lld , &a[i]); } long long int mx = 1; for (int i = 1; i <= n; i++) { for (int j = 1; j <= n; j++) { if (i != j) { ... |
#include <bits/stdc++.h> using namespace std; struct Point { double x, y; }; struct Line { double A, B, C; }; Line Build(Point A, Point B) { Line res; res.A = A.y - B.y; res.B = B.x - A.x; res.C = A.x * B.y - B.x * A.y; return res; } Line Per(Line l, Point A) { Line res; ... |
//*****************************************************************************
// (c) Copyright 2009 - 2011 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
/... |
#include <bits/stdc++.h> using namespace std; int a[102][102][102] = {}; int main() { string s; int n, m, k; cin >> n >> m >> k; for (int i = 1; i < n + 1; ++i) { for (int j = 1; j < m + 1; ++j) { cin >> s; for (int t = 1; t < k + 1; ++t) a[i][j][t] = s[t - 1] - 0 ; } ... |
/*
Copyright (C) {2014} {Shawn Jain} <>
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) any later version.
This program is distributed in the ho... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); long long s, x; cin >> s >> x; bool flag = true; bool valid = true; if ((s & 1) != (x & 1)) valid = false; long long ans = 1; for (int i = 62; i >= 1; i--) { long long sb = (s >> i) & 1; ... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long t; cin >> t; while (t--) { long long n, a, b; cin >> n >> a >> b; long long dp[4][n + 1]; string s; cin >> s; vector<long long> ... |
/*===========================================================================*/
/* Copyright (C) 2001 Authors */
/* */
/* This source file may be used and distributed without restriction provided */
... |
#include <bits/stdc++.h> using namespace std; int n, m, k, l[100100], c[100100]; vector<int> g[100100]; vector<int> s; void dfs(int t) { s.push_back(t); l[t] = s.size(); for (auto v : g[t]) { if (!l[v]) dfs(v); else { if (l[t] - l[v] + 1 >= k) { printf( 2 n%d ... |
/******************************************************************************
* File Name : counter.v
* Package Module Name : Elliptic Curve Cryptoprocessor for GF(2^233)
* Author : Chester Rebeiro
* Date of Creation : 3/Apr/2008
* Type of file : Verilog source code
* Synopsis : counts down fro... |
/*
* 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)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 associate... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0, f = 1; char c = getchar(); while ((c < 0 || c > 9 ) && (c != - )) c = getchar(); if (c == - ) f = -1, c = getchar(); while (c >= 0 && c <= 9 ) x = x * 10 + c - 0 , c = getchar(); return x * f; ... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( sse4 ) using namespace std; const long long INF = 1e18; const long long MOD = 1e9 + 7; const long long N = 2e6 + 10; const long long dx[8] = {1, 0, -1, 0, 1, 1, -1, -1}, dy[8] = {0, 1, 0, -1, -1, 1, -1, 1}; bool TC... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) { long long int n; cin >> n; if (n % 2 == 0) cout << n / 2 << << n / 2 << n ; else { long long int x = -1; ... |
#include <bits/stdc++.h> using namespace std; const int N = 15e4 + 10; long long a[N]; bool vis[N]; int main() { int n; scanf( %d , &n); set<pair<long long, int> > se; for (int i = 0; i < n; i++) { scanf( %lld , a + i); se.insert(pair<long long, int>(a[i], i)); } int sz = n... |
#include <bits/stdc++.h> using std::cin; using std::cout; using std::endl; using std::string; using std::vector; int zfn[100010]; int count = 0, nodes_count; string P, T; vector<string> str; vector<vector<int> > connections; void kmpPreprocess() { int i = 0, j = -1; zfn[0] = -1; while ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; double a, b, jav = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b; jav += b; } jav /= n; cout << jav + 5; } |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017
// Date : Sat Sep 23 13:26:00 2017
// Host : DarkCube running 64-bit major release ... |
/* or1200_top_wrapper.b */
// only removes all un-needed signals
module or1200_top_wrapper #(
parameter AW = 24
)(
// system
input wire clk,
input wire rst,
// data bus
output wire dcpu_cs,
output wire dcpu_we,
output wire [ 4-1:0] dcpu_sel,
output wire [ 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 law... |
// File: mm_sop2.v
// Generated by MyHDL 0.9dev
// Date: Fri Mar 28 22:21:18 2014
`timescale 1ns/10ps
module mm_sop2 (
clock,
reset,
x,
y
);
input clock;
input reset;
input signed [15:0] x;
output signed [15:0] y;
reg signed [15:0] y;
wire signed [34:0] wwire;
wire signed [30:0] cgens_g_11_y;
wire... |
/**
* 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 sq(long long x) { return x * x; } long double ptos(pair<long long, long long> A, pair<long long, long long> B, pair<long long, long long> C) { long long area = abs((B.first - A.first) * (C.second - A.second) - ... |
#include <bits/stdc++.h> using namespace std; using ll = long long int; using ull = unsigned long long int; using dd = double; using ldd = long double; int main() { ios_base::sync_with_stdio(0); cin.tie(0); ll n, r; cin >> n >> r; vector<ll> arr((ll(1)) << n); ll sum = 0; n = ((l... |
#include <bits/stdc++.h> using namespace std; int prim[10] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29}; int n; long long ans; void DFS(int a, int b, long long temp) { if (temp < ans && a == n) ans = temp; if (a >= n) return; for (int i = 1; i <= 64; i++) { if (ans / prim[b] < temp) break; t... |
/**
* This module first zeros out video memory, then accepts
* requests to write to individual pixels.
*
* @author Robert Fotino, 2016
*/
`include "definitions.vh"
`define STATE_CLEAR_SCREEN_WRITE 0
`define STATE_CLEAR_SCREEN_CMD 1
`define STATE_PIXEL_WRITE 2
`define STATE_PIXEL_CMD 3
module p... |
#include <bits/stdc++.h> using namespace std; inline long long read() { char ch = getchar(); long long nega = 1; while (!isdigit(ch)) { if (ch == - ) nega = -1; ch = getchar(); } long long ans = 0; while (isdigit(ch)) { ans = ans * 10 + ch - 48; ch = getchar(); }... |
#include <bits/stdc++.h> using namespace std; const int N = 100 + 2; const int MOD = 1 << 30; const double pi = acos(-1); struct line { double a, b, c; }; struct point { double x, y; }; void pointsToLine(point p1, point p2, line &l) { if (fabs(p1.x - p2.x) < 1e-2) { l.a = 1.0; ... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:64000000 ) using namespace std; int n, b[110], l, r, c, t, q[110], m; int main() { cin >> m >> n; for (int i = 1; i <= m; i++) b[i] = 1 << 30; for (int i = 0; i < n; i++) { cin >> l >> r >> t >> c; for (int j = l; j <= r; j++) { ... |
#include <bits/stdc++.h> const int MOD = 1e9 + 7; int primes[100000]; using namespace std; bool cmp(const pair<int, int>& a, const pair<int, int>& b) { return a.first > b.first; } int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); int n, k; cin >> n >> k; int a[n]; f... |
/**
* 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 MAX_N = 2e5; vector<int> gr[MAX_N]; int indx(int h, int t) { return h * 450 + t; } int win = 1e9; int lose = 0; bool draw = false; int used[MAX_N] = {0}; void bfs(int st_indx) { queue<pair<int, int>> q; q.push({0, st_indx}); used[st_i... |
#include <bits/stdc++.h> using namespace std; const int maxN(1e5 + 10); typedef int i_N[maxN]; int N, Gx[maxN][2], Fx[maxN][2][2]; i_N A; string S; int main() { scanf( %d n , &N); getline(cin, S); for (int i = 0; i < (int)S.size(); i++) A[i + 1] = S[i] == 1 ; A[0] = A[N + 1] = -1; for... |
#include <bits/stdc++.h> using namespace std; int main() { long long int i, j, k, n, m, ans = 0; cin >> n >> m >> k; ans = n + m + k; cout << min(ans / 3, ans - max(n, max(m, k))); } |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; long long n; pair<long long, long long> loc[2001]; long long cp[2001]; long long cw[2001]; pair<long long, pair<long long, long long> > road[4000001]; long long ct = 0; long long val[2001]; long long ans = 0; long long ansleft; long long ansr = 0; bo... |
// megafunction wizard: %LPM_RAM_DQ%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: lpm_ram_dq1.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =========================... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; int n; vector<pair<int, int> > v[maxn]; int size[maxn]; long long mi, mx; void dfs(int first, int fa) { size[first] = 1; for (pair<int, int> i : v[first]) { if (i.first == fa) continue; dfs(i.first, first); ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> #pragma GCC optimize(2) using namespace std; const int INF = 1e9 + 7; const int N = 4e5 + 7; const int M = 5e6 + 7; int vis[M]; int p[N]; int qt[N]; signed main() { ios::sync_with_stdio(false); int q, x, y; cin >> q >> x; set<pair<int, int>> vals; for (int ... |
#include <bits/stdc++.h> using namespace std; long long ans; int n, l, w, x, pn; vector<int> pos, neg; int cal(long long a, int b) { if (b == 0) return (a > 0 ? INT_MAX : -INT_MAX); if (a < 0) { if (a % b != 0) return (a / b - 1); } return a / b; } int main() { ios::sync_with_std... |
/*
* Copyright (c) 2012, Stefan Kristiansson <>
* All rights reserved.
*
* Based on vga_fifo_dc.v in Richard Herveille's VGA/LCD core
* Copyright (C) 2001 Richard Herveille <>
*
* Redistribution and use in source and non-source forms, with or without
* modification, are permitted provided that the following con... |
//------------------------------------------------------------------------------
// File : axi_pipe.v
// Author : Xilinx Inc.
// -----------------------------------------------------------------------------
// (c) Copyright 2010 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and propr... |
#include <bits/stdc++.h> using namespace std; long long int n; const long long int mod = 1000000007; long long int f(long long int x, long long int k) { long long int res = 1; while (k) { if (k & 1) res = res * x % mod; x = x * x % mod; k >>= 1; } return res; } int main() {... |
/**
* 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... |
`default_nettype none
module j1(
input wire clk,
input wire resetq,
output wire io_rd,
output wire io_wr,
output wire [15:0] mem_addr,
output wire mem_wr,
output wire [15:0] dout,
input wire [15:0] io_din,
output wire [12:0] code_addr,
input wire [15:0] insn_from_memory,
input wire interrup... |
#include <bits/stdc++.h> #pragma GCC optimize(3) #pragma GCC optimize(2) #pragma GCC optimize( Ofast ) using namespace std; vector<int> g[2097312]; int a[2097312][2]; char st[2097312]; int f[2097312]; int find(int x) { if (f[x] == x) return x; return f[x] = find(f[x]); } int main() { i... |
#include <bits/stdc++.h> int main() { int t; scanf( %d , &t); int a[t], b[t], c[t]; for (int i = 0; i < t; i++) scanf( %d %d %d , &a[i], &b[i], &c[i]); for (int i = 0; i < t; i++) { if (a[i] == b[i] && b[i] == c[i]) { printf( YES n ); printf( %d %d %d n , a[i], a[i], a[i]); ... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; const double EPS = 1e-9; int n, a[100015]; int main() { scanf( %d , &n); if (n % 4) { printf( ! -1 n ); fflush(stdout); } else { printf( ? %d n , 1... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; int main() { int T, t1 = 0, t2, maxn = 0, flag = 1, sum = 0, sum1 = 0; scanf( %d , &T); while (T--) { scanf( %d , &t2); if (flag && t2 == 0) { maxn = max(maxn, sum); sum1 = sum; sum = 0; ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1005; const int mod1 = 998244353; const int mod2 = 1e9 + 7; const int b1 = 337; const int b2 = 421; const int inf = 2147483647; struct Pair { int x[2] = {}; bool operator<(const Pair a) const { return x[0] < a.x[0] || x[0] == a... |
#include <bits/stdc++.h> using namespace std; int ans[100005], t, n, d; signed main() { cin >> t; while (t--) { scanf( %d , &n); int sum = ans[0] = 1; for (int i = 1; i <= n; ++i) { if (sum + (1 << (i + 1)) > n) { d = i; break; } sum += (1 << i... |
//-----------------------------------------------------
// This is FSM demo program using function
// Design Name : fsm_using_function
// File Name : fsm_using_function.v
//-----------------------------------------------------
module fsm_using_function (
clock , // clock
reset , // Active high, syn reset
re... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:38:47 03/02/2016
// Design Name:
// Module Name: Ctr
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencie... |
`timescale 1ns / 1ps
//-----------------------------------------------
// Company: agh
// Engineer: komorkiewicz
// Create Date: 11:41:13 05/10/2011
// Description: log image to ppm file
//-----------------------------------------------
module hdmi_out
(
input hdmi_clk,
input hdmi_vs,
input hdmi_de,
input [... |
#include <bits/stdc++.h> using namespace std; const int kMod = 10007; char buf[222]; int m, n, l; int dp[222][222][222]; int f[222]; int s; struct Matrix { int v[444][444]; void clear() { memset(v, 0, sizeof(v)); } } I, A, F; Matrix operator*(const Matrix &a, const Matrix &b) { Matrix c;... |
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; const int N = 3005; int n, c, a[N], dp[N][N], g[N][N], freq[N], mul[N], imul[N], pw[N], cnt[N]; int dp2[2][N][1 << 12]; int inverse(int n) { if (n == 1) return 1; return inverse(mod % n) * 1LL * (mod - mod / n) % mod; } inl... |
// -*- verilog -*-
// Copyright (c) 2012 Ben Reynwar
// Released under MIT License (see LICENSE.txt)
// A single FFT stage.
// We fill it with values and then empty it.
// This is for QA purposes.
module qa_contents
#(
parameter WIDTH = 32,
parameter MWIDTH = 1
)
(
input wire c... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, s, f, add = 0, rund = 1; cin >> n >> m >> s >> f; if (s < f) add = 1; else add = -1; for (int i = 0; i < m; i++) { int t, l, r; cin >> t >> l >> r; while (rund < t) { if (s == f) break; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int a[n]; for (int i = 0; i < n; i++) a[i] = i + 1; int cnt = (n / 2) * (n / 2); if (n % 2 == 0) cnt -= n / 2; if (cnt < m) { cout << -1; return 0; } int idx = n - 1; while (m < cn... |
#include <bits/stdc++.h> using namespace std; vector<int> gr[300005]; int n, m; int col[300005]; void go(int now) { for (auto to : gr[now]) { if (col[to]) continue; col[to] = 3 - col[now]; go(to); } int cnt = 0; for (auto to : gr[now]) { cnt += (col[to] == col[now]); ... |
#include <bits/stdc++.h> #define Mid ((l + r) >> 1) #define lson (rt << 1) #define rson (rt << 1 | 1) using namespace std; int read(){ char c; int num, f = 1; while(c = getchar(),!isdigit(c)) if(c == - ) f = -1; num = c - 0 ; while(c = getchar(), isdigit(c)) num = num * 10 + c - 0 ; return f * ... |
/**
* 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 n, m, k; std::unordered_set<int> G[100123]; int deg[100123]; inline bool CheckClique(int x) { std::vector<int> V({x}); for (int y : G[x]) V.emplace_back(y); for (int u : V) for (int v : V) if (u < v && (!G[u].count(v))) return false; return true; } ... |
#include <bits/stdc++.h> using namespace std; long long a[200000 + 1]; int main() { long long t; cin >> t; while (t--) { long long n, k; cin >> n >> k; for (int i = 1; i <= n; i++) scanf( %lld , &a[i]); sort(a + 1, a + n + 1); long long mpos = 0, ppos = 0; for (int ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma,tune=native ) using namespace std; int a1, b1, c1, a2, b2, c2; int d1, d2, d3, d4, d5, d6, d7; int f1, f2, f3, f4, f5, f6, f7; bool check() { return f1 <= d1 && f2 <=... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int x; cin >> x; if (x % 4 == 0) printf( 1 A ); else if (x % 4 == 1) printf( 0 A ); else if (x % 4 == 2) printf( 1 B ); else if (x % 4 == 3) p... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 2e3; vector<int> e[MAX_N], d; vector<char> flag; void dfs(int v) { if (d[v] != -1) return; d[v] = 1; for (int to : e[v]) { dfs(to); d[v] = max(d[v], d[to] + 1); } } int main() { int n; scanf( %d , &n); ... |
#include <bits/stdc++.h> using namespace std; long long int i, j, p, d, n, m, total, k, ok, a, b, c, op, maxi, rasp, m1, m2, p1, p2, rez, modu = 1000000007, mini, mij, ls, ld; pair<long long int, long long int> v[300500]; priority_queue<pair<long long int, long long int> > nxt; priority_queue<long long ... |
#include <bits/stdc++.h> using namespace std; int customer[1000][1000]; int main() { int n, m, k; cin >> n >> m >> k; deque<int> dq; for (int i = 0; i < k; i++) { int x; cin >> x; dq.push_back(x); } for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) cin >> cu... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_ba
//
// Generated
// by: wig
// on: Mon Oct 24 15:17:36 2005
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../verilog.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.