Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03547 (python)

Fixed submission:
s = input()

a, b = s.split()
if a.isdigit():
  a = int(a)
else:
  a = ord(a) - 50

if b.isdigit():
  b = int(b)
else:
  b = ord(b) - 50

if a < b:
  print("<")
elif a > b:
  print(">")
else:
  print("=")

Buggy submission (verdict: Runtime Error):
s1 = input()
s2 = input()

x, y, z = [int(i) for i in s1.split()]
l = [int(i) for i in s2.split()]
 
if x = 1:
  print(abs(z - l[x-1]))
else:
  if abs(z - l[x-1]) > abs(l[x-1] - l[x-2]):
    print(abs(z - l[x-1]))
  else:
    print(abs(l[x-1] - l[x-2]))

Buggy submission (verdict: Runtime Error):
x, y, z = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
 
if x = 1:
  print(abs(z - l[x-1]))
else:
  if abs(z - l[x-1]) > abs(l[x-1] - l[x-2]):
    print(abs(z - l[x-1]))
  else:
    print(abs(l[x-1] - l[x-2]))

Buggy submission (verdict: Runtime Error):
a, b = input().split
if a.isdigit():
  a = int(a)
else:
  a = ord(a) - 50

if b.isdigit():
  b = int(b)
else:
  b = ord(b) - 50

if a > b:
  print("<")
elif a < b:
  print(">")
else:
  print("=")
Problem p03550 (python)

Fixed submission:
s1 = input()
s2 = input()

x, y, z = [int(i) for i in s1.split()]
l = [int(i) for i in s2.split()]

if x == 1:
  print(abs(z - l[x-1]))
else:
  if abs(z - l[x-1]) > abs(l[x-1] - l[x-2]):
    print(abs(z - l[x-1]))
  else:
    print(abs(l[x-1] - l[x-2]))

Buggy submission (verdict: Runtime Error):
s1 = input()
s2 = input()

x, y, z = [int(i) for i in s1.split()]
l = [int(i) for i in s2.split()]
 
if x = 1:
  print(abs(z - l[x-1]))
else:
  if abs(z - l[x-1]) > abs(l[x-1] - l[x-2]):
    print(abs(z - l[x-1]))
  else:
    print(abs(l[x-1] - l[x-2]))

Buggy submission (verdict: Runtime Error):
x, y, z = [int(i) for i in s.split()]
l = [int(i) for i in s.split()]

if x = 1:
  print(abs(z - l[x-1]))
else:
  if abs(z - l[x-1]) > abs(l[x-1] - l[x-2]):
    print(abs(z - l[x-1]))
  else:
    print(abs(l[x-1] - l[x-2]))
Problem p02882 (python)

Fixed submission:
# -*- coding: utf-8 -*-

import math

a, b, x = map(int, input().split())

V = a**2 * b
V_2 = V / a

x_2 = x / a

if x_2 > V_2/2:
    c = 2*x/a**2 - b
    theta = math.atan2(a,(b-c))
    deg = math.degrees(theta)
else:
    c = 2*x/(a*b)
    theta = math.atan2(c,b)
    deg = math.degrees(theta)

print("{}".format(90.0-deg))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import math

a, b, x = map(int, input().split())

V = a**2 * b
V_2 = V / a

x_2 = x / a

if x_2 > V_2/2:
    c = 2*x/a**2 - b
    theta = math.atan(a/(b-c))
    deg = math.degrees(theta)
else:
    c = 2*x/(a*b)
    theta = math.atan(c/b)
    deg = math.degrees(theta)

print("{}".format(90.0-deg))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

import math

a, b, x = map(int, input().split())

V = a**2 * b
V_2 = V / a

x_2 = x / a

if x_2 > V_2/2:
    c = 2*x/a**2 - b
    theta = math.atan(a/(b-c))
    deg = math.degrees(theta)
else:
    c = 2*x/(a*b)
    theta = math.atan(c/b)
    deg = math.degrees(theta)

print("{:.9}".format(90-deg))
Problem p03101 (python)

Fixed submission:

