Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input()))
t=1
p=a[0]
m=0
for i in a:
  if(p==i):
    continue
  if(m>0):
    if(i<p):
      t+=1
      m=0
  elif(m<0):
    if(i>p):
      t+=1
      m=0
  else:
    if(i>p):
      m=1
    elif(i<p):
      m=-1
  p=i
print(t)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
t=1
p=a[0]
m=0
for i in a:
  if(p==i):
    continue
  if(m>0):
    if(i<p):
      t+=1
      m=0
  elif(m<0):
    if(i>p):
      t+=1
      m=0
  else:
    if(i>p):
      m=1
    elif(i<p):
      m=-1
  p=i
print(t)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input()))
t=1
p=a[0]
m=0
for i in a:
  if(p==i):
    continue
  if(m>0):
    if(i<p):
      t+=1
      m=0
  elif(m<0):
    if(i>p):
      t+=1
      m=0
  else:
    if(i>p):
      m=1
    eif(i<p):
      m=-1
  p=i
print(t)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
t=1
p=a[0]
m=0
for i in a:
  if(p==i):
    continue
  if(m>0):
    if(i<p):
      t+=1
      m=0
  elif(m<0):
    if(i>p):
      t+=1
      m=0
  else:
    if(i>p):
      m=1
    elif(i<p):
      m=-1
  p=i
print(t)
Buggy python submission (verdict: Runtime Error):
f=lambda x:int(x)%2
n=int(input())
a=list(map(f,input().split())).count(1)
print([YNEOS][n>1 and a%2>0::2])

Fixed submission:
f=lambda x:int(x)%2
n=int(input())
a=list(map(f,input().split())).count(1)
print('YNEOS'[n>1 and a%2>0::2])

