akhauriyash/Code-Regression huggingface dataset:
S=input()
N=len(S)
pointofRL=[]
i=0
map=[0]*N
ans=[0]*N
while i<N-1:
    if (S[i]=="R")and(S[i+1]=="L"):
        pointofRL.append([i,i+1])

        i=i+1
    i=i+1
#print(pointofRL)
id=0
i=0
while i<N:
    if id<len(pointofRL):
        if (i==pointofRL[id][0]):
            map[i]="R"
        elif (i==pointofRL[id][1]):
            map[i]="L"
            id=id+1
        else:
            if S[i]=="R":
                map[i]=pointofRL[id][0]-i
            else:
                map[i]=i-(pointofRL[id-1][1])
    else:
        map[i]=i-(pointofRL[len(pointofRL)-1][1])
    i=i+1
#print(map)
id=0
for i in range(N):
    state=map[i]
    if state=="R":
        ans[i]=ans[i]+1
    elif state=="L":
        ans[i] = ans[i] + 1
        id=id+1
    elif S[i]=="R":
        if state%2==0:
            ans[pointofRL[id][0]]=ans[pointofRL[id][0]]+1
        else:
            ans[pointofRL[id][1]] = ans[pointofRL[id][1]] + 1
    elif S[i]=="L":
        if state%2==0:
            ans[pointofRL[id-1][1]]=ans[pointofRL[id-1][1]]+1
        else:
            ans[pointofRL[id - 1][0]] = ans[pointofRL[id - 1][0]] + 1
print(*ans,sep=" ")





    
                


Measured memory_bytes: 56508
#![allow(non_snake_case)]

use std::io;
use std::f64::consts;

fn main() {
    let mut buf = String::new();
    let sin = io::stdin();
    sin.read_line(&mut buf).ok();
    let r: f64 = buf.trim().parse().unwrap();

    println!("{:.6} {:.6}", consts::PI*r*r, 2.0*consts::PI*r);
}



Measured memory_bytes: 5056
#include <iostream>
//#include <vector>
#include <string>
//#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 100100
//#define NIL -1
//#define INFTY 1000000000000000000

int main(){
    string s;
    cin >> s;
    s[3]='8';
    cout << s << endl;

    return 0;
}


Measured memory_bytes: 3576
import java.util.*;

public class Main {

    public static void main(String args[]) {

        // 入力
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int m = Integer.parseInt(sc.next());
        Integer[] x = new Integer[m];
        Arrays.setAll(x, i -> Integer.parseInt(sc.next()));
        sc.close();

        // 主処理
        Arrays.sort(x);
        PriorityQueue<Integer> pq = new PriorityQueue<>(Collections.reverseOrder());
        for (int i = 0; i < m - 1; i++) {
            int left = x[i];
            int right = x[i + 1];
            int diff = right - left;
            pq.add(diff);
        }
        for (int i = 0; i < n - 1; i++) {
            pq.poll();
        }
        int sum = pq.stream().mapToInt(i -> i).sum();
        int result = sum;

        // 出力
        System.out.println(result);
    }
}


Measured memory_bytes: 49380
#include<bits/stdc++.h>
int m=0,minv=10000000; 
using namespace std;
int main(){
	int n;
	
	int temp=0;
	cin>>n;
	int a[n+1];
	for(int i=1;i<=n;i++){
		cin>>a[i];
		m=max(m,a[i]);
	}
	for(int i=1;i<=m;i++){
		temp=0;
		for(int j=1;j<=n;j++){
			temp+=fabs(a[j]-i)*fabs(a[j]-i);
		}
		
		if(temp<minv)minv=temp;
	}
	cout<<minv;
	return 0;
	
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
    
int main(){
int a,b,c,d;

cin>>a>>b>>c>>d;

while (1)
{
  c=c-b;
  if (c<1)
  {
    cout<<"Yes"<<endl;
    break;
  }
  a=a-d;
  if (a<1)
  {
    cout<<"No"<<endl;
    break;
  }
  

}

    return 0;
}

Measured memory_bytes: 3632
#include <cmath>
#include <cstdio>
#include <complex>
#include <algorithm>
#pragma warning(disable : 4996)
using namespace std;
// ------ Defines ------ //
#define Point complex<long double>
#define px real()
#define py imag()
// ------ Classes ------ //
class Segment {
public:
	Point p1, p2;
	Segment(Point p1_, Point p2_) : p1(p1_), p2(p2_) {};
	Segment(long double p1x, long double p1y, long double p2x, long double p2y) : p1(Point(p1x, p1y)), p2(Point(p2x, p2y)) {};
	friend bool operator==(const Segment& s1, const Segment& s2) { return (s1.p1 == s2.p1 && s1.p2 == s2.p2) || (s1.p1 == s2.p2 && s1.p2 == s2.p1); }
	friend bool operator!=(const Segment& s1, const Segment& s2) { return !(s1 == s2); }
};
class Line {
public:
	Point p1, p2;
	Line(Point p1_, Point p2_) : p1(p1_), p2(p2_) {};
	Line(long double p1x, long double p1y, long double p2x, long double p2y) : p1(Point(p1x, p1y)), p2(Point(p2x, p2y)) {};
	friend bool operator==(const Line& s1, const Line& s2) { return (s1.p1 == s2.p1 && s1.p2 == s2.p2) || (s1.p1 == s2.p2 && s1.p2 == s2.p1); }
	friend bool operator!=(const Line& s1, const Line& s2) { return !(s1 == s2); }
};
// ------ Functions ------ //
long double dot(const Point& a, const Point& b) { return a.px * b.px + a.py * b.py; }
long double crs(const Point& a, const Point& b) { return a.px * b.py - a.py * b.px; }
int ccw(Point p0, Point p1, Point p2) {
	Point a = p1 - p0, b = p2 - p0;
	if (crs(a, b) > 1e-10) return 1;
	if (crs(a, b) < -1e-10) return -1;
	if (dot(a, b) < -1e-10) return 2;
	if (norm(a) < norm(b)) return -2;
	return 0;
}
bool its(Point p1, Point p2, Point p3, Point p4) {
	return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 && ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0);
}
bool its(Segment s1, Segment s2) {
	return its(s1.p1, s1.p2, s2.p1, s2.p2);
}
long double dst(const Line& a, const Point& b) {
	return abs(crs(a.p2 - a.p1, b - a.p1) / abs(a.p2 - a.p1));
}
long double dst(const Segment& a, const Point& b) {
	if (dot(a.p2 - a.p1, b - a.p1) < 0.0) return abs(b - a.p1);
	if (dot(a.p1 - a.p2, b - a.p2) < 0.0) return abs(b - a.p2);
	return abs(crs(a.p2 - a.p1, b - a.p1) / abs(a.p2 - a.p1));
}
long double dst(const Segment& a, const Segment& b) {
	if (its(a, b)) return 0;
	return min({ dst(a, b.p1), dst(a, b.p2), dst(b, a.p1), dst(b, a.p2) });
}
int N[2], X[2][52], Y[2][52];
int main() {
	scanf("%d", &N[0]);
	X[0][0] = 0, Y[0][0] = 0, X[0][N[0] + 1] = 1000, Y[0][N[0] + 1] = 0;
	for (int i = 1; i <= N[0]; i++) scanf("%d%d", &X[0][i], &Y[0][i]);
	scanf("%d", &N[1]);
	X[1][0] = 0, Y[1][0] = 1000, X[1][N[1] + 1] = 1000, Y[1][N[1] + 1] = 1000;
	for (int i = 1; i <= N[1]; i++) scanf("%d%d", &X[1][i], &Y[1][i]);
	long double ret = 1000.0L;
	for (int i = 0; i <= N[0] + 1; i++) {
		for (int j = 0; j <= N[1]; j++) {
			ret = min(ret, dst(Segment(X[1][j], Y[1][j], X[1][j + 1], Y[1][j + 1]), Point(X[0][i], Y[0][i])));
		}
	}
	for (int i = 0; i <= N[1] + 1; i++) {
		for (int j = 0; j <= N[0]; j++) {
			ret = min(ret, dst(Segment(X[0][j], Y[0][j], X[0][j + 1], Y[0][j + 1]), Point(X[1][i], Y[1][i])));
		}
	}
	printf("%.9Lf\n", ret);
	return 0;
}

