akhauriyash/Code-Regression huggingface dataset:
using System;

namespace AIZUJudge {
    class EquisionSolver {
        static void Main(string[] args) {
            new EquisionSolver().solve();
       }

        void solve() {
            string[,] map = new string[8, 8];
            for (int i = 0; i < map.GetLength(0); i++) {
                string line = Console.ReadLine();
                for (int j = 0; j < map.GetLength(1); j++) {
                    map[i, j] = line.Substring(j,1);
                }
            }
            Console.WriteLine("90");
            char[,] newMap = transMap(map, 90);
            for (int i = 0; i < newMap.GetLength(0); i++) {
                for (int j = 0; j < newMap.GetLength(1); j++) {
                    Console.Write(newMap[i,j]);
                }
                Console.Write("\r\n");
            }
            Console.WriteLine("180");
            newMap = transMap(map, 180);
            for (int i = 0; i < newMap.GetLength(0); i++) {
                for (int j = 0; j < newMap.GetLength(1); j++) {
                    Console.Write(newMap[i, j]);
                }
                Console.Write("\r\n");
            }
            Console.WriteLine("270");
            newMap = transMap(map, 270);
            for (int i = 0; i < newMap.GetLength(0); i++) {
                for (int j = 0; j < newMap.GetLength(1); j++) {
                    Console.Write(newMap[i, j]);
                }
                Console.Write("\r\n");
            }
        }

        char[,] transMap(string[,] map , int angle) {
            char[,] newMap = new char[map.GetLength(0), map.GetLength(1)];
            if (angle == 90) {
                for (int i = 0; i < map.GetLength(0); i++) {
                    for (int j = 0; j < map.GetLength(1); j++) {
                        newMap[j, 7 - i] = map[i, j][0];
                        
                    }
                }
            } else if (angle == 180) {
                for (int i = 0; i < map.GetLength(0); i++) {
                    for (int j = 0; j < map.GetLength(1); j++) {
                        newMap[7-i, 7-j] = map[i, j][0];
                    }
                }
            } else {
                for (int i = 0; i < map.GetLength(0); i++) {
                    for (int j = 0; j < map.GetLength(1); j++) {
                        newMap[7 - j, i] = map[i, j][0];
                    }
                }
            }
            return newMap;
        }
    }
}

Measured memory_bytes: 8464
#include<stdio.h>
int main(){
int W,H,x,y,r,a,b,c,d;
scanf("%d",&W);
scanf("%d",&H);
scanf("%d",&x);
scanf("%d",&y);
scanf("%d",&r);
a=x-r;
b=x+r;
c=y-r;
d=y+r;
if(a>=0&&b<=W&&c>=0&&d<=H){
printf("Yes\n");
}else{
printf("No\n");
}
return 0;
}

Measured memory_bytes: 584
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

template<typename T>
istream& operator >> (istream& is, vector<T>& vs){
  for(T& v: vs) is >> v;
  return is;
}

