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

Fixed submission:
from itertools import product
N=int(input())
F = [list(map(int, input().split())) for i in range(N)]
P = [list(map(int, input().split())) for i in range(N)]
store_str=list(product('01', repeat=10))
store=[[int(i) for i in j] for j in store_str]
store.pop(0)
all_sum=[]
for s in store:
    value_list=[]
    for i,j in zip(F,P): 
        l=len([1 for a,b in zip(s,i) if a==1 and b==1])
        value_list.append(j[l])
    value_sum=sum(value_list)
    all_sum.append(value_sum)
print(max(all_sum))

Buggy submission (verdict: Runtime Error):
import itertools
N=int(input())
F = [list(map(int, input().split())) for i in range(N)]
P = [list(map(int, input().split())) for i in range(N)]

store_str=list(product('01', repeat=10))
store=[[int(i) for i in j] for j in store_str]
store.pop(0)
all_sum=[]
for s in store:#joiの店をあけられる時間帯の組み合わせ
    value_list=[]
    for i,j in zip(F,P): #i番目の店の開いている時間帯のリスト
        l=len([1 for a,b in zip(s,i) if a==1 and b==1])
        value_list.append(j[l])
    value_sum=sum(value_list)
    all_sum.append(value_sum)
print(max(all_sum))
Problem p03633 (python)

Fixed submission:
import fractions
from functools import reduce
N=int(input())
L = [int(input()) for i in range(N)]
def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

print(lcm(*L))

Buggy submission (verdict: Runtime Error):
import numpy
N=int(input())
L = [int(input()) for i in range(N)]
print(numpy.lcm.reduce(L))
Problem p02760 (python)

Fixed submission:
A = []
for _ in range(3):
    a = list(map(int, input().split()))
    A.append(a)

import numpy as np
A = np.array(A)

N = int(input())
B = []
for _ in range(N):
    B.append(int(input()))

ans = [[False] * 3 for _ in range(3)]
ans = np.array(ans)

for b in B:
    temp = (A == b)

    ans = np.logical_or(ans, temp)


if ans[0, :].all() or ans[1, :].all() or ans[2, :].all():
    print("Yes")

elif ans[:, 0].all() or ans[:, 1].all() or ans[:, 2].all():
    print("Yes")

elif ans[0, 0] and ans[1, 1] and ans[2, 2]:
    print("Yes")
elif ans[0, 2] and ans[1, 1] and ans[2, 0]:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A = []
for _ in range(3):
    a = list(map(int, input().split()))
    A.append(a)

import numpy as np
A = np.array(A)

N = int(input())
B = []
for _ in range(N):
    B.append(int(input()))

ans = [[False] * 3 for _ in range(3)]
ans = np.array(ans)

for b in B:
    temp = (A == b)

    ans = np.logical_or(ans, temp)


if ans[0, :].all() or ans[1, :].all() or ans[2, :].all():
    print("Yes")

elif ans[:, 0].all() or ans[:, 1].all() or ans[:, 2].all():
    print("Yes")

elif ans[0, 0] and ans[1, 1] and ans[2, 2]:
    print("Yes")
elif ans[0, 2] and ans[1, 1] and ans[2, 0]:
    print("Yes")
else:
    print("No")
Problem p02850 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)
N = int(input())

M = [set() for _ in range(N)]

A = [[] for _ in range(N)]
ans = [0] * (N - 1)
for i in range(N - 1):
    a, b = map(int, input().split())
    A[a - 1].append((b - 1, i))
    A[b - 1].append((a - 1, i))

def dfs(x, p, pre):
    cnt = 1
    for a in A[x]:
        if a[0] == pre:
            continue

        if cnt == p:
            cnt += 1
        ans[a[1]] = cnt
        cnt += 1

        dfs(a[0], ans[a[1]], x)

dfs(0, -1, -1)

print(max(ans))
for a in ans:
    print(a)

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

M = [set() for _ in range(N)]

A = [[] for _ in range(N)]
ans = [0] * (N - 1)
for i in range(N - 1):
    a, b = map(int, input().split())
    A[a - 1].append((b - 1, i))
    A[b - 1].append((a - 1, i))

