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

Fixed submission:
n = int(input())
t = list(map(int, input().split()))
to = t[0]
if 0 in t:
  print(0)
  exit()
for a in t[1:]:
    to *= a
    if to > (10**18):
        print("-1")
        exit()
print(to)

Buggy submission (verdict: Runtime Error):
n = int(input())
t = list(map(int, input().split()))
to = t[0]
if 0 in t:
  print(0)
  exit()
for a in t[1:]:
	to *= a
    if to > 10**18:
	print("-1")
    exit()
else:
  print(to)
Problem p02582 (python)

Fixed submission:
W = input()
ans = 0
count = 0
for i in range(len(W)):
  if W[i] == "R":
    count += 1
    ans = max(ans,count)
  else:
    count = 0
print(ans)

Buggy submission (verdict: Runtime Error):
W = input()
ans = 0
count = 0
for i in range(len(W)):
  if W[i] == R:
    count += 1
    ans = max(ans,count)
  else:
    count = 0
print(ans)
Problem p02584 (python)

Fixed submission:
X,K,D = map(int,input().split())
X = abs(X)
X_div_D = X//D

ans_min = X % D

if K <= X_div_D:
  print(X - K * D)
else:
  if (K % 2) ^ (X_div_D % 2) == 0:
    print(ans_min)
  else:
    print(abs(ans_min - D))

Buggy submission (verdict: Runtime Error):
X,K,D = map(int,input().split())
X = abs(X)
X_div_D = X//D

p_min = X % D
n_min = abs(p_min - D)

if p_min <= n_min:
  ans_min = p_min
  min_idx = X_div_D
else:
  ans = min = n_min
  min_idx = X_div_D + 1
  
if K <= min_idx:
  print(X - K * D)
else:
  if (K - min_idx) % 2 == 0:
    print(ans_min)
  else:
    print(abs(ans_min - D))

Buggy submission (verdict: Runtime Error):
X,K,D = map(int,input().split())
X = abs(X)
X_div_D = X//D

p_min = X % D
n_min = abs(p_min - D)

if p_min <= n_min:
  ans_min = p_min
  min_idx = X_div_D
  sign_min = 1
else:
  ans = min = n_min
  min_idx = X_div_D + 1
  sign_min = -1
  
if K < min_idx:
  print(X - K * D)
else:
  if (K - min_idx) % 2 == 0:
    print(ans_min)
  else:
    print(abs(ans_min - sign_min * D))

Buggy submission (verdict: Runtime Error):
X,K,D = map(int,input().split())
X_div_D = X//D

p_min = X % D
n_min = abs(p_min - D)

if p_min <= n_min:
  ans_min = p_min
  min_idx = X_div_D
  sign_min = 1
else:
  ans = min = n_min
  min_idx = X_div_D + 1
  sign_min = -1
  
if K < min_idx:
  print(X - K * D)
else:
  if (K - min_idx) % 2 == 0:
    print(ans_min)
  else:
    print(abs(ans_min - sign_min * D))
Problem p02607 (python)

Fixed submission:
def resolve():
    N = (int(input()) + 1) // 2 * 2 
    A = list(map(int,input().split()))
    ans = 0

    for i in range(0,N,2):
        if A[i] % 2 == 1:
            ans += 1
    print(ans)
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    N = int(input()) // 2 * 2 
    A = list(map(int,input().split()))
    ans = 0

    for i in range(0,N+2,2):
        if A[i] % 2 == 1:
            ans += 1
    print(ans)
resolve()
Problem p02621 (python)

Fixed submission:
a = int(input())
ans = a + a*a + a*a*a
print(ans)

Buggy submission (verdict: Runtime Error):
a = int(input)
ans = a + a*a + a*a*a
print(ans)
Problem p02639 (python)

Fixed submission:
X = list(map(int,input().split()))
for i in range(5):
  if X[i] == 0:
    print(i+1)
    break

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

Fixed submission:
def find_num(lst, value):
    return [i for i, x in enumerate(lst) if x == value]