int main() {
  int N; cin >> N;
  vector<int> d(N); cin >> d;
  int sum = 0;
  for (int i = 0; i < N; ++i) {
    for (int j = i + 1; j < N; ++j) {
      sum += d[i] * d[j];
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 3592
#include <cmath>
#include <iostream>
#include <vector>

int main() {
  using std::size_t;
  size_t n;
  std::cin >> n;

  const size_t maxJ = std::sqrt(n);

  size_t minMove = n - 1;
  for (size_t j = 2; j <= maxJ; ++j) {
    if (n % j == 0) {
      const auto i = n / j;
      const size_t move = (i - 1) + (j - 1);
      if (move < minMove) minMove = move;
    }
  }

  std::cout << minMove << std::endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
struct UnionFind {
    vector<int> d;
    UnionFind(int n=0): d(n,-1) {}
    int root(int x) {
      if (d[x] < 0) return x;
      return d[x] = root(d[x]);
    }
    bool unite(int x, int y) {
      x = root(x); y = root(y);
      if (x == y) return false;
      if (d[x] > d[y]) swap(x,y);
      d[x] += d[y];
      d[y] = x;
      return true;
    }
    bool same(int x, int y) { return root(x) == root(y);}
    int size(int x) { return -d[root(x)];}
  };
signed main(){
    int n,m;cin >>n >> m;
    UnionFind uf(n);
    rep(i,m){
        int a,b;cin >> a >> b;
        a--;b--;
        uf.unite(a,b);
    }
    int ret = 0;
    rep(i,n)ret = max(ret,uf.size(i));
    cout << ret << endl;
    return 0;
}

Measured memory_bytes: 4840
fn main() {
    proconio::input! {
        a: i128,
        b: i128,
        c: i128,
        d: i128,
    }
    let mut v = vec![a * c, a * d, b * c, b * d];
    if a <= 0 && b >= 0 || c <= 0 && d >= 0 {
        v.push(0);
    }
    let ans = v.iter().max().unwrap();
    println!("{}", ans);
}


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

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt" , "r" , stdin);
	freopen("output.txt" , "w" , stdout);
#endif

	double A, B, C, D;
	cin >> A >> B >> C >> D;


	double impact1 = C / B;
	double impact2 = A / D;


	if (ceil(impact1) <= ceil(impact2) ) {
		cout << "Yes";
		return 0;
	}

	cout << "No";


	return 0;
}

Measured memory_bytes: 3740
N,K=map(int,input().split())
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)
x2 = Base_10_to_n(N,K)
print(len(x2))


Measured memory_bytes: 61376
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define PI 3.141592
#define LL_INF 9000000000000000000
#define LL_MINF -9000000000000000000
#define INT_INF 2000000000
#define INT_MINF -2000000000
#define all(a) (a).begin(), (a).end()
#define fi first
#define se second
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int main(){
    string s;
    cin >> s;
    cout << s[0] << s.size() - 2 << s.back() << endl;
}


Measured memory_bytes: 3564
//  [amitdu6ey]
// g++ -std=c++11 -o2 -Wall filename.cpp -o filename
#include <bits/stdc++.h>
#define hell 1000000009
#define bug1(x) cout<<"$ "<<x<<" $"<<endl
#define bug2(x) cout<<"% "<<x<<" %"<<endl
#define bug3(x) cout<<"# "<<x<<" #"<<endl
#define ll long long
#define pb push_back
#define mp make_pair
#define tr(z) for(auto it=z.begin(); it!=z.end(); it++)
#define rloop(i,a,b) for(long long i=a; i>=b;i--)
#define loop(i,a,b) for(long long i=a; i<b; i++)
#define vbool vector< bool >
#define vvbool  vector< vector<bool> >
#define vchar vector<char>
#define vi vector<int>
#define vvi vector< vector<int> >
#define pll pair<long long, long long>
#define vll vector<long long>
#define vvl vector< vector<long long> >
#define ninf numeric_limits<long long>::min()
#define pinf numeric_limits<long long>::max()
#define comp(a,b) (abs(a-b)<1e-9) // to compare doubles
using namespace std;

void solve(){
    ll n,k;
    cin>>n>>k;
    vll a(n);
    loop(i,0,n) cin>>a[i];
    vll dp(n,pinf);
    dp[0]=0;
    loop(i,1,n){
        loop(j,i-k,i){
            if(j>=0) dp[i]=min({dp[j]+abs(a[i]-a[j]), dp[i]});
        }
    }
    cout<<dp[n-1]<<endl;
    return;
}

int main(){
    ios_base::sync_with_stdio(0);
    cout.tie(0);
    cin.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int test_cases=1;
    //cin>>test_cases;
    while(test_cases--){
      solve();
    }
    return 0;
}


Measured memory_bytes: 1792
//****** @mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define EB emplace_back
#define PB push_back
#define endl "\n"
#define MOD2 1000000007
#define MOD 998244353
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
typedef pair<int, int> pr;
typedef vector<int> VI;
typedef vector<pr> VP;
typedef vector<string> VS;
typedef vector<vector<int>> VV;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define trace1(x)                cout<<#x<<": "<<x<<endl
#define trace2(x, y)             cout<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cout<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cout<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define trace(v) for(auto it=v.begin();it!=v.end();it++)cout<<*it<<" ";cout<<endl;
int fast_pow(int x, int y, int p);
const int MAX_SIZE = 200001;
int sz[MAX_SIZE];
int n,m,visited[MAX_SIZE];
VI g[MAX_SIZE];
int dfs(int node){
    int ans=0;
    visited[node]=1;
    for(auto x:g[node]){
        if(!visited[x]){
            ans=max(ans,dfs(x));
        } else{
            ans=max(ans,sz[x]);
        }
    }
    sz[node]=ans+1;
    return ans+1;
}
void solve() {
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int x,y;cin>>x>>y;
        g[x].EB(y);
    }
    for(int i=1;i<=n;i++){
        if(!visited[i]){
            dfs(i);
        }
    }
    int mx=0;
    for(int i=1;i<=n;i++)mx=max(mx,sz[i]);
    cout<<mx-1;
}

int32_t main() {
    IOS;
    int test = 1;
//    cin >> test;
    for(int i=1;i<=test;i++){
//        cout<<"Case #"<<i<<": ";
        solve();
    }
    return 0;
}
int fast_pow(int x, int y, int p) {
    int res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

Measured memory_bytes: 12416
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {
REP(i,v.size()){if(i)os<<" ";os<<v[i];}return os;}
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) {
REP(i,v.size()){if(i)os<<endl;os<<v[i];}return os;}

int main() {
	std::map<int, int> map;
	int n; cin >> n;
	rep(i,n) {
		int d; cin >> d;
		map.insert({d,0});
	}

	cout << map.size() << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int a[111];

int main(int argc, char const *argv[])
{
	int p, q, r, s;
	cin >> p >> q >> r >> s;
	a[p] += 1;
	a[q] += 1;
	a[r] += 1;
	a[s] += 1;
	if(a[1] && a[9] && a[7] && a[4]) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#include <bits/stdc++.h>
using namespace std;

long long n;
int a[200010];

int main()
{
    ios::sync_with_stdio(false);
    cin>>n;
    for(long long i=1;i<=n;i++) cin>>a[i];
    long long l=1,r=1,sum=0,num=0,Xor=0,ans=0;
    while(l<=n){
        while(sum==Xor&&r<=n){
            sum+=a[r];
			Xor^=a[r];
			r++;
			num++;
        }
        if(sum==Xor) ans+=num--;
        else ans+=--num;
        r--;
        sum-=a[r];
        Xor^=a[r];
        l++;
        sum-=a[l-1];
        Xor^=a[l-1];
		num--;
    }
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1152
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N = ri()
A = rl()
B = rl()
C = rl()

ans = 0
prev = -2
for i in range(N):
	n = A[i]-1
	ans += B[n]
	if n-prev == 1:
		ans += C[prev]
	prev = n
print(ans)


Measured memory_bytes: 38384
#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;

int n, a[200100];
ll dp[200100][5];
int f(int x) {
	return x;
}
int g(int x) {
	return (x & 1) ^ 1;
}
int h(int x) {
	if (x == 0)
		return 2;
	return x & 1;
}
int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", a + i);
		ll p = dp[i - 1][0];
		dp[i][0] = p + f(a[i]);
		p = min(p, dp[i - 1][1]);
		dp[i][1] = p + h(a[i]);
		p = min(p, dp[i - 1][2]);
		dp[i][2] = p + g(a[i]);
		p = min(p, dp[i - 1][3]);
		dp[i][3] = p + h(a[i]);
		p = min(p, dp[i - 1][4]);
		dp[i][4] = p + f(a[i]);
	}
	ll min_c = 2e18;
	for (int i = 0; i < 5; i++)
		min_c = min(dp[n][i], min_c);
	printf("%lld\n", min_c);
}

Measured memory_bytes: 8704
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

s= ns()
t = ns()

if s == t[:-1]:
    print('Yes')
else:
    print('No')


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

void fail() {
    cout << -1 << '\n';
    exit(0);
}

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

    string S;
    cin >> S;
    int N = S.size();

    if (S.back() == '1')
        fail();

    if (S.front() != '1')
        fail();

    for (int i = 0; i < N - 1; i++)
        if (S[i] != S[N - 2 - i])
            fail();

    vector<pair<int, int>> edges;
    int current = 1;

    for (int size = 2; size <= N / 2; size++)
        if (S[size - 1] == '1') {
            while (current < size)
                edges.emplace_back(current++, size);
        }

    while (current < N)
        edges.emplace_back(current++, N);

    for (pair<int, int> &edge : edges)
        cout << edge.first << ' ' << edge.second << '\n';
}


Measured memory_bytes: 2500
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
typedef long long ll;

int main(){
    int N,ans=1;
    cin >> N;
    while((ans+1)*(ans+1) <= N) ans++;
    cout << ans*ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define INF 2e9
#define MOD (1000000007)
#define EPS 1e-9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long long int lli;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;

  int maxL = 0, sum = 0;
  REP(i, N) {
    int p;
    cin >> p;
    maxL = max(p, maxL);
    sum += p;
  }
  cout << (sum - maxL > maxL ? "Yes" : "No") << "\n";
}

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

int main()
{
    int n;
    cin >> n;
    string s;
    string t;
    cin >> s;
    cin >> t;
    for(int i = 0; i < n; ++ i)
    {
        cout << s[i] << t[i];
    }
    cout << endl;
}

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

using namespace std;

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

constexpr int N=200000;

vector<int> e[N];

long long a,b,n,c[N],sz[N],ans[N]={},C[N]={};

auto f=[](auto a){return a*(a+1)/2;};

void dfs(int i,int p=-1){

    auto tmp = C[c[i]];

    for(auto j:e[i]) if(j!=p){

        C[c[i]]=0;

        dfs(j,i);

        sz[i]+=sz[j];

        ans[c[i]]-=f(sz[j]-C[c[i]]);

    }

    C[c[i]]=tmp+sz[i];

}

int main(){

    cin>>n;

    fr(i,n) cin>>c[i],--c[i],sz[i]=1;

    fr(i,n-1){

        cin>>a>>b;--a,--b;

        e[a].push_back(b);

        e[b].push_back(a);

    }

    dfs(0);

    fr(i,n) cout<<ans[i]+f(n)-f(n-C[i])<<'\n';

}



Measured memory_bytes: 39520
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#define ll long long int
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define sz size
#define f first
#define s second
#define pb push_back
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod 1000000007
#define PI 3.14159265359
#define CODE_START  ios_base::sync_with_stdio();cin.tie();cout.tie();
using namespace std;
ll n;
string s;
int32_t main(){
CODE_START;
cin>>s;
if(s[2]==s[3]&&s[4]==s[5]){
    cout<<"Yes"<<endl;
}else cout<<"No"<<endl;
}


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

#define MP make_pair
#define FF first
#define SS second
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pie;
const int MOD = 1e9 + 7;
const int INF = 2e9;
const ll LINF = 4e18;
const ll delta = 1634569;

const int N = 1e5 + 20;
vector<int> G[N];
int n, g[N];

void dfs(int v, int p = -1) {
	for (int u : G[v])
		if (u - p)
			dfs(u, v);	
	for (int u : G[v])
		if (u - p)
			g[v] = g[v] ^ (g[u] + 1);
}

int main() {
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0, v, u; i < n - 1; i++) {
		cin >> v >> u;
		G[v].push_back(u);
		G[u].push_back(v);
	}
	dfs(1);
	cout << (g[1] ? "Alice" : "Bob") << endl;
}



