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

Fixed submission:
N = int(input())
X = input()
memo = {}
X_int = int(X, 2)


def popcount(n: int):
    x = bin(n)[2:]
    return x.count("1")


pcf = popcount(int(X, 2))
pcm = pcf - 1
pcp = pcf + 1
xm = X_int % pcm if pcm != 0 else 0
xp = X_int % pcp


def f(n: int, ops: int):

    while n != 0:
        n %= popcount(n)
        ops += 1
    return ops


def rev(x: str, i: int):
    if x == "1":
        if pcm == 0:
            return -1
        n = (xm - (pow(2, N-i-1, pcm))) % pcm
    else:
        n = (xp + (pow(2, N-i-1, pcp))) % pcp
    return n


if __name__ == "__main__":
    for i, x in enumerate(X):
        n = rev(x, i)
        if n == -1:
            print(0)
        else:
            print(f(n, 1))

Buggy submission (verdict: Runtime Error):
N = int(input())
X = input()
memo = {}
X_int = int(X, 2)


def popcount(n: int):
    x = bin(n)[2:]
    return x.count("1")


pcf = popcount(int(X, 2))
pcm = pcf - 1
pcp = pcf + 1
xm = X_int % pcm
xp = X_int % pcp


def f(n: int, ops: int):

    while n != 0:
        n %= popcount(n)
        ops += 1
    return ops


def rev(x: str, i: int):
    if x == "1":
        if pcm == 0:
            return -1
        n = (xm - (pow(2, N-i-1, pcm))) % pcm
    else:
        n = (xp + (pow(2, N-i-1, pcp))) % pcp
    return n


if __name__ == "__main__":
    for i, x in enumerate(X):
        n = rev(x, i)
        if n == -1:
            print(0)
        else:
            print(f(n, 1))

Buggy submission (verdict: Runtime Error):
N = int(input())
X = input()
memo = {}
X_int = int(X, 2)


def popcount(n: int):
    x = bin(n)[2:]
    return x.count("1")


pcf = popcount(int(X, 2))
pcm = pcf - 1
pcp = pcf + 1
xm = X_int % pcm
xp = X_int % pcp


def f(n: int, ops: int):

    while n != 0:
        n %= popcount(n)
        ops += 1
    return ops


def rev(x: str, i: int):
    if x == "1":
        n = (xm - (pow(2, N-i-1, pcm))) % pcm
    else:
        n = (xp + (pow(2, N-i-1, pcp))) % pcp
    return n


if __name__ == "__main__":
    for i, x in enumerate(X):
        n = rev(x, i)
        if n == 0:
            print(0)
        else:
            print(f(n, 1))

Buggy submission (verdict: Runtime Error):
N = int(input())
X = input()
memo = {}
X_int = int(X, 2)


def popcount(n: int):
    x = bin(n)[2:]
    return x.count("1")


pcf = popcount(int(X, 2))
pcm = pcf - 1
pcp = pcf + 1
xm = X_int % pcm
xp = X_int % pcp


def f(n: int, ops: int):

    while n != 0:
        n %= popcount(n)
        ops += 1
    return ops


def rev(x: str, i: int):
    if x == "1":
        n = (xm - (pow(2, N-i-1, pcm))) % pcm
    else:
        n = (xp + (pow(2, N-i-1, pcp))) % pcp
    return n


if __name__ == "__main__":
    for i, x in enumerate(X):
        print(f(rev(x, i), 1))
Problem p02630 (python)

Fixed submission:

def sum_dict(d):
    num = 0
    for k, v in d.items():
        num += k * v
    return num


def create_dict(A):
    d = {}
    for a in A:
        if d.get(a) is None:
            d[a] = 1
        else:
            d[a] += 1
    return d


if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    Q = int(input())
    BC = []
    for i in range(Q):
        BC.append(tuple(map(int, input().split())))

    d = create_dict(A)

    ans = sum_dict(d)
    for b, c in BC:
        db = d.get(b)
        if db is None:
            db = 0
        if d.get(c) is None:
            d[c] = 0
        d[c] += db
        d[b] = 0

        ans += (c - b) * db
        print(ans)