def dfs(x, p, pre):
    cnt = 1
    for a in A[x]:
        if a[0] == pre:
            continue

        if cnt == p:
            cnt += 1
        ans[a[1]] = cnt
        cnt += 1

        dfs(a[0], ans[a[1]], x)

dfs(0, -1, -1)

print(max(ans))
for a in ans:
    print(a)

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

M = [set() for _ in range(N)]

A = [[] for _ in range(N)]
ans = [0] * (N - 1)
for i in range(N - 1):
    a, b = map(int, input().split())
    A[a - 1].append((b - 1, i))
    A[b - 1].append((a - 1, i))

def dfs(x, p, pre):
    for a in A[x]:
        if a[0] == pre:
            continue

        cnt = 1
        if cnt == p:
            cnt += 1
        ans[a[1]] = cnt
        cnt += 1

        dfs(a[0], ans[a[1]], x)

dfs(0, -1, -1)

print(max(ans))
for a in ans:
    print(a)
Problem p03363 (python)

Fixed submission:
from itertools import accumulate
from collections import Counter

N = int(input())
num_list = list(map(int, input().split()))
cumulative_sum_list = list(accumulate(num_list))
cumulative_sum_list.append(0)

c = Counter(cumulative_sum_list)
s = 0
for i in c.values():
    s += i * (i - 1) // 2
print(s)

Buggy submission (verdict: Runtime Error):
N = int(input())
num_list = list(map(int, input().split()))
cumulative_sum_list = [0]
c_s = 0
for i in num_list:
    c_s += i
    cumulative_sum_list.append(c_s)
cumulative_sum_list.sort()
cumulative_sum_set = set(cumulative_sum_list)
cumulative_dif = [0, 0]
for idx, i in enumerate(range(1, 2 * (10 ** 5)), 2):
    cumulative_dif.append(cumulative_dif[idx - 1] + i)
s = 0
for i in cumulative_sum_set:
    s += cumulative_dif[cumulative_sum_list.count(i)]
print(s)
Problem p03436 (python)

Fixed submission:
from collections import deque

H, W = map(int, input().split())
grid = [list(input()) for _ in range(H)]
dot_cnt = 0
for g in grid:
    dot_cnt += g.count('.')
sy = 0
sx = 0
gy = H - 1
gx = W - 1

deq = deque()
deq.append((0, 0))
grid[0][0] = 0

y_list = [-1, 1, 0, 0]
x_list = [0, 0, -1, 1]

while deq:
    y, x = deq.popleft()
    if y == gy and x == gx:
        break
    for i in range(len(y_list)):
        dy = y + y_list[i]
        dx = x + x_list[i]
        if dy < 0 or H <= dy or dx < 0 or W <= dx:
            continue
        if grid[dy][dx] == '.':
            deq.append((dy, dx))
            grid[dy][dx] = grid[y][x] + 1
if grid[gy][gx] == '.':
    print(-1)
else:
    print(dot_cnt - (grid[gy][gx] + 1))

Buggy submission (verdict: Runtime Error):
from collections import deque

H, W = map(int, input().split())
grid = [list(input()) for _ in range(H)]
dot_cnt = 0
for g in grid:
    dot_cnt += g.count('.')
sy = 0
sx = 0
gy = H - 1
gx = W - 1

deq = deque()
deq.append((0, 0))
grid[0][0] = 0

y_list = [-1, 1, 0, 0]
x_list = [0, 0, -1, 1]

while deq:
    y, x = deq.popleft()
    if y == gy and x == gx:
        break
    for i in range(len(y_list)):
        dy = y + y_list[i]
        dx = x + x_list[i]
        if dy < 0 or H <= dy or dx < 0 or W <= dx:
            continue
        if grid[dy][dx] == '.':
            deq.append((dy, dx))
            grid[dy][dx] = grid[y][x] + 1
print(dot_cnt - (grid[gy][gx] + 1))
Problem p03633 (python)

