text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; struct comp { double x, y; } a[65600], b[65600], c[65600], fft[65600], tp[17][65600]; double pi = acos(-1.0); comp operator+(comp a, comp b) { return (comp){a.x + b.x, a.y + b.y}; } comp operator-(comp a, comp b) { return (comp){a.x - b.x, a.y - b.y}; } co... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int INF = 2e9; const long long INFLL = 1e18; const int MAX_N = 20; int N, M, Q; string str1[MAX_N + 1], str2[MAX_N + 1]; int main() { scanf( %d%d , &N, &M); for (int i = 0; i < N; i++) { cin >> str1[i]; } ... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: pcx2mb_entry.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it and/... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); int n; cin >> n; vector<char> c(n); vector<int> id(n); map<int, bool> state, exist; for (int i = 0; i < n; i++) cin >> c[i] >> id[i]; for (int i = 0; i < n; i++) { if (c[... |
/* A alu module*/
module ALU(inputA, inputB, ALUop, result, zero);
input [31:0] inputA, inputB;
input [2:0] ALUop;
output [31:0] result;
reg [31:0] result;
output zero;
reg zero;
/*whenever input or ALUop changes*/
always @(inputA or inputB or ALUop)
begin
/*it supports AND, OR, ADD, SLT with a zero output*/
case... |
//--------------------------------------------------------------------------------
// Project : SWITCH
// File : rx_engine.v
// Version : 0.1
// Author : Vipin.K
//
// Description: 64 bit PCIe transaction layer receive unit
//
//---------------------------------------------------------------------------... |
// (C) 2001-2017 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated docum... |
/**
* 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 N = 300000 + 10; const int mod = 1e9 + 7; int n, q; char s[N]; long long sum[N]; long long pw[N], fibo[N], pw2[N], pw3[N]; int main() { scanf( %d%d , &n, &q); scanf( %s , s + 1); for (int i = 1; i <= n; ++i) { sum[i] = sum[i - 1] ... |
#include <bits/stdc++.h> using namespace std; int Ask(string s) { cout << s << n ; cout.flush(); int diff; cin >> diff; if (diff == 0) exit(0); return diff; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); if (fopen( input.txt , r )) { freopen( in... |
/**
* 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 a[100005]; int prime[100005 + 5000]; int a2[10005]; map<int, int> M; int f[100005]; int Gcd[50005]; int sum[50005]; int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } int main() { int i, j, k = 0; for (i = 2; i <=... |
// 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 10:20:39 2017
// Host : Juice-Laptop running 64-bit major release ... |
/*
* 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 a[100005]; int main(void) { int n, x, k; scanf( %d %d %d , &n, &x, &k); for (int i = 0; i < n; i++) { scanf( %d , a + i); } sort(a, a + n); long long sum = 0; for (int i = 0; i < n; i++) { long long p = (long long)ceil(a[i] ... |
// timeServer.v - GPS Disciplined Time Server
// Copyright (c) 2012 Atomic Rules LLC - ALL RIGHTS RESERVED
// The MIT License (MIT)
//
// 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 withou... |
/*
* 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; template <typename T1, typename T2> istream &operator>>(istream &in, pair<T1, T2> &a) { in >> a.first >> a.second; return in; } template <typename T1, typename T2> ostream &operator<<(ostream &out, pair<T1, T2> a) { out << a.first << << a.second;... |
#include <bits/stdc++.h> using namespace std; int n; int v[5], p[5]; int cnt[5], add[5]; int getMaxScr(int acc, int tot) { int MaxScr; for (int i = 0; i < 6; i++) { int t = 1 << i; if (tot >= t * acc) MaxScr = (i + 1) * 500; } return MaxScr; } bool ok(int m) { int vScr = 0,... |
// 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 Feb 13 12:44:30 2017
// Host : WK117 running 64-bit major release (build ... |
#include <bits/stdc++.h> using namespace std; void ifree() { freopen( in , r , stdin); } void ofree() { freopen( out , w , stdout); } double min(double a, double b) { return a < b ? a : b; } int main() { int n, w; while (cin >> n >> w) { int arr[2 * n]; for (int i = 0; i < 2 * n; i++) ci... |
/*
* In this example, the set and clr are both synchronous. This checks
* that this complex case is handled correctly.
*/
module main;
reg Q, clk, rst, set, clr;
(* ivl_synthesis_on *)
always@(posedge clk or posedge rst)
begin
if (rst)
Q <= 1'b0;
else if (set)
Q <= 1'b1;
else if (clr)
... |
module spmc_timestamp_gen #(
parameter SOURCES = 2, //number of timestamp capture sources
parameter PIN_SOURCES = 2, //number of timestamp capture pin sources
parameter INVERTED_SOURCES_MASK = 0, //mask if sources to invert (so trigger on a negative edge instead of a p... |
//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; int n; long long A, B; struct node { long long vx, vy, w; } p[400005]; bool cmp(const node p1, const node p2) { if (p1.w == p2.w) return p1.vx < p2.vx; return p1.w < p2.w; } int main() { scanf( %d%I64d%I64d , &n, &A, &B); int i, j; lo... |
#include <bits/stdc++.h> int main() { int n; scanf( %d , &n); int i = sqrt(n); for (int i = 0; i <= 10; i++) { if (pow(2, i) == n) { printf( YES ); return 0; } } printf( NO ); 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; int32_t main() { ios_base::sync_with_stdio(0); long long n; cin >> n; vector<long long> a; for (long long i = 0; i < n; ++i) { long long x; cin >> x; a.push_back(x); } sort(a.begin(), a.end()); long long c = 0; for (... |
// -- (c) Copyright 2010 - 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
// -- laws.
// --
// -- DISCLAIMER
// -- This disclaimer is not a... |
#include <bits/stdc++.h> using namespace std; int read() { int x = 0, f = 0; char ch = getchar(); while (!isdigit(ch)) f |= ch == - , ch = getchar(); while (isdigit(ch)) x = 10 * x + ch - 0 , ch = getchar(); return f ? -x : x; } template <typename T> void print(T x) { if (x < 0) putc... |
`timescale 1ns/10ps
//`include "spdu.v"
module spdutb;
reg in0, in1, in2, in3, d0, d1, d2, d3;
reg clk, reset;
wire out0, out1, out2, out3;
spdu spdu1(in0, in1, in2, in3, d0, d1, d2, d3,
out0, out1, out2, out3, clk, reset);
initial
begin
d0=1'b0; d1=1'b1; d2=1'... |
/*===========================================================================*/
/* Copyright (C) 2001 Authors */
/* */
/* This source file may be used and distributed without restriction provided */
... |
// Module m_paper implements all features of the 4-bit paper processor.
module m_paper;
reg r_low = 1'b0; // logic low register
reg r_high = 1'b1; // logic high register
reg r_clock = 1'b0; // clock pulse register
reg r_reset = 1'b1; // reset value register
wire w_low,... |
`timescale 1ns / 1ps
`include "Defintions.v"
`define LOOP1 8'd8
`define LOOP2 8'd5
module ROM
(
input wire[15:0] iAddress,
output reg [27:0] oInstruction
);
always @ ( iAddress )
begin
case (iAddress)
/*
0: oInstruction = { `NOP ,24'd4000 };
1: oInstruction = { `STO , `R7,16'b0001 };
2: oInstruction = ... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n, k; cin >> n >> k; string ans = ; for (long long i = 0; i < n; i++) { ans.push_back( a ); } for (long long i = n - 2; i >= 0; i--) { if (k <= n - i - 1) { ans[i] = b ; ans[n - k] = b ; ... |
#include<bits/stdc++.h> using namespace std; #define N 2005 int read(){ int w=0,f=1; char c= ; while(c< 0 ||c> 9 )f=(c== - ?-f:f),c=getchar(); while(c>= 0 &&c<= 9 )w=w*10+c- 0 ,c=getchar(); return w*f; } int T,n,ans[N],cnt; bool vis[N]; bool check(int x){ printf( ? %d %d n ,x,1); fo... |
module loopback (
vjtag_byteenable,
vjtag_writedata,
vjtag_address,
sdram_readdatavalid,
sdram_waitrequest,
sdram_readdata,
vjtag_write,
vjtag_read,
rst,
clk,
leds,
vjtag_readdata,
vjtag_waitrequest,
vjtag_readdatavalid,
sdram_address,
sdram_read,
sdra... |
#include <bits/stdc++.h> using namespace std; int n, a[5005], b[5005], ans[5005], s, q[10005], x[10005]; map<int, int> m; void ask(int x, int y) { printf( ? %d %d n , x, y); fflush(stdout); } int main() { scanf( %d , &n); for (int i = 0; i < n; i++) ask(i, 0), scanf( %d , a + i), x[a[i]] = i... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f, maxn = 200007; const long long MOD = 1004535809; const long long LINF = 0x3f3f3f3f3f3f3f3fLL; const long long P = 19260817; char nc() { static char buf[100000], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread... |
#include <bits/stdc++.h> using namespace std; long long read() { long long x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = x * 10 + ch - 0 ; ch = getchar(); } return x... |
#include <bits/stdc++.h> using namespace std; vector<int> g[300001]; int arr[300001]; int dp[300001]; int maxi = -(int)1e10, max_pos; bool flag = false; void dfs(int beta, int baap) { if (flag) return; if (arr[beta] == maxi) dp[beta] = 0; else dp[beta] = -(int)1e10; for (int i ... |
(* Copyright © 1998-2006
* Henk Barendregt
* Luís Cruz-Filipe
* Herman Geuvers
* Mariusz Giero
* Rik van Ginneken
* Dimitri Hendriks
* Sébastien Hinderer
* Bart Kirkels
* Pierre Letouzey
* Iris Loeb
* Lionel Mamane
* Milad Niqui
* Russell O’Connor
* Randy Pollack
* Nickolay V. Shmyrev
* Bas Spitters
* ... |
#include <bits/stdc++.h> int d[1005][1005][15][2]; char a[1005], b[1005]; int max(int a, int b) { if (a < b) return b; return a; } int main() { int n, m, k, i, j, l; scanf( %d %d %d , &n, &m, &k); for (i = 1; i <= n; i++) scanf( %c , &a[i]); for (i = 1; i <= m; i++) scanf( %c , &b[i]... |
#include <bits/stdc++.h> using namespace std; int n, m; long long pw[19]; long long val[19]; char A[100009]; string s[100009]; int main() { scanf( %s , A); scanf( %d , &m); for (int i = 0; i < 10; i++) { val[i] = i; pw[i] = 10; } for (int i = 0; i < m; i++) cin >> s[i]; ... |
#include <bits/stdc++.h> using namespace std; long long power(int base, long long p) { long long res = 1; while (p) { if (p & 1) { res *= base; --p; } base *= base; p /= 2; } return res; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); ... |
module xyz (/*AUTOARG*/
// Outputs
signal_f, signal_c,
// Inputs
signal_b
);
/*AUTOINPUT*/
// Beginning of automatic inputs (from unused autoinst inputs)
input [2:0] signal_b; // To u_abc of abc.v
// End of automatics
/*AUTOOUTPUT*/
/... |
#include <bits/stdc++.h> using namespace std; int main() { int n, ed[26][26] = {}, pos[26][26] = {}; static char s[200100], t[200100]; scanf( %d%s%s , &n, s, t); int ans = 0; for (int i = 0; i < (n); ++i) { ans += s[i] != t[i]; ed[s[i] - a ][t[i] - a ] += 1; pos[s[i] - a ][t... |
#include <bits/stdc++.h> using namespace std; int n, m; int main() { char ch[106][106]; scanf( %d%d , &n, &m); for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) cin >> ch[i][j]; for (int i = 0; i < n; ++i) for (int j = 0; j < m; ++j) if (ch[i][j] == C || ch[i][j] == M... |
// (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 ... |
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq
*
* 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, version 3 of the License.
*
* This program is distributed ... |
/**
* 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 = 1e9 + 7; int N, M; int dist[200000]; int interval[200000]; int cnt[200000]; int main(void) { cin >> N; for (int i = 0; i < (int)(N); ++i) scanf( %d , dist + i); for (int i = 0; i < (int)(N - 1); ++i) interval[i] = dist[i + 1] - dist... |
#include<bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { int a,b,c; cin>>a>>b>>c; int sum=a+b+c; if(sum<7) cout<< No <<endl; else { if(sum%9==0) { ... |
// file: clk_166M_83M_exdes.v
//
// (c) Copyright 2008 - 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
// laws.
//
// DISCLAIMER
// This disclaimer ... |
///////////////////////////////////////////////////////////////////////////////
// vim:set shiftwidth=3 softtabstop=3 expandtab:
//
// Module: oq_regs_host_iface.v
// Project: NF2.1
// Description: Handles the host interface accesses (ie. accesses from the
// host CPU). Most of the work is actually off-loaded to oq_re... |
#include <bits/stdc++.h> int a[300004], pos[300004]; using namespace std; int main() { int n, temp; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; pos[a[i]] = i; } bool flag = false; for (int i = 1; i <= n && !flag; i++) for (int j = i + 1; j <= min(n, i + 5) && !f... |
#include <bits/stdc++.h> using namespace std; char sign[1000][1000], cpy[1000][1000]; int n, m; void tryFill(int i, int j) { for (int ii = i - 1; ii <= i + 1; ii++) { for (int jj = j - 1; jj <= j + 1; jj++) { if (i == ii && j == jj) { continue; } if (sign[ii][jj] == ... |
#include <bits/stdc++.h> int main() { std::string first, last, create = fffffffffffff ; int let = 1; std::cin >> first >> last; create[0] = first[0]; int size = first.size(); for (int i = 1; i < size; i++) { if (first[i] < last[0]) { create[let] = first[i]; let++; ... |
/**
* 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) 1999 Paul Bain ()
//
// 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 ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m, k; cin >> n >> m >> k; long long int a[m]; for (int i = 0; i < m; i++) cin >> a[i]; long long int s = 0, S = 0; for (int i = 0; i < m; i++) { long long int d; if ((a[i] - s) % k == 0) d = (a[i]... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2014.4
// Copyright (C) 2014 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1ns/1ps
module ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; int MOD; struct modint { private: int v; static int minv(int a, int m) { a %= m; assert(a); return a == 1 ? 1 : int(m - ll(minv(m, a)) * ll(m) / a); } public: modint() ... |
// (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; #define ll long long //int r1[5005],r2[5005],l2[5005],l1[5005]; //ll ans[5005][5005]; ll ans1[5005]; ll ans2[5005]; ll last1[5005]; ll last2[5005]; int tag[5005]; ll s[5005]; int main() { int t; cin>>t; while(t--) { i... |
#include <bits/stdc++.h> using namespace std; long long qpow(long long x, long long k, long long mod) { long long ret = 1; while (k) { if (k & 1) { ret = ret * x; ret = ret % mod; } x = x * x; x = x % mod; k = (k >> 1); } return ret; } const int Maxn... |
`timescale 1ns / 1ps
module cpu_wrapper( clk, reset, AB, DB_IN, DB_OUT, RD, IRQ, NMI, RDY, halt_b);
input clk; // CPU clock
input reset; // reset signal
output [15:0] AB; // address bus
input [7:0] DB_IN; // data in,
output [7:0] DB_OUT; // data_out,
output RD; //... |
/**
* 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 = 2e5 + 7; int n, w, h; struct Point { int d, p, id; bool operator<(const Point& r) const { return p < r.p; } }; vector<Point> px[N], py[N]; int ansx[N], ansy[N], tmpx[N], tmpy[N]; int main() { scanf( %d%d%d , &n, &w, &h); for (in... |
/*
* 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
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03/29/2016 05:57:16 AM
// Design Name:
// Module Name: Testbench_FPU
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revisio... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar(... |
/*
* 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... |
//*******************************************************************************************************************************************************/
// Module Name: alu
// Module Type: Arithmetic Logic Unit
// Author: Shreyas Vinod
// Purpose: Arithmetic Logic Unit for Neptune I v3.0
// Description: A simple... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<long long> s(n); for (int(i) = (int)(0); (i) < (int)(n); ++(i)) cin >> s[i]; long long a, b, c, d, e; cin >> a >> b >> c >> d >> e; long long r = 0; vector<long long> t(5, 0); for (int(i) = (int)(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... |
//This was taken from Rudolf Usselmann's generic_fifo_dc_gray.v
/////////////////////////////////////////////////////////////////////
//// ////
//// Universal FIFO Dual Clock, gray encoded ////
//// ... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) { return a; } return gcd(b, a % b); } long long lcm(long long a, long long b) { return ((a * b) / gcd(a, b)); } long long int read_int() { char r; bool start = false, neg = false; ... |
#include <bits/stdc++.h> using namespace std; int n, l, k, a[200], p[200]; double memo[200][201][201]; bool seen[200][201][201]; double solve(int idx, int kk, int ll) { if (kk < 0) { return 0; } if (idx == n) { return ll >= l; } if (seen[idx][kk][ll]) { return memo[idx][k... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; for (int i = 2; i < s.size(); i++) { int a = 0, b = 0, c = 0; for (int j = i; j >= i - 2; j--) { if (s[j] == A ) a++; if (s[j] == B ) b++; if (s[j] == C ) c++; } if (a > 0 &&... |
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date:
// Design Name:
// Module Name: quick_spi
// Project Name:
// Target Devices:
// Tool Versions:
// Description: spi module with arbitrary data length up to 64 bits,
// i.e ... |
#include <bits/stdc++.h> using namespace std; int const mxsz = 509; long long w[mxsz][mxsz]; bool ver[mxsz]; int main() { vector<int> er; vector<long long> res; int n; scanf( %d , &n); er.resize(n); for (int i = 0; i < n; ++i) { int x; for (int j = 0; j < n; ++j) { ... |
#include <bits/stdc++.h> const int inf = 1e7 + 7; long long mod = 1e9 + 7; const double eps = 1e-9; using namespace std; int num[1000005]; char s[1000005]; int main() { cin >> s; int len = strlen(s); num[len] = 0; for (int i = len - 1; i >= 0; i--) { if (s[i] == 0 ) num[i] =... |
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> inline void smin(T &a, const U &b) { if (a > b) a = b; } template <typename T, typename U> inline void smax(T &a, const U &b) { if (a < b) a = b; } template <typename T> inline void gn(T &first) { char c, sg = ... |
#include <bits/stdc++.h> using namespace std; const int N = 2005, M = 2000010; const long long MOD = 1E9 + 7; long long Pow(long long a, long long b) { long long c = 1; for (; b; a = a * a % MOD, b >>= 1) if (b & 1) c = c * a % MOD; return c; } struct Node { int x, y; bool operator... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; long long sl = s.length(); long long one = 0; long long two = 0; long long three = 0; long long i; for (i = 0; i < sl; i = i + 2) { if (s[i] - 0 == 1) { one++; } else if (s[i] - 0 =... |
#include <bits/stdc++.h> using namespace std; int main() { string s; string buf; while (getline(cin, buf)) s += buf; vector<int> a; string hoge; vector<int> cnt; for (int i = 0; i < s.length(); ++i) { if (s[i] == < ) { hoge = ; } else if (s[i] == > ) { if ... |
#include <bits/stdc++.h> using namespace std; const int maxn = INT_MAX; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n, m; cin >> n >> m; if (n > m) { swap(n, m); } if (n == 1) { if (m % 6 == 0) { cout << n * m; } else if (... |
/***********************************************************************************************************************
* Copyright (C) 2017 Andrew Zonenberg and contributors *
* ... |
#include <bits/stdc++.h> const long long MOD = 1e9 + 7, INF = 1e18 + 1; using namespace std; long long a[1000000], cnt, n, m; long long p[1000000], sz[1000000]; int d[10000001]; long long gcd(long long a, long long b) { if (!b) return (a > 1); else return gcd(b, a % b); } long long f... |
#include <bits/stdc++.h> using namespace std; int sum[100005]; int main() { int h1, h2, a, b, k, x; cin >> h1 >> h2 >> a >> b; int num = h1 + a * 8; if (num >= h2) x = 0; else if (a <= b) x = -1; else { x = 1; num -= b * 12; for (int i = 1;; i++) { num... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( sse4 ) using namespace std; static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL; template <typename T, typename U> static void amin(T &x, U y) { if (y < x) x = y; } template <typename T, typen... |
/*
* 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 long a[1000000 + 100], f2, x1, x2, b[1000000 + 100], razl, sol, pok1, pok2; double f1; int main() { for (int i = 1; i <= 4; i++) cin >> a[i]; f1 = sqrt(1 + 8 * a[1]) * 1.0; f2 = sqrt(1 + 8 * a[1]); if (f1 != f2) { printf( Impossible n ); ... |
#include <bits/stdc++.h> using namespace std; int getFldsFromLine(char *line, std::vector<char *> &res, const char *sep = t n v f r ); int main(int argc, char **argv) { FILE *infile = stdin; char *line; line = (char *)calloc(5000000, sizeof(char)); if (line == NULL) { ... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:66777216 ) using namespace std; template <typename TT, int V, int E> struct DinicFlow { int ds[V + 1], q[V + 1], nx[E + 1], last[V + 1], ver[E + 1], now[V + 1], n, edgesCount, S, T; TT cap[E + 1], flow[E + 1]; DinicFlow() : n(0), S(0),... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n; string s; cin >> s; int l = s.length(), ct = 1; for (int i = 1; i < l; i++) { if (s[i] != s[i - 1]) ct++; } if (ct >= (n - 1)) cout << n; else cout << ct + 2; return 0; } |
#include <bits/stdc++.h> using namespace std; long long int Mmax(long long int a, long long int b) { if (a > b) return a; return b; } long long int Mmin(long long int a, long long int b) { if (a < b) return a; return b; } long long int nod(long long int a, long long int b) { while (a && ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.