Measured memory_bytes: 2808
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)
#define rrep(i,x) for(int i=(int)x-1;i>=0;--i)
#define rrep1(i,x) for(int i=(int)x;i>=1;--i)

using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int, int>;
using vpii=vector<pii>;

template<class T,class U>ostream&operator<<(ostream&os,const pair<T,U>p){os<<"("<<p.fst<<", "<<p.scd<<")";return os;}
template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
template<typename T>T&max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T&min(T&a,T&b){if(a < b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a < b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a > b){a=b;return true;}return false;}

constexpr int inf = 1e9;
constexpr ll linf = 3e18;
constexpr double eps = 1e-9;

int N, M;
bool infected[20020];

signed main()
{
    while (cin >> N >> M, N) {
        memset(infected, 0, sizeof infected);
    infected[0] = true;

    vector<pair<int, pii>> packets;
    
    rep(i, M) {
        int t, s, d;cin>>t>>s>>d;
        --s,--d;
        packets.emplace_back(t, pii(s, d));
    }
    
    sort(all(packets));
    rep(i, M) {
        int s = packets[i].second.first, d = packets[i].second.second;
        infected[d] |= infected[s];
    }
    
    int ans = 0;
    rep(i, N) if (infected[i]) ans++;
    
    cout << ans << endl;
    }
}



Measured memory_bytes: 3472
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using pii = pair<int, int>;

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;

int		main(void)
{
	ios::sync_with_stdio(0);
	cin.tie(0);

	int n, m;
	cin >> n >> m;
	cout << n * (n - 1) / 2 + m * (m - 1) / 2 << endl;
}

Measured memory_bytes: 256
N,K = map(int, input().split())
hate = [i for i in input().split()]
j = 0
k = 0
while j >= 0:
  k = 0
  for nums in hate:
    if nums in str(N):
      k += 1
    else:
      pass
  if k == 0:
    break
  else:
    N += 1

print(N)

  

Measured memory_bytes: 2940
N,K = map(int,input().split())
A = list(map(int,input().split()))

import copy
B = copy.deepcopy(A)
for i in range(N):
    B[i] -= 1

C = [0]
for i in range(N):
    C.append((C[-1]+B[i])%K)

from collections import defaultdict
D = defaultdict(list)
for i in range(N+1):
    D[C[i]].append(i)

ans = 0
#print(B)
#print(C)
#print(D)
for i in D:
    E = D[i]
    #print(ans)
    if len(E)>=2:
        left = 0
        right = 1
        count = 0
        flag = 0
        while left != len(E)-1 :
            if E[right]-E[left] < K:
                if right == len(E)-1:
                    if flag == 0:
                        count += 1
                        flag = 1
                    ans += count
                    left += 1
                    count -= 1
                else:
                    count += 1
                    right += 1
            else:
                ans += count
                count -= 1
                left += 1
print(ans)

Measured memory_bytes: 122068
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int l = sc.nextInt();
		int count = 0;
		char [][] s =  new char [n][];
		char [] hozon = new char [l];
	    for(int i = 0; i < n; i++){
		s [i] = sc.next().toCharArray();}
	    
	    for(int o = 0; o < l; o++){
	    for(int i = 0; i < n - 1; i++){
	    for(int j = i + 1; j < n; j++){
	    	
	    for(int k = 0; k < o; k++){	
	    if(s[i][k] == s[j][k]){ count++;} else {}
	    }
	    
	    if(count == o && s[i][o] > s[j][o]){ 
		for(int m = 0; m < l; m++){
		hozon[m] = s[i][m];
		s[i][m] = s[j][m];
		s[j][m] = hozon[m];}
		}
	    count = 0;
	    }}}
	    
	    for(int i = 0; i < n; i++){
		for(int j = 0; j < l; j++){
		System.out.print(s[i][j]);
		}}
		    			
	}}