Fixed submission:
import fractions


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


N = int(input())
if N == 1:
    print(input())
else:
    t1 = int(input())
    t2 = int(input())
    t = lcm(t1, t2)
    for _ in range(2, N):
        t = lcm(t, int(input()))
    print(t)

Buggy submission (verdict: Runtime Error):
import fractions


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


N = int(input())
t1 = int(input())
t2 = int(input())
t = lcm(t1, t2)
for _ in range(2, N):
    t = lcm(t, int(input()))
print(t)
Problem p02690 (python)

Fixed submission:
x = int(input())
r = range(-1000,1000)
for a in r:
  for b in r:
    if a*a*a*a*a - b*b*b*b*b == x:
      ans = (a,b)
print(ans[0], ans[1])

Buggy submission (verdict: Runtime Error):
import numpy as np
x = int(input())
r = range(-100,100)
for a in r:
  for b in r:
    if a*a*a*a*a - b*b*b*b*b ==x:
      ans = (a,b)
print(ans)
Problem p02732 (python)

Fixed submission:
import numpy as np
import collections

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

dic = {}
after = {}

l = collections.Counter(A)

for key, val in l.items():
	dic[key] = val * (val - 1) // 2
	after[key] = (val - 1) * (val - 2) // 2

numsum = sum(dic.values())

ans = {}
for key in dic.keys():
	ans[key] = numsum - dic[key] + after[key]

for i in range(N):
	print(ans[A[i]])

Buggy submission (verdict: Runtime Error):
import numpy as np
from math import factorial

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

dic = {}
after = {}

newdata = np.unique(A)
for i in range(len(newdata)):
	x = np.sum(A == newdata[i])
	if x <= 1:
		dic[newdata[i]] = 0
	else:
		dic[newdata[i]] = x * (x - 1) // 2
	if x - 1 <= 1:
		after[newdata[i]] = 0
	else:
		after[newdata[i]] = (x - 1) * (x - 2) // 2

numsum = 0
for dicv in dic.values():
	numsum += dicv 

ans = {}
for key in dic.keys():
	ans[key] = numsum - dic[A[key]] + after[A[key]]

for i in range(N):
	print(ans[A[i]])

Buggy submission (verdict: Runtime Error):
import numpy as np
from math import factorial

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

dic = {}
after = {}

newdata = np.unique(A)
for i in range(len(newdata)):
	x = np.sum(A == newdata[i])
	if x <= 1:
		dic[newdata[i]] = 0
	else:
		dic[newdata[i]] = factorial(x) / factorial(2) / factorial(x - 2)

	if x - 1 <= 1:
		after[newdata[i]] = 0
	else:
		after[newdata[i]] = factorial(x - 1) / factorial(2) / factorial(x - 1 - 2)

numsum = 0
for dicv in dic.values():
	numsum += dicv 


for i in range(N):
	print(int(numsum - dic[A[i]] + after[A[i]]))

Buggy submission (verdict: Runtime Error):
import numpy as np
from math import factorial

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

dic = {}
after = {}

newdata = np.unique(A)
for i in range(len(newdata)):
	x = np.sum(A == newdata[i])
	if x <= 1:
		dic[newdata[i]] = 0
	else:
		dic[newdata[i]] = factorial(x) / factorial(2) / factorial(x - 2)

	if x - 1 <= 1:
		after[newdata[i]] = 0
	else:
		after[newdata[i]] = factorial(x - 1) / factorial(2) / factorial(x - 1 - 2)

	print(dic, after)

numsum = 0
for dicv in dic.values():
	numsum += dicv 


for i in range(N):
	print(int(numsum - dic[A[i]] + after[A[i]]))

Buggy submission (verdict: Runtime Error):
import numpy as np
from math import factorial

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

dic = {}
newdata = np.unique(A)
for i in range(len(newdata)):
	x = np.sum(A == newdata[i])
	dic[newdata[i]] = x

for i in range(N):
	dic[A[i]] -= 1
	ans = 0
	for num in dic.values():
		if num <= 1:
			pass
		else:
			ans += factorial(num) / factorial(2) / factorial(num- 2)
	print(int(ans))
	dic[A[i]] += 1
