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

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

a, b = input().split()
a, b = int(a), int(b)
print(a * b // gcd(a, b))

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
  if a == 0:
    return b
  if b == 0:
    return a
  if a > b:
    return gcd(a%b, b)
  return gcd(a, b%a)

print(a * b // gcd(a, b))
Problem p02987 (python)

Fixed submission:
from collections import Counter
c = True
for (k, v) in Counter(input()).items():
  if v != 2:
    c = False
if c:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
from collections import Counter
c = True
for (k, v) in Counter(input()):
  if v != 2:
    c = False
if c:
  print("Yes")
else:
  print("No")
Problem p02820 (python)

Fixed submission:
n,k = map(int,input().split())
R,S,P =map(int,input().split())
T = list(input())
value= {'r':P,'s':R,'p':S}
ans = 0
#k個ごとのグループで考える
for i in range(k):
    num = i
    pre = ''
    while num<n:
        if pre == T[num]:#同じ手だったら負けかあいこ．つまり0点カウント
            pre = ''
        else:
            pre = T[num]
            ans += value[pre]
        num += k
print(ans)

Buggy submission (verdict: Runtime Error):
,k = map(int,input().split())
R,S,P =map(int,input().split())
T = list(input())
value= {'r':P,'s':R,'p':S}
ans = 0
pre = ''
#k個ごとのグループで考える
for i in range(k):
    num = i
    while num<n:
        if pre == T[num]:#同じ手だったら負けかあいこ．つまり0点カウント
            pre = ''
        else:
            pre = T[num]
            ans += value[pre]
        num += k
print(ans)
Problem p02881 (python)

Fixed submission:
import math
N = int(input())
Min = float('inf')
Max = math.ceil(math.sqrt(N))
for i in range(1,Max+1):
    if N%i==0:
        b = N//i
        Min = min(Min,i+b-2)
print(Min)

Buggy submission (verdict: Runtime Error):
import math
N = int(input())
Min = float('inf')
Max = math.ceil(math.sqrt(N))
for i in range(1,Max+1):
    if N%i==0:
        b = N//i
        Min = min(Min,i+b-2)
print(Min
Problem p02891 (python)

Fixed submission:
s = list(input())
k = int(input())
s += '+'

releki = []
cnt = 1
pre = s[0]
for i in range(1,len(s)):
    if pre==s[i]:
        cnt += 1
    else:
        releki.append([pre,cnt])
        pre = s[i]
        cnt = 1
        
ans = 0
for i in range(len(releki)):
    ans += releki[i][1]//2
if len(releki)==1:
    print((len(s)-1)*k//2)
    exit()
if s[0]!=s[-3]:
    print(ans*k)
else:
    a = releki[0][1]
    b = releki[-1][1]
    ans = ans*k - (k-1)*(a//2 +b//2 -(a+b)//2)
    print(ans)

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

s += s[0]

cnt = 0
pre = s[0]
for i in range(1,len(s)):
    if s[i]==pre:
        cnt += 1
        pre =''
    else:
        pre = s[i]
ans = cnt*k
if (s[-3]!=s[-2]) and (s[-2]==s[-1]):
    print(ans-1)
else:
    print(ans)
Problem p02990 (python)

Fixed submission:
import math
Num = 1000000007
N,K = map(int,input().split())

def conbinations_count(n, r):
    if n<0 or r<0 or n-r<0:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - r)*math.factorial(r))


for i in range(1,K+1):
    tmp = conbinations_count(N-K+1,i)*conbinations_count(K-1,i-1)
    print(tmp%Num)

Buggy submission (verdict: Runtime Error):
import math
Num = 1000000007
N,K = map(int,input().split())

def conbinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r)*math.factorial(r))


for i in range(1,K+1):
    tmp = conbinations_count(N-K+1,i)*conbinations_count(K-1,i-1)
    print(tmp%Num)
Problem p03038 (python)

Fixed submission:
import copy
N,M = map(int,input().split())
A = [int(i) for i in input().split()]
A.sort()
A_copy = copy.deepcopy(A)
CB = []
for i in range(M):
    b,c = map(int,input().split())
    CB.append([c,b])
CB.sort(reverse = True)
tmp = 0
for c,b in CB:
    for i in range(b):
        if tmp+i >= N:
            print(sum(A))
            exit()
            
        if A_copy[tmp+i]<c:
            A[tmp+i] = c
        else:
            break
    tmp += b
print(sum(A))

Buggy submission (verdict: Runtime Error):
import copy
N,M = map(int,input().split())
A = [int(i) for i in input().split()]
A.sort()
A_copy = copy.deepcopy(A)
CB = []
for i in range(M):
    b,c = map(int,input().split())
    CB.append([c,b])
CB.sort(reverse = True)
tmp = 0
for c,b in CB:
    for i in range(b):
        if A_copy[tmp+i]<=c:
            A[tmp+i] = c
        else:
            print(sum(A))
            exit()
    tmp += b
Problem p03775 (python)

Fixed submission:
import math

N = int(input())
A = []
B = []
F = []

for i in range(1,int(math.sqrt(N))+1,1):
    if (N%i)== 0:
        A.append(N/i)
        B.append(i)
for i in range(len(A)):
    count_A = int(math.log10(A[i])+1)
    count_B = int(math.log10(B[i])+1)
    if count_A >= count_B:
        F.append(count_A)
    else:
        F.append(count_B)
print(min(F))

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = []
B = []
F = []

for i in range(1,int(math.sqrt(N)),1):
    if (N%i)== 0:
        A.append(N/i)
        B.append(i)
for i in range(len(A)):
    count_A = int(math.log10(A[i])+1)
    count_B = int(math.log10(B[i])+1)
    if count_A >= count_B:
        F.append(count_A)
    else:
        F.append(count_B)
print(min(F))

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = []
B = []
F = []
for i in range(1,int(N/2),1):
    if (N%i)== 0:
        A.append(N/i)
        B.append(i)
for i in range(len(A)):
    count_A = int(math.log10(A[i])+1)
    count_B = int(math.log10(B[i])+1)
    if count_A >= count_B:
        F.append(count_A)
    else:
        F.append(count_B)
print(min(F))

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = []
B = []
F = []
for i in range(1,N/2):
    if (N%i)== 0:
        A.append(N/i)
        B.append(i)
for i in range(len(A)):
    count_A = int(math.log10(A[i])+1)
    count_B = int(math.log10(B[i])+1)
    if count_A >= count_B:
        F.append(count_A)
    else:
        F.append(count_B)
print(min(F))

Buggy submission (verdict: Runtime Error):
import math

N = int(input())
A = []
B = []
F = []
for i in range(1,N):
    if (N%i)== 0:
        A.append(N/i)
        B.append(i)
for i in range(len(A)):
    count_A = int(math.log10(A[i])+1)
    count_B = int(math.log10(B[i])+1)
    if count_A >= count_B:
        F.append(count_A)
    else:
        F.append(count_B)
print(min(F))
Problem p02693 (python)

Fixed submission:
k=int(input())
a,b=map(int,input().split())
print("OK" if a//k < b//k or a%k==0 or b%k==0 else "NG")

Buggy submission (verdict: Runtime Error):
    k=int(input())
    a,b=map(int,input().split())
    print("OK" if a//k < b//k or a%k==0 or b%k==0 else "NG")
Problem p02819 (python)

Fixed submission:
x = int(input())
for i in range(x,10**5 +4):
    for p in range(2, int(x**(1/2)+1)):
        if i%p == 0 :
            break
    else:
        print(i)
        break

Buggy submission (verdict: Runtime Error):
from sympy import nextprime
x = int(input())
print(nextprime(x-1))
Problem p02881 (python)

Fixed submission:
n = int(input())
ans = 0
t = int(n**(1/2)+1)


for i in range(t, 0, -1):
    if n%i == 0:
        ans += i
        ans += n//i
        break

print(ans-2)

Buggy submission (verdict: Runtime Error):
import math
from sympy import primerange
import sys
sys.setrecursionlimit(10**6) 
inn = n = int(input())
num = int(math.sqrt(n)) + 1
primlist = list(primerange(2,num)) 

for i in primlist:
    if inn % i == 0:
        while inn % num != 0:
            num -= 1
        else:
            print(num+ inn//num -2)
            break
        
else:
    print(inn-1)

Buggy submission (verdict: Runtime Error):
import math
from sympy import primerange
inn = n = int(input())
num = int(math.sqrt(n)) + 1
primlist = list(primerange(2,num)) 
for i in primlist:
    if inn % i == 0:
        while inn % num != 0:
            num -= 1
        else:
            print(num+ inn//num -2)
            break        
else:
    print(inn-1)

Buggy submission (verdict: Runtime Error):
import math
from sympy import primerange
inn = n = int(input())
num = int(math.sqrt(n)) + 1
primlist = list(primerange(2,num)) 

for i in primlist:
    if inn % i == 0:
        while inn % num != 0:
            num -= 1
        else:
            print(num+ inn//num -2)
            break
        
else:
    print(inn-1)
Problem p02915 (python)

Fixed submission:
n = int(input())
print(n**3)

Buggy submission (verdict: Runtime Error):
    n = int(input())
    print(n**3)
Problem p03013 (python)

Fixed submission:
n,m = map(int, input().split())
a = [True]*(n+1)
for i in range(m):
    t = int(input())
    a[t] = False

x = [0]*(n+1)
x[0] = 1
if a[1]:
    x[1] = 1


for i in range(2, n+1):
    if a[i]:
        x[i] = x[i-1]+ x[i-2]
print(x[n]%1000000007)

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

if a[0] == 1:
    x = [1,0]
else:
    x = [1,1]

for i in range(2,n+1):
    if i in a:
        x.append(0)

    else:
        x.append(x[i-1] + x[i-2])

if x[-1] == 0:
    print(0)
else:
    print(x[-1]%1000000007)

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

if a[0] == 1:
    x = [1,0]
else:
    x = [1,1]

for i in range(2,n+1):
    if i in a:
        x.append(0)

    else:
        x.append(x[i-1] + x[i-2])

print(x[-1]%1000000007)
Problem p03307 (python)

Fixed submission:
N = int(input())
if N % 2 == 0:
    print(N)
else:
    print(N * 2)

Buggy submission (verdict: Runtime Error):
N = input()
if N % 2 == 0:
  print(N)
else:
  print(N*2)
Problem p02595 (python)

Fixed submission:
n, d = map(int, input().split())
lists = []
cnt = 0

for i in range(n):
  x, y = map(int, input().split())
  lists.append([x, y])
  

for j in range(n):
  l = (lists[j][0] ** 2 + lists[j][1] ** 2) ** (1 / 2)
  if l <= d:
    cnt += 1
  else:
    continue

print(cnt)

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

for i in range(n):
  x.append(int(input()))
  y.append(int(input()))

for j in range(n):
  l = (x[j] ** 2 + y[j] ** 2) ** (1 / 2)
  if l <= d:
    cnt += 1
  else:
    continue

print(cnt)
Problem p02595 (python)

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

cnt=0
dist=0

for i in range(n):
  x,y=map(int,input().split())
  dist = x**2 + y**2
  if dist <= d**2:
    cnt+=1

print(cnt)

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

cnt=0
dist=0

for i in range(n){
  x,y=map(int,input().split())
  dist = x**2 + y**2
  if (dist <= d){
    cnt+=1
  }
}

print(cnt)
Problem p03042 (python)

Fixed submission:
s=input()
if 10*int(s[0])+int(s[1])<=12 and int(s[0])+int(s[1])!=0:
  if 10*int(s[2])+int(s[3])<=12 and int(s[2])+int(s[3])!=0:
    print("AMBIGUOUS")
  else:
    print("MMYY")
if 10*int(s[0])+int(s[1])>=13 or int(s[0])+int(s[1])==0:
  if 10*int(s[2])+int(s[3])<=12 and int(s[2])+int(s[3])!=0:
    print("YYMM")
  else:
    print("NA")

Buggy submission (verdict: Runtime Error):
s=input()
if 10*int(s[2])+int(s[3])>=13:
  if int(s[0])+int(s[1])==0 or 10*int(s[0])+int(s[1])>=13:
    print("NA")
  else:
    print("MMYY")
if 10*int(s[0])+int(s[1])>=13:
  if int(s[2])+int(s[3])==0 or 10*int(s[2])+int(s[3])>=13:
    print("NA")
  else:
    print("YYMM")
if 10*int(s[2])+int(s[3])<=12 and 10*int(s[0])+int(s[1])<=12:
  print("AMBIGUOUS")
  else:
    print("NA")
Problem p03207 (python)

Fixed submission:
n=int(input())
p=[]
for _ in range(n):
    p.append(int(input()))
print(sum(p)-max(p)//2)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
lst=[]
for _ in range(h):
    lst.append(input())
hl=[0]*h
wl=[0]*w
for i in range(h):
    for j in range(w):
        if lst[i][j]=="#":
            hl[i]=1
            wl[j]=1
            if hl[i]==1 and wl[j]==1:
                print(lst[i][j],end="")
    print("")
Problem p03038 (python)

Fixed submission:
from sys import stdin
import math
import fractions
from collections import deque

INF = 10 ** 10

N, M = [int(x) for x in stdin.readline().rstrip().split()]
A = [int(x) for x in stdin.readline().rstrip().split()]
BC = [list(map(int, stdin.readline().rstrip().split())) for _ in range(M)]
A.sort()
BC.sort(key=lambda x: (x[1]), reverse=True)

i = 0
A_len = len(A)

for B, C in BC: # O(10^5)
    for _ in range(B):
        if A[i] < C:
            A[i] = C
            i += 1
            if i > A_len - 1:
                print(sum(A))
                exit()
        else:
            print(sum(A))
            exit()

print(sum(A))

Buggy submission (verdict: Runtime Error):
from sys import stdin
import math
import fractions
from collections import deque

INF = 10 ** 10

N, M = [int(x) for x in stdin.readline().rstrip().split()]
A = [int(x) for x in stdin.readline().rstrip().split()]
BC = [list(map(int, stdin.readline().rstrip().split())) for _ in range(M)]
A.sort()
BC.sort(key=lambda x: (x[1]), reverse=True)

i = 0

for B, C in BC: # O(10^5)
    for _ in range(B):
        if A[i] < C:
            A[i] = C
            i += 1
        else:
            print(sum(A))
            exit()

print(sum(A))
Problem p03072 (python)

Fixed submission:
from sys import stdin

N = int(stdin.readline().rstrip())
H_list = [int(x) for x in stdin.readline().rstrip().split()]

if N == 1:
    print(1)
    exit()

cnt = 1
if H_list[1] >= H_list[0]:
    cnt += 1

for i in range(2, N):
    if H_list[i] >= max(H_list[:i]):
        cnt += 1

print(cnt)

Buggy submission (verdict: Runtime Error):
from sys import stdin

N = int(stdin.readline().rstrip())
H_list = [int(x) for x in stdin.readline().rstrip().split()]

cnt = 1
if H_list[1] >= H_list[0]:
    cnt += 1

for i in range(2, N):
    if H_list[i] >= max(H_list[:i-1]):
        cnt += 1

print(cnt)
Problem p03104 (python)

Fixed submission:
from sys import stdin

A, B = [int(x) for x in stdin.readline().rstrip().split()]

def isOdd(num):
    if num % 2 == 0:
        return False
    else:
        return True

def solve(num):
    if isOdd(num):
        if (num // 2) % 2 == 0:
            return 1
        else:
            return 0
    else:
        return solve(num+1) ^ (num+1) 


print(solve(B) ^ solve(A-1))

Buggy submission (verdict: Runtime Error):
from sys import stdin

A, B = [int(x) for x in stdin.readline().rstrip().split()]

result = "0"

for d in range(A, B+1):
    # 排他的論理和
    result = (bin(int(result) ^ d))

print(int(result, 2))
Problem p02771 (python)

Fixed submission:
A,B,C=map(int,input().split())
if (A==B or B==C or C==A) and not(A==B and B==C and C==A):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
if (A==B + B==C + C==A) =1:
  print("Yes")
else:
  print("No")
Problem p02912 (python)

Fixed submission:
import heapq
N,M=map(int,input().split())
A=list(map(lambda x: x*(-1),list(map(int,input().split()))))
A.sort()
B=[]
for i in range(N):
    heapq.heappush(B,A[i])
for i in range(M):
    heapq.heappush(B,(((heapq.heappop(B))*(-1))//2)*(-1))
print((sum(B))*(-1))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
A=list(map(int,input().split()))
A.sort(reverse=True)
while M>0:
    if A[0]//2<A[1]:
        A_0=A[0]
        i=0
        while A[i]>=A_0 and i<M and i<N:
            A[i]=A[i]//2
            i+=1
        A.sort(reverse=True)
        M-=i
    else:
        A[0]=A[0]//2
        M-=1
print(sum(A))
Problem p02933 (python)

Fixed submission:
a = int(input())
s = input()
if a >= 3200:
    print(s)
else:
    print("red")

Buggy submission (verdict: Runtime Error):
N = int(input())
L = input().split()
L.sort()
c = 0
for a in range(N):
    if a == 0:
        c = c + float(L[0])*pow(0.5, N - 1)
    else:
        c = c + float(L[a])*pow(0.5, N - a)
print(c)

Buggy submission (verdict: Runtime Error):
N = int(input())
L = input().split()
L.sort()
c = 0
for a in range(N):
    if a == 0:
        c = c + float(L[0])/pow(2, N - 1)
    else:
        c = c + float(L[a])/pow(2, N - a)
print(c)
Problem p02753 (python)

Fixed submission:
if len(set(input())) == 1:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
S = input()
for _ in range(int(input())):
    l = input().split()
    if len(l) == 1:
        S = S[::-1]
    else:
        if l[1] == "1":
            S = l[2] + S
        else:
            S = S + l[2]
print(S)
Problem p03805 (python)

Fixed submission:
N, M = map(int, input().split())
graph = [[] for i in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    graph[a].append(b)
    graph[b].append(a)


def dfs(now, prev, visited):
    visited.append(now)
    if len(visited) == N:
        return 1

    ret = 0
    for edge in graph[now]:
        if edge == prev:
            continue
        if edge in visited:
            continue

        ret += dfs(edge, prev, visited[:])

    return ret


print(dfs(0, -1, []))

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10 ** 7)

N, M = map(int, input().split())

visited = [0 for _ in range(N)]
graph = [[0] * M for _ in range(M)]
for _ in range(M):
    a, b = map(int, input().split())
    graph[a - 1][b - 1] = 1
    graph[b - 1][a - 1] = 1


def dfs(i, depth):
    if visited[i]:
        return 0
    if depth == N - 1:
        return 1

    visited[i] = 1
    ret = 0
    for j in range(0, N):
        if graph[i][j]:
            ret += dfs(j, depth + 1)

    visited[i] = 0

    return ret


print(dfs(0, 0))

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(1000000)

N, M = map(int, input().split())

visited = [0 for _ in range(N)]
graph = [[0] * M for _ in range(M)]
for _ in range(M):
    a, b = map(int, input().split())
    graph[a - 1][b - 1] = 1
    graph[b - 1][a - 1] = 1


def dfs(i, depth):
    if visited[i]:
        return 0
    if depth == N - 1:
        return 1

    visited[i] = 1
    ret = 0
    for j in range(0, N):
        if graph[i][j]:
            ret += dfs(j, depth + 1)

    visited[i] = 0

    return ret


print(dfs(0, 0))

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(100000)

N, M = map(int, input().split())

visited = [0 for _ in range(N)]
graph = [[0] * M for _ in range(M)]
for _ in range(M):
    a, b = map(int, input().split())
    graph[a - 1][b - 1] = 1
    graph[b - 1][a - 1] = 1


def dfs(i, depth):
    if visited[i]:
        return 0
    if depth == N - 1:
        return 1

    visited[i] = 1
    ret = 0
    for j in range(0, N):
        if graph[i][j]:
            ret += dfs(j, depth + 1)

    visited[i] = 0

    return ret


print(dfs(0, 0))

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

visited = [0 for _ in range(N)]
graph = [[0] * M for _ in range(M)]
for _ in range(M):
    a, b = map(int, input().split())
    graph[a - 1][b - 1] = 1
    graph[b - 1][a - 1] = 1


def dfs(i, depth):
    if visited[i]:
        return 0
    if depth == N - 1:
        return 1

    visited[i] = 1
    ret = 0
    for j in range(0, N):
        if graph[i][j]:
            ret += dfs(j, depth + 1)

    visited[i] = 0

    return ret


print(dfs(0, 0))
Problem p02595 (python)

Fixed submission:
import math
li = input()
n = int(li.split()[0])
d = int(li.split()[1])
max_distance = math.sqrt(d**2)
ans = 0
for _ in range(n):
    li = input()
    x = int(li.split()[0])
    y = int(li.split()[1])
    distance = math.sqrt(x**2 + y**2)
    if distance <= max_distance:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import math
li = input()
n = int(li.split()[0])
d = int(li.split()[1])
max_distance = math.sqrt(d**2)
ans = 0
for _ in range(n):
    li = input()
    x = int(li.split[0])
    y = int(li.split[1])
    distance = math.sqrt(x**2 + y**2)
    if distance <= max_distance:
        ans += 1
print(ans)
Problem p02595 (python)

Fixed submission:
import math

def dist(x, y):
    return math.sqrt(x**2+y**2)

# in_values = input()

l = list(map(int, input().split()))
n = l[0]
d = l[1]

count = 0
for _ in range(n):
    l = list(map(int, input().split()))
    if dist(l[0], l[1]) <= d:
        count+=1

print(count)

Buggy submission (verdict: Runtime Error):
import math

def dist(x, y):
    return math.sqrt(x^2+y^2)

# in_values = input()

l = list(map(int, input().split()))
n = l[0]
d = l[1]

count = 0
for _ in range(n):
    l = list(map(int, input().split()))
    if dist(l[0], l[1]) <= d:
        count+=1

print(count)
Problem p02753 (python)

Fixed submission:
print('Yes' if len(set(input().strip())) > 1 else 'No')

Buggy submission (verdict: Runtime Error):
from collections import deque
S = deque(list(input().strip()))
Q = int(input().strip())
flag = 1
for i in range(Q):
  line = input().strip()
  if len(line) == 1:
    flag = 1 - flag
  else:
    _, F, C = line.strip().split()
    if flag:
      if int(F) == 1:
        S.appendleft(C)
      else:
        S.append(C)
    else:
      if int(F) == 1:
        S.append(C)
      else:
        S.appendleft(C)

if flag:
  print(''.join(S))
else:
  print(''.join(S[::-1]))
Problem p03345 (python)

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

if K > 0:
    if K % 2 == 0:
        ans = A - B
    else:
        ans = B - A
else:
    ans = A - B
print(ans if ans <= 1e18 else 'Unfair')

Buggy submission (verdict: Runtime Error):
A_prev, B_prev, C_prev, K = map(int, input().split())

for _ in range(K):
  A_cur = B_prev + C_prev
  B_cur = A_prev + C_prev
  C_cur = A_prev + B_prev
  A_prev, B_prev, C_prev = A_cur, B_cur, C_cur
ans = A_cur - B_cur
print(A_cur - B_cur if ans <= 1e18 else 'Unfair')
Problem p03803 (python)

Fixed submission:
A, B = map(int, input().split())
if A == B:
  print('Draw')
elif A == 1:
  print('Alice')
elif B == 1:
  print('Bob')
elif A > B:
  print('Alice')
else:
  print('Bob')

Buggy submission (verdict: Runtime Error):
A, B = map(int(input().split()))
if A == B:
  print('Draw')
elif A == 1:
  print('Alice')
elif B == 1:
  print('Bob')
elif A > B:
  print('Alice')
else:
  print('Bob')
Problem p02676 (python)

Fixed submission:
K = int(input())
S = input()
if len(S) <= K:
  print(S)
else:
  print(S[:K] + "...")

Buggy submission (verdict: Runtime Error):
K = input()
S = input()K = int(input())
S = input()
if len(S) <= K:
  print(S)
else:
  print(S[:K] + "...")
Problem p02990 (python)

Fixed submission:

from scipy.misc import comb
n , k = map(int, input().split())

mod = 10 ** 9 + 7
red_count = n - k 
for i in range(1, k+1) :
    if red_count + 1 - i < 0 :
        print(0)
        
    else:

        print(comb(red_count+1, i , exact = True)*comb(k-1, i-1, exact=True) % mod)

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

mod = 10 ** 9 + 7
red_count = n - k 
for i in range(1, k+1):
    if red_count + 1 - i < 0:
        print(0)
        continue
    b_dif = math.factorial(k-1) / (math.factorial(i-1) * math.factorial(k-i))
    
    r_dif = math.factorial(red_count + 1)  /  (math.factorial(i) * math.factorial(red_count + 1 - i))

    
    print(int(r_dif * b_dif % mod))

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

mod = 10 ** 9 + 7
red_count = n - k 
for i in range(1, k+1):
    if red_count + 1 - i < 0:
        print(0)
        continue
    b_dif = math.factorial(k-1) / (math.factorial(i-1) * math.factorial(k-i))
    
    a_dif = math.factorial(red_count + 1)  /  (math.factorial(i) * math.factorial(red_count + 1 - i))

    print(int(a_dif * b_dif % mod))

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

mod = 10 ** 9 + 7
red_count = n - k 
for i in range(1, k+1):
    if red_count == 0:
        print(1)
        continue
    b_dif = math.factorial(k-1) / (math.factorial(i-1) * math.factorial(k-i))
    
    a_dif = math.factorial(red_count + 1)  /  (math.factorial(i) * math.factorial(red_count + 1 - i))

    print(int(a_dif * b_dif % mod))

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

mod = 10 ** 9 + 7
red_count = n - k 
for i in range(1, k+1):
    b_dif = math.factorial(k-1) / (math.factorial(i-1) * math.factorial(k-i))
    
    a_dif = math.factorial(red_count + 1)  /  (math.factorial(i) * math.factorial(red_count + 1 - i))

    print(int(a_dif * b_dif % mod))