Buggy python submission (verdict: Runtime Error):
f=lambda x:int(x)%2
n=int(input())
a=list(map(f,input().split())).count(1)
print([YNEOS][n>1 and a%2>0::2]

Fixed submission:
f=lambda x:int(x)%2
n=int(input())
a=list(map(f,input().split())).count(1)
print('YNEOS'[n>1 and a%2>0::2])
Buggy python submission (verdict: Runtime Error):
n=int(input())
c=[list(map(int,unput().split())) for _ in [0]*n].reverse()
t=0
for i in c:
  a=c[0]
  b=c[2]
  t+=b-1-(a+t-1)%b
print(t)

Fixed submission:
c=list(reversed([list(map(int,input().split())) for _ in [0]*int(input())]))
t=0
for i in c:
  a=i[0]
  b=i[1]
  t+=b-1-(a+t-1)%b
print(t)
Buggy python submission (verdict: Runtime Error):
s=input()
print('YES' if s=='5 5 7'||s=='5 7 5'||s=='7 5 5' else 'NO')

Fixed submission:
s=input()
print('YES' if s=='5 5 7' or s=='5 7 5' or s=='7 5 5' else 'NO')
Buggy python submission (verdict: Time Limit Exceeded):
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    mod = 998244353
    N, K = iim()
    it = map(int, sys.stdin.read().split())
    A = [0] * N
    A[0] = 1

    B = []
    for l, r in zip(it, it):
        for x in range(l, r+1):
            B.append(x)

    B.sort()
    for i in range(N-1):
        if A[i] == 0:
            continue
        for j in B:
            k = i + j
            if k >= N:
                break
            A[k] = (A[k] + A[i]) % mod

    print(A[-1])


if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    mod = 998244353
    N, K = iim()
    it = map(int, sys.stdin.read().split())
    B = list(zip(it, it))

    N1 = N+1 if N&1 else N
    N2 = 1<<(N.bit_length())
    NN2 = N1 + N2
    A = [0] * NN2

    def add(a, i, j, x):
        i += N2; j += N2
        while i < j:
            if i & 1:
                A[i] = (A[i] + x) % mod
                i += 1
            if not j & 1:
                A[j] = (A[j] + x) % mod
                j -= 1
            i >>= 1; j >>= 1
        if i == j:
            A[i] = (A[i] + x) % mod

    def get(a, i):
        i += N2
        ans = 0
        while i > 0:
            ans = (ans + A[i]) % mod
            i >>= 1
        return ans

    A[N2] = 1

    B.sort()
    for i in range(N-1):
        x = get(A, i)
        for a, b in B:
            a += i; b += i
            if a > N-1: continue
            b = min(b, N-1)
            add(A, a, b, x)

    print(get(A, N-1))


if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    N, Q = iim()
    it = map(int, sys.stdin.read().split())

    N2 = N - 2
    cc = [N-1] * 2
    ans = (N-2)**2
    A = [[N2]*(N2) for i in range(2)]

    for q, i in zip(it, it):
        q -= 1; i -= 2
        #print(q, i, N2)
        val = A[q][i]
        ans -= val
        aa = A[q^1]
        for j in range(val):
            aa[j] = min(aa[j], i)
        #print(ans, A)
    print(ans)


if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    N, Q = iim()
    it = map(int, sys.stdin.read().split())

    M = N + 1if N & 1 else N
    NM = 1<<M.bit_length()
    ans = (N-2)**2
    A = [[N-2]*(NM+M) for i in range(2)]

    def set(a, i, j, x):
        i += NM; j += NM
        while i < j:
            a[i] = min(a[i], x)
            if i&1:
                i += 1
            a[j] = min(a[j], x)
            if j&1 == 0:
                j -= 1
            i >>= 1; j >>= 1
        a[i] = min(a[i], x)
    def get(a, i):
        i += NM
        ans = a[i]
        while i > 0:
            i >>= 1
            ans = min(ans, a[i])
        return ans

    for q, i in zip(it, it):
        q -= 1; i -= 2
        val = get(A[q], i)
        ans -= val
        set(A[q^1], 0, val, i)
    print(ans)


if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def cmb_mod(N, mod=10**9+7):
    N1 = N + 1
    g1 = [0] * N1
    g2 = [0] * N1
    inv = [0] * N1
    g1[0] = g1[1] = g2[0] = g2[1] = inv[1] = 1

    for i in range(2, N1):
        g1[i] = g1[i-1] * i % mod
        inv[i] = -inv[mod % i ] * (mod//i) % mod
        #inv[i] = pow(g1[i-1], mod-2, mod)
        g2[i] = g2[i-1] * inv[i] % mod

    def cmb(n, a):
        if a < 0 or a > n:
            return 0
        return g1[n] * g2[a] * g2[n-a] % mod
    return cmb

def resolve():
    mod = 10**9 + 7
    S = int(input())

    if S < 3:
        print(0)
        return

    cmb = cmb_mod(S - 3 * 2 + 2)

    ans = 1
    for i in range(2, S//3+1):
        n = S - 3 * i + i - 1
        tmp = cmb(n, i - 1)
        ans = (ans + tmp) % mod
    print(ans)


if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def cmb_mod(N, mod=10**9+7):
    N1 = N + 1
    g1 = [0] * N1
    g2 = [0] * N1
    inv = [0] * N1
    g1[0] = g1[1] = g2[0] = g2[1] = inv[1] = 1

    for i in range(2, N1):
        g1[i] = g1[i-1] * i % mod
        inv[i] = -inv[mod % i ] * (mod//i) % mod
        #inv[i] = pow(g1[i-1], mod-2, mod)
        g2[i] = g2[i-1] * inv[i] % mod

    def cmb(n, a):
        if a < 0 or a > n:
            return 0
        return g1[n] * g2[a] * g2[n-a] % mod
    return cmb

def resolve():
    mod = 10**9 + 7
    S = int(input())

    if S < 3:
        print(0)
        return
    elif S < 6:
        print(1)
        return

    cmb = cmb_mod(S - 3 * 2 + 3)

    ans = 1
    for i in range(2, S//3+1):
        n = S - 3 * i + i - 1
        tmp = cmb(n, i - 1)
        ans = (ans + tmp) % mod
    print(ans)


if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N, S = iim()
    A = list(iim())
    mod = 998244353
    S1 = S + 1

    dp = [0] * (S+1)
    dp1 = dp[:]
    dp[0] = 1
    for ai in A:
        sa = S - ai
        for i in range(sa):
            dp1[i] = 2 * dp[i]
        for i in range(sa, S1):
            dp1[i] = 2 * dp[i] + dp[i-ai]
        dp, dp1 = dp1, dp

    print(dp[-1])


if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N, S = iim()
    A = list(iim())
    mod = 998244353
    S1 = S + 1

    dp = [0] * (S+1)

    dp[0] = pow(2, N, mod)
    inv = pow(2, mod-2, mod)

    for ai in A:
        for i in range(S, ai-1, -1):
            dp[i] = (dp[i] + dp[i-ai]*inv) % mod

    print(dp[-1])


if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Runtime Error):
#!python3

iim = lambda: map(int, input().rstrip().split())
from collections import defaultdict

def resolve():
    N, S = iim()
    A = list(iim())
    mod = 998244353

    dp = [0] * (S+1)
    dp1 = dp[:]
    dp[0] = 1
    for ai in A:
        for i in range(ai):
            dp1[i] = 2 * dp[i]
        for i in range(ai, S+1):
            dp1[i] = 2 * dp[i] + dp[i-ai]
        dp, dp1 = dp1, dp

    print(dp[-1])


if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N, S = iim()
    A = list(iim())
    mod = 998244353
    S1 = S + 1

    dp = [0] * (S+1)

    dp[0] = pow(2, N, mod)
    inv = pow(2, mod-2, mod)

    for ai in A:
        for i in range(S, ai-1, -1):
            dp[i] = (dp[i] + dp[i-ai]*inv) % mod

    print(dp[-1])


if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
#!python3

iim = lambda: map(int, input().rstrip().split())
from collections import defaultdict

def resolve():
    N, S = iim()
    A = list(iim())
    mod = 998244353

    dp0 = [[]]
    ans = 0
    T  = [defaultdict(int, [(0, 1)])]
    for ai in A:
        tmp = []
        for t1 in T:
            t2 = t1.copy()
            for k, v in t1.items():
                if k + ai > S:
                    continue
                t2[k+ai] += v
                t2[k+ai] %= mod
            tmp.append(t2)

            ans += t2[S]
            ans %= mod

        T += tmp

    print(ans)


if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N, S = iim()
    A = list(iim())
    mod = 998244353
    S1 = S + 1

    dp = [0] * (S+1)

    dp[0] = pow(2, N, mod)
    inv = pow(2, mod-2, mod)

    for ai in A:
        for i in range(S, ai-1, -1):
            dp[i] = (dp[i] + dp[i-ai]*inv) % mod

    print(dp[-1])


if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    X = int(input())

    def calc(a, b):
        ans = 0
        for i in range(0, 5):
            ans += pow(a, i)*pow(b, 4-i)
        return ans

    if X == 1:
        print(1, 0)
        return

    if X % 2 == 0:
        x = 2
    else:
        for x in range(3, int(X**0.5), 2):
            if X % x == 0:
                break

    N = 10**16
    for i in range(N):
        j = i - x

        ij = calc(i, j)
        if x * ij == X:
            print(i, j)
            break




if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    X = int(input())

    if X == 1:
        print(1, 0)
        return

    ii = 2 if X % 2 else 1

    N = 10**9

    for x in range(1, N, ii):
        if X % x:
            continue
        for i in range(N):
            j = i - x

            ij = i**5 - j**5
            diff = ij - X
            if diff == 0:
                print(i, j)
                return
            elif j > 0 and diff > 0:
                break




if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
#!python3
import sys
sys.setrecursionlimit(1000000000)
from functools import lru_cache

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N = int(input())
    A = list(enumerate(iim()))

    A.sort(key=lambda x: x[1], reverse=True)

    @lru_cache
    def rec(i, j1, j2):
        if i == N:
            return 0
        pos, ai = A[i]

        ax = abs(pos - j1) * ai + rec(i+1, j1+1, j2)
        bx = abs(pos - j2) * ai + rec(i+1, j1, j2-1)

        return max(ax, bx)

    print(rec(0, 0, N-1))

if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N = int(input())
    A = list(enumerate(iim()))

    A.sort(key=lambda x: (x[1], (2*x[0]-N)**2), reverse=True)

    dp = [0] * (N+1)
    dp0 = dp[:]
    for i, (j, ai) in enumerate(A):
        for k in range(i+1):
            dp[k] = max(dp[k], dp0[k] + abs(N-i+k-1-j) * ai)
            dp[k+1] = max(dp[k+1], dp0[k] + abs(k-j) * ai)
        dp, dp0 = dp0, dp

    print(max(dp0))

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    X, Y, A, B, C = iim()
    P = list(iim())
    Q = list(iim())
    R = list(iim())

    P.sort(reverse=True)
    Q.sort(reverse=True)
    R.sort(reverse=True)

    p1 = [0]*(X+1)
    for i in range(X):
        p1[i+1] = p1[i] + P[i]
    q1 = [0]*(Y+1)
    for i in range(Y):
        q1[i+1] = q1[i] + Q[i]

    si = [X-1, Y-1]
    S = [P, Q]
    if P[si[0]] < Q[si[1]]:
        idx = 0
    else:
        idx = 1
    ans = 0
    for i in range(C):
        if S[idx][si[idx]] < R[i]:
            si[idx] -= 1
            ans += R[i]
            if P[si[0]] < Q[si[1]]:
                idx = 0
            else:
                idx = 1
        else:
            break

    print(p1[si[0]+1] + q1[si[1]+1] + ans)

if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    X, Y, A, B, C = iim()
    P = list(iim())
    Q = list(iim())
    R = list(iim())

    P.sort(reverse=True)
    Q.sort(reverse=True)
    R.sort(reverse=True)

    p1 = [0]*(X+1)
    for i in range(X):
        p1[i+1] = p1[i] + P[i]
    q1 = [0]*(Y+1)
    for i in range(Y):
        q1[i+1] = q1[i] + Q[i]

    si = [X-1, Y-1]
    S = [P, Q]
    if P[si[0]] < Q[si[1]]:
        idx = 0
    else:
        idx = 1
    ans = 0
    swap = True
    for i in range(C):
        if S[idx][si[idx]] < R[i]:
            si[idx] -= 1
            ans += R[i]

            if si[idx] < 0:
                idx ^= 1
                if si[idx] <= 0:
                    break
                swap = False
            elif not swap:
                continue
            elif P[si[0]] < Q[si[1]]:
                idx = 0
            else:
                idx = 1
        else:
            break

    print(p1[si[0]+1] + q1[si[1]+1] + ans)

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N = int(input())
    A = tuple(iim())

    d1 = dict()
    for ai in A:
        if ai in d1:
            d1[ai] += 1
        else:
            d1[ai] = 1

    aa = []
    items = d1.items()
    for ak in A:
        ans = 0
        for k, v in items:
            if k == ak:
                v -= 1
            if v > 1:
                ans += v * (v-1) // 2
        aa.append(ans)
    print(*aa, sep="\n")


if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N = int(input())
    A = tuple(iim())

    d1 = dict()
    for ai in A:
        if ai in d1:
            d1[ai] += 1
        else:
            d1[ai] = 1

    aa = []
    cnt = 0
    d2 = dict()
    for k, v in d1.items():
        v = v * (v-1) // 2
        cnt += v
        d2[k] = v

    for ak in A:
        ans = 0
        v = d1[ak] - 1
        v = v * (v-1) // 2
        aa.append(cnt-d2[ak]+v)
    print(*aa, sep="\n")


if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
#!python3

from heapq import heappush, heappop
iim = lambda: map(int, input().rstrip().split())

def resolve():
    H, W = iim()
    S = [input() for i in range(H)]
    H1, W1 = H-1, W-1

    dq = []
    heappush(dq, (0, 0, 0))

    while dq:
        cost, x, y = heappop(dq)

        if S[y][x] == "#":
            cost += 1

        if x == W1 and y == H1:
            print(cost)
            return

        if x < W1:
            heappush(dq, (cost, x+1, y))
        if y < H1:
            heappush(dq, (cost, x, y+1))

if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    H, W = iim()
    S = [input() for i in range(H)]
    c1 = "#"
    H1, W1 = H-1, W-1

    inf = H*W+1
    dq = [0]*W
    dq0 = [(inf, True)]*W
    dq0[0] = (0, True)

    for y in range(H):
        (co, good0) = dq0[0]

        good = not S[y][0] == c1
        if not good:
            if good0:
                co += 1
        dq1 = dq[0] = (co, good)
        for x in range(1, W):
            (co0, good0) = dq0[x]
            (co1, good1) = dq1
            good = not S[y][x] == c1
            if not good:
                if good0:
                    co0 += 1
                if good1:
                    co1 += 1
            dq1 = dq[x] = (min(co0, co1), good)
        dq, dq0 = dq0, dq
        #print(dq0)
    print(dq0[-1][0])

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N, P = iim()
    S = list(map(int, input().rstrip()))

    if P == 2:
        cnt = N * (N + 1) // 2
        for i, si in enumerate(S):
            if si & 1:
                cnt -= i + 1
        print(cnt)
        return

    i = j = 1
    while j < P:
        i += 1
        j *=10
    keta = i - 2
    cnt = 0
    for i in range(N):
        ans = 0
        if S[i] == 0:
            cnt += 1
        for j in range(i, i+keta):
            ans = 10*ans + S[j]
        for j in range(i+keta, N):
            sj = S[j]
            ans = 10*ans + sj
            #print(ans, ans % P)
            if ans % P == 0:
                cnt += 1
    print(cnt)

if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N, P = iim()
    S = list(map(int, input().rstrip()))

    if P == 2 or P == 5:
        cnt = 0
        for i, si in enumerate(S):
            if si % P == 0:
                cnt += i + 1
        print(cnt)
        return

    T = [0] * P
    T[0] = 1

    ss, p10 = 0, 1
    for s1 in S[::-1]:
        ss += p10 * s1
        ss %= P
        T[ss] += 1
        p10 = 10 * p10 % P

    ans = 0
    for i in T:
        ans += i*(i-1)//2
    print(ans)

if __name__ == "__main__":
    resolve()

Buggy python submission (verdict: Time Limit Exceeded):
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N, P = iim()
    S = list(map(int, input().rstrip()))

    if P == 2:
        cnt = N * (N + 1) // 2
        for i, si in enumerate(S):
            if si & 1:
                cnt -= i + 1
        print(cnt)
        return

    cnt = 0
    for i in range(N):
        ans = 0
        for j in range(i, N):
            sj = S[j]
            ans = 10*ans + sj
            #print(ans, ans % P)
            if ans % P == 0:
                cnt += 1
    print(cnt)

if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    N, P = iim()
    S = list(map(int, input().rstrip()))

    if P == 2 or P == 5:
        cnt = 0
        for i, si in enumerate(S):
            if si % P == 0:
                cnt += i + 1
        print(cnt)
        return

    T = [0] * P
    T[0] = 1

    ss, p10 = 0, 1
    for s1 in S[::-1]:
        ss += p10 * s1
        ss %= P
        T[ss] += 1
        p10 = 10 * p10 % P

    ans = 0
    for i in T:
        ans += i*(i-1)//2
    print(ans)

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
#!python3


iim = lambda: map(int, input().rstrip().split())

def resolve():
    N = list(map(int, input()))
    K = int(input())
    size = len(N)

    dp = [[[0]*(size+1) for j in range(2)] for i in range(size+1)]

    dp[0][0][0] = 1
    for i in range(size):
        for less in range(2):
            for k in range(size):
                for x in range(10 if less else N[i] + 1):
                    #print((i, less, k), x, (i+1, int(less or x < N[i]), k + (1 if x else 0)))
                    dp[i+1][less or x < N[i]][k + (1 if x else 0)] += dp[i][less][k]
        #print(dp[i+1])

    print(dp[-1][0][K] + dp[-1][1][K])

if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

from math import factorial

iim = lambda: map(int, input().rstrip().split())

def cmb(a, b):
    c = a - b
    if c < b:
        b = c
    if b == 0: return 1

    ans = 1
    for i in range(b):
        ans *= a - i

    return ans // factorial(b)

def cnt(N, K):
    if K == 0:
        return 1

    n10 = 10 ** (K-1)
    if N < n10:
        return 0

    n10 *= 10
    n9 = 9 ** K

    ans = 0
    a = n10
    i = 0
    while a < N:
        a *= 10; i += 1
    a //= 10; i -= 1
    if i >= 0:
        ans = cmb(i+K, K) * n9
        #print(f"{i+K}C{K}", ans)

    n, b = divmod(N, a)
    if n > 1:
        ans += (n - 1) * cnt(a-1, K - 1)
    ans += cnt(b, K - 1)


    return ans

def resolve():
    N = int(input())
    K = int(input())

    print(cnt(N, K))

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Runtime Error):
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    a, b = iim()

    if a > b:
        a, b = b, a
    print(f"{a}"*b)

if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    a, b = iim()

    if a > b:
        a, b = b, a
    print("{0}".format(a)*b)

if __name__ == "__main__":
    resolve()
Buggy python submission (verdict: Time Limit Exceeded):
#!python3

iim = lambda: map(int, input().rstrip().split())

from bisect import bisect_left

def resolve():
    N = int(input())
    #S = [list(iim()) for i in range(N)]
    MX = 10**9
    S = []
    for i in range(N):
        x, l = iim()
        i = x - l
        if i < 0:
            i = 0
        j = x + l
        if j > MX:
            j = MX

        a = [i, j]
        S.append(a)
    S.sort()

    d = dict()
    x, y = S[0]
    d = {-1: 0}
    dk = [-1]
    ans = 0
    for x, y in S:
        for xx in dk:
            if xx <= x:
                n = d[xx] + 1
                if y in d:
                    if d[y] < n:
                        d[y] = n
                        if ans < n:
                            ans = n
                else:
                    d[y] = n
                    dk.append(y)
                    if ans < n:
                        ans = n
        #print(x, y, d)
    print(n)






if __name__ == "__main__":
    resolve()


Fixed submission:
#!python3

iim = lambda: map(int, input().rstrip().split())

from bisect import bisect_left

def resolve():
    N = int(input())
    #S = [list(iim()) for i in range(N)]
    MX = 10**9
    S = []
    for i in range(N):
        x, l = iim()
        i = x - l
        if i < 0:
            i = 0
        j = x + l
        if j > MX:
            j = MX

        a = [i, j]
        S.append(a)
    S.sort()

    ans = 0
    last = MX+1
    n = 1
    for x, y in S:
        if y < last:
            last = y
        elif last <= x:
            n += 1
            last = y

    print(n)






if __name__ == "__main__":
    resolve()