akhauriyash/Code-Regression huggingface dataset:
N=input()
m=len(N)
ans=0
for i in range(m-1):
  if N[i+1]=="9":
    ans+=int(N[i])
  else:
    ans+=int(N[i])-1
    ans+=9*(m-2-i)
    break
if m!=1:
  ans+=9
else:
  ans+=int(N)
print(ans)
    

Measured memory_bytes: 38384
import sys
import re
import math
import collections
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal
import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))


# ===CODE===

def main():
    n = ni()
    a, c, g, t = 0, 1, 2, 3
    dic = {0: "A", 1: "C", 2: "G", 3: "T"}

    dp = [[[[0 for _ in range(4)] for __ in range(4)] for ___ in range(4)] for ____ in range(n + 1)]
    dp[0][t][t][t] = 1

    for x in range(n):
        for i in range(4):
            for j in range(4):
                for k in range(4):
                    for l in range(4):
                        if [j, k, l] not in [[a, g, c], [g, a, c], [a, c, g]]:
                            if [i, j, l] != [a, g, c]:
                                if [i, k, l] != [a, g, c]:
                                    dp[x + 1][j][k][l] += dp[x][i][j][k]
                                    dp[x + 1][j][k][l] %= MOD

    ans = 0
    for i in range(4):
        for j in range(4):
            for k in range(4):
                ans += dp[n][i][j][k]
                ans %= MOD

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 95548
#include <iostream>
using ll = long long;
using namespace std;