Measured memory_bytes: 13952
N, K, Q = gets.split.map(&:to_i)
arr = Q.times.map { gets.to_i }

players = Array.new(N, 0)
arr.each do |i|
  players[i - 1] += 1
end

players.each do |player|
  if player > Q - K
    puts 'Yes'
  else
    puts 'No'
  end
end

Measured memory_bytes: 3836
#include<bits/stdc++.h>
using namespace std;
int f[31]={0},c[31];
int main()
{
	int i,j,k,a,s=0,n,m;
	scanf("%d %d",&n,&m);
	for(i=1;i<=n;i++)
	{
		scanf("%d",&k);
		memset(c,0,sizeof(c));
		for(j=1;j<=k;j++)
		{
			scanf("%d",&a);
			c[a]=1;
		}
		for(j=1;j<=m;j++)
			if(c[j])
				f[j]++;
	}
	for(i=1;i<=m;i++)
		if(f[i]==n)
			s++;
	printf("%d",s);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);

		char[] a = sc.next().toCharArray();
		char[] b = sc.next().toCharArray();
		char[] c = sc.next().toCharArray();

		int turn = 0;
		int aid = 0, bid = 0, cid = 0;
		while (true) {
			if (turn == 0) {
				if (a.length <= aid) {
					System.out.println("A");
					return;
				}
				turn = a[aid++] - 'a';
			} else if (turn == 1) {
				if (b.length <= bid) {
					System.out.println("B");
					return;
				}
				turn = b[bid++] - 'a';
			} else {
				if (c.length <= cid) {
					System.out.println("C");
					return;
				}
				turn = c[cid++] - 'a';
			}
		}
	}

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


