akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

bool judge(int W, int H, int x, int y){
    if(0<=x && x<=W && 0<=y && y<=H) return true;
    else return false;
}

int main(){
   int W, H, x, y, r;
   cin >> W >> H >> x >> y >> r;
   if(judge(W,H,x,y+r) && judge(W,H,x+r,y) && judge(W,H,x,y-r) && judge(W,H,x-r,y)){
       cout << "Yes" << endl;
   }
   else cout << "No" << endl;
   return 0;
}


Measured memory_bytes: 3100
from collections import Counter


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


c = Counter(A)
ans = []



# 全体でできる、各整数のペアの数から、 i番目の数を使ってできる、A[i]のペアを取り除くでOKのはず
total = 0
for n in c.values():
    total += n * (n - 1) // 2

ans = []
for a in A:
    # A[i]を使ってできるペアの数（A[i]以外の同じ整数とペアになるので、全体のaの個数-1）
    tmp = c[a]-1
    ans.append(total - tmp)

for i in range(N):
    print(ans[i])

Measured memory_bytes: 26936
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>

using namespace std;
using ll = long long int;
using ld = long double;
using vec = vector<int>;

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define Sort(a)    sort(a.begin(), a.end())
#define gSort(a)   sort(a.begin(), a.end())
const int INF = 2147483647;
const ll  MOD = 1000000007;
const ld  EPS = 1.0E-14;

int n;

void dfs(string s, char mx) {
    // sの長さがnになったら出力
    if(s.length() == n) {
        cout << s << endl;
    }else {
        // そうでないならsにcを加え，cがmxでないならそのまま，cがmxなら次に進めて探索
        for(char c = 'a'; c <= mx; c++) {
            dfs(s + c, ((c == mx) ? (char)(mx + 1) : mx));
        }
    }
}

int main() {
    cin >> n;
    dfs("", 'a');
}

Measured memory_bytes: 1536
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <array>
#include <vector>
#include <utility>
#include <bitset>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <stack>

using namespace std;

using ll = long long;
using p = pair<ll, ll>;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;

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

    ll N;
    cin >> N;
    
    vector<ll> A(N);
    for (auto&& a : A) {
        cin >> a;
    }

    vector<ll> D(N);
    for (ll i = 0; i < N; i++) {
        D[i] = A[(i + 1) % N] - A[i];
    }

    ll sum = accumulate(A.begin(), A.end(), 0LL);
    ll n_seq_sum = N * (N + 1) / 2;

    if (sum % n_seq_sum != 0) {
        cout << "NO" << endl;
        return 0;
    }

    ll k = accumulate(A.begin(), A.end(), 0LL) / (N * (N + 1) / 2);

    for (auto&& d : D) {
        d -= k;
    }

    ll minus_k_count = 0;
    for (auto&& d : D) {
        if (d > 0 || (-d) % N != 0) {
            cout << "NO" << endl;
            return 0;
        }
        minus_k_count += -d / N;
    }

    cout << (minus_k_count == k ? "YES" : "NO") << endl;

    return 0;
}



Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
char s[maxn];
int vis[maxn];
int n,a,b,c,d;
int main()
{

    scanf("%d%d%d%d%d",&n,&a,&b,&c,&d);
    scanf("%s",s+1);
   // int len=strlen(s+1);
    //cout<<len<<endl;
    if(s[c]=='#'||s[d]=='#')
         puts("No");
    else
    {
        if(a>b)
        swap(a,b),swap(c,d);
        int f1=0;
        for(int i=a; i<=max(c,d)-1; i++)
        {
            if(s[i]=='#'&&s[i-1]=='#')
            {
                  f1=1;
                 break;
            }
        }
        if(f1)
            puts("No");
        else
        {    
            if(c<d)
                puts("Yes");
            else
            {
                    int  f=0;
                for(int i=b; i<=d; i++)
                {
                    if(s[i]=='.'&&s[i-1]=='.'&&s[i+1]=='.')
                          f=1;
                }
                if(f)
                    puts("Yes");
                else
                    puts("No");
            }
        }

    }
    return 0;
}


Measured memory_bytes: 384
# -*- coding: utf-8 -*-
import sys,copy,math,heapq,itertools as it,fractions,re,bisect,collections as coll

T = int(raw_input())
for loop in xrange(T):
    N, D = map(int, raw_input().split())
    ans = 0
    for i in xrange(N - 2):
        ans += 127
        D ^= 127

    mx = 0
    if N > 1:
        for i in xrange(1, 128):
            mx = max(mx, i + (D^i))
        print ans + mx
    else:
        print D



Measured memory_bytes: 4520
N, M = list(map(int, input().split()))
lis = [0 for i in range(M + 1)]
for i in range(N):
    temp = list(map(int, input().split()))
    for j in range(1, temp[0] + 1):
        lis[temp[j]] += 1
count = 0
for i in range(M + 1):
    if lis[i] == N:
        count += 1
print(count)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int main(){
	int a[maxn],dp[maxn],n,k;
	memset(dp,0x3f3f,sizeof(dp));
	scanf("%d%d",&n,&k);
	for(int i = 1;i <= n;i++)
		scanf("%d",&a[i]);
	dp[1] = 0;
	for(int i = 1;i < n;i++){
		for(int j = 1;j <= k;j++){
			if(i + j <= n)
			dp[i + j] = min(dp[i + j],dp[i] + abs(a[i + j] - a[i]));
		}
	}
	printf("%d\n",dp[n]);
	return 0;
}

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


int main()
{
	int k;
	string s;
	cin >> k >> s;
	if (s.size() <= k)
		cout << s << endl;
	else
	{
		for (int i = 0; i < k; ++i)
			cout << s[i];
		cout << "..." << endl;
	}
}


Measured memory_bytes: 3628
N = int(input())
p = list(map(int,input().split()))

p_hikaku = []
for j in range(1,N+1):
    p_hikaku.append(j)

count = 0
for j in range(N):
    if p[j] !=  p_hikaku[j]:
        count += 1

if count == 0 or count == 2:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3064
dp = {}

