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

Fixed submission:
A,B,C,D  = map(int, input().split())

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

#Cの倍数
if A % C ==0:
    C_start = A // C
else:
    C_start = (A//C)+1

C_end = B//C
C_count =-C_start+C_end+1

#Dの倍数
if A % D ==0:
    D_start = A // D
else:
    D_start = (A//D)+1

D_end = B//D
D_count =-D_start+D_end+1

#CとDの倍数
CD=C*D//gcd(C, D)
if A % CD ==0:
    CD_start = A // CD
else:
    CD_start = (A//CD)+1

CD_end = B//CD
CD_count =-CD_start+CD_end+1

count = (B-A+1)-(C_count +D_count -CD_count)
print(count)

Buggy submission (verdict: Runtime Error):
import math
A,B,C,D  = map(int, input().split())
#Cの倍数
if A % C ==0:
    C_start = A // C
else:
    C_start = (A//C)+1

C_end = B//C
C_count =-C_start+C_end+1

#Dの倍数
if A % D ==0:
    D_start = A // D
else:
    D_start = (A//D)+1

D_end = B//D
D_count =-D_start+D_end+1

#CとDの倍数
CD=C*D//math.gcd(C, D)
if A % CD ==0:
    CD_start = A // CD
else:
    CD_start = (A//CD)+1

CD_end = B//CD
CD_count =-CD_start+CD_end+1

count = (B-A+1)-(C_count +D_count -CD_count)
print(count)
Problem p02995 (python)

Fixed submission:

def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if x%y == 0:
        return y
    else:
        while x%y != 0:
            z = x%y
            x = y
            y = z
        else:
            return z
        
A, B, C, D = map(int, input().split())
lcm = int(C * D / gcd(C, D))

num_B_C = B // C
num_B_D = B // D
num_B_CD = B // (lcm)

num_A_C = (A-1) // C
num_A_D = (A-1) // D
num_A_CD = (A-1) // (lcm)

num_all = (num_B_C - num_A_C) + (num_B_D - num_A_D) - (num_B_CD - num_A_CD)
result = (B - (A-1)) - num_all

print(result)

Buggy submission (verdict: Runtime Error):
import math

A, B, C, D = map(int, input().split())
lcm = int(C * D / math.gcd(C, D))

num_B_C = B // C
num_B_D = B // D
num_B_CD = B // (lcm)

num_A_C = (A-1) // C
num_A_D = (A-1) // D
num_A_CD = (A-1) // (lcm)

num_all = (num_B_C - num_A_C) + (num_B_D - num_A_D) - (num_B_CD - num_A_CD)
result = (B - (A-1)) - num_all

print(result)
Problem p03060 (python)

Fixed submission:
N = int(input())

sum = 0

V = list(map(int, input().split()))
C = list(map(int, input().split()))

for i in range(N):
  diff = V[i] - C[i]
  if diff >= 0:
    sum += diff

print(sum)

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

sum = 0

V = list(map(int, input().split()))
C = list(map(int, input().split()))

for V_i, C_i in V, C:
  diff = V_i - C_i
  if diff >= 0:
    sum += diff

print(sum)
Problem p03044 (python)

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

from collections import deque

N = int(input())
L = N-1
graph = [[] for _ in range(N)]
color = [-1 for _ in range(N)]
visit = [False for _ in range(N)]

for i in range(L):
    u,v,w = map(int, input().split())
    u-=1
    v-=1
    graph[u].append((v,w))
    graph[v].append((u,w))

que = deque([0])    # 添え字0からアクセス開始
color[0] = 0    # 添え字0をcolor0と置く
while len(que) > 0:
    idx = que.popleft()
    visit[idx] = True
    for i, w in graph[idx]:
        if visit[i] is True:
            continue
        if w%2 == 0:    # 同色で塗る
            color[i] = color[idx]
            que.append(i)
        else:   # 異色で塗る
            color[i] = 1 - color[idx]   # 1-cで異色になる
            que.append(i)

for c in color:
    print(c)

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

import sys
sys.setrecursionlimit(10000)

def dfs(graph, color, visit, idx):
    visit[idx] = True
    if len(graph[idx]) == 0:
        return
    for i, w in graph[idx]:
        if visit[i] is True:
            continue
        if w%2 == 0:    # 同色で塗る
            color[i] = color[idx]
        else:   # 異色で塗る
            color[i] = 1 - color[idx]   # 1-cで異色になる
        dfs(graph, color, visit, i)


N = int(input())
L = N-1
graph = [[] for _ in range(N)]
color = [-1 for _ in range(N)]
visit = [False for _ in range(N)]

for i in range(L):
    u,v,w = map(int, input().split())
    u-=1
    v-=1
    graph[u].append((v,w))
    graph[v].append((u,w))

color[0] = 0    # 添え字0をcolor0と置く
dfs(graph, color, visit, 0)

for c in color:
    print(c)

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

import sys
sys.setrecursionlimit(10000)

def dfs(graph, color, visit, idx):
    visit[idx] = True
    for i, w in graph[idx]:
        if visit[i] is True:
            continue
        if w%2 == 0:    # 同色で塗る
            color[i] = color[idx]
            dfs(graph, color, visit, i)
        else:   # 異色で塗る
            color[i] = 1 - color[idx]   # 1-cで異色になる
            dfs(graph, color, visit, i)


N = int(input())
L = N-1
graph = [[] for _ in range(N)]
color = [-1 for _ in range(N)]
visit = [False for _ in range(N)]

for i in range(L):
    u,v,w = map(int, input().split())
    u-=1
    v-=1
    graph[u].append((v,w))
    graph[v].append((u,w))

color[0] = 0    # 添え字0をcolor0と置く
dfs(graph, color, visit, 0)

for c in color:
    print(c)

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

def dfs(graph, color, visit, idx):
    visit[idx] = True
    for i, w in graph[idx]:
        if visit[i] is True:
            continue
        if w%2 == 0:    # 同色で塗る
            color[i] = color[idx]
            dfs(graph, color, visit, i)
        else:   # 異色で塗る
            color[i] = 1 - color[idx]   # 1-cで異色になる
            dfs(graph, color, visit, i)


N = int(input())
L = N-1
graph = [[] for _ in range(N)]
color = [-1 for _ in range(N)]
visit = [False for _ in range(N)]

for i in range(L):
    u,v,w = map(int, input().split())
    u-=1
    v-=1
    graph[u].append((v,w))
    graph[v].append((u,w))

color[0] = 0    # 添え字0をcolor0と置く
dfs(graph, color, visit, 0)

for c in color:
    print(c)
Problem p03061 (python)

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

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

N = int(input())
A = [int(a) for a in input().split()]

# GCDの結合則を利用する
# 左端、右端からの累積GCDを求めておくと、Aiを取り除いた場合のGCDがすぐに計算できる。
# つまり、
# L(i): n=0,...,iまでのGCD 
# R(i): n=i,...,N-1までのGCD
# このとき、Aiを除いた全体のGCDは、GCD(L(i-1), R(i+1))で計算できる。

L = [0] * N
R = [0] * N

L[0] = A[0]
R[-1] = A[-1]
for i in range(1, N):
    L[i] = gcd(L[i-1], A[i])
    idx = N-1-i
    R[idx] = gcd(R[idx+1], A[idx])

mx = 0
for i in range(N):
    if i == N-1:
        v = L[N-2]
    elif i == 0:
        v = R[1]
    else:
        v = gcd(R[i+1], L[i-1])
    mx = max(v, mx)
print(mx)

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

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

N = int(input())
A = [int(a) for a in input().split()]

if N <= 2:
    print(max(A))
    exit()

gc = [0] * (N-1)
for i in range(0,N-1):
    gc[i] = gcd(A[i],A[i+1])
#print(gc)
# このgcで最小のものが算出されるところを書き換えればよい？
# 連続してれば共通部、連続してないなら端とか？

mnd = -1
mn = 1e10
for i in range(0, N-1):
    if mn >= gc[i]:
        mnd = i
        mn = gc[i]

if mnd == N-1 and gc[-1] < gc[-2]:
    mnd = N-1

# 連続してれば後者になるのでmndはA[i]に対応することになる
# gcの長さはN-1

B = [a for a in A if a != A[mnd]]
#print(B)

lb = len(B)
if lb >= 2:
    g = B[0]
    for i in range(1, len(B)):
        g = gcd(g, B[i])
else:
    g = B[0]
print(g)
Problem p03111 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# import math   # math.infが使えない？(3.5から。AtCoderは3.4)

# 解説見ながら記述
# 延長魔法は、合成前・合成後で実施しても等価。
# 合成魔法が使えないパターンにのみ延長魔法を使うようにして全探索するみたい

N, A, B, C = map(int, input().split())
ls = [int(input()) for i in range(N)]
INF = 10 ** 10  # int32.max = 2*10^9より大きくしている

def rec(cur, a, b, c):
    """
    cur: 現在のlsのindex
    a: 合成中の1本目の長さ
    b: 合成中の1本目の長さ
    c: 合成中の1本目の長さ
    """
    if cur == N:
        if min(a, b, c) > 0:
            # 合成1回目：1本目は選ぶだけで合成する必要ないので10*3を引いておく
            return abs(A-a) + abs(B-b) + abs(C-c) - 30
        else:
            # 1回も合成していない場合は無効
            # return math.inf
            return INF
    else:
        r0 = rec(cur+1, a, b, c)    # ls[cur]に対して何もしない
        r1 = rec(cur+1, a+ls[cur], b, c) + 10    # ls[cur]をaに合成
        r2 = rec(cur+1, a, b+ls[cur], c) + 10    # ls[cur]をbに合成
        r3 = rec(cur+1, a, b, c+ls[cur]) + 10    # ls[cur]をcに合成
        return min(r0, r1, r2, r3)

r = rec(0, 0, 0, 0)

print(r)

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

# 解説見ながら記述
# 延長魔法は、合成前・合成後で実施しても等価。
# 合成魔法が使えないパターンにのみ延長魔法を使うようにして全探索するみたい

N, A, B, C = map(int, input().split())
ls = [int(input()) for i in range(N)]

def rec(cur, a, b, c):
    """
    cur: 現在のlsのindex
    a: 合成中の1本目の長さ
    b: 合成中の1本目の長さ
    c: 合成中の1本目の長さ
    """
    if cur == N:
        if min(a, b, c) > 0:
            # 合成1回目：1本目は選ぶだけで合成する必要ないので10*3を引いておく
            return abs(A-a) + abs(B-b) + abs(C-c) - 30
        else:
            # 1回も合成していない場合は無効
            return math.inf
    else:
        r0 = rec(cur+1, a, b, c)    # ls[cur]に対して何もしない
        r1 = rec(cur+1, a+ls[cur], b, c) + 10    # ls[cur]をaに合成
        r2 = rec(cur+1, a, b+ls[cur], c) + 10    # ls[cur]をbに合成
        r3 = rec(cur+1, a, b, c+ls[cur]) + 10    # ls[cur]をcに合成
        return min(r0, r1, r2, r3)

r = rec(0, 0, 0, 0)

print(r)
Problem p02983 (python)

Fixed submission:
import numpy

L, R = map(int, input().split())
l, r = L % 2019, R % 2019

if l > r or (R - L) >= 2019:
    print(0)
else:
    print(numpy.min([(i * j) % 2019 for i in range(l, r) for j in range(i + 1, r + 1)]))

Buggy submission (verdict: Runtime Error):
import numpy

L, R = map(int, input().split())
l, r = L % 2019, R % 2019

if l > r or (R - L) >= 2019:
    print(0)
else:
    print(numpy.min([(i * j) % 2019 for i in range(l, r)　for j in range(i + 1, r + 1)]))
Problem p03078 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import itertools
import sys
import math
from functools import lru_cache

# 1整数
# n = int(input())

# 空白区切り2変数
from queue import Queue
from operator import mul
from functools import reduce
from queue import Queue
from operator import mul
from functools import reduce
from functools import lru_cache

input = sys.stdin.readline

# N個整数
x, y, z, kk = list(map(int, input().split()))

# 1整数
# n = int(input())

# 空白区切りリスト整数
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)


ll = []
count = 0
for i in range(len(a)):
    for j in range(len(b)):
        if i * j > kk:

            break
        for k in range(len(c)):
            if i * j * k > kk:
                break
            ll.append(a[i] + b[j] + c[k])
ll.sort(reverse=True)

for i in range(kk):
    print(ll[i])

# 空白区切り文字列
# t, d = input().split()

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import itertools
import sys
import math
from functools import lru_cache

# 1整数
# n = int(input())

# 空白区切り2変数
from queue import Queue
from operator import mul
from functools import reduce
from queue import Queue
from operator import mul
from functools import reduce
from functools import lru_cache

input = sys.stdin.readline

# N個整数
x, y, z, kk = list(map(int, input().split()))

# 1整数
# n = int(input())

# 空白区切りリスト整数
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)


ll = [0] * 1000000
count = 0
for i in range(len(a)):
    for j in range(len(b)):
        if i * j > kk:

            break
        for k in range(len(c)):
            if i * j * k > kk:
                break
            ll[count] = a[i] + b[j] + c[k]
            count += 1
ll.sort(reverse=True)

for i in range(kk):
    print(ll[i])

# 空白区切り文字列
# t, d = input().split()
Problem p03081 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import itertools
import sys
import math
from functools import lru_cache

# 1整数
# n = int(input())

# 空白区切り2変数
from queue import Queue
from operator import mul
from functools import reduce

import sys

input = sys.stdin.readline

# N個整数
n, q = list(map(int, input().split()))

s = input()

ans = set()

qq = [''] * q

for i in range(q):
    t, d = input().split()
    qq[i] = t + d


##最初にマスiにいるゴーレムが左に抜けられるかどうか
def hidari(i):
    for qn in range(q):
        if qq[qn][0] == s[i]:
            if qq[qn][1] == 'R':
                i += 1
                if i >= n:
                    return False
            else:
                i -= 1
                if i < 0:
                    return True
    return False


# 右に抜けられるかどうか
def migi(i):
    for qn in range(q):
        if qq[qn][0] == s[i]:
            if qq[qn][1] == 'R':
                i += 1
                if i >= n:
                    return True
            else:
                i -= 1
                if i < 0:
                    return False
    return False


##左に抜けられるかどうかの最大のにぶたんwithめぐる
ok = -1
ng = n
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
    #print(mid, hidari(mid))
    if hidari(mid):
        ok = mid
    else:
        ng = mid
n_hidari = ok

##右に抜けられるかどうかの最大のにぶたんwithめぐる
ok = n
ng = -1
while abs(ok - ng) > 1:
    mid = (ok + ng) // 2
   # print(mid, migi(mid))
    if migi(mid):
        ok = mid
    else:
        ng = mid
n_migi = ok
#print(n_migi,n_hidari)
print(max(0, n_migi - n_hidari-1))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import itertools
import sys
import math
from functools import lru_cache

# 1整数
# n = int(input())

# 空白区切り2変数
from queue import Queue
from operator import mul
from functools import reduce

import sys

input = sys.stdin.readline

# N個整数
n, q = list(map(int, input().split()))

s = input()

ans = set()

qq = [''] * q

for i in range(q):
    t, d = input().split()
    qq[i] = t + d


##i番目の呪文を唱える直前にposにいるゴーレムの数を返す
def dfs(pos, i):
    ret = 0
    start = -1
    ##このマスから移動した呪文までを見る必要がある
    for ii in range(i - 1, -1, -1):
        if qq[ii][0] == s[pos]:
            start = ii
            break
    if start == -1:
        ret += 1

    if pos != 0:
        # 0でなければ左からposの位置へ動くものを見つける
        for ii in range(i - 1, start, -1):
            if qq[ii] == s[pos - 1] + 'R':
                ret += dfs(pos - 1, ii)

    if pos != n - 1:
        # 右からposの位置へ動く呪文を見つける
        for ii in range(i - 1, -1, -1):
            if qq[ii] == s[pos + 1]+'L':
                ret += dfs(pos + 1, ii)
    #print(pos, i, ret)

    return ret


ret = 0

for ii in range(q - 1, -1, -1):
    if qq[ii] == s[0] + 'L':
        ret += dfs(0, ii)

for ii in range(q - 1, -1, -1):
    if qq[ii] == s[n - 1] + 'R':
        ret += dfs(n - 1, ii)

print(n-ret)

# 1整数
# n = int(input())

# 空白区切りリスト整数
# b = list(map(int, input().split()))
Problem p03088 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import itertools
import sys
import math
from functools import lru_cache

# 1整数
n = int(input())
if n == 3:
    print('61')
    quit()

divide = 1000000007

agct = ['A', 'G', 'C', 'T']

out = set()
for c in agct:
    out.add('AGC' + c)
    out.add(c+'AGC')
    out.add( 'A' + c + 'GC')
    out.add('AG' + c + 'C')
    out.add('GAC' + c)
    out.add(c+'GAC')
    out.add('ACG' + c)
    out.add(c+'ACG')

##後ろ4文字を与えて，それがokかどうか
def isok(str):
    if str[-4:] in out:
        return False
    return True


#N文字で最後の4文字がstrの時の種類数
@lru_cache(maxsize=1000000)
def saiki(n,str):
    if n == 4:
        if isok(str):
            return 1
        return 0
    ret = 0
    if isok(str)==False:
        return 0
    for c in agct:
        next = c+str
        next = next[0:4]
        ret += saiki(n-1,next)
    return ret%divide

strlist = list(itertools.product(agct, repeat=4))
#print('len is ',len(strlist))
rr = 0
for strs in strlist:
    rr += saiki(n,''.join(strs))
print(rr%divide)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import itertools
import sys
import math
from functools import lru_cache

# 1整数
n = int(input())

divide = 1000000007

agct = ['A', 'G', 'C', 'T']

out = set()
for c in agct:
    out.add('AGC' + c)
    out.add(c+'AGC')
    out.add( 'A' + c + 'GC')
    out.add('AG' + c + 'C')
    out.add('GAC' + c)
    out.add(c+'GAC')
    out.add('ACG' + c)
    out.add(c+'ACG')

##後ろ4文字を与えて，それがokかどうか
def isok(str):
    if str[-4:] in out:
        return False
    return True


#N文字で最後の4文字がstrの時の種類数
@lru_cache(maxsize=1000000)
def saiki(n,str):
    if n == 4:
        if isok(str):
            return 1
        return 0
    ret = 0
    if isok(str)==False:
        return 0
    for c in agct:
        next = c+str
        next = next[0:4]
        ret += saiki(n-1,next)
    return ret%divide

strlist = list(itertools.product(agct, repeat=4))
#print('len is ',len(strlist))
rr = 0
for strs in strlist:
    rr += saiki(n,''.join(strs))
print(rr%divide)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import itertools
import sys
import math
from functools import lru_cache

# 1整数
n = int(input())

divide = 1000000007

agct = ['A', 'G', 'C', 'T']

out = set()
for c in agct:
    out.add('AGC' + c)
    out.add(c+'AGC')
    out.add( 'A' + c + 'GC')
    out.add('AG' + c + 'C')
    out.add('GAC' + c)
    out.add(c+'GAC')
    out.add('ACG' + c)
    out.add(c+'ACG')

##後ろ4文字を与えて，それがokかどうか
def isok(str):
    if str[-4:] in out:
        return False
    return True


#N文字で最後の4文字がstrの時の種類数
@lru_cache(maxsize=1000000)
def saiki(n,str):
    if n == 4:
        if isok(str):
            return 1
        return 0
    ret = 0
    if isok(str)==False:
        return 0
    for c in agct:
        next = c+str
        next = next[0:4]
        ret += saiki(n-1,next)
    return ret%divide

strlist = list(itertools.product(agct, repeat=4))
#print('len is ',len(strlist))
rr = 0
for strs in strlist:
    rr += saiki(n,''.join(strs))
print(rr%divide)
Problem p03612 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n = int(input())
a = list(map(int, input().split()))  # 整数
count = 0
## 同一なら次と入れ替える
for i in range(n-1):
    if a[i] == i + 1:
        a[i], a[i + 1] = a[i + 1], a[i]
        count += 1
##ラストが同一だったら先に入れ替えておく
if a[n - 1] == n:
    count += 1

print(count)

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

# -*- coding: utf-8 -*-

n = int(input())
a = list(map(int, input().split()))  # 整数

##ラストが同一だったら先に入れ替えておく
count = 0

## 同一なら次と入れ替える
for i in range(n ):
    if a[i] is i + 1:
        a[i], a[i + 1] = a[i + 1], a[i]
        count += 1

print(count)
Problem p02983 (python)

Fixed submission:
def main():
    import sys
    input = sys.stdin.readline
 
    l, r = [int(i) for i in input().split()]
 
    if(r - l) >= 2019:
        print(0)
        exit()
    
    minmod = float('inf')
 
    for i in range(l, r):
        for j in range(i+1, r+1):
            temp = (i*j)%2019
            if(temp < minmod):
                minmod = temp
 
            #print("i = {}, j = {}, temp = {}, minmod = {}".format(i, j, temp, minmod))
 
    print(minmod)
 
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    import sys
    import math
    input = sys.stdin.readline
 
    l, r = [int(i) for i in input().split()]
    
    minmod = math.inf

    for i in range(l, r):
        for j in range(i+1, r+1):
            temp = (i*j)%2019
            if(temp < minmod):
                minmod = temp
 
            #print("i = {}, j = {}, temp = {}, minmod = {}".format(i, j, temp, minmod))
 
    print(minmod)
 
if __name__ == '__main__':
    main()
Problem p04032 (python)

Fixed submission:
def d_unbalanced(S):
    S_length = len(S)
    s = S + '##'  # 統一的に扱うため、アルファベットでない文字を番兵とする
    for i in range(S_length):
        # どちらかを満たす文字列をアンバランスなものとして出せばいい
        # 全部調べても成り立たなければ、アンバランスな文字列はない
        if s[i] == s[i + 1]:  # XXと文字が並んでいる
            return '{} {}'.format(i + 1, i + 2)
        elif s[i] == s[i + 2]:  # XYXと文字が並んでいる
            return '{} {}'.format(i + 1, i + 3)
    # アンバランスな文字列はなかった
    return '-1 -1'
 
S = input().strip()
print(d_unbalanced(S))

Buggy submission (verdict: Runtime Error):
def balance:
	slen = len(S)
	s = S + '##'

	for i in range(slen):
  		if s[i] == s[i+1]:
    		return '{} {}'.format(i + 1, i + 2)

  		if s[i] == [i+2]:
    		return '{} {}'.format(i + 1, i + 3)
    
	return '-1 -1'

    
S = input().strip()
print(balance(S))

Buggy submission (verdict: Runtime Error):
S = input().strip()
slen = len(S)
s = S + '##'

for i in range(slen):
  if s[i] == s[i+1]:
    print(i+1, i+2)
    exit()

  if s[i] == [i+2]:
    print(i+1, i+3)
  	exit()
    
print(-1, -1)

Buggy submission (verdict: Runtime Error):
S = input().strip()
slen = len(S)
s = S + '##'

for i in range(slen):
  if s[i] == s[i+1]:
    print(i+1, i+2)
    exit()

  if s[i] == [i+2]:
    print(i+1, i+3)
  	exit()
    
print(-1, -1)
Problem p03220 (python)

Fixed submission:
N = int(input())
T,A  =[int(i) for i in input().split()]
H = [int(i) for i in input().split()]
diff = (abs(A-(T-H[0]*0.006)))
palace = 0
for i in range(len(H)):
    if(abs(A-(T-H[i]*0.006)) < diff):
        palace = i
        diff = abs(A-(T-H[i]*0.006))
print(palace+1)

Buggy submission (verdict: Runtime Error):
N = int(input())
T,A  =[int(i) for i in input().split()]
H = [int(i) for i in input.split()]
diff = (abs(A-(T-H[0]*0.006)))
palace = 0
for i in range(H):
    if(abs(A-(T-H[i]*0.006)) < diff):
        palace = i
        diff = abs(A-(T-H[i]*0.006))
print(palace)
Problem p03370 (python)

Fixed submission:
N,X = [int(i) for i in input().split()]
m = []
for i in range(N):
    m.append(int(input()))
summation = sum(m)
min_d = min(m)
print(N+int((X - summation)/min_d))

Buggy submission (verdict: Runtime Error):
N,X = int(input())
m = []
for i in range(N):
    m.append(int(input()))
summation = sum(m)
min_d = min(m)
print(N+int((X - suumation)/min_d))

Buggy submission (verdict: Runtime Error):
N,X = int(input())
m = []
for i in range(N):
    m.append(int(input()))
summation = sum(m)
min_d = min(m)
print(N+int((X - suumation)/m))
Problem p03416 (python)

Fixed submission:
A,B =[int(i) for i in input().split()]
num = 0
for i in range(A,B+1):
    n = i
    s=[]
    while(n>0):
        s.append(str(n%10))
        n //= 10

    s_rev = ''.join(s[::-1])
    s = ''.join(s)
    if(s == s_rev):
        num += 1
print(num)

Buggy submission (verdict: Runtime Error):
A,B =[int(i) for i in input().split()]
num += 0
for i in range(A,B+1):
    n = i
    s=[]
    while(n>0):
        s.append(str(n%10))
        n //= 10

    s_rev = ''.join(s[::-1])
    s = ''.join(s)
    if(s == s_rev):
        num += 1
print(num)
Problem p03434 (python)

Fixed submission:
N = int(input())
a = [int(i) for i in input().split()]
a_sorted = sorted(a,reverse=True)
diff = 0
for i in range(int(N/2)):
       diff +=  a_sorted[2*i] - a_sorted[2*i + 1]
if(N%2 != 0):
       diff += a_sorted[N-1]
print(diff)

Buggy submission (verdict: Runtime Error):
N = input()
a = [int(i) for i in range(N)]
a_sorted = sorted(a)
diff = 0
for i in range(N/2):
   diff =  a_sorted[2*i] - a_sorted[2*i + 1]
if(N%2 != 0):
    diff += a_sorted[N-1]
print(diff)
Problem p03457 (python)

Fixed submission:
N = int(input())
table = [[int(i) for i in input().split()] for n in range(N)]
can = True
for i in range(N):
    if(i != 0):
        dt = table[i][0] - table[i-1][0]
        dist = abs(table[i][1]-table[i-1][1]) +abs(table[i][2]-table[i-1][2])
    else:
        dt = table[i][0]
        dist = abs(table[0][1]) + abs(table[0][2])
    if(dist > dt):
        can = False
        break
    elif((dt-dist)%2 != 0):
        can = False
        break
if(can == True):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
table = [[int(t) for i in input().split()] for n in range(N)]
can = True
for i in range(N):
    if(i != 0):
        dt = table[i][0] - table[i-1][0]
        dist = abs(table[i][1]-table[i-1][1]) +abs(table[i][2]-table[i-1][2])
    else:
        dt = table[i][0]
        dist = abs(table[0][1]) + abs(table[0][2])
    if(dist > dt):
        can = False
        break
    elif((dt-dist)%2 != 0):
        can = False
        break
if(can == True):
    print("Yes")
else:
    print("No")
Problem p03469 (python)

Fixed submission:
S = input()
S = S[:3] + '8' + S[4:]
print(S)

Buggy submission (verdict: Runtime Error):
S = input()
S[3] = 8
print(S)