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

Fixed submission:
w,h,n=map(int,input().split())
xya=[list(map(int,input().split())) for i in range(n)]
xya1=[i[0] for i in xya if i[2]==1]+[0]
xya2=[i[0] for i in xya if i[2]==2]+[w]
xya3=[i[1] for i in xya if i[2]==3]+[0]
xya4=[i[1] for i in xya if i[2]==4]+[h]
left=max(xya1)
right=min(xya2)
lower=max(xya3)
upper=min(xya4)
if left>=right or lower>=upper:
  print(0)
else:
  print((right-left)*(upper-lower))

Buggy submission (verdict: Runtime Error):
w,h,n=map(int,input().split())
xya=[list(map(int,input().split())) for i in range(n)]
xya1=[i[0] for i in xya if i[2]==1]
xya2=[i[0] for i in xya if i[2]==2]
xya3=[i[1] for i in xya if i[2]==3]
xya4=[i[1] for i in xya if i[2]==4]
left=max(xya1)
right=min(xya2)
lower=max(xya3)
upper=min(xya4)
if left>=right or lower>=upper:
  print(0)
else:
  print((right-left)*(upper-lower))

Buggy submission (verdict: Runtime Error):
w,h,n=map(int,input().split())
xya=[list(map(int,input().split())) for i in range(n)]
xya1=[i[0] for i in xya if i[2]==1]
xya2=[i[0] for i in xya if i[2]==2]
xya3=[i[1] for i in xya if i[2]==3]
xya4=[i[1] for i in xya if i[2]==4]
left=max(xya1)
right=min(xya2)
lower=max(xyz3)
upper=min(xyz4)
if left>=right or lower>=upper:
  print(0)
else:
  print((right-left)*(upper-lower))
Problem p04043 (python)

Fixed submission:
a,b,c=map(int,input().split())
aa=sorted([a,b,c])
if aa == [5,5,7]:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
aa=sort([a,b,c])
if aa == [5,5,7]:
  print("YES")
else:
  print("NO")
Problem p02621 (python)

Fixed submission:
from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
    return int(input())

def rl():
    return list(map(int, input().split()))


def solve():
    a = ri()
    print (a + a*a + a*a*a)





mode = 's'

if mode == 'T':
    t = ri()
    for i in range(t):
        solve()
else:
    solve()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict as dd
from collections import deque
import bisect
import heapq

def ri():
    return int(input())

def rl():
    return list(map(int, input().split()))


def solve():
    a = ri()
    print (a + a*a + a*a*a)





mode = 's'

if mode == 's':
    t = ri()
    for i in range(t):
        solve()
else:
    solve()
Problem p02576 (python)

Fixed submission:
N,X,T = map(int, input().split())
a = int(N/X)
if N%X != 0:
  a += 1
print(int(a * T))

Buggy submission (verdict: Runtime Error):
N,X,T = map(int, input().split())
a = N/X
if N%X != 0:
  a += 1
return a * T
Problem p02658 (python)

Fixed submission:
#! /usr/bin/env python3
input()
l = 10**18
a = 1
*b, = map(int, input().split())
if 0 in b:
    a = 0
else:
    for i in b:
        a *= i
        if a > l:
            a = -1
            break
print(a)

Buggy submission (verdict: Runtime Error):
#! /usr/bin/env python3
input()
l = 10**18
a = 1
for i in map(int, input()):
    a *= i
    if a > l:
        a = -1
        break
print(a)
Problem p03076 (python)

Fixed submission:
t=0
for i in sorted([int(input())for i in' '*5],key=lambda x:-x%10-(x%10<1)):t+=i+(10-t%10)%10
print(t)

Buggy submission (verdict: Runtime Error):
t=0
for i in sorted(map(int,[*open(0)]),key=lambda x:-x%10-(x%10<1)):t+=i+(10-t)%10
print(t)
Problem p03106 (python)

Fixed submission:
#! /usr/bin/env python3
a, b, c = map(int, input().split())
t = []
for i in range(1, 101):
    if a%i + b%i < 1: t += [i]
print(t[-c])

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
for i in range(1, 101):
  if a%i + b%i < 1:
	c -= 1
    if c < 1:
      print(i)
	  break
Problem p03125 (python)

Fixed submission:
a, b = map(int, input().split())
print([b+a,b-a][b%a>0])

Buggy submission (verdict: Runtime Error):
a, b = map(int, input())
print([b+a,b-a][b%a>0])
Problem p03238 (python)

