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

Fixed submission:
def main():
    import sys
    from fractions import gcd
    input=sys.stdin.readline
    n=int(input())
    a=tuple(map(int,input().split()))
    ide_ele=0
    num=2**(n-1).bit_length()
    seg=[ide_ele]*2*num
    def init(init_val):
        for i in range(n):
            seg[i+num-1]=init_val[i]
        for i in range(num-2,-1,-1):
            seg[i]=gcd(seg[2*i+1],seg[2*i+2])
    
    def update(k,x):
        k+=num-1
        seg[k]=x
        while k:
            k=(k-1)//2
            seg[k]=gcd(seg[k*2+1],seg[k*2+2])
    
    def query(p,q):
        if q<=p:
            return ide_ele
        p+=num-1
        q+=num-2
        res=ide_ele
        while q-p>1:
            if p&1==0:
                res=gcd(res,seg[p])
            if q&1==1:
                res=gcd(res,seg[q])
                q-=1
            p=p//2
            q=(q-1)//2
        if p==q:
            res=gcd(res,seg[p])
        else:
            res=gcd(gcd(res,seg[p]),seg[q])       
        return res

    init(a)
    ans=-1
    for i in range(n):
        ans=max(ans,gcd(query(0,i),query(i+1,n)))
    print(ans)
main()

Buggy submission (verdict: Runtime Error):
t=list(map(int,input().split()))
s=list(map(int,input().split()))
def gcd(x,y):
  if y==0:
    return(x)
  else:
    return gcd(y,x%y)
  
a=gcd(s[0],s[1])
b=gcd(s[0],s[2])
c=gcd(s[1],s[2])
if a<b:
  if b<c:
    print(c)
  else:
    print(b)
else:
  if a<c:
    print(c)
  else:
    print(a)
Problem p03067 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a<=c<=b or b<=c<=a:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, raw_input().split())
if A<B:
if B<C:
print("No")
else:
print("Yes")

else:
if A<C:
print("No")
else:
print("Yes")
Problem p03240 (python)

Fixed submission:
N=int(input())
x=[list(map(int,input().split())) for _ in range(N)]
x.sort(key=lambda x:-x[2])
dp=[[0]*101 for i in range(101)]
bp=[[0]*101 for i in range(101)]
for j in range(101):
  for k in range(101):
    a,b,c=x[0]
    r=0
    asa=abs(a-j)+abs(b-k)+c
    for i in range(N):
      count=abs(x[i][0]-j)+abs(x[i][1]-k)
      if x[i][2]==max(asa-count,0):
        r+=1
    if r==N:
      print(j,k,asa)
      exit()

Buggy submission (verdict: Runtime Error):
N=int(input())
x=[list(map(int,input().split())) for _ in range(N)]
Cx=0
Cy=0
H=0
dp=[[0]*101 for i in range(101)]
ans=10**10
for i in range(N):
  for j in range(101):
    for k in range(101):
      count=abs(x[i][0]-j)+abs(x[i][1]-k)+x[i][2]
      if dp[j][k]!=i*count:
        dp[j][k]=0
      else:
        dp[j][k]+=count
      ans=min(ans,x[i][2])
