Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import math
X=int(input())


count=1

while(count==1):
    for n in range(2,X):
        if (X%n==0):
            X+=1
            break
        if (n>math.sqrt(X)):
            count=0
            break
print(X)


Fixed submission:
import math
X=int(input())

count=1

if X==2:
    count=0

while(count==1):
    for n in range(2,X):
        if (X%n==0):
            X+=1
            break
        if (n>math.sqrt(X)):
            count=0
            break
print(X)

Buggy python submission (verdict: Time Limit Exceeded):
X=int(input())

count=1

while(count==1):
    for n in range(2,X):
        if (X%n==0):
            X+=1
            break
        if (n*n>X):
            count=0
            break
print(X)

Fixed submission:
import math
X=int(input())

count=1

if X==2:
    count=0

while(count==1):
    for n in range(2,X):
        if (X%n==0):
            X+=1
            break
        if (n>math.sqrt(X)):
            count=0
            break
print(X)

Buggy python submission (verdict: Time Limit Exceeded):
X=int(input())

count=1

while(count==1):
    for n in range(2,X):
        if (X%n==0):
            X+=1
            break
        if (n*n>X):
            count=0
print(X)


Fixed submission:
import math
X=int(input())

count=1

if X==2:
    count=0

while(count==1):
    for n in range(2,X):
        if (X%n==0):
            X+=1
            break
        if (n>math.sqrt(X)):
            count=0
            break
print(X)

Buggy python submission (verdict: Time Limit Exceeded):
X=int(input())

count=1

while(count==1):
    for n in range(2,X):
        if (X%n==0):
            X+=1
            break
        if (n==X-1):
            count=0
print(X)


Fixed submission:
import math
X=int(input())

count=1

if X==2:
    count=0

while(count==1):
    for n in range(2,X):
        if (X%n==0):
            X+=1
            break
        if (n>math.sqrt(X)):
            count=0
            break
print(X)
Buggy python submission (verdict: Runtime Error):
list=[1,2,3]

A=input()
B=input()

C=list.remove(A).remove(B)

print(C[0])


Fixed submission:
list=["1","2","3"]

A=input()
B=input()

list.remove(A)
list.remove(B)

print(list[0])
Buggy python submission (verdict: Runtime Error):
N = int(input())
s, t = map(str, input().split())

word = ""
for i in range(N):
    word = word + s[i]
    word = word + t[i]

input(word)

Fixed submission:
N = int(input())
s, t = map(str, input().split())

word = ""
for i in range(N):
    word = word + s[i]
    word = word + t[i]

print(word)
Buggy python submission (verdict: Time Limit Exceeded):
[x,k,d] = [int(i) for i in input().split()]
tmp_diff = abs(x)

while tmp_diff > d and k > 0:
    tmp_diff -= d
    k -= 1

if k <= 0:
    print(tmp_diff)
else:
    if k % 2 == 0:
        print(tmp_diff)
    else:
        print(d - tmp_diff)


Fixed submission:
[x,k,d] = [int(i) for i in input().split()]
x = abs(x)

if k < x//d:
    print(x - k * d)
else:
    k -= x // d
    x -= (x // d) * d
    if k % 2:
        print(abs(x-d))
    else:
        print(x)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())

if k % 2 == 0:
    print(-1)
else:
    now = 7
    ans = 1
    md = 7 % k
    while md != 0:
        md *= 10
        md += 7
        md %= k
        ans += 1
    print(ans)



Fixed submission:
k = int(input())

if k % 2 == 0 or k % 5 == 0:
    print(-1)
else:
    ans = 1
    md = 7 % k
    while md != 0:
        md *= 10
        md += 7
        md %= k
        ans += 1
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import collections

n = int(input())
x = input()
dic = collections.defaultdict(int)
#dic_count = collections.defaultdict(int)
one_count = x.count("1")

for i in range(1,n+1):
    cnt = 0
    nm = bin(i).count("1")
    tmp = i
    while tmp:
        tmp %= nm
        nm = bin(tmp).count("1")
        cnt += 1
    dic[i] = cnt

if one_count == 1:
    cnt = 0
    for i in range(n):
        if x[i] == "1":
            print(0)
        else:
            num = int(x,2) + 2 ** (n - i - 1)
            num %= (one_count+1)
            if num != 0:
                print(dic[num]+1)
            else:
                print(1)