Fixed submission:
*a,=map(int,open(0).read().split())
print(a[1]+a[2]if a[0]>1else'Hello World')

Buggy submission (verdict: Runtime Error):
i=input;print'Hello World'*(i()-1)or i()+i()

Buggy submission (verdict: Runtime Error):
i=input;i(eval(i()+'+'+i())if'1'<i()else'Hello World')

Buggy submission (verdict: Runtime Error):
a=map(int,open(0).read().split())
print('Hello World'if a[0]<2else a[1]+a[2])
Problem p03323 (python)

Fixed submission:
#! /usr/bin/env python3

A, B = map(int, input().split())

if A <= 8 and B <= 8:
    print('Yay!')
else:
    print(':(')

Buggy submission (verdict: Runtime Error):
#! /usr/bin/env python3

A = int(input())
B = int(input())

if A <= 8 and B <= 8:
    print('Yay!')
else:
    print(':(')
Problem p03337 (python)

Fixed submission:
A,B=map(int,input().split());print(max(A+B,A-B,A*B))

Buggy submission (verdict: Runtime Error):
A=int(input());B=int(input());print(max(A+B,A-B,A+B))
Problem p03370 (python)

Fixed submission:
N, X = map(int, input().split())
L = [int(input()) for x in range(N)]
print(N + ((X - sum(L))) // min(L))

Buggy submission (verdict: Runtime Error):
N, X = map(int, input().split())
L = [int(x) for x in range(N)]
print(N + ((X - sum(L))) // min(L))
Problem p03393 (python)

Fixed submission:
#! /usr/bin/env python3

alp = 'abcdefghijklmnopqrstuvwxyz'
S = input()
if S == alp[::-1]:
    print(-1)
else:
    if len(S) == len(alp):
        l = list(S)
        s = []
        for i in range(1, len(S))[::-1]:
            s += [l[i]]
            r = sorted(x for x in s if x > l[i-1])
            if r:
                l = l[:i-1] + [r[0]]
                break
        print(''.join(l))
    else:
        for i in S : alp = alp.replace(i, '')
        print(S+alp[0])

Buggy submission (verdict: Runtime Error):
#! /usr/bin/env python3

alp = 'abcdefghijklmnopqrstuvwxyz'
S = input()
if S == alp[::-1]:
    print(-1)
else:
    if len(S) == len(alp):
        p = ''
        for i, j in zip(alp, S):
            if i != j : break
            p += i
        S = p

    for i in set(S) : alp = alp.replace(i, '')
    print(S+alp[0])
Problem p03434 (python)

Fixed submission:
input();a=sorted(map(int,input().split()))[::-1];print(sum(a[::2])-sum(a[1::2]))

Buggy submission (verdict: Runtime Error):
*a,=open(0);n,a=map(int,a);print(sum(a[0::2])-sum(a[1::2]))
Problem p03609 (python)

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

Buggy submission (verdict: Runtime Error):
a, b = map(int, input.split())
print(max(0, a-b))
Problem p03611 (python)

Fixed submission:
input()
d = {}
for i in map(int, input().split()):
    for j in (-1, 0, 1):
        a = i + j
        if a in d:
            d[a] += 1
        else:
            d[a] = 1
print(sorted(d.values())[-1])

Buggy submission (verdict: Runtime Error):
input()
d = {}
for i in map(int, input().split()):
    if i in d:
        d[i] = 1
    else:
        d[i] += 1
print(sorted(d.values())[-1])
Problem p03633 (python)

Fixed submission:
#! /usr/bin/env python3


def gcd(a, b):
    if a < b : return gcd(b, a)
    while b != 0:
        t = a % b
        a = b
        b = t
    return a

N = int(input())
T = sorted(set([int(input()) for x in range(N)]))
a = T[-1]
for i in T[:-1]:
    a = (a * i) // gcd(a, i)

print(a)

Buggy submission (verdict: Runtime Error):
#! /usr/bin/env python3

def f(diu, n):
    r = []
    try:
        while n != 1:
            r = [diu[n][0]] + r
            n = diu[n][1]
    except:
        pass
    return r

memo = {}
def d(p, a, b, k):
    if k in memo : return memo[k]
    c = 0
    for i, j in zip(a, b):
        if i == j:
            c += 1
        else:
            break
    memo[k] = sum(p[x][2] for x in a[c:]) + sum(p[x][2] for x in b[c:])
    return memo[k]

def main():
    N = int(input())
    P = [tuple(map(int, input().split())) for x in range(N-1)]
    diu = {max(v[0], v[1]) : (i, min(v[0], v[1]))  for i, v in enumerate(P)}
    Q, K = map(int, input().split())
    k = f(diu, K)
    for i in range(Q):
        x, y = map(int, input().split())
        print(d(P, f(diu, x), k, (K, x)) + d(P, f(diu, y), k, (K, y)))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#! /usr/bin/env python3
import math

N = int(input())
T = sorted(set([int(input()) for x in range(N)]))
a = 1
for i in T[:-1] : a *= i
print((a * T[-1]) // math.gcd(a, T[-1]))

Buggy submission (verdict: Runtime Error):
#! /usr/bin/env python3
import math

N = int(input())
T = sorted(set([int(input()) for x in range(N)]))
s = set()
for i in T : s = s.union(set(primefactor(i)))
a = 1
for i in T[:-1] : a *= i

print((a * T[-1]) // math.gcd(a, T[-1]))
Problem p03817 (python)

Fixed submission:
N = int(input())

if N < 11:
    d, m = divmod(N, 6)
    print(d + (m>0))
else:
    d, m = divmod(N, 11)
    a = (1 if m else 0) if m < 7 else 2
    print(d * 2 + a)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
D = {}
for i in A:
    if i in D:
        D[i] += 1
    else:
        D[i] = 1
cnt = 0
for k in D.keys():
    if D[k] % 2:
        D[k] = 1
    else:
        D[k] = 2
        cnt += 1
print(len({*A}) - (cnt % 2))
Problem p03856 (python)

Fixed submission:
S = input()
for i in ['eraser', 'erase', 'dreamer', 'dream']:
    S=S.replace(i, 'R')
s = set(S)
print(['NO', 'YES'][len(s) == 1 and 'R' in s])

Buggy submission (verdict: Runtime Error):
S = input()
for i in ['eraser', 'erase', 'dreamer', 'dream']:
    S=S.replace(i, 'R')
print(['NO', 'YES'][len(s) == 1 and 'R' in s])
Problem p03930 (python)

Fixed submission:
#! /usr/bin/env python3

def dropcell(h, w, rm):
    for i in range(w):
        y = 0
        for j in range(h):
            if rm[h-j-1][i] != 0:
                rm[h-y-1][i] = rm[h-j-1][i]
                y += 1
        for j in range(h-y):
            rm[h-y-j-1][i] = 0

def removecell(h, w, k, rm, a):
    p = 0
    for y in range(h):
        c, t = 1, 0
        for i in range(w+1):
            x = rm[y][i]
            if x > 0 and x == t:
                c += 1
            else:
                if c >= k:
                    for j in range(c):
                        rm[y][i-1-j] = 0
                    p += (t * c)
                t = x
                c = 1
    return p * (2**a)

def game(h, w, k, M, y, x):
    f, score, a = 1, 0, 0
    rm = [[j for j in i]for i in M[:y+1]]
    rm[y][x] = 0
    while f:
        dropcell(len(rm), w, rm)
        f = removecell(len(rm), w, k, rm, a)
        score += f
        a += 1
    return score

def main():
    H, W, K = map(int, input().split())
    M = [list(map(int, list(input())))+[0] for i in range(H)]
    ans = 0
    for j in range(W):
        t = 0
        for i in range(1, H):
            if M[i][j] != t:
                ans = max(ans, game(H, W, K, M, i, j))
                t = M[i][j]
    print(ans)
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#! /usr/bin/env python3

def dropcell():
    for y in range(H):
        for i in range(H):
            for j in range(W):
                if gm[H-i][j] == 0:
                    gm[H-i-1][j], gm[H-i][j] = gm[H-i][j], gm[H-i-1][j]
def removecell():
    global gp, gf
    gf = False
    p = 0
    for y in range(H):
        c = 1
        t = 0
        for i in range(W+1):
            x = gm[y+1][i]
            if x > 0 and x == t:
                c += 1
            else:
                if c >= K:
                    for j in range(c):
                        gm[y+1][i-1-j] = 0
                    p += (t * c)
                    gf = True
                t = x
                c = 1
    gp += p * (2**gi)


H, W, K = map(int, input().split())
M = [[0]*(W+1)]+[list(map(int, [*input()]))+[0] for i in range(H)]
points = {}
for i in range(H)[::-1]:
    for j in range(W):
        gp = 0
        gf = True
        gi = 0
        gm = [[j for j in i]for i in M]
        gm[i+1][j] = 0
        while gf:
            dropcell()
            removecell()
            gi += 1
        points[gp] = 1
print(max(points))
Problem p03957 (python)

Fixed submission:
c = 0
f = 0
for i in input():
    if i == 'C' : c = 1
    if c and i == 'F':
        f = 1
        break
print( 'Yes' if c + f > 1 else 'No')

Buggy submission (verdict: Runtime Error):
#! /usr/bin/env python3

def main():
    d = 10 ** 9 + 7
    ans = 1
    N = int(input())
    T = list(map(int, input().split()))
    A = list(map(int, input().split()))
    L = len(T)
    ST = [T[0]] + [0] * (L-2) + [T[-1] if T[-1] != T[-2] else 0]
    SA = [A[0] if A[0] != A[1] else 0] + [0] * (L-2) + [A[-1]]
    for i in range(0, L-1):
        if T[i] == T[i-1] and A[i] == A[i+1]:
            ans = (ans * min(T[i], A[i])) % d
        else:
            if T[i] != T[i-1] : ST[i] = T[i]
            if A[i] != A[i+1] : SA[i] = A[i]
    mt = ma = 0
    for i in range(L):
        ma = max(ma, SA[i])
        mt = max(mt, ST[L-i-1])
        if ST[i] and SA[i] and ST[i] != SA[i]:
            ans = 0
        if (ST[i] and ST[i] < ma) or (SA[-i-1] and SA[-i-1] < mt):
            ans = 0
    print(ans)
    
if __name__ == '__main__':
    main()
Problem p04043 (python)

Fixed submission:
L = list(map(int, input().split()))
print("YES" if 5 in L and 7 in L and sum(L) == 17 else "NO")

Buggy submission (verdict: Runtime Error):
print('YNEOS'[input()%18!=17::2])
Problem p04047 (python)

Fixed submission:
#! /usr/bin/env python3

N = int(input())
L = list(sorted(map(int, input().split())))
ans = 0
for i in range(N):
    ans += min(L[i*2], L[i*2+1])
print(ans)

Buggy submission (verdict: Runtime Error):
#! /usr/bin/env python3

N, X = map(int, input().split())
if X*2 == N:
    print(X*3)
else:
    print(X*3*((N-X)//X + (1 if (N-X)%X>0 else 0)))
Problem p02576 (python)

Fixed submission:
from math import ceil
n,x,t=map(int,input().split())
y=ceil(n/x)
print(y*t)

Buggy submission (verdict: Runtime Error):
n,x,t=map(int,input().split())
y=ceil(n/x)
print(y*t)
Problem p02768 (python)

Fixed submission:
n, a, b = map(int, input().split())
value_max = 2 * (10 ** 5)
com = [0 for _ in range(value_max + 1)]
com[1] = n
mod = 10 ** 9 + 7
mod_inverse = [pow(i, mod - 2, mod) for i in range(1, value_max + 1)]
ans = pow(2, n, mod)

for i in range(2, min(n, value_max) + 1):
    if (n - i + 1) == 0:
        break

    com[i] = com[i - 1] * (n - i + 1)
    com[i] *= mod_inverse[i - 1]
    com[i] %= mod

diff = (com[a] + com[b] + 1) % mod
print((ans - diff) % mod)

Buggy submission (verdict: Runtime Error):
def main():
    n, a, b = map(int, input().split())
    value_max = 2 * (10 ** 5)
    com = [0 for _ in range(value_max + 1)]
    com[1] = n
    mod = 10 ** 9 + 7
    mod_inverse = [pow(i, mod - 2, mod) for i in range(1, value_max + 1)]
    ans = pow(2, n, mod)
 
    # KeyInsight:
    # 全体 - 条件を満たす場合
    # modの世界では割り算の代わりに逆元を使う
    # See:
    # https://www.youtube.com/watch?v=lzAMKPMLdtU&feature=youtu.be
    for i in range(2, min(n, value_max) + 1):
        if (n - i + 1) == 0:
            break
 
        com[i] = com[i - 1] * (n - i + 1)
        com[i] *= mod_inverse[i - 1]
        com[i] %= mod
 
    diff = (com[a] + com[b] + 1) % mod
    print((ans - diff) % mod)
 main()
Problem p02817 (python)

Fixed submission:
s,t = map(str,input().split());print(t+s)

Buggy submission (verdict: Runtime Error):
s,t = map(str,input());print(t+s)
Problem p02924 (python)

Fixed submission:
n = int(input())
print(n*(n-1)//2)

Buggy submission (verdict: Runtime Error):
n = int(input())
a_L = list(range(1,n+1))
a_L.pop()

print(sum(a_L))
Problem p02939 (python)

Fixed submission:
from collections import deque
s = input()
a_L = deque([val for val in s])

div_L = [""]
moji = ""

counter = 0

while a_L:
    tmp = a_L.popleft()
    moji += tmp
    if moji !=  div_L[counter]:
        div_L.append(moji)
        moji = ""
        counter += 1

print(len(div_L)-1)

Buggy submission (verdict: Runtime Error):
s = input()
a_L = deque([val for val in s])

div_L = [""]
moji = ""

counter = 0

while a_L:
    tmp = a_L.popleft()
    moji += tmp
    if moji !=  div_L[counter]:
        div_L.append(moji)
        moji = ""
        counter += 1

print(len(div_L)-1)
Problem p02947 (python)

Fixed submission:
import collections
import math

n = int(input())
str_L = []

for val in range(n):
    s = input()
    s_L = [i for i in s]
    s_L.sort()
    s = "".join(s_L)
    str_L.append(s)


c = collections.Counter(str_L)

str_L = list(set(str_L))


ans = 0
r = 2

def combinations_count(n, r):
    try:
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    except:
        return 0

for val in str_L:
    n = c[val]
    #print(n,r)
    ans = ans + combinations_count(n,r) #comb(n, r, exact=True)

print(ans)

Buggy submission (verdict: Runtime Error):
import collections
from scipy.special import comb

n = int(input())
str_L = []

for val in range(n):
    s = input()
    s_L = [i for i in s]
    s_L.sort()
    s = "".join(s_L)
    str_L.append(s)


c = collections.Counter(str_L)

str_L = list(set(str_L))


ans = 0
r = 2

for val in str_L:
    n = c[val]
    ans = ans + comb(n, r, exact=True)

print(ans)

Buggy submission (verdict: Runtime Error):
import collections
from scipy.special import comb

n = int(input())
str_L = []

for val in range(n):
    s = input()
    s_L = [i for i in s]
    s_L.sort()
    s = "".join(s_L)
    str_L.append(s)


c = collections.Counter(str_L)

str_L = list(set(str_L))


ans = 0
r = 2

for val in str_L:
    n = c[val]
    ans = ans + comb(n, r, exact=True)

print(ans)

Buggy submission (verdict: Runtime Error):
import collections
from scipy.special import comb

n = int(input())
str_L = []

for val in range(n):
    s = input()
    s_L = [i for i in s]
    s_L.sort()
    s = "".join(s_L)
    str_L.append(s)

print(str_L)

c = collections.Counter(str_L)
print(c)

str_L = list(set(str_L))


ans = 0
r = 2

for val in str_L:
    n = c[val]
    ans = ans + comb(n, r, exact=True)

print(ans)
Problem p02963 (python)

Fixed submission:
S = int(input())
X1, Y1, X2, Y2 = 0, 0, 10**9, 1
shou, amari = divmod(S, 10**9)
 
if amari == 0:
    Y3 = shou
    X3 = 0
else:
    Y3 = shou + 1
    X3 = -(amari - 10**9)
 
print(X1, Y1, X2, Y2, X3, Y3)

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

# (0,0),(0,x),(x,y)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

yakusu = make_divisors(s)[1]


print(0,0,int(s/yakusu),0,0,int(yakusu))

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

# (0,0),(0,x),(x,y)
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort()
    return divisors

yakusu = make_divisors(s)[1]


print(0,0,int(s/yakusu),0,0,int(yakusu))
Problem p02983 (python)

Fixed submission:
from itertools import combinations
import sys

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

if r-l> 2019:
    print(0)
    sys.exit(0)

A = list(range(l,r+1))

ans_L = [i[0]*i[1]%2019 for i in combinations(A,2)]
print(sorted(ans_L)[0])

Buggy submission (verdict: Runtime Error):
l,r = map(int,input().split())


from itertools import combinations

A = list(range(l,r+1))

ans_L = [i[0]*i[1]%2019 for i in combinations(A,2)]
print(sorted(ans_L)[0])
Problem p02993 (python)

Fixed submission:
s = input()
 
tmp = ""
for val in s:
  if tmp == val:
    print("Bad")
    import sys
    sys.exit(0)
  tmp = val
 
print("Good")

Buggy submission (verdict: Runtime Error):
import copy

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

n_L = list(range(n))
a_L = list(map(lambda x:l+x,n_L))
# out of rangeを防ぐため
a_L.append(0)

allsum = sum(a_L)

result_L = []


diff = abs(allsum-sum(a_L[1:]))

for val in range(n):
    b_L = copy.copy(a_L)
    b_L.pop(val)
    temp_sum = sum(b_L)

    if abs(allsum-temp_sum) <= diff:
        result = temp_sum
    diff = abs(allsum-temp_sum)

print(result)

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

tmp = ""
for val in s:
  if tmp == val:
    print("Bad")
    import sys.exit(0)
  tmp = val

print("Good")
Problem p02999 (python)

Fixed submission:
x,a = map(int,input().split(" "))

if x < a:
    print(0)
else:
    print(10)

Buggy submission (verdict: Runtime Error):
w,h,x,y = map(int,input().split())

print(w*h/2)
if x == w/2 and y == h/2:
        print(1)
else:
        print(0)

Buggy submission (verdict: Runtime Error):
import sys

n,x = map(int,input().split())
n = n+1

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


counter = 0
next_jump = 0
for val in range(0,n):
    #if next_jump <= x:
    if next_jump < x:
        next_jump = next_jump + l_L[val-1]
        counter += 1
    else:
        print(counter)
        sys.exit(0)
Problem p03000 (python)

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

d = 0
counter = 1
for val in range(n):
    d = d + L[val]
    if d <= x:
        counter +=1

print(counter)

Buggy submission (verdict: Runtime Error):
import sys

n,x = map(int,input().split())
n = n+1

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


counter = 0
next_jump = 0
for val in range(1,n+1):
    if next_jump <= x:
        next_jump = next_jump + l_L[val-1]
        counter += 1
    else:
        print(counter)
        sys.exit(0)
print(counter)
Problem p03043 (python)

Fixed submission:
import math

n, k = map( int, input().split())
 
ans = 0
for i in range(1, n + 1):
  a = max( 0 , math.ceil(math.log( k / i, 2 )))
  ans += ( 1 / n ) * ( 0.5 ** a )
print(ans)

Buggy submission (verdict: Runtime Error):
import math

n,k = map(int,input().split())

ans = 0
for val in range(1,n+1):
    #print(val,",",math.log2(k)-math.log2(val))
    x = math.ceil(math.log2(k)-math.log2(val))
    ans = ans + 1/n * (1/2)**x 
print(ans)
Problem p03086 (python)

Fixed submission:
s = input()
L = ["A","C","G","T"]

counter = 0
ans_L = []
for val in s:
    if val in L:
        counter += 1
    else:
        ans_L.append(counter)
        counter = 0
ans_L.append(counter)

print(max(ans_L))

Buggy submission (verdict: Runtime Error):
s = input()
L = ["A","C","G","T"]

counter = 0
ans_L = []
for val in s:
    if val in L:
        counter += 1
    else:
        ans_L.append(counter)
        counter = 0

print(max(ans_L))

Buggy submission (verdict: Runtime Error):
s = input()
L = ["A","C","G","T"]

counter = 0
ans_L = []
for val in s:
    if val in L:
        counter += 1
    else:
        ans_L.append(counter)
        counter = 0

print(max(ans_L))
Problem p03103 (python)

Fixed submission:
N, M = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(N)]

#print(AB)
rest = M
ans = 0
for a, b in sorted(AB, key=lambda x: x[0]):
	
    if (b < rest):
        ans += a*b
        rest -= b
    else:
        ans += (a*rest)
        break
print(ans)

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

dic,new_dic = {},{}
for val in range(n):
    a,b = map(int,input().split())
    dic[a] = b

dic = sorted(dic.items(),key=lambda x:x[0])

for val in dic:
    new_dic[val[0]] = val[1]

ans = 0

print(new_dic)

for k,v in new_dic.items():
    if m - v > 0:
        ans += k*v

    elif m - v <=s 0:
        ans += k*m
        print(ans)
        exit()

    m = m-v

print(ans)
Problem p03106 (python)

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

ans = []
for val in range(1,min(a,b)+1):
    #print(val)
    if a % val == 0 and b % val ==0:
        ans.append(val)
        #print(val)

print(ans[-k])

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

ans = []
for val in range(1,101):
    if val % a == 0 and val %b ==0:
        ans.append(val)

print(ans[k+1])
Problem p03125 (python)

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

if b%a==0:
    print(a+b)
else:
    print(b-a)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input())

if a%b==0:
    print(a+b)
else:
    print(a-b)