akhauriyash/Code-Regression huggingface dataset:
from collections import deque

h, w = map(int, input().split())
maze = [input() for _ in range(h)]

max_move = 0
for start_i in range(h):
  for start_j in range(w):
    if maze[start_i][start_j] == '.':
      queue = deque([(0, start_i, start_j)])
      yet = [[True] * w for _ in range(h)]
      yet[start_i][start_j] = False
      while queue:
        move, i, j = queue.popleft()
        if i != 0 and maze[i-1][j] == '.' and yet[i-1][j]:
          queue.append((move + 1, i - 1, j))
          yet[i-1][j] = False
        if i != h - 1 and maze[i+1][j] == '.' and yet[i+1][j]:
          queue.append((move + 1, i + 1, j))
          yet[i+1][j] = False
        if j != 0 and maze[i][j-1] == '.' and yet[i][j-1]:
          queue.append((move + 1, i, j - 1))
          yet[i][j-1] = False
        if j != w - 1 and maze[i][j+1] == '.' and yet[i][j+1]:
          queue.append((move + 1, i, j + 1))
          yet[i][j+1] = False
      if move > max_move:
        max_move = move

print(max_move)

Measured memory_bytes: 3444
import sys

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

if (R - L) >= 2019:
    print(0)
    sys.exit()

ans = 2018
L = L % 2019
R = R % 2019

if L >= R:
    print(0)
    sys.exit()
for i in range(L, R):

    for j in range(i + 1, R + 1):
        tmp = int((i * j) % inf)
        ans = min(ans, tmp)
        if ans == 0:
            break
    if ans == 0:
        break

print(ans)


Measured memory_bytes: 3064
//04-2.cpp

#include <iostream>
using namespace std;

int main()
{
	int n;
	string s;
	cin>>n>>s;
	
	//3pin, 0~9,0~9,0~9
	char res[1000][3];
	for(int i=0; i<1000; i++)
		{
			char bai=i/100+48;
			char shi=i/10%10+48;
			char ge=i%10+48;
			res[i][0]=bai;
			res[i][1]=shi;
			res[i][2]=ge; 
		}
	
	//循环遍历这个二维数组，先在字符串中寻找百位的数，如果找到了，记作left，找不到下个数 
	//再找个位的数，找到了记作right，找不到到下个数 
	//如果left+1<=right,寻找十位的数，找不到到下个数
	//十位数找到后，判断是否>left，<right，是的话计数+1，到下个数，不是的话找下个十位数
	//如果全都找过了， 到下个数
	int nc=0;
	for(int i=0;i<1000;i++){
		int l = s.find(res[i][0]);
		if(l==-1)
			continue;
		int r=s.rfind(res[i][2]);
		if(r==-1)
			continue;
		if(l+1>r)
			continue;
		int start=0;
		int pos;
		while((pos=s.find(res[i][1],start))!=-1){
			if(pos>l &&  pos<r)
				{
					nc++;
					break;
				}
			start=pos+1;
		}
	} 
	cout<<nc<<endl;
} 

Measured memory_bytes: 256
n = str(input())
n_1 = int(n[-1])

if n_1 == 3:
    print("bon")
elif (n_1 == 0) or (n_1 == 1) or (n_1 == 6) or (n_1 == 8):
    print("pon")
else:
    print("hon")

Measured memory_bytes: 9176
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    ll h1,m1,h2,m2,k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    ll st = h1*60 + m1;
    ll la = h2 * 60 + m2;
    if(la - st < k){
        cout << 0 << endl;
    }else{
        cout << la-st - k << endl;
    }
    return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <algorithm>
#include <vector>

#define MAX_N 100000

using namespace std;

typedef unsigned long long int uint64;

vector<uint64> S;
int N;

bool ctb(uint64 x)
{
	int able = false;
	for(int ofs = 0;ofs < N;ofs++)
	{
		auto itr = lower_bound(S.begin(),S.end(),S[ofs]+x);
		itr = lower_bound(itr,S.end(),*(itr)+x);
		itr = lower_bound(itr,S.end(),*(itr)+x);
		if(itr < S.begin()+ofs+N+1)
		{
			able = true;
		}
	}
	return able;
}

int main(void)
{
	cin >> N;
	uint64 s = 0;
	uint64 t;
	S.push_back(0);
	for(int i = 0;i < N;i++)
	{
		cin >> t;
		s += t;
		S.push_back(s);
	}
	for(int i = 0;i < N;i++)
	{
		S.push_back(S[i+1] + S[N]);
	}
	S.push_back(S[2*N]+1);
	uint64 L = S[N-1];
	uint64 S = 1;
	uint64 m;
	while(S != L)
	{
		m = (((L-S)+1)/2)+S;
		if(ctb(m))
		{
			S = m;
		}
		else
		{
			L = m-1;
		}
	}
	cout << S << endl;
}

Measured memory_bytes: 4912
use whiteread::parse_line;

fn main() {
    let n: usize = parse_line().unwrap();
    let mut v: Vec<i32> = parse_line().unwrap();
    let mut k: usize = 0;
    let mut t: usize = 0;

    while t < n {
        if v[t] % 2 == 0{
            v[t] = v[t] / 2;
            k = k + 1;
            t = 0;
        } else {
            t = t + 1;
        }
    }

    println!("{}", k);
}


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

using namespace std;

int main()
{
   //int t,l=1;
   
   //cin>>t;
   
   //while(t--){
       long long int n;
       cin>>n;
       
       long long a[n],b[n],ans[n],ca[n+1],cb[n+1];
       memset(ans,0,sizeof(ans));
       memset(ca,0,sizeof(ca));
       memset(cb,0,sizeof(cb));
       
       for(long long int i = 0 ; i < n ; i++){
           cin>>a[i];
           ca[i+1] = a[i] + ca[i];
       }
       for(long long int i = 0 ; i < n ; i++){
           cin>>b[i];
           cb[i+1] = b[i] + cb[i];
       }
       
       
       for(long long int i = 1 ; i <= n ; i++){
           ans[i-1] = ca[i] + cb[n] - cb[i-1];
       }
       
       sort(ans,ans+n);
       
       cout<<ans[n-1];
       //l++;
   //}
   
   return 0;

}