def rec(s):
    if s in dp:
        return dp[s]
    ret = int(s)
    for i in range(1, len(s)):
        ret += int(s[:i]) * (2**(len(s)-i-1)) + rec(s[i:])
    dp[s] = ret
    return ret

print(rec(input()))


Measured memory_bytes: 3064
package main

import(
      "fmt"
)

func main(){

  var a,b,c int
  fmt.Scan(&a,&b,&c)
  A := min(a, min(b,c))
  B := a+b+c-min(a, min(b,c))-max(a, max(b,c))
  C := max(a, max(b,c))

  sub := C-A+C-B

  if sub%2==1 {
    fmt.Println(sub/2+2)
  }else{
    fmt.Println(sub/2)
  }
}

//====  ↓↓↓ template functions ↓↓↓  ======================

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 abs(x int) int{
  if x < 0 {
    return -x
  }
  return x
}

func gcd(a, b int) int{
  if b == 0 {
    return a
  }else{
    return gcd(b, a%b)
  }
}

func lcm(a, b int) int{
  return a*b/gcd(a, b);
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
typedef long long ll;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

const int MOD = 1000000007;
const int MAX = 200000;

int main() {
  long double a;
  long double b;
  cin >> a >> b;
  long double ans = a * b;
  ll res = (ll)floorl(ans);
  cout << res << endl;
}


Measured memory_bytes: 3704
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cctype>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<iomanip>
#include<sstream>
#include<vector>
#include<cstdlib>
#include<ctime>
#include<list>
#include<deque>
#include<bitset>
#include<fstream>
#define ld double
#define ull unsigned long long
#define ll long long
#define pii pair<int,int >
#define P pair<pii,pii >
#define F first
#define S second
#define d0 first.first
#define d1 first.second
#define d2 second.first
#define d3 second.second
#define mp make_pair
#define INF 1000000000
#define MOD 1000000007
#define rep(i,x) for(int (i)=0;(i)<(x);(i)++)
inline int getint(){
    int x=0,p=1;char c=getchar();
    while (c<=32)c=getchar();
    if(c==45)p=-p,c=getchar();
    while (c>32)x=x*10+c-48,c=getchar();
    return x*p;
}
using namespace std;
//ruogu
const int N=410;
int n,c[N][4];
vector<P >v;
ll res;
map<P,ll >Mp;
//
vector<P>doit(int x,int y,int z,int w){
	vector<P >ans;
	ans.push_back(mp(mp(x,y),mp(z,w)));
	ans.push_back(mp(mp(y,z),mp(w,x)));
	ans.push_back(mp(mp(z,w),mp(x,y)));
	ans.push_back(mp(mp(w,x),mp(y,z)));
	return ans;
}
ll cntsame(P xx,P yy){
	ll ans=0;
	int x=xx.F.F,y=xx.F.S,z=xx.S.F,w=xx.S.S;
	if(mp(mp(x,y),mp(z,w))==yy)ans++;
	if(mp(mp(y,z),mp(w,x))==yy)ans++;
	if(mp(mp(z,w),mp(x,y))==yy)ans++;
	if(mp(mp(w,x),mp(y,z))==yy)ans++;
	return ans;
}
ll cnt(P xx,P yy){return cntsame(xx,yy);}
int main(){
	n=getint();
	rep(i,n)rep(j,4)c[i][j]=getint();
	rep(i,n){
		int x=c[i][0],y=c[i][1],z=c[i][2],w=c[i][3];
		rep(j,v.size()){
			P xx=mp(mp(x,y),mp(v[j].d1,v[j].d0));
			P yy=mp(mp(y,z),mp(v[j].d2,v[j].d1));
			P zz=mp(mp(z,w),mp(v[j].d3,v[j].d2));
			P ww=mp(mp(w,x),mp(v[j].d0,v[j].d3));
			ll ans=1;
			ans*=Mp[xx]-cntsame(xx,v[j]);
			ans*=Mp[yy]-cntsame(xx,yy)-cntsame(yy,v[j]);
			ans*=Mp[zz]-cntsame(zz,xx)-cnt(zz,yy)-cnt(zz,v[j]);
			ans*=Mp[ww]-cntsame(ww,xx)-cntsame(ww,yy)-cntsame(ww,zz)-cntsame(ww,v[j]);
		//cout<<ans<<endl;
			res+=ans;
		}
		x=c[i][0],y=c[i][3],z=c[i][2],w=c[i][1];
		vector<P >vv=doit(x,y,z,w);
		rep(k,vv.size()){
			Mp[vv[k]]++;
			v.push_back(vv[k]);
		}
	}
	printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 80128
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<vector>
#include<math.h>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef long double db;
typedef pair<int,int> pii;
const int N=100000;
const db pi=acos(-1.0);
#define lowbit(x) (x)&(-x)
#define sqr(x) (x)*(x)
#define rep(i,a,b) for (register int i=a;i<=b;i++)
#define per(i,a,b) for (register int i=a;i>=b;i--)
#define go(u,i) for (register int i=head[u];i;i=sq[i].nxt)
#define fir first
#define sec second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define maxd 998244353
#define eps 1e-8
int n;
struct node{int l,r;}seg[100100];
bool operator <(node p,node q) {return p.r<q.r;}
int read()
{
    int x=0,f=1;char ch=getchar();
    while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
    while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
    return x*f;
}

int main()
{
	n=read();
	rep(i,1,n)
	{
		int x=read(),len=read();
		seg[i]=(node){x-len,x+len};
	}
	sort(seg+1,seg+1+n);
	int ans=1,nowr=seg[1].r;
	rep(i,2,n)
	{
		if (seg[i].l<nowr) continue;
		nowr=seg[i].r;ans++;
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
n, y = map(int,input().split())  # お札の枚数と合計金額の変数を作る
a = -1  # 10000円札の枚数を入れる変数を作る
b = -1  # 5000円札の枚数
c = -1  # 1000円札の枚数
flag = True
for i in range(n+1):
    for g in range(n+1):
        if y == 10000*i + 5000*g + 1000*(n - i - g) and n - i - g >= 0:
            a = i
            b = g
            c = n - i - g


print (a,b,c)


Measured memory_bytes: 3060
N, M = map(int, input().split())
lst = []
for i in range(M):
	lst.append(list(map(int, input().split())))
p = list(map(int, input().split()))

suc = 0
for i in range(2**N):
	judge = 1
	s = []
	n = i
	for j in range(N):
		if n >= 2**(N-1-j):
			s.append(1)
			n -= 2**(N-1-j)
		else:
			s.append(0)
	for j in range(M):
		cnt = 0
		for k in range(lst[j][0]):
			if s[N-lst[j][k+1]] == 1:
				cnt += 1
		if cnt%2 != p[j]:
			judge = 0
	if judge == 1:
		suc += 1

print(suc)


Measured memory_bytes: 3188
import java.io.*;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        Scanner sc = new Scanner(System.in);
        while (sc.hasNext()) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int t = sc.nextInt();
            int res = process(a, b, t);
            System.out.println(res);
        }
        sc.close();
    }

    private static int process(int a, int b, int t) {
        int n = t / a;
        return n * b;
    }
}


Measured memory_bytes: 23124
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

template <typename TYPE>
void print_vec(const vector<TYPE>& v){
	for(int i=0; i<v.size(); i++){
		cout << v[i] << " ";
	}
	cout << endl;
}

template <typename TYPE>
void print_vec2(const vector<vector<TYPE>>& v){
	for(int i=0; i<v.size(); i++){
		cout << "i=" << i << ":   ";
		for(int j=0; j<v[i].size(); j++){
			cout << v[i][j] << "   ";
		}
		cout << endl;
	}
}



int fib(int i, vector<int> &dp){
    if(dp[i] != -1) return dp[i];
    if(i == 0) return dp[i] = 1;//dpにメモしながら返す
    if(i == 1) return dp[i] = 1;
    return dp[i] = fib(i-1, dp) + fib(i-2, dp);

}
int main(){//
   int n;
   cin >> n;
   vector<int> dp(n+5, -1);

   cout << fib(n, dp) << endl;


}



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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n, m) for (int (i) = (n); (i) < (m); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};

