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

Fixed submission:
N = int(input())
A = [int(i) for i in input().split()]

counts = [0]*9

for i in A:
    color = int(i/400)
    if color > 8:
        color = 8
    counts[color] += 1

#print(counts)

v = 8 - counts[:-1].count(0)

if counts[-1] == 0:
    print(v,v)
else:
    if v == 0:
        print(1,counts[-1])
    else :
        print(v,v+counts[-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]

counts = [0]*9

for i in A:
    counts[int(i/400)] += 1

#print(counts)

v = 8 - counts[:-1].count(0)

if counts[-1] == 0:
    print(v,v)
else:
    if v == 0:
        print(1,counts[-1])
    else :
        print(v,v+counts[-1])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(i) for i in input().split()]

counts = [0]*9

for i in A:
    counts[int(i/400)] += 1

#print(counts)

v = 8 - counts[:-1].count(0)

if counts[-1] == 0:
    print(v,v)
else:
    if v == 0:
        print(1,counts[-1])
    else :
        print(v,v+counts[-1])
Problem p03827 (python)

Fixed submission:
N = int(input())
S = input()
x = [0]*N

if S[0] == 'I':
        x[0] += 1
else:
    x[0] -= 1

for i in range(1,N):
    if S[i] == 'I':
        x[i] = x[i-1] + 1
    else:
        x[i] = x[i-1] - 1

print(max(x) if max(x) > 0 else 0)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
x = [0]*N

if S[0] == 'I':
        x[0] += 1
else:
    x[0] -= 1

for i in range(1,N):
    if S[i] == 'I':
        x[i] = x[i-1] + 1
    else:
        x[i] = x[i-1] - 1

print(max(x,0))
Problem p03828 (python)

Fixed submission:
import math
from collections import Counter

def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

if __name__ == "__main__":
    N = int(input())
    num = math.factorial(N)
    pf = prime_factors(num)
    c = Counter(pf)
    
    res = 1

    for i in c.values():
        res *= i + 1
    
    print(res % (10**9+7))

Buggy submission (verdict: Runtime Error):
def prime_factors(n):
    i = 2
    factors = []
    while i * i <= n:
        if n % i:
            i += 1
        else:
            n //= i
            factors.append(i)
    if n > 1:
        factors.append(n)
    return factors

if __name__ == "__main__":
    N = int(input())
    num = math.factorial(N)
    pf = prime_factors(num)
    c = Counter(pf)
    
    res = 1

    for i in c.values():
        res *= i + 1
    
    print(res % (10**9+7))
Problem p03966 (python)

Fixed submission:
import math
from decimal import *

N = int(input())
_input = []
for i in range(N):
    _input.append(list(map(int,input().split())))

total_T = 1
total_A = 1

