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

Fixed submission:
n, k = map(int, input().split())
s = list(map(int, list(str(input()))))
c = 0
ran = [0,0]
for i in range(n):
    if s[c] == s[i]:
        ran[-1] += 1
    else:
        ran.append(i+1)
        c = i
result = []
for i in range(1, len(ran)):
    if s[ran[i-1]] == 1:
        result.append(ran[min(i+2*k,len(ran)-1)]-ran[i-1])
    else:
        result.append(ran[min(i+2*k-1, len(ran)-1)]-ran[i-1])
print(max(result))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split(' '))
s = list(map(int, list(input())))

s.append(9)
ran = []
a = 0
i = 1
#ランレングス圧縮
while i < len(s):
    if s[a] == s[i]:
        i +=1
    else:
        ran.append(i-a)
        a = i
        i += 1
ran.append(0)
ran.append(0)
ran.append(0)
b = s[0]
result = []
i = 0
counter = 0
if len(ran) <= k*2:
    print(n)
else:
    while i+2*k <= len(ran)-3:
        if s[counter] == 1:
            result.append(sum(ran[i:2*k+i+1]))
        else:
            result.append(sum(ran[i:2*k+i]))
        counter += ran[i]
        i += 1
    print(max(result))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split(' '))
s = list(map(int, list(input())))

s.append(9)
ran = []
a = 0
i = 1
#ランレングス圧縮
while i < len(s):
    if s[a] == s[i]:
        i +=1
    else:
        ran.append(i-a)
        a = i
        i += 1
ran.append(0)
ran.append(0)
ran.append(0)
b = s[0]
result = []
i = 0
counter = 0
if n/2 <= k:
    print(n)
else:
    while i+2*k <= len(ran)-3:
        if s[counter] == 1:
            result.append(sum(ran[i:2*k+i+1]))
        else:
            result.append(sum(ran[i:2*k+i]))
        counter += ran[i]
        i += 1
    print(max(result))

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split(' '))
s = list(map(int, list(input())))

s.append(9)
ran = []
a = 0
i = 1
#ランレングス圧縮
while i < len(s):
    if s[a] == s[i]:
        i +=1
    else:
        ran.append(i-a)
        a = i
        i += 1
ran.append(0)
ran.append(0)
ran.append(0)
b = s[0]
result = []
i = 0
counter = 0
if n/2 <= k:
    print(n)
else:
    while i+2*k <= len(ran):
        if s[counter] == 1:
            result.append(sum(ran[i:2*k+i+1]))
        else:
            result.append(sum(ran[i:2*k+i]))
        counter += ran[i]
        i += 1
    print(max(result))

Buggy submission (verdict: Runtime Error):
n, k = list(map(int, input().split(' ')))
s = list(map(int, list(input())))
pres = []
i = 0
while i < n:
    ka = 0
    while s[i] == s[i+ka]:
        ka += 1
        if ka+i >= n:
            break
    pres.append([s[i],ka])
    i += ka
ia = 0
result = []
while ia < len(pres):
    h = 0
    if pres[ia][0] == 0:
        if ia + 2*k <= len(pres):
            for p in range(2*k):
                h += pres[p+ia][1]
            result.append(h)
        else:
            break
    else:
        if ia + 2*k+1 <= len(pres):
            for p in range(2*k+1):
                h += pres[ia+p][1]
            result.append(h)
        else:
            break
    ia += 1
print(max(result))
Problem p03095 (python)

Fixed submission:
mod = 10**9+7
n = int(input())
s = input()
d = {}
for i in s:
    if i in d:
        d[i] += 1
    else:
        d[i] = 1
result = 1
for i, j in d.items():
    result = (result*(j+1))%mod

print((result-1)%mod)

Buggy submission (verdict: Runtime Error):
use std::io::stdin;
use std::collections::HashMap;

fn main() {
    let mut st = String::new();
    stdin().read_line(&mut st).unwrap();
    let n = st.trim().parse::<usize>().unwrap();
    let mut st = String::new();
    stdin().read_line(&mut st).unwrap();
    let s:Vec<char> = st.trim().chars().collect();
    let mut map:HashMap<&char, i64> = HashMap::new();
    for i in &s {
        let count = map.entry(i).or_insert(1);
        *count += 1;
    };
    let mo = 100000007;
    let mut result:i64 = 1;
    for (_i, j) in map.iter() {
        result = (result*j)%mo;
    };
    println!("{}", result-1);
}