Problem p02783 (python)

Fixed submission:
import numpy as np

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

ans = N // A

if N%A>0:
	ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np

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

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

win = 0
for i in range(N):
	for j in range(i+1, N):
		if x[i] + x[j] >= H:
			win = 1
			print("Yes")
			break
	if win == 1:
		break


if win == 0:
	print("No")
Problem p02784 (python)

Fixed submission:
import numpy as np

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

x = np.array(list(map(int, input().split())))

if sum(x) >= H:
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np

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

x = np.array(list(map(int, input().split())))

x = np.sort(x)[::-1]

if x[0] + x[1] >= H:
	print("Yes")
else:
	print("No")
Problem p02801 (python)

Fixed submission:
input_line = input()

print(chr(ord(input_line)+1))

Buggy submission (verdict: Runtime Error):
import numpy as np

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

N, M = x[0], x[1]

ac, wa = np.array([0 for i in range(N)]), np.array([0 for i in range(N)])

for i in range(M):
    num, result = input().split()
    num = int(num) - 1

    if ac[num] == 1:
        pass
    else:
        if result == "AC":
            ac[num] = 1
        else:
            wa[num] += 1

print(np.sum(ac), np.sum(wa))
Problem p02886 (python)

Fixed submission:
n=int(input())
d=[]
"""for i in range(n):
    d.append(int(input()))
"""
d=list(map(int,input().split()))