int query(int x) {
   cout << x << endl;
   string s;
   cin >> s;
   if (s == "Male") {
      return 0;
   } else if (s == "Female") {
      return 1;
   } else {
      exit(0);
   }
}

int main() {
   int n;
   cin >> n;

   int left = 0, right = n;
   int mid = (left+right)/2;
   int l = query(left), m = query(mid);

   rep (i, 0, 18) {
      // 矛盾の判定
      int dist = mid - left;
      bool ok;
      if (dist&1) {
         if (l != m) ok = true;
         else ok = false;
      } else {
         if (l == m) ok = true;
         else ok = false;
      }

      if (ok) { // 矛盾無し
         left = mid;
         l = m;
      } else { // 矛盾有り
         right = mid;
      }
      mid = (left + right) / 2;
      m = query(mid);
   }

   return 0;
}

Measured memory_bytes: 852
result = Array.new(26, 0)
$stdin.readlines.map(&:chomp).join.downcase.each_byte do |byte|
  next unless byte.between?(97, 122)
  result[byte - 97] += 1
end
result.each_with_index {|x, i| puts "#{(i + 97).chr} : #{x}"}


Measured memory_bytes: 6856
N,u,v = map(int,input().split())
g = [[] for _ in range(N)]
for i in range(N-1):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    g[a].append([1,b])
    g[b].append([1,a])

from heapq import heappush, heappop
def dijkstra(graph:list, node:int, start:int) -> list:
    inf = float('inf')
    dist = [inf]*node

    dist[start] = 0
    heap = [(0,start)]
    while heap:
        cost,thisNode = heappop(heap)
        for NextCost,NextNode in graph[thisNode]:
            dist_cand = dist[thisNode]+NextCost
            if dist_cand < dist[NextNode]:
                dist[NextNode] = dist_cand
                heappush(heap,(dist[NextNode],NextNode))
    return dist

du = dijkstra(g,N,u-1)
dv = dijkstra(g,N,v-1)
d = []
for i in range(N):
    if dv[i]-du[i]>=0:
        d.append(dv[i])
ans = max(d)-1
print(ans)

Measured memory_bytes: 108192
n, m = map(int, input().split())
a_list = list(map(int, input().split()))

all_num = sum(a_list) // (4 * m)
if sum(a_list) / (4 * m) % 1 == 0:
    all_num =  sum(a_list) // (4 * m)
else:
    all_num =  (sum(a_list) // (4 * m)) + 1


count = 0
flag = False
for i in range(n):
    a = a_list[i]
    if a >= all_num:
        count += 1
    if count == m:
        flag = True
        break

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

Measured memory_bytes: 38864
n=int(input())
a=[]
for i in range(1,n+1):
  t=i
  cnt=0
  while t!=0:
    if t%2==0:
      cnt+=1
    t//=2
  a.append((cnt,i))
a.sort(key=lambda x: x[0])
print(a[-1][1])

Measured memory_bytes: 3060
import java.util.*;

public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int count = 0;
        for (int i = 1; i < N+1; i++) {
            int a = sc.nextInt();
            if (i%2 != 0 && a%2 != 0) {
                count++;
            }
        }
        System.out.println(count);
    }
}

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