Buggy submission (verdict: Runtime Error):

def sum_dict(d):
    num = 0
    for k, v in d.items():
        num += k * v
    return num


if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    Q = int(input())
    BC = []
    for i in range(Q):
        BC.append(tuple(map(int, input().split())))

    d = {i: 0 for i in range(10**5)}
    for a in A:
        d[a] += 1

    for b, c in BC:
        d[c] += d[b]
        d[b] = 0
        print(sum_dict(d))
Problem p02641 (python)

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

d = {i: 1 for i in p}
idx = X
while True:
    if d.get(idx) is None:
        ans_plus = idx
        break
    else:
        idx += 1

idx = X
while True:
    if d.get(idx) is None:
        ans_minus = idx
        break
    else:
        idx -= 1

if abs(X - ans_plus) < abs(X - ans_minus):
    print(ans_plus)
else:
    print(ans_minus)

Buggy submission (verdict: Runtime Error):
d = {i: 1 for i in p}
idx = X
while True:
    if d.get(idx) is None:
        ans_plus = idx
        break
    else:
        idx += 1

idx = X
while True:
    if d.get(idx) is None:
        ans_minus = idx
        break
    else:
        idx -= 1

if abs(X - ans_plus) < abs(X - ans_minus):
    print(ans_plus)
elif abs(X - ans_plus) > abs(X - ans_minus):
    print(ans_minus)
else:
    print(ans_minus)
Problem p03695 (python)

Fixed submission:
#!/usr/local/bin/python3
# https://atcoder.jp/contests/abc064/tasks/abc064_c


def check(a):
    if a < 400:
        return 0
    elif a < 800:
        return 1
    elif a < 1200:
        return 2
    elif a < 1600:
        return 3
    elif a < 2000:
        return 4
    elif a < 2400:
        return 5
    elif a < 2800:
        return 6
    elif a < 3200:
        return 7
    else:
        return 8


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

ratings = [
    '1-399', '400-799', '800-1199', '1200-1599', '1600-1999',
    '2000-2399', '2400-2799', '2800-3199', '3200-']
d = {r: 0 for r in ratings}

for a in A:
    d[ratings[check(a)]] += 1

ans = 0
for k, v in d.items():
    if k != '3200-' and v != 0:
        ans += 1

top = d['3200-']
if top == 0:
    print(ans, ans)
elif ans == 0:
    print(1, top)
else:
    print(ans, ans+top)

Buggy submission (verdict: Runtime Error):
#!/usr/local/bin/python3
# https://atcoder.jp/contests/abc064/tasks/abc064_c


def check(a):
    if 1 <= a < 400:
        return 0
    elif 400 <= a < 799:
        return 1
    elif 800 <= a < 1199:
        return 2
    elif 1200 <= a < 1599:
        return 3
    elif 1600 <= a < 1999:
        return 4
    elif 2000 <= a < 2399:
        return 5
    elif 2400 <= a < 2799:
        return 6
    elif 2800 <= a < 3199:
        return 7
    elif 3200 <= a:
        return 8


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

ratings = [
    '1-399', '400-799', '800-1199', '1200-1599', '1600-1999',
    '2000-2399', '2400-2799', '2800-3199', '3200-']
d = {r: 0 for r in ratings}

for a in A:
    d[ratings[check(a)]] += 1

ans = 0
for k, v in d.items():
    if k != '3200-' and v != 0:
        ans += 1

top = d['3200-']
if top == 0:
    print(ans, ans)
elif ans == 0:
    print(1, min(8, top))
else:
    print(ans, ans+min(8, top))
Problem p02684 (python)

Fixed submission:
import sys

input = sys.stdin.readline
n,k = map(int,input().split())
a = list(map(int,input().split()))

p = [1]
for i in range(n):
    p.append(a[p[i]-1])

if k <= n:
    print(p[k])
else:
    # 周期の来る前の回数
    num = p.index(p[-1])
    p = p[num:]

    # 周期
    pn = len(p)-1
    k -= num

    # 回数/周期のあまり
    ans = k%pn
    print(p[ans])