Measured memory_bytes: 3600
# -*- coding: utf-8 -*-
import sys
from collections import Counter
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    N,K,L=map(int,input().split())
    class UnionFind:
        def __init__(self,n):
            self.par=[i for i in range(n)]
            self.siz=[1]*n
            
        def root(self,x):
            while self.par[x]!=x:
                self.par[x]=self.par[self.par[x]]
                x=self.par[x]
            return x
        
        def unite(self,x,y):
            x=self.root(x)
            y=self.root(y)
            if x==y:
                return False
            if self.siz[x]<self.siz[y]:
                x,y=y,x
            self.siz[x]+=self.siz[y]
            self.par[y]=x
            return True
        
        def is_same(self,x,y):
            return self.root(x)==self.root(y)
        
        def size(self,x):
            return self.siz[self.root(x)]
    d=UnionFind(N)
    t=UnionFind(N)
    for _ in range(K):
        p,q=map(int1,input().split())
        d.unite(p,q)
    for _ in range(L):
        r,s=map(int1,input().split())
        t.unite(r,s)
    l=[]
    for i in range(N):
        l.append((d.root(i),t.root(i)))
    c=Counter(l)
    for i in range(N):
        print(c[l[i]],end=' ')

if __name__ == '__main__':
    main()


Measured memory_bytes: 97324
from collections import Counter
N = int(input())
XY = []
XY_cand = []
for _ in range(N):
        x, y = map(int, input().split())
        XY.append((x,y))
for (x, y) in XY:
        for (i, j) in XY:
                if i != x or j != y:
                        XY_cand.append((i-x, j-y))
if XY_cand == []:
        print(N)
else:
        print(N - Counter(XY_cand).most_common()[0][1])

Measured memory_bytes: 3956
Imports System.Console
Module Module1
    Sub Main()
        Dim s1 As String = ReadLine()
        Dim s2 As String = ReadLine()
        Dim c1() As Char = s1.ToCharArray
        Dim c2() As Char = s2.ToCharArray
        Dim ans As Integer
        For i = 0 To c1.Length - 1
            If c1(i) <> c2(i) Then
                ans += 1
            End If
        Next
        WriteLine(ans)
    End Sub
End Module


Measured memory_bytes: 28300
#include <iostream>
#define inf 1e9

using namespace std;

int N, T;