int main() {

  int N,a;
  cin >> N;
  vector<int> a_vector;

  for(int i=0; i<N; i++) {
    cin >> a;
    a_vector.push_back(a);
  }

  int alice=0, bob=0;
  vector<int>::iterator iter;

  sort(a_vector.begin(), a_vector.end(), greater<int>());
  iter = a_vector.begin();

  while(iter != a_vector.end()) {
   alice += *iter;
   iter++;
   if(iter != a_vector.end()) {
     bob += *iter;
     iter++;
   }
  }

  cout << alice - bob << endl;
  return 0;
}
   



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long int num[200000+200],ara[200000+200];
int main()
{
	int n,i;
	cin>>n;
	int x;
	long long int sum=0,ans;
	for(i=0;i<n;i++){
		cin>>x;
		ara[i]=x;
		num[x]++;
	}
	for(i=1;i<=n;i++){
		sum+=(num[i]*(num[i]-1))/2;
	}
	for(i=0;i<n;i++){
		ans=sum-((num[ara[i]]*(num[ara[i]]-1))/2-((num[ara[i]]-1)*(num[ara[i]]-2))/2);
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 4736
#include<iostream>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#define ll long long
using namespace std;
int main(){
	string s;
	cin>>s;
	int cnt=0;
	for(int i=0;i<s.size()/2;i++){
		if(s[i]!=s[s.size()-1-i]){
			cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	string s,sf="",ss="";
	cin>>n>>s;
	sf+=s.substr(0,n/2);
	ss+=s.substr(n/2);
	if(sf==ss)
	{
		cout<<"Yes"<<endl;
	}
	else
	{
		cout<<"No"<<endl;
	}
	return 0;
}


 

Measured memory_bytes: 256
class UnionFind:
    __slots__ = ["_data_size", "_roots"]

    def __init__(self, data_size: int) -> None:
        self._data_size = data_size
        self._roots = [-1] * data_size

    def __getitem__(self, x: int) -> int:
        while self._roots[x] >= 0:
            x = self._roots[x]
        return x

    def is_connected(self, x: int, y: int) -> bool:
        return self[x] == self[y]

    def unite(self, x: int, y: int) -> None:
        x, y = self[x], self[y]
        if x == y:
            return
        if self._roots[x] > self._roots[y]:
            x, y = y, x
        self._roots[x] += self._roots[y]
        self._roots[y] = x


def main():
    N, Q = map(int, input().split())
    tree = UnionFind(N)
    res = []
    for _ in range(Q):
        t, u, v = map(int, input().split())
        if t:
            res.append(int(tree.is_connected(u, v)))
        else:
            tree.unite(u, v)
    print("\n".join(map(str, res)))


if __name__ == "__main__":
    main()


Measured memory_bytes: 18704
#include <iostream>
#include <cfenv>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>

#define rep(i,n) for(int (i)=0;(i)<(n); ++(i))
using namespace std;

int main() {
    int n;
    cin >> n;

    string s;
    cin >> s;

    string ch;

    for (int i=0; i<n; i++){
        if (s[i] != s[i+1]){
           ch += s[i];
        }
    }

    cout << ch.length() << endl;

}

Measured memory_bytes: 704
import numpy as np

def main():
    n, m, x = map(int, input().split())
    c = [None]*n
    a = [None]*n
    for i in range(n):
        ca = list(map(int, input().split()))
        c[i] = ca[0]
        a[i] = ca[1:]

    ms = -1

    for i in range(2**n):
        mm = np.zeros([m])
        p = 0
        for j in range(n):
            if i>>j & 1:
                mm += a[j]
                p += c[j]
        if all(mm >= x) and (ms < 0 or ms > p):
            ms = p

    print(ms)


if __name__ == '__main__':
    main()

Measured memory_bytes: 27088
W,H,x,y,r=map(int,input().split())
a=int(x+r)
b=int(x-r)
c=int(y+r)
d=int(y-r)
if (a<=W) and (b>=0) and (c<=H) and (d>=0):
    print("Yes")
else:
    print("No")



Measured memory_bytes: 5596
//BUGSBUNNY
//IIT ROORKEE
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define double long double
#define ld long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define vl vector<long long>
#define vpii vector<pii>
#define vpipii vector<pipii>
#define vb vector<bool>
#define pb push_back
#define pob pop_back
#define mp make_pair
#define pii pair<int,int>
#define pipii pair<int,pii>
#define piipi pair<pii,int>
#define pld pair<long double,long double>
#define mod 1000000007
// #define mod 163577857 
// #define mod 998244353
#define rep(i,n) for (ll i = 0; i < n; i++)
#define repp(i,a,b) for(ll i = a ; i<b ; i++)
#define reppr(i,a,b) for(ll i = a-1 ; i>=b ; i--)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define ff first
#define ss second
#define pc putchar_unlocked
#define gc getchar_unlocked
#define inf 9223372036854775807
#define infn -9223372036854775807
#define pi 3.14159265358979323846
#define eps 0.0000000001
#define sp << " " <<
#define setprec(x) cout << fixed << setprecision(x);
#define REVERSE(a) reverse(all(a));
#define SORT(a) sort(all(a));
#define all(n) n.begin(),n.end()
 
//GCD and LCM
    int gcd (int a, int b) { return b ? gcd (b, a % b) : a; }
    int lcm (int a, int b) { return a / gcd(a, b) * b; }
 
//Modular Exponentiation
    int powmod(int x,int y) 
    { 
        if (y == 0) return 1; 
        int p = powmod(x, y/2) % mod; 
        p = (p * p) % mod;   
        return (y%2 == 0)? p : (x * p) % mod; 
    }
 
//Modular Inverse
    int inverse(int a) 
    { 
       return powmod(a,mod-2); 
    }


void solve();
signed main()
{
    //-------------------------------------------------------------------------------   
        ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
        clock_t clk = clock();
    //-------------------------------------------------------------------------------   
    //-------------------------------------------------------------------------------
        int t = 1;
        // cin >> t;       
        rep(i,t)
        {
            // cout << "Case #" << i+1 << ": ";
            solve();
        }
    //-------------------------------------------------------------------------------
        clk = clock() - clk;
        cerr << fixed << setprecision(12) << "Time: " << ((double)clk)/CLOCKS_PER_SEC;
    //-------------------------------------------------------------------------------
}

void solve()
{
    double x;
    cin >> x;
    double lol = 100;
    int ans = 0;
    while(lol < x)
        ans++ , lol *= 1.01 , lol = floor(lol); 
    cout << ans << endl;
}   

Measured memory_bytes: 3816
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define REPS(i, _s, n) for(int i = _s, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
using namespace std;

#define repi(itr, ds) for(auto itr = ds.begin(); itr != ds.end(); itr++)
// vector
template <typename T>
istream &operator>>(istream &is, vector<T> &vec) {
  for(T &x : vec) is >> x;
  return is;
}
// pair
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &pair_var) {
  os << "(" << pair_var.first << ", " << pair_var.second << ")";
  return os;
}
// vector
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
  os << "{";
  for(int i = 0; i < vec.size(); i++) {
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  }
  os << "}\n   ";
  return os;
}
// map
template <typename T, typename U>
ostream &operator<<(ostream &os, map<T, U> &map_var) {
  os << "{";
  repi(itr, map_var) {
    os << *itr;
    itr++;
    if(itr != map_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}
// set
template <typename T>
ostream &operator<<(ostream &os, set<T> &set_var) {
  os << "{";
  repi(itr, set_var) {
    os << *itr;
    itr++;
    if(itr != set_var.end()) os << ", ";
    itr--;
  }
  os << "}";
  return os;
}

#define DUMPOUT cerr

void dump_func() { DUMPOUT << endl; }
template <class Head, class... Tail>
void dump_func(Head &&head, Tail &&... tail) {
  DUMPOUT << head;
  if(sizeof...(Tail) > 0) {
    DUMPOUT << ", ";
  }
  dump_func(std::move(tail)...);
}
#ifdef DEBUG_
#define DEB
#define dump(...)                                                             \
  DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                             \
          << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]" << endl \
          << "    ",                                                          \
      dump_func(__VA_ARGS__)
#else
#define DEB if(false)
#define dump(...)
#endif

typedef long long int ll;

int main() {
  char C;
  cin >> C;
  cout << (char)(C + 1) << endl;
}


Measured memory_bytes: 256
program answer
  implicit none
  integer(8) :: i, j, k, N, aa
  integer(8), allocatable :: L(:)
  read(*,*) N
  allocate(L(N))
  read(*,*) L

  !do i = 1, N-1
  !   do j = i+1, N
  !      if(L(i)>L(j)) then
  !      L(i)=aa
  !      L(i)=L(j)
  !      L(j)=aa
  !   end do
  !end do

  aa=0
  do i = 1, n-2
     do j = i+1, n-1
        do k = j+1, n
           if(L(i)+L(j)>L(k).and.L(i)+L(k)>L(j).and.L(j)+L(k)>L(i)) then
              if(L(i)/=L(j).and.L(i)/=L(K).and.L(j)/=L(k)) then
                 aa=aa+1
              end if
           end if
        end do
     end do
  end do

  write(*,*) aa
  stop
 end program answer

Measured memory_bytes: 2864
object Main extends App {
  val lrdInput =  scala.io.StdIn.readLine()
  val lrdArray = lrdInput.split(" ").map(_.toInt).toSeq

  val l = lrdArray(0)
  val r = lrdArray(1)
  val d = lrdArray(2)

  var result = 0
  (l to r).foreach { i =>
    if (i % d == 0) {
      result = result + 1
    }
  }

  println(result)
}

Measured memory_bytes: 54492
K = int(input())
il2 = [int(k) for k in input().split()]
A = il2[0]
B = il2[1]

result = False

for i in range(A, B+1):
    if (i%K==0):
        result = True
        break

if (result):
    print("OK")
else:
    print("NG")


Measured memory_bytes: 9184
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ll long long

using pi = pair<int, int>;

typedef tree< pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update>Order_Set;

Order_Set X;

const int mxn = 1e6+100;
const int Mod = 1e9+7;

int arr[mxn], qs[mxn];
int bitOn[55];
map<int,int>Mp, cnt, op;
vector<int>Pi, Ans;
vector<int>G[mxn];
set<int>seet[mxn];

int main()
{
    ios::sync_with_stdio(false);

    char ch;
    cin>>ch;
    printf("%c",ch+1);

    return 0;
}


Measured memory_bytes: 71936
package main

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

func abs(it int) int {
	if it < 0 {
		it *= -1
	}
	return it
}

// ref.
// https://qiita.com/tnoda_/items/b503a72eac82862d30c6
var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)
	n := nextInt()
	a := make([]int, n)

	ans := 0
	neg := 0
	minA := 2 << 61
	for i := range a {
		a[i] = nextInt()
		absA := abs(a[i])
		ans += absA
		if a[i] < 0 {
			neg++
		}
		if absA < minA {
			minA = absA
		}
	}

	if neg%2 == 1 {
		ans -= 2 * minA
	}

	fmt.Println(ans)
}


Measured memory_bytes: 3072
#アルゴリズム実装
def linearSearch(list, find_number):
    i = 0
    search_list = list + [find_number]
    last_number = len(search_list) - 1
    while search_list[i] != find_number:
        i += 1
    if i ==  last_number:
        return 0
    else:
        return 1

#インプットdata
n_number = int(input())
n_list = list(map(int, input().split()))
q_number = int(input())
q_list = list(map(int, input().split()))
result = 0

#処理の実行
for i in range(q_number):
        result += linearSearch(n_list, q_list[i])

#結果の表示
print(result)


Measured memory_bytes: 6552
//Kyokai no Kanata //
#include<bits/stdc++.h>

using namespace std;

typedef long long int LL;
typedef pair<int,int> II;
typedef vector<II> VII;
typedef vector<int> VI;
typedef vector< VI > VVI;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))