def resolve():
    X,N = map(int,input().split())
    if N == 0:
        print(X)
    else:
        p = list(map(int,input().split()))
        p.sort()
        idx = find_num(p,X)
        if idx == []:
            print(X)
        else:
            for i in range(1,100):
                if p[idx[0] - i ] != X - i or idx[0] - i == -1:
                    print(X-i)
                    break
                if idx[0] + i == N:
                    print(X+i)
                    break
                elif p[idx[0] + i ] != X + i:
                    print(X+i)
                    break
resolve()

Buggy submission (verdict: Runtime Error):
def find_num(lst, value):
    return [i for i, x in enumerate(lst) if x == value]

def resolve():
    X,N = map(int,input().split())
    if N == 0:
        print(X)
    else:
        p = list(map(int,input().split()))
        p.sort()
        idx = find_num(p,X)
        if idx == []:
            print(X)
        else:
            for i in range(1,100):
                if p[idx[0] - i ] != X - i or idx[0] - i == -1:
                    print(X-i)
                    break
                if p[idx[0] + i ] != X + i or idx[0] + i == N:
                    print(X+i)
                    break
resolve()
Problem p02642 (python)

Fixed submission:
#写経
#https://atcoder.jp/contests/abc170/submissions/14363499
import sys

def resolve():
    it = map(int,sys.stdin.read().split())
    N = next(it)
    A = [next(it) for i in range(N)]
    
    if N == 1:
        print(1)
        return
    ax = max(A) + 1
    dp = [0] * ax
    for ai in A:
        da = dp[ai]
        if da > 1:
            continue
        dp[ai] += 1
        if da == 0:
            for aj in range(2*ai, ax, ai):
                dp[aj] = 2
    ans = 0
    for ai in A:
        if dp[ai] == 1:
            ans += 1
    print(ans)
resolve()

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

def resolve():
    input = sys.stdin.readline
    sys.setrecursionlimit(10**9)
    N = int(input())
    A = list(map(int,input().split()))
    ans = np.ones(N,dtype=int)
    for i in range(N-1):
        for j in range(i+1,N):
            if A[i] % A[j] == 0:
                ans[i] = 0
                break
    for i in range(N-1):
        for j in range(i+1,N):
            if A[N-1 - i] % A[N-1 -j] == 0:
                ans[N-1 - i] = 0
                break
    print(sum(ans))
resolve()
Problem p02678 (python)

Fixed submission:
#写経
#https://atcoder.jp/contests/abc168/submissions/13358850
from collections import deque

def resolve():
    N,M, *AB = map(int, open(0).read().split())
    graph = [[] for _ in range(N+1)]
    for a,b in zip(*[iter(AB)] * 2):
        graph[a].append(b)
        graph[b].append(a)

    queue = deque([1])
    signposts = [0] * (N+1)
    signposts[1] = 1
    while queue:
        u = queue.popleft()
        for v in graph[u]:
            if not signposts[v]:
                signposts[v] = u
                queue.append(v)

    if all(signposts[2:]):
        print("Yes")
        print("\n".join(map(str,signposts[2:])))
    else:
        print("No")
resolve()

Buggy submission (verdict: Runtime Error):
#写経
#https://atcoder.jp/contests/abc168/submissions/13358850
from collections import deque

def resolve():
    N,M, *AB = map(int, open(0).read().split())
    graph = [[] for _ in range(N+1)]
    for a,b in zip(*[iter(AB)] * 2):
        graph[a].append(b)
        graph[b].append(a)
        print(graph)

    queue = deque([1])
    signposts = [0] * (N+1)
    signposts[1] = 1
    while queue:
        u = queue.popleft()
        for v in graph[u]:
            if not signposts[v]:
                signposts[v] = u
                queue.append(v)

    if all(signposts[2:]):
        print("Yes")
        print("\n".join(map(str,signposts[2:])))
    else:
        print("No")
resolve()
Problem p02690 (python)

Fixed submission:
def calc(X):
    A = 1
    B = 1
    if X == 0:
        return A,B
    else:
        l_bound = 1
        h_bound = 200
        for i in range(l_bound,h_bound):
            for j in range(0,i+1):
                if i ** 5 - j ** 5 == X:
                    A = i
                    B = j
                    return A,B
                if i ** 5 + j ** 5 == X:
                    A = i
                    B = -j
                    return A,B