Measured memory_bytes: 8788
#include<stdio.h>
using namespace std;

int main(){
  int n;
  scanf("%d", &n);
  int a[n];
  for (int i = 0; i < n; i++){
    int number = n - i - 1;
    scanf("%d", &a[number]);
  }
  printf("%d", a[0]);
  for (int j = 1; j < n; j++) {
    printf(" %d", a[j]);
  }
printf("\n");
return 0;
}


Measured memory_bytes: 2760
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

const int N = 1e5 + 10;
int64 a[N];
int dp[2][N];

void add(int c[], int n, int x, int y) {
  for (++x; x <= n; x += x & -x) {
    c[x] = (c[x] + y) % MOD;
  }
}

void clear(int c[], int n, int x) {
  for (++x; x <= n; x += x & -x) {
    c[x] = 0;
  }
}

int query(int c[], int x) {
  int ret = 0;
  for (; x; x -= x & -x) {
    ret = (ret + c[x]) % MOD;
  }
  return ret;
}

int main() {
  int n;
  int64 A[2];
  scanf("%d%lld%lld", &n, &A[0], &A[1]);
  a[0] = -(1LL << 60);
  for (int i = 1; i <= n; ++i) {
    scanf("%lld", &a[i]);
  }
  set<int> visit[2];
  for (int k = 0; k < 2; ++k) {
    add(dp[k], n, 0, 1);
    visit[k].insert(0);
  }
  for (int i = 2; i <= n; ++i) {
    int y[2];
    for (int k = 0; k < 2; ++k) {
      int x = upper_bound(a, a + i - 1, a[i] - A[k]) - a;
      y[k] = query(dp[1 - k], x);
    }
    for (int k = 0; k < 2; ++k) {
      if (a[i] < a[i - 1] + A[k]) {
        for (auto& it : visit[k]) {
          clear(dp[k], n, it);
        }
        visit[k].clear();
      }
      add(dp[k], n, i - 1, y[k]);
      visit[k].insert(i - 1);
    }
  }
  int ret = (query(dp[0], n) + query(dp[1], n)) % MOD;
  printf("%d\n", ret);
  return 0;
}


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

namespace AOJ1_7_D
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] NML = Console.ReadLine().Split(' ');
            int n = int.Parse(NML[0]);
            int m = int.Parse(NML[1]);
            int l = int.Parse(NML[2]);
            string[][] A = new string[n][];//nm行列
            string[][] B = new string[m][];//ml行列
            double[][] C = new double[n][];//nl行列
            //行列Aを定義する
            for (int i = 0; i < n; i++)
            {
                A[i] = Console.ReadLine().Split(' ');
            }
            //行列Bを定義する
            for (int i = 0; i < m; i++)
            {
                B[i] = Console.ReadLine().Split(' ');
            }
            //行列Cに枠を与える
            for(int i = 0;i<n;i++)
            {
                C[i] = new double[l];
            }
            //行列Cの初期値を零行列にする
            for(int i =0;i<n;i++)
            {
                for(int j=0;j<l;j++)
                {
                    C[i][j] = 0;
                }
            }
            //行列の積をもとめる

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < l; j++)
                {
                    for (int k = 0; k < m; k++)
                    {
                        C[i][j] += double.Parse(A[i][k]) * double.Parse(B[k][j]);
                    }
                }
            }
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < l; j++)
                {
                    Console.Write(C[i][j]);
                    if (!(j == (l - 1)))
                    {
                        Console.Write(" ");
                    }
                }
                Console.Write("\n");
            }
        }


    }
}