Measured memory_bytes: 26200
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
const int N = 2e5+5;
const ll mod = 1e9+7;
void solve(){
    int n,a,b; 
    cin>>n>>a>>b; 
    cout<<min(n*a,b)<<endl;
}
int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
  //  cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int ans=0;
  for(int i=1;i<=s.size();i++) {
    if(s[i-1]==s[i]) {
      if(s[i]=='1') {
        s[i]='0';
      }
      else{
        s[i]='1';
      }
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
vector <int> ve;
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0;i<n;i++)
    {
        int now;
        scanf("%d",&now);
        ve.push_back(now);
    }

    int times = 0;
    for(int i=0;i<n;i++)
    {
        int mini = i;
        for(int j=i;j<n;j++)
            if(ve[j] < ve[mini])
                mini = j;
        swap(ve[i],ve[mini]);
        if(i != mini)
            times++;
    }

    for(int i=0;i<n;i++)
    {
        if(i == n-1)
            printf("%d",ve[i]);
        else
            printf("%d ",ve[i]);
    }
    printf("\n%d\n",times);
}

Measured memory_bytes: 3264
#include "bits/stdc++.h"

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n;
string s;
ll k;

int main() {
    cin >> s >> k;

    REP(i, s.size()) {
        if (s[i] != '1') {
            cout << s[i] << '\n';
            return 0;
        } else if (k == i+1) {
            cout << 1 << '\n';
            return 0;
        }
    }

    return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	N := ReadInt()
	A := make([][]int, N)
	noUse := make([][]bool, N)
	for i := 0; i < N; i++ {
		A[i] = ReadInts(N)
		noUse[i] = make([]bool, N)
	}
	for k := 0; k < N; k++ {
		for i := 0; i < N; i++ {
			for j := 0; j < N; j++ {
				if k == i || k == j {
					continue
				}
				if A[i][k]+A[k][j] < A[i][j] {
					fmt.Println(-1)
					return
				}
				if A[i][k]+A[k][j] == A[i][j] {
					noUse[i][j] = true
				}
			}
		}
	}
	ans := 0
	for i := 0; i < N; i++ {
		for j := i + 1; j < N; j++ {
			if !noUse[i][j] {
				ans += A[i][j]
			}
		}
	}
	fmt.Println(ans)
}

var reader = bufio.NewReader(os.Stdin)

func Scan(a ...interface{}) {
	if _, err := fmt.Fscan(reader, a...); err != nil {
		panic(err)
	}
}
func ReadInt() (i int)       { Scan(&i); return }
func ReadString() (s string) { Scan(&s); return }

func ReadInts(n int) []int {
	v := make([]int, n)
	for i := 0; i < n; i++ {
		Scan(&v[i])
	}
	return v
}


Measured memory_bytes: 4204
#include<stdio.h>

int main()
{
    int n,c=30,i,j,k,ans=2147483647;
    scanf("%d %d",&n,&c);
    int board[n][n];
    int iwakan[c][c];
    for(i=0;i<c*c;i++)
    {
        scanf("%d ",&(iwakan[i/c][i%c]));
    }
    for(j=0;j<n*n;j++)
    {
        scanf("%d",&(board[j/n][j%n]));
    }
    int iwaArray[3][30]={0};
    for(i=0;i<c;i++)
    {
        for(j=0;j<(n*n);j++)
        {
            int befcolor=board[j/n][j%n];
            if(befcolor!=(i+1))
            {
                iwaArray[((j/n)+(j%n))%3][i]+=(iwakan[befcolor-1][i]);
            }
            
        }
    }
    for(k=0;k<c*c*c;k++)
    {
        int x=(k/c)/c;
        int y=(k/c)%c;
        int z=k%c;
        if(!((x-y)*(y-z)*(z-x)))continue;
        int kari=iwaArray[0][x]+iwaArray[1][y]+iwaArray[2][z];
        if(kari<ans)ans=kari;
    }
    printf("%d",ans);
}