int main(void)
{
	cin >> N >> T;
	int ans = inf;
	int c, t;
	for(int i = 0; i < N; i++){
		cin >> c >> t;
		if(t <= T) ans = min(ans, c);
	}
	if(ans >= inf) cout << "TLE" << endl;
	else cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
def resolve():
    H, W = map(int, input().split())
    s_list = []
    answer = [[0] * W for i in range(H)]
    for i in range(H):
        s_list.append(list(input()))

    for h, s_h in enumerate(s_list):
        for w, s_h_w in enumerate(s_h):
            count = 0
            if s_h_w == '.':
                continue
            else:
                for x in range(-1,2):
                    target_x = w + x
                    if target_x < 0 or target_x >= W:
                        continue
                    for y in range(-1,2):
                        target_y = h + y
                        if target_y < 0 or target_y >= H:
                            continue
                        if s_list[target_y][target_x] != '#':
                            answer[target_y][target_x] += 1
                        else:
                            answer[target_y][target_x] = '#'

    for i in answer:
        print("".join(map(str,i)))

resolve()


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

char da[14][14];
int an,sx,sy,gx,gy,x,y,z,m[14][14],a[36],c[14][14],mn[36],dx[4]={1,0,-1,0},dy[4]={0,-1,0,1};

int mkda(int x1,int y1,int u,int g) {
	int k,f;
	da[y1][x1]='.'; m[y1][x1]=u; mn[u]++; f=0;
	for (k=0;k<4;k++) {
		 if (da[y1+dy[k]][x1+dx[k]]=='X') { f=1; mkda(x1+dx[k],y1+dy[k],u,g+1);}
		}
	if (f==0 && g==0) { da[y1][x1]='#'; mn[u]=0; return 1;}
	return 0;	
	}

int dfs(int x1,int y1,int d) {
	int i,j,x2,y2;
	if (da[y1][x1]=='g' || d+1>=an) { if (d+1<an) an=d+1; return 1;}
	for (i=0;i<4;i++) {
		x2=x1+dx[i]; y2=y1+dy[i];
		 if (c[y2][x2]==0 && da[y2][x2]!='#') {
				z=0;
				if (m[y2][x2]>=0) if (a[m[y2][x2]]+1>mn[m[y2][x2]]/2) continue;
				for (j=0;j<4 ;j++) z+=c[y2+dy[j]][x2+dx[j]];   
					if (z<2) {
					for (j=0;j<4;j++) {if (da[y2+dy[j]][x2+dx[j]]!='#' && m[y2+dy[j]][x2+dx[j]]<0 && c[y2+dy[j]][x2+dx[j]]==0)
                       if (c[y2+dy[j]*2][x2+dx[j]*2]==1) z=2;}
                    if (z<2) {    	
					c[y2][x2]=1;
					if (m[y2][x2]>=0) { a[m[y2][x2]]++; dfs(x2,y2,d+1); a[m[y2][x2]]--;} else dfs(x2,y2,d+1);
					c[y2][x2]=0;
				    }
				    }
			}
		}
		return 0;
} 
int main() {
	int i,j,k,e;
	char ch[14];
	while(cin >> x >> y && x>0) {
	for (i=0;i<36;i++) mn[i]=0;	
	for (i=1;i<=y;i++) { cin >> ch;
	     da[i][0]=da[i][x+1]='#'; for (j=0;j<x;j++) da[i][1+j]=ch[j]; 
	     for (j=0;j<=x+1;j++) { m[i][j]=-1; da[0][j]=da[y+1][j]='#';
	      if (da[i][j]=='S') {sx=j; sy=i;}
	      if (da[i][j]=='G') {gx=j; gy=i;}
	       }
	   }
	e=1; k=-1;
	while(e>0) {e=0; for (i=1;i<=y;i++) for (j=1;j<=x;j++) {
		if (da[i][j]=='X') { e=1; k++; k-=mkda(j,i,k,0);}}}
	for (i=0;i<=y+1;i++) for (j=0;j<=x+1;j++) c[i][j]=0;
	for (i=0;i<36;i++) a[i]=0;	
	an=999; c[sy][sx]=1;
	for (i=0;i<4;i++) if (da[gy+dy[i]][gx+dx[i]]!='#') da[gy+dy[i]][gx+dx[i]]='g';
	dfs(sx,sy,0);
	cout << an << endl;
	}  	 	
	return 0;
}

Measured memory_bytes: 1176
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
using namespace std;
int inf = 1000000000;

int main(void) {
  int n, m;
  while( cin >> n >> m ){
    if( n == 0 && m == 0 ) break;
    vector<bool> v(n+1, false);
    v[1] = true;
    vector< vector<int> > d(m, vector<int>(3));
    for(int i=0; i<m; i++){
      for(int j=0; j<3; j++) cin >> d[i][j];
    }
    sort(d.begin(), d.end());
    for(int i=0; i<m; i++){
      if( v[ d[i][1] ] ) v[ d[i][2] ] = true;
    }
    int cnt = 0;
    for(int i=0; i<=n; i++) cnt += v[i];
    cout << cnt << endl;
  }

  return 0;
}

// EOF

Measured memory_bytes: 3888
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func maxInt64(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumInt64(a []int64) int64 {
	var ret int64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcdInt64(m, n int64) int64 {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcmInt64(m, n int64) int64 {
	return m / gcdInt64(m, n) * n
}

// sort ------------------------------------------------------------

type int64Array []int64

func (s int64Array) Len() int           { return len(s) }
func (s int64Array) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s int64Array) Less(i, j int) bool { return s[i] < s[j] }

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------

func main() {
	n := readInt()

	cnt := 0
	for i := 0; i < n; i++ {
		p := readInt()
		if p != i+1 {
			cnt++
		}
	}
	if cnt == 0 || cnt == 2 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 640
#include "bits/stdc++.h"
 
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
//----------------------------------------------------------------

// int MOD = 998244353;
int MOD = 1000000007;

ll bitpow(ll x,ll n){
    ll ans = 1;
    while(n > 0){
        if(n%2 == 1) ans = ans * x % MOD;
        x = x * x %MOD;
        n = n >> 1;
    }
    return ans;
}

//高速nCk
#define N 2000010
int fac[N+1];
int inv[N+1];
ll COM(ll n,ll k){
    return fac[n]*inv[k]%MOD*inv[n-k]%MOD;
}
    



//----------------------------------------------------------------
signed main(){
   
    int x,y;
	cin >> x >> y;

	if((x+y)%3 != 0){
		cout << 0 << endl;
		return 0;
	}

	if(2*x < y|| 2*y < x ){
		cout << 0 << endl;
		return 0;
	}

	fac[0] = 1;
    inv[0] = 1;
    for(int i = 1;i <= N;i++){
        fac[i] = fac[i-1]*i%MOD;
        inv[i] = bitpow(fac[i],MOD-2)%MOD;
    }


	int n = (x+y)/3;
	int X = x - n;
	int Y = n - X;

	cout << fac[X+Y]*inv[X]%MOD*inv[Y]%MOD << endl;
	// cout << n << " " <<  X << " " << Y << endl;


	

	return 0;
}

//----------------------------------------------------------------

// g++ -std=c++14 code1.cpp
// sudo pip3 install --upgrade online-judge-tools
// rm -r -f test;oj dl https://code-festival-2018-quala.contest.atcoder.jp/tasks/code_festival_2018_quala_c
// rm -r -f test;oj dl https://nikkei2019-2-qual.contest.atcoder.jp/tasks/nikkei2019_2_qual_b
// rm -r -f test;oj dl https://abc145.contest.atcoder.jp/tasks/abc145_b

Measured memory_bytes: 31616
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep1(i,n) for (int i = 1; i <= (n); i++)
#define repi(i,a,b) for (int i = (a); i < (b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;

int main() {
  int n, m;
  cin >> n >> m;
  
  cout << (n-1)*(m-1) << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
 
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int[] fpoint=new int[n];
        int[] tage=new int[m];
        int[][] who=new int[m][n];
        for(int i=0;i<m;i++){
             tage[i]=sc.nextInt();
        }
        for(int j=0;j<m;j++){
            for(int i=0;i<n;i++){
                who[j][i]=sc.nextInt();
            }
        }
        sc.close();
        for(int i=0;i<m;i++){
            for(int j=0;j<n;j++){
                if(tage[i]==who[i][j]){
                    fpoint[j]++;
                }else{
                    fpoint[tage[i]-1]++;
                }
 
            }
        }
 
        for(int i=0;i<n;i++){
            System.out.printf("%d\n", fpoint[i]);
            }
        }
 
}

Measured memory_bytes: 40712
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

/*
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()
*/

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-9;

ll count(string& s) {
    map<char, int> mp;
    for(ll i = 0; i < s.size(); i++) {
        mp[s[i]]++;
    }
    return mp.size();
}

void solve() {
    ll n;
    cin >> n;
    string s;
    cin >> s;
    vvll count(n + 1, vll(26));
    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j < 26; j++) {
            count[i + 1][j] = count[i][j] + (s[i] - 'a' == j);
        }
    }
    ll ans = 0;
    for(ll i = 1; i <= n - 1; i++) {
        ll ans_ = 0;
        for(ll j = 0; j < 26; j++) {
            ans_ += count[i][j] && count[n][j] - count[i][j];
        }
        chmax(ans, ans_);
    }
    cout << ans << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 256
people = []
all = gets.chomp.to_i
people.push(gets.chomp.to_i)
people.push(gets.chomp.to_i)
people.push(gets.chomp.to_i)
people.push(gets.chomp.to_i)
people.push(gets.chomp.to_i)

x = people.index(people.min)
x_value = people.min

if all % x_value == 0
  y = all / x_value
else
  y = all / x_value + 1
end

z = 4 - people.index(people.min)

puts x + y + z

Measured memory_bytes: 1788
n, m = map(int, input().split())
ans = 0
lstn = [False for i in range(n)]
lstc = [0 for i in range(n)]
for i in range(m):
  p, s = input().split()
  pp = int(p)
  status = lstn[pp-1]
  if not status:
    if s == "WA":
      lstc[pp-1] += 1
    else:
      lstn[pp-1] = True
seikai = lstn.count(True)
for i in range(len(lstn)):
  tf = lstn[i]
  if tf:
    ans += lstc[i]
print(seikai, ans)

Measured memory_bytes: 4760
program main
   implicit none
   character x,y
   read(*,*)x,y
   if(iachar(x)>iachar(y))then
      write(*,'(a1)')">"
   elseif(iachar(x)==iachar(y))then
   write(*,'(a1)')"="
   else
   write(*,'(a1)')"<"
   endif
end program main


Measured memory_bytes: 768
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<cmath>
using namespace std;
int main(){
	int x,y,z,n;
	while(~scanf("%d%d%d",&x,&y,&z)){
	n=(x-z)/(y+z);
	printf("%d\n",n);
	}
}


Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Solve s= new Solve();
		s.solve();
	}

}
class Solve{
	 Scanner sc = new Scanner(System.in) ;