fn bisec(v:&Vec<i64>, num:&i64) -> usize {
    let mut l:usize = 0;
    let mut r = v.len() as usize;
    let mut m = (l+r)/2 as usize;
    while l < r {
        if num <= &v[m] {
            r = m;
        } else {
            l = m+1;
        };
        m = (l+r)/2;
    };
    l
}

fn max (a:&i64, b:&i64) -> i64 {
    if a < b {
        *b
    } else {
        *a
    }
}

fn min (a:&i64, b:&i64) -> i64 {
    if a > b {
        *b
    } else {
        *a
    }
}
Problem p03105 (python)

Fixed submission:
a, b , c = map(int, input().split(' '))
if a*c < b:
    print(c)
else:
    print(int(b//a))

Buggy submission (verdict: Runtime Error):
a, b , c = map(int, input().split(' '))
if a*c < b:
    print(c)
else:
    printn(int(b//a))
Problem p03109 (python)

Fixed submission:
s = str(input())
a = list(map(int,s.split('/')))
if a[1]<=2019 and a[1] <=4 and a[2]<=30:
    print('Heisei')
else:
    print('TBD')

Buggy submission (verdict: Runtime Error):
s = str(input())
a = s.split('/')
if a[1]<=2019 and a[1] <=4 and a[2]<=30:
    print('Heisei')
else:
    print('TBD')
Problem p03147 (python)

Fixed submission:
n = int(input())
h = list(map(int, input().split()))
hantei = [0 for _ in range(n)]
hantei.append(1)
result = 0
h.append(10*3)

while any(hantei[i] != 1 for i in range(n)):
    min_h = min(h)
    cost = 0
    for i in range(len(h)):
        if hantei[i]==1:
            result += cost
            cost = 0
            h[i] = 10**3
        else:
            h[i] -= min_h
            if h[i] == 0:
                hantei[i] = 1
            cost = min_h
print(result)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = list(map(int, input().split()))
hantei = [0 for _ in range(n)]
hantei.append(1)
result = 0
h.append(10*3)

while any(hantei[i] != 1 for i in range(n)):
    min_h = min(h)
    cost = 0
    for i in range(len(h)):
        if hantei[i]==1:
            result += cost
            cost = 0
            h[i] = 10**3
        else:
            h[i] -= min_h
            if h[i] == 0:
                hantei[i] = 1
            cost = min_
print(result)
Problem p03262 (python)

Fixed submission:
n, X = map(int, input().split())
x = list(map(int, input().split()))
x.append(X)
x = sorted(x)
y = [x[i+1]-x[i] for i in range(n)]

def eu(a, b):
    a, b = sorted([a,b])
    while a != 0:
        b, a = a, b%a
    return b
d = y[0]
for i in range(1, n):
    d = eu(d, y[i])
print(d)

Buggy submission (verdict: Runtime Error):
import math
n, X = map(int, input().split(' '))
x = list(map(int, input().split(' ')))
x = [abs(X-i) for i in x]
c = x[0]
for i in range(1, n):
    c = math.gcd(c, x[i])

print(c)

Buggy submission (verdict: Runtime Error):
import math
n, X = map(int, input().split(' '))
x = list(map(int, input().split(' ')))
x = [abs(X-i) for i in x]
c = x[0]
for i in range(1, n):
    gc = math.gcd(c, x[i])
    if c <= gc:
        continue
    else:
        c = gc
print(c)
Problem p03311 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split(' ')))
a = [a[i]-i-1 for i in range(n)]
a.sort()
if n%2 == 0:
    num = int(n/2)
    b = int((a[num-1]+a[num])/2)
    a = [abs(a[i]-b) for i in range(n)]
else:
    num = int(n/2)
    b = int(a[num])
    a = [abs(a[i]-b) for i in range(n)]
print(sum(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
a = [a[i]-i for i in range(n)]

import numpy as np
a = np.array(a)
x = np.median(a)
r = 0
for i in range(n):
    r += abs(a[i]-x)
print(int(r))
Problem p03355 (python)

Fixed submission:
def main():
    s = str(input())
    s += '0'
    k = int(input())
    result = set()
    for i in range(1, 6):
        for j in range(len(s)-i):
            result.add(s[j:j+i])
    out = list(result)
    out.sort()
    print(out[k-1])
if __name__ =='__main__':
    main()

Buggy submission (verdict: Runtime Error):
s = str(input())
k = int(input())
result = []
for i in range(1, k+1):
    for j in range(len(s)-i):
        result.append(s[j:j+i])
r = set(result)
out = list(r)
out.sort()
print(out[k-1])
Problem p03361 (python)

Fixed submission:
import sys
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
hantei = [[0 for _ in range(w)] for _ in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            if i < h-1:
                if s[i+1][j] == "#":
                    hantei[i][j] = 1
                    hantei[i+1][j] = 1
            if j < w-1:
                if s[i][j+1] == "#":
                    hantei[i][j] = 1
                    hantei[i][j+1] = 1

for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            if hantei[i][j] == 0:
                print("No")
                sys.exit()

print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
hantei = [[0 for _ in range(h)] for _ in range(w)]
for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            if i < h-1:
                if s[i+1][j] == "#":
                    hantei[i][j] = 1
                    hantei[i+1][j] = 1
            if j < w-1:
                if s[i][j+1] == "#":
                    hantei[i][j] = 1
                    hantei[i][j+1] = 1

for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            if hantei[i][j] == 0:
                print("No")
                sys.exit()

print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
hantei = [[0 for _ in range(h)] for _ in range(w)]
for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            if i < h-1:
                if s[i+1][j] == "#":
                    hantei[i][j] = 1
                    hantei[i+1][j] = 1
            if j < w-1:
                if s[i][j+1] == "#":
                    hantei[i][j] = 1
                    hantei[i][j+1] = 1

for i in range(w):
    for j in range(h):
        if s[i][j] == "#":
            if hantei[i][j] == 0:
                print("No")
                sys.exit()

print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
hantei = [[0 for _ in range(h)] for _ in range(w)]
for i in range(w-1):
    for j in range(h-1):
        if s[i][j] == "#":
            if s[i+1][j] == "#":
                hantei[i+1][j] = 1
                hantei[i][j] = 1
            if s[i][j+1] == "#":
                hantei[i][j+1] = 1
                hantei[i][j] = 1
for j in range(w-1):
    if s[h-1][j] == "#":
        if s[h-1][j+1] == "#":
            hantei[h-1][j] = 1
            hantei[h-1][j+1] = 1
for i in range(h-1):
    if s[i][w-1] == "#":
        if s[i+1][w-1] == "#":
            hantei[i][w-1] = 1
            hantei[i+1][w-1] = 1


for i in range(w):
    for j in range(h):
        if s[i][j] == "#":
            if hantei[i][j] == 0:
                print("No")
                sys.exit()

print("Yes")
Problem p03420 (python)

Fixed submission:
n, k = map(int, input().split(' '))
result = 0
for i in range(1, n+1):
    p = n//i
    result += p*max(0,i-k)
    result += max(0, n%i-k+1)
    if k == 0:
        result -= 1
print(result)

Buggy submission (verdict: Runtime Error):
def main():
    n, k = map(int, input().split(' '))
    result = [n//i*max(0,i-k) + max(0, n%i-k+1) for i in range(1, n+1)]
    if k == 0:
        result -= n
    print(result)
main()
Problem p03450 (python)

Fixed submission:
import sys
n, m = map(int, input().split())
if m==0:
    print("Yes")
    sys.exit()

tree = [[] for _i in range(n+1)]
for _i in range(m):
    l, r, d = map(int, input().split())
    tree[l].append([r, d])
    tree[r].append([l, -d])

from collections import deque
INF = "INF"
visit = [INF for _i in range(n+1)]
for i in range(1, n+1):
    if visit[i]==INF:
        visit[i] = 0
    else:
        continue
    q = deque([i])
    while q:
        p = q.popleft()
        if visit[p]==INF:
            visit[p] = 0
        for i, j in tree[p]:
            if i==p:
                continue
            elif visit[i] == INF:
                visit[i] = visit[p]+j
                q.append(i)
            elif visit[i] == visit[p]+j:
                continue
            else:
                print("No")
                sys.exit()

print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
n, m = map(int, input().split())
if m==0:
    print("Yes")

tree = [[] for _i in range(n+1)]
for _i in range(m):
    l, r, d = map(int, input().split())
    tree[l].append([r, d])
    tree[r].append([l, -d])


from collections import deque
INF = float("inf")
visit = [INF for _i in range(n+1)]
visit[l] = 0
q = deque([l])
while q:
    p = q.popleft()
    for i, j in tree[p]:
        if i==p:
            continue
        elif visit[i] == INF:
            visit[i] = visit[p]+j
            q.append(i)
        elif visit[i] == visit[p]+j:
            continue
        else:
            print("No")
            sys.exit()
print(visit)
print("Yes")
Problem p03470 (python)

Fixed submission:
n = int(input())
d = [int(input()) for i in range(n)]
d.sort(reverse=True)
count = 1
for i in range(n-1):
    if d[i]> d[i+1]:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
d = [int(input()) for i in range(n)]
d.sort(reverse=True)
result = []
for i in range(n-1):
    count = 1
    if all(d[x] == d[i] for x in range(i,n)):
        count = 1
    else:
        if d[i] == d[i+1]:
            count += 1
        for j in range(i, n-1):
            if d[j] > d[j+1]:
                count += 1
    result.append(count)
print(max(result))

Buggy submission (verdict: Runtime Error):
n = int(input())
d = [int(input()) for i in range(n)]
d.sort(reverse=True)
result = []
for i in range(n-1):
    count = 1
    if all(d[x] == d[i] for x in range(i,n)):
        count = 1
    else:
        if d[i] == d[i+1]:
            count += 1
        for j in range(n-i-1):
            if d[j+i] > d[j+i+1]:
                count += 1
    result.append(count)
print(max(result))
Problem p03472 (python)

Fixed submission:
n, h = list(map(int, input().split(' ')))
k = [list(map(int, input().split(' '))) for _ in range(n)]
a = []
b = []
for i in range(n):
    a.append(k[i][0])
    b.append(k[i][1])

a.sort(reverse = True)
b.sort(reverse = True)
a.append(0)
b.append(0)
count = 0
x = 0
y = 0

while h > 0:
    if a[x] <= b[y]:
        h -= b[y]
        y += 1
        count += 1
    elif a[x] > b[y]:
        count += h//a[x]
        if h%a[x] != 0:
            count += 1
        h = 0
print(count)

Buggy submission (verdict: Runtime Error):
n, h = list(map(int, input().split(' ')))
a, b = [list(map(int, input().split(' '))) for _ in range(n)]

a.sort(reverse = True)
b.sort(reverse = True)
a.append(0)
b.append(0)
count = 0
x = 0
y = 0

while h < 0:
    if a[x] <= b[y]:
        h -= b[y]
        y += 1
        count += 1
    elif a[x] > b[y]:
        h -= a[x]
        count += 1
print(count)
Problem p03543 (python)

Fixed submission:
import sys
n = input()
for i in range(2):
    if n[i]==n[i+1] and n[i]==n[i+2]:
        print("Yes")
        sys.exit()
print("No")

Buggy submission (verdict: Runtime Error):
n = input()
for i in range(2):
    if n[i]==n[i+1] and n[i]==n[i+2]:
        print("Yes")
        sys.exit()
print("No")
Problem p03624 (python)

Fixed submission:
s = sorted(list(set(list(input()))))
i = 0
while i < len(s) and chr(i+97)==s[i]:
    i += 1
if i<=25:
    print(chr(i+97))
else:
    print("None")

Buggy submission (verdict: Runtime Error):
s = sorted(list(set(list(input()))))
i = 0
while i <= 25 and chr(i+97)==s[i]:
    i += 1
if i<=25:
    print(chr(i+97))
else:
    print("None")

Buggy submission (verdict: Runtime Error):
s = sorted(list(set(list(input()))))
i = 0
while i <= 25 and chr(i+97)==s[i]:
    i += 1
if i<=25:
    print(chr(i+97))
else:
    print("None")
Problem p03633 (python)

Fixed submission:
from fractions import gcd
n = int(input())
t = [int(input()) for _ in range(n)]
result = t[0]
for i in range(1, n):
    result = result*t[i]//gcd(result, t[i])
print(result)

Buggy submission (verdict: Runtime Error):
from math import gcd
n = int(input())
t = [int(input()) for _ in range(n)]
result = t[0]
for i in range(1, n):
    result = result*t[i]//gcd(result, t[i])
print(result)
Problem p03673 (python)

Fixed submission:
n = int(input())
a = list(input().split())

if n%2==1:
    print(" ".join(a[n-1::-2]+a[1:n+1:2]))
else:
    print(" ".join(a[n::-2]+a[:n+1:2]))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(input().split())

if n%2==1:
    print(*a[n-1::-2], *a[1:n+1:2])
else:
    print(*a[n::-2], *a[:n+1:2])
Problem p03715 (python)

Fixed submission:
from math import floor, ceil
h, w = map(int, input().split(' '))
result = []
if h%3 == 0 or w%3 == 0:
    print(0)
elif h<3 or w<3:
    if h<3 and w>=3:
        for i in range(1, w-1):
            x = i*h
            y = (w-i)*floor(h/2)
            z = (w-i)*ceil(h/2)
            result.append(max(x,y,z)-min(x,y,z))
            y = floor((w-i)/2)*h
            z = ceil((w-i)/2)*h
            result.append(max(x,y,z)-min(x,y,z))
        print(min(result))
    elif h>=3 and w<3:
        for i in range(1, h-1):
            x = i*w
            y = (h-i)*floor(w/2)
            z = (h-i)*ceil(w/2)
            result.append(max(x,y,z)-min(x,y,z))
            y = floor((h-i)/2)*w
            z = ceil((h-i)/2)*w
            result.append(max(x,y,z)-min(x,y,z))
        print(min(result))
    else:
        print(1)
else:
    for i in range(1, h-1):
        x = i*w
        y = (h-i)*floor(w/2)
        z = (h-i)*ceil(w/2)
        result.append(max(x,y,z)-min(x,y,z))
        y = floor((h-i)/2)*w
        z = ceil((h-i)/2)*w
        result.append(max(x,y,z)-min(x,y,z))
    for i in range(1, w-1):
        x = i*h
        y = (w-i)*floor(h/2)
        z = (w-i)*ceil(h/2)
        result.append(max(x,y,z)-min(x,y,z))
        y = floor((w-i)/2)*h
        z = ceil((w-i)/2)*h
        result.append(max(x,y,z)-min(x,y,z))
    print(min(result))

Buggy submission (verdict: Runtime Error):
from math import floor, ceil
h, w = map(int, input().split(' '))
result = []
if h%3 == 0 or w%3 == 0:
    print(0)
else:
    for i in range(1, h-1):
        x = i*w
        y = (h-i)*floor(w/2)
        z = (h-i)*ceil(w/2)
        result.append(max(x,y,z)-min(x,y,z))
        y = floor((h-i)/2)*w
        z = ceil((h-i)/2)*w
        result.append(max(x,y,z)-min(x,y,z))
    for i in range(1, w-1):
        x = i*h
        y = (w-i)*floor(h/2)
        z = (w-i)*ceil(h/2)
        result.append(max(x,y,z)-min(x,y,z))
        y = floor((w-i)/2)*h
        z = ceil((w-i)/2)*h
        result.append(max(x,y,z)-min(x,y,z))
    print(min(result))
Problem p03739 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split(' ')))
result = 0
counter = 0
if a[0] == 0:
    counter += 1
    result += 1
else:
    counter += a[0]

for i in range(1, n):
    if counter < 0:
        counter += a[i]
        if counter == 0:
            counter += 1
            result +=1
        elif counter > 0:
            continue
        else:
            result += 1-counter
            counter = 1
    else:
        counter += a[i]
        if counter == 0:
            counter -= 1
            result += 1
        elif counter < 0:
            continue
        else:
            result += counter+1
            counter = -1
out = []
out.append(result)
result = 0
counter = 0
if a[0] == 0:
    counter -= 1
    result +=1
elif a[0]< 0:
    counter += 1
    result += 1-a[0]
else:
    counter -= 1
    result += 1+a[0]

for i in range(1, n):
    if counter < 0:
        counter += a[i]
        if counter == 0:
            counter += 1
            result += 1
        elif counter > 0:
            continue
        else:
            result += 1-counter
            counter = 1
    else:
        counter += a[i]
        if counter == 0:
            counter -= 1
            result +=1
        elif counter < 0:
            continue
        else:
            result += counter+1
            counter = -1
out.append(result)
print(min(out))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split(' ')))
result = 0
h = 0
if a[0] == 0:
    counter += 1
    result += 1
else:
    counter += a[0]

for i in range(1, n):
    if counter < 0:
        counter += a[i]
        if counter == 0:
            counter += 1
            result +=1
        elif counter > 0:
            continue
        else:
            result += 1-counter
            counter = 1
    else:
        counter += a[i]
        if counter == 0:
            counter -= 1
            result += 1
        elif counter < 0:
            continue
        else:
            result += counter+1
            counter = -1
out = []
out.append(result)
result = 0
counter = 0
if a[0] == 0:
    counter -= 1
    result +=1
elif a[0]< 0:
    counter += 1
    result += 1-a[0]
else:
    counter -= 1
    result += 1+a[0]

for i in range(1, n):
    if counter < 0:
        counter += a[i]
        if counter == 0:
            counter += 1
            result += 1
        elif counter > 0:
            continue
        else:
            result += 1-counter
            counter = 1
    else:
        counter += a[i]
        if counter == 0:
            counter -= 1
            result +=1
        elif counter < 0:
            continue
        else:
            result += counter+1
            counter = -1
out.append(result)
print(min(out))
Problem p03800 (python)

Fixed submission:
n = int(input())
s = str(input())
s += s
candidate = [[1,-1],[1,1],[-1,-1],[-1,1]]
result = []
checker = 0
while checker < 4:
    result = candidate[checker]
    for i in range(1, len(s)-1):
        if s[i] == 'o' and result[i] == 1:
            result.append(result[-2])
        elif s[i] == 'x' and result[i] == 1:
            result.append(-result[-2])
        elif s[i] == 'o' and result[i] == -1:
            result.append(-result[-2])
        else:
            result.append(result[-2])
    if result[:n] == result[n:]:
        checker += 10
    else:
        checker += 1
if checker == 4:
    print(-1)
else:
    result = ['S' if x == 1 else 'W' for x in result[:n]]
    print(''.join(result))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = str(input())
s += s[0]
candidate = [[1,-1],[1,1],[-1,-1],[-1,1]]
result = []
checker = 0
while checker < 4:
    result = candidate[checker]
    for i in range(1, n):
        if s[i] == 'o' and result[i] == 1:
            result.append(result[-2])
        elif s[i] == 'x' and result[i] == 1:
            result.append(-result[-2])
        elif s[i] == 'o' and result[i] == -1:
            result.append(-result[-2])
        else:
            result.append(result[-2])
    if result[0] == result[-1]:
        checker += 10
    else:
        checker += 1
if checker == 4:
    print(-1)
else:
    result = ['S' if x == 1 else 'W' for x in result[:n]]
    print(''.join(result)
Problem p03830 (python)

Fixed submission:
n = int(input())

result = [0 for i in range(n+1)]

for i in range(1, n+1):
    for j in range(2, i+1):
        while i%j == 0:
            result[j] += 1
            i //= j
        if i == 1:
            break
r = 1
for i in range(n+1):
    r *= result[i]+1
    r %= 10**9 + 7
print(r)

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

def gcd(num):
    result = []
    for i in range(2, int(num**(1/2))+2):
        r = 0
        while num%i == 0:
            num = num//i
            r += 1
        if r != 0:
            result.append(r)
    return result

c = 1
for i in range(1, n+1):
    c *= i
o = 1
res = gcd(c)
if len(res) != 0:
    for i in range(len(res)):
        o *= res[i]+1
    print(o%(10**9 + 7))
else:
    print(2)
Problem p04012 (python)

Fixed submission:
from collections import Counter
w = list(Counter(list(input())).items())
if all(w[i][1]%2==0 for i in range(len(w))):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
from collections import Counter
w = list(Counter(list(input())).items())
if all(w[i][1]%2== for i in range(len(w))):
    print("Yes")
else:
    print("No")