ans=0
for l in range(n):
    for i in range(l+1,n):
        ans+=d[l]*d[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
d=[]
for i in range(n):
    d.append(int(input()))
ans=0
for l in range(n):
    for i in range(l+1,n):
        ans+=d[l]*d[i]
print(ans)
Problem p03220 (python)

Fixed submission:
n=int(input())
t,a=map(int,input().split())
lists=[abs(a-(t-x*0.006)) for x in map(int,input().split())]
print(lists.index(min(lists))+1)

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

def abs_1(x):
    return abs(A-(T-x*0.006))

H=[]
for i in range(N):
    H.append(int(input()))
abslists=list(map(abs_1,H))

print(abslists)

print(min(abslists))

print(abslists.index(min(abslists))+1)

Buggy submission (verdict: Runtime Error):
def abs_1(x):
    return abs(A-(T-x*0.006))
N=int(input())
T=int(input())
A=int(input())
H=[]
for i in range(N):
    H.append(int(input())) 
abslists=list(map(abs_1,H))
print(abslists.index(min(abslists))+1)

Buggy submission (verdict: Runtime Error):
N=int(input())
T=int(input())
A=int(input())
"候補地の標高"
H=[]
for i in range(N):
    H.append(int(input()))


def abs_1(x):
    return abs(A-(T-x*0.006))

abslists=list(map(abs_1,H))
print(abslists.index(min(abslists))+1)

Buggy submission (verdict: Runtime Error):
N=int(input())
T=int(input())
A=int(input())
"候補地の標高"
H=[]
for i in range(N):
    H.append(int(input()))


def abs_1(x):
    return abs(A-(T-x*0.006))

abslists=list(map(abs_1,H))

print(abslists)

print(min(abslists))

print(abslists.index(min(abslists))+1)
Problem p02761 (python)

Fixed submission:
n, m = list(map(int, input().split()))
num = [-1] * n


for i in range(m):
    s, c = list(map(int, input().split()))
    if n > 1 and s == 1 and c == 0:
        print(-1)
        exit()
    elif num[s-1] != -1 and num[s-1] != c:
        print(-1)
        exit()
    else:
        num[s-1] = c

for i in range(n):
    if i == 0 and num[i] == -1:
        if n == 1:
            num[i] = 0
        else:
            num[i] = 1

    elif num[i] == -1:
        num[i] = 0

print(int(''.join(list(map(str, num)))))

Buggy submission (verdict: Runtime Error):
n, m = list(map(int, input().split()))
num = [-1] * n


for i in range(m):
    s, c = list(map(int, input().split()))
    if n > 1 and s == 1 and c == 0:
        print(-1)
        exit()
    elif num[s-1] != -1 and num[s-1] != c:
        print(-1)
        exit()
    else:
        num[s-1] = c

for i in range(m):
    if i == 0 and num[i] == -1:
        num[i] = 1
    elif num[i] == -1:
        num[i] = 0

print(int(''.join(list(map(str, num)))))
Problem p04044 (python)

Fixed submission:
ip1 = input().split()
N = int(ip1[0])
L = int(ip1[1])
strings = []
for i in range(N):
    strings.append(input())
strings.sort()
ans = ""
for i in range(len(strings)):
    ans += strings[i]

print(ans)

Buggy submission (verdict: Runtime Error):
ip1 = input().split()
N = int(ip1[0])
L = int(ip1[1])
strings = []
for i in range(N):
    strings.append(input())
strings.sort()
ans = ""
for i in range(len(strings)):
    ans += string[i]

print(ans)
Problem p03061 (python)

Fixed submission:
import math

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

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

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

#print(A)
lgcd=[A[0]]*N
for i in range(1,N):
    lgcd[i]=gcd(lgcd[i-1],A[i])

rgcd=[A[-1]]*N
for i in reversed(range(0,N-1)):
    rgcd[i]=gcd(rgcd[i+1],A[i])

#print(lgcd)
#print(rgcd)

ans=[0]*N
ans[0]=rgcd[1]
ans[N-1]=lgcd[N-2]
for i in range(1,N-1):
    ans[i]=gcd(lgcd[i-1],rgcd[i+1])
print(max(ans))

Buggy submission (verdict: Runtime Error):
import math

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

#print(A)

lgcd=[A[0]]*N
for i in range(1,N):
    lgcd[i]=math.gcd(lgcd[i-1],A[i])

rgcd=[A[-1]]*N
for i in reversed(range(0,N-1)):
    rgcd[i]=math.gcd(rgcd[i+1],A[i])

#print(lgcd)
#print(rgcd)


ans=[0]*N
ans[0]=rgcd[1]
ans[N-1]=lgcd[N-2]
for i in range(1,N-1):
    ans[i]=math.gcd(lgcd[i-1],rgcd[i+1])
print(max(ans))
Problem p03062 (python)

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

Ap=[]
Am=[]
for a in A:
    if a >= 0:
        Ap.append(a)
    else:
        Am.append(a)

Ap=sorted(Ap)
Am=sorted(Am,reverse=True)


if len(Ap)==0:
    if len(Am)%2==0:
        ans=-sum(Am)
    else:
        ans=-sum(Am)+2*Am[0]
        
elif len(Am)%2==0:
    Ams=-sum(Am)
    Aps=sum(Ap)
    ans=Ams+Aps
else:
    Ams=-sum(Am)+Am[0]
    Aps=sum(Ap)-Ap[0]
    tmp=Ap[0]+Am[0]
    if tmp<0:
        tmp=-tmp
    ans=Ams+Aps+tmp
        
print(ans)

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

Ap=[]
Am=[]
for a in A:
    if a >= 0:
        Ap.append(a)
    else:
        Am.append(a)

Ap=sorted(Ap)
Am=sorted(Am,reverse=True)

if len(Am)%2==0:
    Ams=-sum(Am)
    Aps=sum(Ap)
    ans=Ams+Aps
else:
    Ams=-sum(Am)+Am[0]
    Aps=sum(Ap)-Ap[0]
    tmp=Ap[0]+Am[0]
    if tmp<0:
        tmp=-tmp
    ans=Ams+Aps+tmp
        
print(ans)

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

Ap=[]
Am=[]
for a in A:
    if a >= 0:
        Ap.append(a)
    else:
        Am.append(a)

Ap=sorted(Ap)
Am=sorted(Am,reverse=True)

if len(Am)%2==0:
    Ams=-sum(Am)
    Aps=sum(Ap)
    ans=Ams+Aps
else:
    Ams=-sum(Am[1:])
    Aps=sum(Ap[1:])
    tmp=Ap[0]+Am[0]
    if tmp<0:
        tmp=-tmp
    ans=Ams+Aps+tmp
        
print(ans)
Problem p03078 (python)

Fixed submission:
x,y,z,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)