def resolve():
    X = int(input())
    A,B = calc(X)  
    print(str(A) + " " + str(B))
resolve()

Buggy submission (verdict: Runtime Error):
def calc(X):
    A = 1
    B = 1
    if X == 0:
        return A,B
    else:
        l_bound = int(X**0.2)
        h_bound = l_bound * 2
        for i in range(l_bound,h_bound):
            for j in range(0,i+1):
                if i ** 5 - j ** 5 == X:
                    A = i
                    B = j
                    return A,B
                if i ** 5 + j ** 5 == X:
                    A = i
                    B = -j
                    return A,B
def resolve():
    X = int(input())
    A,B = calc(X)  
    print(str(A) + " " + str(B))
resolve()

Buggy submission (verdict: Runtime Error):
def calc():
    X = int(input())
    A = 1
    B = 1
    if X == 0:
        return A,B
    if X == 2:
        B = -1
        return A,B
    else:
        l_bound = int(X**0.2)
        h_bound = l_bound * 2
        for i in range(l_bound,h_bound):
            for j in range(0,i):
                if i ** 5 - j ** 5 == X:
                    A = i
                    B = j
                    return A,B
                if i ** 5 + j ** 5 == X:
                    A = i
                    B = -j
                    return A,B 
def resolve():
    A,B = calc()  
    print(str(A) + " " + str(B))
resolve()

Buggy submission (verdict: Runtime Error):
def calc():
    X = int(input())
    A = 1
    B = 1
    if X == 0:
        return A,B
    else:
        l_bound = int(X**0.2)
        h_bound = l_bound * 2
        for i in range(l_bound,h_bound):
            for j in range(0,i):
                if i ** 5 - j ** 5 == X:
                    A = i
                    B = j
                    return A,B
                if i ** 5 + j ** 5 == X:
                    A = i
                    B = -j
                    return A,B 
def resolve():
    A,B = calc()  
    print(str(A) + " " + str(B))
resolve()

Buggy submission (verdict: Runtime Error):
def calc():
    X = int(input())
    A = 1
    B = 1
    if X == 0:
        return A,B
    else:
        l_bound = int(X**0.2)
        h_bound = l_bound * 2
        for i in range(l_bound,h_bound):
            for j in range(0,i):
                if i ** 5 - j ** 5 == X:
                    A = i
                    B = j
                    return A,B
                if i ** 5 + j ** 5 == X:
                    A = i
                    B = -j
                    return A,B 

def resolve():
    A,B = calc()  
    print(str(A) + " " + str(B))
resolve()
Problem p02697 (python)