p=10**19
a=0
b=0
for i in range(101):
  for j in range(101):
    if dp[i][j]%N==0 dp[i][j]!=0:
      if p!=min(p,dp[i][j]//N):
        a=i
        b=j
        p=min(p,dp[i][j]//N)
print(a,b,p)
Problem p03353 (python)

Fixed submission:
s=input()
s=s+'0'
K=int(input())
p=set()
for i in range(len(s)):
  for j in range(1,6):
    if i+j<=len(s)-1:
      p.add(s[i:j+i])
p=sorted(p)
print(p[K-1])

Buggy submission (verdict: Runtime Error):
s=input()
K=int(input())
p=set()
for i in range(len(s)):
  for j in range(1,6):
    if i+j<=len(s)-1:
      p.add(s[i:j+i])
p=sorted(p)
print(p[K-1])

Buggy submission (verdict: Runtime Error):
s=input()
K=int(input())
p=set()
for i in range(len(s)):
  for j in range(1,6):
    if i+j<=len(s):
      p.add(s[i:j+1])
p=sorted(p)
print(p[K-1])
Problem p03360 (python)

Fixed submission:
A=list(map(int,input().split()))
K=int(input())
A.sort(reverse=True)
ans=sum(A)
for i in range(K):
  ans+=A[0]
  A[0]*=2
print(ans)

Buggy submission (verdict: Runtime Error):
A=list(map(int,input().split()))
K=int(input())
A.sort(reverse=True)
ans=sum(A)
for i in range(K):
  ans+=A[i]
print(ans)
Problem p03457 (python)

Fixed submission:
N=int(input())
flag='Yes'
p,q,r=0,0,0
for _ in range(N):
  t,x,y=map(int,input().split())
  a=abs(x-p)+abs(y-q)
  e=t-r
  if a<=e:
    if (e-a)%2!=0:
      flag='No'
      break
  else:
    flag='No'
    break
  p,q,r=x,y,t
print(flag)

Buggy submission (verdict: Runtime Error):
N=int(input())
flag='Yes'
p,q,r=0,0,0
for _ in range(N):
  t,x,y=map(int,input().split())
  a=x+y-p-q
  e=t-r
  if a<=e:
    if (e-a)%2!=0:
      flag='No'
      break
  else:
    flag='No'
    break
  p=x
  q=y
  r=t
print(flag)N=int(input())
flag='Yes'
p,q,r=0,0,0
for _ in range(N):
  t,x,y=map(int,input().split())
  a=x+y-p-q
  e=t-r
  if a<=e:
    if (e-a)%2!=0:
      flag='No'
      break
  else:
    flag='No'
    break
  p=x
  q=y
  r=t
print(flag)
Problem p03474 (python)

Fixed submission:
A,B=map(int,input().split())
S=input()
a='Yes'
for i in range(A+B+1):
  if i==A:
    if S[i]!='-':
      a='No'
  else:
    if S[i]=='-':
      a='No'
print(a)

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
S=input()
a='Yes'
for i in range(A+B+2):
  if i!=A:
    if S[i]!='-':
      a='No'
  else:
    if S[i]=='-':
      a='No'
print(a)
Problem p03547 (python)

Fixed submission:
X,Y=map(str,input().split())
if X<Y:
  print('<')
elif X>Y:
  print('>')
else:
  print('=')

Buggy submission (verdict: Runtime Error):
X,Y=map(int,input().split())
if X<Y:
  print('<')
elif X>Y:
  print('>')
else:
  print('=')
Problem p03611 (python)

Fixed submission:
N=int(input())
a=list(map(int,input().split()))
dp=[0]*(10**5+3)
for i in range(N):
  for j in range(3):
    dp[a[i]+j]+=1
print(max(dp))

Buggy submission (verdict: Runtime Error):
N=int(input())
a=list(map(int,input().split()))
dp=[0]*(10**5+1)
for i in range(N):
  for j in range(3):
    dp[a[i]+j]+=1
print(max(dp))
Problem p03623 (python)

Fixed submission:
x,a,b=map(int,input().split())
if abs(a-x)>abs(b-x):
  print('B')
else:
  print('A')

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
if abs(a-x)>abs(b-x):
  print(B)
else:
  print(A)
Problem p03658 (python)

Fixed submission:
N,K=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
print(sum(l[:K]))

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
l=list(map(int,input().split()))
l.sort(reverse=True)
print(sum[:K])
Problem p03671 (python)

Fixed submission:
a=list(map(int,input().split()))
a.sort()
print(a[0]+a[1])

Buggy submission (verdict: Runtime Error):
a=list(map(int,input().split()))
a.sort()
print(a[0]+[1])
Problem p03729 (python)

Fixed submission:
A,B,C=map(str,input().split())
if A[-1]==B[0] and B[-1]==C[0]:
  print('YES')
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
A,B,C=map(int,input().split())
if A[-1]==B[0] and B[-1]==C[0]:
  print('YES')
else:
  print('NO')
Problem p03860 (python)

Fixed submission:
a,b,c=map(str,input().split())
print(a[0]+b[0]+c[0])

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print(a[0]+b[0]+c[0])
Problem p02573 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

class UnionFind:
    def __init__(self, n):
        self.parent = [i for i in range(n)]
        self.num = [1 for i in range(n)]

    def root(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.root(self.parent[x])
            return self.parent[x]

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x != y:
            self.parent[x] = y
            self.num[y] += self.num[x]

    def same(self, x, y):
        return self.root(x) == self.root(y)

    def count(self, x):
        return self.num[self.root(x)]

N, M = map(int, input().split())
un = UnionFind(N)
for i in range(M):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    un.unite(a, b)
ans = 0
for i in range(N):
    ans = max(ans, un.count(i))
print(ans)

Buggy submission (verdict: Runtime Error):
class UnionFind:
    def __init__(self, n):
        self.parent = [i for i in range(n)]
        self.num = [1 for i in range(n)]

    def root(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.root(self.parent[x])
            return self.parent[x]

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x != y:
            self.parent[x] = y
            self.num[y] += self.num[x]

    def same(self, x, y):
        return self.root(x) == self.root(y)

    def count(self, x):
        return self.num[self.root(x)]

N, M = map(int, input().split())
un = UnionFind(N)
for i in range(M):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    un.unite(a, b)
ans = 0
for i in range(N):
    ans = max(ans, un.count(i))
print(ans)
Problem p02949 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
INF = 10**18

def dfs1(cur):
    for to in G1[cur]:
        if done1[to]: continue
        done1[to] = True
        dfs1(to)

def dfs2(cur):
    for to in G2[cur]:
        if done2[to]: continue
        done2[to] = True
        dfs2(to)

N, M, P = map(int, input().split())
G = []
G1 = [[] for i in range(N)]
G2 = [[] for i in range(N)]
for i in range(M):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    G.append((a, b, c-P))
    G1[a].append(b)
    G2[b].append(a)
D = [0]*N
for i in range(N):
    D[i] = -INF
D[0] = 0
for i in range(N):
    for j in range(M):
        fr, to, cost = G[j]
        if D[fr] != -INF and D[fr]+cost > D[to]:
            D[to] = D[fr]+cost
done1 = [False]*N
done1[0] = True
dfs1(0)
done2 = [False]*N
done2[N-1] = True
dfs2(N-1)
for _ in range(N):
    for j in range(M):
        fr, to, cost = G[j]
        if D[fr] != -INF and D[fr]+cost > D[to]:
            D[to] = D[fr]+cost
            if done1[to] and done2[to]:
                print(-1)
                exit()
if D[N-1] < 0:
    print(0)
else:
    print(D[N-1])

Buggy submission (verdict: Runtime Error):
INF = 10**18

def dfs1(cur):
    for to in G1[cur]:
        if done1[to]: continue
        done1[to] = True
        dfs1(to)

def dfs2(cur):
    for to in G2[cur]:
        if done2[to]: continue
        done2[to] = True
        dfs2(to)

N, M, P = map(int, input().split())
G = []
G1 = [[] for i in range(N)]
G2 = [[] for i in range(N)]
for i in range(M):
    a, b, c = map(int, input().split())
    a -= 1
    b -= 1
    G.append((a, b, c-P))
    G1[a].append(b)
    G2[b].append(a)
D = [0]*N
for i in range(N):
    D[i] = -INF
D[0] = 0
for i in range(N):
    for j in range(M):
        fr, to, cost = G[j]
        if D[fr] != -INF and D[fr]+cost > D[to]:
            D[to] = D[fr]+cost
done1 = [False]*N
done1[0] = True
dfs1(0)
done2 = [False]*N
done2[N-1] = True
dfs2(N-1)
for _ in range(N):
    for j in range(M):
        fr, to, cost = G[j]
        if D[fr] != -INF and D[fr]+cost > D[to]:
            D[to] = D[fr]+cost
            if done1[to] and done2[to]:
                print(-1)
                exit()
if D[N-1] < 0:
    print(0)
else:
    print(D[N-1])
Problem p03148 (python)

Fixed submission:
N, K = map(int, input().split())
nums = [[] for i in range(N)]
for i in range(N):
    t, d = map(int, input().split())
    t -= 1
    nums[t].append(d)
maxs = []
rest = []
for i in range(N):
    nums[i].sort(reverse=True)
    if len(nums[i]) > 0:
        maxs.append(nums[i][0])
        for n in nums[i][1:]:
            rest.append(n)
        #rest = rest + nums[i][1:]
maxs.sort(reverse=True)
if len(maxs) > K:
    maxs = maxs[:K]
    for n in maxs[K:]:
        rest.append(n)
    #rest = rest + maxs[K:]
rest.sort(reverse=True)
other = []
idx = 0
while len(maxs)+len(other) < K:
    other.append(rest[idx])
    idx += 1
rest = rest[idx:]

types = len(maxs)
#print(maxs)
#print(rest)
for i,r in enumerate(rest):
    diff = types*types - pow(types-1, 2)
    if diff < r-maxs[len(maxs)-1-i]:
        maxs[len(maxs)-1-i] = r
        types -= 1
    else:
        break
ans = types*types
for num in maxs:
    ans += num
for num in other:
    ans += num
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N, K = map(int, input().split())
nums = []
for i in range(N):
    t, d = map(int, input().split())
    nums.append((d, t))
nums.sort(reverse=True)
se = set()
kind = 0
a1 = []
a2 = []
rest = []
for i, n in nums:
    if i < K:
        if not n[1] in se:
            se.add(n[1])
            kind += 1
            a1.append(n)
        else:
            a2.append(n)
    else:
        rest.append(n)
points = 0
for (d, t) in a1: points += d
for (d, t) in a2: points += d
ans = points + pow(kind, 2)
a2.sort()
for i, (d, t) in enumerate(rest):
    if t in se: continue
    if i >= len(a2): break
    points -= a2[i]
    points += d
    kind += 1
    ans = max(ans, points+pow(kind, 2))
print(ans)
Problem p03231 (python)

Fixed submission:
from math import gcd
from collections import defaultdict

N, M = map(int, input().split())
S = input()
T = input()
g = N//gcd(N, M)*M
ans = defaultdict(bool)
for i in range(N):
    ans[i*g//N] = S[i]
ok = True
for i in range(M):
    idx = i*g//M
    if ans[idx] and ans[idx] != T[i]:
        ok = False
        break
if ok:
    print(g)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from math import gcd
N, M = map(int, input().split())
S = input()
T = input()
g = N//gcd(N, M)*M
ans = ['?']*g
for i in range(N):
    ans[i*g//N] = S[i]
ok = True
for i in range(M):
    idx = i*g//M
    if ans[idx] != '?' and ans[idx] != T[i]:
        ok = False
        break
if ok:
    print(g)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
from math import gcd
N, M = map(int, input().split())
S = input()
T = input()
g = N//gcd(N, M)*M
ans = ['?']*g
for i in range(N):
    ans[i*g//N] = S[i]
ok = True
for i in range(M):
    idx = i*g//M
    if ans[idx] != '?' and ans[idx] != T[i]:
        ok = False
        break
if ok:
    print(g)
else:
    print(-1)
Problem p03838 (python)

Fixed submission:
x, y = map(int, input().split())
if x >= 0 and y >= 0:
    if x <= y:
        ans = abs(x-y)
    elif y == 0:
        ans = abs(x-y)+1
    else:
        ans = abs(x-y)+2
elif x < 0 and y <= 0:
    if x <= y:
        ans = abs(x-y)
    else:
        ans = abs(x-y)+2
else:
    ans = abs(abs(x)-abs(y))+1
print(ans)

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
if x >= 0 and y >= 0:
    if x <= y:
        ans = abs(x-y)
    else:
        ans = abs(x-y)+2
elif x < 0 and y < 0:
    if x <= y:
        ans = abs(x-y)
    else:
        ans = abs(x-y)+2
elif x >= 0 and y <= 0:
    ans = abs(abs(x)-abs(y))+1
print(ans)
Problem p02741 (python)

Fixed submission:
K = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
a = int(input())
b = K[a-1]

print(b)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
if H==1 or W ==1:
    print(1)
else:print(-(-H*W//2))
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if 1<=a<=100 and 1<=b<=100:
  return a*b

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if 1<=a<=100 and 1<=b<=100:
  return a*b

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if 1<=a<=100 and 1<=b<=100:
  print(a*b)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if 1<=a<=100 and 1<=b<=100:
  print(a*b)

Buggy submission (verdict: Runtime Error):
for i,j in range(1,101):
  print(i*j)

Buggy submission (verdict: Runtime Error):
for i,j in [[1:100],[1:100]]:
  print(i*j)

Buggy submission (verdict: Runtime Error):
for i,j in [1:100,1:100]:
  print i*j

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
print(a*b)

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

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
print(a*b)
Problem p02621 (python)

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

Buggy submission (verdict: Runtime Error):
a = input()
b = a+a*a+a*a*a
print(int(b))

Buggy submission (verdict: Runtime Error):
a = input()
print(int(a+a*a+a*a*a))

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

Fixed submission:
n, a, b = map(int, input().split())
c = n * a
if c < b:
    print(c)
else:
    print(b)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())
c = N * A
if c < B:
    print(c)
else:
    print(B)
Problem p02993 (python)

Fixed submission:
s = str(input())
for i in range(3):
    if s[i] == s[i + 1]:
        print('Bad')
        exit()
print('Good')

Buggy submission (verdict: Runtime Error):
s = str(input())
for i in range(1, 5):
    if s[i - 1] == s[i]:
        print('Bad')
        exit()
print('Good')
Problem p02684 (python)

Fixed submission:
def read_int():
    return int(input())

def read_int_map():
    return map(int,input().split(' '))

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

def read_s_list_loop(n):
    return [input() for _ in range(n)]

N,K = read_int_map()
An = read_int_list()
memo = [0]*(N+1)
memo_indx = [0]*(N+1)
memo[1] = 1
memo_indx[1] = 0
seq_an = [1]
next_place = An[0]
for i in range(len(An)):
    if memo[next_place] == 0:
        seq_an.append(next_place)
        memo[next_place] = 1
        memo_indx[next_place] = i + 1
        next_place = An[next_place-1]
    else:
        break
loop_idx = memo_indx[next_place]
loop_list = seq_an[loop_idx:]
if K <= len(seq_an)-1:
    print(seq_an[K])
else:
    num = (K - len(seq_an)) % len(loop_list)
    print(loop_list[num])

Buggy submission (verdict: Runtime Error):
def read_int():
    return int(input())

def read_int_map():
    return map(int,input().split(' '))

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

def read_s_list_loop(n):
    return [input() for _ in range(n)]

N,K = read_int_map()
An = read_int_list()
memo = [0]*(N+1)
memo_indx = [0]*(N+1)
memo[1] = 1
memo_indx[1] = 0
seq_an = [1]
next_place = An[0]
for i in range(len(An)):
    if memo[next_place] == 0:
        seq_an.append(next_place)
        memo[next_place] = 1
        memo_indx[next_place] = i + 1
        next_place = An[next_place-1]
    else:
        break
loop_idx = memo_indx[next_place]
loop_list = seq_an[loop_idx:]
if K <= len(seq_an):
    print(seq_an[K])
else:
    num = (K - len(seq_an)) % len(loop_list)
    print(loop_list[num])
Problem p02838 (python)

Fixed submission:
import bisect
N = int(input())
An = list(map(int,input().split(' '))) 

bit_list = [1]
for i in range(100000):
    bit_list.append(bit_list[i]*2)
    if bit_list[i+1] > 2**60:
        break
start_point = bisect.bisect_right(bit_list,max(An))
keta_list = [0] *  start_point

for A in An:
    abin = format(A, 'b')
    for i in range(len(abin)):
        if abin[i] == '1':
            keta_list[len(abin)-1-i] += 1
count = 0
for idx,keta_count in enumerate(keta_list):
    count += (N-keta_count) * bit_list[idx] * keta_count
    count = count % (1000000000+7)
print(count)

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
An = list(map(int,input().split(' '))) 

bit_list = [1]
for i in range(100000):
    bit_list.append(bit_list[i]*2)
    if bit_list[i+1] > 10**12:
        break
start_point = bisect.bisect_right(bit_list,max(An))
keta_list = [0] * start_point

for A in An:
    abin = format(A, 'b')
    for i in range(len(abin)):
        if abin[i] == '1':
            keta_list[len(abin)-1-i] += 1
count = 0
for idx,keta_count in enumerate(keta_list):
    count += (N-keta_count) * bit_list[idx] * keta_count
    count = count % (1000000000+7)
print(count)

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
An = list(map(int,input().split(' '))) 

bit_list = [1]
for i in range(100000):
    bit_list.append(bit_list[i]*2)
    if bit_list[i+1] > 10**12:
        break
start_point = bisect.bisect_left(bit_list,max(An))
keta_list = [0] * start_point

for A in An:
    abin = format(A, 'b')
    for i in range(len(abin)):
        if abin[i] == '1':
            keta_list[len(abin)-1-i] += 1
count = 0
for idx,keta_count in enumerate(keta_list):
    count += (N-keta_count) * bit_list[idx] * keta_count % (1000000000+7)
print(count)

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
An = list(map(int,input().split(' '))) 

bit_list = [1]
for i in range(100000):
    bit_list.append(bit_list[i]*2)
    if bit_list[i+1] > 10**12:
        break
start_point = bisect.bisect_right(bit_list,An[-1])
keta_list = [0] * start_point

for A in An:
    abin = format(A, 'b')
    for i in range(len(abin)):
        if abin[i] == '1':
            keta_list[len(abin)-1-i] += 1
count = 0
for idx,keta_count in enumerate(keta_list):
    count += (start_point-keta_count) * bit_list[idx] % (1000000000+7)
print(count)
Problem p02856 (python)

Fixed submission:
M = int(input())
keta = 0
count_sum = 0
for _ in range(M):
    d,c= map(int,input().split(' '))
    keta += c
    count_sum += d*c
additional = count_sum//10
if 9 < count_sum:
    print(keta-1 + (count_sum-1)//9)
else:
    print(keta-1)

Buggy submission (verdict: Runtime Error):
keta = 0
count_sum = 0
for _ in range(M):
    d,c= map(int,input().split(' '))
    keta += c
    count_sum += d*c
additional = count_sum//10
if 9 < count_sum:
    print(keta-1 + (count_sum-1)//9)
else:
    print(keta-1)
'''
Problem p02983 (python)

Fixed submission:
LR = input().split(' ')
L = int(LR[0])
R = int(LR[1])

min_num = 2000000001
flag = False
for l in range(L,R):
    for r in range(l+1,R+1):
        mod = (l*r) %2019
        if mod < min_num:
            min_num = mod
            if mod == 0:
                flag =True
                break
    if flag:
        break

print(min_num)

Buggy submission (verdict: Runtime Error):
import itertools
LR = input().split(' ')
L = int(LR[0])
R = int(LR[1])

min_num = 2000000001
store = [0,0]
num_list = range(L,R+1)
combination_list = list(itertools.combinations(num_list,2))

for comb in combination_list:
    mod = (comb[0]% 2019) * (comb[1]% 2019 ) 
    if mod < min_num:
        min_num = mod
        if mod == 0:
            break

print(min_num)

Buggy submission (verdict: Runtime Error):
import itertools
LR = input().split(' ')
L = int(LR[0])
R = int(LR[1])

min_num = 2000000001
store = [0,0]
num_list = range(L,R+1)
combination_list = list(itertools.combinations(num_list,2))

for comb in combination_list:
    mod = (comb[0] * comb[1] ) % 2019
    if mod < min_num:
        min_num = mod
        if mod == 0:
            break

print(min_num)

Buggy submission (verdict: Runtime Error):
import itertools
LR = input().split(' ')
L = int(LR[0])
R = int(LR[1])

min_num = 2000000001
store = [0,0]
num_list = range(L,R+1)
combination_list = list(itertools.combinations(num_list,2))

for comb in combination_list:
    mod = (comb[0] * comb[1] ) % 2019
    if mod < min_num:
        min_num = mod
        store[0] = comb[0]
        store[1] = comb[1]

print(' '.join(map(str,store)))
Problem p02988 (python)

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

count_pn = 0
for i in range(1,N-1):
    if ( Pn[i-1] < Pn[i] < Pn[i+1] ) or ( Pn[i+1] < Pn[i] < Pn[i-1] ):
        count_pn += 1
print(count_pn)

Buggy submission (verdict: Runtime Error):
N = int(input())
Pn = list(input().split(' '))

count_pn = 0
for i in range(1,N-1):
    if ( Pn[i-1] <= Pn[i] and Pn[i] < Pn[i+1] ) or ( Pn[i+1] <= Pn[i] and Pn[i] < Pn[i-1] ):
        count_pn += 1
print(count_pn)


S = list(input())
S.sort()

if S[0] == S[1] and S[2] == S[3] and S[1] != S[2]:
    print('Yes')
else:
    print('No')