for t,a in _input:
    #n = max(math.ceil(total_T/t),math.ceil(total_A/a))
    n = max(-(-total_T//t), -(-total_A//a))
    total_T = int(t*n)
    total_A = int(a*n)

print(total_A+total_T)

Buggy submission (verdict: Runtime Error):
import math
from decimal import *

N = int(input())
_input = []
for i in range(N):
    _input.append(list(map(int,input().split())))

total_T = 1
total_A = 1

for t,a in _input:
    #n = max(math.ceil(total_T/t),math.ceil(total_A/a))
    n = max(-(-t//Ti), -(-a//Ai))
    total_T = int(t*n)
    total_A = int(a*n)

print(total_A+total_T)
Problem p02988 (python)

Fixed submission:
n = int(input())
s = list(map(int, input().split()))

l = 0
for i in range(1, n-1):
    if s[i-1] < s[i] < s[i+1] or s[i+1] < s[i] < s[i-1]:
        l += 1

print(l)

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

a = len(d)/2
l = d[a+1] - d[a]

print(l)
Problem p02909 (python)

Fixed submission:
s = input()
if s == "Sunny":
    print("Cloudy")
elif s == "Cloudy":
    print("Rainy")
else:
    print("Sunny")

Buggy submission (verdict: Runtime Error):
s = input()
if s == "Sunny"
    print("Cloudy")
elif s == "Cloudy":
    print("Rainy")
else:
    print("Sunny")
Problem p02995 (python)

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

def lcm(a, b):
    return (a*b)//gcd(a,b)

def solve(a, b, c, d):
    div = ((b//c) - ((a-1)//c)) + ((b//d) - ((a-1)//d)) - ((b//lcm(c,d)) -
            ((a-1)//lcm(c,d))) 

    return (b - a + 1) - div

a, b, c, d = map(int, input().split())
print(solve(a,b,c,d))

Buggy submission (verdict: Runtime Error):
from math import gcd

def lcm(a, b):
    return (a*b)//gcd(a,b)


def solve(a, b, c, d):
    div = ((b//c) - ((a-1)//c)) + ((b//d) - ((a-1)//d)) - ((b//lcm(c,d)) -
            ((a-1)//lcm(c,d))) 

    return (b - a + 1) - div

a, b, c, d = map(int, input().split())
print(solve(a,b,c,d))
Problem p03844 (python)

Fixed submission:
s = list(input().split())
if (s[1]=='+'):
    print(int(s[0])+int(s[2]))
if (s[1]=='-'):
    print(int(s[0])-int(s[2]))

Buggy submission (verdict: Runtime Error):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
p=[0]*m
x=[0]*m
for i in range(m):
  p[i],x[i]=map(int,input().split())  
for i in range(m):
  print(sum(t)-t[p[i]-1]+x[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
t = list(map(int,input(),split()))
m = int(input())
p = [0]* m 
x = [0]* m 
for i in range(m):
    p[i],x[i]= map(int(input(),split()))
for i in range(m):
    print(sum(t)-t[p[i]-1]+x[i])
Problem p03845 (python)

Fixed submission:
n=int(input())
t=list(map(int,input().split()))
m=int(input())
p=[0]*m
x=[0]*m
for i in range(m):
  p[i],x[i]=map(int,input().split())  
for i in range(m):
  print(sum(t)-t[p[i]-1]+x[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
t=list(map(int,input().split()))
m=int(input())
p=[0]* m 
x=[0]* m 
for i in range(m):
    p[i],x[i]= map(int(input().split()))
for i in range(m):
    print(sum(t)-t[p[i]-1]+x[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
t=list(map(int,input(),split()))
m=int(input())
p=[0]* m 
x=[0]* m 
for i in range(m):
  p[i],x[i]= map(int(input(),split()))
for i in range(m):
  print(sum(t)-t[p[i]-1]+x[i])

Buggy submission (verdict: Runtime Error):
n=int(input())
t=list(map(int,input(),split()))
m=int(input())
p=[0]* m 
x=[0]* m 
for i in range(m):
    p[i],x[i]= map(int(input(),split()))
for i in range(m):
    print(sum(t)-t[p[i]-1]+x[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
t = list(map(int,input(),split()))
m = int(input())
p = [0]* m 
x = [0]* m 
for i in range(m):
    p[i],x[i]= map(int(input(),split()))
for i in range(m):
    print(sum(t)-t[p[i]-1]+x[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
t = list(map(int,input(),split()))
m = int(input())
p = [0]* m 
x = [0]* m 
for i in range(m):
    p[i],x[i]= map(int(input(),split()))
for i in range(m):
    print(sum(t)-t[p[i]-1]+x[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
t = list(map(int,input(),split()))
m = int(input())
p = [0]* m 
x = [0]* m 
for i in range(m):
    p[i],x[i]= map(int(input(),split()))
print(sum(t)-t[p[i]-1]+x[i])
Problem p03846 (python)

Fixed submission:
n = int(input())
A = list(map(int,input().split()))
A.sort()
B = []
if n % 2 == 0:
    i_max = n//2
    for i in range(1,i_max+1):
        B.append(2*i-1)
        B.append(2*i-1)
else:
    i_max = (n-1)//2
    B.append(0)
    for i in range(1,i_max+1):
        B.append(2*i)
        B.append(2*i)
if A == B:
    print((2**i_max)%(10**9+7))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(map(int,input().split()))
if n % 2 == 1:
    t = 0
    for i in s:
        c = count(i)
        if i != 0 and c == 2:
            t = t+1
        if i == 0 and c == 0:
            t = t
        else:
            t = 0
            break
    if t == 0:
        print(0)
    else:
        print(2^t)
elif n % 2 == 0:
    t = 0
    for i in s:
        c = count(i)
        if c == 2:
            t = t+1
        else:
            t = 0
            break
    if t == 0:
        print(0)
    else:
        print(2^t)
Problem p03289 (python)

Fixed submission:
s=input()
if s[0] =='A' and s[2:-1].count('C') ==1 and s[1:].replace('C', '').islower():
  print('AC')
else:
  print('WA')

Buggy submission (verdict: Runtime Error):
s=input()
if s[0] =="A" and s[2:-1].count("C") ==1:
  if s[1:].replace("C").islower:
    print("AC")
  else:
    print('WA')  
else:
  print('WA')

Buggy submission (verdict: Runtime Error):
s=input()
print(s[2:-1])
if s[0] =="A" and s[2:-1].count("C") ==1:
  if s[1:].replace("C").islower:
    print("AC")
  else:
    print('WA')  
else:
  print('WA')
Problem p02995 (python)

Fixed submission:
from fractions import gcd


def main():
    A, B, C, D = map(int, input().split())
    Q_AC, R_AC = A // C, A % C
    Q_AD, R_AD = A // D, A % D
    Q_BC, R_BC = B // C, B % C
    Q_BD, R_BD = B // D, B % D
    Q_ACD, R_ACD = A // lcm(C, D), A % lcm(C, D)
    Q_BCD, R_BCD = B // lcm(C, D), B % lcm(C, D)
    N_C = num_baisu(Q_AC, Q_BC, R_AC, R_BC)
    N_D = num_baisu(Q_AD, Q_BD, R_AD, R_BD)
    N_CD = num_baisu(Q_ACD, Q_BCD, R_ACD, R_BCD)
    print(B - A + 1 - (N_C + N_D - N_CD))
    return


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


def num_baisu(Q_A, Q_B, R_A, R_B):
    if R_A == 0 and R_B == 0:
        return Q_B - Q_A + 1
    elif R_A == 0 and R_B != 0:
        return Q_B - Q_A + 1
    elif R_A != 0 and R_B == 0:
        return Q_B - (Q_A + 1) + 1
    else:
        return Q_B - (Q_A + 1) + 1


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
from math import gcd


def main():
    A, B, C, D = map(int, input().split())
    Q_AC, R_AC = A // C, A % C
    Q_AD, R_AD = A // D, A % D
    Q_BC, R_BC = B // C, B % C
    Q_BD, R_BD = B // D, B % D
    Q_ACD, R_ACD = A // lcm(C, D), A % lcm(C, D)
    Q_BCD, R_BCD = B // lcm(C, D), B % lcm(C, D)
    N_C = num_baisu(Q_AC, Q_BC, R_AC, R_BC)
    N_D = num_baisu(Q_AD, Q_BD, R_AD, R_BD)
    N_CD = num_baisu(Q_ACD, Q_BCD, R_ACD, R_BCD)
    print(B - A + 1 - (N_C + N_D - N_CD))
    return


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


def num_baisu(Q_A, Q_B, R_A, R_B):
    if R_A == 0 and R_B == 0:
        return Q_B - Q_A + 1
    elif R_A == 0 and R_B != 0:
        return Q_B - Q_A + 1
    elif R_A != 0 and R_B == 0:
        return Q_B - (Q_A + 1) + 1
    else:
        return Q_B - (Q_A + 1) + 1


if __name__ == "__main__":
    main()
Problem p03006 (python)

Fixed submission:
from itertools import combinations


def main():
    N = int(input())
    x = []
    y = []
    for _ in range(N):
        x_n, y_n = map(int, input().split())
        x.append(x_n)
        y.append(y_n)
    if N == 1:
        print(1)
        return
    comb = list(combinations([i for i in range(N)], 2))
    dic = {}
    for c in comb:
        i, j = c[0], c[1]
        dx = x[j] - x[i]
        dy = y[j] - y[i]
        if not (dx, dy) in dic.keys():
            dic[(dx, dy)] = 0
        if not (-dx, -dy) in dic.keys():
            dic[(-dx, -dy)] = 0
        dic[(dx, dy)] += 1
        dic[(-dx, -dy)] += 1
    dic_sorted = sorted(dic.items(), key=lambda x:x[1])[::-1]
    print(N - dic_sorted[0][1])
    return


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from itertools import combinations


def main():
    N = int(input())
    x = []
    y = []
    for _ in range(N):
        x_n, y_n = map(int, input().split())
        x.append(x_n)
        y.append(y_n)
    comb = list(combinations([i for i in range(N)], 2))
    dic = {}
    for c in comb:
        i, j = c[0], c[1]
        dx = x[j] - x[i]
        dy = y[j] - y[i]
        if not (dx, dy) in dic.keys():
            dic[(dx, dy)] = 0
        if not (-dx, -dy) in dic.keys():
            dic[(-dx, -dy)] = 0
        dic[(dx, dy)] += 1
        dic[(-dx, -dy)] += 1
    dic_sorted = sorted(dic.items(), key=lambda x:x[1])[::-1]
    print(N - dic_sorted[0][1])
    return


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from itertools import combinations


def main():
    N = int(input())
    x = []
    y = []
    for _ in range(N):
        x_n, y_n = map(int, input().split())
        x.append(x_n)
        y.append(y_n)
    comb = list(combinations([i for i in range(N)], 2))
    dic = {}
    for c in comb:
        i, j = c[0], c[1]
        dx = x[j] - x[i]
        dy = y[j] - y[i]
        if not (dx, dy) in dic.keys():
            dic[(dx, dy)] = 0
        dic[(dx, dy)] += 1
    dic_sorted = sorted(dic.items(), key=lambda x:x[1])[::-1]
    print(N - dic_sorted[0][1])
    return


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from itertools import combinations


def main():
    N = int(input())
    x = []
    y = []
    for _ in range(N):
        x_n, y_n = map(int, input().split())
        x.append(x_n)
        y.append(y_n)
    comb = list(combinations([i for i in range(N)], 2))
    dic = {}
    for c in comb:
        i, j = c[0], c[1]
        dx = x[j] - x[i]
        dy = y[j] - y[i]
        if not (dx, dy) in dic.keys():
            dic[(dx, dy)] = 0
        if not -dx in dic.keys():
            dic[(-dx, -dy)] = 0
        dic[(dx, dy)] += 1
        dic[(-dx, -dy)] += 1
    dic_sorted = sorted(dic.items(), key=lambda x:x[1])[::-1]
    print(N - dic_sorted[0][1])
    return


if __name__ == '__main__':
    main()
Problem p03061 (python)

Fixed submission:
from fractions import gcd


def main():
    N = int(input())
    A = list(map(int, input().split()))
    left = [0] * N
    right = [0] * N
    for i in range(1, N):
        left[i] = gcd(left[i-1], A[i-1])
        right[-1-i] = gcd(right[-i], A[-i])
    gcds = []
    for i in range(N):
        gcds.append(gcd(left[i], right[i]))
    print(max(gcds))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#include <iostream>
using namespace std;

int gcd(int a, int b);

int main() {
    int N; cin >> N;
    int A[N]; for (int i = 0; i < N; i++) cin >> A[i];
    int left, right, max = 0;
    for (int n = 0; n < N; n++) {
        left = 0;
        right = 0;
        for (int i = 0; i < n; i++) left = gcd(left, A[i]);
        for (int i = N-1; i > n; i--) right = gcd(right, A[i]);
        if (gcd(left, right) > max) max = gcd(left, right);
    }
    cout << max << endl;
}

int gcd(int a, int b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    int r = a % b;
    while (r != 0) {
        a = b;
        b = r;
        r = a % b;
    }
    return b;
}

Buggy submission (verdict: Runtime Error):
import math
import fraction
from functools import reduce
from copy import copy

N = int(input())
A = list(map(int, input().split()))

def gcd(*numbers):
    return reduce(fraction.gcd, numbers)

gcds = []
for i in range(N):
    A_ = copy(A)
    A_.pop(i)
    gcds.append(gcd(*A_))

print(max(gcds))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
from copy import copy

N = int(input())
A = list(map(int, input().split()))

def gcd(*numbers):
    return reduce(math.gcd, numbers)

gcds = []
for i in range(N):
    A_ = copy(A)
    A_.pop(i)
    gcds.append(gcd(*A_))

print(max(gcds))
Problem p03069 (python)

Fixed submission:
def main():
    N = int(input())
    S = input()
    left_black = 0
    right_white = S.count('.')
    min_change = left_black + right_white
    for s in S:
        if s == '#':
            left_black += 1
        else:
            right_white -= 1
        min_change = min(min_change, left_black + right_white)
    print(min_change)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    N = int(input())
    S = input()
    for i in range(N):
        if S[i] == '.':
            pass
        else:
            first_black = i
            break
    sum = 0
    for i in range(first_black+1, N):
        if S[i] == '.':
            sum += 1
        else:
            pass
    print(sum)


if __name__ == '__main__':
    main()
Problem p03071 (python)

Fixed submission:
def main():
    A, B = map(int, input().split())
    if A == B:
        M = A + B
    elif A > B:
        M = A + (A - 1)
    else:
        M = B + (B - 1)
    print(M)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    A, B = map(int, input())
    if A == B:
        M = A + B
    elif A > B:
        M = A + (A - 1)
    else:
        M = B + (B - 1)
    print(M)

if __name__ == "__main__":
    main()
Problem p02957 (python)

Fixed submission:
a,b  = list(map(int,input().split()))
k = (a+b)/2
if (k - int(k))!=0:
    print("IMPOSSIBLE")
else:
    print(int(k))

Buggy submission (verdict: Runtime Error):
import sys
A, B = map(int, input().split())

ans = (A+B)/2
if ans % int(ans) != 0:
    print("IMPOSSIBLE")
    sys.exit()

print(int(ans))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())

ans = (A+B)/2
if ans % int(ans) != 0:
    ans = "IMPOSSIBLE"

print(ans)

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())

ans = A+B
if ans % 2 == 1:
    ans = "IMPOSSIBLE"
else:
    ans /= 2

print(int(ans))
Problem p02971 (python)

Fixed submission:
import copy
N = int(input())
A = [int(input()) for _ in range(N)]
a_copy = copy.deepcopy(A)
a_max = max(a_copy)
a_copy.remove(a_max)
b_max = max(a_copy)

for i in A:
    if i == a_max:
        print(b_max)
    else:
        print(a_max)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]
a_copy = A
a_max = max(a_copy)
b_max = list(set(a_copy))
b_max.remove(a_max)
b_max = max(b_max)

for i in A:
    if i == a_max:
        print(b_max)
    else:
        print(a_max)
Problem p02995 (python)

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

def lcm(a,b):
    return a*b//fractions.gcd(a,b)

b_n = B//C + B//D - B//lcm(C,D)
a_n = (A-1)//C + (A-1)//D - (A-1)//lcm(C,D)
ans_n = b_n - a_n
print(int(B-A+1-ans_n))

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())

def lcm(a,b):
    return a*b//math.gcd(a,b)

b_n = B//C + B//D - B//lcm(C,D)
a_n = (A-1)//C + (A-1)//D - (A-1)//lcm(C,D)
ans_n = b_n - a_n
print(int(B-A+1-ans_n))

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = map(int, input().split())

def lcm(a,b):
    return a*b/math.gcd(a,b)

b_n = B//C + B//D - B//lcm(C,D)
a_n = (A-1)//C + (A-1)//D - (A-1)//lcm(C,D)
ans_n = b_n - a_n
print(ans_n)
print(B-A+1-ans_n)
Problem p03000 (python)

Fixed submission:
N, X = map(int, input().split())
L = list(map(int, input().split()))

x = 0
i = 0

while x <= X :
    if i == N:
        i += 1
        break
    x += L[i]
    i += 1

print(i)

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = list(map(int, input().split()))

x = 0
i = 0

while x <= X :
    x += L[i]
    i += 1
    
print(i)
Problem p03059 (python)

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

print(T//A*B)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
import math
N = int(input())
A = list(map(int,input().split()))
L_A = [0]*(N+1)
R_A = [0]*(N+1)
for i in range(N):
    L_A[1+i] = math.gcd(L_A[i], A[i])
for i in reversed(range(N)):
    R_A[i] = math.gcd(R_A[i+1], A[i])
print(max(math.gcd(L_A[i], R_A[i+1]) for i in range(N)))
Problem p03238 (python)

Fixed submission:
N = int(input())
if N == 1:
    print('Hello World')
else:
    A = int(input())
    B = int(input())
    print(A+B)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N == 1:
    print('Hello World')
else:
    A, B = map(int, input().split())
    print(A+B)
Problem p02957 (python)

Fixed submission:
a,b=map(int,input().split(" "))
if a%2 != b%2:
    print("IMPOSSIBLE")
else:
    print(int((a+b)/2))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input(),split(" "))
if a%2 != b%2:
    print("IMPOSSIBLE")
else:
    print((max(a,b)-min(a,b))/2)
Problem p02921 (python)

Fixed submission:
p = list(input())
a = list(input())
o = [a[i] for i in range(len(p)) if p[i] == a[i]]
print(len(o))

Buggy submission (verdict: Runtime Error):
forcast = input().split()
actual = input().split()
match = 0
for i in range(
Problem p02923 (python)

Fixed submission:
input()
a = list(map(int, input().split(" ")))
count = 0
arrayCount = []
for i in range(0, len(a) - 1):
    if a[i] >= a[i + 1]:
        count += 1
    else:
        arrayCount.append(count)
        count = 0
arrayCount.append(count)
print(max(arrayCount))

Buggy submission (verdict: Runtime Error):
input()
a = list(map(int, input().split()))
m = 0
end = 0
for i in range(len(a)):
  if end < len(a) - 2:
    for j in range(i, len(a) - 1):
      if a[j] >= a[j + 1]:
        m += 1
        end = j
        else:
          m = 0
          break
          print(m)

Buggy submission (verdict: Runtime Error):
input()
    a = list(map(int, input().split()))
    m = 0
    end = 0
    for i in range(len(a)):
        if end < len(a) - 2:
            for j in range(i, len(a) - 1):
                if a[j] >= a[j + 1]:
                    m += 1
                    end = j
                else:
                    m = 0
                    break
    print(m)
Problem p03813 (python)

Fixed submission:
x, = map(int , input().split())
if( x < 1200 ):
    print('ABC')
else:
    print('ARC')

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

for i , v in enumerate(s):
    if v == 'A':
        apos = i + 1
        break

for i , v in enumerate(s[::-1]):
    if v == 'Z':
        zpos = len(s) - i 
        break

print( zpos - apos + 1)
Problem p02885 (python)

Fixed submission:
a,b = map(int ,raw_input().split())
print max(0,a-2*b)

Buggy submission (verdict: Runtime Error):
a,b = map(raw_input().split())
print max(0,a-2*b)

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
print max(0,a-2*b)
Problem p02898 (python)

Fixed submission:
N, K = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
count = 0

for i in range(len(a)):
    if a[i] >= K:
        count += 1


print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [int(i) for i in input().split()]
b =[]

for i in range(1,N+1):
    b.append(a.index(i) + 1)

print(*b, sep=' ')
Problem p03000 (python)

Fixed submission:
l = input().split()
n = int(l[0])
x = int(l[1])
l = input().split()
cnt = 1
d = 0

while(cnt -1 < len(l)):
    d = d + int(l[cnt-1])
    if(d<=x):
        cnt = cnt + 1
    else:
        break

if(cnt > n+1):
    cnt = n+1
print(cnt)

Buggy submission (verdict: Runtime Error):
l = input().split()
n = int(l[0])
x = int(l[1])
l = input().split()
cnt = 1
d = 0

while(True):
    d = d + int(l[cnt-1])
    if(d<=x):
        cnt = cnt + 1
    else:
        break

print(cnt)
Problem p02900 (python)

Fixed submission:
def trial_division(n,b):
    a = []
    if n%2==0 and b%2==0:
        a.append(2)
    while n % 2 == 0:
        n /= 2
    f = 3
    while f*f <= n:
        if n % f == 0: 
            if b%f == 0:
                a.append(f)
            n /= f
        else:
            f += 2   
    if n != 1 and b%n==0: 
        a.append(n)
    return a
A,B = (lambda x: (min(x),max(x)))(list(map(int,input().split())))
print(len(set(trial_division(A,B)))+1)

Buggy submission (verdict: Runtime Error):
def trial_division(n):
    a = []  
    while n % 2 == 0:
        a.append(2)
        n /= 2
    f = 3
    while f*f <= n:
        if n % f == 0:
            a.append(f)
            n /= f
        else:
            f += 2   
    if n != 1: a.append(n)
    return a
A,B = (lambda x: (min(x),max(x)))(list(map(int,input().split())))
print(len(set(trial_division(A),trial_division(B)))+1)