Buggy submission (verdict: Runtime Error):
import sys

def mink(numk,l):
    x = 1
    for _ in range(k):
        x = a[x-1]
    return x

input = sys.stdin.readline
n,k = map(int,input().split())
a = list(map(int,input().split()))

# kが小さい時
if 10**5 <= n and k <= 10**10:
    print(mink(k,a))
    sys.exit()

z = 1
p = [1]
for _ in range(k):
    z = a[z-1]
    if z in p:
        p.append(z)
        break
    p.append(z)

# 周期の来る前の回数
num = p.index(p[-1])

p = p[num:]

# 周期
pn = len(p)-1

k -= num

# 回数/周期のあまり
anum = k%pn
print(p[anum])

Buggy submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline
n,k = map(int,input().split())
a = list(map(int,input().split()))

if k ==1:
    print(a[a[0]-1])
    sys.exit()

z = 1
p = [1]
for _ in range(k):
    z = a[z-1]
    if z in p:
        p.append(z)
        break
    p.append(z)

# 周期の来る前の回数
num = p.index(p[-1])

p = p[num:]

# 周期
pn = len(p)-1

k -= num

# 回数/周期のあまり
anum = k%pn
print(p[anum])

Buggy submission (verdict: Runtime Error):
import sys

def mink(numk,l):
    x = 1
    for _ in range(k):
        x = a[x-1]
    return x

input = sys.stdin.readline
n,k = map(int,input().split())
a = list(map(int,input().split()))

# kが小さい時
if k <= 10**3:
    print(mink(k,a))
    sys.exit()

z = 1
p = [1]
for _ in range(k):
    z = a[z-1]
    if z in p:
        p.append(z)
        break
    p.append(z)

# 周期の来る前の回数
num = p.index(p[-1])

p = p[num:]

# 周期
pn = len(p)-1

k -= num

# 回数/周期のあまり
anum = k%pn
print(p[anum])

Buggy submission (verdict: Runtime Error):
import sys

input = sys.stdin.readline
n,k = map(int,input().split())
a = list(map(int,input().split()))

z = 1
p = [1]
for _ in range(k):
    z = a[z-1]
    if z in p:
        p.append(z)
        break
    p.append(z)

# 周期の来る前の回数
num = p.index(p[-1])

p = p[num:]

# 周期
pn = len(p)-1

k -= num

# 回数/周期のあまり
anum = k%pn
print(p[anum])
Problem p02696 (python)

Fixed submission:
import math

def floor(num,a,b):
    return math.floor(a*num/b)-(a*math.floor(num/b))

a,b,n = map(int,input().split())
print(floor(min(b-1,n),a,b))

Buggy submission (verdict: Runtime Error):
import math

def fl(number):
    return math.floor(number)

a,b,n = map(int,input().split())
x = list(range(1,n+1))
ma = 0

for i in x:
    c = fl(i/b)
    tmp = fl((a*i)/b)-(a*c)
    if ma < tmp:
        ma = tmp

print(ma)
Problem p02706 (python)

Fixed submission:
n,m = map(int,input().split())
a = list(map(int,input().split()))
if sum(a)>n:
  print('-1')
else:
  print(n-sum(a))

Buggy submission (verdict: Runtime Error):
n,m = int(input().split())
a = int(input().split())
if sum(a)>n:
  print('-1')
else:
  print(n-sum(a))
Problem p02713 (python)

Fixed submission:
import math
k = int(input())
s = 0
i = 0
d = [0]*k*k
for a in range(1,k+1):
    for b in range(1,k+1):
        d[i] = math.gcd(a,b)
        i+=1
for c in range(1,k+1):
        s += sum(map(lambda x: math.gcd(x,c),d))
print(s)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
    
k = int(input())
sum = 0
for a in xrange(1,k+1):
    for b in xrange(1,k+1):
        for c in xrange(1,k+1):
            sum += gcd(a,b,c)
print(sum)
Problem p02742 (python)