	 void solve() {
	 int N=sc.nextInt();
	 int[] d= new int[N];
	 for(int i=0;i<N;i++) {
		 d[i]=sc.nextInt();
	 }
	 Arrays.sort(d);
	 int half=(N/2)-1;

	 System.out.println(d[half+1]-d[half]);
	 


	 }
}

Measured memory_bytes: 49048
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = 1001002003004005006ll;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	deque<int> res;
	rep(i, n) {
		int it = lower_bound(all(res), a[i]) - res.begin();
		if (!it) res.emplace_front(a[i]);
		else res[it - 1] = a[i];
	}
	cout << res.size() << endl;
	return 0;
}

Measured memory_bytes: 1024
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int a = Integer.parseInt(s);
		int b = sc.nextInt();
		int count = 0;
		char[] c = s.toCharArray();
		for(int i = a; i <= b; i++) {
			s = String.valueOf(i);
			c = s.toCharArray();
			if(c[0] == c[4] && c[1] == c[3]) {
				count++;
			}
		}
		System.out.println(count);
		sc.close();
	}

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	public static void permutation(String q, String ans) { //Call permutation(String, "",) from outside
		if (q.length() <= 1)
			System.out.println(ans + q); //Fill in processing
		else
			for (int i = 0; i < q.length(); i++)
				permutation(q.substring(0, i) + q.substring(i + 1), ans + q.charAt(i));
	}

	public static void combination(String q, String ans, int k) { //Call combination(String, "", n) from outside (nCr)
		if (ans.length() == k)
			System.out.println(ans); //Fill in processing
		else
			while (q.length() > 0) {
				combination(q.substring(1), ans + q.charAt(0), k);
				q = q.substring(1);
			}
	}

	long combination(int n, int r, int m) { //nCr mod m
		long[][] Combination = new long[n + 1][n + 1];
		for (int i = 0; i <= n; i++) {
			Combination[i][0] = 1;
			for (int j = 1; j <= i; j++)
				Combination[i][j] = (Combination[i - 1][j - 1] + Combination[i - 1][j]) % m;
		}
		return Combination[n][r];
	}

	int gcd(int a, int b) {
		if (a < b) {
			int c = a;
			a = b;
			b = c;
		}
		if (b == 0)
			return a;
		else
			return gcd(b, a % b);
	}

	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 30292
