akhauriyash/Code-Regression huggingface dataset:
s = input()
t = input()


ans = len(t)


for i in range(len(s)-len(t)+1):
    dif = 0
    for j in range(len(t)):
        if t[j] != s[i+j]:
            dif += 1

    ans = min(ans, dif)

print(ans)

# for i in range(len(t)+1, 0, -1):
#    for j in range(0, len(t)-i+1):
#        sb = t[j:j+i]
#        if sb in s[j:]:
#            print(sb, s[j:])
#            ans = len(t)-len(sb)
#            flag = True
#            break
#
#    if flag:
#        break


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

typedef long long ll;
const int N = 1e5;
int p[N+100],q[N+100];

int main()
{
	int x,y,a,b,c;
	priority_queue<int,vector<int>,greater<int> >pq1;
	priority_queue<int>pq2;
	scanf("%d%d%d%d%d",&x,&y,&a,&b,&c);
	for(int i=1;i<=a;i++){
		scanf("%d",p+i);
	}
	for(int i=1;i<=b;i++){
		scanf("%d",q+i);
	}
	for(int i=1;i<=c;i++){
		int cur;
		scanf("%d",&cur);
		pq2.push(cur);
	}
	sort(p+1,p+a+1,greater<int>());
	sort(q+1,q+b+1,greater<int>());
	ll ans = 0,cur = 0;
	for(int i=1;i<=x;i++){
		cur += p[i];
		pq1.push(p[i]);
	}
	for(int i=1;i<=y;i++){
		cur += q[i];
		pq1.push(q[i]);
	}
	ans = max(ans,cur);
	while(!pq1.empty()&&!pq2.empty())
	{
		int u = pq1.top();
		int v = pq2.top();
		pq1.pop();
		pq2.pop();
		cur += (v-u);
		ans = max(ans,cur);
	}
	printf("%lld\n",ans);
}


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

int main() {
	int N, M;
	cin >> N >> M;
	vector<bool> judge(N, false);
	vector<int> penalty(N, 0);
	int ans = 0, pen = 0;
	rep(i, M) {
		int p;
		string S;
		cin >> p >> S;
		if (!judge[p - 1]) {
			if (S == "WA") {
				penalty[p - 1]++;
			}
			else {
				ans++;
				pen += penalty[p - 1];
				judge[p - 1] = true;
			}
		}
	}
	cout << ans << " " << pen << endl;
	return 0;
}

Measured memory_bytes: 640
# include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e5+7;
int head[maxn],to[maxn],nex[maxn],cnt = 1;
void add(int u,int v){
    to[cnt] = v;
    nex[cnt] = head[u];
    head[u] = cnt++;
}
int n,m;
ll stk[maxn][2],ans[maxn],Fa[maxn],siz[maxn];
ll Find(int x){return x == Fa[x]?x:Fa[x] = Find(Fa[x]);}
int main() {
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)Fa[i] = i,siz[i] = 1;
    for(int i=0;i<m;i++)scanf("%lld%lld",&stk[i][0],&stk[i][1]);
    for(int i=m-1;~i;i--){
        int u = stk[i][0],v = stk[i][1];
        u = Find(u),v = Find(v);
        if(u == v){
            ans[i] = ans[i+1];
            continue;
        }
        ans[i] = ans[i+1]+siz[u]*siz[v];
        siz[u] += siz[v];
        Fa[v] = u;
    }
    ll p = 1ll*n*(n-1)/2;
    for(int i=1;i<m;i++)
        printf("%lld\n",p-ans[i]);
    printf("%lld\n",p);
    return 0;
}


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

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int n, Q;
int arr[N + 2];


void solve()
{
	cin >> n;
	int r = n % 10;
	if ( r == 3 ) cout << "bon" << endl;
	else if ( r < 2 or r == 6 or r == 8) cout << "pon";
	else cout << "hon" << endl;

}

int32_t main()
{
	ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);

	int test = 1;
	// cin >> test;
	while (test--)solve();


}





Measured memory_bytes: 3600
n = gets.to_i
ratio = gets.split(" ").map(&:to_i)

(n - 1).times do
  new_ratio = gets.split(" ").map(&:to_i)
  amp = new_ratio.zip(ratio).map do |nr, r|
    r / nr + (r % nr == 0 ? 0 : 1)
  end.max
  ratio = new_ratio.map { |r| r * amp }
end

puts ratio.inject(&:+)

Measured memory_bytes: 1788
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

use std::cmp;

fn main() {
    let (w, aa, bb) = get!(i32, i32, i32);
    let (a, b) = if aa < bb { (aa, bb) } else { (bb, aa) };
    println!("{}", cmp::max(0, b - (a+w)));
}

Measured memory_bytes: 4352
# main関数
if __name__ == '__main__':

    s = input()
    
    ans = []
    for i in s :
        if i == 'B' :
            if len(ans) > 0 :
                ans.pop()
        else:
            ans.append(i)
    
    for i in ans :
        print(i, end="")

    print()

Measured memory_bytes: 38384
from collections import Counter
import sys

h, w = map(int, input().split())
arr = [list(map(str, input().rstrip())) for _ in range(h)]

arr = sum(arr, [])

c = Counter(arr)
c = list(c.values())

if h % 2 == 0 and w % 2 == 0:
    ans = all([x % 4 == 0 for x in c])