else:
    for i in range(n):
        tmp_count = one_count
        num = int(x,2)
        if x[i] == "1":
            num -= 2 ** (n - i - 1)
            tmp_count -= 1
        else:
            num += 2 ** (n - i - 1)
            tmp_count += 1
        num %= tmp_count
        if num != 0:
            print(dic[num]+1)
        else:
            print(1)


Fixed submission:
import collections
n = int(input())
x = input()

num_of_one = x.count("1")

#xの中に1が1つもない時
if num_of_one == 0:
    for i in range(n):
        print(1)
#xの中に1が1つの時(1を取り除くと0個になる)
elif num_of_one == 1:
    for i in range(n):
        if x[i] == "1":
            print(0)
        else:
            #1が2個なので偶数なら余り0
            if x[-1] == "0" and i != n-1:
                print(1)
            #奇数なら1回1を経由
            else:
                print(2)
else:
    dic = collections.defaultdict(int)
    #0からnまでの回数を予め求めて辞書に格納
    for i in range(n):
        tmp_p = i

        cnt = 0
        while tmp_p:
            tmp_p %= bin(tmp_p).count("1")
            cnt += 1
        dic[i] = cnt


    #2冪を num_of_one ± 1 で割った余りの配列を用意しておく
    bi_mod_p = [1 % (num_of_one+1)]
    bi_mod_m = [1 % (num_of_one-1)]
    for i in range(1,n):
        bi_mod_p.append((bi_mod_p[-1] * 2) % (num_of_one+1))
        bi_mod_m.append((bi_mod_m[-1] * 2) % (num_of_one-1))

    #xと逆順なので合わせる
    bi_mod_p.reverse()
    bi_mod_m.reverse()

    #xの10進表記を num_of_one ± 1 で割った余りを用意する
    sum_p = 0
    sum_m = 0
    for i in range(n):
        if x[i] == "1":
            sum_p += bi_mod_p[i]
            sum_p %= (num_of_one+1)
            sum_m += bi_mod_m[i]
            sum_m %= (num_of_one-1)
    tmp = 0
    for i in range(n):
        # 0 -> 1 の変化。1が増えるのでpの方を使う
        if x[i] == "0":
            tmp = sum_p + bi_mod_p[i]
            tmp %= (num_of_one+1)

        # 1 -> 0 の変化。1が減るのでmの方を使う
        else:
            tmp = sum_m - bi_mod_m[i]
            if tmp < 0:
                tmp += (num_of_one-1)
            tmp %= (num_of_one-1)
        print(dic[tmp]+1)
Buggy python submission (verdict: Runtime Error):
import collections
n = int(input())
dic = collections.defaultdict(int)
for i in range(n):
  dic[input()] += 1
print("AC x" + dic["AC"])
print("WA x" + dic["WA"])
print("TLE x" + dic["TLE"])
print("RE x" + dic["RE"])


Fixed submission:
#[int(i) for i in input().split()]
import collections
n = int(input())
dic = collections.defaultdict(int)
for i in range(n):
  dic[input()] += 1
print("AC x " + str(dic["AC"]))
print("WA x " + str(dic["WA"]))
print("TLE x " + str(dic["TLE"]))
print("RE x " + str(dic["RE"]))
Buggy python submission (verdict: Time Limit Exceeded):
import time
st = time.time()
import random
import math
d = int(input())
c = [int(i) for i in input().split()]
s = []
for i in range(d):
    s.append([int(j) for j in input().split()])
t = []

for i in range(d):
    t.append(math.floor(26 * random.random()))

tmp = -1
while time.time() - st < 1.99:
    tmp_d = math.floor(d * random.random())
    old = t[tmp_d]
    t[tmp_d] = math.floor(26 * random.random())
    last = [-1] * 26
    satis = 0
    for i in range(d):
        satis += s[i][t[i]]
        last[t[i]] = i;
        for j in range(26):
            satis -= c[j] * (i - last[j])
    if satis > tmp:
        tmp = satis
    else:
        t[tmp_d] = old

for i in range(d):
    print(t[i] + 1)
#print(time.time()-st)


Fixed submission:
import random
import math
d = int(input())
c = [int(i) for i in input().split()]
s = []
for i in range(d):
    s.append([int(j) for j in input().split()])
t = []

for i in range(d):
    print(math.ceil(26 * random.random()))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
tmp = 1
for i in range(n):
    tmp *= a[i]

if tmp > 10 ** 18:
    print(-1)
else:
    print(tmp)


Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
tmp = 1
flg = 1
if 0 in a:
    print(0)
