-
Notifications
You must be signed in to change notification settings - Fork 1
/
template.c
116 lines (109 loc) · 3.09 KB
/
template.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/* AUTHOR:AKASH JAIN
* USERNAME:akash19jain
* TIME: $%D%$-$%M%$-$%Y%$ $%h%$:$%m%$:$%s%$
*/
// #include<algorithm>
// #include <bits/stdc++.h>
// using namespace std;
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
#define SC1(x) scanf("%lld",&x)
#define SC2(x,y) scanf("%lld%lld",&x,&y)
#define SC3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z)
#define SCS(x) scanf("\n%s", x)
#define SCA(a,n) for(long long i=0;i<n;i++) scanf("%lld",&a[i]);
#define PF1(x) printf("%lld\n",x)
#define PF2(x,y) printf("%lld %lld\n",x,y)
#define PF3(x,y,z) printf("%lld %lld %lld\n",x,y,z)
#define PFA(a,n) for(long long i=0;i<n;i++) printf("%lld",a[i]); printf("\n");
#define PFN printf("\n")
#define REP(i,n) for(long long i=0;i<(n);++i)
#define FOR(i,a,b) for(long long i=(a);i<=(b);++i)
#define FORD(i,a,b) for(long long i=(a);i>=(b);--i)
#define WHILE(n) while(n--)
#define MEM(a, b) memset(a, (b), sizeof(a))
#define ITOC(c) ((char)(((ll)'0')+c))
#define MID(s,e) (s+(e-s)/2)
#define SZ(a) strlen(a)
#define MOD 1000000007
#define MAX 10000000005
#define MIN -10000000005
#define PI 3.1415926535897932384626433832795
#define DEB(x) printf("The value of \"%s\" is: %d\n",#x,x)
#define CASES ll t;SC1(t);while(t--)
#define ABS(a) ((a>0)?a:-(a))
#define SWAP(a,b) ll z=a;a=b;b=z
#define SWAPC(a,b) char z=a;a=b;b=z
const int INF = 1<<29;
typedef long long ll;
typedef unsigned long long ull;
#define FILEIO(name) \ freopen(name".in", "r", stdin); \ freopen(name".out", "w", stdout);
int cmp(const void * a,const void * b);
long long maxv(long long a,long long b);
long long minv(long long a,long long b);
long long gcd(long long u,long long v);
long long digits(long long n);
bool ispoweroftwo(long long n);
bool isvowel(char x);
ll chartoint(char ch);
ll CEIL(ll x,ll y);
ll FLOOR(ll x,ll y);
int main()
{
return 0;
}
//qsort(arr,n,sizeof(arr[0]),cmp);
int cmp (const void * a, const void * b)
{
if( *(ll*)a - *(ll*)b < 0 ) return -1;
if( *(ll*)a - *(ll*)b > 0 ) return 1;
return 0;
}
long long maxv(long long a,long long b)
{
if(a>b) return a;
return b;
}
long long minv(long long a,long long b)
{
if(a<b) return a;
return b;
}
long long gcd(long long u,long long v)
{
if (v == 0) return u;
return gcd(v, u%v);
}
long long digits(long long n) //to calculate no of digits in a number
{
return floor(log10(n))+1;
}
bool ispoweroftwo(long long x)
{
return x && (!(x&(x-1)));
}
bool isvowel(char x)
{
return(x=='a' || x== 'e' ||x=='i' || x== 'o' || x=='u' );
}
ll chartoint(char ch)
{
if(ch>='A' && ch<='Z') return(ch-'A');
else if(ch>='0' && ch<='9') return (ch-'0');
else if(ch>='a' && ch<='z') return (ch-'a');
else return 0;
}
ll CEIL(ll x,ll y)
{
if(x%y==0) return(x/y);
else return(x/y +1);
}
ll FLOOR(ll x,ll y)
{
if(x%y==0) return(x/y);
else return(x/y -1);
}