solution
stringlengths 11
983k
| difficulty
int64 0
21
| language
stringclasses 2
values |
---|---|---|
def to_dec(s, b):
i = len(s) - 1
n = 0
for d in s:
n += d * (b ** i)
i -= 1
return n
xlen, xb = map(int, input().split())
x = list(map(int, input().split()))
ylen, yb = map(int, input().split())
y = list(map(int, input().split()))
x = int(to_dec(x, xb))
y = int(to_dec(y, yb))
if x == y:
print('=')
elif x > y:
print('>')
else:
print('<')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, bx, m, by, q;
double x = 0, y = 0;
cin >> n >> bx;
for (int i = n; i > 0; i--) {
cin >> q;
x += q * pow(bx, n - 1);
n--;
}
cin >> m >> by;
for (int i = m; i > 0; i--) {
cin >> q;
y += q * pow(by, m - 1);
m--;
}
if (x < y) {
printf("<\n");
} else if (x > y) {
printf(">\n");
} else {
printf("=\n");
}
}
| 7 | CPP |
n, bx = map(int, input().split())
x = list(map(int, input().split()))
m, by = map(int, input().split())
y = list(map(int, input().split()))
tmp = 1
ans = 0
for i in range(1, n + 1):
ans += x[-i] * tmp
tmp *= bx
ans1 = 0
tmp = 1
for i in range(1, m + 1):
ans1 += y[-i] * tmp
tmp *= by
if ans < ans1:
print("<")
elif ans > ans1:
print(">")
else:
print("=")
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int MaxN = 10000;
long long n, a[MaxN + 5], m, p, q, b[MaxN + 5], ans1, ans2;
int main() {
scanf("%I64d%I64d", &n, &p);
for (int i = 1; i <= n; i++) scanf("%I64d", &a[i]);
scanf("%I64d%I64d", &m, &q);
for (int i = 1; i <= m; i++) scanf("%I64d", &b[i]);
long long tot = 1;
for (int i = n; i >= 1; i--) {
ans1 += a[i] * tot;
tot *= p;
}
tot = 1;
for (int i = m; i >= 1; i--) {
ans2 += b[i] * tot;
tot *= q;
}
if (ans1 == ans2) printf("=");
if (ans1 > ans2) printf(">");
if (ans1 < ans2) printf("<");
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, bx, m, by;
cin >> n >> bx;
int a[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
}
cout << endl;
cin >> m >> by;
int b[m];
for (int i = 0; i < m; i++) {
cin >> b[i];
}
long long int x = 0, y = 0, p = 1, p1 = 1;
for (int i = 0; i < max(n, m); i++) {
if (i < n) {
x += a[n - 1 - i] * p;
p *= bx;
}
if (i < m) {
y += b[m - 1 - i] * p1;
p1 *= by;
}
}
if (x - y < 0)
cout << "<";
else if (x - y > 0)
cout << ">";
else
cout << "=";
return 0;
}
| 7 | CPP |
n, bx =map(int,input().split())
x = list(map(int, input().split()))
x =reversed(x)
q = 1
x1 = 0
for i in x:
x1 += q * i
q *= bx
n, bx =map(int,input().split())
x = list(map(int, input().split()))
x =reversed(x)
q = 1
y1 = 0
for i in x:
y1 += q * i
q *= bx
if x1>y1:
print('>')
elif x1<y1:
print('<')
else:
print('=')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int dig1, b1, dig2, b2, i, j, sum1 = 0, sum2 = 0, inp1, inp2;
cin >> dig1 >> b1;
for (i = dig1 - 1; i >= 0; i--) {
cin >> inp1;
sum1 = sum1 + inp1 * pow(b1, i);
}
cin >> dig2 >> b2;
for (j = dig2 - 1; j >= 0; j--) {
cin >> inp2;
sum2 = sum2 + inp2 * pow(b2, j);
}
if (sum1 > sum2)
cout << ">" << endl;
else if (sum1 < sum2)
cout << "<" << endl;
else
cout << "=" << endl;
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
vector<int> arr;
long long int power(int base, int p) {
long long sum = 1;
if (p == 0)
return 1;
else {
for (int i = 1; i <= p; i++) {
sum *= base;
}
}
return sum;
}
long long int base_con(long long int base, long long int n) {
long long int sum = 0;
int cnt = 0;
for (long long int i = n - 1; i >= 0; i--) {
sum += arr[cnt++] * power(base, i);
}
return sum;
}
int main() {
long long int n1, b1, n2, b2, num1, num2;
cin >> n1 >> b1;
for (int i = 0; i < n1; i++) {
int x;
cin >> x;
arr.push_back(x);
}
num1 = base_con(b1, n1);
arr.clear();
cin >> n2 >> b2;
for (int i = 0; i < n2; i++) {
int x;
cin >> x;
arr.push_back(x);
}
num2 = base_con(b2, n2);
if (num1 == num2)
cout << "=" << endl;
else if (num1 < num2)
cout << "<" << endl;
else
cout << ">" << endl;
}
| 7 | CPP |
n1, r1 = map(int, input().split())
v1 = 0
x1 = 1
for d in list(map(int, input().split()))[::-1]:
v1 += d * x1
x1 *= r1
r2 = int(input().split()[1])
v2 = 0
x2 = 1
for d in list(map(int, input().split()))[::-1]:
v2 += d * x2
x2 *= r2
print('>' if v1 > v2 else ('<' if v1 < v2 else '='))
| 7 | PYTHON3 |
nx, bx = map(int, input().split())
x = list(map(int, input().split()))
m=0
for i in range(nx):
m += (bx**(nx-i-1))*x[i]
ny, by = map(int, input().split())
y = list(map(int, input().split()))
n=0
for i in range(ny):
n += (by**(ny-i-1))*y[i]
if m==n:
print("=")
elif m>n:
print(">")
else:
print("<") | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, X = 0, Y = 0, temp, base, bx, by;
cin >> n >> base;
while (n--) {
cin >> temp;
X = X * base + temp;
}
cin >> n >> base;
while (n--) {
cin >> temp;
Y = Y * base + temp;
}
if (X == Y)
printf("=\n");
else if (X < Y)
printf("<\n");
else
printf(">\n");
return 0;
}
| 7 | CPP |
a = []
for i in range(2):
n, b = map(int, input().split())
a.append(0)
for x in map(int, input().split()):
a[-1] = a[-1] * b + x
print('<>='[(a[0] == a[1]) + (a[0] >= a[1])])
| 7 | PYTHON3 |
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
""
"""
n = list(map(int,input().split()))
num1 = list(map(int,input().split()))
t1=0
x=n[0]
for i in range(0,n[0]):
x-=1
t1 += num1[i]*pow(n[1],x)
m = list(map(int,input().split()))
num2 = list(map(int,input().split()))
t2=0
y=m[0]
for i in range(0,m[0]):
y-=1
t2 += num2[i]*pow(m[1],y)
if t1==t2:
print("=")
elif t1>t2:
print(">")
else:
print("<") | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int N = 15;
long long Get_Num(int num[], int b, int n) {
long long number = 0;
long long in = 1;
for (int i = n - 1; i >= 0; i--) {
number += num[i] * in;
in = in * b;
}
return number;
}
int main() {
int x[N], y[N];
int b;
int n;
long long X, Y;
cin >> n >> b;
for (int i = 0; i < n; i++) {
cin >> x[i];
}
X = Get_Num(x, b, n);
cin >> n >> b;
for (int i = 0; i < n; i++) {
cin >> y[i];
}
Y = Get_Num(y, b, n);
if (X == Y) {
printf("=\n");
} else if (X > Y) {
printf(">\n");
} else {
printf("<\n");
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long A, n, k, x, B;
int main() {
scanf("%lld %lld", &n, &k);
for (long long i = 1; i <= n; i++) {
scanf("%lld", &x);
A = A * k + x;
}
scanf("%lld %lld", &n, &k);
for (long long i = 1; i <= n; i++) {
scanf("%lld", &x);
B = B * k + x;
}
if (A == B) cout << "=";
if (A < B) cout << "<";
if (A > B) cout << ">";
return 0;
}
| 7 | CPP |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
n, bx = map(int,input().split())
X = list(map(int,input().split()))
d_x = 0
for idx, x in enumerate(X[::-1]):
d_x += x * (bx ** idx)
m, by = map(int,input().split())
Y = list(map(int,input().split()))
d_y = 0
for idx, y in enumerate(Y[::-1]):
d_y += y * (by ** idx)
if d_x < d_y:
print('<')
elif d_x > d_y:
print('>')
else:
print('=')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
unsigned long long ss, pp, i, s, j, x, b;
cin >> x >> b;
ss = 0;
for (i = 0; i < x; i++) {
cin >> s;
ss = ss * b + s;
}
cin >> x >> b;
pp = 0;
for (i = 0; i < x; i++) {
cin >> s;
pp = pp * b + s;
}
if (ss == pp)
printf("=\n");
else if (ss > pp)
printf(">\n");
else if (ss < pp)
printf("<\n");
return 0;
}
| 7 | CPP |
x_n, x_osn = map(int, input().split())
x_data = list(map(int, input().split()))
x_10 = 0
for i in range(x_n):
x_10 += x_data[i] * (x_osn ** (x_n - i - 1))
y_n, y_osn = map(int, input().split())
y_data = list(map(int, input().split()))
y_10 = 0
for i in range(y_n):
y_10 += y_data[i] * (y_osn ** (y_n - i - 1))
if x_10 < y_10:
print('<')
elif x_10 > y_10:
print('>')
else:
print('=') | 7 | PYTHON3 |
n, bx = tuple(map(int, input().split()))
x = tuple(map(int, input().split()))
m, by = tuple(map(int, input().split()))
y = tuple(map(int, input().split()))
X = 0
for i in range(n):
X += x[n - 1 - i] * (bx ** i)
Y = 0
for j in range(m):
Y += y[m - 1 - j] * (by ** j)
if X == Y: print('=')
if X > Y: print('>')
if X < Y: print('<') | 7 | PYTHON3 |
a=int(input().split()[1])
*b,=map(int,input().split())
c=0
for i in b:c=c*a+i
d=int(input().split()[1])
*e,=map(int,input().split())
f=0
for i in e:f=f*d+i
if c==f:print('=')
elif c<f:print('<')
else:print('>')
| 7 | PYTHON3 |
from math import *
from collections import deque
from copy import deepcopy
import sys
def inp(): return sys.stdin.readline().rstrip("\r\n") #for fast input
def multi(): return map(int,input().split())
def strmulti(): return map(str, inp().split())
def lis(): return list(map(int, inp().split()))
def lcm(a,b): return (a*b)//gcd(a,b)
def ncr(n,r): return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))
def stringlis(): return list(map(str, inp().split()))
def out(var): sys.stdout.write(str(var)) #for fast output, always take string
def printlist(a) :
print(' '.join(str(a[i]) for i in range(len(a))))
def isPrime(n) :
if (n <= 1) : return False
if (n <= 3) : return True
if (n % 2 == 0 or n % 3 == 0) : return False
i = 5
while(i * i <= n) :
if (n % i == 0 or n % (i + 2) == 0) :
return False
i = i + 6
return True
#copied functions end
#start coding
n,ba=multi()
a=lis()
astr=''
# for i in a:
# astr+=i
nb,bb=multi()
b=lis()
num=0
num1=0
for i in range(1,n+1):
num+=(a[-i]*ba**(i-1))
for i in range(1,nb+1):
num1+=b[-i]*bb**(i-1)
bstr=''
# for i in b:
# bstr+=i
#
# print(int(astr,ba))
# print(int(bstr,bb))
# print(num,num1)
if(num==num1):
print("=")
elif(num>num1):
print(">")
else:
print("<") | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int n, m;
int b1, b2;
int main() {
scanf("%d%d", &n, &b1);
int a[n];
for (int i = 0; i < n; i++) scanf("%d", &a[i]);
scanf("%d%d", &m, &b2);
int b[m];
for (int i = 0; i < m; i++) scanf("%d", &b[i]);
long long ans1 = 0, ans2 = 0;
long long tmp1 = 1, tmp2 = 1;
for (int i = n - 1; i >= 0; i--) {
ans1 += a[i] * tmp1;
tmp1 *= b1;
}
for (int i = m - 1; i >= 0; i--) {
ans2 += b[i] * tmp2;
tmp2 *= b2;
}
if (ans1 < ans2)
printf("<\n");
else if (ans1 == ans2)
printf("=\n");
else
printf(">\n");
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long n, m, b1, b2, mul, X, Y, a[15], b[15], i;
while (scanf("%I64d %I64d", &n, &b1) == 2) {
for (i = 0; i < n; i++) {
scanf("%I64d", &a[i]);
}
scanf("%I64d %I64d", &m, &b2);
for (i = 0; i < m; i++) {
scanf("%I64d", &b[i]);
}
mul = 1;
X = 0;
i = n - 1;
for (i = n - 1; i >= 0; i--) {
X += a[i] * mul;
mul *= b1;
}
mul = 1;
Y = 0;
for (i = m - 1; i >= 0; i--) {
Y += b[i] * mul;
mul *= b2;
}
if (X > Y) {
printf(">\n");
} else if (X == Y) {
printf("=\n");
} else {
printf("<\n");
}
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "inline", "-ffast-math")
#pragma GCC target("abm,avx,mmx,popcnt,sse,sse2,sse3,ssse3,sse4")
using namespace std;
int n, m, a, b, num;
long long l, r;
inline int qread() {
int x = 0, y = 1;
int c = getchar();
while (c < '0' || c > '9') {
if (c == '-') y = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
x = (x << 1) + (x << 3) + (c ^ 48);
c = getchar();
}
return x * y;
}
int main() {
n = qread();
a = qread();
for (register int i = 1; i <= n; i++) {
num = qread();
l = l * a + num;
}
m = qread();
b = qread();
for (register int i = 1; i <= m; i++) {
num = qread();
r = r * b + num;
}
if (l ^ r) {
if (l > r) {
putchar('>');
return 0;
} else {
putchar('<');
return 0;
}
} else {
putchar('=');
return 0;
}
return 0;
}
| 7 | CPP |
n,bx = [int(i) for i in input().split(" ")]
x = [int(i) for i in input().split(" ")]
m,by = [int(i) for i in input().split(" ")]
y = [int(i) for i in input().split(" ")]
xx = 0
for i in x:
xx *= bx
xx += i
yy = 0
for i in y:
yy *= by
yy += i
if xx == yy:
print("=")
elif xx < yy:
print("<")
else:
print(">")
| 7 | PYTHON3 |
n, bx = map(int, input().split())
X = list(map(int, input().split()))
m, by = map(int, input().split())
Y = list(map(int, input().split()))
def to_10(X, n, bx):
ten_base_n = 0
for i in range(len(X)):
ten_base_n += X[len(X) - i - 1] * bx ** i
return ten_base_n
if to_10(X, n, bx) == to_10(Y, m, by):
print("=")
elif to_10(X, n, bx) > to_10(Y, m, by):
print(">")
else:
print("<") | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long int p(long long int num, long long int e) {
long long int res = 1;
for (int i = 0; i < e; i++) res *= num;
return res;
}
int main() {
long long int x = 0, y = 0, n, m, bx, by, inp;
cin >> n >> bx;
while (n--) {
cin >> inp;
x += p(bx, n) * inp;
}
cin >> n >> by;
while (n--) {
cin >> inp;
y += p(by, n) * inp;
}
if (x < y)
cout << "<";
else if (x == y)
cout << "=";
else
cout << ">";
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a;
long long n;
long long bx0;
long long by0;
long long bx;
long long X;
long long Y;
long long by;
long long i;
bx = 1;
by = 1;
cin >> n >> bx0;
Y = 0;
X = 0;
for (i = 1; i < n; i++) {
bx = bx * bx0;
}
for (i = 1; i < n + 1; i++) {
cin >> a;
X = X + a * bx;
bx = bx / bx0;
}
cin >> n >> by0;
for (i = 1; i < n; i++) {
by = by * by0;
}
for (i = 1; i < n + 1; i++) {
cin >> a;
Y = Y + a * by;
by = by / by0;
}
if (X < Y) {
cout << "<";
}
if (X == Y) {
cout << "=";
}
if (X > Y) {
cout << ">";
}
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long f(long long a, long long b) {
long long s = 1;
while (b--) s *= a;
return s;
}
int main() {
long long ax, ay, bx, by, a, kx = 0, ky = 0;
cin >> ax >> bx;
while (ax--) {
cin >> a;
kx += a * f(bx, ax);
}
cin >> ay >> by;
while (ay--) {
cin >> a;
ky += a * f(by, ay);
}
if (kx == ky)
cout << "=";
else if (kx < ky)
cout << "<";
else
cout << ">";
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using db = double;
using str = string;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using pd = pair<db, db>;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<ll>;
using vd = vector<db>;
using vs = vector<str>;
using vpi = vector<pi>;
using vpl = vector<pl>;
using vpd = vector<pd>;
template <class T>
using V = vector<T>;
template <class T, size_t SZ>
using AR = array<T, SZ>;
const int MOD = 1e9 + 7;
const int MX = 2e5 + 5;
const ll INF = 1e18;
const ld PI = acos((ld)-1);
const int xd[4] = {1, 0, -1, 0}, yd[4] = {0, 1, 0, -1};
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
constexpr int pct(int x) { return __builtin_popcount(x); }
constexpr int bits(int x) { return 31 - __builtin_clz(x); }
ll cdiv(ll a, ll b) { return a / b + ((a ^ b) > 0 && a % b); }
ll fdiv(ll a, ll b) { return a / b - ((a ^ b) < 0 && a % b); }
template <class T>
bool ckmin(T& a, const T& b) {
return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
return a < b ? a = b, 1 : 0;
}
template <class T, class U>
T fstTrue(T lo, T hi, U f) {
hi++;
assert(lo <= hi);
while (lo < hi) {
T mid = lo + (hi - lo) / 2;
f(mid) ? hi = mid : lo = mid + 1;
}
return lo;
}
template <class T, class U>
T lstTrue(T lo, T hi, U f) {
lo--;
assert(lo <= hi);
while (lo < hi) {
T mid = lo + (hi - lo + 1) / 2;
f(mid) ? lo = mid : hi = mid - 1;
}
return lo;
}
template <class T>
void remDup(vector<T>& v) {
sort(begin(v), end(v));
v.erase(unique(begin(v), end(v)), end(v));
}
template <class T, class U>
void erase(T& t, const U& u) {
auto it = t.find(u);
assert(it != end(t));
t.erase(u);
}
template <class T>
void re(complex<T>& c);
template <class T, class U>
void re(pair<T, U>& p);
template <class T>
void re(vector<T>& v);
template <class T, size_t SZ>
void re(AR<T, SZ>& a);
template <class T>
void re(T& x) {
cin >> x;
}
void re(db& d) {
str t;
re(t);
d = stod(t);
}
void re(ld& d) {
str t;
re(t);
d = stold(t);
}
template <class T, class... U>
void re(T& t, U&... u) {
re(t);
re(u...);
}
template <class T>
void re(complex<T>& c) {
T a, b;
re(a, b);
c = {a, b};
}
template <class T, class U>
void re(pair<T, U>& p) {
re(p.f, p.s);
}
template <class T>
void re(vector<T>& x) {
for (auto& a : x) re(a);
}
template <class T, size_t SZ>
void re(AR<T, SZ>& x) {
for (auto& a : x) re(a);
}
str to_string(char c) { return str(1, c); }
str to_string(const char* s) { return (str)s; }
str to_string(str s) { return s; }
str to_string(bool b) { return to_string((int)b); }
template <class T>
str to_string(complex<T> c) {
stringstream ss;
ss << c;
return ss.str();
}
str to_string(vector<bool> v) {
str res = "{";
for (int i = (0); i < ((int)(v).size()); ++i) res += char('0' + v[i]);
res += "}";
return res;
}
template <size_t SZ>
str to_string(bitset<SZ> b) {
str res = "";
for (int i = (0); i < (SZ); ++i) res += char('0' + b[i]);
return res;
}
template <class T, class U>
str to_string(pair<T, U> p);
template <class T>
str to_string(T v) {
bool fst = 1;
str res = "";
for (const auto& x : v) {
if (!fst) res += " ";
fst = 0;
res += to_string(x);
}
return res;
}
template <class T, class U>
str to_string(pair<T, U> p) {
return to_string(p.f) + " " + to_string(p.s);
}
template <class T>
void pr(T x) {
cout << to_string(x);
}
template <class T, class... U>
void pr(const T& t, const U&... u) {
pr(t);
pr(u...);
}
void ps() { pr("\n"); }
template <class T, class... U>
void ps(const T& t, const U&... u) {
pr(t);
if (sizeof...(u)) pr(" ");
ps(u...);
}
void DBG() { cerr << "]" << endl; }
template <class T, class... U>
void DBG(const T& t, const U&... u) {
cerr << to_string(t);
if (sizeof...(u)) cerr << ", ";
DBG(u...);
}
void setIn(str s) { freopen(s.c_str(), "r", stdin); }
void setOut(str s) { freopen(s.c_str(), "w", stdout); }
void unsyncIO() { cin.tie(0)->sync_with_stdio(0); }
void setIO(str s = "") {
unsyncIO();
if ((int)(s).size()) {
setIn(s + ".in"), setOut(s + ".out");
}
}
void solve();
int main() {
setIO();
ll T = 1;
for (int i = (0); i < (T); ++i) solve();
}
void solve() {
ll n, bx, x = 0;
re(n, bx);
for (int i = (0); i < (n); ++i) {
ll a;
cin >> a;
x += a * pow(bx, n - i - 1);
}
ll y = 0;
re(n, bx);
for (int i = (0); i < (n); ++i) {
ll a;
cin >> a;
y += a * pow(bx, n - i - 1);
}
if (x > y) {
cout << ">";
} else if (x < y) {
cout << "<";
} else {
cout << "=";
}
}
| 7 | CPP |
n,m=map(int,input().split())
l=list(map(int,input().split()))
first=int(0)
second=int(0)
now=int(1)
for i in range(len(l)-1,-1,-1):
first=first+now*l[i]
now=now*m
n1,m1=map(int,input().split())
l1=list(map(int,input().split()))
now=1
for i in range(len(l1)-1,-1,-1):
second=second+now*l1[i]
now=now*m1
if second==first:
print('=')
elif second>first:
print('<')
else:
print('>')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long int n, m, s1 = 0, s2 = 0, i, b1, b2;
cin >> n >> b1;
int a1[n];
for (i = 0; i < n; i++) cin >> a1[i];
cin >> m >> b2;
int a2[m];
for (i = 0; i < m; i++) cin >> a2[i];
long long int cnt = 0;
for (i = n - 1; i >= 0; i--) {
s1 += pow(b1, cnt) * a1[i];
cnt++;
}
cnt = 0;
for (i = m - 1; i >= 0; i--) {
s2 += pow(b2, cnt) * a2[i];
cnt++;
}
if (s1 == s2)
cout << "=";
else if (s1 < s2)
cout << "<";
else
cout << ">";
return 0;
}
| 7 | CPP |
a1,b1=map(int,input().split())
x=list(map(int,input().split()))
x1=0
a2,b2=map(int,input().split())
y=list(map(int,input().split()))
y1=0
for i in range(a1):
x1+=(b1**(a1-i-1))*x[i]
for i in range(a2):
y1+=(b2**(a2-i-1))*y[i]
if x1<y1:
print('<')
if x1==y1:
print('=')
if x1>y1:
print('>')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n1, n2, p1, p2, wynik1 = 0, wynik2 = 0;
cin >> n1 >> p1;
int CYFRY1[10], CYFRY2[10];
for (int i = 0; i < n1; i++) {
cin >> CYFRY1[i];
wynik1 = wynik1 * p1 + CYFRY1[i];
}
cin >> n2 >> p2;
for (int i = 0; i < n2; i++) {
cin >> CYFRY2[i];
wynik2 = wynik2 * p2 + CYFRY2[i];
}
if (wynik1 > wynik2)
cout << ">";
else if (wynik1 < wynik2)
cout << "<";
else
cout << "=";
return 0;
}
| 7 | CPP |
def convert():
n, b = map(int, input().split())
v = 0
for x in map(int, input().split()):
v = b * v + x
return v
x, y = convert(), convert()
if x > y:
print('>')
elif x < y:
print('<')
else:
print('=')
| 7 | PYTHON3 |
__author__ = 'sandeepmellacheruvu'
nx, bx = map(int,input().split())
x = list(map(int,input().split()))
ny, by = map(int, input().split())
y = list(map(int,input().split()))
numX = 0
numY = 0
for i in range(len(x)):
numX += x[i] * (bx ** (len(x) - i - 1))
for i in range(len(y)):
numY += y[i] * (by ** (len(y) - i - 1))
if(numX < numY):
print("<")
elif numX > numY:
print(">")
else:
print("=") | 7 | PYTHON3 |
def num_with_base_to_int(num_arr, base):
num = 0
for i, digit in enumerate(num_arr):
num = num*base + int(digit)
return num
def two_base():
_, baseX = [int(x) for x in input().split(' ')]
numX = input().split(' ')
_, baseY = [int(x) for x in input().split(' ')]
numY = input().split(' ')
XToInt = num_with_base_to_int(numX, baseX)
YToInt = num_with_base_to_int(numY, baseY)
# print(XToInt, YToInt)
if XToInt < YToInt:
return '<'
elif XToInt > YToInt:
return '>'
elif XToInt == YToInt:
return '='
if __name__ == "__main__":
print(two_base()) | 7 | PYTHON3 |
#include <bits/stdc++.h>
int main() {
int bx, by, n, m;
double X = 0, Y = 0;
scanf("%d%d", &n, &bx);
int x[n];
for (int i = 0; i < n; i++) scanf("%d", &x[i]);
scanf("%d%d", &m, &by);
int y[m];
for (int i = 0; i < m; i++) scanf("%d", &y[i]);
for (int i = 1; i <= n; i++) {
X += pow(bx, n - i) * x[i - 1];
}
for (int i = 1; i <= m; i++) {
Y += pow(by, m - i) * y[i - 1];
}
if (X == Y)
printf("=");
else if (X < Y)
printf("<");
else
printf(">");
}
| 7 | CPP |
I=lambda:map(int,input().split()[::-1])
def f():
b,_=I()
r,x=0,1
for i in I():
r+=i*x
x*=b
return r
a=f()-f()
print("<"if a<0 else ">="[a==0]) | 7 | PYTHON3 |
res = [0, 0]
for i in range(2):
n, b = map(int, input().split())
for x in [int(x) for x in input().split()]:
res[i] *= b
res[i] += x
print('<' if res[0] < res[1] else '>' if res[0] > res[1] else '=') | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, a, m, b;
double x = 0, y = 0, k;
scanf("%d %d", &n, &a);
for (int i = 1; i <= n; i++) {
scanf("%lf", &k);
x += k * pow(a, n - i);
}
scanf("%d %d", &m, &b);
for (int i = 1; i <= m; i++) {
scanf("%lf", &k);
y += k * pow(b, m - i);
}
if (x == y)
printf("=\n");
else if (x > y)
printf(">\n");
else
printf("<\n");
return 0;
}
| 7 | CPP |
a,b=map(int,input().split())
c=list(map(int,input().split()))
d,e=map(int,input().split())
f=list(map(int,input().split()))
n1=0
n2=0
for i in range(len(c)):
n1+=c[i]*b**(len(c)-i-1)
for i in range(len(f)):
n2+=f[i]*e**(len(f)-i-1)
if n1>n2:
print('>')
elif n1==n2:
print('=')
else:
print('<') | 7 | PYTHON3 |
def input_to_10():
n, base = map(int, input().split())
x = list(map(int, input().split()))[::-1]
res = 0
power = 1
for el in x:
res += el * power
power *= base
return res
a = input_to_10()
b = input_to_10()
if a == b:
print('=')
elif a < b:
print('<')
else:
print('>') | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long i, j, k, n, a[100], b[100], s, p, ans = 0, ans2 = 0;
cin >> k >> n;
for (i = 0; i < k; i++) {
cin >> s;
ans = ans * n + s;
}
cin >> k >> n;
for (i = 0; i < k; i++) {
cin >> s;
ans2 = ans2 * n + s;
}
if (ans == ans2)
cout << "=" << endl;
else if (ans > ans2)
cout << ">" << endl;
else
cout << "<" << endl;
return 0;
}
| 7 | CPP |
nx, bx = map(int, input().split())
A = list(map(int, input().split()))
ny, by = map(int, input().split())
B = list(map(int, input().split()))
x = y = 0
for i in range(len(A)):
x = x * bx + A[i]
for i in range(len(B)):
y = y * by + B[i]
if x > y:
print('>')
elif x < y:
print('<')
else:
print('=')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
long long int A[1000][1000];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
;
long long int n, base, help, a, s1 = 0, s2 = 0;
cin >> n >> base;
help = n;
for (long long int i = 0; i < n; i++) {
cin >> a;
s1 += (a * pow(base, --help));
}
cin >> n >> base;
help = n;
for (long long int i = 0; i < n; i++) {
cin >> a;
s2 += (a * pow(base, --help));
}
if (s1 < s2)
cout << "<" << endl;
else if (s1 > s2)
cout << ">" << endl;
else
cout << "=" << endl;
return 0;
}
| 7 | CPP |
n,b1=map(int,input().split())
x=list(map(int,input().split()))
m,b2=map(int,input().split())
y=list(map(int,input().split()))
x=x[::-1]
y=y[::-1]
ans1 = 0
for i in range(n):
ans1+=(b1**i)*x[i]
ans2 = 0
for i in range(m):
ans2+=(b2**i)*y[i]
if ans1==ans2:
print("=")
elif ans1<ans2:
print("<")
else:
print(">") | 7 | PYTHON3 |
import sys
input_file = sys.stdin
#input_file = open("in.txt")
_, base_x = map(int,input_file.readline().rstrip().split())
number_x = list(reversed(list(map(int,input_file.readline().rstrip().split()))))
_, base_y = map(int,input_file.readline().rstrip().split())
number_y = list(reversed(list(map(int,input_file.readline().rstrip().split()))))
val_x = 0
for i,val in enumerate(number_x):
val_x += number_x[i] * (base_x ** i)
val_y = 0
for i,val in enumerate(number_y):
val_y += number_y[i] * (base_y ** i)
if val_x < val_y:
print("<")
elif val_y < val_x:
print(">")
else:
print("=")
| 7 | PYTHON3 |
#include <bits/stdc++.h>
int main(void) {
int n, m, x, y, temp;
long long X = 0, Y = 0;
scanf("%d %d", &n, &x);
for (int i = 0; i < n; i++) {
X *= x;
scanf("%d", &temp);
X += temp;
}
scanf("%d %d", &m, &y);
for (int i = 0; i < m; i++) {
Y *= y;
scanf("%d", &temp);
Y += temp;
}
if (X == Y)
puts("=");
else
puts(X > Y ? ">" : "<");
return 0;
}
| 7 | CPP |
n, bx = [int(x) for x in input().split()]
xi = [int(x) for x in input().split()]
m, by = [int(x) for x in input().split()]
yi = [int(x) for x in input().split()]
x = 0
y = 0
for i in range(len(xi)):
x += xi[i] * bx**(n - i - 1)
for i in range(len(yi)):
y += yi[i] * by**(m - i - 1)
if x == y: print('=')
if x > y: print('>')
if x < y: print('<')
| 7 | PYTHON3 |
contest = True
if not contest:
fin = open("in", "r")
inp = input if contest else lambda: fin.readline()[:-1]
read = lambda: tuple(map(int, inp().split()))
lx, bx = read()
numsx = tuple(reversed(read()))
x = 0
for i in range(lx):
x += numsx[i] * bx ** i
ly, by = read()
numsy = tuple(reversed(read()))
y = 0
for i in range(ly):
y += numsy[i] * by ** i
if x == y:
print("=")
if x > y:
print(">")
if x < y:
print("<")
| 7 | PYTHON3 |
n, bx = map(int, input().split())
summa1 = 0
s = list(map(int, input().split()))
for i in range(n):
a = s[i]
summa1 += bx ** (n - i - 1) * a
m, by = map(int, input().split())
summa2 = 0
s = list(map(int, input().split()))
for i in range(m):
a = s[i]
summa2 += by ** (m - i - 1) * a
if summa1 > summa2:
print('>')
elif summa2 == summa1:
print('=')
else:
print('<') | 7 | PYTHON3 |
def calc():
n,b=map(int,input().split())
x=list(map(int,input().split()))
ans=0
for i in x:
ans=ans*b+i
return ans
X=calc()
Y=calc()
if X>Y:
print('>')
elif X==Y:
print('=')
else:
print('<') | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const long long mod = 1000000007;
const long long maxn = 100005;
const long long inf = 1ll << 30;
long long ar[maxn];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long n, bx, m, by;
cin >> n >> bx;
long long suma = 0;
for (int i = 0; i < n; ++i) {
long long temp;
cin >> temp;
suma = suma * bx + (temp);
}
cin >> m >> by;
long long sumb = 0;
for (int i = 0; i < m; ++i) {
long long temp;
cin >> temp;
sumb = sumb * by + temp;
}
if (suma < sumb) {
cout << "<";
} else if (suma == sumb) {
cout << "=";
} else {
cout << ">";
}
return 0;
}
| 7 | CPP |
def main():
(n, bx) = (int(x) for x in input().split())
digitsX = [int(x) for x in input().split()]
(m, by) = (int(x) for x in input().split())
digitsY = [int(x) for x in input().split()]
print(solver(digitsX, bx, digitsY, by))
def solver(digitsX, bx, digitsY, by):
X = getValue(digitsX, bx)
Y = getValue(digitsY, by)
if X < Y:
return '<'
elif X == Y:
return '='
else:
return '>'
def getValue(digitsK, bk):
total = 0
for i in range(len(digitsK)):
total += digitsK[i] * pow(bk, len(digitsK) - i - 1)
return total
main()
# digits1 = [1, 0, 1, 1]
# b1 = 3
# print(getValue(digits1, b1)) | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 + 10;
const int maxm = 1000000 + 10;
const int mod = (int)1e9 + 7;
const int INF = 0x3f3f3f3f;
const long long LINF = (1LL << 62);
const double eps = 1e-8;
const double PI = acos(-1.0);
long long hehe(int a, int b) {
long long res = 1;
for (int i = 0; i < b; i++) {
res *= a;
}
return res;
}
int main() {
long long x1 = 0, x2 = 0;
int n, b;
scanf("%d%d", &n, &b);
for (int i = 0; i < n; i++) {
int x;
scanf("%d", &x);
x1 += (long long)x * hehe(b, n - i - 1);
}
scanf("%d%d", &n, &b);
for (int i = 0; i < n; i++) {
int x;
scanf("%d", &x);
x2 += (long long)x * hehe(b, n - i - 1);
}
if (x1 < x2)
printf("<\n");
else if (x1 > x2)
printf(">\n");
else
printf("=\n");
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007LL;
int main() {
int n1, b1;
scanf("%d%d", &n1, &b1);
long long x = 0;
for (int i = 0, _n = n1; i < _n; i++) {
x *= b1;
int tr;
scanf("%d", &tr);
x += tr;
}
int n2, b2;
scanf("%d%d", &n2, &b2);
long long y = 0;
for (int i = 0, _n = n2; i < _n; i++) {
y *= b2;
int tr;
scanf("%d", &tr);
y += tr;
}
if (x == y) printf("=\n");
if (x < y) printf("<\n");
if (x > y) printf(">\n");
return 0;
}
| 7 | CPP |
n, b = list(map(int, input().split(' ')))
X = list(map(int, input().split(' ')))
Nico = 1
x = 0
for i in range(n):
x = x + X[n - 1 - i] * Nico
Nico = Nico * b
n, b = list(map(int, input().split(' ')))
Y = list(map(int, input().split(' ')))
Nico = 1
y = 0
for i in range(n):
y = y + Y[n - 1 - i] * Nico
Nico = Nico * b
if (x < y):
print("<")
if (x == y):
print("=")
if (x > y):
print(">")
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
map<int, int> g;
int b[100005], f[100005] = {};
int x[11], y[11];
int main() {
long long n, m, bx, by, tx = 0, ty = 0;
cin >> n >> bx;
for (int i = 0; i < n; i++) {
cin >> x[i];
tx *= bx;
tx += x[i];
}
cin >> m >> by;
for (int i = 0; i < m; i++) {
cin >> y[i];
ty *= by;
ty += y[i];
}
if (tx > ty) cout << ">";
if (tx == ty) cout << "=";
if (tx < ty) cout << "<";
}
| 7 | CPP |
def anyToDecimal(num,n):
baseStr = {"0":0,"1":1,"2":2,"3":3,"4":4,"5":5,"6":6,"7":7,"8":8,"9":9,
"10":10,"11":11,"12":12,"13":13,"14":14,"15":15,"16":16,"17":17,"18":18,"19":19,
"20":20,"21":21,"22":22,"23":23,"24":24,"25":25,"26":26,"27":27,"28":28,"29":29,
"30":30,"31":31,"32":32,"33":33,"34":34,"35":35,"36":36,"37":37,"38":38,"39":39,
"40":40}
new_num = 0
nNum = len(num) - 1
for i in num:
new_num = new_num + baseStr[i]*pow(n,nNum)
nNum = nNum -1
return new_num
n1=list(map(int,input().split()))
x=list(map(str,input().split()))
n2=list(map(int,input().split()))
y=list(map(str,input().split()))
# print(x,n1[1])
ans_x=anyToDecimal(x, n1[1])
ans_y=anyToDecimal(y, n2[1])
if ans_x>ans_y:
print(">")
elif ans_x<ans_y:
print("<")
else:
print("=") | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, bx, m, by, i, j, arr1[1000], arr2[1000];
long long a[1000], b[1000], cnt1 = 1, cnt2 = 1, ans1 = 0, ans2 = 0;
cin >> n >> bx;
for (i = 0; i < n; i++) {
cin >> arr1[i];
a[i] = cnt1;
cnt1 *= bx;
}
cin >> m >> by;
for (i = 0; i < m; i++) {
cin >> arr2[i];
b[i] = cnt2;
cnt2 *= by;
}
for (i = n - 1, j = 0; i >= 0, j < n; i--, j++) {
if (arr1[i] != 0) ans1 += (a[j] * arr1[i]);
}
for (i = m - 1, j = 0; i >= 0, j < m; i--, j++) {
if (arr2[i] != 0) ans2 += (b[j] * arr2[i]);
}
if (ans1 < ans2)
cout << "<"
<< "\n";
else if (ans1 > ans2)
cout << ">"
<< "\n";
else
cout << "="
<< "\n";
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
using namespace std;
long long fun(int n, int base) {
vector<int> v(n);
for (auto& i : v) cin >> i;
long long res = 0;
for (int i = n - 1; i >= 0; i--) {
res += pow(base, n - i - 1) * v[i];
}
return res;
}
int main() {
int x, bx;
cin >> x >> bx;
long long sumX = fun(x, bx);
int y, by;
cin >> y >> by;
long long sumY = fun(y, by);
if (sumX == sumY)
cout << "=";
else
cout << (sumX > sumY ? '>' : '<');
return 0;
}
| 7 | CPP |
ans=[]
for i in range(2):
(n,b),data=map(int,input().split()),list(map(int, input().split()))
data.reverse();
t=0
j=0
for i in range(n):
t+=data[i]*(b**j)
j+=1
ans.append(t)
# print(ans[0],"...",ans[1])
if ans[0]>ans[1]:
print(">")
elif ans[0]<ans[1]:
print("<")
else:
print("=")
| 7 | PYTHON3 |
#include <bits/stdc++.h>
#pragma comment(linker, "/stack:20000000")
using namespace std;
double __begin;
template <typename T1, typename T2, typename T3>
struct triple {
T1 a;
T2 b;
T3 c;
triple(){};
triple(T1 _a, T2 _b, T3 _c) : a(_a), b(_b), c(_c) {}
};
template <typename T1, typename T2, typename T3>
bool operator<(const triple<T1, T2, T3>& t1, const triple<T1, T2, T3>& t2) {
if (t1.a != t2.a)
return t1.a < t2.a;
else if (t1.b != t2.b)
return t1.b < t2.b;
else
return t1.c < t2.c;
}
template <typename T1, typename T2, typename T3>
inline std::ostream& operator<<(std::ostream& os, const triple<T1, T2, T3>& t) {
return os << "(" << t.a << ", " << t.b << ", " << t.c << ")";
}
inline int bits_count(int v) {
v = v - ((v >> 1) & 0x55555555);
v = (v & 0x33333333) + ((v >> 2) & 0x33333333);
return ((v + (v >> 4) & 0xF0F0F0F) * 0x1010101) >> 24;
}
inline int bits_count(long long v) {
int t = v >> 32;
int p = (v & ((1LL << 32) - 1));
return bits_count(t) + bits_count(p);
}
unsigned int reverse_bits(register unsigned int x) {
x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1));
x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2));
x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4));
x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8));
return ((x >> 16) | (x << 16));
}
inline int sign(int x) { return x > 0; }
inline bool isPowerOfTwo(int x) { return (x != 0 && (x & (x - 1)) == 0); }
template <typename T1, typename T2>
inline std::ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p) {
return os << "(" << p.first << ", " << p.second << ")";
}
template <typename T>
inline std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) {
bool first = true;
os << "[";
for (unsigned int i = 0; i < v.size(); i++) {
if (!first) os << ", ";
os << v[i];
first = false;
}
return os << "]";
}
template <typename T>
inline std::ostream& operator<<(std::ostream& os, const std::set<T>& v) {
bool first = true;
os << "[";
for (typename std::set<T>::const_iterator ii = v.begin(); ii != v.end();
++ii) {
if (!first) os << ", ";
os << *ii;
first = false;
}
return os << "]";
}
template <typename T1, typename T2>
inline std::ostream& operator<<(std::ostream& os, const std::map<T1, T2>& v) {
bool first = true;
os << "[";
for (typename std::map<T1, T2>::const_iterator ii = v.begin(); ii != v.end();
++ii) {
if (!first) os << ", ";
os << *ii;
first = false;
}
return os << "]";
}
template <typename T, typename T2>
void printarray(T a[], T2 sz, T2 beg = 0) {
for (T2 i = beg; i < sz; i++) cout << a[i] << " ";
cout << endl;
}
inline long long mulmod(long long x, long long n, long long _mod) {
long long res = 0;
while (n) {
if (n & 1) res = (res + x) % _mod;
x = (x + x) % _mod;
n >>= 1;
}
return res;
}
inline long long powmod(long long x, long long n, long long _mod) {
long long res = 1;
while (n) {
if (n & 1) res = (res * x) % _mod;
x = (x * x) % _mod;
n >>= 1;
}
return res;
}
inline long long gcd(long long a, long long b) {
long long t;
while (b) {
a = a % b;
t = a;
a = b;
b = t;
}
return a;
}
inline int gcd(int a, int b) {
int t;
while (b) {
a = a % b;
t = a;
a = b;
b = t;
}
return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
inline long long gcd(long long a, long long b, long long c) {
return gcd(gcd(a, b), c);
}
inline int gcd(int a, int b, int c) { return gcd(gcd(a, b), c); }
template <class T>
inline void cinarr(T& a, int n) {
for (int i = 0; i < n; ++i) cin >> a[i];
}
inline unsigned long long convert_decimal(int N, int base, int arr[]) {
unsigned long long sum = 0;
for (int i = 1; i <= N; i++) {
sum = sum * base + arr[i - 1];
}
return sum;
}
int main() {
int N, base;
cin >> N >> base;
int arr[N];
for (int i = 0; i < N; i++) cin >> arr[i];
int N1, base1;
cin >> N1 >> base1;
int arr1[N1];
for (int i = 0; i < N1; i++) cin >> arr1[i];
unsigned long long sum = convert_decimal(N, base, arr);
unsigned long long sum1 = convert_decimal(N1, base1, arr1);
if (sum == sum1) printf("=\n");
if (sum > sum1) printf(">\n");
if (sum < sum1) printf("<\n");
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long n, bx, x, m, by, y;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> bx;
x = 0;
for (int i = 0; i < n; i++) {
int t = 0;
cin >> t;
x = bx * x + t;
}
cin >> m >> by;
y = 0;
for (int i = 0; i < m; i++) {
int t = 0;
cin >> t;
y = by * y + t;
}
if (x == y) cout << "=" << endl;
if (x < y) cout << "<" << endl;
if (x > y) cout << ">" << endl;
return 0;
}
| 7 | CPP |
n, bx = map(int, input().split(" "))
vx = list(map(int, input().split(" ")))
res = 0
for i in range(n):
res = res * bx + vx[i]
n, bx = map(int, input().split(" "))
vx = list(map(int, input().split(" ")))
ret = 0
for i in range(n):
ret = ret * bx + vx[i]
if res == ret:
print("=")
else:
print(">" if res > ret else "<")
| 7 | PYTHON3 |
import sys
n,bx = map(int,input().split())
x = list(map(int,input().split()))
m,by = map(int,input().split())
y = list(map(int,input().split()))
res1 = res2 = 0
a = b = 0
for i in range(n-1,-1,-1):
res1 += x[i] * (bx ** a)
a += 1
for j in range(m-1,-1,-1):
res2 += y[j] * (by ** b)
b += 1
if(res1 < res2):
print('<')
elif(res1 > res2):
print('>')
else:
print('=') | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long int my_pow(long long int num, long long int z) {
long long int p = 1;
for (int i = 0; i < z; i++) {
p *= num;
}
return p;
}
int main() {
long long int n, bx;
cin >> n >> bx;
long long int x = 0;
for (long long int i = 0; i < n; i++) {
long long int x_cur;
cin >> x_cur;
x += x_cur * my_pow(bx, n - i - 1);
}
long long int m, by;
cin >> m >> by;
long long int y = 0;
for (long long int i = 0; i < m; i++) {
long long int y_cur;
cin >> y_cur;
y += y_cur * my_pow(by, m - i - 1);
}
if (x == y) {
cout << "=";
} else if (x < y) {
cout << "<";
} else {
cout << ">";
}
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long ans[2];
int main() {
for (int i = 0; i < 2; i++) {
int n, b;
cin >> n >> b;
for (int j = 0; j < n; j++) {
int t;
cin >> t;
ans[i] *= b, ans[i] += t;
}
}
if (ans[0] < ans[1])
cout << "<";
else if (ans[0] == ans[1])
cout << "=";
else
cout << ">";
cout << "\n";
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
long long a = 0, b = 0, c, i, base, cur;
int n;
scanf("%d %I64d", &n, &base);
cur = 1;
for (i = 1; i < n; ++i) cur *= base;
for (i = 0; i < n; ++i) {
scanf("%I64d", &c);
a += c * cur;
cur /= base;
}
scanf("%d %I64d", &n, &base);
cur = 1;
for (i = 1; i < n; ++i) cur *= base;
for (i = 0; i < n; ++i) {
scanf("%I64d", &c);
b += c * cur;
cur /= base;
}
if (a < b)
printf("<\n");
else if (a == b)
printf("=\n");
else
printf(">\n");
return 0;
}
| 7 | CPP |
n, bx = list(map(int, input().split()))
x = []
x = list(map(int, input().split()))
m, by = list(map(int, input().split()))
y = []
y = list(map(int, input().split()))
xk = 1
yk = 1
X = 0
Y = 0
for i in range(n - 1, -1, -1):
X += xk * x[i]
xk *= bx
for i in range(m - 1, -1, -1):
Y += yk * y[i]
yk *= by
if X < Y:
print('<')
if X > Y:
print('>')
if X == Y:
print('=')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
long long a[10000];
long long c[10000];
using namespace std;
int main() {
int n, m, n2, m2;
scanf("%d%d", &n, &m);
for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
long long sum = 0, t = 1;
for (int i = n - 1; i >= 0; i--) {
sum += a[i] * t;
t *= m;
}
scanf("%d%d", &n2, &m2);
for (int i = 0; i < n2; i++) scanf("%lld", &c[i]);
long long sum2 = 0, t2 = 1;
for (int i = n2 - 1; i >= 0; i--) {
sum2 += c[i] * t2;
t2 *= m2;
}
if (sum == sum2) printf("=\n");
if (sum < sum2) printf("<\n");
if (sum > sum2) printf(">\n");
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
const int MAX = 50;
long long dp[MAX];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, x;
cin >> n >> x;
long long r = 0;
dp[0] = 1;
for (int i = 1; i < n; i++) dp[i] = dp[i - 1] * x;
for (int i = n - 1; i >= 0; i--) {
int tmp;
cin >> tmp;
r += tmp * dp[i];
}
int m, y;
cin >> m >> y;
long long l = 0;
for (int i = 1; i < m; i++) dp[i] = dp[i - 1] * y;
for (int i = m - 1; i >= 0; i--) {
int tmp;
cin >> tmp;
l += tmp * dp[i];
}
if (r == l)
cout << '=';
else if (r > l)
cout << '>';
else
cout << '<';
}
| 7 | CPP |
n,x = map(int,input().split())
arrx = list(map(int,input().split()))
m,y = map(int,input().split())
arry = list(map(int,input().split()))
sumx=sumy=0
for i in range(n):
sumx += pow(x,n-1-i)*arrx[i]
for j in range(m):
sumy += pow(y,m-1-j)*arry[j]
if sumx>sumy:
print('>')
elif sumx<sumy:
print('<')
else:
print('=') | 7 | PYTHON3 |
l = [int(x) for x in input().split()]
n, bx = l[0], l[1]
a = [int(x) for x in input().split()]
xx = 0
for y in a:
xx *= bx
xx += y
l = [int(x) for x in input().split()]
m, by = l[0], l[1]
b = [int(x) for x in input().split()]
yy = 0
for y in b:
yy *= by
yy += y
if(xx < yy):
print("<")
elif (xx == yy):
print("=")
else:
print(">")
| 7 | PYTHON3 |
#include <bits/stdc++.h>
int main() {
int n, b;
int data[10];
unsigned long long v1 = 0, v2 = 0;
int i;
unsigned long long mul;
scanf("%d", &n);
scanf("%d", &b);
for (i = 0; i < n; i++) scanf("%d", &data[i]);
mul = 1;
for (i = n - 1; i >= 0; i--) {
v1 += mul * data[i];
mul *= b;
}
scanf("%d", &n);
scanf("%d", &b);
for (i = 0; i < n; i++) scanf("%d", &data[i]);
mul = 1;
for (i = n - 1; i >= 0; i--) {
v2 += mul * data[i];
mul *= b;
}
if (v1 > v2) printf(">");
if (v1 == v2) printf("=");
if (v1 < v2) printf("<");
}
| 7 | CPP |
def main():
res = []
for _ in range(2):
_, b = map(int, input().split())
x = 0
for s in input().split():
x = x * b + int(s)
res.append(x)
print(">" if res[0] > res[1] else "<" if res[0] < res[1] else "=")
if __name__ == '__main__':
main()
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int n, b, x;
long long res1, res2;
int main() {
scanf("%d%d", &n, &b);
for (int i = 0; i < n; i++) {
scanf("%d", &x);
res1 = res1 * b + x;
}
scanf("%d%d", &n, &b);
for (int i = 0; i < n; i++) {
scanf("%d", &x);
res2 = res2 * b + x;
}
if (res1 == res2)
puts("=");
else if (res1 < res2)
puts("<");
else
puts(">");
return 0;
}
| 7 | CPP |
def STR(): return list(input())
def INT(): return int(input())
def MAP(): return map(int, input().split())
def MAP2():return map(float,input().split())
def LIST(): return list(map(int, input().split()))
def STRING(): return input()
import string
import sys
from heapq import heappop , heappush
from bisect import *
from collections import deque , Counter , defaultdict
from math import *
from itertools import permutations , accumulate
dx = [-1 , 1 , 0 , 0 ]
dy = [0 , 0 , 1 , - 1]
#visited = [[False for i in range(m)] for j in range(n)]
#sys.stdin = open(r'input.txt' , 'r')
#sys.stdout = open(r'output.txt' , 'w')
#for tt in range(INT()):
#CODE
n , a = MAP()
l1 = LIST()
r1 = 0
for i in l1:
r1 += i* a **(n - 1)
n-=1
m , b = MAP()
l2 = LIST()
r2 = 0
for i in l2:
r2 += i * b ** (m - 1)
m -= 1
#print(r1)
#print(r2)
if r1 > r2 :
print('>')
elif r1 < r2 :
print('<')
else:
print('=')
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, bx;
scanf("%d %d", &n, &bx);
int n1 = n - 1;
int i, x;
long long int s = 0, k = 1;
while (n1 > 0) {
k *= bx;
n1--;
}
for (i = 0; i < n; i++) {
scanf("%d", &x);
s += k * x;
k /= bx;
}
scanf("%d %d", &n, &bx);
n1 = n - 1;
k = 1;
long long int s1 = 0;
while (n1 > 0) {
k *= bx;
n1--;
}
for (i = 0; i < n; i++) {
scanf("%d", &x);
s1 += k * x;
if (s1 > s) break;
k /= bx;
}
if (s1 > s) printf("<");
if (s1 < s) printf(">");
if (s1 == s) printf("=");
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
long long a[100005];
long long b[100005];
long long pow(long long a, long long b) {
long long ans = 1;
long long t = a;
while (b != 0) {
if (b & 1) ans = (ans * t);
t = (t * t);
b = b >> 1;
}
return ans;
}
int main() {
long long n;
cin >> n;
long long b1;
cin >> b1;
for (int i = 0; i < n; i++) cin >> a[i];
long long m;
cin >> m;
long long b2;
cin >> b2;
for (int i = 0; i < m; i++) cin >> b[i];
long long n1 = 0;
{
for (int i = 0; i < n; i++) {
n1 += a[i] * pow(b1, n - i - 1);
}
}
long long n2 = 0;
{
for (int i = 0; i < m; i++) {
n2 += b[i] * pow(b2, m - i - 1);
}
}
if (n1 > n2)
cout << ">";
else if (n1 < n2)
cout << "<";
else
cout << "=";
cout << endl;
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, x, m, y, b;
cin >> n >> x;
unsigned long long ans1 = 0;
for (int i = 0; i < n; i++) {
cin >> b;
ans1 *= x;
ans1 += b;
}
cin >> m >> y;
unsigned long long ans2 = 0;
for (int i = 0; i < m; i++) {
cin >> b;
ans2 *= y;
ans2 += b;
}
if (ans1 < ans2)
cout << "<" << endl;
else if (ans1 > ans2)
cout << ">" << endl;
else
cout << "=" << endl;
return 0;
}
| 7 | CPP |
def convert_base(s: str, base: int):
digits = list(map(int, s.strip().split()))
return sum(
digit * base ** (len(digits) - position - 1)
for position, digit in enumerate(digits)
)
n, bx = map(int, input().strip().split())
x = convert_base(input(), bx)
m, by = map(int, input().strip().split())
y = convert_base(input(), by)
if x == y:
print("=")
elif x < y:
print("<")
else:
print(">")
| 7 | PYTHON3 |
n,k = map(int,input().split())
a = list(map(int,input().split()))
m,k1 = map(int,input().split())
b = list(map(int,input().split()))
a = a[::-1]
b = b[::-1]
s1 = 0
for i in range(n):
s1 += pow(k,i)*a[i]
s2 = 0
for i in range(m):
s2 += pow(k1,i)*b[i]
if s1 > s2:
print(">")
elif s1 < s2:
print("<")
else:
print("=")
| 7 | PYTHON3 |
#include <bits/stdc++.h>
int x[10], y[10];
int main() {
int n, m, bx, by;
long long xx, yy, b;
scanf("%d%d", &n, &bx);
for (int i = n - 1; i >= 0; i--) scanf("%d", &x[i]);
scanf("%d%d", &m, &by);
for (int i = m - 1; i >= 0; i--) scanf("%d", &y[i]);
xx = 0LL;
b = 1LL;
for (int i = 0; i < n; i++) {
xx += b * x[i];
b *= bx;
}
yy = 0LL;
b = 1LL;
for (int i = 0; i < m; i++) {
yy += b * y[i];
b *= by;
}
if (xx == yy)
puts("=");
else if (xx < yy)
puts("<");
else
puts(">");
return 0;
}
| 7 | CPP |
n, b = map(int, input().split())
curr = 1
c1 = 0
a = [int(i) for i in input().split()]
a = a[::-1]
for i in range(n):
c1 += a[i] * curr
curr *= b
n, b = map(int, input().split())
curr = 1
c2 = 0
a = [int(i) for i in input().split()]
a = a[::-1]
for i in range(n):
c2 += a[i] * curr
curr *= b
if (c1 < c2):
print('<')
elif (c1 == c2):
print('=')
else:
print('>') | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
int64_t pow_nik(int64_t a, int64_t b) {
int64_t result = 1;
for (int i = 0; i < b; i++) {
result *= a;
}
return result;
}
int64_t other_to_dec(int64_t ar[], int size, int osnovanie) {
int64_t dec = 0;
int64_t result_dec = 0;
int cnt = size;
for (int i = 0; i < size; i++) {
dec = ar[i] * pow_nik(osnovanie, cnt - 1);
cnt--;
result_dec = result_dec + dec;
}
return result_dec;
}
int main() {
int n1 = 0;
int b1 = 0;
int64_t x[40];
int n2 = 0;
int b2 = 0;
int64_t y[40];
cin >> n1;
cin >> b1;
for (int i = 0; i < n1; i++) {
cin >> x[i];
}
cin >> n2;
cin >> b2;
for (int i = 0; i < n2; i++) {
cin >> y[i];
}
if (other_to_dec(x, n1, b1) == other_to_dec(y, n2, b2)) {
cout << "=";
} else if (other_to_dec(x, n1, b1) > other_to_dec(y, n2, b2)) {
cout << ">";
} else if (other_to_dec(x, n1, b1) < other_to_dec(y, n2, b2)) {
cout << "<";
}
return 0;
}
| 7 | CPP |
firstline = [int(x) for x in input().split()]
firstnum = 0
for digit in input().split():
firstnum *= firstline[1]
firstnum += int(digit)
secondline = [int(x) for x in input().split()]
secondnum = 0
for digit in input().split():
secondnum *= secondline[1]
secondnum += int(digit)
if (firstnum > secondnum):
print('>')
if (firstnum == secondnum):
print('=')
if (firstnum < secondnum):
print('<')
| 7 | PYTHON3 |
n1,b1=map(int,input().split())
a1=list(map(int,input().split()))
a1.reverse()
n2,b2=map(int,input().split())
a2=list(map(int,input().split()))
a2.reverse()
x=0
y=0
import math
for i in range(n1):
x+=(a1[i]*math.pow(b1,i))
for i in range(n2):
y+=(a2[i]*math.pow(b2,i))
if(x==y):
print("=")
elif(x<y):
print("<")
elif (x>y):
print(">")
| 7 | PYTHON3 |
#Two Bases.py
import os
import sys
while True:
l = ""
for line in sys.stdin:
l = line
break
if l != "":
n, bx = map(int, l.split())
x = 0
lx = input().split();
for i in range(0, n):
x = x * bx + int(lx[i])
m, by = map(int, input().split())
y = 0
ly = input().split();
for i in range(0, m):
y = y * by + int(ly[i])
# print(x)
# print(y)
if x > y:
print(">")
elif x < y:
print("<")
else:
print("=")
else:
break | 7 | PYTHON3 |
def get_number(digits, base):
number = 0
multiplier = 1
for digit in reversed(digits):
number += digit * multiplier
multiplier *= base
return number
def main():
n, b_x = [int(t) for t in input().split()]
digits_x = [int(t) for t in input().split()]
n, b_y = [int(t) for t in input().split()]
digits_y = [int(t) for t in input().split()]
x = get_number(digits_x, b_x)
y = get_number(digits_y, b_y)
if x == y:
print('=')
if x < y:
print('<')
if x > y:
print('>')
if __name__ == '__main__':
main()
| 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2 * 100 * 1000 + 17, inf = 1e9;
long long n, m, x[MAXN], y[MAXN], X, Y, bx, by;
int main() {
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
cin >> n >> bx;
long long t = 1;
for (int i = n; i > 0; i--) cin >> x[i];
for (int i = 1; i <= n; i++) X += t * x[i], t *= bx;
cin >> m >> by;
t = 1;
for (int i = m; i > 0; i--) cin >> y[i];
for (int i = 1; i <= m; i++) Y += t * y[i], t *= by;
cerr << X << " " << Y << endl;
if (X < Y)
cout << '<';
else if (X > Y)
cout << '>';
else
cout << '=';
return 0;
}
| 7 | CPP |
def f(a, x):
n = len(a)
res = 0
for i in range(n):
res+=a[i]*x**(n-i-1)
return res
n, bx=map(int, input().split())
a = list(map(int, input().split()))
res1=f(a, bx)
n, bx=map(int, input().split())
a = list(map(int, input().split()))
res2=f(a, bx)
if res1==res2:
print('=')
elif res1>res2:
print('>')
else:
print('<') | 7 | PYTHON3 |
#include <bits/stdc++.h>
using namespace std;
long long power(long long n, long long a) {
if (n <= 0)
return 1;
else {
long long v = power(n / 2, a);
v = v * v;
if (n & 1) return v * a;
return v;
}
}
int main() {
long long n, i, b, v, x = 0, y = 0;
cin >> n >> b;
for (i = 1; i <= n; i++) {
cin >> v;
x += v * power(n - i, b);
}
cin >> n >> b;
for (i = 1; i <= n; i++) {
cin >> v;
y += v * power(n - i, b);
}
if (x == y)
cout << "=\n";
else if (x > y)
cout << ">\n";
else
cout << "<\n";
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
long long n, a;
cin >> n >> a;
long long a1[n];
for (int i = 0; i < n; i++) {
cin >> a1[i];
}
long long m, b;
cin >> m >> b;
long long b1[m];
for (int i = 0; i < m; i++) {
cin >> b1[i];
}
reverse(a1, a1 + n);
reverse(b1, b1 + m);
long long p1 = 0, p2 = 0;
for (int i = 0; i < n; i++) {
p1 += a1[i] * pow(a, i);
}
for (int i = 0; i < m; i++) {
p2 += b1[i] * pow(b, i);
}
if (p1 > p2)
cout << ">" << endl;
else if (p1 < p2)
cout << "<" << endl;
else
cout << "=" << endl;
}
| 7 | CPP |
def num():
a ,b = map(int,input().split())
n=0
for i in map(int,input().split()):
n = n*b + i
return n
n1 = num()
n2 = num()
if n1==n2:
print("=")
elif n1>n2:
print(">")
else:
print("<")
| 7 | PYTHON3 |
#include <bits/stdc++.h>
long long ipow(long long base, long long exp) {
long long result = 1;
while (exp) {
if (exp & 1) result *= base;
exp >>= 1;
base *= base;
}
return result;
}
using namespace std;
int main() {
int i, j;
long long x = 0, y = 0, bx, by;
long long inp, n;
cin >> n >> bx;
for (i = n - 1; i >= 0; i--) {
cin >> inp;
x += inp * ipow(bx, i);
}
cin >> n >> by;
for (i = n - 1; i >= 0; i--) {
cin >> inp;
y += inp * ipow(by, i);
}
if (x == y) cout << "=";
if (x > y) cout << ">";
if (x < y) cout << "<";
return 0;
}
| 7 | CPP |
#include <bits/stdc++.h>
using namespace std;
int n, bx, m, by;
int x[50], y[50];
long long my_pow(long long a, long long n) {
long long ans = 1;
for (int i = 1; i <= n; i++) ans *= a;
return ans;
}
int main() {
cin >> n >> bx;
for (int i = 1; i <= n; i++) scanf("%d", &x[i]);
cin >> m >> by;
for (int i = 1; i <= m; i++) scanf("%d", &y[i]);
long long ansx = 0, ansy = 0;
for (int i = 1; i <= n; i++) ansx += (long long)x[i] * my_pow(bx, n - i);
for (int i = 1; i <= m; i++) ansy += (long long)y[i] * my_pow(by, m - i);
if (ansx > ansy)
cout << ">" << endl;
else if (ansx < ansy)
cout << "<" << endl;
else
cout << "=" << endl;
return 0;
}
| 7 | CPP |
import sys
import math
import bisect
def main():
n, b1 = map(int, input().split())
x = 0
for a in list(map(int, input().split())):
x = x * b1 + a
n, b2 = map(int, input().split())
y = 0
for a in list(map(int, input().split())):
y = y * b2 + a
if x == y:
print('=')
elif x > y:
print('>')
elif x < y:
print('<')
if __name__ == "__main__":
main()
| 7 | PYTHON3 |
def to_int(b, arr):
d = 1
r = 0
for x in arr:
r += d * x
d *= b
return r
n, bx = map(int, input().split())
xd = [int(i) for i in input().split()][::-1]
n, by = map(int, input().split())
yd = [int(i) for i in input().split()][::-1]
x = to_int(bx, xd)
y = to_int(by, yd)
if x < y:
print('<')
elif x == y:
print('=')
else:
print('>')
| 7 | PYTHON3 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.