elif h % 2 == 1 and w % 2 == 1:
    even = (h + w) // 2 - 1
    odd_cnt = len([x for x in c if x % 2 == 1])
    if odd_cnt != 1:
        print("No")
        sys.exit()
    odd = sum([x for x in c if x % 2 == 1])
    if odd % 4 == 3:
        even -= 1
    c.remove(odd)
    ans = True if sum([x % 4 == 2 for x in c]) <= even else False
    ans &= all([x % 4 == 0 for x in c if x % 4 != 2])

else:
    even = h // 2 if h % 2 == 0 else w // 2
    ans = True if sum([x % 4 == 2 for x in c]) <= even else False
    ans &= all([x % 4 == 0 for x in c if x % 4 != 2])

print("Yes" if ans else "No")

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

def main():
    a,b=input().split()
    N=int(a+b)
    for i in range(1,1000):
        if N%i==0 and i==N//i:
            print('Yes')
            exit()
    print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
from collections import defaultdict, deque

def topological_sort(vertex:list, edge:list):
    graph = {i: [] for i in vertex}
    for i, j in edge:
        graph[i].append(j)
        
    inp_cnt = defaultdict(int)
    outs = defaultdict(list)
    for inp, out in edge:
        inp_cnt[out] += 1
        outs[inp].append(out)

    result = []
    queue = deque([i for i in vertex if inp_cnt[i]==0])
    while queue:
        v = queue.popleft()
        result.append(v)
        for v2 in outs[v]:
            inp_cnt[v2] -= 1
            if inp_cnt[v2] == 0:
                queue.append(v2)
    return result

N, M = map(int, input().split())
vertex = list(range(1, N+1))
edge = [list(map(int, input().split())) for _ in range(M)]
graph = {i: [] for i in vertex}
for i, j in edge:
    graph[i].append(j)

sorted_vertecies = topological_sort(vertex, edge)
dp = [0] * (N+1)
for i in sorted_vertecies:
    ends = graph[i]
    for j in ends:
        dp[j] = max(dp[j], dp[i] + 1)
print(max(dp))

Measured memory_bytes: 85604
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

// 素因数分解。計算量はO(√n)
map<ll, ll> primefactor(ll n) {  // (nのi番目の素因数, その素因数の個数)のmapを返す(n = 720 = (2^4)*(3^2)*(5^1)なら{(2, 4), (3, 2), (5, 1)}のように)
    map<ll, ll> res;
    for(ll i = 2; i*i <= n; i++) {
        while(n%i == 0) {
            res[i]++;
            n /= i;
        }
    }
    if(n != 1) {
        res[n] = 1;
    }
    return res;
}

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

    map<ll, ll> mp;
    exrep(x, 1, n) {
        map<ll, ll> mp2 = primefactor(x);
        for(auto p : mp2) {
            mp[p.first] += p.second;
        }
    }

    ll ans = 1;
    for(auto p : mp) {
        ans *= (p.second + 1);
        ans %= mod;
    }

    out(ans);
    re0;
}

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