#include<bits/stdc++.h>
#define mo 1000000007
#define pi 3.1415926535898
#define eps 1e-9 
using namespace std;
long long read(){
    long long xx=0,flagg=1;
    char ch=getchar();
    while((ch<'0'||ch>'9')&&ch!='-')
        ch=getchar();
    if(ch=='-'){
        flagg=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        xx=xx*10+ch-'0';
        ch=getchar();
    }
    return xx*flagg;
}
void pus(long long xx,long long flagg){
    if(xx<0){
        putchar('-');
        xx=-xx;
    }
    if(xx>=10)
        pus(xx/10,0);
    putchar(xx%10+'0');
    if(flagg==1)
        putchar(' ');
    if(flagg==2)
        putchar('\n');
    return;
}
long long n,i,j,k,a,b,d,p1,p2,l,r,ll,rr,zz[100005],du[100005],cf[100005],ans;
long long maxx(long long u,long long v){
	return u>v?u:v;
}
long long abss(long long v){
	return v<0?-v:v;
}
struct nyh{
	long long x,y,id,flag;
}o[100005];
bool cmp(nyh u,nyh v){
	return u.x<v.x||u.x==v.x&&u.y<v.y;
}
long long zzz(long long z){
	if(zz[z]==z) return z;
	return zz[z]=zzz(zz[z]);
}
void lj(int u,int v){
	p1=zzz(u);
	p2=zzz(v);
	zz[p1]=p2;
}
int main(){
    //freopen("mate.in","r",stdin);
    //freopen("teleport.in","w",stdout);
    n=read();a=read();b=read();
    o[a].flag=1;
    o[b].flag=2;
    for(i=1;i<=n;i++){
    	p1=read();
    	p2=read();
    	o[i].x=p1+p2;
    	o[i].y=p1-p2;
    	o[i].id=i;
    }
    d=maxx(abss(o[a].x-o[b].x),abss(o[a].y-o[b].y));
	sort(o+1,o+n+1,cmp);
	for(i=1;i<=n;i++)
		zz[i]=i;
	l=1;r=0;
	for(i=1;i<=n;i++){
		while((o[r+1].x-o[i].x<d||o[r+1].x-o[i].x==d&&o[r+1].y-o[i].y<=d)&&r<n)
			r++;
		while((o[l].x-o[i].x<d||o[l].x-o[i].x==d&&o[l].y-o[i].y<-d)&&l<=n)
			l++;
		if(l<=r){
			cf[l]++;
			cf[r]--;
			lj(o[i].id,o[l].id);
			du[o[i].id]+=r-l+1;
		}
		swap(o[i].x,o[i].y);
	}
	for(i=1;i<=n;i++){
		cf[i]+=cf[i-1];
		if(cf[i]!=0)
			lj(o[i].id,o[i+1].id);
	}
	for(i=1;i<=n;i++)
		cf[i]=0;
	sort(o+1,o+n+1,cmp);
	l=1;r=0;
	for(i=1;i<=n;i++){
		while((o[r+1].x-o[i].x<d||o[r+1].x-o[i].x==d&&o[r+1].y-o[i].y<=d)&&r<n)
			r++;
		while((o[l].x-o[i].x<d||o[l].x-o[i].x==d&&o[l].y-o[i].y<-d)&&l<=n)
			l++;
		if(o[r].y-o[i].y==d)
			rr=r-1;
		else
			rr=r;
		if(o[i].y-o[l].y==d)
			ll=l+1;
		else
			ll=l;
		if(ll<=rr){
			cf[ll]++;
			cf[rr]--;
			lj(o[i].id,o[ll].id);
			du[o[i].id]+=rr-ll+1;
		}
	}
	for(i=1;i<=n;i++){
		cf[i]+=cf[i-1];
		if(cf[i]!=0)
			lj(o[i].id,o[i+1].id);
	}
	for(i=1;i<=n;i++)
		if(o[i].flag!=0){
			if(o[i].flag==1)
				p1=zzz(o[i].id);
			else
				p2=zzz(o[i].id);
		}
	for(i=1;i<=n;i++)
		if(zzz(i)==p1||zzz(i)==p2)
			ans=ans+du[i];
	pus(ans,2);
	return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#define FOR(i, begin, end) \
    for (int i = (begin), i##_end_ = (end); i < i##_end_; i++)
#define IFOR(i, begin, end) \
    for (int i = (end)-1, i##_begin_ = (begin); i >= i##_begin_; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
//#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    if (v.size() > 0) {
        os << v[v.size() - 1] << endl;
    }
    return os;
}

int main() {
    int n;
    cin>>n;
    int ac = 0, wa = 0, tle = 0, re = 0;
    REP(i, n) {
        string s;
        cin >> s;
        if (s == "AC"){
            ++ac;
        }else if (s == "WA"){
            ++wa;
        }else if (s == "TLE"){
            ++tle;
        }else{
            ++re;
        }
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
}

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

int main(){

    int n,k;
    cin >> n >> k;
    vector<int> h(n);
    for(int i=0; i<n; i++) cin >> h.at(i);

    sort(h.begin(),h.end());

    int ans=1e9,d;
    for(int i=0; i<n-k+1; i++){
        d=h.at(k+i-1)-h.at(i);
        ans=min(ans,d);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3676
#include<iostream>
#include<vector>
#include<string>

int main(){
    int n, m;
    std::cin >> n >> m;
    std::vector<int> val(n, -1);
    std::vector<int> s(m), c(m);
    for(int i = 0; i < m; i++){
        std::cin >> s[i] >> c[i];
        s[i]--;
        if(val[s[i]] == -1){
            val[s[i]] = c[i];
        }else if(val[s[i]] != c[i]){
            // 矛盾した条件
            std::cout << -1 << std::endl;
            return 0;
        }
    }

    // 指示なし
    if(m == 0){
        if(n == 1) std::cout << 0 << std::endl;
        else if(n == 2) std::cout << 10 << std::endl;
        else std::cout << 100 << std::endl;
        return 0;
    }

    if(val[0] == 0 && n == 1){
        std::cout << 0 << std::endl;
    }else if(val[0] == 0){
        std::cout << -1 << std::endl;
    }else{
        int ans = 0;
        int base = 1;
        for(int i = 0; i < n; i++){
            if(val[n - 1 - i] != -1){
                ans += base * val[n - 1 - i];
            }
            base *= 10;
        }
        // 最上位の桁だけは0はNG
        if(val[0] == -1){
            ans += base / 10;
        }

        std::cout << ans << std::endl;
    }

    return 0;
}


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

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

int main()
{
    int N;
    cin >> N;
    vector<int> A(N);
    int maxA = 0;
    for (int i=0; i<N; i++)
    {
        int num;
        cin >> num;
        A[i]=num;
        maxA = max(maxA, num);
    }

    vector<int> hurui(maxA+1, 0);
    for (int i=0; i<N; i++)
    {
        hurui[A[i]]++;
    }

    for (int i=1; i<=maxA/2; i++)
    {
        if (hurui[i]>=1)
        {
            //cout << hurui << endl;
            for (int j=2; j*i<=maxA; j++)
            {
                hurui[i*j]=0;
            }
        }
    }
    int result=0;
    for (int i=1; i<=maxA; i++)
    {
        if (hurui[i]==1) result++;
    }

    cout << result << endl;
}

Measured memory_bytes: 7844
# Ruby (2.3.3) のとき最速だったどなたかのコード
# 私の書いたコードではないが速度比較ため提出

(n,k),a,f=$<.map{|l|l.split.map &:to_i}
m=a.sort.zip f.sort.reverse
p (0..2**40).bsearch{|i|
  s=0
  m.each{|a,f|(0<x=a-i/f)&&s+=x}
  s<=k
}

Measured memory_bytes: 54880
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <queue>
#include <memory>
#include <fstream>

#pragma GCC optimize("no-stack-protector,Ofast,unroll-loops,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,popcnt,abm,mmx,tune=native,avx,avx2")

#define int long long
#define ld long double
#define eb emplace_back
#define pb pop_back
#define mp make_pair
#define ss second
#define ff first
#define sqr(x) (x) * (x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pii pair < int, int >
#define vi vector < int >
#define vvi(x, y) vector < vi > (x, vi(y))

typedef int(*func)(int a, int b);

using namespace std;

random_device rd;
mt19937 get_rand(rd());

template < typename T1, typename T2 >
istream& operator>>(istream& in, pair < T1, T2 >& p) {
	in >> p.ff >> p.ss;
	return in;
}

template < typename T1, typename T2 >
ostream& operator<<(ostream& out, pair < T1, T2 >& p) {
	out << p.ff << ' ' << p.ss;
	return out;
}

template < typename T1 >
istream& operator>>(istream& in, vector < T1 >& v) {
	for (int i = 0; i < sz(v); i++)
		in >> v[i];
	return in;
}

template < typename T1 >
ostream& operator<<(ostream& out, vector < T1 >& v) {
	for (int i = 0; i < sz(v); i++)
		out << v[i] << ' ';
	out << '\n';
	return out;
}

int gcd(int a, int b) {
	return (!a ? b : gcd(b % a, a));
}

const int INF = 1e9 + 7;
const int B = 100003;
const int MOD = 998244353;
const ld EPS = 1e-9;
const ld PI = 3.14159265358979323;
const int MAXLL = 9223372036854775807;

int a[50], b[50], c[50], d[50], A[50];
int n, m, q;
int res = 0;

void rec(int p, int k) {
	if (p == n) {
		int s = 0;
		for (int i = 0; i < q; i++)
			if (A[b[i] - 1] - A[a[i] - 1] == c[i])
				s += d[i];
		res = max(res, s);
		return;
	}
	for (int i = k; i <= m; i++) {
		A[p] = i;
		rec(p + 1, i);
	}
}

signed main() {
	//ifstream cin("kdivision.in");
	//ofstream cout("kdivision.out");
#ifdef _LOCAL
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	srand(time(NULL));

	int ttt = 1;
	//cin >> ttt;
	while (ttt--) {
		cin >> n >> m >> q;
		for (int i = 0; i < q; i++) 
			cin >> a[i] >> b[i] >> c[i] >> d[i];
		rec(0, 1);
		cout << res << '\n';
	}
	return 0;
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define Rint register int
using namespace std;
typedef long long LL;
const int N = 100003;
int n, m, cnt[3], ecnt, dis[N];
LL ans;
bool flag;
vector<int> E[N], Er[N];
inline void dfs(int x){
	++ cnt[dis[x]];
	for(Rint v : E[x]){
		++ ecnt;
		if(dis[v] == -1){
			dis[v] = (dis[x] + 1) % 3; dfs(v);
		} else if(dis[v] != (dis[x] + 1) % 3) flag = true;
	}
	for(Rint v : Er[x])
		if(dis[v] == -1){
			dis[v] = (dis[x] + 2) % 3; dfs(v);
		} else if(dis[v] != (dis[x] + 2) % 3) flag = true;
}
int main(){
	scanf("%d%d", &n, &m);
	memset(dis, -1, sizeof dis);
	for(Rint i = 1;i <= m;i ++){
		int a, b;
		scanf("%d%d", &a, &b);
		E[a].push_back(b);
		Er[b].push_back(a);
	}
	for(Rint i = 1;i <= n;i ++) if(dis[i] == -1){
		dis[i] = flag = cnt[0] = cnt[1] = cnt[2] = ecnt = 0; dfs(i);
		if(flag) ans += (LL) (cnt[0] + cnt[1] + cnt[2]) * (cnt[0] + cnt[1] + cnt[2]);
		else if(!cnt[1] || !cnt[2]) ans += ecnt;
		else ans += (LL) cnt[0] * cnt[1] + (LL) cnt[1] * cnt[2] + (LL) cnt[2] * cnt[0];
	}
	printf("%lld", ans);
}

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

typedef long long ll;

using vi = vector<int>;
using vl = vector<long long int>;
using vii = vector<vector<int>>;
using vll = vector<vector<long long int>>;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
       const int INF=1e9+7;
 int ans=-1,sum=0;
 int n,m;
 cin>>n>>m;
 ll arr[n];
 for(int i=0;i<m;i++)
 {
  cin>>arr[i];
  sum+=arr[i];
 }
 ans=max(ans,n-sum);
 cout<<ans<<endl;
return 0;

}




Measured memory_bytes: 3724
import Control.Applicative
import Control.Monad
import qualified Data.Map as M
import Data.List
main = do
 _ <- getLine
 a_s <- (map negate . map read . words) <$> getLine
 print $ analyze a_s

analyze :: [Integer] -> Integer
analyze input = foo arr
 where arr = take 2 . filter ((>1) . snd) . sort . M.toList $ M.fromListWith (+) [(c, 1) | c <- input]

foo [] = 0
foo [(x,u)]
 | u >= 4 = x*x
foo [(x,u),(y,_)]
 | u < 4 = x*y
 | otherwise = x*x
 



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

int main() {
  int n, d;
  cin >> n >> d;
  if (n % (2 * d + 1) == 0) cout << n / (2 * d + 1) << endl;
  else cout << n / (2 * d + 1) + 1 << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset((a),0,sizeof(a));
#define MEM_1(a) memset((a),-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef double db;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 998244353;
ll POW(ll a, ll b, ll MMM = MOD) {ll ret=1; for(;b;b>>=1,a=(a*a)%MMM)if(b&1)ret=(ret*a)% MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1,1,1,-1,-1 }, dy[] = { 1,0,-1,0,1,-1,1,-1 };

int main() {
	int n;
	scanf("%d",&n);
	printf("%d\n",n*(n-1)/2-n/2);
	fup(i,1,n,1)fup(j,i+1,n,1)if(i+j!=n/2*2+1)printf("%d %d\n",i,j);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define INF 1000000000000 //10^12

int main(){
    ll a,b,n;
    cin >>a>>b>>n;
    ll x=min(b-1,n);

    cout<< (ll)(a*x)/b - a*(ll)(x/b) <<endl;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  map<string,int> A;
  while(N--){
    string S;
    cin>>S;
    A[S]++;
  }
  vector<string> S={"AC","WA","TLE","RE"};
  for(string s:S)
    cout<<s<<" x "<<A[s]<<endl;
}

Measured memory_bytes: 3636
#include<stdio.h>

int main(void){
  
  int a,b,c,d;
  char s[10];
  
  scanf("%s",s);
  if(s[2]==s[3] && s[4] == s[5])
    printf("Yes\n");
  else
    printf("No\n");
  
  return 0;
}
  

Measured memory_bytes: 1660
#include<bits/stdc++.h>
using namespace std;
long long int ans[505];
int main(){
    int n;
    cin >> n;
    long long int c[n],s[n],f[n];
    for(int i=0;i<n-1;i++){
        cin >> c[i] >> s[i] >> f[i];
        for(int j=0;j<=i;j++)ans[j] = max(((ans[j]+f[i]-1)/f[i])*f[i],s[i])+c[i];
    }
    for(int i=0;i<n;i++)cout << ans[i] << endl;
}

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

int main(){
    
    int H, W;
    cin >> H >> W;
    
    vector<string> S(H);
    for(int i=0;i<H;i++)    cin >> S.at(i);
    
    if(S.at(0).at(0) == '#' && S.at(0).at(1) == '.' && S.at(1).at(0) == '.'){
        cout << "No" << endl;
        goto Exit;
    }else if(S.at(0).at(W-1) == '#' && S.at(0).at(W-2) == '.' && S.at(1).at(W-1) == '.'){
        cout << "No" << endl;
        goto Exit;
    }else if(S.at(H-1).at(0) == '#' && S.at(H-1).at(1) == '.' && S.at(H-2).at(0) == '.'){
        cout << "No" << endl;
        goto Exit;
    }else if(S.at(H-1).at(W-1) == '#' && S.at(H-1).at(W-2) == '.' && S.at(H-2).at(W-1) == '.'){
        cout << "No" << endl;
        goto Exit;
    }

    for(int i=1;i<W-1;i++){
        if(S.at(0).at(i) == '#' && S.at(0).at(i-1) == '.' && S.at(0).at(i+1) == '.' && S.at(1).at(i) == '.'){
            cout << "No" << endl;
            goto Exit;
        }else if(S.at(H-1).at(i) == '#' && S.at(H-1).at(i-1) == '.' && S.at(H-1).at(i+1) == '.' && S.at(H-2).at(i) == '.'){
            cout << "No" << endl;
            goto Exit;
        }
    }
    
    for(int i=1;i<H-1;i++){
        if(S.at(i).at(0) == '#' && S.at(i-1).at(0) == '.' && S.at(i+1).at(0) == '.' && S.at(i).at(1) == '.'){
            cout << "No" << endl;
            goto Exit;
        }else if(S.at(i).at(W-1) == '#' && S.at(i-1).at(W-1) == '.' && S.at(i+1).at(W-1) == '.' && S.at(i).at(W-2) == '.'){
            cout << "No" << endl;
            goto Exit;
        }
    }

    for(int i=1;i<H-1;i++){
        for(int j=1;j<W-1;j++){
            if(S.at(i).at(j) == '#'&&S.at(i).at(j-1) == '.'&&S.at(i).at(j+1) == '.'&&S.at(i-1).at(j) == '.'&&S.at(i+1).at(j) == '.'){
                cout << "No" << endl;
                goto Exit;
            }
        }
    }

    
    cout << "Yes" << endl;
    
Exit:
    ;
    
    return 0;
    
}





Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n, h, max, ans int
	fmt.Scan(&n, &h)
	ans++
	max = h
	for i := 1; i < n; i++ {
		fmt.Scan(&h)
		if max <= h {
			ans++
			max = h
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
struct pos{
    int pos;
    int step;
    int round;
};
bool mark[100001][3];
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int i;
    int n, m;
    int u, v;
    int s, t;
    cin >> n >> m;
    vector<vector<int>> vec(100001);
    for(i=0; i<m; i++){
        cin >> u >> v;
        vec[u].push_back(v);
    }
    cin >> s >> t;
    queue<pos> positions;
    for(i=0; i<vec[s].size(); i++){
        positions.push({vec[s][i], 0, 1});
        //
    }
    int ans=-1;
    while(!positions.empty() && ans==-1){
        pos aPos=positions.front();
        positions.pop();
        if(aPos.pos==t && aPos.step==2){
            ans=aPos.round;
        }
        if(!mark[aPos.pos][aPos.step]){
            mark[aPos.pos][aPos.step]=true;
        }
        else{
            continue;
        }
        for(i=0; i<vec[aPos.pos].size(); i++){
            int newVert=vec[aPos.pos][i];
            int newStep=aPos.step+1;
            int newRound=aPos.round;
            if(newStep>2){
                newStep=0;
                newRound++;
            }
            positions.push({newVert, newStep, newRound});
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 6016
import math
N = int(input())
A = input()
A = A.split()
B =[]
C = []
ans1 = 0
ans2 = 0
for i in range(N):
    B.append(int(A[i]))
    C.append(int(A[i])-i)
C.sort(reverse=True)

n = math.floor(N/2)
b = C[n]
b1 = C[n-1]

for i in range(N):
    ans1 = ans1 + abs(B[i]-(i+b))
for i in range(N):
    ans2 = ans2 + abs(B[i]-(i+b1))
ans = min(ans1, ans2)
print(ans)


Measured memory_bytes: 36084
#include <bits/stdc++.h>
using namespace std;
int main(){
    long n; cin>>n;
    vector<long> l(n);
    for(int i=0;i<n;i++)
        cin>>l[i];
    auto max_it=max_element(begin(l),end(l));
    long max=*max_it;
    l.erase(max_it);
    long sum=0;
    for(auto x:l)
        sum+=x;
    if(max<sum)
        cout<<"Yes";
    else
        cout<<"No";
}

Measured memory_bytes: 256
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    xy = [LI() for _ in range(N)]

    cnt0 = collections.Counter()
    for x, y in xy:
        cnt0[x+y] += 1
    ans0 = max(cnt0.keys()) - min(cnt0.keys())

    cnt1 = collections.Counter()
    for x, y in xy:
        cnt1[x-y] += 1
    ans1 = max(cnt1.keys()) - min(cnt1.keys())

    print(max(ans0, ans1))

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 86324
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  N=I()
  l=LI()

  if l[0]!=0:
    return 0

  a=[0]*3

  ans=1
  for x in l:
    ans*=a.count(x)
    c=a.count(x)
    if c>0:
      a[a.index(x)]+=1

    ans%=mod

  return ans

# main()
print(main())


Measured memory_bytes: 16392
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>
#include<set>
 
using namespace std;
 
#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define pb push_back
 
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef long long ll;

int main(){
	int n,m,a,b;
	string S;
	cin>>S;
	for(int i=0;i<S.size()-1;i++){
		if(S[i]=='A'&&S[i+1]=='C'){
			cout<<"Yes"<<endl;
			return 0;
		}
	}
	cout<<"No"<<endl;
	return 0;
}



Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std ;
int main(){
    int n , i ; 
    cin >> n ;
    vector<int> h(n) , best(n) ;
    for(i=0;i<n;++i) cin >> h[i] ;
    best[0] = 0 ;
    best[1] = abs(h[1]-h[0]) ;
    for(i=2;i<n;++i) best[i] = min(best[i-1]+abs(h[i]-h[i-1]),best[i-2]+abs(h[i]-h[i-2])) ;
    cout << best[n-1] << "\n" ;
    return 0 ;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main(void) {
	int ok[53];
	int n;
	int i;
	char pic;
	int rank;
	
	for(i = 1; i <= 52; i++) {
		ok[i] = 0;
	}
	
	scanf("%d", &n);
	
	for(i = 0; i < n; i++) {
		scanf("%s %d", &pic, &rank);
		switch(pic) {
		case 'S':
			ok[13*0 + rank] = 1;
			break;
		case 'H':
			ok[13*1 + rank] = 1;
			break;
		case 'C':
			ok[13*2 + rank] = 1;
			break;
		case 'D':
			ok[13*3 + rank] = 1;
			break;
		}
	}
	
	for(i = 0; i < 52; i++) {
		if(!ok[i+1]) {
			if(i / 13 == 0) {
				printf("S %d\n", i%13+1);
			} else if(i / 13 == 1) {
				printf("H %d\n", i%13+1);
			} else if(i / 13 == 2) {
				printf("C %d\n", i%13+1);
			} else if(i / 13 == 3) {
				printf("D %d\n", i%13+1);
			}
		}
	}
	
	return 0;
}

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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 100010

signed main()
{
    int X;
    cin >> X;
    if(X == 3 || X == 5 || X == 7) { printf("YES\n"); }
    else { printf("NO\n"); }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll  int
#define e endl
int main()
{
    ll a,b,c,t,i;
    char s[1000];
    cin>>s;
    a=strlen(s);

        if(s[a-1]=='s'){cout<<s;cout<<"es";}
        else {cout<<s;cout<<"s";}


}


Measured memory_bytes: 3588
package main

import "fmt"

func main() {
	var k, x int
	fmt.Scan(&k, &x)

	for i := x - k + 1; i < x+k; i++ {
		if i != x+k-1 {
			fmt.Printf("%d ", i)
			continue
		}
		fmt.Printf("%d\n", i)
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define INF 1<<30
#define endl '\n'
#define maxn 1005
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
const double PI = acos(-1.0);
#define dbg(x) cerr << #x << " = " << x << endl;
#define dbg2(x, y) cerr << #x << " = " << x << ", " << #y << " = " << y << endl;
#define dbg3(x, y, z) cerr << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl;


int main()
{
    FASTIO
    /*
    //double start_time = clock();
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif
//*/
    int T;
    //cin >> T;
    T = 1;
    for (int cs = 1; cs <= T; cs++) {
        int n;
        cin >> n;
        vector<int> v(n);
        for (int i = 0; i < n; i++) {
            cin >> v[i];
        }
        int cnt = 0;
        //cerr << "-------------\n";
        for (int i = 1; i < n - 1; i++) {
            if ( (v[i] > v[i - 1] and v[i] < v[ i + 1]) || (v[i] < v[i - 1] and v[i] > v[ i + 1])) cnt++;
           // cerr << v[i-1] << ' '<< v[i] << ' '<<v[i+1]<< ' '<<i<< " "<<cnt<<endl;
        }
        cout << cnt << endl;
    }

    //double end_time = clock();
    //printf( "Time = %lf ms\n", ( (end_time - start_time) / CLOCKS_PER_SEC)*1000);
    return 0;
}

Measured memory_bytes: 256