AB=[a+b for a in A for b in B]
AB.sort(reverse=True)

ABC=[ab+c for ab in AB[:min(k,x*y)] for c in C]
ABC.sort(reverse=True)

for i in range(k):
    print(ABC[i])

Buggy submission (verdict: Runtime Error):
x,y,z,k=map(int,input().split())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))

AB=[0]*(x*y)
i=0
for a in A:
    for b in B:
        AB[i]=a+b
        i+=1

AB=AB.sort(reverse=True)[:min(k,x*y)]
ABC=[0]*(min(k,x*y)*z)
i=0
for ab in AB:
    for c in C:
        ABC[i]=ab+c
        i+=1

ABC.sort(reverse=True)

for i in range(k):
    print(ABC[i])
Problem p02696 (python)

Fixed submission:
a, b, n = map(int, input().split())
 
tmp = 0
for x in (range(1, b+1, b-2) if b<=n else range(1, n+1, n-1)):
#for x in range(1, n+1):
    calc = a*x//b - a*(x//b)
    if calc > tmp:
        tmp = calc
 
print(tmp)

Buggy submission (verdict: Runtime Error):
a, b, n = map(int, input().split())
 
tmp = 0
for x in (range(1, b+1, b//2) if b<=n else range(1, n+1, n-1)):
#for x in range(1, n+1):
    calc = a*x//b - a*(x//b)
    if calc > tmp:
        tmp = calc
 
print(tmp)

Buggy submission (verdict: Runtime Error):
a, b, n = map(int, input().split())
 
tmp = 0
for x in (range(1, b+1, b-1) if b<n else range(1, n+1, n-1)):
#for x in range(1, n+1):
    calc = a*x//b - a*(x//b)
    if calc > tmp:
        tmp = calc
 
print(tmp)

Buggy submission (verdict: Runtime Error):
a, b, n = map(int, input().split())
 
tmp = 0
for x in (range(1, b+1, b-1) if b<=n else range(1, n+1, n-1)):
#for x in range(1, n+1):
    calc = a*x//b - a*(x//b)
    if calc > tmp:
        tmp = calc
 
print(tmp)

Buggy submission (verdict: Runtime Error):
a, b, n = map(int, input().split())
 
tmp = 0
for x in (range(1, b+1, b)) #if b<=n else range(1, n+1, n-1)):
#for x in range(1, n+1):
    calc = a*x//b - a*(x//b)
    if calc > tmp:
        tmp = calc
 
print(tmp)

Buggy submission (verdict: Runtime Error):
a, b, n = map(int, input().split())
 
tmp = 0
for x in (range(1, b+1, b): #if b<=n else range(1, n+1, n-1)):
#for x in range(1, n+1):
    calc = a*x//b - a*(x//b)
    if calc > tmp:
        tmp = calc
 
print(tmp)

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

tmp = 0
for x in (range(1, b+1, b-1) if b<=n else range(1, n+1, n-1)):
#for x in range(1, n+1):
    calc = a*x//b - a*(x//b)
    if calc > tmp:
        tmp = calc

print(tmp)

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

tmp = 0
for x in (range(1, b+1, b-1) if b<=n else range(1, n+1, n-1)):
#for x in range(1, n+1):
    #calc = (a*x)//b - a*(x//b)
    
    if calc > tmp:
        tmp = calc

print(tmp)
Problem p04012 (python)

Fixed submission:
w = list(map(str,input()))
w.sort()
w = "".join(w)

flag = 0
w = [w[i*2:i*2+2] for i in range(-(-len(w)//2))]
for i in w:
  if len(i)==1 or not i[0] == i[1]:
    flag = 1
    break

print("Yes") if not flag else print("No")

Buggy submission (verdict: Runtime Error):
w = list(map(str,input()))
w.sort()
w = "".join(w)

flag = 0
w = [w[i*2:i*2+2] for i in range(-(-len(w)//2))]
for i in w:
  if not i[0] == i[1]:
    flag = 1

print("Yes") if not flag else print("No")

Buggy submission (verdict: Runtime Error):
w = list(map(str,input()))
w.sort()
w = "".join(w)

flag = 0
w = [w[i*2:i*2+2] for i in range(-(-len(w)//2))]
for i in w:
  if not w[0] == w[1]:
    flag = 1

print("Yes") if not flag else print("No")
Problem p02690 (python)

Fixed submission:
import numpy as np

n=1000
X = int(input())

a = np.array(range(n))
ex = np.full(n, 5)

m = a*n+a.reshape(n,1)

b = np.power(a, ex)

plus = b + b.reshape(n,1)
minus = b - b.reshape(n,1)

plus = plus==X
minus = minus==X

if np.count_nonzero(plus):
  c = m[plus][0]
  ans = int(c/n), -int(c%n)
else:
  c = m[minus][0]
  ans = int(c/n), int(c%n)
  
print(ans[0], ans[1], sep=' ')

Buggy submission (verdict: Runtime Error):
import numpy as np

n=100
X = int(input())

a = np.array(range(n))
ex = np.full(n, 5)

m = a*n+a.reshape(n,1)

b = np.power(a, ex)

plus = b + b.reshape(n,1)
minus = b - b.reshape(n,1)

plus = plus==X
minus = minus==X

if np.count_nonzero(plus):
  c = m[plus][0]
  ans = int(c/n), -int(c%n)
else:
  c = m[minus][0]
  ans = int(c/n), int(c%n)
  
print(ans[0], ans[1], sep=' ')
Problem p02696 (python)

Fixed submission:
import math

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

m = 0
n = 1

def cal(x):
  return math.floor(A*x/B)-A*math.floor(x/B)

while n<N:
  c = B*(math.floor((n+1)/B)+1)-1
  n = min(N, c)
  m = max(cal(n), m)
  if (A*n)%B == 0:
    break
  
print(m)

Buggy submission (verdict: Runtime Error):
import math

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

m = 0
n = 1

def cal(x):
  return math.floor(A*x/B)-A*math.floor(x/B)

while n<N:
  c = B*(math.floor((n+1)/B)+1)-1
  n = min(N, c)
  m = max(cal(n), m)
  if (A*x)%B == 0:
    break
  
print(m)
Problem p04043 (python)

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

if (a+b+c).count('5')==2 and (a+b+c).count('7')==1:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
s = input().split
s = s[0]+s[1]+s[2]

if s.count('5')==2 and s.count('7')==1:
  print("Yes")
else:
  print("No")
Problem p03238 (python)

Fixed submission:
N = int(input())
if N ==1:
  print("Hello World")
elif N == 2:
  A = int(input())
  B = int(input())
  print(A+B)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())
 
if N == 2:
  print(A+B)
elif N ==1:
  print("Hello World")

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

if N = 2:
  print(A+B)
elif N =1:
  print("Hello World")

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

if N > 1:
  print(A+B)
else:
  print("Hello World")

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

if N > 1:
  print(A+B)
else:
  print("Hello World")
Problem p03239 (python)

Fixed submission:
N, M = map(int, raw_input().split())
a = []
for i in range(N):
    a.append(map(int, raw_input().split()))

mincost = 10001
minnum = 10000
for i in range(N):
    if a[i][1]>M:
        continue
    else:
        if mincost > a[i][0]:
            mincost = a[i][0]
            minnum = i
if mincost == 10001:
  print ("TLE")
else:
  print(a[minnum][0])

Buggy submission (verdict: Runtime Error):
N, M = map(int, raw_input().split())
a = []
for i in range(N):
    a.append(map(int, raw_input().split()))

mincost = 10001
minnum = 10000
for i in range(N):
    if a[i][1]>M:
        continue
    else:
        if mincost > a[i][0]:
            mincost = a[i][0]
            minnum = i

print(a[minnum][0])