int main() {
    int a[2];
    for (auto &x : a) {
        cin >> x;
        if (x == 2){
            x = 3;
        } else if (x > 7){
            if (x%2 == 0) x = 1;
            else x = 2;
        } else {
            if (x%2 == 0) x = 2;
            else x = 1;
        }
    }
    if (a[0] == a[1]) cout << "Yes"; else cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<map>
#include<vector>

using namespace std;

const int mod=2019;

int l,r;

map<int,bool> M;

int main()
{
	scanf("%d %d",&l,&r);
	for(int i=l;i<=min(l+mod,r);i++)
		M[i%mod]=1;
	
	int ans=mod*mod;
	for(int i=0;i<mod;i++)
		if(M[i])
			for(int j=0;j<mod;j++) 
				if(M[j] && i!=j)
					ans = min(ans,i*j%mod);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 384
// file creato da gio il 2020-04-07 18:40:06.953635

#include <bits/stdc++.h>
#define FAST 

#ifdef FAST
#pragma GCC optimize("Ofast")
#pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
#endif

#define S second
#define F first
#define PB push_back
using namespace std;
int arr[100];
int main(){
	//freopen("output","w",stdout);
	//freopen("input","r",stdin);
#ifdef FAST
	ios::sync_with_stdio(0);
  	cin.tie(0);
#endif

	int n,m;
	cin >> n>>m;
	int sum=0;
	for(int i=0;i<n;i++){
		cin >>arr[i];
		sum+=arr[i];
	}
	int countM=0;
	int minval=sum/(4*m);
	if(sum%4*m==0){
		minval-=1;
	}
	for(int i=0;i<n&&countM<m;i++){
		if(arr[i]>minval)countM++;
	}
	cout << ((m==countM)? "Yes":"No");
	return 0;
}

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

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    deque<int> q;
    if(n & 1)
    {
        int tmp;
        for(int i = 0; i < n; ++i)
        {
            cin >> tmp;
            if(i % 2 ==1)
            q.push_back(tmp);
            else
            q.push_front(tmp);
        }
    }
    else
    {
        int tmp;
        for(int i = 0; i < n; ++i)
        {
            cin >> tmp;
            if(i % 2 == 0)
                q.push_back(tmp);
            else
                q.push_front(tmp);
        }
    }
    vector<int > a;
    while(!q.empty())
    {
        a.push_back(q.front());
        q.pop_front();
    }
    int sz = (int)a.size();
    for(int i = 0 ;i < sz ;++i)
    {
        if(i == sz - 1) cout << a[i] << endl;
        else cout << a[i] <<" ";
    }
    return 0;
}

Measured memory_bytes: 3960
n,m,l=(int(x) for x in input().split())
a=[[0 for i in range(m)] for j in range(n)]
b=[[0 for i in range(l)] for j in range(m)]
c=[[0 for i in range(l)] for j in range(n)]

for i in range(n):
  a[i][:]=(int(x) for x in input().split())

for i in range(m):
  b[i][:]=(int(x) for x in input().split())

for i in range(n):
  for j in range(m):
    for k in range(l):
      c[i][k]+=a[i][j]*b[j][k]

for i in range(n):
  for j in range(l):
    print(c[i][j],end='')
    if j<l-1:
      print(' ',end='')
  print('')


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

typedef long long ll;
const ll MOD = 1e9 + 7;
const long long INF = 1LL<<60;
const double PI=3.14159265358979323846;
const int NMAX=100005;
using namespace std;


ll gcd(ll a, ll b) {
    if (b == 0) return a;
    else return gcd(b, a % b);
}

ll lcm(ll x, ll y) {
    ll ans = x / gcd(x, y) * y;
    return ans;
}

int main(){
    ll a,b;
    cin >> a >> b;
    if(a > b) swap(a,b);
    vector<ll> l;
    for(ll i = 1; i*i <= a; i++){
        if(a%i == 0){
            if(b%i == 0) l.push_back(i);
            ll t = a/i;
            if(t != i && b%t == 0) l.push_back(t);
        }
        if(b%i == 0){
            ll t = b/i;
            if(t != i && a%t == 0) l.push_back(t);
        }
    }
    sort(l.begin(), l.end());
    
    ll ans = 0;
    for(int i = 0; i < l.size(); i++){
        if(l[i] == -1) continue;
        ans++;
        if(l[i] == 1) continue;
        for(int j = i+1; j < l.size(); j++){
            if(l[j] == -1) continue;
            if(l[j]%l[i] == 0){
                l[j] = -1;
                continue;
            }
            for(ll k = 2; k*k <= l[i]; k++){
                if(l[i]%k == 0 && l[j]%k == 0){
                    l[j] = -1;
                    break;
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3716
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
#include<iterator>
#include<list>

using namespace std;

typedef  long long int lint;

#define rep(i, n) for (lint i = 0; i < n; i++)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
#define mp make_pair
#define P pair<int,int>
#define enld endl

vector<lint> prime_factorization(lint N) {
	//素因数分解して配列で返す
	vector<lint> R;
	if (N < 2)return R;
	for (lint i = 2; i * i <= N; i++) {
		while (N % i == 0) {
			R.push_back(i);
			N /= i;
		}
	}
	if (N != 1) {
		R.push_back(N);
	}
	return R;
}

int main() {
	lint N;
	cin >> N;
	vector<lint>V = prime_factorization(N);
	cout << N << ':';
	rep(i, V.size()) {
		cout << ' ' << V[i];
	}
	cout << enld;
}


Measured memory_bytes: 3152
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

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

    vector<int> a(n);
    for(int i=0; i<n; ++i)
        cin >> a[i];

    set<int> used;
    for(int i=n-1; i>=0; --i){
        if(m > 0 && used.find(a[i]) == used.end()){
            cout << a[i] << endl;
            used.insert(a[i]);
            -- m;
        }
    }

    return 0;
}

Measured memory_bytes: 3908
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define ALL(v) (v).begin(),(v).end()
using namespace std;

int main() {
	int n, l;
	cin >> n >> l;
	vector<string> v(n);
	REP(i, n) cin >> v[i];
	sort(ALL(v));
	REP(i, n) cout << v[i];
	cout << '\n';
}

Measured memory_bytes: 256
import math
import cmath

coordinates = 0
ang = 90
while True:
    line = list(map(float, input().split(",")))
    if line[0] == 0 and line[1] == 0:
        break

    coordinates += cmath.rect(line[0], math.radians(ang))
    ang -= line[1]

print(int(coordinates.real))
print(int(coordinates.imag))

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

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

  vector<int> l(n);
  rep(i, n) cin >> l[i];

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

  int ans = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      int a = l[i];
      int b = l[j];
      int d = distance(l.begin(), lower_bound(l.begin(), l.end(), a + b));
      int l = j + 1;
      ans += d - l;
    }
  }
  cout << ans << endl;
}

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

int main() {
    int A, B;
    double H, M;
    cin >> A >> B >> H >> M;
    static const double pi = 3.141592653589793;
    double bp = M / 60.0;
    double ap = (H+M/60) / 12.0;
    ap *= 2.0*pi;
    bp *= pi*2.0;
    double ax = double(A) * cos(ap);
    double ay = double(A)*sin(ap);
    double bx = double(B) * cos(bp);
    double by = double(B)*sin(bp);
    double dx = (ax - bx);
    double dy = (ay - by);
    cout << setprecision(20) << sqrt(dx*dx + dy*dy) << endl;

    return 0;
}

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

#define     fast()              ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); 
#define     ll                  long long int
#define     test()              ll t; cin>>t; while(t--) 
#define     lp0(i,begin,end)    for(ll i=begin;i<end;i++)
#define     lp1(i,begin,end)    for(ll i=begin;i<=end;i++)
#define     rlp(i,begin,end)    for(ll i=end;i>=begin;i--)
#define     prec(n)             fixed<<setprecision(n)
#define     initial(a,i)        memset(a,i,sizeof(a))
#define     pb                  push_back
#define     PI                  3.1415926535897932384626433832795
#define     MOD                 1000000007
#define     F                   first
#define     S                   second
#define     all(a)              (a).begin(),(a).end()
#define     BPC(x)              __builtin_popcountll(x)
#define     gcd(a,b)            __gcd(a,b)

ll gcd(ll a,ll b) {if (a==0) return b;return gcd(b%a,a);}

ll power(ll x,ll n)
{
    ll result = 1;
    while (n)
    {
        if (n & 1)
            result = result * x;
        n = n / 2;
        x = x * x;
    }
    return result;
}


// Solution Function
void solution(ll compte)
{
    // cout<<compte<<"\n";
    ll a;
    string s;
    cin>>a>>s;
    if(a>=3200)cout<<s<<endl;
    else cout<<"red"<<endl;
}
// Driver Function
int main()
{
    ll compte = 1;
    //test()
    //{
        solution(compte);
        compte++;
    //}
    return 0;
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
#define MN 100005
inline long long read(){
	long long 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;
}
long long n,k,a[MN],p[MN],q[MN],b[MN];
long long mm(long long x){return x>0?x:0;}
int main(){
	n=read(),k=read();
	for(int i=1;i<=n;i++) a[i]=read(),b[i]=b[i-1]+a[i];
	for(int i=1;i<=n;i++) p[i]=p[i-1]+(a[i]>0?a[i]:0);
	for(int i=n;i>=1;i--) q[i]=q[i+1]+(a[i]>0?a[i]:0);
	long long ans=-1;
	for(int i=1;i+k-1<=n;i++) ans=max(ans,p[i-1]+q[i+k]+mm(b[i+k-1]-b[i-1]));
	printf("%lld",ans);
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
 
#define endl '\n'
#define f1 first
#define s2 second
#define pb push_back
#define mp make_pair
#define ll long long
#define fri(a) freopen(a,"r",stdin);
#define fro(a) freopen(a,"w",stdout);
const int N=405;

int n;

void solve(){
	bool flag=0;
	for(int i=1;i<=n;i++){
		if(n%i==0 && i<10 && n/i<10){
			flag=1;
			break;
		}
	}
	if(flag)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;


}

int main(){
	//fri("in.txt");
	//fro("out.txt");
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin>>n;
	solve();
	


return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    int b=ceil(n*1.0/1000.0);
    int c=b*1000;
    cout<<(c-n)<<'\n';
}


Measured memory_bytes: 3656
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = Long.parseLong(sc.next());
        long b = Long.parseLong(sc.next());
        long c = Long.parseLong(sc.next());   
        long k = Long.parseLong(sc.next());
        long count = 0;
        if(a <= k) {
            count += a;
            k -= a;
            if(b <= k) {
                k -= b;
                if(c <= k) {
                    count -= c;
                    k -=c;
                }else {
                    count -= k;
                    k = 0;
                }
            }else {
                k = 0;
            }
        }else {
            count = k;
            k = 0;
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 35744
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(t) t.begin(), t.end()
#define inrange(i, a, b) (((i)>= min((a), (b))) && ((i) <= max((a), (b))))
typedef vector<ll> vi;
#define fi first
#define se second
const ll inf = 9e18;
const ll mod = 1e9 + 7;

void print(ll a[], ll n){for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<"\n";}
ll power(ll x, ll y, ll M = inf){
    ll ans = 1;
    x %= M;
    while(y){
        if(y&1)
            ans = (x * ans) % M;

        x = (x * x) % M;
        y >>= 1;
    }
    return ans;
}
ll modInverse(ll n) {return power(n, mod-2, mod);}
inline ll mul(ll a, ll b){ return (a * b) % mod; }
inline ll sub(ll a, ll b){ ll c = a - b; if(c < 0) c += mod; return c; }
inline ll add(ll a, ll b){ ll c = a + b; if(c > mod) c -= mod; return c; }
inline ll divi(ll a, ll b){ return mul(a, modInverse(b)); }

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

	string s;
	cin>>s;
	map<char, ll> mp;
	for(int i=0;s[i];i++){
		mp[s[i]]++;
	}
	if(mp.size() == 2 && mp[s[0]] == 2) cout<<"Yes\n";
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <set>
#include <cctype>
#include <vector>
#include <map>
#include <queue>
#include <list>
#include <algorithm>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <limits>
#include <cmath>
#include <typeinfo>


using namespace std;

int main() {
	int r = 0, d = 0, x = 0, total = 0;
	cin >> r >> d >> x;
	int tmp = x;
	for(int i = 0; i < 10; i++) {
		total = r * tmp - d;
		cout << total << endl;
		tmp = total;

	}

    return 0;
}

Measured memory_bytes: 256
IDENTIFICATION DIVISION.
 PROGRAM-ID.     TEST140.
 DATA DIVISION.
 WORKING-STORAGE SECTION.
  01 INP        PIC 9(1).
  01 WA         PIC 9(3).
  01 ANS        PIC ZZ9.

 PROCEDURE DIVISION.
  ACCEPT INP.
  COMPUTE WA = INP * INP * INP.
  MOVE WA       TO ANS.

  DISPLAY ANS.
 STOP RUN.

Measured memory_bytes: 384
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    vector<ll> a(n);
    for(int i = 0; i < n; ++i){
        cin >> a.at(i);
    }

    ll s = 0;
    for(int i = 0; i < n; ++i){
        s ^= a.at(i);
    }

    for(int j = 0; j < n; ++j){
        a.at(j) &= ~s;
    }

    int r = 0;
    for(int k = 60; k >= 0; --k){
        bool found = false;
        for(int i = r; i < n; ++i){
            if((a.at(i) >> k) & 1){
                swap(a.at(r), a.at(i));
                found = true;
                break;
            }
        }
        if(!found){
            continue;
        }
        for(int i = 0; i < n; ++i){
            if(i == r){ continue; }
            if((a.at(i) >> k) & 1){
                a.at(i) ^= a.at(r);
            }
        }
        r++;
    }

    ll s2 = 0;
    for(int i = 0; i < n; ++i){
        s2 ^= a.at(i);
    }

    ll ans = s + 2 * s2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define EQ(a,b) abs((a)-(b))<EPS
using namespace std;
typedef long double D;
const D EPS = 1e-8;

int n,b;
D d;
D p[11],h[11];

bool check(D H, D W){
  D a = -4*H/W/W;
  rep(i,n){
    D x = p[i];
    while(x+EPS>W)x -= W;
    if(EQ(x,0))return false;
    if(a*(x-W/2)*(x-W/2)+H +EPS < h[i])return false;
  }
  return true;
}

int main(){
  cin >> d >> n >> b;
  rep(i,n)cin >> p[i] >> h[i];

  D res = 1e15;
  rep(i,b+1){
    D w = d/(i+1);
    D l = w/4, r = 1e15;
    rep(azu,300){
      D mid = (l+r)/2;
      if(check(mid,w))r = mid;
      else l = mid;
    }
    D vy = sqrt(2*l), vx = w/2/vy;
    res = min(res, sqrt(vy*vy + vx*vx));
  }
  cout << fixed << setprecision(5) << res << endl;
}

Measured memory_bytes: 1296
<?php
$ans = 0;
fscanf(STDIN, '%s', $org);
$rev = strrev($org);
$len = strlen($org);
$orgArr = str_split($org);
$revArr = str_split($rev);
$lim = floor($len / 2);
for ($i=0; $i < $lim; $i++) { 
    if ($orgArr[$i] != $revArr[$i]) {
        $ans++;
    }
}
echo $ans . "\n";

Measured memory_bytes: 4728
#include<stdio.h>
#include <math.h>
int main()
{
    double x1,y1;
    double x2,y2,D;
    scanf("%lf %lf",&x1,&y1);
    scanf("%lf %lf",&x2,&y2);
    D=sqrt(pow((x2-x1),2)+pow((y2-y1),2));
    printf("%.8lf\n",D);
    return 0;

}



Measured memory_bytes: 2120
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
const int mod=1e9+7;
// Not for Rating """"""""""I'm in Love with Experience :)""""""""""""""""""
void solve()
{
    ll N;cin>>N;
    string s; cin>>s;
    ll c=0;
    for(int i=0;i<N-2;++i)
    {
        if(s[i]=='A' and s[i+1]=='B' and s[i+2]=='C')c++;
    }
    cout<< c;
}
int main(void)
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    int T=1;while(T--){solve();}return 0;
}/*Solved By:- RITIK AGARWAL*/

Measured memory_bytes: 3588
#include <iostream>
#include <vector>
#include <string>
using namespace std;

int N;
vector<vector<int>> v(26);
int vis[26] = {};

bool dfs(int n){
    vis[n] = -1;
    bool ok = true;
    for(auto x:v[n]){
        if(vis[x]==0) ok = ok && dfs(x);
        else if(vis[x]==-1) return false;
    }
    vis[n] = 1;
    return ok;
}

int main(){
    while(cin >> N && N){
        vector<string> S(N);
        for(int i=0;i<26;i++){
            v[i].clear();
            vis[i] = 0;
        }
        bool yes = true;
        for(int i=0;i<N;i++){
            cin >> S[i];
            if(i>=1){
                if(S[i-1].size()>S[i].size() && S[i-1].substr(0,S[i].size())==S[i]) yes = false;
                else{
                    int n = S[i-1].size(),m = S[i].size();
                    for(int j=0;j<min(n,m);j++){
                        if(S[i-1][j]!=S[i][j]){
                            v[S[i-1][j]-'a'].push_back(S[i][j]-'a');
                            break;
                        }
                    }
                }
            }
        }
        for(int i=0;i<26;i++) if(!vis[i]) yes = yes && dfs(i);
        cout << (yes? "yes":"no") << endl;
    }
}


Measured memory_bytes: 3212
#include <stdio.h>
#include <memory.h>
int map[15][15],z;
void set(int x,int y,int num){
    if(num>z*z)
        return;
    do{
        if(x<0||x>=z)
            x<0?x+=z:(x-=z);
        if(y<0||y>=z)
            y<0?y+=z:(y-=z);
        if(map[y][x]){
            x-=1;
            y+=1;
        }
    }while(x<0||y<0||x>=z||y>=z||map[y][x]);
    map[y][x]=num;
    set(x+1,y+1,num+1);
}
int main(void){
    int i,o;
    for(;memset(map,0,sizeof(map)),scanf("%d",&z),z;){
        set(z/2,z/2+1,1);
        for(i=0;i<z;i++)
            for(o=0;o<z;o++)
                printf("%4d%s",map[i][o],o==z-1?"\n":"");
    }
    return 0;
}

Measured memory_bytes: 612
n,a,b,c,d = map(int,input().split())
s = list(input())
s.insert(0,0)
for i in range(a,max(c,d)):
    if '#' == s[i] and '#' == s[i+1]:
        print('No')
        exit(0)
if c < d:
    print('Yes')
else:
    for i in range(b-1,d):
        if '.' == s[i] and '.' == s[i+1] and '.' == s[i+2]:
            print('Yes')
            exit(0)
    print('No')

Measured memory_bytes: 10568
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <stack>
#include <functional>

#ifdef LOCAL
    #define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
    #define eprintf(...) 42
#endif

#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define repp(i, m, n) for(int i = m, i##_len = (n); i < i##_len; ++i)
#define reprev(i, n) for(int i = (n-1LL); i >= 0; --i)
#define all(x) (x).begin(), (x).end()
template <class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
template <class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int,int> P;
typedef long double ld;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<int> a(n); rep (i, n) cin >> a[i];
    bool flg = true;
    rep (i, n) {
        if (a[i] % 2 == 0 && a[i] % 3 != 0 && a[i] % 5 != 0) flg = false;
    }
    if (flg) cout << "APPROVED\n";
    else cout << "DENIED\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
constexpr int INF = numeric_limits<int>::max()/2;
constexpr long long LINF = numeric_limits<long long>::max()/3;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename T> ostream& operator<<(ostream& os,const set<T>& st){ os<<"{"; for(T v:st) os<<v<<","; os <<"}"; return os; }
template<typename T,typename U> inline void chmax(T &x,U y){ if(y>x) x = y; }
template<typename T,typename U> inline void chmin(T &x,U y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

int main(){
    ll N,A,B; cin >> N >> A >> B;
    vector<ll> h(N); rep(i,N) cin >> h[i];
    sort(all(h));

    const ll D = A - B;

    ll l,r;
    l = 0;
    r = 1000050000;

    while(r-l>1){
        ll m = (l+r)/2;
        auto hh(h);

        for(auto& v:hh){
            v -= min(m*B,v);
            v=max(v,0ll);
        }

        ll c = 0;
        for(auto v : hh){
            if(v==0) continue;
            c+=(v+D-1)/D;
        }

        if(c<=m){ // ok
            r = m;
        }else{
            l = m;
        }
    }
    cout << r << endl;
}


Measured memory_bytes: 1792
#include<cstdio>
#include<set>
#include<algorithm>
#define rep(i, n) for ( int i = 0; i < (int)n; i++ )
using namespace std;

#define MAX 10000
#define BEGIN 1
#define END 0

class Sheet{
    public:
    int x1, y1, x2, y2;
    Sheet(){}
    Sheet(int x1, int y1, int x2, int y2): x1(x1), y1(y1), x2(x2), y2(y2){}

    bool operator < ( const Sheet &s ) const {
	if ( x1 == s.x1 ) return y1 < s.y1;
	return x1 < s.x1;
    }
};

class Event{ 
    public:
    int id, mode, x;
    Event(){}
    Event( int id, int mode, int x): id(id), mode(mode), x(x){}

    bool operator < ( const Event &e ) const{
	if ( x == e.x ) return mode > e.mode;
	return x < e.x;
    }
};

int n, ne;
Sheet S[MAX+1];
Event E[2*MAX+1];
int r;

int getHeight( multiset<pair<int, int> > &seg, int &group ){
    group = 1;
    if ( seg.size() == 0 ) return 0;
    int w = 0;
    int s, t;
    multiset<pair<int, int> >::iterator it = seg.begin();
    s = (*it).first;
    t = (*it).second;
    for (++it; it != seg.end(); it++ ){
	if ( (*it).first > t ){
	    w += (t - s);
	    s = (*it).first;
	    t = (*it).second;
	    group++;
	} else {
	    t = max( t, (*it).second);
	}
    }
    w += (t - s);
    return w;
}

void sweep(){
    multiset< pair<int, int> > cur;
    int area = 0, vertical = 0, horizon = 0;
    int height = 0, preH = 0, group = 0, prex = E[0].x;

    for ( int e = 0; e < ne; e++ ){
	Event ev = E[e];
	area += (ev.x - prex)*height;
	horizon += (ev.x - prex)*2*group;

	if ( ev.mode == BEGIN ) cur.insert( make_pair( S[ev.id].y1, S[ev.id].y2) );
	else  cur.erase( cur.find(make_pair( S[ev.id].y1, S[ev.id].y2)) );

	preH = height;
	prex = ev.x;

	height = getHeight(cur, group);

	if ( ev.mode == BEGIN ) vertical += height - preH;
	else  vertical += preH - height;
    }

    printf("%d\n", area);
    if ( r == 2 ) printf("%d\n", vertical + horizon);
}

int main(){
    while(1){
	scanf("%d %d", &n, &r);
	if ( n == 0 && r == 0) break;
	ne = 0;
	rep(i, n) scanf("%d %d %d %d", &S[i].x1, &S[i].y1, &S[i].x2, &S[i].y2);
	sort( S, S+n);
	rep(i, n){
	    E[ne++] = Event(i, BEGIN, S[i].x1);
	    E[ne++] = Event(i, END, S[i].x2);
	}
	sort( E, E + ne );
	sweep();
    }
    return 0;
}

Measured memory_bytes: 1644
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <complex>
typedef long long int LL;
using namespace std;

// 插入此處

struct Edge {
    int to;
    int weight;
};

struct Node {
    bool vis;
    vector<Edge> edges;
    int color;
} nodes[100005];

void dfs(int nu) {
    Node cur = nodes[nu];
    for (Edge edge : cur.edges) {
        if (!nodes[edge.to].vis) {
            // printf("%d -> %d\n", nu, edge.to);
            nodes[edge.to].vis = true;
            nodes[edge.to].color = edge.weight % 2 == 0 ? cur.color : !cur.color;
            dfs(edge.to);
        }
    }
}

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n - 1; i++) {
        int u, v, w;
        scanf("%d%d%d", &u, &v, &w);
        nodes[u].edges.push_back(Edge{v, w});
        nodes[v].edges.push_back(Edge{u, w});
    }
    nodes[1].color = 0;
    nodes[1].vis = true;
    dfs(1);
    for (int i = 1; i <= n; i++) {
        printf("%d\n", nodes[i].color);
    }
}


Measured memory_bytes: 11136
#include <iostream>

void swap(int*, int, int);
void sepTwoNumbers(char*, int&, int&);
int char2Number(char*, int, int);

const int MAX_VIRTICAL_LINE = 30;
const int MAX_HORIZONTAL_LINE = 30;

int main(){
	int numOfVirticalLine;
	int numOfHorizontalLine;
	int amidaList[MAX_VIRTICAL_LINE] = {};

	for (int i = 0; i < MAX_VIRTICAL_LINE; i++)
	{
		amidaList[i] = i + 1;
	}

	std::cin >> numOfVirticalLine >> numOfHorizontalLine;
	for (int i = 0; i < numOfHorizontalLine; i++)
	{
		int line1, line2;
		char swapLineInfo[6];
		std::cin >> swapLineInfo;
		sepTwoNumbers(swapLineInfo, line1, line2);
		swap(amidaList, line1, line2);
	}
	for (int i = 0; i < numOfVirticalLine; i++)
	{
		std::cout << amidaList[i] << std::endl;
	}
	return 0;
}

void sepTwoNumbers(char* charOftwoNumber, int& number1, int& number2){
	int commaIndex;
	int endIndex;
	for (commaIndex = 0; charOftwoNumber[commaIndex] != ','; ++commaIndex);
	number1 = char2Number(charOftwoNumber, 0, commaIndex);
	for (endIndex = commaIndex; charOftwoNumber[endIndex] != '\0'; ++endIndex);
	number2 = char2Number(charOftwoNumber, commaIndex + 1, endIndex);
}

int char2Number(char* charNumber, int startDigit, int endDigit){
	int number = 0;
	for (int i = startDigit; i < endDigit; ++i){
		number *= 10;
		number += charNumber[i] - '0';
	}
	return number;
}

void swap(int* amidaList, int line1, int line2){
	int temp = amidaList[line1 - 1];
	amidaList[line1 - 1] = amidaList[line2 - 1];
	amidaList[line2 - 1] = temp;
}


Measured memory_bytes: 3100
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
typedef long long ll;

#include <bits/stdc++.h>
using namespace std;

int main() {
  int a,b;
  cin>>a>>b;
  
  if(b%a==0) cout<<a+b<<endl;
  else cout<<b-a<<endl;

  return 0;
}

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

int main(){
    using namespace std;
    unsigned long N, M, K;
    cin >> N >> M >> K;
    vector<unsigned long> uf(N), sz(N, 1);
    iota(uf.begin(), uf.end(), 0UL);
    const auto& find = [&uf](unsigned long i) -> unsigned long {
        while(i != uf[i])i = uf[i] = uf[uf[i]];
        return i;
    };
    const auto& unite = [&uf, &sz, &find](unsigned long i, unsigned long j) -> void {
        i = find(i);
        j = find(j);
        if(i == j)return ;
        if(sz[i] < sz[j])swap(i, j);
        sz[i] += sz[j];
        uf[j] = i;
    };
    vector<unsigned long> ans(N, 1);
    for(unsigned long i{0}, a, b; i < M; ++i){
        cin >> a >> b;
        ++ans[--a];
        ++ans[--b];
        unite(a, b);
    }
    for(unsigned long i{0}, c, d; i < K; ++i){
        cin >> c >> d;
        if(find(--c) == find(--d)){
            ++ans[c];
            ++ans[d];
        }
    }
    for(unsigned long i{0}; i < N; ++i)cout << sz[find(i)] - ans[i] << " ";
    return 0;
}

Measured memory_bytes: 3200
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

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

int main(){
    vector<int> s, t;
    int n,q;
    cin >> n;
    s.resize(n);
    rep(i,n){
        int k;
        cin >> k;
        s[i] = k;
    }
    cin >> q;
    t.resize(q);
    rep(i,q){
        int k;
        cin >> k;
        t[i] = k;
    }
//    sort( s.begin(), s.end() );
    sort( t.begin(), t.end() );
    int cnt = 0, is=0, it=0;
    while( is<n && it<q ){
        if( s[is] == t[it] ){
            cnt++;
            is++;
            it++;
        }else if( s[is] < t[it] )
            is++;
        else
            it++;
    }
    cout << cnt << endl;
    return 0;
}

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

int main(int argc, char const *argv[])
{
	int n, m; cin >> n >> m;
	vector<int> a(n); rep(i, n) cin >> a[i];
	vector<int> b(m), c(m); rep(i, m) cin >> b[i] >> c[i];

	sort(a.begin(), a.end()); reverse(a.begin(), a.end());

	vector<pair<int, int>> v; rep(i, m) v.push_back(make_pair(c[i], b[i]));
	sort(v.begin(), v.end()); reverse(v.begin(), v.end());

	vector<int> vc; {
		int idx = 0;
		while(vc.size() < n && idx < m) {
			if (v[idx].second > 0) {
				vc.push_back(v[idx].first);
				v[idx].second--;
			} else {
				idx++;
			}
		}
		while (vc.size() < n) vc.push_back(0);
		sort(vc.begin(), vc.end());

		// for (auto u : vc) printf("%d ", u);
		// printf("\n");
	}

	ll ans = 0;
	rep(i, n) {
		ans += max(a[i], vc[i]);
	}
	cout << ans << endl;
	return 0;
}


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

#define REP(i,n) for(int i=0; i < (n); ++i)
#define REPR(i,n) for(int i=(n); i >= 0; --i)
#define FOR(i, m, n) for(int i = (m); i < (n); ++i)

using ll = long long;
#define INF 1e9


int main(){
  string S;
  cin >> S;
  for(int i = S.length()-2; i >=2; i-=2){
    bool flag = true;
    REP(j, i/2){
      if(S[j] != S[i/2+j]){
        flag = false;
        break;
      }
    }
    if(flag){
      cout << i << endl;
      break;
    }
  }


  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define mp make_pair
#define pb push_back
#define pll pair<ll,ll>
ll INF = 1000000007;


/***************/
 #define amin main
/***************/

ll exp(ll x, ll n)
{if(n==0) return 1;if(n==1) return x%INF;if(n%2==0) return exp((x*x)%INF,n/2); else return(x*exp((x*x)%INF,n/2))%INF;}


int amin()
{
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t,i,j;
	ll n;
	cin>>n;
	vector<char>ans;
	//n--;
	while(n>0)
	{
		n--;
		ans.pb('a'+ n%26);
		n = n/26;
	}
	reverse(ans.begin(),ans.end());
	for(i=0;i<ans.size();i++)
	{
		cout<<ans[i];
	}
	cout<<endl;	
	


	
	

	
	


	
	return 0;
}

Measured memory_bytes: 3652
from collections import defaultdict, deque, Counter


def euler_tour(G, root=0):
    n = len(G)
    euler = []
    dq = deque([root])
    dq2 = deque()
    visited = [0] * n
    while dq:
        u = dq.pop()
        euler += [u]
        if visited[u]:
            continue
        for v in G[u]:
            if visited[v]:
                dq += [v]
            # [親頂点、子頂点、子頂点、。。。]と入れていく.その後連結
            else:
                dq2 += [v]
        dq.extend(dq2)
        dq2 = deque()
        visited[u] = 1
    return euler

import sys
import bisect
input = sys.stdin.readline
n = int(input())
num = list(map(int,input().split()))
ab = [list(map(int,input().split())) for i in range(n-1)]
graph = [[] for i in range(n+1)]
for a,b in ab:
  graph[a].append(b)
  graph[b].append(a)
et = euler_tour(graph,1)
vis = [0]*(n+1)
ans = [0]*(n+1)
dp = [0]
parent = [0]*(n+1)
dc = defaultdict(int)
for i in range(len(et)):
  x = et[i]
  m = num[x-1]
  if vis[x] == 0:
    if x != 1:
      parent[x] = et[i-1]
    idx = bisect.bisect_left(dp,m)
    if idx == len(dp):
      dp.append(m)
      dc[x] = -1
    else:
      dc[x] = dp[idx]
      dp[idx] = m
    ans[x] = len(dp)-1
    vis[x] = 1
  else:
    prv = num[et[i-1]-1]
    kid = et[i-1]
    change = dc[kid]
    idx = bisect.bisect_left(dp,prv)
    if change == -1:
      dp.pop()
    else:
      dp[idx] = change
print(*ans[1:])

Measured memory_bytes: 178804
n = int(input())
h = list(map(int, input().split()))
l = 0
ans = 0
while l < n:
    r = l
    while r < n-1 and h[r] >= h[r+1]:
        r += 1
    ans = max(ans, r-l)
    l = r+1
print(ans)

Measured memory_bytes: 14252
#include <string>
#include <iostream>
#include <stack>
#include <queue> // priority_queue も入ってる
#include <set>   // 要素数は size() で取得 multisetもある
#include <map>
#include <array> // sizeはコンパイル時定数で固定
#include <vector>
#include <numeric>   // accumulate, gcd
#include <algorithm> // count_ifに必要
#include <iomanip>   // cout << setprecision(15) << x で小数の出力精度を指定
#include <tuple>
#include <utility> //pair
#include <cmath>
#include <bitset>

using namespace std;
// 問題が起こるまでintは使用禁止2020-04-13
using ll = long long;

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

template <class InputIterator, class T>
bool contains_itr(InputIterator iterator, const T &value)
{
    if (find(iterator.begin(), iterator.end(), value) == iterator.end())
        return false;
    else
        return true;
}

template <class T>
bool contains_set(set<T> st, const T &value)
{
    if (st.find(value) == st.end())
    {
        return false;
    }
    else
    {
        return true;
    }
}

template <class InputIterator>
auto sum(InputIterator iterator)
{
    return accumulate(iterator.begin(), iterator.end(), 0);
}

// endは排他的(exclusive)なので注意
vector<ll> range(ll begin, ll end)
{
    vector<ll> result;
    for (ll i = begin; i < end; ++i)
    {
        result.push_back(i);
    }
    return result;
}

// =========ここまでテンプレ============

int main()
{
    ll n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    rep(i, min(k, ll{41}))
    {
        vector<ll> b(n);
        rep(j, n)
        {
            // for (ll m = max(j - a[j], ll{0}); m <= min(j + a[j], n - 1); ++m)
            // {
            //     ++b[m];
            // }
            ++b[max(j - a[j], ll{0})];
            if (j + a[j] + 1 < n)
                --b[j + a[j] + 1];
        }
        for (ll j = 1; j < n; ++j)
            b[j] += b[j - 1];
        a = b;
        if (a == vector<ll>(n, n))
        {
            // cout << 'k: ' << k << endl;
            break;
        }
    }
    rep(i, n) cout << a[i] << ' ';
    cout << endl;
}

Measured memory_bytes: 7600
#include <iostream>
#include <string>

using namespace std;
typedef long long ll;

int main(){
    ll n, k;
    cin >> n >> k;
    string s;
    cin >> s;
    ll ans = 0;
    for(int i = 0; i < n - 1; ++i){
        ans += (s.at(i) == s.at(i + 1));
    }
    ans = min(ans + 2 * k, n - 1);
    cout << ans << endl;
    return 0;
}

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

int main()
{
    int n,m;
    cin >> n >> m;
    map<long long int,int> nums;
    for(int i = 0; i < n; ++i)
    {
        long long int t;
        scanf("%lld",&t);
        nums[t] += 1;
    }

    for(int i = 0; i < m; ++i)
    {
        int b;
        long long int c;
        scanf("%d %lld", &b, &c);
        nums[c] += b;
    }

    long long int sum = 0;
    map<long long int,int>::iterator numsIt = nums.end();
    --numsIt;
    while(n > 0)
    {
        long long int values = numsIt->first;
        int count = numsIt->second;
        if(n > count)
        {
            sum += values * count;
            n -= count;
        }
        else
        {
            sum += values * n;
            n = 0;
        }
        --numsIt;
    }
    cout << sum << endl;
}

Measured memory_bytes: 12800
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
#include<stdio.h>
#include <cstdint>
#include <stdlib.h> 
#include <time.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rrep(i,n) REP(i,1,n+1)
#define all(a) a.begin(), a.end()
#define fi first
#define se second
#define RNG(x, a, n) &((x)[a]), &((x)[n])
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
typedef long long ll;
typedef pair<ll, ll> Pll;
typedef pair<int, int> PII;
typedef vector<ll> Vl;
typedef vector<int> VI;
typedef tuple<int, int, int> TT;
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
const int MAX = 500000;
const int inf = 1000000007;
const ll mod = 1000000007;
const long double PI = (acos(-1));
const long double EPS = 0.0000000001;

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




int n, m;
vector<PII> hen[200005];
int d[200005];
int ans[200005];

void dijkstra(int s) {
	priority_queue < PII, vector<PII>, greater<PII>> que;
	fill(d, d + n, inf);
	d[s] = 0;
	ans[s] = 0;
	que.push(PII(0, s));
	while (!que.empty()) {
		PII p = que.top(); que.pop();
		int v = p.second;
		if (d[v] < p.fi) continue;
		rep(i, hen[v].size()) {
			PII e = hen[v][i];
			if (d[e.fi] > d[v] + e.se) {
				d[e.fi] = d[v] + e.second;
				que.push(PII(d[e.fi], e.fi));
				ans[e.fi] = v;
			}
		}
	}
}

int main() {

	cin >> n >> m;

	queue<PII> que;

	rep(i, 200005)d[i] = inf;

	rep(i, m) {
		int tmp1, tmp2;
		cin >> tmp1 >> tmp2;
		hen[tmp1].push_back(dmp(tmp2, 1));
		hen[tmp2].push_back(dmp(tmp1, 1));
	}

	dijkstra(1);
	
	cout << "Yes" << endl;

	REP(i, 2, n + 1) {
		cout << ans[i] << endl;
	}

}


Measured memory_bytes: 16228
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    func count() -> Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
}
extension Array where Element: Comparable {
    func max() -> Element! {
        return self.maxElement()
    }
    func min() -> Element! {
        return self.minElement()
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}
func pow(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){(i,_) in i * lhs}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let input = readIntSplit(by: " ")
let (x1, y1, x2, y2) = (input[0], input[1], input[2], input[3])
let (dx, dy) = (x1-x2, y1-y2)
let (x3, y3) = (x2+dy, y2-dx)
let (x4, y4) = (x3+dx, y3+dy)
print("\(x3) \(y3) \(x4) \(y4)")


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

int main(){
  int a,b;
  cin >> a >> b;
  
  if(a != 1 && a < b){
    cout << "Bob" << endl;
  }else if(b != 1 && a > b){
    cout << "Alice" << endl;
  }else if(a == 1 && a < b){
    cout << "Alice" << endl;
  }else if(b == 1 && a > b){
    cout << "Bob" << endl;
  }else if(a == b){
    cout << "Draw" << endl;
  }
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S1 = sc.next();
        String str = String.valueOf(S1);
        String W2=null;
        String W1=null;
        for(int count=1;count<=4;count++){
         W1 = str.substring(count-1,count);
            if(W1.equals(W2)){
            System.out.print("Bad");
            return;
        }
        W2=W1;
        }
        System.out.print("Good");
   	 }
}

Measured memory_bytes: 21844
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

string L;
constexpr ll MOD = 1e9 + 7;
vector<vector<ll>> memo;

ll solve(ll i, bool small) {
    if (i == L.size()) {
        return 1;
    }

    if (memo[i][small] != -1) {
        return memo[i][small];
    }

    ll result = 0;
    if (small) {
        result = 3 * solve(i + 1, small) % MOD;
    } else {
        if (L[i] == '0') {
            //(0, 0)だけ
            result = solve(i + 1, false);
        } else {
            //(1, 0), (0, 1), (0, 0)
            result = (2 * solve(i + 1, small) % MOD + solve(i + 1, true)) % MOD;
        }
    }

    return memo[i][small] = result;
}

int main() {
    cin >> L;
    memo.resize(L.size(), vector<ll>(2, -1));
    cout << solve(0, false) << endl;
}

Measured memory_bytes: 10496
#include <cstring>
#include <algorithm>
#include <string>
#include <iostream>
#include <map>

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

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

string g[100];

int h,w;
int main(){
    while(cin>>h>>w && h){
        map<string,int> m;
        rep(i,h)cin>>g[i];
        rep(i,h)rep(j,w){
            rep(d,4){
                string s;
                for(int ii=i, jj=j; s.size()==0 || ii!=i || jj!=j;
                    ii=(ii+h+dy[d])%h, jj=(jj+w+dx[d])%w){
                    s += g[ii][jj];
                    m[s]++;
                    reverse(s.begin(),s.end());
                    m[s]++;
                    reverse(s.begin(),s.end());
                }
            }
        }
        string ans;
        for(auto& p:m){
            //cout << p.first << " " << p.second << endl;
            if(p.second < 2) continue;
            if(ans.size() > p.first.size()) continue;
            if(ans.size() == p.first.size()){
                ans = min(ans,p.first);
            }
            if(ans.size() < p.first.size()) ans = p.first;
        }
        if(ans.size() <= 1) ans="0";
        cout<<ans<<endl;
        getchar();
    }
}

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

using namespace std;

const int MOD = 1e9 + 7;
const int N = 22;
int dp[N][(1 << 21) + 1];
int a[N][N], n;

int solve(int i, int mask) {
    if (i == n) {
        return __builtin_popcount(mask) == n;
    }
    int& ans = dp[i][mask];
    if (ans != -1) {
        return ans;
    }
    ans = 0;
    for (int j = n - 1; j >= 0; j--) {
        if (a[i][j] == 1 && (mask & (1 << j)) == 0) {
            ans += solve(i + 1, mask | (1 << j));
            ans %= MOD;
        }
    }
    return ans;
}

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> a[i][j];
        }
    }
    memset(dp, -1, sizeof dp);
    cout << solve(0, 0);
    return 0;
}


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