#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names,Arg1&& arg1,Args&&... args){
  const char* comma=strchr(names+1,',');
  cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1,args...);
}
#else
#define trace(...)
#endif
//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
float  inf=std::numeric_limits<double>::infinity();
LL INF=std::numeric_limits<LL>::max();
LL powm(LL base,LL power, LL mod){
  LL ret=1;
  while(power){
    if(power&1) ret=(ret*base)%mod;
    base=(base*base)%mod;
    power>>=1;
  } return ret;
}
int main(){
  int n; cin>>n;
  if(n<1200)return 0*puts("ABC");
  if(n<2800) return 0*puts("ARC");
  return 0*puts("AGC");
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#include <fstream>
#include <iterator>
// #include "prettyprint.hpp"

using namespace std;
using ll = long long;

int main()
{
    int P, Q, R;
    cin >> P >> Q >> R;
    cout << min({P + Q, Q + R, R + P}) << endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
n = int(input())
A = [list(map(int,input().split())) for i in range(n)]

D = [[0] * 3 for i in range(n)]

D[0] = A[0]
for i in range(1, n):
    for j in range(3):
        D[i][j] = max(D[i-1][(j+1)%3], D[i-1][(j+2)%3]) + A[i][j]
print(max(D[-1]))

Measured memory_bytes: 102120
#include <iostream>

int main()
{
	int ninzu = 0;
	int needShincho = 0;
	std::cin >> ninzu >> needShincho;
	int countNoreru = 0;
	int nowShincho = 0;
	for (int count = 0; count < ninzu; ++count)
	{
		std::cin >> nowShincho;
		if (nowShincho >= needShincho)
		{
			++countNoreru;
		}
	}
	std::cout << countNoreru << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


void fds(vector<ll> &s, int keta, string tmp){

    if (tmp.size() == keta){
        s.push_back(stoll(tmp));
        return;
    }
    if (tmp == ""){
        for (int i = 1; i <= 9; i++)
        {
            fds(s, keta, to_string(i));
        } 
        return;       
    }
    int num = tmp[tmp.size()-1] - '0';

    if (num!=0) fds(s, keta, tmp+to_string(num-1));
    fds(s, keta, tmp+to_string(num));
    if (num!=9) fds(s, keta, tmp+to_string(num+1));
    return;
}




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

    vector<ll> s;
    rep(i, 10){
        fds(s, i+1, "");
    }

    sort(s.begin(), s.end());
    
    cout << s[k-1] << endl;    
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

const int INF = 1000000000;

int search(const vector<vector<int>> &t) {
  map<vector<vector<int>>,int> mp;
  mp[t] = 0;
  queue<tuple<vector<vector<int>>,int>> q;
  q.push(make_tuple(t, 0));
  while(!q.empty()) {
    auto tb = get<0>(q.front());
    int d = get<1>(q.front());
    q.pop();
    bool ok = true;
    REP(i,4)REP(j,8) {
      if (j<7 && tb[i][j] != (i+1)*10+j+1) ok = false;
    }
    if (ok) return d;
    REP(i,4)REP(j,8) {
      if (j && tb[i][j] == 0) {
        auto cp = tb;
        int sc = cp[i][j-1] + 1;
        if (sc%10 == 8 || sc == 1) continue;
        REP(k,4)REP(l,8) {
          if (cp[k][l] == sc) {
            swap(cp[i][j],cp[k][l]);
            if (mp.count(cp) == 0 || mp[cp] > d+1) {
              mp[cp] = d+1;
              q.push(make_tuple(cp, d+1));
            }
          }
        }
      }
    }
  }
  return INF;
}

int main() {
  int n;
  cin>>n;
  REP(cnt,n) {
    vector<vector<int>> tb(4,vector<int>(8,0));
    REP(i,4)REP(j,7)
      cin>>tb[i][j+1];
    REP(i,4)REP(j,8) {
      REP(k,4) {
        if (tb[i][j] == k*10+11)
          swap(tb[k][0],tb[i][j]);
      }
    }
    int ans = search(tb);
    if (ans == INF)
      cout << -1 << endl;
    else
      cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 25904
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<limits>
#include<algorithm>
#include<numeric>

int main(){
    int N, M;
    int s,t;
    std::cin >> N >> M;

    s=1;
    t=N;

    for(int i=0;i<M;i++){
        int _L, _R;
        std::cin >> _L >> _R;
        if(s<_L) s=_L;
        if(t>_R) t=_R;
        if(s>t) break;
    }

    std::cout << ((s>t)?0:t-s+1) << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

struct Card {
  char suit;
  int value;
};

struct Card L[MAX / 2 + 2], R[MAX / 2 + 2];

void merge(struct Card A[], int n, int left, int mid, int right) {
  int i, j, k;
  int n1 = mid - left;
  int n2 = right - mid;
  for ( i = 0; i < n1; i++ ) L[i] = A[left + i];
  for ( i = 0; i < n2; i++ ) R[i] = A[mid + i];
  L[n1].value = R[n2].value = SENTINEL;
  i = j = 0;
  for ( k = left; k < right; k++ ) {
    if ( L[i].value <= R[j].value ) {
      A[k] = L[i++];
    } else {
      A[k] = R[j++];
    }
  }
}

void mergeSort(struct Card A[], int n, int left, int right) {
  int mid;
  if ( left + 1 < right ) {
    mid = (left + right) / 2;
    mergeSort(A, n, left, mid);
    mergeSort(A, n, mid, right);
    merge(A, n, left, mid, right);
  }
}

int partition(struct Card A[], int n, int p, int r) {
  int i, j;
  struct Card t, x;
  x = A[r];
  i = p - 1;
  for ( j = p; j < r; j++ ) {
    if ( A[j].value <= x.value ) {
      i++;
      t = A[i]; A[i] = A[j]; A[j] = t;
    }
  }
  t = A[i + 1]; A[i + 1] = A[r]; A[r] = t;
  return i + 1;
}

void quickSort(struct Card A[], int n, int p, int r) {
  int q;
  if ( p < r ) {
    q = partition(A, n, p, r);
    quickSort(A, n, p, q - 1);
    quickSort(A, n, q + 1, r);
  }
}

int main() {
  int n, i, v;
  struct Card A[MAX], B[MAX];
  char S[10];
  int stable = 1;

  scanf("%d", &n);

  for ( i = 0; i < n; i++) {
    scanf("%s %d", S, &v);
    A[i].suit = B[i].suit = S[0];
    A[i].value = B[i].value = v;
  }

  mergeSort(A, n, 0, n);
  quickSort(B, n, 0, n - 1);

  for ( i = 0; i < n; i++ ) {
    if ( A[i].suit != B[i].suit ) stable = 0;
  } 

  if ( stable == 1) printf("Stable\n");
  else printf("Not stable\n");
  for ( i = 0; i < n; i++ ) {
    printf("%c %d\n", B[i].suit, B[i].value);
  }

  return 0;
}


Measured memory_bytes: 5016
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i,a,b) for(int i=(a); i<=(b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define chmin(a,b) if((a)>(b)) (a)=(b);
#define chmax(a,b) if((a)<(b)) (a)=(b);
#define vi vector<int>
#define pii pair<int,int>
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define pb push_back
#define pf push_front
int gcd(int a,int b){/*a>=0,b>=0,￢(a=b=0)*/
  while(min(a,b)>0){if(a<b)swap(a,b);a%=b;}return max(a,b);
}
int dx[]={0,1,0,-1,1,-1,-1,1};
int dy[]={1,0,-1,0,1,1,-1,-1};
const int MOD = 1e9+7;
const int INF = 1e18+10;

/*----------------------------------------------*/

signed main(){
  int k,a,b;
  cin>>k>>a>>b;
  if(b-a<=2){
    cout<<k+1<<endl;
    return 0;
  }
  int ans=1;
  ans+=min(k,a-1);
  k-=min(k,a-1);
  ans+=k/2*(b-a);
  k%=2;
  if(k>0) ans++;

  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int ans[10005];
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for(int i=1;i<=100;i++){
        for(int j=1;j<=100;j++){
            for(int k=1;k<=100;k++){
                int sum = i*i + j*j + k*k + i*j + i*k + j*k;
                if(sum <= 10000) ans[sum]++;
            }
        }
    }   
    for(int i=1;i<=n;i++) printf("%d\n", ans[i]);
}

Measured memory_bytes: 3716
#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
using ll = long long;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
#define REP(var, a, b) for (int var = (a); var < (b); var++)
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()
#define rALL(c) (c).rbegin(), (c).rend()
ll MOD = 1000000007;
const ll INF = 1LL << 60;

struct mint {
  ll x;
  mint(ll x = 0) : x(x % MOD) {}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += MOD - a.x) >= MOD) x -= MOD;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= MOD;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res -= a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }

  // for prime MOD
  mint inv() const { return pow(MOD - 2); }
  mint& operator/=(const mint a) { return (*this) *= a.inv(); }
  mint operator/(const mint a) const {
    mint res(*this);
    return res /= a;
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;
  cin >> n;
  if (n == 1) {
    cout << "Hello World" << endl;
  } else {
    ll a,b;
    cin >> a >> b;
    cout << a + b << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{

   int n,c=0,mx=-1;
   cin>>n;
   int x[n];
   for(int i=0;i<n;i++)cin>>x[i];
   for(int i=0;i<n-1;i++)
   {
       if(x[i]>=x[i+1])c++;
       else
       {
           mx=max(mx,c);
           c=0;
       }
   }

   mx=max(mx,c);
   cout<<mx<<endl;
    return 0;
}


Measured memory_bytes: 640
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc=new Scanner(System.in);
        long m=sc.nextLong(),n=sc.nextLong(),ans=1,p=m,mod=1000000007;
        while(n>0){
            if(n%2==0){
                p=p*p%mod;
                n=n/2;
            }else{
                ans=ans*p%mod;
                n--;
            }
        }
        System.out.println(ans);
    }
}



Measured memory_bytes: 26220
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int k,a,b,l,i;
	scanf("%d %d %d",&a,&b,&k);
	l=b-a+1;
	if(l>k*2)
	{
		for(i=a;i<=a+k-1;i++)
		{
			printf("%d\n",i);
		}
		for(i=b-k+1;i<=b;i++)
		{
			printf("%d\n",i);
		}
	}
	else
	{
		for(i=a;i<=b;i++)
		{
			printf("%d\n",i);
		}
	}
	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 rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9 + 7;
const int inf = 1e8;

int main() {
	int H,W;
	cin>>H>>W;
	vector<string> S(H);
	rep(i,H){
		cin>>S[i];
	}
	rep(i,H)rep(j,W){
		if(S[i][j] == '.')
		S[i][j] = '0';
	}
	string ans = "Yes";
	rep1(i,H-1)rep1(j,W-1){
		if(S[i][j] == '#'){
			if(S[i+1][j]!='#'&&S[i][j+1]!='#'&&S[i-1][j]!='#'&&S[i][j-1]!='#')
				ans = "No";
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using namespace atcoder;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

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

    int N,M; cin >> N >> M;
    scc_graph scc(N);
    set<P> st;
    rep(i,M) {
        int a,b; cin >> a >> b;
        if (a == b) continue;
        if (st.count(P{a,b})) continue;
        st.insert(P{a,b});
        scc.add_edge(a,b);
    }
    auto group = scc.scc();
    cout << group.size() << '\n';
    rep(i,group.size()) {
        cout << group[i].size() << ' ';
        rep(j,group[i].size()) {
            cout << group[i][j] << ' ';
        }
        cout << '\n';
    }
    return 0;
}

Measured memory_bytes: 64088
#include "bits/stdc++.h"
using namespace std;
#define F first
#define S second
#define show(x) cout<<#x<<" "<<x<<" ";
#define f(i,j,k) for(int i = j;i<=k;i++)
#define fr(i,j,k) for(int i = j;i>=k;i--)
#define ll long long
#define all(A)  A.begin(),A.end()  
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);  
const int MSIZE = 1e2+5;
const int MOD = 1e9+7;

int wts[MSIZE];
int vals[MSIZE];

ll dp[MSIZE][(int)1e5+5];

ll ks(int n,int wt) {
    if(n==0||wt==0)  return 0;
    if(dp[n][wt]!=-1)   return dp[n][wt];
    return dp[n][wt] = max(ks(n-1,wt),
                (wt>=wts[n])?(vals[n]+ks(n-1,wt-wts[n])):0);
}

int main(){
    FIO
    int N, W; cin>>N>>W;

    f(i,1,N)  cin>>wts[i]>>vals[i];

    memset(dp,-1,sizeof(dp));

    cout<<ks(N,W)<<endl;

    return 0;

}
    


Measured memory_bytes: 82304
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-10;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()


ll n, W, v[45], w[45];
 
void build(int bg, int en, vector<P> &t){
    int _n = en - bg;
    for(int i = 0; i<(1<<_n); ++i){
        ll vt = 0, wt = 0;
        for(int j = 0; j<_n; ++j){
            if((i>>j)&1){
                vt += v[bg+j];
                wt += w[bg+j];
            }
        }
        if(wt>W)continue;
        t.push_back({wt,vt});
    }
    SORT(t);
    ll vmax = 0;
    for(int i=0;i<t.size();++i){
        if(t[i].second < vmax)t[i].second = vmax;
        vmax = max(vmax, t[i].second);
    }
}
 

int main() {
    cin >> n >> W;
    REP(i,n){
        cin >> v[i] >> w[i];
    }
    vector<P> t[2];
    build(0,n/2,t[0]);
    build(n/2,n,t[1]);
    ll ans = 0;
    for(auto p : t[0]){
        auto q = *--upper_bound(ALL(t[1]),P(W-p.first,LLINF));
        ans = max(ans, p.second + q.second);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 43728
#include <bits/stdc++.h>
 using namespace std;
 int main() {
  int K;
  int A;
  int B;
  cin >> K >> A >> B;
  int X = A / K;
  int Y = B / K;
  if(X < Y){
   cout << "OK" << endl;
  }
  else if(B % K == 0){
   cout << "OK" << endl;
  }
  else if(A % K == 0){
   cout << "OK" << endl;
  }
  else{
   cout << "NG" << endl;
  }
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
const int N =1e6;

int dp[N], h[N];

int main(){
    int n;
    cin >> n;
    for(int i =0; i < n;i ++){
        cin >> h[i];
    }
    dp[1] = abs(h[0]-h[1]);
    for(int i = 2; i < n; i++){
        dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2] + abs(h[i]-h[i-2]));
    }
    cout << dp[n-1] << endl;

}


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

using namespace std;
using ll = long long;
const int nax = 1e6+1;
using dl = long double;
const dl PI = 3.14159265358979323846264;
int main(){
   dl a,b,x;
   cin>>a>>b>>x;
    dl vol =a*a*b;
    dl k= a*a*a;
if(x>=vol/2){
   dl z= vol - x;
   z= 2*z;
   dl p = z/k;
    dl ret = atan(p);
    dl val = (ret * 180) / PI;
    cout<<fixed<<setprecision(12)<<val;
}
else{
    dl q = b*b*a;
    q/=2;
    q/=x;
    dl ret = atan(q);
     dl val = (ret * 180) / PI;
    cout<<fixed<<setprecision(12)<<val;



}
return 0;
}



Measured memory_bytes: 3812
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<bool> ans(N, false);

    rep(i, N) {
        int a, b;
        cin >> a >> b;
        if(a == b) ans[i] = true;
    }
    
    bool YN = false;
    rep(i, N - 2) {
        if(ans[i] == true && ans[i + 1] == true && ans[i + 2] == true) {
            YN = true;
        }
    }

    if(YN == true) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3624
#include <stdio.h>
#define SIZE 201
 
int que[SIZE];
int head, tail;
 
int init() { head = tail = 0; }
int empty() { return head == tail; }
int push(int elm) { que[tail] = elm; tail = (tail+1)%SIZE; }
int front() { return que[head]; }
void pop() { head = (head+1)%SIZE; }
 
int bfs(int n, int G[][101], int *cost) {
  int i;
  init();
  push(1);
  cost[1] = 0;
  while(!empty()) {
    int p = front();
    pop();
    for(i = 1; i <= n; ++i) {
      if(!G[p][i]) continue;
      if(cost[i] != -1) continue;
      cost[i] = cost[p] + G[p][i];
      push(i);
    }
  }
}
 
 
int main() {
  int n;
  int i,j,k;
  int G[101][101];
  int src, dst;
  int cost[101];
  for(i = 0; i < 101; ++i)  {
    cost[i] = -1;
    for(j = 0; j < 101; ++j) {
      if(i == 0) G[i][j] = 1;
      else G[i][j] = 0;
    }
  }
  scanf("%d", &n);
  for(i = 1; i <= n; ++i) {
    scanf("%d %d", &src, &k);
    while(k--) {
      scanf("%d", &dst);
      G[src][dst] = 1;
    }
  }
  bfs(n,G,cost);
  for(i = 1; i <= n; ++i) {
    printf("%d %d\n", i, cost[i]);
  }
  return 0;
}


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

int main(void)
{
	int n;

	while(cin >> n, n){
		int a,b,c;

		while(--n, n >= 0){
			cin >> a >> b >> c;
			if(a == 100 || b == 100 || c == 100)
				cout << "A" << endl;

			else if((a+b)/2 >= 90)
				cout << "A" << endl;

			else if((a+b+c)/3 >= 80)
				cout << "A" << endl;
			
			else if((a+b+c)/3 >= 70 ||((a+b+c)/3 >= 50 && (a >= 80 || b >= 80)))
				cout << "B" << endl;
			else
				cout << "C" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1156
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)

N = int(input())
ans = (num2alpha(N)).lower()
print(ans)

Measured memory_bytes: 9116
#include <iostream>
#include <algorithm>

using namespace std;

void copy(int *to, int *from, int N){
    for(int i = 0; i < N; i++){
        to[i] = from[i];
    }
}

int main(){
    int N, K, Q;
    int A[2000];
    int B[2000];
    int C[2000];
    int D[2000];
    int ans;
    cin >> N >> K >> Q;
    for(int i = 0; i < N; i++){
        cin >> A[i];
        B[i] = A[i];
    }
    sort(B, B+N);
    ans = B[Q-1] - B[0];
    int prev = 0;
    for(int i = 0; i < N; i++){
        if(prev != B[i]){
            int cnt = 0;
            int left = 0, right = -1;
            for(int j = 0; j < N; j++){
                if(A[j] >= B[i]) right++;
                if(A[j] < B[i] || j == N-1){
                //if(A[j] < B[i]){
                    if(right-left+1 >= K){
                        copy(C, A+left, right-left+1);
                        sort(C, C+right-left+1);
                        copy(D+cnt, C, right-left-K+2);
                        cnt += right-left-K+2;
                    }
                    left = j+1;
                    right = j;
                }
            }
            if(cnt < Q)break;
            else {
                sort(D, D+cnt);
                ans = min(ans, D[Q-1]-D[0]);
            }
        }
        prev = B[i];
    }
    cout << ans << endl;
}

Measured memory_bytes: 256