Measured memory_bytes: 18108
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>


using namespace std;
typedef long long int ll;

void disp(int x) {
    cout << x << endl;
}

int main() {
    ll N;
    cin >> N;
    vector<int> d(N);
    
    for(size_t i = 0; i < N; i++)
    {
        cin >> d[i];
    }

    ll ans;
    vector<int> l(N);
    for(size_t i = 0; i < N; i++)
    {
        int c = count(l.begin(), l.end(), d[i]);
        if (c == 0) {
            l.push_back(d[i]);
            ans++;
        }
    }
    
    std::cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main(void) {
  int n, i, tmp;
  int* a;
  scanf("%d", &n);
  a = (int*)malloc(sizeof(int)*n);
  for(i=0; i<n-1; i++) {
    scanf("%d", &tmp);
    a[tmp-1]++;
  }
  for(i=0; i<n; i++) {
    printf("%d\n", a[i]);
  }
  return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int

using namespace __gnu_pbds;

typedef tree<pair<ll,pair<ll,ll> >, null_type, less<pair<ll,pair<ll,ll> > >, rb_tree_tag, tree_order_statistics_node_update>ordered_set;


#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
#define PI acos(-1)
/* Precode Start Here *\



This functio helps to accesss map<pair<ll,ll>,ll ,hash_pair>myMap

struct hash_pair {
    template <class T1, class T2>
    size_t operator()(const pair<T1, T2>& p) const
    {
        auto hash1 = hash<T1>{}(p.first);
        auto hash2 = hash<T2>{}(p.second);
        return hash1 ^ hash2;
    }
};


power of 2 less than or equal to N

ll largest_power(ll N)
{
    //changing all right side bits to 1.
    N = N (N>>1);
    N = N| (N>>2);
    N = N| (N>>4);
    N = N| (N>>8);


//as now the number is 2 * x-1, where x is required answer, so adding 1 and dividing it by
 2.
            return (N+1)>>1;

}


     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}




/* Precode Ends */
#define mod 1000000007
ll A[5000001],B[5000001];
vector<ll>v;
map<ll,ll>myMap;
set<ll>mySet;
vector<pair<ll,ll> >vp;
priority_queue<ll> pq;
priority_queue<ll, vector<ll>, std::greater<ll> > first;


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

 string s;
 cin>>s;
 if(s[2]==s[3]&&s[5]==s[4])
 {
     cout<<"Yes"<<endl;
 }
 else
 {
     cout<<"No"<<endl;
 }

return 0;
}



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

int main() {
#ifdef whyqx
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif
    long long a, b, c, d, e;
    cin >> a >> b >> c >> d;
    e = c * d / __gcd(c, d);
    long long tmpa = b / c - (a - 1) / c;
    long long tmpb = b / d - (a - 1) / d;
    long long tmpc = b / e - (a - 1) / e;
    cout << b - a + 1 - (tmpa + tmpb - tmpc) << endl;
    return 0;
}




Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
const int MAX = 700000;
const int MOD = 1000000007;

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;
}
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y){
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
/*逆元計算*/
long long int  modinv(long long a, long long m) {
	long long int b = m, u = 1, v = 0;
	while (b) {
		long long int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
// index が条件を満たすかどうか
vector<long long int >meguru;
bool isOK(int index, int key) {
	if (meguru[index] >= key) return true;
	else return false;
}
// 汎用的な二分探索のテンプレ
int binary_search(int key) {
	int left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	int right = (int)meguru.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()
	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		int mid = left + (right - left) / 2;

		if (isOK(mid, key)) right = mid;
		else left = mid;
	}
	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}
long long modpow(long long a, long long n, long long mod) {
	long long res = 1;
	while (n > 0) {
		if (n & 1) res = res * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int main() {
	long long int n, m;
	cin >> n >> m;
	vector<vector<int>>s(100030);
	vector<int> orders;
	orders.push_back(0);
	for (int i = 0; i < n; i++) {
		int p;
		cin >> p;
		orders.push_back(p);
	}
	for (int i = 0; i < m; i++) {
		int a, b;
		cin >> a >> b;
		s[a].push_back(b);
		s[b].push_back(a);
	}
	int seen[100050] = {};
	int groups = 0;
	for (int i = 1; i <= n; i++) {
		if (seen[i] == 0) {
			groups++;
			seen[i] = groups;
			queue<int> q;
			q.push(i);
			while (q.size()) {
				int a = q.front();
				q.pop();
				for (auto j : s[a]) {
					if (seen[j] == 0) {
						seen[j] = groups;
						q.push(j);
					}
				}
			}
		}
	}
	long long int sum = 0;
	for (int i = 1; i <= n; i++) {
		if (seen[i] == seen[orders[i]]) {
			sum++;
		}
	}
	cout << sum;
}


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


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

 bool ok = true;
 for(int i=0 ;i<n;i++){
   int a;
   cin >> a;
   if(a%2 == 0){
     if(a%3 != 0 && a%5 != 0) ok = false;
   }
 }

 if(ok) cout << "APPROVED" << endl;
 else cout << "DENIED" << endl;
 
 return 0;

}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)

ll total = 0;
string s;

ll split(string t) {
	ll st = 0;
	ll d = 0;
	ll sum = 0;
	rep(i, 0, t.size()) {
		if (t[i] == '+' || i == t.size() - 1) {
			sum += stoll(t.substr(st, d));
			st = i + 1;
			d = 0;
		}
		d++;
	}
	return sum;
}

void insert(string *t, int i) {
	int n = i;
	int d = 1;
	int size = t->size();
	while (n > 0) {
		if (n % 2 == 1) {
			t->insert(size - d, "+");
		}
		d++;
		n /= 2;
	}
}

int main() {
	cin >> s;
	for (int i = 1; i < 1 << s.size() - 1; i++) {
		string t = s;
		insert(&t, i);
		total += split(t);
	}
	total += stoll(s);
	cout << total << endl;

	return 0;
}

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

string t;
int n, s, w, e;

int main(){

cin>>t;

for(int i=0; i<t.size(); i++){
    if(t[i] == 'N'){ n++; }
    if(t[i] == 'W'){ w++; }
    if(t[i] == 'E'){ e++; }
    if(t[i] == 'S'){ s++; }
}

if(s > 0 && n == 0){ cout<<"No"; return 0; }
if(n > 0 && s == 0){ cout<<"No"; return 0; }
if(w > 0 && e == 0){ cout<<"No"; return 0; }
if(e > 0 && w == 0){ cout<<"No"; return 0; }

cout<<"Yes";

return 0;

}


Measured memory_bytes: 256
N,K=map(int,input().split())
R,S,P=map(int,input().split())
te=["0"]*N
T=input()
score=0
for i in range(N):
    if i<=K-1:
        if T[i]=="r":
            score+=P
        elif T[i]=="s":
            score+=R
        else:
            score+=S
        te[i]=T[i]
    else:
        if T[i]==T[i-K] and T[i]==te[i-K]:
            te[i]="nt"
        else:
            te[i]=T[i]
            if T[i]=="r":
                score+=P
            elif T[i]=="s":
                score+=R
            else:
                score+=S
                
print(score)

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

using namespace std;

const double PI = 3.141592653589;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define int long long
#define ll long long
#define all(c) (c).begin(),(c).end()
#define M 1000000007
#define INF LLONG_MAX
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ", "; dbs(str.substr(idx + 1), s...);}
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
// Use pr(a,b,c,d,e) or cerr<<anything or prc(v.begin(),v.end()) or prc(v,v+n)
//  


int32_t main()
{
    fastio;
    //freopen("file.in", "r", stdin);
    //freopen("file.out", "w", stdout);
    int n;
    cin >> n;
    vector<int> h(n);
    for(int i=0;i<n;++i)
        cin >> h[i];
    vector<int> dp(n);
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for(int i=2;i<n;++i)
        dp[i] = min(dp[i-2] + abs(h[i] - h[i-2]), dp[i-1] + abs(h[i] - h[i-1]));
    cout << dp[n-1] << "\n";
    return 0;
}



Measured memory_bytes: 1792
#pragma GCC optimize("O3")
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld  double
#define pii pair<ll,int>
#define pip pair<int,pii>
#define ppi pair<pii,int> 
#define ppp pair<pii,pii>
#define pb push_back
#define ppb pop_back
#define pf push_fron
#define ppf pop_front
#define N 200003
#define inf (ll)(1e9+11)
#define warmup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll mod=1e9+7;

signed main()
{
    warmup
    
    int n,m;
    cin>>n>>m;
    int ans=0;
    if(n)
        ans+=(n*(n-1)>>1);
    if(m)
        ans+=(m*(m-1)>>1);
    cout<<ans;
    
    return 0;
}


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

signed main() {
    int n, k, c;
    cin >> n >> k >> c;
    string s;
    cin >> s;
    int f[k], b[k];
    int i = 0, j = 0;
    while (i < n && j < k) 
    {
        if (s[i] == 'o') {
            f[j++] = i;
            i = i + c + 1;
        }else ++i;
    }
    i = n - 1, j = k - 1;
    while (i >= 0 && j >= 0) {
        if (s[i] == 'o') {
            b[j--] = i;
            i -= (c + 1);
        }else --i;
    }

    for (int i = 0; i < k; ++i) {
        if (f[i] == b[i]) {
            cout << f[i] + 1 << endl;
        }
    }
    return 0;
}

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

int main(){
int a,b;
char op;

while(1){
cin>>a>>op>>b;
if(op=='?') break;

if(op=='+') cout<<a+b<<endl;
else if(op=='-') cout<<a-b<<endl;
else if(op=='*') cout<<a*b<<endl;
else if(op=='/') cout<<a/b<<endl;
}
return 0;
}


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

int main()
{
  int64_t n, k;
  cin >> n >> k;
  
  int64_t residue = n % k;
  int64_t residue_abs = residue - k;
  if (residue_abs < 0) residue_abs = -1 * residue_abs;
  
  if (residue < residue_abs) cout << residue << endl;
  else cout << residue_abs << endl;
  
  return 0;
}

Measured memory_bytes: 256
mod = 10**9 + 7

fact_range = 10**6 * 2
facts = [1] * (fact_range + 1)
for i in range(0, fact_range):
    facts[i+1] = facts[i] * (i + 1) % mod

ifacts = [1] * (fact_range + 1)
ifacts[fact_range] = pow(facts[fact_range], mod - 2, mod)
for i in range(fact_range, 0, -1):
    ifacts[i-1] = ifacts[i] * i % mod

def comb(n, k):
    if k < 0 or n < k:
        return 0
    else:
        return facts[n] * ifacts[n-k] % mod * ifacts[k] % mod

k = int(input())
s = len(input())
ans = 0
for a in range(k + 1):
    ans += pow(25, a, mod) * pow(26, k-a, mod) % mod * comb(s-1+a, a)
    ans %= mod
print(ans)


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

int main()
{
    string sa, sb, sc;
    cin >> sa >> sb >> sc;
    char now = 'a';
    int atop = 0, btop = 0, ctop = 0;
    int anum = sa.size(), bnum = sb.size(), cnum = sc.size();
    while (1)
    {
        if (now == 'a')
        {
            if (atop == anum)
            {
                cout << "A" << endl;
                return 0;
            }
        }
        else if (now == 'b')
        {
            if (btop == bnum)
            {
                cout << "B" << endl;
                return 0;
            }
        }
        else
        {
            if (ctop == cnum)
            {
                cout << "C" << endl;
                return 0;
            }
        }

        if (now == 'a')
        {
            now = sa[atop];
            atop++;
        }
        else if (now == 'b')
        {
            now = sb[btop];
            btop++;
        }
        else
        {
            now = sc[ctop];
            ctop++;
        }
    }
    return 0;
}

Measured memory_bytes: 256
//Written by Zhu Zeqi
//Come on,baby
//Hack,please
#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#define CLR(x) memset(x,0,sizeof x)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define MAX 1000000000000000000
#define MOD 1000000007
#define PI 3.141592653589793238462
#define INF 0x3f3f3f3f
typedef long long ll;
//orz yht
using namespace std;
string i_s(int x){
	if(x==0)
	return "0";
	string ret="";
	while(x){
		ret=ret+(char)(x%10+'0');
		x/=10;
	}
	reverse(ret.begin(),ret.end());
	return ret;
}
string add(string a,string b){
	if(a=="")
	a="0";
	if(b=="")
	b="0";
	if(a.length()<b.length())
	swap(a,b);
	while(b.length()<a.length()){
		b='0'+b;
	}
	for(int i=0;i<a.length();i++){
		a[i]=a[i]+(b[i]-'0');
	}
	bool big=false;
	for(int i=a.length()-1;i>=0;i--){
		if(big){
			a[i]++;
		}
		big=false;
		if(a[i]>'9'){
			a[i]=a[i]-10;
			big=true;
		}
	}
	if(big)
	a='1'+a;
	return a;
}
string mul(string a,string b){
	vector<int> va,vb;
	if(a=="0" || b=="0")
	return "0";
	string ans;
	for(int i=0;i<a.length();i++){
		va.push_back(a[i]-'0');
	}
	for(int i=0;i<b.length();i++){
		vb.push_back(b[i]-'0');
	}
	reverse(va.begin(),va.end());
	reverse(vb.begin(),vb.end());
	vector<int> res;
	res.clear();
	res.resize(1005);
	for(int i=0;i<a.length();i++){
		for(int j=0;j<b.length();j++){
			res[i+j]+=(va[i]*vb[j]);
		}
	}
	for(int i=0;i<1005;i++){
		if(res[i]>9){
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	for(int i=0;i<1005;i++){
		ans+=(res[i]+'0');
	}
	reverse(ans.begin(),ans.end());
	int k=0;
	while(ans[k]=='0'){
		k++;
	}
	ans=ans.substr(k);
	return ans;
}
bool is_prime(int n){
	if(n<2)
    return false;
    for(int i=2;i*i<=n;i++)
    if(n%i==0)
    return false;
    return true;
}
string s; 
int main(){
	//freopen("input.in","r",stdin);
	//freopen("output.out","w",stdout);
	cin>>s;
	for(int i=0;i<2;i++){
		if(s[i]=='9'){
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
use std::ops;

fn read<T: std::str::FromStr>(
    stdin_lock: &mut std::io::StdinLock,
    buf: &mut Vec<u8>,
    delimiter: u8,
) -> T {
    buf.clear();
    let l = std::io::BufRead::read_until(stdin_lock, delimiter, buf).unwrap();
    buf.truncate(l - 1); // remove delimiter
    let s = unsafe { std::str::from_utf8_unchecked(&buf) };
    s.parse().unwrap_or_else(|_| panic!("read"))
}

const MODP: u64 = 1_000_000_007;

#[derive(Debug, Copy, Clone, Eq, PartialEq)]
struct ModU64(u64);

impl ModU64 {
    fn pow(self, mut x: u64) -> Self {
        let mut b = self;
        let mut a = ModU64(1);
        while x > 1 {
            if x & 1 == 1 {
                a = a * b;
            }
            x = x / 2;
            b = b * b;
        }
        if x == 1 {
            a = a * b;
        }
        a
    }
}

impl ops::Add<ModU64> for ModU64 {
    type Output = ModU64;

    fn add(self, rhs: ModU64) -> Self::Output {
        ModU64((self.0 + rhs.0) % MODP)
    }
}

impl ops::Mul<ModU64> for ModU64 {
    type Output = ModU64;

    fn mul(self, rhs: ModU64) -> Self::Output {
        ModU64(self.0 % MODP * rhs.0 % MODP)
    }
}

impl ops::Div<ModU64> for ModU64 {
    type Output = ModU64;

    fn div(self, rhs: ModU64) -> Self::Output {
        self * rhs.pow(MODP - 2)
    }
}

fn main() {
    use std::cmp::max;
    use std::collections::HashMap;

    let stdin = std::io::stdin();
    let mut stdin_lock = stdin.lock();
    let mut buf: Vec<u8> = Vec::new();
    let n: usize = read(&mut stdin_lock, &mut buf, b'\n');
    let mut av = vec![0u64; n];
    for i in 0..n - 1 {
        av[i] = read(&mut stdin_lock, &mut buf, b' ');
    }
    av[n - 1] = read(&mut stdin_lock, &mut buf, b'\n');

    let mut pv = vec![0u64; 1_000_000 + 1];
    for i in 0..pv.len() {
        pv[i] = i as u64;
    }
    for i in 2..pv.len() {
        let mut j = i;
        while j < pv.len() {
            if pv[j] % i as u64 == 0 {
                pv[j] = i as u64;
            }
            j += i;
        }
    }

    let mut apv: Vec<HashMap<u64, u64>> = vec![HashMap::new(); n];
    for i in 0..av.len() {
        let mut j = av[i];
        while j != 1 {
            let p = pv[j as usize];
            *apv[i].entry(p).or_insert(0) += 1;
            j /= p;
        }
    }

    let mut l: HashMap<u64, u64> = HashMap::new();
    for a in apv.iter() {
        for (&k, &v) in a.iter() {
            if let Some(lv) = l.get_mut(&k) {
                *lv = max(*lv, v);
                continue;
            }
            l.insert(k, v);
        }
    }

    let mut lcm = ModU64(1);
    for (&k, &v) in l.iter() {
        for _ in 0..v {
            lcm = lcm * ModU64(k as u64);
        }
    }

    let mut ans = ModU64(0);
    for &a in av.iter() {
        let b = lcm / ModU64(a);
        ans = ans + b;
    }
    println!("{}", ans.0);
}


Measured memory_bytes: 20732
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define ull unsigned long long
#define db long double
#define pb push_back
#define ppb pop_back
#define F first
#define S second
#define mp make_pair
#define all(x) (x).begin(), (x).end()

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <int> vi;
typedef vector <ll> vll;

typedef tree <pii, null_type, less <pii>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int N = 2e5 + 123;
int n, fen[N];
string s;
deque <int> d[26];

void upd(int x, int y) {
	for (; x <= n; x |= (x + 1)) {
		fen[x] += y;
	}
}

int get(int x) {
	int res = 0;
	for (; x >= 0; x = (x & (x + 1)) - 1) {
		res += fen[x];
	}
	return res;
}

int main() {
	ios_base::sync_with_stdio(false), cin.tie(NULL);
	#ifdef LOCAL
		freopen("input.txt", "r", stdin);
	#endif
	
	cin >> s;
	n = s.size();
	for (int i = 0; i < n; i++) {
		d[s[i] - 'a'].pb(i + 1);
	}
	int odd = 0;
	for (int i = 0; i < 26; i++) {
		odd += (int)d[i].size() & 1;
	}
	if (odd > 1) {
		cout << -1;
		return 0;
	}
	int cur = n;
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		upd(i, 1);
	}
	while (cur > 0) {
		int mx = -1, c = -1;
		for (int i = 0; i < 26; i++) {
			if (d[i].empty()) {
				continue;
			}
			int l = d[i].front(), r = d[i].back();
			int len = get(r) - get(l - 1);
			if (len > mx) {
				mx = len, c = i;
			}
		}
		int l = d[c].front(), r = d[c].back();
		int len = get(r) - get(l - 1);
		ans += cur - len;
		upd(l, -1);
		if (l != r) {
			upd(r, -1);
		}
		d[c].pop_front();
		if (!d[c].empty()) {
			d[c].ppb();
		}
		cur -= 2;
	}
	cout << ans;
}


Measured memory_bytes: 2196