Fixed submission:
def resolve():
    N,M = map(int,input().split())
    if N % 2 == 1:
        for i in range(M):
            print(str(i+1) + " " + str(N-i))
    else:
        for i in range((M-1) // 2 + 1):
            print(str(i+1) + " " + str(N-i))
        for i in range((M-1) // 2 + 1 , M):
            print(str(i+1) + " " + str(N-i-1))
resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    N,M = map(int,input().split())
    for i in range(M):
        print(str(N//2 - i) + " " + str(N//2+1 + i))
resolve():
Problem p02706 (python)

Fixed submission:
def resolve():
    N,M =  map(int,input().split())
    A = list(map(int,input().split()))
    ans = N
    for i in range(M):
        ans = ans - A[i]
    if ans < 0:
        print(-1)
    else:
        print(ans)
resolve()

Buggy submission (verdict: Runtime Error):
N,M =  map(int,input().split())
A = list(map(int,input().split()))
ans = N
for i in range(M):
  ans = ans - A[i]
if ans < 0:
  print(-1)
else
	print(ans)
Problem p02640 (python)

Fixed submission:
a = list(map(int,input().split()))
if (a[0] * 4) >= a[1] and (a[0] * 2) <= a[1] and a[1] % 2 == 0:
    print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
if (a[0] * 4) >= a[1] and (a[0] * 2) <= a[1] and A[1] % 2 == 0:
    print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
if (a[0] * 4) <= a[1]:
  if (a[0] * 2) >= a[1]:
    print("Yes")
  else:
    print("No")
else:
print("No")
Problem p02705 (python)

Fixed submission:
n = float(input())
R = 2*3.1415926535*n
print(R)

Buggy submission (verdict: Runtime Error):
n = input
R = 2*3.1415926535*n
print(R)

Buggy submission (verdict: Runtime Error):
n = input 
R = n * 2 * 3.1415926535
Problem p03694 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
print(max(A)-min(A))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
print(max(N)-min(N))
Problem p03061 (python)

Fixed submission:
# coding: utf-8
# Your code here!

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

def gcd(x, y):
    if x == 0:
        return y
    if y == 0:
        return x
        
    if y > x:
        temp = y
        y = x
        x = temp
    amari = x % y
    if amari == 0:
        return y
    else:
        return gcd(y, amari)
        
L = list(range(N))
L[0] = 0
for i in range(N-1):
    L[i+1] = gcd(L[i], A[i])
    
R = list(range(N))
R.append(0)
for i in reversed(range(N)):
    R[i] = gcd(R[i+1], A[i])

M = [gcd(L[i], R[i+1]) for i in range(N)] # i=1,...,N

print(max(M))

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

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

def gcd(x, y):
    if x == 0:
        return y
    if y == 0:
        return x
        
    if y > x:
        temp = y
        y = x
        x = temp
    amari = x % y
    if amari == 0:
        return y
    else:
        return gcd(y, amari)
        
def L(i):
    if i == 0:
        return 0
    else:
        return gcd(L(i-1), A[i-2])
        
def R(i):
    if i == N+1:
        return 0
    else:
        return gcd(R(i+1), A[i-1])
        
M = [gcd(L(i), R(i+1)) for i in range(1, N+1)] # i=1,...,N

print(max(M))
Problem p03076 (python)

Fixed submission:
# coding: utf-8
# Your code here!

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

cooking_time = [a,b,c,d,e]

l = [x%10 for x in cooking_time]
if sum(l)==0:
    mindiv10=0
else:
    mindiv10 = min(list(filter(lambda n:n>0, l)))

# search
last_food = 0
for x in cooking_time:
    if x%10 == mindiv10:
        last_food = x
        
cooking_time.remove(last_food)

time = 0
for x in cooking_time:
    time += x + (0 if x%10==0 else 10-x%10)

time += last_food

print(time)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

cooking_time = [a,b,c,d,e]

mindiv10 = min(list(filter(lambda n:n>0, [x%10 for x in cooking_time])))

# search
last_food = 0
for x in cooking_time:
    if x%10 == mindiv10:
        last_food = x
        
cooking_time.remove(last_food)

time = 0
for x in cooking_time:
    time += x + (0 if x%10==0 else 10-x%10)

time += last_food

print(time)
Problem p03076 (python)

Fixed submission:
import math
a=[input() for i in range(5)]
b,c=10,0
for i in range(5):
    if 0<int(a[i][-1])<b:
        b=int(a[i][-1])
        d=i
for i in range(5):
    if b!=10:
        if i==d:
            c+=int(a[i])
        else:
            if int(a[i][-1])==0:
                c+=int(a[i])
            elif int(a[i])<=10:
                c+=10
            else:
                c+=(int(a[i][0:-1])+1)*10
    else:
        c+=int(a[i])
print(c)

Buggy submission (verdict: Runtime Error):
import math
a=[input() for i in range(5)]
b,c=10,0
for i in range(5):
    if 0<int(a[i][-1])<b:
        b=int(a[i][-1])
        d=i
for i in range(5):
    if i==d:
        c+=int(a[i])
    else:
        if int(a[i][-1])==0:
            c+=int(a[i])
        elif int(a[i])<=10:
            c+=10
        else:
            c+=(int(a[i][0:-1])+1)*10
print(c)
Problem p03262 (python)

Fixed submission:
import fractions
def gcdlist(a):
    ans = a[0]
    for i in range(1, len(a)):
        ans = fractions.gcd(ans, a[i])
    return ans

n,y=map(int,input().split())
x=list(map(int,input().split()))
x.append(y)
if y==1:
    print(abs(x[0]-1))
    exit()

l=[]
for i in range(n):
    l.append(abs(x[i+1]-x[i]))
print(gcdlist(l))

Buggy submission (verdict: Runtime Error):
import fractions
def gcdlist(a):
    ans = a[0]
    for i in range(1, len(a)):
        ans = fractions.gcd(ans, a[i])
    return ans

n,y=map(int,input().split())
x=list(map(int,input().split()))
l=[]
if y==1:
    print(abs(x[0]-1))
    exit()

for i in range(n-1):
    l.append(abs(x[i+1]-x[i]))
print(gcdlist(l))
Problem p03361 (python)

Fixed submission:
h,w=map(int,input().split())
g=[list(input()) for _ in range(h)]
for x in range(h):
    for y in range(w):
        if g[x][y]=="#":
            k=0
            for i,j in [(1,0),(-1,0),(0,1),(0,-1)]:
                nx=x+i
                ny=y+j
                if nx<0 or nx>=h or ny<0 or ny>=w:
                   continue
                if g[nx][ny]==".":
                    k+=1
            if k==4:
                print("No")
                exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
g=[list(input()) for _ in range(h)]
for x in range(h):
    for y in range(w):
        if g[y][x]=="#":
            k=0
            for i,j in [(1,0),(-1,0),(0,1),(0,-1)]:
                nx=x+i
                ny=y+j
                if nx<0 or nx>=h or ny<0 or ny>=w:
                   continue
                if g[ny][nx]==".":
                    k+=1
            if k==4:
                print("No")
                exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10**10)
h,w=map(int,input().split())
g=[list(input()) for _ in range(h)]
for x in range(h):
    for y in range(w):
        if g[y][x]=="#":
            k=0
            for i,j in [(1,0),(-1,0),(0,1),(0,-1)]:
                nx=x+i
                ny=y+j
                if nx<0 or nx>=h or ny<0 or ny>=w:
                   continue
                if g[ny][nx]==".":
                    k+=1
            if k==4:
                print("No")
                exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
import sys

sys.setrecursionlimit(10**8)
h,w=map(int,input().split())
g=[list(input()) for _ in range(h)]
for x in range(h):
    for y in range(w):
        if g[y][x]=="#":
            k=0
            for i,j in [(1,0),(-1,0),(0,1),(0,-1)]:
                nx=x+i
                ny=y+j
                if nx<0 or nx>=h or ny<0 or ny>=w:
                   continue
                if g[ny][nx]==".":
                    k+=1
            if k==4:
                print("No")
                exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
g=[list(input()) for _ in range(h)]
for x in range(h):
    for y in range(w):
        if g[y][x]=="#":
            k=0
            for i,j in [(1,0),(-1,0),(0,1),(0,-1)]:
                nx=x+i
                ny=y+j
                if nx<0 or nx>=h or ny<0 or ny>=w:
                   continue
                if g[ny][nx]==".":
                    k+=1
            if k==4:
                print("No")
                exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
g=[list(input()) for _ in range(h)]
for x in range(h):
    for y in range(w):
        if g[y][x]=="#":
            k=0
            for i,j in [(1,0),(-1,0),(0,1),(0,-1)]:
                nx=x+i
                ny=y+j
                if nx<0 or nx>=h or ny<0 or ny>=w:#範囲外ならスルー
                    continue
                if g[ny][nx]==".":
                    k+=1
            if k==4:
                print("No")
                exit()
print("Yes")
Problem p02618 (python)

Fixed submission:
import random
import numpy as np


D=int(input())
C=np.array(list(map(int,input().split())))
S=[]
for _ in range(D):
    S.append(list(map(int,input().split())))


T=[]
for i in range(D):
    print(np.argmax(S[i])+1)

Buggy submission (verdict: Runtime Error):
import random
D=int(input())
C=np.array(list(map(int,input().split())))
S=[]
for _ in range(D):
    S.append(list(map(int,input().split())))



for i in range(D):
    print(random.randint(1,26))
Problem p02760 (python)

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

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

bingo=np.zeros((3,3),int)
for i in range(3):
    for j in range(3):
        if A[i][j] in B:
            bingo[i][j]=1

flag=False
for x in bingo.sum(axis=1):
    if x ==3:
        flag=True
for x in bingo.sum(axis=0):
    if x ==3:
        flag=True
y=0
for i in range(3):
    y+=bingo[i,i]
if y==3:
    flag=True
y=0
for i in range(3):
    y+=bingo[2-i,i]
if y==3:
    flag=True

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

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

import numpy as np
A=np.array(A)
mask=np.isin(A,B)

bingo=np.zeros((3,3),int)
bingo[mask]=1

flag=False
for x in bingo.sum(axis=1):
    if x ==3:
        flag=True
for x in bingo.sum(axis=0):
    if x ==3:
        flag=True
y=0
for i in range(3):
    y+=bingo[i,i]
if y==3:
    flag=True
y=0
for i in range(3):
    y+=bingo[2-i,i]
if y==3:
    flag=True

if flag:
    print("Yes")
else:
    print("No")
Problem p02761 (python)

Fixed submission:
N,M=map(int,input().split())
ans=[0]*N
SC=[0]*N
flag=0
flag2=0
for i in range(M):
    s,c=map(int,input().split())
    if s-1==0:
        flag2=1
    if SC[s-1]==1:
        if ans[s-1]!=c:
            flag=1
    else:
        SC[s-1]=1
        ans[s-1]=c

if flag2==0 and N!=1:
    ans[0]=1

if ans[0]==0 and N!=1:
    flag=1

if flag==0:
    ans2=""
    for a in ans:
        ans2+=str(a)
    print(ans2)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):

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

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


keta=np.unique(SC[:,0])
flag=0
for i in keta:
    if len(np.unique(SC[SC[:,0]==i],axis=0))>=2:
        flag=1
for x in SC[SC[:,0]==1]:
    if x[1]==0:
        flag=1

ans=[0]*N
ans[0]=1
if flag!=1:
    for i in keta:
        ans[i-1]=np.unique(SC[SC[:,0]==i],axis=0)[0][1]
    ans2=""
    for a in ans:
        ans2+=str(a)
    print(ans2)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):

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

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


keta=np.unique(SC[:,0])
flag=0
for i in keta:
    if len(np.unique(SC[SC[:,0]==i]))>=3:
        flag=1
for x in SC[SC[:,0]==1]:
    if x[1]==0:
        flag=1

ans=[0]*N
ans[0]=1
if flag!=1:
    for i in keta:
        ans[i-1]=np.unique(SC[SC[:,0]==i])[1]
    ans2=""
    for a in ans:
        ans2+=str(a)
    print(ans2)
else:
    print(-1)
Problem p02768 (python)

Fixed submission:
mod=10 ** 9 + 7

n, a, b = map(int, input().split())

def power(x,n):
    if n==0:
        return 1
    elif n%2==0:
        half=power(x,n//2)
        return half**2 %mod
    else:
        half=power(x,(n-1)//2)
        return  half**2 * x %mod

def binomial(n,k):
    x=1
    y=1
    for i in range(k):
        x=x*(n-i)%mod
        y=y*(i+1)%mod
    return x*power(y,mod-2)%mod

ans=(power(2,n)-1 - binomial(n,a) -binomial(n,b))%mod

print(ans)

Buggy submission (verdict: Runtime Error):
mod=10 ** 9 + 7

n, a, b = map(int, input().split())

def power(x,n):
    if n==0:
        return 1
    elif n%2==0:
        half=power2(x,n//2)
        return half**2 %mod
    else:
        half=power2(x,(n-1)//2)
        return  half**2 * x %mod

def binomial(n,k):
    x=1
    y=1
    for i in range(k):
        x=x*(n-i)%mod
        y=y*(i+1)%mod
    return x*pow(y,mod-2,mod)%mod

ans=(power(2,n) - binomial(n,a) -binomial(n,b))%mod

print(ans)
Problem p02780 (python)

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

def s(x):
    return (1+x)/2


wa=sum(P[0:K])
temp=sum(P[0:K])
for i in range(N-K):
    wa+=P[i+K]
    wa-=P[i]
    if temp <= wa:
        temp=wa

ans=s(temp+K-1)
print(ans)

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

def s(x):
    return (1+x)/2


wa=sum(P[0:K])
for i in range(N-K):
    wa+=P[i+K]
    wa-=P[i]
    if temp <= wa:
        temp=wa

ans=s(temp+K-1)
print(ans)