else:
    for i in a:
        tmp *= i
        if tmp > 10**18:
            flg = 0
            break
    if flg:
        print(tmp)
    else:
        print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
tmp = 1
for i in range(n):
    tmp *= a[i]

if tmp > 10 ** 18:
    print(-1)
else:
    print(tmp)


Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
tmp = 1
flg = 1
if 0 in a:
    print(0)
else:
    for i in a:
        tmp *= i
        if tmp > 10**18:
            flg = 0
            break
    if flg:
        print(tmp)
    else:
        print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
#[int(i) for i in input().split()]
t = input()
ans = ""
for i in range(len(t)):
    if t[i] == "?":
        ans += "D"
    else:
        ans += t[i]
print(ans)


Fixed submission:
#[int(i) for i in input().split()]
t = input()
ans = ""
for i in range(len(t)):
    if t[i] == "?":
        ans += "D"
    else:
        ans += t[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
pl = []
dic_mn = {}
for i in range(-n,n):
    dic_mn[i] = 0

for i in range(n):
    pl.append(a[i] + i)
    dic_mn[i - a[i]] += 1
ans = 0
for i in range(n):
    try:
        ans += dic_mn[pl[i]]
    except:
        ans = ans
print(ans)
#print(pl)
#print(dic_mn)


Fixed submission:
import collections
n = int(input())
a = [int(i) for i in input().split()]
pl = []
dic_mn = collections.defaultdict(int)

for i in range(n):
    pl.append(a[i] + i)
    dic_mn[i - a[i]] += 1
ans = 0
for i in range(n):
    ans += dic_mn[pl[i]]

print(ans)
#print(pl)
#print(dic_mn)
Buggy python submission (verdict: Runtime Error):
k = int(input())
[a,b] = [int(i) for i in input().split()]
f = 0
for i in range(a,b+1):
	if i % k == 0:
    	f = 1
if f:
	print("OK")
else:
	print("NG")

Fixed submission:
k = int(input())
[a,b] = [int(i) for i in input().split()]
f = 0
for i in range(a,b+1):
  if i % k == 0:
    f = 1
if f:
  print("OK")
else:
  print("NG")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
for i in range(n):
	try:
		dic[a[i]] += 1
	except:
		dic[a[i]] = 1
if max(dic.values) > 1:
	print("Yes")
else:
  	print("No")

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
for i in range(n):
	try:
		dic[a[i]] += 1
	except:
		dic[a[i]] = 1
if max(dic.values()) > 1:
	print("NO")
else:
  	print("YES")

Buggy python submission (verdict: Runtime Error):
[n,k] = [int(i) for i in input().split()]
p = [(int(i)+1)/2 for i in input().split()]

a = []
#print(a)
ans = -1
ruiseki = []
for i in range(n-k+1):
    ruiseki.append(sum(p[i:i+k]))
print(max(ruiseki))


Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
for i in range(n):
	try:
		dic[a[i]] += 1
	except:
		dic[a[i]] = 1
if max(dic.values()) > 1:
	print("NO")
else:
  	print("YES")

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
flag = 1
ls = [0] * (max(a)+1)
#print(ls)
for i in range(n):
    if ls[a[i]] == 1:
        flag = 0
        print("NO")
        break
    else:
        ls[a[i]] = 1
if flag:
    print("YES")
#print(ls)


Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
for i in range(n):
	try:
		dic[a[i]] += 1
	except:
		dic[a[i]] = 1
if max(dic.values()) > 1:
	print("NO")
else:
  	print("YES")

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
flag = 1
ls = [0] * (max(a)+1)
for i in range(n):
    if ls[a[i]] == 1:
        flag = 0
        print("NO")
        break
    else:
        ls[a[i]] = 1

if flag:
    print("YES")


Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
for i in range(n):
	try:
		dic[a[i]] += 1
	except:
		dic[a[i]] = 1
if max(dic.values()) > 1:
	print("NO")
else:
  	print("YES")

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
flag = 1
for i in range(n):
    if a[i] in dic.keys():
        flag = 0
        print("NO")
        break
    else:
        dic[a[i]] = 1
if flag:
    print("YES")


Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
dic = {}
for i in range(n):
	try:
		dic[a[i]] += 1
	except:
		dic[a[i]] = 1
if max(dic.values()) > 1:
	print("NO")
else:
  	print("YES")
Buggy python submission (verdict: Time Limit Exceeded):
[n,k] = [int(i) for i in input().split()]
p = [(int(i)+1)/2 for i in input().split()]
ans = 0
for i in range(n-k+1):
	ans = max(ans,sum(p[i:i+k]))
print(ans)


Fixed submission:
[n,k] = [int(i) for i in input().split()]
p = [(int(i)+1)/2 for i in input().split()]
sm_l = [0]
#sm_r = [0]
for i in range(n):
	sm_l.append(sm_l[-1] + p[i])
	#sm_r.append(sm_r[-1] + p[-i-1])
ans = 0
for i in range(n-k+1):
	ans = max(ans,sm_l[i+k]-sm_l[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
[n,k] = [int(i) for i in input().split()]
p = [(int(i)+1)/2 for i in input().split()]

a = []
#print(a)
ans = -1
ruiseki = []
for i in range(n-k+1):
    ruiseki.append(sum(p[i:i+k]))
print(max(ruiseki))


Fixed submission:
[n,k] = [int(i) for i in input().split()]
p = [(int(i)+1)/2 for i in input().split()]
sm_l = [0]
#sm_r = [0]
for i in range(n):
	sm_l.append(sm_l[-1] + p[i])
	#sm_r.append(sm_r[-1] + p[-i-1])
ans = 0
for i in range(n-k+1):
	ans = max(ans,sm_l[i+k]-sm_l[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
[n,k] = [int(i) for i in input().split()]
p = [(int(i)+1)/2 for i in input().split()]
ls = [0]
ex = [0]
mx = 1001

a = []
#print(a)
ans = -1
ruiseki = []
for i in range(n-k+1):
    ruiseki.append(sum(p[i:i+k]))
print(max(ruiseki))


Fixed submission:
[n,k] = [int(i) for i in input().split()]
p = [(int(i)+1)/2 for i in input().split()]
sm_l = [0]
#sm_r = [0]
for i in range(n):
	sm_l.append(sm_l[-1] + p[i])
	#sm_r.append(sm_r[-1] + p[-i-1])
ans = 0
for i in range(n-k+1):
	ans = max(ans,sm_l[i+k]-sm_l[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
[n,k] = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
ls = [0]
ex = [0]
mx = 1001
for i in range(1,mx):
    ls.append(i + ls[i-1])
for i in range(1,mx):
    ex.append(ls[i]/i)
a = []
for i in range(n):
    a.append(ex[p[i]])
#print(a)
ans = -1
ruiseki = []
for i in range(n-k+1):
    ruiseki.append(sum(a[i:i+k]))
print(max(ruiseki))


Fixed submission:
[n,k] = [int(i) for i in input().split()]
p = [(int(i)+1)/2 for i in input().split()]
sm_l = [0]
#sm_r = [0]
for i in range(n):
	sm_l.append(sm_l[-1] + p[i])
	#sm_r.append(sm_r[-1] + p[-i-1])
ans = 0
for i in range(n-k+1):
	ans = max(ans,sm_l[i+k]-sm_l[i])
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
[n,k] = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
ls = [0]
ex = [0]
mx = 1001
for i in range(1,mx):
    ls.append(i + ls[i-1])
for i in range(1,mx):
    ex.append(ls[i]/i)
a = []
for i in range(n):
    a.append(ex[p[i]])
#print(a)
ans = -1
for i in range(n-k+1):
    ans = max(ans,sum(a[i:i+k]))
print(ans)


Fixed submission:
[n,k] = [int(i) for i in input().split()]
p = [(int(i)+1)/2 for i in input().split()]
sm_l = [0]
#sm_r = [0]
for i in range(n):
	sm_l.append(sm_l[-1] + p[i])
	#sm_r.append(sm_r[-1] + p[-i-1])
ans = 0
for i in range(n-k+1):
	ans = max(ans,sm_l[i+k]-sm_l[i])
print(ans)
Buggy python submission (verdict: Runtime Error):
n = input()
[s,t] = [i for i in input().split()]
ans = ""
for i in range(n):
    ans += s[i]
    ans += t[i]
print(ans)

Fixed submission:
n = int(input())
[s,t] = [i for i in input().split()]
ans = ""
for i in range(n):
    ans += s[i]
    ans += t[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
ls = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
dic = {"A":1,"B":2,"C":3,"D":4,"E":5,"F":6,"G":7,"H":8,"I":9,"J":10,"K":11,"L":12,"M":13,"N":14,"O":15,"P":16,"Q":17,"R":18,"S":19,"T":20,"U":21,"V":22,"W":23,"X":24,"Y":25,"Z":26}

n = int(input())
s = input()
ans = ""
for i in range(len(s)):
  ans += ls[dic[s[i]]+n-1]
print(ans)

Fixed submission:
ls = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
dic = {"A":1,"B":2,"C":3,"D":4,"E":5,"F":6,"G":7,"H":8,"I":9,"J":10,"K":11,"L":12,"M":13,"N":14,"O":15,"P":16,"Q":17,"R":18,"S":19,"T":20,"U":21,"V":22,"W":23,"X":24,"Y":25,"Z":26}

n = int(input())
s = input()
ans = ""
for i in range(len(s)):
  ans += ls[(dic[s[i]]+n-1) % 26]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [int(i) for i in input().split()]
sum1 = []
sum2 = []
s = sum(a)
ls = []
for i in range(1,n):
    sum1.append(sum(a[:i]))
    sum2.append(s - sum(a[:i]))

for i in range(n-1):
    ls.append(abs(sum1[i] - sum2[i]))

print(min(ls))


Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
sum1 = [a[0]]
sum2 = [sum(a)-a[0]]
s = sum(a)
ls = []
for i in range(1,n):
    sum1.append(sum1[i-1]+a[i])
    sum2.append(s - sum1[i])

for i in range(n-1):
    ls.append(abs(sum1[i] - sum2[i]))

print(min(ls))
Buggy python submission (verdict: Runtime Error):
#include <iostream>

using namespace std;

int main(){
  int a,b,cnt,now;
  cin >> a >> b;
  now = 1;
  cnt = 0;
  while(now < b){
    if (cnt == 0) now += a;
    else now += a - 1;
  cnt += 1;
  }
  cout << cnt << endl;
  return 0;
}

Fixed submission:
[a,b] = [int(i) for i in input().split()]
now = 1
cnt = 0
while(now < b):
    now += a-1
    cnt += 1
print(cnt)
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = [int(i) for i in input().split()]
a = []
t = 0
for i in range(n):
  if i == 0:
    a.append(0)
  else:
    if h[i] < h[i-1]:
      t += 1
    else:
      t = 0
    a.append(t)
print(max(t))

Fixed submission:
n = int(input())
h = [int(i) for i in input().split()]
a = []
t = 0
for i in range(n):
  if i == 0:
    a.append(0)
  else:
    if h[i] <= h[i-1]:
      t += 1
    else:
      t = 0
    a.append(t)
print(max(a))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]


dic = {}
m = 0
for i in range(len(a)):
    if a[i] in dic.keys():
        dic[a[i]] += 1
    else:
        dic[a[i]] = 1

ls = list(dic.keys())

if len(ls) <= 2 and 0 in ls:
    ls.sort()
    if dic[ls[0]] == 2 * dic[ls[1]]:
        print("Yes")
    else:
        print("No")
elif len(ls) == 3:
    ls.sort()
    if  dic[ls[0]] == dic[ls[1]] and dic[ls[0]] == dic[ls[2]]:
        if list(ls)[0] ^ list(ls)[1] == list(ls)[2]:
            print("Yes")
        else:
            print("No")
else:
    print("No")




Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]

#a_b = []
dic = {}
m = 0
for i in range(len(a)):
    if a[i] in dic.keys():
        dic[a[i]] += 1
    else:
        dic[a[i]] = 1

ls = list(dic.keys())

if len(ls) <= 2 and 0 in ls:
    ls.sort()
    #2種類の時...0と何か
    if len(ls) == 2:
        #0の数が他の数の半分
        if 2 * dic[ls[0]] == dic[ls[1]]:
            print("Yes")
        else:
            print("No")
    #1種類の時...0だけ
    else:
        print("Yes")
#3種類の時...全ての個数が揃っていて2つが1つの排他的論理和になっている
elif len(ls) == 3:
    ls.sort()
    if  dic[ls[0]] == dic[ls[1]] and dic[ls[0]] == dic[ls[2]]:
        if list(ls)[0] ^ list(ls)[1] == list(ls)[2]:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
#4種類以上の時...ダメ
else:
    print("No")

"""
for i in a:
    if i == max(a):
        m = i
    #print(bin(i))
for i in a:
    a_b.append(bin(i)[:2]+'0'*(len(bin(m))-len(bin(i)))+bin(i)[2:])

#for i in range(len(a_b)):
#    print(a_b[i])


a = int("0b" + "0" * (len(bin(m))-2),2)

for i in range(len(a_b)):
    a = a ^ int(a_b[i],2)
if a == 0:
    print("Yes")
else:
    print("No")
"""
Buggy python submission (verdict: Time Limit Exceeded):
[h,w] = [int(i) for i in input().split()]
s = []
tate = [[0] * (h+2) for i in range(w+2)]
yoko = [[0] * (w+2) for i in range(h+2)]
s.append("#"*(w+2))
for i in range(h):
    tmp = input()
    s.append("#" + tmp + "#")
s.append("#"*(w+2))

#横
for i in range(1,h+1):
    tmp = 1
    before = 1
    while tmp < w+2:
        if s[i][tmp] == "#":
            before += 1
            tmp += 1
        else:
            while s[i][tmp] != "#":
                tmp += 1
                if tmp == w+2:
                    break
            yoko[i][before:tmp] = [tmp-before] * (tmp - before)
            before = tmp

for i in range(1,w+1):
    tmp = 1
    before = 1
    while tmp < h+2:
        if s[tmp][i] == "#":
            before += 1
            tmp += 1
        else:
            while s[tmp][i] != "#":
                tmp += 1
                if tmp == h+2:
                    break
            tate[i][before:tmp] = [tmp-before] * (tmp - before)
            before = tmp
ans = 0
for i in range(1,h+1):
    for j in range(1,w+1):
        ans = max(ans,tate[j][i]+yoko[i][j]-1)
print(ans)


Fixed submission:
[h,w] = [int(i) for i in input().split()]
s = []
tate = [[0] * (h+2) for i in range(w+2)]
yoko = [[0] * (w+2) for i in range(h+2)]
s.append("#"*(w+2))
for i in range(h):
    tmp = input()
    s.append(tmp.join(["#","#"]))
s.append("#"*(w+2))

#横
for i in range(1,h+1):
    tmp = 1
    before = 1
    while tmp < w+2:
        if s[i][tmp] == "#":
            before += 1
            tmp += 1
        else:
            while s[i][tmp] != "#":
                tmp += 1
                if tmp == w+2:
                    break
            yoko[i][before:tmp] = [tmp-before] * (tmp - before)
            before = tmp

for i in range(1,w+1):
    tmp = 1
    before = 1
    while tmp < h+2:
        if s[tmp][i] == "#":
            before += 1
            tmp += 1
        else:
            while s[tmp][i] != "#":
                tmp += 1
                if tmp == h+2:
                    break
            tate[i][before:tmp] = [tmp-before] * (tmp - before)
            before = tmp
ans = 0
for i in range(1,h+1):
    for j in range(1,w+1):
        ans = max(ans,tate[j][i]+yoko[i][j]-1)
print(ans)
Buggy python submission (verdict: Runtime Error):
print((n-2) * 180)

Fixed submission:
print((int(input())-2)*180)
Buggy python submission (verdict: Time Limit Exceeded):
[n,m] = [int(i) for i in input().split()]
ls = []
for i in range(n):
    ls.append(i+1)
for i in range(m):
    [l,r] = [int(i) for i in input().split()]
    ls = [0] * (l-1) + ls[l-1:r] + [0] * (n-r)
print(len([i for i in ls if i != 0]))


Fixed submission:
[n,m] = [int(i) for i in input().split()]
to_acc = [0] * (n+1)
for i in range(m):
  [l,r] = [int(j)-1 for j in input().split()]
  to_acc[l] += 1
  to_acc[r+1] -= 1
acc = [0]
ans = 0
for i in range(n+1):
  acc.append(acc[-1] + to_acc[i])
for i in range(1,n+1):
  if m == acc[i]:
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
ls = []

for i in range(5):
    ls.append(int(input()))
sum = 0
ls1 = []
for i in range(5):
    if ls[i] % 10 == 0:
        sum += ls[i]
    else:
        ls1.append(10 - ls[i] % 10)
        sum += (ls[i] // 10 + 1 )* 10
#print(ls1)
print(sum - max(ls1))


Fixed submission:
ls = []

for i in range(5):
    ls.append(int(input()))
sum = 0
ls1 = []
for i in range(5):
    if ls[i] % 10 == 0:
        sum += ls[i]
    else:
        ls1.append(10 - ls[i] % 10)
        sum += ((ls[i] // 10) + 1)* 10
#print(ls1)
if len(ls1) != 0:
    print(sum - max(ls1))
else:
    print(sum)