l = list(map(int, input().split(' ')))
s = list(map(int, input().split(' ')))

print(int((l[1]-s[1])*(l[0]-s[0])))

Buggy submission (verdict: Runtime Error):

l = lsit(map(int, input().split(' ')))
s = lsit(map(int, input().split(' ')))

print(int((l[1]-s[1])*(l[0]-s[0])))
Problem p03227 (python)

Fixed submission:
s = input()
ans = []
if len(s) == 2:
    print(s)
elif len(s) == 3:
    for i in range(len(s)):
        ans.append(s[2-i])
    ans_ = map(str, ans)
    print("".join(ans_))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
ans=0
if N % 2 == 0:
    ans = 2 * (sum(A[N // 2 + 1:]) - sum(A[:N // 2 - 1])) + A[N // 2] - A[N // 2 - 1]
else:
    x = 2 * (sum(A[N // 2 + 1:]) - sum(A[:N // 2 - 1])) - A[N // 2] - A[N // 2 - 1]
    y = 2 * (sum(A[N // 2 + 2:]) - sum(A[:N // 2])) + A[N // 2] + A[N // 2 + 1]
    ans = max(x, y)
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
import pandas as pd

N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
ans=0
if N % 2 == 0:
    ans = 2 * (sum(A[N // 2 + 1:]) - sum(A[:N // 2 - 1])) + A[N // 2] - A[N // 2 - 1]
else:
    x = 2 * (sum(A[N // 2 + 1:]) - sum(A[:N // 2 - 1])) - A[N // 2] - A[N // 2 - 1]
    y = 2 * (sum(A[N // 2 + 2:]) - sum(A[:N // 2])) + A[N // 2] + A[N // 2 + 1]
    ans = max(x, y)
print(ans)
Problem p03229 (python)

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()
ans=0
if N % 2 == 0:
    ans = 2 * (sum(A[N // 2 + 1:]) - sum(A[:N // 2 - 1])) + A[N // 2] - A[N // 2 - 1]
else:
    x = 2 * (sum(A[N // 2 + 1:]) - sum(A[:N // 2 - 1])) - A[N // 2] - A[N // 2 - 1]
    y = 2 * (sum(A[N // 2 + 2:]) - sum(A[:N // 2])) + A[N // 2] + A[N // 2 + 1]
    ans = max(x, y)
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
import pandas as pd

N = int(input())
A = [int(input()) for _ in range(N)]
A.sort()

if N % 2 == 0:
    ans = 2 * (sum(A[N // 2 + 1:]) - sum(A[:N // 2 - 1])) + A[N // 2] - A[N // 2 - 1]
else:
    x = 2 * (sum(A[N // 2 + 1:]) - sum(A[:N // 2 - 1])) - A[N // 2] - A[N // 2 - 1]
    y = 2 * (sum(A[N // 2 + 2:]) - sum(A[:N // 2])) + A[N // 2] + A[N // 2 + 1]
    ans = max(x, y)
print(ans)
Problem p03262 (python)

Fixed submission:
from fractions import gcd
N, X = map(int, input().split())
x = list(map(int, input().split()))
l = []
for xx in x:
    l.append(abs(xx - X))

g = l[0]

for i in range(1, len(l)):
    g = gcd(g, l[i])

print(g)

Buggy submission (verdict: Runtime Error):
from math import gcd
N, X = map(int, input().split())
x = list(map(int, input().split()))
l = []
for xx in x:
    l.append(abs(xx - X))

g = l[0]

for i in range(1, len(l)):
    g = gcd(g, l[i])

print(g)
Problem p03352 (python)

Fixed submission:

X = int(input())
b = [1]

for i in range(2, 32):
    p = 2
    while i ** p <= X:
        b.append(i ** p)
        p += 1

print(max(b))

Buggy submission (verdict: Runtime Error):
X = int(input())
b = []

for i in range(2, 32):
    p = 2
    while i ** p <= X:
        b.append(i ** p)
        p += 1

print(max(b))

Buggy submission (verdict: Runtime Error):
X = int(input())
b = []

for i in range(2, 32):
    p = 2
    while i ** p <= X:
        b.append(i ** p)
        p += 1

print(max(b))

Buggy submission (verdict: Runtime Error):

X = int(input())
b = []

for i in range(2, 32):
    p = 2
    while i ** p <= X:
        b.append(i ** p)
        p += 1

print(max(b))
Problem p03408 (python)

Fixed submission:
N = int(input())
s = []
for _ in range(N):
    s.append(input())
M = int(input())
t = []
for _ in range(M):
    t.append(input())
ans = []
for ss in set(s):
    ans.append(s.count(ss) - t.count(ss))
p = max(ans) if max(ans) > 0 else 0
print(p)

Buggy submission (verdict: Runtime Error):
N = int(input())
s = []
for _ in range(N):
    s.append(input())
M = int(input())
t = []
for _ in range(M):
    t.append(input())
ans = []
for ss in set(s):
    ans.append(s.count(ss) - t.count(ss))
p = ans if ans > 0 else 0
print(p)
Problem p03501 (python)

Fixed submission:

l = list(map(int, input().split()))

p1 = l[0] * l[1]
p2 = l[2]

print(min(p1, p2))

Buggy submission (verdict: Runtime Error):

l = list(map(int, input()))

p1 = l[0] * l[1]
p2 = l[2]

print(min(p1, p2))
Problem p03565 (python)

Fixed submission:
import re

s = input().strip()
t = input().strip()

ls = len(s)
lt = len(t)

if ls < lt:
    print('UNRESTORABLE')
else:
    s = s.replace('?', '.')
    ans = []
    for i in range(len(s) - len(t) + 1):
        m = re.match(s[i:i + lt], t)
        if m is None:
            continue
        ans.append((s[:i]+t+s[i+lt:]).replace('.', 'a'))
    if not ans:
        print('UNRESTORABLE')
    else:
        print(min(ans))

Buggy submission (verdict: Runtime Error):
import re

s = list(input())
t = list(input())

ls = len(s)
lt = len(t)

if ls < lt:
    print('UNRESTORABLE')
else:
    ans = []
    for i in range(len(s) - len(t) + 1):
        m = re.match(s[i:i + lt], t)
        if m is None:
            continue
        ans.append((s[:i]+t+s[i+lt:]).replace('?', 'a'))
    if not ans:
        print('UNRESTORABLE')
    else:
        print(min(ans))
Problem p03633 (python)

Fixed submission:
from fractions import gcd
def lcm(a, b):
    return a * b // gcd(a, b)

n = int(input())
g = int(input())
for _ in range(n-1):
    t = int(input())
    g = lcm(g, t)
print(g)

Buggy submission (verdict: Runtime Error):
from math import gcd
def lcm(a, b):
    return a * b // gcd(a, b)

n = int(input())
g = int(input())
for _ in range(n-1):
    t = int(input())
    g = lcm(g, t)
print(g)
Problem p03636 (python)

Fixed submission:
s = list(input())
f = s[0]
e = s[-1]
s.pop(0)
s.pop(-1)
l = len(s)
print("".join([f, str(l), e]))

Buggy submission (verdict: Runtime Error):
s = list(input())
f = s[0]
e = s[-1]
s.pop(0).pop(-1)
l = len(s)
print("".join([f, str(l), e]))
Problem p03759 (python)

Fixed submission:
a, b, c = map(int, input().split())

if (b-a) == (c-b):
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a, b, c = mapc(int, input().split())

if (b-a) == (c-b):
    print('YES')
else:
    print('NO')
Problem p03963 (python)

Fixed submission:
n, k = map(int, input().split())
print(k * ((k - 1)**(n - 1)))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
print(k * ((nk - 1) ** (n - 1)))
Problem p03000 (python)

Fixed submission:
N, X = map(int, input().split())
L = [int(i) for i in input().split()]
step = [0]
nowstep = 0
ans = 0
i = 0

while i < N:
    step.append(nowstep + L[i])
    nowstep += L[i] 
    i += 1

for i in range(len(step)):
    if step[i] <= X:
        ans += 1
    else:
        pass

print(ans)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = [int(i) for i in input().split()]
step = 0
i = 0

while step <= X and i <= N+1:
    step += L[i]
    i += 1
    #print(step)

print(i)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = [int(i) for i in input().split()]
step = 0
i = 0

while step <= X and i <= N:
    step += L[i]
    i += 1

print(i)
Problem p03076 (python)

Fixed submission:
dishes_1 = [int(input()) for i in range(5)]
dishes_2 = [i % 10 for i in dishes_1]
dishes_sort = []

min_time = 0

for i in range (5):
    if dishes_2[i] == 0:
       dishes_sort.append(dishes_1[i])

for i in range (9, 0, -1):
    for j in range (5):
        if dishes_2[j] == i:
            dishes_sort.append(dishes_1[j])

for i in range (4):
    for j in range (9):
        if dishes_sort[i] % 10 == 0:
           break
        else:
            dishes_sort[i] += 1
            
print (sum(dishes_sort))

Buggy submission (verdict: Runtime Error):
dishes_1 = [int(input()) for i in range(5)]
dishes_2 = [i % 10 for i in dishes_1]
dishes_sort = []

min_time = 0

for i in range (5):
    if dishes_2[i] == 0:
       dishes_sort.append(dishes_1[i])

for i in range (9, 1, -1):
    for j in range (5):
        if dishes_2[j] == i:
            dishes_sort.append(dishes_1[j])

for i in range (4):
    for j in range (9):
        if dishes_sort[i] % 10 == 0:
           break
        else:
            dishes_sort[i] += 1
            
print (sum(dishes_sort))
Problem p02888 (python)

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
l = sorted(l)
ans = 0
for c in range(n):
    a=0
    b=c-1
    while a<b:
        if l[a]+l[b]>l[c]:
            ans+=b-a
            b-=1
        else:
            a+=1
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
n = input()
l = list(map(int,input().split()))
ans = 0
for i in list(itertools.combinations(l,3)):
    i.sort()
    a,b,c = i[0],i[1],i[2]
    if c<a+b:
        ans += 1
print(ans)
Problem p03633 (python)

Fixed submission:
def gcd(x, y):
    if y==0:
        return x
    else:
        return gcd(y, x%y)

def lcm(x, y):
    return (x * y) // gcd(x, y)

n = int(input())
a = [int(input()) for i in range(n)]
r = 1
for i in a:
    r = lcm(r, i)
print(r)

Buggy submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

n = int(input())
a = [int(input()) for i in range(n)]
r = 1
for i in a:
    r = lcm(r, i)
print(r)

Buggy submission (verdict: Runtime Error):
import math
import functools

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

n = int(input())
print(functools.reduce(lcm, [int(input()) for i in range(n)]))
Problem p02841 (python)

Fixed submission:
li = []
for i in range(2):
  a,b = map(int, input().split())
  li.append(a)
  
if li[1] == li[0]+1:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
N = int(input())
count = 0

for i in range(N):
  if N <= int(i*1.08) < N+1:
    print(i)
    count += 1

if count == 0:
    print(":(")

Buggy submission (verdict: Runtime Error):
li = []
for i in range(2):
  a,b = map(int, input().split())
  li.append(a)
  
if li[1] == li[0]+1:
  return 1
else:
  return 0

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
c,d = map(int, input().split())
if c == a+1:
  return 1
else:
  return 0

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
c,d = map(int, inout().split())
if c == a+1:
  print(1)
else:
  print(0)
a,b = map(int, input().split())
c,d = map(int, inout().split())
if c = a+1:
  return 1
else:
  return 0

Buggy submission (verdict: Runtime Error):
a,b = map(int, input().split())
c,d = map(int, inout().split())
if c = a+1:
  print(1)
else:
  print(0)
Problem p03110 (python)

Fixed submission:
N = int(input())
x = 0
u = 0
Y = 0
for i in range(N):
    str = input().split(' ')

    x = float(str[0])
    u = str[1]
    if u == 'JPY':
        Y += x
    else:
        Y += x * 380000.0
print(Y)

Buggy submission (verdict: Runtime Error):
x = []
u = []
Y = 0
for i in range(N):
    str = input().split(' ')
    x[i] = int(str[0])
    u[i] = int(str[1])
    if u[i] == 'JPY':
        Y += x[i]
    else:
        Y += x[i] * 380000.0
print(Y)
Problem p02971 (python)

Fixed submission:
import numpy as np
n = int(input())
a = [int(input()) for _ in range(n)]
t1 = max(a)
t1_idx = [i for i, v in enumerate(a) if v == t1]
a.sort()

if len(t1_idx) < 2:
    try:
        t2 = a[-1*len(t1_idx)-1]
    except:
        for i in range(n):
            print(t1)

    for i in range(n):
        if i in t1_idx:
            print(t2)
        else:
            print(t1)
else:
    for i in range(n):
        print(t1)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = [int(input()) for _ in range(n)]
t1 = max(a)
t1_idx = [i for i, v in enumerate(a) if v == t1]
a.sort()
t2 = a[-1*len(t1_idx)-1]
for i in range(n):
    if i in t1_idx:
        print(t2)
    else:
        print(t1)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = [int(input()) for _ in range(n)]
t1 = max(a)
t1_idx = [i for i, v in enumerate(a) if v == t1]
a.sort()
t2 = t2 = a[-1*len(t1_idx)-1]
for i in range(n):
    if i in t1_idx:
        print(t2)
    else:
        print(t1)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = np.array([int(input()) for _ in range(n)])
for i in range(n):
    print(max(a[:i]), max(a[i+1:]))
Problem p02988 (python)

Fixed submission:
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(1, n-1):
    if (p[i-1] < p[i] and p[i] < p[i+1]) or (p[i-1] > p[i] and p[i] > p[i+1]):
        cnt += 1
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(intput())
p = list(map(int, input().split()))
cnt = 0
for i in range(1, n-1):
  if (p[i-1] < p[i] and p[i] < p[i+1]) or (p[i-1] > p[i] and p[i] > p[i+1]):
    cnt += 1
print(cnt)
Problem p03031 (python)

Fixed submission:
from collections import defaultdict
n, m = map(int, input().split())
switch = defaultdict(list)
for i in range(m):
    s = list(map(int, input().split()))[1:]
    switch[i] = s
p = list(map(int, input().split()))

output = 0
for h in range(2**n):
    flag = 1
    padding = '0{}b'.format(n)
    bit = format(h, padding)
    for i, v in enumerate(p):
        cnt = 0
        for j in switch[i]:
            if bit[j-1] == '1':
                cnt += 1
        if cnt % 2 != v:
            flag = 0
    if flag == 1:
        output += 1
print(output)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
n, m = map(int, input().split())
switch = defaultdict(list)
for i in range(m):
    s = list(map(int, input().split()))[1:]
    switch[i] = s
p = list(map(int, input().split()))

output = 0
for h in range(2**n):
    flag = 1
    padding = f'0{n}b'
    bit = format(h, padding)
    for i, v in enumerate(p):
        cnt = 0
        for j in switch[i]:
            if bit[j-1] == '1':
                cnt += 1
        if cnt % 2 != v:
            flag = 0
    if flag == 1:
        output += 1
print(output)

Buggy submission (verdict: Runtime Error):
from itertools import combinations
from collections import defaultdict
n, m = map(int, input().split())
switch = defaultdict(list)
for i in range(m):
    s = list(map(int, input().split()))[1:]
    switch[i] = s
p = list(map(int, input().split()))

output = 0
for h in range(2**n):
    flag = 1
    padding = f'0{n}b'
    bit = format(h, padding)
    for i, v in enumerate(p):
        cnt = 0
        for j in switch[i]:
            if bit[j-1] == '1':
                cnt += 1
        if cnt % 2 != v:
            flag = 0
    if flag == 1:
        output += 1
print(output)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())

def ones(s):
    ss = s[0]
    idx = 0
    while ss=="1" and idx+1 < len(s):
        idx += 1
        ss = s[idx]
    return idx

if s[0]!="1":
    print(s[0])
else:
    idx = ones(s)
    if idx>=k:
        print("1")
    else:
        print(s[idx])

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())

def ones(s):
    ss = s[0]
    idx = 0
    while ss=="1":
        idx += 1
        ss = s[idx]
    return idx

if s[0]!="1":
    print(s[0])
else:
    idx = ones(s)
    if idx>=k:
        print("1")
    # else:
        # print(s[idx])

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())

def ones(s):
    ss = s[0]
    idx = 0
    while ss=="1":
        idx += 1
        ss = s[idx]
    return idx

if s[0]!="1":
    print(s[0])
else:
    idx = ones(s)
    if idx>=k:
        print("1")
    else:
        print(s[idx])

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())

def ones(s):
    ss = s[0]
    idx = 0
    while ss=="1":
        idx += 1
        ss = s[idx]
    return idx

if s[0]!="1":
    print(s[0])
else:
    idx = ones(s)
    if idx>k:
        print("1")
    else:
        print(s[idx])
Problem p03283 (python)

Fixed submission:
import numpy as np
n, m, q = map(int, input().split())
kukan = np.zeros((n+1, n+1))
for _ in range(m):
    l, r = map(int, input().split())
    kukan[r][l] += 1

# まず終点の側から考える
# iまでに終わる線分の数はi-1までの累積和
for i in range(1, n+1):
    kukan[i] += kukan[i-1]
# 次に始点の側から考える
# i以降に始まる線分の数はi-1までの総和
for i in range(1, n+1):
    kukan[:, i] += kukan[:, i-1]
# print(kukan)
for i in range(1, q+1):
    p, q = list(map(int, input().split()))
    print(int(kukan[q][q] - kukan[q][p-1] - kukan[p-1][q] + kukan[p-1][p-1]))

Buggy submission (verdict: Runtime Error):
import numpy as np
n, m, q = map(int, input().split())
kukan = np.zeros((N+1, N+1))
for _ in range(m):
    l, r = map(int, input().split())
    kukan[r][l] += 1

# まず終点の側から考える
# iまでに終わる線分の数はi-1までの累積和
for i in range(1, n+1):
    kukan[i] += kukan[i-1]
# 次に始点の側から考える
# i以降に始まる線分の数はi-1までの総和
for i in range(1, n+1):
    kukan[:, i] += kukan[i-1]

for i in range(q):
    p, q = list(map(int, input().split()))
    print(int(kukan[q][q] - kukan[q][p-1] - kukan[p-1][q] + kukan[p-1][p-1]))
Problem p03476 (python)

Fixed submission:
import numpy as np
n=123456
q = int(input())
 
is_prime = np.ones(n+1,dtype=int)
is_prime[0]=0
is_prime[1]=0
 
for i in range(2,n+1):
    if(is_prime[i]==1):
        j=i+i
        while j <= n:
            is_prime[j] = 0
            j += i
 
cnt = [is_prime[x]*is_prime[(x+1)//2] for x in range(0,n+1)]
 
for i in range(1,n+1):
    cnt[i]+=cnt[i-1]
 
for i in range(q):
    l,r = map(int, input().split())
    print(cnt[r]-cnt[l-1])

Buggy submission (verdict: Runtime Error):
import numpy as np

q = int(input())

# 高速素数判定
is_prime = np.ones(100001, dtype=int)
is_prime[0]=0
is_prime[1]=0

for i in range(2,100001):
    if is_prime[i]==1:
        j=i+i
        while j <= 100000:
            is_prime[j] = 0
            j += i

like2017 = [1 if is_prime[x] and is_prime[(x+1)//2] else 0 for i in range(0,100001) ]

for i in range(1,100001):
    like2017[i] += like2017[i-1]
for i in range(q):
    l,r = map(int, input().split())
    print(like2017[r]-like2017[l-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
n=10000
q = int(input())
 
is_prime = np.ones(n+1,dtype=int)
is_prime[0]=0
is_prime[1]=0
 
for i in range(2,n+1):
    if(is_prime[i]==1):
        j=i+i
        while j <= n:
            is_prime[j] = 0
            j += i
 
cnt = [is_prime[x]*is_prime[(x+1)//2] for x in range(0,n+1)]
 
for i in range(1,n+1):
    cnt[i]+=cnt[i-1]
 
for i in range(q):
    l,r = map(int, input().split())
    print(cnt[r]-cnt[l-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
 
q = int(input())
 
# 高速素数判定
is_prime = np.ones(10001, dtype=int)
is_prime[0]=0
is_prime[1]=0
 
for i in range(2,10001):
    if is_prime[i]==1:
        j=i+i
        while j <= 10000:
            is_prime[j] = 0
            j += i
            
like2017 = [is_prime[x]*is_prime[(x+1)//2] for x in range(0,10001)]
 
for i in range(1,10001):
    like2017[i] += like2017[i-1]
    
for i in range(q):
    l,r = map(int, input().split())
    print(like2017[r]-like2017[l-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
 
q = int(input())
 
# 高速素数判定
is_prime = np.ones(10001, dtype=int)
is_prime[0]=0
is_prime[1]=0
 
for i in range(2,10001):
    if is_prime[i]==1:
        j=i+i
        while j <= n:
            is_prime[j] = 0
            j += i
            
like2017 = [is_prime[x]*is_prime[(x+1)//2] for x in range(0,10001)]
 
for i in range(1,10001):
    like2017[i] += like2017[i-1]
    
for i in range(q):
    l,r = map(int, input().split())
    print(like2017[r]-like2017[l-1])

Buggy submission (verdict: Runtime Error):
import numpy as np

q = int(input())

# 高速素数判定
is_prime = np.ones(10001, dtype=int)
is_prime[0]=0
is_prime[1]=0

for i in range(2,10001):
    if is_prime[i]==1:
        j=i+i
        while j <= n:
            is_prime[j] = 0
            j += i
            
like2017 = [is_prime[x]*is_prime[(x+1)//2] for x in range(0,10001)]

for i in range(1,n+1):
    like2017[i] += like2017[i-1]
    
for i in range(q):
    l,r = map(int, input().split())
    print(like2017[r]-like2017[l-1])
Problem p03471 (python)

Fixed submission:
N, Y = list(map(int, input().split()))
for i in range(N+1):
    for j in range(N+1):
        if ((N-i-j) >= 0 and i*10000 + j*5000 + (N-(i+j))*1000 == Y):
            print(i, j, N-i-j)
            exit()
print(-1, -1, -1)

Buggy submission (verdict: Runtime Error):
N = int(input())
Y = int(input())
for i in range(N+1):
    for j in range(N+1):
        if ((N-i-j) >= 0 and i*10000 + j*5000 + (N-(i+j))*1000 == Y):
            print(i, j, N-i-j)
            exit()
print(-1, -1, -1)
Problem p04044 (python)

Fixed submission:
n, l = map(int, input().split())
s = sorted([input() for _ in range(n)], key=lambda x: ([x[i] for i in range(l)]))
print("".join(s))

Buggy submission (verdict: Runtime Error):
n, l = map(int, input().split())
s = [input() for _ in range(n)]

result = ""
s.sort()
for i in range(l):
    result += s[i]

print(result)
Problem p02866 (python)

Fixed submission:
n = int(input().strip())
d = list(map(int, input().split()))
h = [0] * n
for x in d:
  h[x] += 1

ans = 1
mod = 998244353
for i in range(1, n):
  ans = (ans * pow(h[i-1], h[i], mod)) % mod

if h[0] != 1 or d[0] != 0:
  ans = 0

print (ans)

Buggy submission (verdict: Runtime Error):
n = int(input().strip())
d = list(map(int, input().split()))
h = [0] * n
for x in d:
  h[x] += 1

ans = 1
mod = 998244353
for i in range(1, n):
  ans = (ans * pow(h[i-1], h[i], mod)) % mod

if h[0] != 1 || d[0] != 0:
  ans = 0

print (ans)