Fixed submission:
h, w = map(int, raw_input().split())
x = 1 if h == 1 or w == 1 else h * w 
if x == 1:
  print x
elif x % 2 == 0:
  print x / 2
else:
  print x / 2 + 1

Buggy submission (verdict: Runtime Error):
h, w = map(int, raw_input().split())
x = h*w
print x/=2 if x % 2 != 0 x = (x/2)+1
Problem p02743 (python)

Fixed submission:
a,b,c = map(int,raw_input().split())
x = "Yes" if (c-a-b) >= 0 and (4*a*b) < ((c-a-b)**2) else "No"
print x

Buggy submission (verdict: Runtime Error):
import math
a,b,c = map(int,raw_input().split())
print x = "Yes" if math.sqrt(a)+math.sqrt(b)<math.sqrt(c) else "No"
Problem p02924 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
l = list(range(1,n))
print(sum(l))
Problem p02934 (python)

Fixed submission:
import fractions
from functools import reduce

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

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
a = list(map(int,input().split()))
lcm = lcm_list(a)
d = [0]*n

for i in range(n):
    d[i] = lcm//a[i]

print(lcm/sum(d))

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

n = int(input())
a = list(map(int,input().split()))
lcm = np.lcm.reduce(a)
d = [0]*n

for i in range(n):
    d[i] = lcm//a[i]

print(lcm/sum(d))
Problem p02981 (python)

Fixed submission:
n,a,b = map(int,input().split())
print(min(a*n,b))

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

if l == 0:print(0);quit()

for i in range(l,r):
    for j in range(l+1,r+1):
        if ans == 0:
            break
        ans = min(ans,i*j%2019)

print(ans)
Problem p02995 (python)

Fixed submission:
import fractions
a,b,c,d = map(int,input().split())
lcm = (c*d)//fractions.gcd(c,d)
x = b//c - (a-1)//c
y = b//d - (a-1)//d
z = b//lcm - (a-1)//lcm
ans = (b-a+1)-(x+y-z)
print(ans)

Buggy submission (verdict: Runtime Error):
from math import gcd
a,b,c,d = map(int,input().split())
lcm = (c*d)//gcd(c,d)
x = b//c - (a-1)//c
y = b//d - (a-1)//d
z = b//lcm - (a-1)//lcm
ans = (b-a+1)-(x+y-z)
print(ans)
Problem p03000 (python)

Fixed submission:
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = [0]*(n+1)
ans = 1

for i in range(1,n+1):
    d[i] = d[i-1]+l[i-1]
    if x < d[i]:
        break
    ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
l = list(map(int,input().split()))
d = [0]*(n+1)
ans = 1

for i in range(1,n+2):
    d[i] = d[i-1]+l[i-1]
    if x < d[i]:
        break
    ans += 1

print(ans)
Problem p02639 (python)

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

for i in range(len(X)):
  if X[i] == 0:
    print(i+1)
    break

Buggy submission (verdict: Runtime Error):
X = list(map(int,input().split()))
for i in range(X):
  if X[i] == 0:
    print(i+1)
Problem p02641 (python)

Fixed submission:
import bisect

X,N = (int(x) for x in input().split())
P = list(map(int, input().split()))
ALL = list(int(i) for i in range(-100,201))
P.sort()
Q = list(set(P)^set(ALL))
number = bisect.bisect(Q,X)

if number==0:
  print(Q[0])
elif number==len(Q):
  print(Q[len(Q)-1])
elif X-Q[number-1]<=Q[number]-X:
  print(Q[number-1])
elif X-Q[number-1]>Q[number]-X:
  print(Q[number])

Buggy submission (verdict: Runtime Error):
import bisect

X,N = (int(x) for x in input().split())
P = list(map(int, input().split()))
ALL = list(int(i) for i in range(1,101))
P.sort()
Q = list(set(P)^set(ALL))
number = bisect.bisect(Q,X)

if number==0:
  print(Q[0])
elif number==len(Q):
  print(Q[len(Q)-1])
elif X-Q[number-1]<=Q[number]-X:
  print(Q[number-1])