using namespace std;

int main(int argc,char ** argv) {
	double x,y,d;
	int ans=0,n;
	cin >> n >> d;
	for(int i = 0;i < n;i++) {
		cin>>x>>y;
		if(sqrt(x*x+y*y) <= d) ans++;
	}
	cout << ans;
	
	return 0;
} 

Measured memory_bytes: 3800
# ABC147C - HonestOrUnkind2

from collections import defaultdict
import itertools

n = int(input())
m = [[]for i in range(n)]

for i in range(n):
    j = int(input())
    for _ in range(j):
        x,y=map(int,input().split())
        m[i].append([x-1,y])

#print(m)
ans=0
for i in itertools.product([0,1],repeat=n):
    k=1
    for j in itertools.compress([ii for ii in range(n)],i):
        for x,y in m[j]:
            if i[x] !=-1 and i[x]!=y:
                k=0
                break
        if not k:
            break
    #print(i)
    if k:
        ans=max(ans,sum(i))

print(ans)



Measured memory_bytes: 3700
#include <bits/stdc++.h>
#define rep(i,n) for (int i= 0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const long long INF = 1LL << 60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
    ll x;cin>>x;
    vector<ll> ans(1005);
    rep(i,1005){
       ans[i]=pow(i,5);

    }
    for(int i=0;i<=1000;i++) {
        for(int j = 0;j<=1000;j++)
        if(ans[i]-ans[j]==x){
            cout<<i<<" "<<j<<endl;
            return 0;
        }
        else if(ans[i]+ans[j]==x){
            cout<<i<<" "<<j*-1<<endl;
            return 0;
        }

    }

}

Measured memory_bytes: 4076