Measured memory_bytes: 1152
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main()
{
	int n; cin >> n;
	ll a[n+1], ans = 0;
	for(int i=0; i<n; i++) cin >> a[i];
	sort(a, a+n);
	for(int i=0; i<n; i++){
		for(int j=i+1; j<n; j++){
			for(int k=j+1; k<n; k++){
				if(a[i]+a[j]>a[k] && (a[i] != a[j]) && (a[i] != a[k]) && (a[j] != a[k])) ans++;
			}
		}
	}
	cout << ans;

    return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
inline int read(){
    int x = 0; char c = getchar();
    while (!isdigit(c)) c = getchar();
    while (isdigit(c)) x = x * 10 + c - '0',c = getchar();
    return x;
}
inline int Get(){
	char c = getchar();
	while (c != '.' && c != '#') c = getchar();
	return c == '.' ? 0 : 1;
}
const int N = 505,M = 505;
int n,m; bool a[N][M],b[N][M],c[N][M];
int main(){
	int i,j;
	n = read(),m = read();
	for (i = 1; i <= n; ++i)
	for (j = 1; j <= m; ++j) a[i][j] = b[i][j] = c[i][j] = Get();
	for (i = 1; i <= n; ++i)
	for (j = 1; j <= m; ++j){
		if (j == 1) b[i][j] = 1;
		else if (j == m) c[i][j] = 1;
		else if (i & 1) b[i][j] = 1; else c[i][j] = 1;
	}
	for (i = 1; i <= n; ++i,putchar('\n'))
	for (j = 1; j <= m; ++j) putchar(b[i][j] ? '#' : '.');
	putchar('\n');
	for (i = 1; i <= n; ++i,putchar('\n'))
	for (j = 1; j <= m; ++j) putchar(c[i][j] ? '#' : '.');
	putchar('\n');
    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;

int main(){
    int n, i, j, k;
    string s;
    cin >> s;
    n = s.length();
    ll dp[n][13] = {};
    for(int i=0; i<n; i++){
        if(s[i] == '?'){
            if(i == 0){
                for(j=0; j<10; j++){
                    dp[i][j] = 1;
                }
            }else{
                for(j=0; j<13; j++){
                    for(int d=0; d<10; d++){
                        dp[i][(j*10+d)%13] += dp[i-1][j];
                        dp[i][(j*10+d)%13] %= MOD;
                    }
                }
            }
        }else{
            int d = s[i] - '0';
            if(i == 0){
                dp[i][d] = 1;
            }else{
                for(j=0; j<13; j++){
                    dp[i][(j*10+d)%13] += dp[i-1][j];
                    dp[i][(j*10+d)%13] %= MOD;
                }
            }
        }
    }
    cout << dp[n-1][5];
    return 0;
}

Measured memory_bytes: 10752
#include <bits/stdc++.h>

using namespace std;

using ll = long long;




int main(){

    ll n, w; cin >> n >> w;
    vector<ll> weight(101), value(101);
    for(ll i = 1; i <= n; ++i){
        cin >> weight[i] >> value[i];
    }
    ll arr[n + 1][w + 1];
    for(ll i = 0; i < n + 1; ++i){
        for(ll j = 0; j < w + 1; ++j)arr[i][j] = 0;
    }
    for(ll i = 1; i <= n; ++i){
        for(ll j = 1; j <= w; ++j){
            if(j < weight[i]){
                 arr[i][j] = arr[i - 1][j];
            }
            else arr[i][j] = max(value[i] + arr[i - 1][j - weight[i]], arr[i - 1][j]);
        }
    }

    cout << *max_element(arr[n], arr[n] + w + 1);
    return 0;
}


Measured memory_bytes: 82304
// This file is a "Hello, world!" in C++ language by GCC for wandbox.

#include<stdio.h>
#include<string.h>

# define N 1050

int main()
{
    char str[N];
    
    for(int i=0; i<N; i++) str[i]='\0';
    
    scanf("%s",str);
    if( str[strlen(str)-1]!='s' ) str[strlen(str)]='s';//strcat(str,"es");
    else strcat(str,"es"); //str[strlen(str)]='s';
    
    printf("%s\n",str);
    //std::cout << "Hello, Wandbox!" << std::endl;


}


Measured memory_bytes: 1660
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>

using namespace std;
typedef long long ll;

int N = 0;
int W = 0;

int main(){
    //ナップサック問題　荷物の価値を最大化
    cin >> N;
    cin >> W;

    vector<vector<ll> > T;
    //重量：価値
    T = vector<vector<ll> >(N + 1, vector<ll>(2, 0));
    //初期化
    T[0][0] = 0;
    T[0][1] = 0;

    for(int i = 1; i <= N; i++){
        for(int j = 0;  j < 2; j++){
            cin >> T[i][j];
        }
    }

    //価値が大きい順にソート
    ll mx = 0;
    for(int i = 1; i <= N; i++){
        mx = max(mx, T[i][1]);
    }    

    //dp
    vector<vector<ll> > dp;
    dp = vector<vector<ll> >(N + 1, vector<ll>(W + 1, -1));
    dp[0][0] = 0;

    //答え
    ll ans = 0;

    for(int i = 1; i <= N; i++){
        for(int j = 0; j <= W; j++){
            if(dp[i - 1][j] > -1){
                //直下を更新
                if(dp[i][j] <= dp[i - 1][j]){
                    dp[i][j] = dp[i - 1][j];
                }
                //荷物を足し合わせたところを更新
                if(dp[i][j + T[i][0]] <= dp[i - 1][j] + T[i][1] && j + T[i][0] <= W){
                    dp[i][j + T[i][0]] = dp[i - 1][j] + T[i][1];
                    //ans確認
                    if(ans < dp[i - 1][j] + T[i][1]) ans = dp[i - 1][j] + T[i][1];
                }
            }          
        }

    }

    cout << ans << endl;

    //確認
    /*
    for(int i = 0; i < N + 1; i++){
        for(int j = 0; j < W + 1; j++){
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
    */
    

}

Measured memory_bytes: 80256
a, b, c ,d= input()
if a==b:
  if a!=c and c==d:
    print("Yes")
  else:
    print("No")
elif a==c:
  if a!=b and b==d:
    print("Yes")
  else:
    print("No")
elif a==d:
  if a!=b and b==c:
    print("Yes")
  else:
    print("No")
else:
  print("No")



Measured memory_bytes: 2940
eval'H,W,A,B='+`tr ' ' ,`
f=r=1,*(1..H+W).map{r=r*_1%M=10**9+7}
p (B...W).sum{|i|f[H-A-1+i]*f[A+W-i-2]*(f[H-A-1]*f[i]*f[A-1]*f[W-1-i]).pow(M-2,M)}%M

Measured memory_bytes: 34996
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,Q,K,A,B;
string S;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
typedef pair<ll, ll> P;
const ll INF = (1LL<<58);
int main() {
    cin>>N;
    ll n = 1;
    while((n * 360)%N != 0) ++n;
    cout<<(n * 360)/N<<endl;
}

Measured memory_bytes: 3604
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////



int main(){
    itn n,r;
    cin >> n >> r;

    if(n >= 10){
	P(r);
    }else{
	P( r + (100 * (10-n)));
    }
    
    return  0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
main()
{
	long fix=0;
	for(int i=0;i<9;i++)
	{
		int L=0,R=10;
		while(R-L>1)
		{
			int M=L+R>>1;
			long now=fix*10+M;
			while(now<1e15)now*=10;
			cout<<"? "<<now<<endl;
			char ans;cin>>ans;
			if(ans=='Y')R=M;
			else L=M;
		}
		fix=fix*10+L;
	}
	fix++;
	while(fix%10==0)fix/=10;
	long now=fix;
	bool flag=true;
	while(now)flag&=now%10==9,now/=10;
	cout<<"? "<<fix+1<<endl;
	char ans;cin>>ans;
	if(ans==(flag?'Y':'N'))
	{
		while(true)
		{
			cout<<"? "<<fix<<1<<endl;
			cin>>ans;
			fix*=10;
			if(ans=='Y')break;
		}
	}
	cout<<"! "<<fix<<endl;
}

Measured memory_bytes: 596
using System;
using System.Collections;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections.Generic;
using System.Threading.Tasks;

class Program
{

	//Main
	static void Main(string[] args)
	{
		//読み込む
		double R = double.Parse(Console.ReadLine());
		double ans = 2 * R * 3.1415926535897931;

		//出力
		Console.WriteLine(ans);
	}
}



Measured memory_bytes: 18600
#include <iostream>

using namespace std;

int main()
{
	long long a, b;
	char op;
	cin >> a >> op >> b;
	
	if(op == '+')
	{
		cout << a + b << endl;
	}
	else
	{
		cout << a - b << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define MOD 1000000007
using namespace std;
int main()
{
    int n,r;
    cin >> n >> r;
    if(n >= 10)
    {
        cout << r << "\n";
    }
    else
    {
        cout << r + (10 - n) * 100 << "\n";
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <sstream>
#include <iterator>



using namespace std;

#define endl ("\n")
#define pi (3.141592653589)
#define mod 1000000007
#define int int64_t
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define min3(a, b, c) min(c, min(a, b))
#define min4(a, b, c, d) min(d, min(c, min(a, b)))
#define rrep(i, n) for(int i=n-1;i>=0;i--)
#define rep(i,n) for(int i=0;i<n;i++)
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)

struct debugger
{
    template<typename T> debugger& operator , (const T& v)
    {    
        cerr<<v<<" ";    
        return *this;    
    }
} dbg;

int32_t main() 
{
    fast;
	int N;
	cin >> N;
    int bigBoss = 0;
    int subs[N-1];
    fill(subs, subs+N-1, 0);
    for(int i = 2; i <= N; i++){
        int n;
        cin >> n;
        if(n==1) bigBoss++;
        else {
            subs[n-2]++;
        }
    }
    cout << bigBoss << endl;
    for(int thing: subs){
        cout << thing << endl;
    }
}




Measured memory_bytes: 5176
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<algorithm>
using namespace std;
int main(void){
    vector<int> v(3,0);
    cin>>v[0]>>v[1]>>v[2];
    cout<<min(v[0]*v[1],v[2])<<endl;
    return 0;
}

Measured memory_bytes: 256
str = input()
f = ((len(str)-1)//2)
s = ((len(str)+3)//2)
rf=str[:f]
fr=rf[::-1]
sf=str[s-1:]
fs=sf[::-1]
if str[::-1] == str and str[:f]  == fr and str[s-1: ] == fs:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
using System;
using System.Linq;

class D
{
	static void Main()
	{
		Console.ReadLine();
		var d = Console.ReadLine().Select((c, i) => new { c, i }).ToLookup(_ => _.c, _ => _.i);

		var q = from i1 in d.Select(g => g.First())
			from i2 in d.Select(g => g.FirstOrDefault(x => x > i1))
			select d.Count(g => i2 > 0 && g.Any(x => x > i2));
		Console.WriteLine(q.Sum());
	}
}


Measured memory_bytes: 13920
#include <bits/stdc++.h>
using namespace std;

#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;i<n;i++)
#define ll long long

#define pb push_back
#define mp make_pair
#define F first
#define S second

#define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)

#define debug(x) cout<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
using namespace std;
const ll MX = 1ll << 40;

void bitc(ll arr[60], ll n) {
	ll i = 2, j = 0;
	while(i<=MX) {
		ll x, y;
		x = n / i;
		y = n % i - i / 2ll;
		if(y<0)y=0;
		arr[j] = x * i / 2ll + y;
		j++;
		i = i * 2ll;
	}
	while(j<60)arr[j++]=0;
}

int main() 
{
	fastIO;
	ll l[60], r[60], n, i, a, b, ans=0;
	cin>>a>>b;
	bitc(l, a);
	bitc(r, b+1);
	//fo(i,5)cout<<l[i]<<" ";cout<<endl;
	//fo(i,5)cout<<r[i]<<" ";cout<<endl;
	fo(i,60)r[i]=(r[i]-l[i])%2ll;
	fo(i,60)if(r[i]==1)ans+=(1ll<<i);
	cout<<ans;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <assert.h>
#include <fstream>

using namespace std;

typedef double db;
typedef long long ll;

const int MOD = 200003;
const db PI = acos(-1);
const int g = 5;

struct Complex
{
	db real,imag;
	Complex (db R = 0,db I = 0)
	{
		real = R;
		imag = I;
	}
	Complex operator + (const Complex &p)const
	{
		return Complex(real + p.real,imag + p.imag);
	}
	Complex operator - (const Complex &p)const
	{
		return Complex(real - p.real,imag - p.imag);
	}
	Complex operator * (const Complex &p)const
	{
		return Complex(real * p.real - imag * p.imag,real * p.imag + imag * p.real);
	}
}A[MOD << 2],wn[2][MOD << 2];

int n,N;
int rev[MOD << 2];

ll ans;

map<int,int> match;

void init(int l)
{
	N = 1;
	while (N < l)
		N <<= 1;
	for (int i = 1;i < N;i++)
		rev[i] = (rev[i >> 1] >> 1) + (i & 1) * (N >> 1);
	int half = N >> 1;
	for (int i = 0;i < half;i++)
	{
		wn[0][half + i] = Complex(cos(PI * i / half),sin(PI * i / half));
		wn[1][half + i] = Complex(cos(PI * i / half),-sin(PI * i / half));
	}
	for (int i = half - 1;i >= 0;i--)
	{
		wn[0][i] = wn[0][i << 1];
		wn[1][i] = wn[1][i << 1];
	}
}

void FFT(Complex *v,bool inv)
{
	for (int i = 0;i < N;i++)
		if (i < rev[i])
			swap(v[i],v[rev[i]]);
	for (int i = 1;i < N;i <<= 1)
		for (int j = 0;j < N;j += (i << 1))
		{
			Complex *l = v + j,*r = v + j + i,*w = wn[inv] + i,A;
			for (int k = 0;k < i;k++,l++,r++,w++)
			{
				A = *w * *r;
				*r = *l - A;
				*l = *l + A;
			}
		}
	if (inv)
	{
		Complex Inv(1.0 / N,0);
		for (int i = 0;i < N;i++)
			v[i] = v[i] * Inv;
	}
}

int main()
{
	scanf("%d",&n);
	int t = 1;
	for (int i = 0;i < MOD - 1;i++)
	{
		match[t] = i;
		(t *= g) %= MOD;
	}
	init(MOD << 1);
	for (int a,i = 1;i <= n;i++)
	{
		scanf("%d",&a);
		if (!a)
		{
			i--;
			n--;
			continue;
		}
		ans -= (ll)a * a % MOD;
		A[match[a]].real++;
	}
	FFT(A,0);
	for (int i = 0;i < N;i++)
		A[i] = A[i] * A[i];
	FFT(A,1);
	t = 1;
	for (int i = 0;i < MOD * 2;i++)
	{
		ans += (ll)(A[i].real + 0.5) * t;
		(t *= g) %= MOD;
	}
	printf("%lld\n",ans / 2);
	return 0;
}

Measured memory_bytes: 53092
if __name__ == '__main__':
	
	n = int(input())

	for i in range(21):
		s = pow(2,i)
		if n < s:
			if i == 0:
				print(1)
			else:
				print(pow(2,i-1))
			break
		elif n == s:
			print(pow(2,i))
			break




Measured memory_bytes: 5592
import sys
def q(a,k):
 d[a]=k
 for b in t[a]:
  if'-1'!=b:q(b,k+1)
def n(a,k):
 h[a]=max(h[a],k)if a in h else k
 if'-1'!=p[a]:n(p[a],k+1)
input()
t,p,s,d,h={},{},{},{},{}
for e in sys.stdin:
 x,y,z=e.split()
 t[x]=set([y,z])-set(['-1'])
 p[y]=p[z]=x
 s[y],s[z]=z,y
r=(set(t)-set(p)).pop()
p[r],s[r]=['-1']*2
q(r,0)
for i in t:
 if not t[i]:n(i,0)
print('\n'.join(f"node {i}: parent = {p[i]}, sibling = {s[i]}, degree = {len(t[i])}, depth = {d[i]}, height = {h[i]}, {'root'if d[i]==0else'internal node'if t[i]else'leaf'}"for i in map(str,sorted(map(int,t)))))


Measured memory_bytes: 5640
#include <iostream>
using namespace std;
void ABC90(void);
void ABC91(void);
void ABC92(void);
void ABC93(void);
void ABC94(void);
void ABC95(void);
void ABC96(void);
void ABC97(void);
void ABC98(void);
void ABC99(void);

int main(void){
    ABC92();
}

void ABC92(){
    int a,b,c,d,sum=0;
    cin>>a>>b>>c>>d;
    if(a<b)sum+=a;
    else sum+=b;
    if(c<d)sum+=c;
    else sum+=d;
    cout<<sum;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

vector<int> q,sq,e[100010];
int a[100010];
bool v[100010];

void dfs(int x) {
	v[x] = true;
	if (q.empty() || a[x] >= q[0]) q.push_back(a[x]);
	else {
		q.push_back(q[0]);
		q[0] = a[x];
	}
	for (int i = 0; i < e[x].size(); i++) 
		if (!v[e[x][i]]) dfs(e[x][i]);
}

int main() {
	int n,m;
	scanf("%d%d",&n,&m);
	for (int i = 0; i < n; i++) scanf("%d",&a[i]);
	
	while (m--) {
		int x,y;
		scanf("%d%d",&x,&y);
		e[x].push_back(y);
		e[y].push_back(x);
	}
	
	long long ans = 0, tot = 0;
	for (int i = 0; i < n; i++) if (!v[i]) {
		tot++;
		dfs(i);
		ans += q[0];
		for (int i = 1; i < q.size(); i++) sq.push_back(q[i]);
		q.clear();
	}
	
	if (tot < 2) {
		printf("0\n");
		return 0;	
	}
	
	if (sq.size() < tot - 2) {
		printf("Impossible\n");
		return 0;
	}
	
	sort(sq.begin(),sq.end());
	for (int i = 0; i < tot - 2; i++) ans += sq[i];
	printf("%lld\n",ans);
}

Measured memory_bytes: 7420
#include <stdio.h>
#include <string.h>
 
#define swap(a, b) {int tmp;tmp = a;a=b;b=tmp;}
 
int main(){
    char str[1001];
    char cmd[100];
    int n;
    int i;
    int m,a,b;
    char p[1001];
    char *ptr;
    gets(str);
    scanf("%d", &n);
    for(i = 0;i < n; i++){
        scanf("%s", cmd);
        if(strcmp(cmd, "print")==0)m = 0;
        if(strcmp(cmd, "reverse")==0)m = 1;
        if(strcmp(cmd, "replace")==0)m = 2;
        switch(m){
            case 0:
                scanf("%d %d", &a, &b);
                for(;a<=b;a++){
                    putchar(str[a]);
                }
                puts("");
            break;
            case 1:
                scanf("%d %d", &a, &b);
                for(;a<b;a++,b--){
                    swap(str[a],str[b]);
                }
            break;
            case 2:
                scanf("%d %d %s", &a, &b, &p);
                for(ptr = p;a<=b;a++,ptr++){
                    str[a] = *ptr;
                }
            break;
        }
    }
 
    return 0;
}

Measured memory_bytes: 588
/*
	Auther:_Destiny
	time:2020.5.10
*/
#include <bits/stdc++.h>
#define ll long long
#define N 100010
#define M 1010

using namespace std;
int a, b, c;
int k;

int read() {
	int s = 0, f = 0; char ch = getchar();
	while (!isdigit(ch)) f |= (ch == '-'), ch = getchar();
	while (isdigit(ch)) s = s * 10 + (ch ^ 48), ch = getchar();
	return f ? -s : s;
}

int main() {
	a = read(), b = read(), c = read(), k = read();
	int ans = 0;
	if (a >= k) {
		cout << k << "\n";
		return 0;
	} else {
		ans = a;
		k -= a;
		if (b >= k) {
			cout << ans << "\n";
			return 0;
		} else {
			k -= b;
			ans -= k;
			cout << ans << "\n";
			return 0;
		}
	}
}

Measured memory_bytes: 3636
#include <iostream>
#include <cmath>
#include <algorithm>
#include <climits>
#include <vector>
#include <string>
#include <set>
#include <iomanip>
#include <map>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
using ll = long long;
const int INF = 10000000;

int main(){
    int a, b; cin >> a >> b;
    cout << 6 - (a + b)<< endl;
    return 0;
}


Measured memory_bytes: 256
PROGRAM ATCODER

implicit none
character(len=10) :: str
character(len=2) :: mm, dd
integer :: m, d

read(*,'(a)') str   !ここが入力欄

mm = str(6:7)
dd = str(9:10)

read(mm,*) m
read(dd,*) d

if (m < 4) then
	write(*,'(a)') 'Heisei'
    stop
end if

if(m == 4 .and. d <=30) then
	write(*,'(a)') 'Heisei'
    stop
end if

write(*,'(a)') 'TBD'

END PROGRAM ATCODER

Measured memory_bytes: 640
// Best practice

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file 
#include <ext/pb_ds/tree_policy.hpp> 
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <functional> // for less 

#define int         long long
#define pb          emplace_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
 
typedef tree<pair<int,int>, null_type, less<pair<int,int>>, rb_tree_tag, tree_order_statistics_node_update> pbds; 

#define fbo find_by_order
#define ook order_of_key

signed main() {
   tezz
   
   float n,m,k;
   cin >> n >> m >> k;
//   k+=0.5;
   if(n>k){
       cout << 0 << endl;
       return 0;
   }
   k=k+0.5;
   int  ans=0;
   while((k-n)>=0){
       k-=n;
       ans+=m;
   }
   cout << ans << endl;
   
   return 0;
}

Measured memory_bytes: 256
import sys
import math
import fractions
import bisect
import queue
import heapq
import collections
import itertools
sys.setrecursionlimit(4100000)

MOD = int(1e9+7)
PI = 3.14159265358979323846264338327950288
INF = 1e18

'''
1行のint=====================================
N, K = map(int, input().split())
N, M = map(int, input().split())
A, B = map(int, input().split())

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

L, R = map(int, input().split())

1行のstring=================================
S, T = input().split()

1行の整数配列================================
P = list(map(int,input().split()))

A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
D = list(map(int,input().split()))

L = list(map(int,input().split()))
R = list(map(int,input().split()))

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

改行あり整数==================================
X = []
Y = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    X.append(x1)
    Y.append(y1)

A = []
for i in range(N):
    a=int(input())
    A.append(a)

Pair = []
for i in range(N):
    x1,y1=[int(i) for i in input().split()]
    Pair.append((x1, y1))
    
2次元整数配列=====================================
A = []
for i in range(N):
    tmp = list(map(int,input().split()))
    A.append(tmp)


N行M列の初期化====================================
dp = [[VAL] * RETU for i in range(GYO)]

'''



H, W = map(int, input().split())
S = []
for i in range(H):
    a=input()
    S.append(a)

# その方向に照らせる個数
right = [[0] * W for i in range(H)]
left = [[0] * W for i in range(H)]
up = [[0] * W for i in range(H)]
down = [[0] * W for i in range(H)]


for h in range(0, H):
    for w in range(1, W):

        if S[h][w-1] == "#" or S[h][w] == "#":
            left[h][w] = 0
        else:
            left[h][w] = left[h][w-1] + 1


for h in range(0, H):
    for w in range(W-2, -1, -1):
        if S[h][w+1] == "#" or S[h][w] == "#":
            right[h][w] = 0
        else:
            right[h][w] = right[h][w+1] + 1

for h in range(1, H):
    for w in range(0, W):
        if S[h-1][w] == "#" or S[h][w] == "#":
            up[h][w] = 0
        else:
            up[h][w] = up[h-1][w] + 1

for h in range(H-2, -1, -1):
    for w in range(0, W):
        if S[h+1][w] == "#" or S[h][w] == "#":
            down[h][w] = 0
        else:
            down[h][w] = down[h+1][w] + 1

ans = 0
for h in range(H):
    for w in range(W):
        
        if S[h][w] == "#":
            continue

        ans = max(ans, right[h][w] + left[h][w] + up[h][w] + down[h][w] + 1)

print(ans)




Measured memory_bytes: 191084
N = int(input())
P = [int(p) for p in input().split()]

count = 0
for n in range(1, N-1):
    if (P[n-1] < P[n] and P[n] < P[n+1]) or (P[n-1] > P[n] and P[n] > P[n+1]):
        count += 1

print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
#define possible(n) cout << ((n) ? "possible" : "impossible"  ) << endl
#define Size(n) (n).size()

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//long long int kaizyo(long long int hh){
  //  cmp=1;
    //while(hh>1){
      //  cmp=(cmp*hh)%MOD;
        //hh--;
    //}
    //return cmp;
//}
//long long int ruizyo(long long int aa, long long int bb){
  //  if(aa==0){
    //    return 1;
    //}
    //else if(aa%2==0){
      //  long long int tt=ruizyo(aa/2,bb);
        //return (tt*tt)%MOD;
    //}
    //else{
      //  return (ruizyo(aa-1,bb)*bb)%MOD;
    //}
//}フェルマ－のア


//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

//bool f[100001];//1000000以下の素数を調べよう！
//rrep(i,2,100001){
  //      f[i]=false;
    //}
//rrep(i,2,100001){
  //      if(!f[i]){
    //        for(int j=i+i;j<=100000;j+=i){
      //          f[j]=true;
        //    }
        //}
    //}
    //for(int i=3;i<=100000;i+=2){
      //  if(!f[i]){
        //    c[i]++;
      //  }
   // }

//visited=vector<vector<bool>>(10,vector<bool>(10,false));アを全部falseに


long long int n,cnt=0,ans=0,a[301][301],b,c,d,cmp,cmpp,m,h,w,x,y,sum=0,pos;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl=true;

int main(void){
       cin.tie(0);
    ios::sync_with_stdio(false);

       cin >> n;
       rep(i,n)rep(j,n)cin>>a[i][j];
       //ワーシャルフロイドをやって更新されたら-1
       rep(i,n){
           rep(j,n){
               rep(k,n){
                   if(a[i][j]>a[i][k]+a[k][j]){
                       Cout(-1);
                       return 0;
                   }
               }
           }
       }
       //たとえばaからbに行くのに入力の二次元配列で21とあるがcを経由することでaからc
       //までの距離11かつcからbに行くのに10ならば11+10=21よりその21は除かなければならないの実装
    
       rep(i,n){
           rep(j,n){
               rep(k,n){
                   if((a[j][i]>0&&a[i][k]>0&&a[j][k]>0)&&a[j][k]==a[j][i]+a[i][k]){
                       a[j][k]=0;
                   }
               }
           }
       }
       //残ったやつを足せば道路の長さに
       rep(i,n){
           rrep(j,i+1,n){
               ans+=a[i][j];
           }
       }
       Cout(ans);
       
return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
double n,k,pro,point,sum;
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		pro=1.0/n;
		point=i;
		while(point<k)
		{
			point*=2;
			pro/=2;
		}
		sum+=pro;
	}
	printf("%.15lf\n",sum);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long INF = 1LL << 60;

int main(){
  string s;
  cin >> s;

  if(s == "ABC"){
    cout << "ARC" << endl;
  }
  else if(s == "ARC"){
    cout << "ABC" << endl;
  }

  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/integer/common_factor.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

using std::string;
using std::vector;
using std::set;
using std::multiset;
using std::unordered_set;
using std::map;
using std::multimap;
using std::unordered_map;
using std::pair;
using std::cin;
using std::cout;

using boost::multiprecision::cpp_int;
using cpp_dec_float_1000 = boost::multiprecision::number<boost::multiprecision::cpp_dec_float<1000, boost::int128_type>>;

typedef uintmax_t    ull;
typedef intmax_t     ll;
typedef uint64_t     ul;
typedef uint32_t     ui;
typedef uint8_t      uc;

constexpr char CRLF  = '\n';
constexpr char SPACE = ' ';
constexpr char VECTOR_COUT_SEPARATOR = SPACE;
constexpr ll INF = 1000'000'007;
constexpr int MOD = 1000'000'007;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> std::ostream& operator<< (std::ostream& os, const std::vector<T>& vc) { for(auto it = vc.begin(); it != vc.end(); ++it) { if (std::next(it) == vc.end()) os << *it; else os << *it << VECTOR_COUT_SEPARATOR; } return os; }
template<class T1, class T2> inline std::ostream & operator<< (std::ostream & os, const std::pair<T1, T2> & p) { return os << p.first << ' ' << p.second; }
template<class T> T modinv(T a, T m) { T b = m, u = 1, v = 0; while (b) { T t = a / b; a -= t * b; boost::swap(a, b); u -= t * v; boost::swap(u, v); } u %= m; if (u < 0) u += m; return u; }
template<class T> inline bool isSosuu(const T& n) { if (n == T(1)) { return false; } for (T i = 2; i*i <= n; ++i) { if (n % i == 0) { return false; } } return true; }
template<class T> vector<vector<T>> split (const vector<T>& S, T delim) { vector<vector<T>> ret{}; vector<T> buff{}; for (auto c : S) { if (c == delim) { if (!buff.empty()) ret.push_back(buff); buff.clear(); } else { buff.push_back(c); } } if (!buff.empty()) ret.push_back(buff); return ret; }

struct Tmp
{
public:
  Tmp(int N);
};

Tmp::Tmp(int N){}

void solve(void)
{
  int N, M; cin >> N >> M;
  auto ans = (N - 1) * N / 2 + (M - 1) * M / 2;
  cout << ans << CRLF;
  return;
}

int main(void)
{
  std::ios_base::sync_with_stdio(false);
  std::cin.tie(0);

  solve();

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int  long long 
#define speedrap ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
double be(double a,int b,int mod) {if(b == 0) return 1; if(b%2 == 1) return (a*be(a,b-1,mod)); else return (be(a,b/2,mod)*be(a,b/2,mod));}
const int mod = 1e9 + 7;
#define PI 3.14159265359
#define pf push_front
#define pb push_back
#define bitcount __builtin_popcount
#define sc(a) scanf("%d", &a);
#define sz(s) (int)s.size()
#define eb emplace_back
#define pf push_front
#define mkp(x,y) make_pair(x,y)
#define all(x) x.begin(),x.end()
#define INF 0x3f3f3f3f
const int siz = 2*(1e6 + 10);
const int logi = 21;
const double epsilon = 1e-6;
int prime[siz];
int has[siz];
bool cmp(const int &a,const int &b)
{
  return (abs(a-b)>1);
}


signed main()
{
	#ifndef ONLINE_JUDGE
 	freopen("in.txt", "r", stdin);
 	freopen("out.txt", "w", stdout);
 	#else
// // online submission
 	#endif 
	speedrap
	int t;
	t = 1;
	//cin>>t;
	while(t--)
	{	
		int n,k;
		cin>>n>>k;
		set<int> st;

		for(int i = 1 ; i <= n ; i++)
		{
			st.insert(i);
		}

		while(k--)
		{
			int d;
			cin>>d;

			for(int i = 0 ; i <  d ; i++)
			{
				int g;
				cin>>g;
				st.erase(g);
			}
		}

		cout<<st.size();
	}
}



Measured memory_bytes: 3652
#include <iostream>
using namespace std;

void swap(int &, int &);

int main()
{
    int n, i, j, min, max;
    long sum = 0;
    
    cin >> n;
    
    int a[n];
    
    for(i = 0, sum = 0; i < n; i++) {
        cin >> a[i];
        sum += a[i];
    }
    
    for(i = 0; i <= n-1; i++) {
        for(j = 0; j <= n-(2+i); j++) {
            if(a[j] > a[j+1]) swap(a[j], a[j+1]);
        }
    }    
    
    cout << a[0] << ' ' << a[n-1] << ' ' << sum << endl;    
    
    return 0;
    
}

void swap(int &x, int &y)
{
    int z;
    
    z = y;
    y = x;
    x = z;
    
    return;
}


Measured memory_bytes: 3132