int main(){

    while(1){
        int t, d, l; cin >> t >> d >> l;
        if(!t) break;
        vector<int> T(t - 1, 0);
        
        for(int i = 0; i < t; i++){
            int x; cin >> x;
            if(i == t - 1 || x < l) continue;
            T[i]++;
            T[min(t - 1, i + d)]--;
            
        }

        int ans = 0;

        for(int i = 0; i < t - 1; i++){
            //cout << T[i] << " ";
            T[i + 1] += T[i];
            ans += (T[i] > 0);
        }

        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 3464
#include<bits/stdc++.h>
using namespace std;
int a,b,c,sum;
int main()
{
	cin>>a>>b>>c;
	sum=a;
	while(sum%b!=c && sum<=a*1000)
		sum+=a;
	if(sum%b==c)
	    cout<<"YES"<<endl;
	    else
	    cout<<"NO"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  ll N;
  cin>>N;
  ll ans = 0;
  ll now=0;
  ll tmp;
  for(ll i=0;i<N;++i) {
    cin>>tmp;
    if(now==1 && tmp>0) {
      ans++;
      tmp--;
    }
    ans += tmp/2;
    now = tmp%2;
  }
  cout<<ans<<endl;
}



Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

set<char> st;

int main()
{
  string s, ans;
  cin>>s;
  REPALL(i,s) st.insert(s[i]);


  if (s[0] == s[s.size()-1]) {
    if (s.size()%2 == 0) {
      ans = "First";
    } else {
      ans = "Second";
    }
  } else {
    if (s.size()%2 == 0) {
      ans = "Second";
    } else {
      ans = "First";
    }
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 512
// Last Change: 10/27/2019 21:33:24.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

const double PI = acos(-1);

double change(double ipt) {
  return ipt * 180 / PI;
}

int main() {
  ll a, b, x;
  cin >> a >> b >> x;
  double half = double(a * a * b) / 2;
  double theta = 0;
  if (half < x) {
    double temp = a * a * b - x;
    temp = temp * 2 / (a * a * a);
    theta = atan(temp);
  } else {
    double temp = double(a * b * b) / 2 / x;
    theta = atan(temp);
  }
  cout << fixed << setprecision(10) << change(theta) << endl;
}


Measured memory_bytes: 256
from sys import stdin

c = int(stdin.readline().rstrip())
b = int(stdin.readline().rstrip())
a = int(stdin.readline().rstrip())
x = int(stdin.readline().rstrip())
count = 0


for coin_500_num in range(0,c+1):
    for coin_100_num in range(0,b+1):
        for coin_50_num in range(0,a+1):
            total = 500*coin_500_num + 100*coin_100_num + 50*coin_50_num
            if(total == x):
                count +=1


"""
自分の。
for 文のカウンタのスコープは有効だから、for文のifはいらなかった。

for coin_500_num in range(0,c+1):
    amari = x-500*coin_500_num
    if(amari == 0):
        count += 1
    elif(amari > 0):
        for coin_100_num in range(0,b+1):
            amari_2 = amari-100*coin_100_num
            if(amari_2 == 0):
                count += 1
            elif(amari_2 > 0):
                for coin_50_num in range(0,a+1):
                    amari_3 = amari_2-50*coin_50_num
                    if(amari_3 == 0):
                        count += 1

"""

print(count)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
#define pb push_back
#define pr pair<int,int>
#define mod 1000000007
#define endl "\n"

int power(int a,int b,int m=mod)
{
	if(b==0)	return 1;
	if(b==1)	return a;
	int res=power(a,b/2,m);
	res=(res*res)%m;
	if(b&1)	res=(res*a)%m;
	return res;
}
int modinv(int a,int m=mod){ return power(a,m-2,m);}
int add(int a,int b,int m=mod){	int c=(a+b);	if(c>=m)	c-=m;	return c;}
int sub(int a,int b,int m=mod){	int c=(a-b);	if(c<0)		c+=m;	return c;}
int mul(int a,int b,int m=mod){	return (a*b)%m;}
//	x<<1 => x*2		x>>1 => x/2;	cout<<flush;
//	cout<<fixed<<setprecision(10)<<ans<<endl;


void solve()
{
	int n,x,t;
	cin>>n>>x>>t;
	cout<<((n+x-1)/x)*t<<endl;
}

int32_t main()
{
	ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	int t=1;//cin>>t;
	for(int i=1;i<=t;i++){	solve();}
	return 0;
}

Measured memory_bytes: 3596
//#pragma GCC optimize("-Ofast","unroll-loops","omit-frame-pointer","inline") //Optimization flags
//#pragma GCC option("arch=native","tune=native","no-zero-upper") //Enable AVX
//#pragma GCC target("avx2")  //Enable AVX
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
//order_of_key(x) : number of items less than x
//find_by_order(x) : iterator to x

#define mem(dp,a)           memset(dp,a,sizeof dp)
#define rep(i,a,b)          for(ll i=a;i<b;i++)
#define pb(x)               push_back(x)
#define mp(x,y)             make_pair(x,y)
#define fastio              ios_base::sync_with_stdio(false);cin.tie(NULL)
#define F                   first
#define S                   second
#define all(v)              (v).begin(),(v).end()

const ld pi=3.14159265359;
ll INF=1e18+10;
ll MOD=998244353;
ll mod=1e9+7;

inline ll add(ll a,ll b,ll m){
    if(a+b>=m)return (a+b)-m;
    return a+b;
}

inline ll mul(ll a,ll b,ll m){
    if((a*b)<m)return a*b;
    return (a*b)%m;
}

int main()
{
    ll a,b,c;cin>>a>>b>>c;
    cout<<c<<" "<<a<<" "<<b;
}


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

long long X;

int main(){
    cin>>X;
    long long a=100;
    for(int i=0;;i++){
        a=a*1.01;
        if(a>=X){
            printf("%d\n",i+1);
            return 0;
        }
    }
}

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


const int MOD=1000000007;
const int MAX =10000001;
ll e[1000000];

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll f(ll x){
    if(x<=1)return 1;
    ll y=x*f(x-1)%MOD;
    e[x]=y;
    return y;
}


int main(){
    
    e[1]=0;
    e[0]=0;
    int x,y;
    cin>>x>>y;
    ll ans=0;
    ll a=0;
    ll b=0;
    if((x+y)%3!=0){
        cout<<0<<endl;
        return 0;
    }
    else if(x==0 && y==0){
        cout<<1<<endl;
        return 0;
    }
    COMinit();
    if((2*x-y)%3==0 &&(2*x-y)>=0 &&(2*y-x)%3==0 && (2*y-x)>=0){
        b=(2*x-y)/3;
        a=(2*y-x)/3;
    }

    if(a==0&&b==0){ans=0;}
    else if(a==0||b==0){
        ans=1;
    }
    else{
        ans=COM(a+b, max(a,b));
        
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 235776
/**
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

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

#define DEBUG
#ifndef DEBUG
#define endl "\n"
#define log(args...)
#else
#define log(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); logf(_it, args); }
void logf(istream_iterator<string> it) {
}
template<typename T, typename ... Args>
void logf(istream_iterator<string> it, T a, Args ... args) {
	cout << *it << " = " << a << endl;
	logf(++it, args...);
}
#endif

#define forn(i,k,n) for(ll i=(k); i<(n); i++)

const double PI = acos(-1);
typedef long long ll;
#define fori(n) for(ll i=0; i<(n); i++)

#define cins(s) string s; cin>>s;
#define cini(i) int i; cin>>i;
#define cinll(l) ll l; cin>>l;
#define cind(d) double d; cin>>d;
#define cinai(a, n) vi a(n); fori(n) { cin>>a[i]; }
#define cinall(a, n) vll a(n); fori(n) { cin>>a[i]; }
#define cinas(s, n) vs s(n); fori(n) { cin>>s[i]; }
#define cinad(a, n) vd a(n); fori(n) { cin>>a[i]; }

typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<string> vs;
typedef vector<ll> vll;

void solve() {
	cins(s);
	if (s[2] == s[3] && s[4] == s[5])
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}

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



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

int main() {
    string ans;
    int N;
    vector<vector<int>> A(3, vector<int>(3));
    rep(i,3) {
        cin >> A.at(i).at(0) >> A.at(i).at(1) >> A.at(i).at(2);
    }
    cin >> N;
    vector<int> b(N);
    rep(i,N) {
        cin >> b.at(i);
    }
    rep(i,N) {
        rep(j,3) {
            rep(k,3){
                if (b.at(i)==A.at(j).at(k)) {
                    A.at(j).at(k) = - A.at(j).at(k);
                }
            }
        }
    }
    if ((A.at(0).at(0) < 0) && (A.at(0).at(1) < 0) && (A.at(0).at(2) < 0)) {
        ans = "Yes";
    }
    else if ((A.at(1).at(0) < 0) && (A.at(1).at(1) < 0) && (A.at(1).at(2) < 0)) {
        ans = "Yes";
    }
    else if ((A.at(2).at(0) < 0) && (A.at(2).at(1) < 0) && (A.at(2).at(2) < 0)) {
        ans = "Yes";
    }
    else if ((A.at(0).at(0) < 0) && (A.at(1).at(0) < 0) && (A.at(2).at(0) < 0)) {
        ans = "Yes";
    }
    else if ((A.at(0).at(1) < 0) && (A.at(1).at(1) < 0) && (A.at(2).at(1) < 0)) {
        ans = "Yes";
    }
    else if ((A.at(0).at(2) < 0) && (A.at(1).at(2) < 0) && (A.at(2).at(2) < 0)) {
        ans = "Yes";
    }
    else if ((A.at(0).at(0) < 0) && (A.at(1).at(1) < 0) && (A.at(2).at(2) < 0)) {
        ans = "Yes";
    }
    else if ((A.at(0).at(2) < 0) && (A.at(1).at(1) < 0) && (A.at(2).at(0) < 0)) {
        ans = "Yes";
    }
    else {
        ans = "No";
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
def is_unique(seq):
    return len(seq) == len(set(seq))

N = int(input())
words = []
for i in range(N):
    words.append(input())
hantei = 0
for i in range(N-1):
    a = [x for x in words[i]]
    b = [x for x in words[i+1]]
    if a[len(a)-1] == b[0]:
        pass
    else:
        hantei += 1
        break
if hantei == 0 and is_unique(words) == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#a,b,c = [int(i) for i in input().split()]

import sys
input = sys.stdin.readline

n,q = [int(i) for i in input().split()]
s=input()
td = [[i for i in input().split()] for _ in [0]*q]
td=td[::-1]

#print(n,q,td)

l=-1; r=n
for t,d in td:
    if d=="L":
        if l!=n-1:
            moji=s[l+1]
            if moji == t:
                l+=1
        moji=s[r]
        if moji == t:
            r+=1
            

    if d=="R":
        if r!=0:
            moji=s[r-1]
            if moji == t:
                r-=1
        moji=s[l]
        if moji == t:
            l-=1
        
    
#    print(l,r)
if l < r:
    print(n-(l+1)-(n-r))
else:
    print(0)


        

Measured memory_bytes: 28384
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] line = br.readLine().split(" ");
		int[] nums = new int[n];
		int i;
		for(i=0; i<n; i++)
			nums[i] = Integer.parseInt(line[i]);
		
		int[] baseNums = new int[]{-1, -1, -1};
		int[] count = new int[3];
		for(Integer num : nums){
			for(i=0; i<3; i++){
				if( baseNums[i] == num ){
					count[i]++;
					break;
				}else if( baseNums[i] == -1 ){
					baseNums[i] = num;
					count[i] = 1;
					break;
				}
			}
			if( i == 3 ){
				System.out.println("No");
				System.exit(0);
			}
		}

		//面倒な0は最初に持ってくる
		if( baseNums[1] == 0 ){
			int tmp = baseNums[0];
			baseNums[0] = baseNums[1];
			baseNums[1] = tmp;
			tmp = count[0];
			count[0] = count[1];
			count[1] = tmp;
		}

		//数字3つが同じ数ある。n0^n1=n2。
		if( count[0] == count[1] && count[1] == count[2] && (baseNums[0]^baseNums[1]) == baseNums[2] )
			System.out.println("Yes");
		
		//0のみ
		else if( baseNums[0] == 0 && count[0] == n )
			System.out.println("Yes");
		
		//数字2つ。そのうち1つは0。1:2の割合で0が少ない。
		else if( count[0] * 2 == count[1] && count[2] == 0 && baseNums[0] == 0 )
			System.out.println("Yes");
		
		//不適合
		else
			System.out.println("No");
	}
}


Measured memory_bytes: 39004
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

#[allow(dead_code)]
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn input<T: FromStr>(&mut self) -> T {
        self.read().unwrap()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let (a, s, c): (String, String, String) = (sc.input(), sc.input(), sc.input());

    let s: Vec<char> = s.chars().collect();
    println!("A{}C", s[0]);
}


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

using namespace std;

struct tree{
	int dps=-1;
	vector<int> node;
};

int main()
{
	int n,m;
	cin >> n >> m;
	
	vector<tree> room(n);

	int a, b;
	for(int i=0;i<m;i++){
		cin >> a >> b;
		room[a-1].node.push_back(b-1);
		room[b-1].node.push_back(a-1);
	}

	// デバッグ用
//	for(int i=0;i<n;i++){
//		cout << "room_no " << i+1 << ":";
//		for(int j=0;j<room[i].node.size();j++){
//			cout << room[i].node[j]+1;
//		}
//		cout << endl;
//	}

	bool check=true;
	// int select_dps=0;
	room[0].dps=0;
	vector<int> search_room;
	search_room.push_back(0);
	vector<int> next_search;
	
	while(check){
		check=false;

		// Searchすべき部屋数だけ回す
		for(int i=0;i<search_room.size();i++){
			// Select中の部屋のノード数だけ回す
			for(int j=0;j<room[search_room[i]].node.size();j++){
				// Select中の部屋と隣接している部屋のdpsが割り当て前
				if(room[room[search_room[i]].node[j]].dps == -1){
					room[room[search_room[i]].node[j]].dps = search_room[i]+1;
					next_search.push_back(room[search_room[i]].node[j]);
					check=true;
				}
			}
		}
		// 次の探索部屋を更新
		search_room = next_search;
		// select_dps++;
		next_search.erase(next_search.begin(), next_search.end());
	}

	for(int i=1;i<n;i++){
		if(room[i].dps==-1){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	for(int i=1;i<n;i++){
		cout << room[i].dps << endl;
	}
}

Measured memory_bytes: 10840
#include <bits/stdc++.h>
#define rep(i, n, s) for (int i = s; i < n; i ++)
#define graph map<int, vector<int>>
#define field vector<vector<int>>
#define ll long long
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> ans(n,0);
    int cnt = sqrt(n)+2;
    rep(x,cnt,1) rep(y,cnt,1) rep(z,cnt,1){
        int p = x*x+y*y+z*z+x*y+y*z+z*x;
        if (p > n+1) continue;
        ans[p-1] += 1;
    }
    for (auto m : ans){
        cout << m << endl;
    }
}

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

using namespace std;

int main(int argc, char* argv[])
{
    int A, B, C; cin >> A >> B >> C;

    vector<int> T(3);
    T[0] = abs(B-A);
    T[1] = abs(A-C);
    T[2] = abs(C-B);

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

    cout << T[0]+T[1] << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class IDONTKNOWCSHARP
{
    public static void Main()
    {
        string A = Console.ReadLine();
        string B = Console.ReadLine();
        int count = 0;

        for (int i = 0; i < A.Length; i++)
        {
            if (A[i] != B[i])
                count++;
        }

        Console.WriteLine(count);
    }

}

Measured memory_bytes: 27188
import numpy as np
H, W = map(int, input().split())
I = [input() for i in range(H)]
I_n = [list(j) for j in I if '#' in j]
h = np.array(I_n)
n = 0
for k in range (W):
  if '#' not in h[:, n]:
    h = np.delete(h, n, 1)
  else:
    n += 1
H, W = h.shape
for l in range(H):
  A = ""
  for m in range(W):
    A += h[l, m]
  print(A)

Measured memory_bytes: 12516
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <bitset>
using namespace std;

const int INF = 1000000000;
const int MAX_N = 100000 + 10;
int dp[MAX_N][3];
int a[MAX_N], b[MAX_N], c[MAX_N];

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

  int N;
  cin >> N;

  for (int i = 0; i < N; i++) {
    cin >> a[i] >> b[i] >> c[i];
  }

  dp[0][0] = a[0];
  dp[0][1] = b[0];
  dp[0][2] = c[0];  
  
  for (int i = 1; i < N; i++) {
    for (int j = 0; j < 3; j++) {

      int happ = 0;
      if (j == 0) happ = a[i];
      else if (j == 1) happ = b[i];
      else happ = c[i];
      
      for (int k = 0; k < 3; k++) {
	if (j != k) dp[i][j] = max(dp[i][j], dp[i - 1][k] + happ);
      }
    }
  }

  int ans = 0;
  for (int j = 0; j < 3; j++) ans = max(ans, dp[N-1][j]);
  cout << ans << endl;
  
  return 0;
}



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

int N,i,out_point;
int x,H[1100],X,A;        
string out_man;
int main() {
    cin >> N ;
   
    
        for (int i = 0; i < N; ++i) {           
        
           out_man = out_man + "ACL";
           }

          
        
   // max = max - min;
    cout << out_man  << endl;
}

Measured memory_bytes: 3600
#include<string.h>
#include<iostream>
#include <stdio.h>
#include<algorithm>
using namespace std;


int main()
{	
	int  len, max = 0, sum = 0;
	char s[100];
	sum = max = 0;
	scanf("%s", s);
	len = strlen(s);
	for (int p = 0;p < len;p++)
	{
		if (s[p] == '0')
		{
			s[p-1]--;
			for (int i = p;i < len;i++)
				s[i] = '9';
			break;
		}
	}
	for (int p = 0;p < len;p++)
	{
		sum = 0;
		for (int k = 0;k < len - p;k++)
			sum += s[k] - '0';
		
		if (p != 0)sum += p * 9 - 1;
		if (sum > max)max = sum;
	}
	printf("%d", max);
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int a,b,c,d;
  scanf("%d %d %d %d",&a,&b,&c,&d);
  while(1){
    c=c-b;
    if(c<=0){
      printf("Yes");
      return 0;
    }
    a=a-d;
    if(a<=0){
      printf("No");
      return 0;
    }
  }
}



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

int main() {
    int N, M;
    cin >> N >> M;
    long long int x[N], y[N], z[N];
    for (int i=0; i<N; i++){
        cin >> x[i] >> y[i] >> z[i];
    }
    long long int ans=0;
    for (int i=0; i< 1<<3; i++){
        long long int w[N];
        
        for (int j=0; j<N; j++){
            w[j]=(i&4 ? x[j]:-x[j])+(i&2 ? y[j]:-y[j])+(i&1 ? z[j]:-z[j]);
        }
        sort (w, w+N, greater<long long int>());
        long long int sum=0;
        for (int j=0; j<M; j++){
            sum+=w[j];
        }
        ans=max(ans, sum);
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define P pair<int,int>
#define rep(n) for(int i=0; i<n; i++)
#define v(n) vector<n>
using namespace std;
signed main(){
    int n; cin>>n;
    v(int) a(n); rep(n) cin>>a.at(i);
    sort(a.begin(),a.end());
    cout<<a.back()-a.front()<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;

int main()
{
	double x1, x2, y1, y2, x, y,l;
	cin >> x1 >> y1 >> x2 >> y2;

	if (x1 >= 0 && x2 >= 0)
	{
		if (x1 > x2)
		{
			x = x1 - x2;
		}
		else
		{
			x = x2 - x1;
		}
	}
	else if (0 < x1 && x2 < 0)
	{
		x = x1 - x2;
	}
	else if (x1 < 0 && 0 < x2)
	{
		x = x2 - x1;
	}
	else if (x1 < 0 && x2 < 0)
	{
		if (x1 < x2)
		{
			x = x2 - x1;
		}
		else if (x2 < x1)
		{
			x = x1 - x2;
		}
	}

	if (y1 >= 0 && y2 >= 0)
	{
		if (y1 > y2)
		{
			y = y1 - y2;
		}
		else
		{
			y = y2 - y1;
		}
	}
	else if (0 < y1 && y2 < 0)
	{
		y = y1 - y2;
	}
	else if (y1 < 0 && 0 < y2)
	{
		y = y2 - y1;
	}
	else if (y1 < 0 && y2 < 0)
	{
		if (y1 < y2)
		{
			y = y2 - y1;
		}
		else if (y2 < y1)
		{
			y = y1 - y2;
		}
	}

	l = sqrt((x*x) + (y*y));

	cout << fixed << std::setprecision(6) << l << endl;

	return 0;
}

Measured memory_bytes: 3216
#include <iostream>
#include <vector>
#include <utility>
#include <queue>

using namespace std;

class node {
public:
	int parent,children[2],depth,height,sib;
	node() {
		parent = -1;
		children[0] = -1;
		children[1] = -1;
		depth = -1;
		height = -1;
		sib = -1;
	}
	int deg() {
		int c = 0;
		for(int i=0;i<2;i++)if(children[i]!=-1)c++;
		return c;
	}
	string typ() {
		if(parent == -1)return "root";
		else if(deg() == 0)return "leaf";
		else return "internal node";
	}
};

int n;
node d[100000];

void pre(int i) {
	cout << " " << i;
	if(d[i].children[0] != -1) pre(d[i].children[0]);
	if(d[i].children[1] != -1) pre(d[i].children[1]);
}

void ino(int i) {
	if(d[i].children[0] != -1)ino(d[i].children[0]);
	cout << " " << i;
	if(d[i].children[1] != -1)ino(d[i].children[1]);
}

void pos(int i) {
	if(d[i].children[0] != -1)pos(d[i].children[0]);
	if(d[i].children[1] != -1)pos(d[i].children[1]);
	cout << " " << i;
}

int main(void) {
	char * c = new char[1000*1000*100];
	cin >> n;
	for(int i = 0;i < n;i++){
		int a,b,c;
		cin >> a >> b >> c;
		d[a].children[0] = b;
		d[a].children[1] = c;
		d[b].sib = c;
		d[c].sib = b;
		d[b].parent = a;
		d[c].parent = a;
	}
	int rt = -1;
	for(int i = 0;i < n;i++){
		if(d[i].parent == -1) {
			rt = i;
		}
	}
	d[rt].depth = 0;
	cout << "Preorder" << endl;
	pre(rt);
	cout << endl << "Inorder" << endl;
	ino(rt);
	cout << endl << "Postorder" << endl;
	pos(rt);
	cout << endl;
}



Measured memory_bytes: 5436
import sys
from collections import deque

def bfs(maze, visited):
    try:
        sy,sx=0,0
        gy,gx=H-1,W-1
        queue = deque([[sy, sx]])
        visited[sy][sx] = 0
        while queue:
            y, x = queue.popleft()
            if [y, x] == [gy, gx]:
                return visited[y][x]

            p=[]
            if x>0 : p.append([0,-1])
            if x<W-1: p.append([0,1])
            if y>0: p.append([-1,0])
            if y<H-1: p.append([1,0])
            for j, k in p:
                new_y, new_x = y+j, x+k
                if maze[new_y][new_x] == "." and \
                    visited[new_y][new_x] == -1:
                    visited[new_y][new_x] = visited[y][x] + 1
                    queue.append([new_y, new_x])
        return -1

    except RuntimeError:
        print(-1)
        sys.exit()


H,W=map(int,input().split())
m=[input() for i in range(H)]

ans=0
for i in range(H):
    for j in range(W):
        if m[i][j]==".": ans+=1

visited=[[-1]*W for i in range(H)]
p=bfs(m,visited)
print( p if p==-1 else ans-p-1)


Measured memory_bytes: 3316
N = int(input())
A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))

accA1 = [0 for i in range(N+1)]
accA2 = [0 for i in range(N+1)]

for i in range(1, N+1):
    accA1[i] = accA1[i-1] + A1[i-1]
    accA2[N-i] = accA2[N-i+1] + A2[N-i]

accA1.pop(0)
accA2.pop(N)

ans = 0
for i in range(N):
    tmp = accA1[i] + accA2[i]
    if tmp > ans:
        ans = tmp

print(ans)


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

namespace ConsoleApp15
{
    class Class35
    {
        static void Main()
        {
            var NK = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = NK[0], K = NK[1];
            var p = Console.ReadLine().Split().Select(int.Parse).ToArray();
            double sum = 0;
            double max = -1;
            for(int i = 0; i <N; i++)
            {
                sum += p[i];
                if (i >= K) sum -= p[i - K];
                
                max = Math.Max(max, sum);
            }
            Console.WriteLine(K + (max - K) / 2);
        }
        
    }
}


Measured memory_bytes: 33116
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define IL inline
using namespace std;
typedef long long LL;
typedef unsigned int U;
typedef unsigned long long LLU;
typedef pair<int,int> PII;
typedef long double LD;
IL LL read()
{
	LL 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<<1)+(x<<3)+(ch^48);ch=getchar();}
	return x*f;
}
#define io read()
int n,k,x; 
int main()
{
	n=io;k=io;
	x=(n+1)/2;
	if(x>=k){
		puts("YES");	
	}
	else{
		puts("NO");	
	}
	return 0;
}


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

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> h(n);
  rep(i, n) cin >> h[i];
  vector<vector<int> > g(n);
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }

  int ans = 0;
  rep(i, n) {
    if (g[i].size() == 0) {
      ans++;
      continue;
    }
    int cnt = 0;
    for (int j = 0; j < g[i].size(); j++) {
      if (h[i] > h[g[i][j]]) {
        cnt++;
      }
    }
    if (cnt == g[i].size()) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8804
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<double,double> pdd;
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) ll(i.size())
#define FOR(i, j, k, in) for (ll i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (ll i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef tmd
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
// const ll MAXN = 

long double ans;
/********** Good Luck :) **********/
int main()
{
    IOS();
    ll n;
    cin >> n;
    REP (i,n) {
        string u;
        double x;
        cin >> x >> u;
        if (u[0] == 'B') {
            ans += 380000 * x;
        } else {
            ans += x;
        }
    }

    cout << fixed << setprecision(15) << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
#include <iomanip>
#include <string>
#include <algorithm>
#include <vector>

int main()
{
    int A,B,M;
    cin>>A>>B>>M;

    vector<int> a(A);
    vector<int> b(B);

    for(int i=0;i<A;i++){
        cin>>a[i];
    }


    for(int i=0;i<B;i++){
        cin>>b[i];
    }


    
    int cost=*min_element(a.begin(),a.end());
    cost+=*min_element(b.begin(),b.end());
    int costtmp=0;
    int x,y,c;

    for(int i=0;i<M;i++){
        cin>>x>>y>>c;
        costtmp=a[x-1]+b[y-1]-c;

        if(costtmp<cost){
            cost=costtmp;
        }        
    }

    cout<<cost<<endl;



    return 0;
}

Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
using namespace std;

vector<int> G[100100];
int n,m;

int main(void){
        int i,j;
        int s,t;
        bool used[100100];
        int mark[100100];

        scanf("%d%d",&n,&m);
        for(i=0;i<m;i++){
                scanf("%d%d",&s,&t);
                G[s].push_back(t);
                G[t].push_back(s);
        }
        for(i=1;i<=n;i++){
                used[i]=false;
        }
        used[1]=true;
        queue<int> que;
        
        que.push(1);
        while(que.size()){
                int a=que.front();
                que.pop();
                for(auto it = G[a].begin(); it!=G[a].end();++it){
                        int v=*it;
                        if(used[v]==false){
                                used[v]=true;
                                mark[v]=a;
                                que.push(v);
                        }
                }
        }
        bool flag = true;
        for(i=1;i<=n;i++){
                if(used[i]==false){
                        printf("No\n");
                        return 0;
                }
        }
        printf("Yes\n");
        for(i=2;i<=n;i++){
                printf("%d\n",mark[i]);
        }
                
        return 0;
}




Measured memory_bytes: 10800
import Control.Applicative
import Data.List
import Data.Char

getInt :: IO Integer
getInt = (\a -> read a :: Integer) <$> getLine

getIntArray :: IO [Integer]
getIntArray = ((map (\a -> read a :: Integer)) . words) <$> getLine

getStrArray :: Integer -> IO [String]
getStrArray 0 = return [] :: IO [String]
getStrArray n = (:) <$> getLine <*> (getStrArray (n - 1))

groupI :: Integer -> Char
groupI 2 = 'C'
groupI 4 = 'B'
groupI 6 = 'B'
groupI 9 = 'B'
groupI 11 = 'B'
groupI _ = 'A'

main = do
    [x, y] <- getIntArray
    putStrLn (if (groupI x) == (groupI y) then "Yes" else "No")


Measured memory_bytes: 508
#include "bits/stdc++.h"
using namespace std;

#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; }

using ll = long long;

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

	s[3] = '8';

	cout << s;

	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>

const int MAX_N=100000;
using namespace std;

int main(){
int N;
long H[MAX_N];

scanf("%d",&N);
for(int i=0;i<N;i++)
  scanf("%ld",&H[i]);

int count=0;
int max=0;

for(int i=0;i<N-1;i++) {
    if(H[i]>=H[i+1])
      count++;
    else if(H[i]<H[i+1])
      count=0;
    if(max<count)
      max=count;    
  }

printf("%d",max);

return 0;
}

Measured memory_bytes: 896
#include <iostream>
int main(){

  using namespace std;
  int A,B,C;
  
  cin >> A >> B >> C;
  int i;
  for(i = 0;i<C  ;i++){
    if(B-A<0)
      break;
  B-=A;
  }
  
  cout << i;
  

return 0;
}

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

using ll = long long;

int main() {
    ios_base::sync_with_stdio(false);	
    cin.tie(0);
	ll n;
	cin >> n;
	string ans = "";
	while (n > 0) {
		n -= 1;
		ans += char('a') + n % 26;
		n /= 26;
	}
	reverse(ans.begin(), ans.end());
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
typedef long long ll;
const int MAX_N=2e5;
int N;
ll A[MAX_N];
int main(){
	cin>>N;
	map<ll,int> mp;
	REP(i,N){
		cin>>A[i];
		mp[A[i]]++;
	}
	ll ans=0;
	sort(A,A+N);
	REP(i,N){
		ll a=A[N-1-i];
		ll p2=1;
		while(p2<=a){
			p2<<=1;
		}
		if (a!=p2-a){
			ll tmp=min(mp[a],mp[p2-a]);
			
			ans+=tmp;
			mp[a]-=tmp;
			mp[p2-a]-=tmp;
		}else{
			ans+=mp[a]/2;
			mp[a]=0;
		}
	}
	cout<<ans<<endl;
		
	return 0;
}

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

using namespace std;

int a[10];
int l, r;

bool dfs(int i)
{
    if (i == 10) return true;

    bool res = false;

    int tmp;

    if (l <= a[i]) {
        tmp = l;
        l = a[i];
        res = res || dfs(i + 1);
        l = tmp;
    }

    if (r <= a[i]) {
        tmp = r;
        r = a[i];
        res = res || dfs(i + 1);
        r = tmp;
    }

    return res;
}

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

    while (n--) {
        l = r = 0;
        for (int i = 0; i < 10; ++i) cin >> a[i];
        cout << (dfs(0) ? "YES" : "NO") << endl;
    }
}

Measured memory_bytes: 1152
#include "bits/stdc++.h"
using namespace std ;

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

typedef long long ll ;
typedef long double ldb ;

#define mp make_pair
#define pb push_back
#define F first
#define S second
#define nl '\n'

#define all( x ) x.begin(),x.end() 
#define sz( x ) ( int )( x ).size( )
#define mem( a, val ) memset(a, val, sizeof( a ) )
#define deci( x ) cout<<fixed<<setprecision( x );
#define bitcount( x ) __builtin_popcountll( x )

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

const int MAX = 2*1000*1000 + 10 ;
const ll INF = 1e18 ;
const int MOD = 1e9 + 7 ;

ll a[MAX], vis[MAX] ;

ll get( ll x ){
  ll ans = 0, tmp = x ;
  while( !ans or (tmp!=x) ){
    ans++ ;
    tmp = a[tmp] ;
  }
  return ans ;
}

void sol( ){
  ll n, k ;
  cin >> n >> k ;
  for( ll i = 1 ; i <= n ; i++ )
    cin >> a[i] ;
  ll st = 1 ;
  bool f = 0 ;
  while( k and !vis[st] ){
    vis[st] = 1 ;
    st = a[st] ;
    k-- ;
    if( vis[st] )
      f = 1 ;
  }
  if( f ){
    ll len = get( st ) ;
    k %= len ;
    while( k ){
      k-- ;
      st = a[st] ;
    }
  }
  cout << st << nl ;
}

signed main( ){
  timesaver ;
//  int t = 1 ; cin >> t ; while(t--)
  {
    sol( );
  }
}

Measured memory_bytes: 6784
#include "bits/stdc++.h"
using namespace std;
const int maxn = 234567;
int p[maxn], c[maxn];
void init(){
    for(int e = 0; e < maxn; e++) p[e] = e;
}
int find(int x){
    if(x == p[x]) return x;
    return p[x] = find(p[x]);
}
int main(){
    int n, m, k;
    scanf("%d %d %d", &n, &m, &k);
    for(int e = 1; e <= n; e++) scanf("%d", c + e);
    vector<tuple<int,int,int> >ed;
    for(int e = 0; e < m; e++){
        int u, v, w;
        scanf("%d %d %d", &u, &v, &w);
        ed.push_back(make_tuple(w, u, v));
    }
    sort(ed.begin(), ed.end());
    init();
    int cc = k;
    long long ans = 0;
    for(auto e : ed){
        int u, v, w;
        tie(w, u, v) = e;
        if(c[u] > 0) u = find(c[u]);
        else u = find(u + k);
        if(c[v] > 0) v = find(c[v]);
        else v = find(v + k);
        if(u != v){
            p[u] = v;
            ans += w;
            cc--;
        }
        if(cc == 1) break;
    }
    if(cc == 1) printf("%lld\n", ans);
    else printf("-1\n");
    return 0;
}


Measured memory_bytes: 2804
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    int A, B, C;
    cin >> A >> B >> C;
    set<int> D;
    D.insert(A);
    D.insert(B);
    D.insert(C);
    if(D.size()==2){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
n = int(input())

#a(1) : 0
#a(2) : 2
#a(3) : ( 3*10 - 2 ) * 2 - 2 = 54
#a(4) : 
  
#10**n - 8**n - 2*( 9**n - 8**n ) = 10**n - 2* (9**n) + 8**n

p = 10**n - 2* (9**n) + 8**n
p = p%(10**9 + 7)
print(p)

Measured memory_bytes: 11128