elif X-Q[number-1]>Q[number]-X:
  print(Q[number])
Problem p02923 (python)

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
 
t = 0
result =0
 
for i in range(n-1):
  if h[i] >= h[i+1]:
    t += 1
  else:
    result = max(t,result)
    t = 0
 
result = max(t, result)
 
print(result)

Buggy submission (verdict: Runtime Error):
N = int(input()) #マスの数
Hlist = list(map(int, input().split())) #マスの高さのリスト
n = 0
nlist = []

for i in range(N-1):
    if Hlist[i] >= Hlist[i+1]:
        n += 1
        if i == N-2:
            nlist.append(n)
    else:
        nlist.append(n)
        n = 0

print(max(nlist))

Buggy submission (verdict: Runtime Error):
N = int(input()) #マスの数
Hlist = list(map(int, input().split())) #マスの高さのリスト
n = 0
nlist = []

for i in range(N-1):
    if Hlist[i] >= Hlist[i+1]:
        n += 1
        if i == N-2:
            nlist.append(n)
    else:
        nlist.append(n)
        n = 0

print(max(nlist))
Problem p03260 (python)

Fixed submission:
A,B = map(int,input().split())
print(['No','Yes'][A%2==1 and B%2==1])

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
print(['No','Yes'][A%2==1 and B%2==1]
Problem p02583 (python)

Fixed submission:
x = int(input())
d = list(map(int, input().split()))
count = 0
for i in range(len(d)):
  for j in range(i+1,len(d)):
    for k in range(j+1,len(d)):
      temp = []
      temp.extend([d[i],d[j],d[k]])
      temp.sort()
      if temp[0] + temp[1] > temp[2] and len(list(set(temp))) == 3:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
x = int(input())
d = list(map(int, input().split()))
count = 0
if x < 3:
  print(0)
  break
else:
  for i in range(len(d)):
    for j in range(i+1,len(d)):
      for k in range(j+1,len(d)):
        temp = []
        temp.extend([d[i],d[j],d[k]])
        temp.sort()
        if temp[0] + temp[1] > temp[2] and len(list(set(temp))) == 3:
          count += 1
print(count)
Problem p02600 (python)

Fixed submission:
x = int(input())
 
if 400 <= x and x <= 599:
  print(8)
elif x <= 799:
  print(7)
elif x <= 999:
  print(6)
elif x <= 1199:
  print(5)
elif x <= 1399:
  print(4)
elif x <= 1599:
  print(3)
elif x <= 1799:
  print(2)
else:
  print(1)

Buggy submission (verdict: Runtime Error):
x = int(input())
 
if 400 < = x and x <= 599:
  print(8)
elif x <= 799:
  print(7)
elif x <= 999:
  print(6)
elif x <= 1199:
  print(5)
elif x <= 1399:
  print(4)
elif x <= 1599:
  print(3)
elif x <= 1799:
  print(2)
else:
  print(1)
Problem p02910 (python)

Fixed submission:
a=input()
b=list(a)
c=1
x=0
ans={"L":1,"R":0,"U":0,"D":0}
ans2={"L":0,"R":1,"U":0,"D":0}
for i in b:
    if int(c)%2==1:
        x=x+ans[i]
    elif int(c)%2==0:
        x=x+ans2[i]
    c=c+1
if x>=1:
	print("No")
else:
  	print("Yes")

Buggy submission (verdict: Runtime Error):
a=input()
b=list(a)
c=1
x=0
ans={"L":1,"R":0,"U":0,"D":0}
ans2={"L":0,"R":1,"U":0,"D":0}
for i in b:
	if int(c)%2==1:
		x=x+ans[i]
    elif int(c)%2==0:
      	x=x+ans2[i]
    c=c+1
if x>=1:
	print("No")
else:
  	print("yes")

Buggy submission (verdict: Runtime Error):
a=input()
b=list(a)
c=1
x=0
ans={"L":1,"R":0,"U":0,"D":0}
ans2={"L":0,"R":1,"U":0,"D":0}
for i in b:
	if int(c)%2==1:
    	x=x+ans[i]
    elif int(c)%2==0:
      	x=x+ans2[i]
    c=c+1
if x>=1:
	print("No")
else:
  	print("Yes")
Problem p03369 (python)

Fixed submission:
# coding: utf-8
a=input()
b=list(a)
x=700
lis={"o":1,"x":0}
for i in b:
  y=lis[i]
  if y==1:
      x=x+100
print(x)

Buggy submission (verdict: Runtime Error):
a=input()
b=list(a)
print(b)
x=700
if b[0]==o:
	x=x+100
if b[1]==o:
	x=x+100
if b[2]==o:
	x=x+100:
print(x)
Problem p03643 (python)

Fixed submission:
# coding: utf-8
a=input()
print("ABC"+a)

Buggy submission (verdict: Runtime Error):
a=input()
print("ABC"+int(a))
Problem p03697 (python)

Fixed submission:
# coding: utf-8
a,b=input().split()
m=int(a)+int(b)
if m<10:
  print(int(m))
else:
  print("error")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import math
a=input()
b=input()
m=int(a)+int(b)
if m<10:
  print(int(m))
else:
  print("error")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
a=input()
b=input()
m=int(a)+int(b)
if int(m)<10:
  print(int(m))
else:
  print("error")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
a=input()
b=input()
m=int(a)+int(b)
if m<10:
  print(int(m))
else:
  print("error")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
import math
a=input()
b=input()
m=int(a)+int(b)
if m<10:
  print(int(m))
else:
  print("error")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
a=input()
b=input()
m=int(a)+int(b)
if m<10:
  print(int(m))
else:
  print("error")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
m=int(a)+int(b)
if int(m)<10:
	print(int(m))
else:
	print("error")

Buggy submission (verdict: Runtime Error):
# coding: utf-8
a=input()
b=input()
m=a+b
if int(m)<10:
	print(int(m))
else:
	print("error")

Buggy submission (verdict: Runtime Error):
#using
a=input()
b=input()
print(b)
m=int(a)+int(b)
if int(m)<10:
	print(int(m))
else:
	print("error")

Buggy submission (verdict: Runtime Error):
a=input()
b=input()
m=int(a)+int(b)
if m<10
	print(m)
elif 
	print("error")
Problem p03711 (python)

Fixed submission:
a,b=input().split()
list1={"1":1,"2":3,"3":1,"4":0,"5":1,"6":0,"7":1,"8":1,"9":0,"10":1,"11":0,"12":1}
c=list1[a]
d=list1[b]
if str(c)==str(d):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b=input().split()
list1={1:1,2:3,3:1,4:0,5:1,6:0,7:1,8:1,9:0,10:1,11:0,12:1}
c=list1(a)
d=list1(b)
if c==d:
  print("Yes")
else:
  print("No")
Problem p03943 (python)

Fixed submission:
a=input().split(" ")
sum1=int(a[0])+int(a[1])
sum2=int(a[0])+int(a[2])
sum3=int(a[1])+int(a[2])

if sum1==int(a[2]) or sum2==int(a[1]) or sum3==int(a[0]):
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
a=input().split(" ")
sum1=a[0]+a[1]
sum2=a[0]+a[2]
sum3=a[1]+a[2]

if sum1+sum2==sum3 or sum1+sum3==sum2 or sum2+sum3==sum1
	print("Yes")
else:
	print("No")
Problem p03963 (python)

Fixed submission:
a=input().split(" ")
part=0
 
for i in range(int(a[0])):
	if i==0:
		part=int(a[1])
	else:
		part=part*(int(a[1])-1)
 
print(part)

Buggy submission (verdict: Runtime Error):
a=input().split(" ")
part=0

for i in range(a[0]):
	if i==0:
		part=a[1]
	else:
		part=part*(a[1]-1)

print(part)
Problem p04044 (python)

Fixed submission:
a=input().split(" ")
list1=[]
c=""


for i in range(int(a[0])):
	b=input()
	list1.append(b)

list2=sorted(list1)

for j in range(int(a[0])):
    c=c+list2[j]

print(c)

Buggy submission (verdict: Runtime Error):
a=input().split(" ")
list1=[]

for i in range(int(a[0])):
	b=input()
	list1.append(b)

list2=sorted(list1)

for j in range(int(a[0])+1):
	c=c+list2[j]

print(c)
Problem p02554 (python)

Fixed submission:
# 整数の入力
N = int(input())
 
print((10 ** N - 2* 9 ** N + 8 ** N) % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
# 整数の入力
N = int(input())

print((10 ** N - 2* 9 **N + 8 ** N)) % (10 ** 9 + 7)

Buggy submission (verdict: Runtime Error):
import math
def combinations_count(N, r):
    return math.factorial(N) // (math.factorial(N - r) * math.factorial(r))
 
# 整数の入力
N = int(input())
r = 2
 
print(combinations_count(N, r) * 10**(N-r) % (10**9 +7))

Buggy submission (verdict: Runtime Error):
import math
def combinations_count(N, r):
    return math.factorial(N) // (math.factorial(N - r) * math.factorial(r))
 
# 整数の入力
N = int(input())
r = 2

print(combinations_count(N, r))

Buggy submission (verdict: Runtime Error):
def combinations_count(N, r):
    return math.factorial(N) // (math.factorial(N - r) * math.factorial(r))

# 整数の入力
N = int(input())
r = 2

print(combinations_count(N, r) * 10**(N-r) % (10**9 +7))

Buggy submission (verdict: Runtime Error):
# 整数の入力
N = int(input())

print((10 ** (N-2) * N * (N-1) / 2) % (10**9 + 7))

Buggy submission (verdict: Runtime Error):
# 整数の入力
N = int(input())
 
print( (10**(N-2) * N * (N-1) -7) / (10**9 + 7))

Buggy submission (verdict: Runtime Error):
import math

def combinations_count(N, r):
    return math.factorial(N) // (math.factorial(N - r) * math.factorial(r))

# 整数の入力
N = int(input())
r = 2
 
print((combinations_count(N, r) * (10**(N-r)))  / (10**9 + 7))

Buggy submission (verdict: Runtime Error):
import math
# 整数の入力
N = int(input())
r = 2
def combinations_count(N, r):
    return math.factorial(N) // (math.factorial(N - r) * math.factorial(r))
 
print(math.ceil(10**(N-2) * combinations_count(N, r) / (10**9 + 7)))

Buggy submission (verdict: Runtime Error):
# 整数の入力
N = int(input())
r = 2
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

print(10**(N-2) * combinations_count(n, r) / (10**9 + 7))
Problem p03455 (python)

Fixed submission:
# スペース区切りの整数の入力
b, c = map(int, input().split())
 
if b * c % 2 == 0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
# スペース区切りの整数の入力
b, c = map(int, input().split())

if B * C % 2 == 0:
  print("Even")
else:
  print("Odd")
Problem p02574 (python)

Fixed submission:
import math
from functools import reduce

N = int(input())
A = list(map(int, input().split()))
MAX = 10**6 + 1

cut = [2 for _ in range(MAX)]
for i in range(3, MAX, 2):
    if cut[i] != 2:
        continue
    for j in range(i, MAX, i):
        cut[j] = i

if reduce(math.gcd, A) != 1:
    print('not coprime')
    exit()

already = set()
for a in A:
    now = set()
    while a != 1:
        if cut[a] in already:
            print('setwise coprime')
            exit()
        now.add(cut[a])
        a //= cut[a]
    already |= now

print('pairwise coprime')

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

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

cut = [0 for _ in range(MAX+1)]
for i in range(2, MAX+1, 2):
    if cut[i] != 0:
        continue
    for j in range(i, MAX+1, i):
        cut[j] = i

if reduce(math.gcd, A) != 1:
    print('not coprime')
    exit()

already = set()
for a in A:
    now = set()
    while a != 1:
        if cut[a] in already:
            print('setwise coprime')
            exit()
        a //= cut[a]
        now.add(cut[a])
    already |= now

print('pairwise coprime')