akhauriyash/Code-Regression huggingface dataset:
n=int(input())
st=[]
for i in range(n):
    s,t=input().split()
    t=int(t)
    st.append([s,t])
x=input()
j=0
for i in range(n):
    if st[i][0]==x:
        j=i
        break
ans=0
for i in range(j+1,n):
    ans+=st[i][1]
print(ans)


Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
n=n%10;
if(n==3)
  cout<<"bon";
else
  if(n==2||n==4||n==5||n==7||n==9)
    cout<<"hon";
else
  cout<<"pon";
return 0;
}

Measured memory_bytes: 3632
//10-2 ????????????
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
using namespace std;
int main(){
    bool flg = true;
    while(flg){
        int N,M;
        cin >> N >> M;

        if(N==0 && M==0){
            flg = false;
        }
        else{
            int sugoroku[1001] = {};
            for(int i=0; i<N; i++){
                int tmp;
                cin >> tmp;
                sugoroku[i+1] = tmp;
            }
        
            int saikoro[1001] = {};
            for(int i=0; i<M; i++){
                int tmp;
                cin >> tmp;
                saikoro[i+1] = tmp;
            }
        
            int now = 1;
            int i=1;
            while(now<N){
                now += saikoro[i];
                now += sugoroku[now];
                i++;
            }
            cout << i-1 << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3024
import scala.io.StdIn.readInt
import scala.collection.mutable.ArrayBuffer

object Main {
  def sieve(n:Int) = {
    val list = Array.tabulate(n+1) { _ % 2 }
    val primes = new ArrayBuffer[Int]
    list(1) = 0
    list(2) = 2
    primes += 2

    for( i <- 3 to Math.sqrt(n).toInt by 2 )
    {
      if(list(i) == 1) {
        (i*i to n by i*2).foreach { list(_) = 0 }
        primes += primes(primes.length-1)+i
      }
    }
    for(i<-Math.sqrt(n).toInt+1 to n if list(i)==1)
      primes += primes(primes.length-1)+i
    primes.toArray
  }

  def main(args:Array[String]) = {
    val p = sieve(200000)
    var n = 0
    while( { n = readInt; n} != 0 ) println(p(n-1))
  }
}

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

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

const ll INF=2000000020;

int main(){
  int n;
  cin>>n;
  
  vector<ll> X(n),Y(n);
  rep(i,n) cin>>X[i]>>Y[i];
  
  ll ma1=-INF,ma2=-INF,ma3=-INF,ma4=-INF;
  ll mi1=INF,mi2=INF,mi3=INF,mi4=INF;
  rep(i,n){
    if(ma1<X[i]+Y[i]) ma1=X[i]+Y[i];
    if(mi1>X[i]+Y[i]) mi1=X[i]+Y[i];
    if(ma2<X[i]-Y[i]) ma2=X[i]-Y[i];
    if(mi2>X[i]-Y[i]) mi2=X[i]-Y[i];
    if(ma3<-X[i]+Y[i]) ma3=-X[i]+Y[i];
    if(mi3>-X[i]+Y[i]) mi3=-X[i]+Y[i];
    if(ma4<-X[i]-Y[i]) ma4=-X[i]-Y[i];
    if(mi4>-X[i]-Y[i]) mi4=-X[i]-Y[i];
  }
  cout<<max({ma1-mi1,ma2-mi2,ma3-mi3,ma4-mi4})<<endl;

  return 0;
}

Measured memory_bytes: 6420
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	string s;
	cin>>s;
	string rs=s;
	reverse(rs.begin(),rs.end());
	for(int i=0;i<s.size();i++)
	{
		if(rs[i]=='b')rs[i]='d';
        else if(rs[i]=='d')rs[i]='b';
        else if(rs[i]=='p')rs[i]='q';
        else if(rs[i]=='q')rs[i]='p';
	}
	if(s==rs)cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))

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

const int MOD = 1e9+7;
const int INF = 1e9;

vector<int> Iv;
vector<int> Jv;
int N;
int main() {
	cin>>N;
	int X = N;
	if(N%2 == 0)X = N+1;

	int cnt =0;
	rep1(i,N+1)rep1(j,N+1){
		if(i<j)if(i+j!=X){
			cnt++;
			Iv.push_back(i);
			Jv.push_back(j);
		}
	}

	cout<<cnt<<endl;
	rep(i,cnt){
		cout<<Iv[i]<<' '<<Jv[i]<<endl;
	}
}

Measured memory_bytes: 384
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int mod = 1e9 + 7;
void solve(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    s = " " + s;
    unordered_map<char, int> m;
    vector<unordered_map<char, int>> a(n + 1);
    for (int i = 0; i <= n; ++i) {
        m[s[i]]++;
        a[i] = m;
    }
    ll ans = 0;
    for (int i = 1; i <= n; ++i) {
        for (int j = i + 1; j <= n; ++j) {
            if (s[i] == s[j]) continue;
            for (char x : {'R', 'G', 'B'}) {
                if (x == s[i] || x == s[j]) continue;
                ans += a[i - 1][x];
                if (2 * i - j > 0 && s[2 * i - j] == x) ans--; 
            }
        }
    } 
    cout << ans;
}
int main(){
    speed;
    int t = 1;
    //cin >> t;
    for (int i = 1; i <= t; ++i) {
        solve();
    }
}

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

using ll = long long;
using ull = unsigned long long;
using st = string;
using db = double;
using vll = vector<long long>;
using vvll = vector<vll>;
using vst = vector<st>;
using vchar = vector<char>;
#define rep(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
ll mod = 1000000007;

int main(){
  vvll c(3, vll(3));
  vrep(i, c)vrep(j, i) cin >> j;
  bool ans = 1;
  rep(i, 0, 3)
  if(!(c.at(0).at(i) - c.at(0).at(0) == c.at(1).at(i) - c.at(1).at(0) && c.at(0).at(i) - c.at(0).at(0) == c.at(2).at(i) - c.at(2).at(0)))
  ans = 0;
  rep(i, 0, 3)
  if(!(c.at(i).at(0) - c.at(0).at(0) == c.at(i).at(1) - c.at(0).at(1) && c.at(i).at(0) - c.at(0).at(0) == c.at(i).at(2) - c.at(0).at(2)))
  ans = 0;
  cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
const int INF=1145141919,MOD=1e9+7;
const long long LINF=1145141919810364364;


int main(){
	int n; cin>>n;
	long long a[n];
	rep(i,n){
		cin>>a[i];
		if(i!=0) a[i]+=a[i-1];
	}
	long long ans=LINF;
	int left=0,right=2;
	for(int centre=1;centre<=n-3;centre++){
		long long ldiff=abs((a[centre]-a[left])-a[left]),rdiff=abs((a[n-1]-a[right])-(a[right]-a[centre]));
		// cout<<ldiff<<" "<<rdiff<<endl;
		while(abs((a[centre]-a[left+1])-a[left+1])<ldiff&&left+1<centre){
			ldiff=abs((a[centre]-a[left+1])-a[left+1]);
			left++;
		}
		while((abs((a[n-1]-a[right+1])-(a[right+1]-a[centre]))<rdiff&&right+1<n-1)||centre==right){
			rdiff=abs(a[right+1]-a[centre]-(a[n-1]-a[right+1]));
			right++;
		}
		// cout<<left<<" "<<centre<<" "<<right<<endl;
		long long ll=a[left],lr=a[centre]-ll,rl=a[right]-a[centre],rr=a[n-1]-a[right];
		// cout<<ll<<" "<<lr<<" "<<rl<<" "<<rr<<endl;
		ans=min(ans,max({ll,lr,rl,rr})-min({ll,lr,rl,rr}));
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define rep(i,a) for(int i=0;i<a;i++)
using namespace std;
int main(){
    string a,b;
    cin>>a>>b;
    int s,l;
    s=stoi(a);
    l=stoi(b);
    int ans=0;
    for(int i=l;i!=s-1;i--)
    {
        if(i%10==i/10000){
            if(i/10%10==i/1000%10){
                ans++;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
# Code for B - Bingo
# Use input() to fetch data from STDIN
import sys

a = []
a.append([int(x) for x in input().split()])
a.append([int(x) for x in input().split()])
a.append([int(x) for x in input().split()])

c = [[False for x in range(3)] for y in range(3)]

n = int(input())
b = []
for s in range(n):
    b.append(int(input()))

for s in b:
    for i, line in enumerate(a):
        for j, num in enumerate(line):
            if num == s:
                c[i][j] = True

for line in c:
    if all(line):
        print("Yes")
        sys.exit()

for i in range(3):
    if all([c[0][i], c[1][i], c[2][i]]):
        print("Yes")
        sys.exit()

if all([c[0][0], c[1][1], c[2][2]]):
    print("Yes")
    sys.exit()

if all([c[0][2], c[1][1], c[2][0]]):
    print("Yes")
    sys.exit()

print("No")


Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF 2000000000
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;
 
using namespace std;
 
int main(void){
  int N,D,X;
  cin >> N >> D >> X;
  int A[N];
  rep(i,N) cin >> A[i];
  rep(i,D) rep(j,N) if(i%A[j]==0) X++;
  cout << X << endl;
}

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

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++) cin >> a[i];
	long long now = 1000, cnt = 0;
	for(int i = 0; i < n; i++){
		if(a[i] > a[i + 1] || i + 1 == n){
			now += cnt * a[i];
			cnt = 0;
		}
		else if(a[i] < a[i + 1]){
			cnt += now / a[i];
			now -= (now / a[i]) * a[i];
		}
	}
	cout << now << endl;
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll div_ceil(ll, ll);

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

int main() {
  int H, W;
  std::cin >> H >> W;
  std::vector<string> A(H);
  REP(i, H) { std::cin >> A[i]; }
  queue<pair<int, int>> que;
  std::vector<std::vector<int>> d(H, std::vector<int>(W, -1));
  REP(i, H) {
    REP(j, W) {
      if (A[i][j] == '#') {
        que.push(MP(i, j));
        d[i][j] = 0;
      }
    }
  }
  while (!que.empty()) {
    auto p = que.front();
    que.pop();
    REP(i, 4) {
      int gx = p.first + dx[i];
      int gy = p.second + dy[i];
      if (0 <= gx && gx < H && 0 <= gy && gy < W && d[gx][gy] == -1) {
        d[gx][gy] = d[p.first][p.second] + 1;
        que.push(MP(gx, gy));
      }
    }
  }
  int ans = 0;
  REP(i, H) {
    REP(j, W) { ans = max(ans, d[i][j]); }
  }
  std::cout << ans << '\n';
}

ll div_ceil(ll a, ll b) {
  ll quotient = a / b;
  ll remainder = a % b;
  if (remainder == 0) {
    return quotient;
  } else {
    return quotient + 1;
  }
}


Measured memory_bytes: 13456
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>

// ===============================================================

using namespace std;
using ll = long long;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using vs = vector<string>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using vm = vector<short>;
using vmm = vector<vector<short>>;
using pii = pair<int, int>;
using psi = pair<string, int>;
using ld = long double;
using ull = unsigned long long;

// ===============================================================

ll gcd(ll a, ll b) //最大公約数
{
	if (a % b == 0)
	{
		return(b);
	}
	else
	{
		return(gcd(b, a % b));
	}
}

ll lcm(ll a, ll b) //最小公倍数
{
	return a * b / gcd(a, b);
}

ll box(double a) //doubleの切り捨て
{
	ll b = a;
	return b;
}

ll fff(double a) //doubleの四捨五入
{
	ll b = a + 0.5;
	return b;
}

ll sum(ll n) { //整数sまでの合計
	if (n == 0) {
		return 0;
	}

	int s = sum(n - 1);
	return s + n;
}

bool prime(ll num)//素数判定、primeならtrue,違うならfalse
{
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	// 素数である
	return true;
}

// ===============================================================

int main() {
	string a, b;
	cin >> a >> b;
	if (b.substr(0, a.size()) == a) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 3668
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)

void solve(long long A, long long B, long long K){
    set<ll> ans;
    rep(i, K){
        if(A+i <= B)
            ans.insert(A+i);
        if(B-i >= A)
            ans.insert(B-i);
    }
    for(ll x: ans){
        cout << x << endl;
    }
}

int main(){
    long long A;
    scanf("%lld",&A);
    long long B;
    scanf("%lld",&B);
    long long K;
    scanf("%lld",&K);
    solve(A, B, K);
    return 0;
}


Measured memory_bytes: 256
N,K,Q = map(int,input().split())
A = [0]*Q
for i in range(Q):
    A[i] = int(input())
    

points = [K-Q]*N
for i in range(Q):
    points[A[i]-1] += 1
for i in range(N):
    if points[i]<=0:
        print('No')
    else:
        print('Yes')

Measured memory_bytes: 76652
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define mset(x,y) memset(x,y,sizeof(x))
#define rep(i,n) for(int i=0;i<int(n);i++)
#define per(i,n) for(int i=int(n)-1;i>=0;i--)
#define rng(i,a,b) for(int i=int(a);i<=int(b);i++)
#define gnr(i,b,a) for(int i=int(b);i>=int(a);i--)
using namespace std;
using namespace __gnu_pbds;
using ordered_set = tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;
#ifdef LOCAL
#define dmp(...) _dmp(#__VA_ARGS__, __VA_ARGS__)
#else
#define dmp(...) (__VA_ARGS__)
#endif
template<class T> using vt=vector<T>;
template<class T> using vvt=vt<vt<T>>;
template<class TA,class TB> void chmax(TA&a,TB b){if(a<b)a=b;}
template<class TA,class TB> void chmin(TA&a,TB b){if(b<a)a=b;}
template<class TA,class TB>
ostream& operator<<(ostream& os,const pair<TA,TB>& p){
	return os<<"{"<<p.fi<<","<<p.se<<"}";
}
template<class T> ostream& operator<<(ostream& os,const vt<T>& v){
	os<<"{";for(auto& e:v)os<<e<<",";return os<<"}";
}
template<class TH> void _dmp(const char *sdbg, TH h){cout<<sdbg<<"="<<h<<endl;}
template<class TH, class... TA> void _dmp(const char *sdbg, TH h, TA...a){
while(*sdbg!=',')cout<<*sdbg++;cout<<"="<<h<<","; _dmp(sdbg+1, a...);
}
template<class T> void make_unique(vt<T>& v) {
	sort(all(v));v.erase(unique(all(v)),v.end());
}
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
int ri(){int x;cin>>x;return x;}
ll rll(){ll x;cin>>x;return x;}
vi rvi(int n){vi v;rep(i,n)v.pb(ri());return v;}
set<int> get(string a,string b) {
	int na=a.length(),nb=b.length();
	set<int> s;
	rep(i,na+1)s.insert(i);
	rep(j,nb) {
		for(auto it=s.begin();it!=s.end();) {
			if(*it+j>=na||(a[*it+j]=='?'||b[j]=='?'||a[*it+j]==b[j]))it++;
			else it=s.erase(it);
		}
	}
	return s;
}
int solve(string a,string b,string c) {
	int na=a.length(),nb=b.length(),nc=c.length();
	set<int> vab=get(a,b),vac=get(a,c),vbc=get(b,c);
	int ret=INT_MAX;
	rep(i,na+1) {
		if(!vab.count(i))continue;
		rep(j,na+1) {
			if(j<nb&&!vbc.count(j))continue;
			if(i+j<na&&!vac.count(i+j))continue;
			ret=min(ret,max(na,max(i+nb,i+j+nc)));
		}
	}
	return ret;
}
void MAIN() {
	string s[3];
	cin>>s[0]>>s[1]>>s[2];
	vi a={0,1,2};
	int res=INT_MAX;
	do {
		res=min(res,solve(s[a[0]],s[a[1]],s[a[2]]));
	}while(next_permutation(all(a)));
	cout<<res;
}
int main() {
	ios::sync_with_stdio(false);cin.tie(0);
	int T=1;
	//cin>>T;
	for(int tt=1;tt<=T;tt++) {
		MAIN();
	}
	return 0;
}

Measured memory_bytes: 512
#pragma region Macros

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

using ll = long long;
#define int ll
using vi = vector<int>;
using vvi = vector<vi>;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

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

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

#pragma endregion

void Main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    vi a(101, 0);
    a[A]++;
    a[B]--;
    a[C]++;
    a[D]--;
    REP(i, 100) {
        a[i + 1] = a[i] + a[i + 1];
    }
    int count = 0;
    REP(i, 100) {
        if (a[i] == 2) {
            count++;
        }
    }
    cout << count;
}

#pragma region main
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    Main();
    cout << flush;
}
#pragma endregion


Measured memory_bytes: 3540
#include<bits/stdc++.h>
#define debug(x) cerr<<#x<<" = "<<x
#define sp <<"  "
#define el <<endl
#define fgx cerr<<"-----------------------------------"<<endl
#define LL long long
#define M 402
using namespace std;
namespace IO{
	const int BS=(1<<23)+5; int Top=0;
	char Buffer[BS],OT[BS],*OS=OT,*HD,*TL,SS[20]; const char *fin=OT+BS-1;
	char Getchar(){if(HD==TL){TL=(HD=Buffer)+fread(Buffer,1,BS,stdin);} return (HD==TL)?EOF:*HD++;}
	void flush(){fwrite(OT,1,OS-OT,stdout),OS=OT;}
	void Putchar(char c){*OS++ =c;if(OS==fin)flush();}
	void write(int x){
		if(!x){Putchar('0');return;} if(x<0) x=-x,Putchar('-');
		while(x) SS[++Top]=x%10,x/=10;
		while(Top) Putchar(SS[Top]+'0'),--Top;
	}
	int read(){
		int nm=0,fh=1; char cw=getchar();
		for(;!isdigit(cw);cw=getchar()) if(cw=='-') fh=-fh;
		for(;isdigit(cw);cw=getchar()) nm=nm*10+(cw-'0');
		return nm*fh;
	}
}using namespace IO;
int n,m,sz[M*M][2],f[M*M],id[M][M]; LL ans; char ch[M][M];
int fd(int x){return x==f[x]?x:f[x]=fd(f[x]);}
void merge(int x,int y){
	x=fd(x),y=fd(y); if(x==y) return;
	sz[y][0]+=sz[x][0],sz[y][1]+=sz[x][1],f[x]=y;
}
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read(),m=read();
	for(int i=1;i<=n;i++) scanf("%s",ch[i]+1);
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++)
		sz[id[i][j]=(i-1)*m+j][(ch[i][j]=='#')]=1,f[id[i][j]]=id[i][j];
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++){
		if(i<n&&ch[i][j]!=ch[i+1][j]) merge(id[i][j],id[i+1][j]);
		if(j<m&&ch[i][j]!=ch[i][j+1]) merge(id[i][j],id[i][j+1]);
	}
	for(int i=1;i<=n*m;i++) if(fd(i)==i)
		ans+=(LL)sz[i][0]*(LL)sz[i][1];
	printf("%lld\n",ans); return 0;
}

Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        String s = sc.next();

        boolean judge = true;
        String[] target = s.split("");
        for (int i = 0; i < target.length && judge; i++) {
            if (i % 2 == 0) {
                judge = !"L".equals(target[i]);
            } else {
                judge = !"R".equals(target[i]);
            }
        }

        System.out.println(judge ? "Yes" : "No");
    }
}


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

int main() {
  int N;cin>>N;
  vector<vector<int>> A(2,vector<int>(N));
  for(int i=0;i<2;i++){
    for(int j=0;j<N;j++)cin>>A.at(i).at(j);
  }
  
  int MAX=0;
  int candy;
  for(int i=0;i<N;i++){
    candy=0;
    for(int j=0;j<i+1;j++){
      candy+=A.at(0).at(j);
    }
    for(int j=i;j<N;j++){
      candy+=A.at(1).at(j);
    }
    MAX=max(MAX,candy);
  }
  cout<<MAX<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int main(){
    int n;
    cin >> n;
    int work[n];
    for(int i = 0; i < n; i++){
	cin >> work[i];
    }
    for(int i = n - 1; i >= 0; i--){
        cout << work[i];
        if(i != 0){
            cout << " ";
	}
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 1160
n, k = map(int, input().split())
a = list(map(int, input().split()))
if n == 1:
  print("0")
  exit()
ans_unit = 0
for i in range(n-1):
  for j in range(i+1, n):
    if a[i] > a[j]:
      ans_unit+=1
if k == 1:
  print(ans_unit)
  exit()
c = sum([a,a], [])
ans_inc =0
for i in range(0,n):
  for j in range(n, 2*n):
    if c[i] > c[j]:
      ans_inc+=1
ans = (k*ans_unit)%1000000007
if k%2 == 0:
  tmpk = int(k/2)
  tmp_ans = (tmpk*(k-1))%1000000007
else:
  tmpk = int((k-1)/2)
  tmp_ans = (tmpk*(k))%1000000007
tmp_ans *=ans_inc
tmp_ans %=1000000007
ans += tmp_ans
ans = ans%1000000007
print(ans)


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
using namespace std;
 
int main(){
    string s;
    cin >> s;
    int n = s.size();
    vector<ll> ans1(n+1, 0), ans2(n+1, 0), lans(n+1);
    for(int i = n-1; i >= 0; i--){
        if(s[i] == '>'){
            ans1.at(i) = ans1.at(i+1)+1; 
        }
    }
    for(int i = 0; i < n; i++){
        if(s[i] == '<'){
            ans2.at(i+1) = ans2.at(i)+1;
        }
    }
    rep(i, n+1)lans.at(i) = max(ans1.at(i), ans2.at(i));
    cout << accumulate(all(lans), 0LL) << endl;
}

Measured memory_bytes: 12548
log = console.log;

var stdin = require("fs").readFileSync("/dev/stdin", "UTF-8");
var lines = stdin.split("\n");
var N = lines[0].split(" ").map(Number)[0];
var M = lines[0].split(" ").map(Number)[1];
var as = lines
  .slice(1)
  .filter(v => v !== "")
  .map(Number);

steps = Array(N + 1).fill(true);
var dead = false;
as.forEach((v, i) => {
  steps[v] = false;
  if (steps[v - 1] === false) dead = true;
});

if (dead) {
  log(0);
} else {
  moveCounts = [];
  steps.forEach((bool, i) => {
    if (!bool) {
      moveCounts[i] = 0;
    } else if (i === 0) {
      moveCounts[i] = 0;
    } else if (i === 1 && bool) {
      moveCounts[i] = 1;
    } else if (i === 1 && !bool) {
      moveCounts[i] = 0;
    } else if (i === 2 && bool) {
      moveCounts[i] = (moveCounts[i - 1] + 1) % 1000000007;
    } else {
      moveCounts[i] = (moveCounts[i - 1] + moveCounts[i - 2]) % 1000000007;
    }
  });
  count = moveCounts[N]
  log(count);
}


Measured memory_bytes: 27748
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
  vector<char> s,t;
  string ss,st;
  cin >> ss >> st;
  for(int i=0;i<ss.size();i++){
    s.push_back(ss[i]);
  }
  for(int i=0;i<st.size();i++){
    t.push_back(st[i]);
  }

  sort(s.begin(),s.end());
  sort(t.begin(),t.end(),greater<char>());

  int r = min(s.size(),t.size());
  bool flag = true;
  for(int i=0;i<r;i++){
    if(s[i] > t[i]){
      flag = false;
      break;
    }else if(s[i] < t[i]){
      break;
    }
    if(i == r-1){
      if(s.size() >= t.size()){
        flag = false;
      }
    }
  }

  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}


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

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

using namespace std;

typedef pair<int,int> P;
#define P_NUM 4


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

    int H,W;

    cin >> H >> W;

    vector<string> grid;
    int h_tmp = H;
    REP(i,H){
        string hoge = "";
        cin >> hoge;
        if(hoge.find('#') != string::npos)
            grid.push_back(hoge);
        else h_tmp--;
    }
    H = h_tmp;

    bool flag[W];

    REP(c,W)
        flag[c] = false;

    REP(c,W){
        REP(r,H){
            if(grid[r][c] == '.')
                flag[c] = false || flag[c];
            else flag[c] = true;
        }
    }

    REP(r,H){
        REP(c,W) {
            if(flag[c])
                cout << grid[r][c];
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace C_AISING2020
{
    class MainClass
    {

        static int[] s;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);

            int n = s[0];
            var ans = new int[n+1];
            for(int i = 1;i<=100;i++){
                for(int j = 1;j<=100;j++){
                    if(i*i+j*j+i*j>n) continue;
                    for(int k = 1;k<=100;k++){
                        var tmp = i*j+j*k+k*i+i*i+j*j+k*k;
                        if(tmp <=n) ans[tmp]++;
                    }
                }
            }
            for(int i = 1;i<=n;i++){
                WriteLine(ans[i]);
            }
        }

        public static int LowerBound<T>(T[] a, T v)
        {
            return LowerBound(a, v, Comparer<T>.Default);
        }

        public static int LowerBound<T>(T[] a, T v, Comparer<T> cmp)
        {
            var l = 0;
            var r = a.Length - 1;
            while (l <= r)
            {
                var mid = l + (r - l) / 2;
                var res = cmp.Compare(a[mid], v);
                if (res == -1) l = mid + 1;
                else r = mid - 1;
            }
            return l;
        }
        public static int UpperBound<T>(T[] a, T v)
        {
            return UpperBound(a, v, Comparer<T>.Default);
        }

        public static int UpperBound<T>(T[] a, T v, Comparer<T> cmp)
        {
            var l = 0;
            var r = a.Length - 1;
            while (l <= r)
            {
                var mid = l + (r - l) / 2;
                var res = cmp.Compare(a[mid], v);
                if (res <= 0) l = mid + 1;
                else r = mid - 1;
            }
            return l;
        }
    }
}


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

int main() {
    int N, A, B, P;
    cin >> N >> A >> B;
    map<int, int> MP;
    for (int i = 0; i < N; i++) {
        cin >> P;
        if (P <= A) MP[0]++;
        else if (P > A && P <= B) MP[1]++;
        else MP[2]++;
    }
    cout << min(MP[0], min(MP[1], MP[2])) << endl;
    return 0;
}

Measured memory_bytes: 256
S = list(input())
N = len(S)
n1 = (N - 1) // 2
n2 = (N + 3) // 2

res1 = S[:n1]
res2 = S[n2-1:]

if(S == list(reversed(S)) and res1 == list(reversed(res1)) and res2 == list(reversed(res2))):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
#define MAP(x,y) map[(x)+((y)+1)*(W+1)]
H,W,map[101*102];
E(x,y){
	int c=MAP(x,y);
	MAP(x,y)='.';
	if(MAP(x-1,y)==c)
		E(x-1,y);
	if(MAP(x+1,y)==c)
		E(x+1,y);
	if(MAP(x,y-1)==c)
		E(x,y-1);
	if(MAP(x,y+1)==c)
		E(x,y+1);
}
main(){
	int x,y,r;
	for(;scanf("%d%d\n",&H,&W),H|W;){
		for(x=0;x<H*(W+1);x++)
			MAP(x,0)=getchar();
		r=0;
		for(y=0;y<H;y++){
			for(x=0;x<W;x++){
				if(MAP(x,y)!='.'){
					E(x,y);
					r++;
				}
			}
		}
		printf("%d\n",r);
	}
	exit(0);
}

Measured memory_bytes: 0
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdint>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;
using ll = long long;

#define EPS (1e-7)

int main() {
  string S;
  cin >> S;
  string ans = (S == "ABC") ? "ARC" : "ABC";

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




Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <iomanip>
#include <stack>
#include <string>
#include <set>
#include <queue>
#include <functional>
#include <deque>

using namespace std;

#define forn(i,n) for(int i = 0; i < n; i++)
#define forr(i,n) for(int i = n-1; i >= 0; i++)
#define ALL(x) x.begin(),x.end()
#define mp(x,y) make_pair(x,y);
#define lson x*2, l, m
#define rson x*2+1, m+1, r

typedef long long int64;
typedef unsigned long long uint64;
typedef pair<int, int> pii;
typedef pair<int64, int64> pii64;
typedef vector<int> vint;
typedef vector<int64> vint64;
template <typename T> istream& operator >> (istream& in, vector<T>& t) { for (int i = 0;i < t.size();i++) in >> t[i]; return in; }
template <typename T> ostream& operator << (ostream& out, vector<T>& t) { for (int i = 0;i < t.size();i++) out << t[i] << " "; return out; }

struct Node
{
	vector<int> to;
};
vector<Node> g;
int n, m;

void go(int x, int p = -1, int h = 0)
{
	if (h == 2)
	{
		if (x == n - 1)
		{
			puts("POSSIBLE");
			exit(0);
		}
		else return;
	}
	for (int i = 0;i < g[x].to.size();i++)
	{
		if (g[x].to[i] == p) continue;
		go(g[x].to[i], x, h + 1);
	}
}

int main()
{
#ifdef _SANYA
	freopen("abc.txt", "r", stdin);
#else
#define T "permutation"
	//freopen(T ".in", "r", stdin);
	//freopen(T ".out", "w", stdout);
#endif
	cin >> n >> m;
	g.resize(n);
	for (int i = 0;i < m;i++)
	{
		int l, r; cin >> l >> r; l--;r--;
		g[l].to.push_back(r);
		g[r].to.push_back(r);
	}
	go(0);
	puts("IMPOSSIBLE");
	exit(0);
}

Measured memory_bytes: 12016
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Data = pair<ll, vector<int>>; //右側のvector<int>はカウンタ
#define rep(i,N) for (int i = 0; i < N; i++)

int main() {
    vector<ll> N(3);
    int K;
    rep(i,3) cin >> N[i];
    cin >> K;
    vector<vector<ll>> v(3);
    for (int ind = 0; ind < 3; ind++) {
        v[ind].resize(N[ind]);
        for (int i = 0; i < N[ind]; i++) scanf("%Ld", &v[ind][i]);
        sort(v[ind].begin(), v[ind].end(), greater<ll>());
    }
    priority_queue<Data> que;
    set<Data> se;
    que.push(Data(v[0][0] + v[1][0] + v[2][0], vector<int>({0,0,0})));
    rep(k,K) {
        auto c = que.top(); que.pop();
        cout << c.first << endl;

        //次のやつら
        for (int ind = 0; ind < 3; ind++) {
            if (c.second[ind] + 1 < N[ind]){
                ll sum = c.first - v[ind][c.second[ind]] + v[ind][c.second[ind]+1];
                auto num = c.second; num[ind]++;
                auto d = Data(sum, num);

                if (!se.count(d)) se.insert(d), que.push(d);
            }
        }
    }
}

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

using namespace std;

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

    int l, r, d;
    cin >> l >> r >> d;

    int ans = 0;
    int init = l / d;
    init = init * d;
    while (init <= r) {
        //cout << init << " ";
        if (init <= r && init >= l) {
            ans ++;
        }
        init += d;
    }
    cout << ans << "\n";
    return 0;
}

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

using namespace std;

#define boost                         \
    ios_base::sync_with_stdio(false); \
    fin.tie(NULL);                    \
    fout.tie(NULL);
#define ll long long int
// #define int ll
#define vi vector<ll>
#define vvi vector<vi>
#define pii pair<ll, ll>
#define vii vector<pii>
#define pb push_back
#define B begin()
#define E end()
#define sz(A) (ll)(A).size()
#define F first
#define S second
#define loop(z, v) for (auto &z : v)
#define sp << ' ' <<
#define sps << ' '
#define nl "\n"
// #define nl endl
#define fat 1000000007
// #define fat 998244353
#define PI_2 1.57079632679489661923

int main()
{
    // boost;
    // ifstream fin;
    // fin.open("./fb_d1.txt");
    // ofstream fout;
    // fout.open("./d1_out.txt");

    time_t tic, toc;
    ll tt = 1, n, m, k = 0, i, j, p, q;
    ll a, b, c, h, w, u, v, x, y, t;
    ll l = 0, r = 0;
    ll ans = 0;

    bool poss = true;

    string s;

    // cin >> tt;
    tic = clock();
    for(int _ = 1; _ <= tt; _++){
        // cout << "Case #" << _ << ": ";
        cin >> n >> k;

        vi logs(n);
        loop(z, logs) cin >> z;

        l = 1, r = fat;
        while(r > l){
            ll mid = (l + r) >> 1;

            ll cuts = 0;
            loop(z, logs){
                cuts += ceil(1.0*z/mid) - 1;
            }
            if(cuts <= k){
                r = mid;
            }
            else{
                l = mid + 1;
            }
        }
        cout << l << nl;
    }
    // fin.close();
    // fout.close();
    // cerr << (clock() - tic*1.0) / CLOCKS_PER_SEC << nl;
    return 0;
}


Measured memory_bytes: 4752
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
  int x,a,b;
  cin>>x>>a>>b;
  int i,j;
  i=abs(x-a);
  j=abs(x-b);
  if(i>=j)
    {
      cout<<"B"<<endl;
    }else{
    cout<<"A"<<endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long d[5][5];
const long long INF = 1e18;
int a[5];
int main(){
	long long x, y;
	cin >> x >> y;
	for(int i = 0; i < 4 ;i++)
		for(int j=0;j<4;j++)
			if(i!=j)
				d[i][j]=INF;
	a[0]=x;a[1]=-x;a[2]=y;a[3]=-y;
	for(int i=0;i<4;i++){
		for(int j=0;j<4;j++){
			if(a[i] <= a[j])
				d[i][j] = a[j]-a[i];
		}
	}
	d[0][1]=min(d[0][1],1LL);
	d[1][0]=min(d[1][0],1LL);
	d[2][3]=min(d[2][3],1LL);
	d[3][2]=min(d[3][2],1LL);
	for(int k=0;k<4;k++)
		for(int i=0;i<4;i++)
			for(int j=0;j<4;j++)
				d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
	cout<<d[0][2]<<endl;
	//system("pause");
	return 0;
}

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

using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<int,int> P;
#define Mod 1000000007
using VP = vector<P>; using VVP = vector<VP>;
using VI = vector<ll>; using VVI = vector<VI>; using VVVI = vector<VVI>;
#define INF 1e9

struct edge {int to,cap,rev;};

vector<edge> G[100];
int level[100];
int iter[100];

void add_edge(int from,int to,int cap){
    G[from].push_back((edge){to,cap,(int)G[to].size()});
    G[to].push_back((edge){from,0,(int)G[from].size()-1});
}

void bfs(int s){
    memset(level,-1,sizeof(level));
    queue<int> que;
    level[s]=0;
    que.push(s);
    while(!que.empty()){
        int v=que.front(); que.pop();
        for(int i=0;i<G[v].size();i++){
            edge &e=G[v][i];
            if(e.cap>0 && level[e.to]<0) {
                level[e.to]=level[v]+1;
                que.push(e.to);
            }
        }
    }
}

int dfs(int v,int t,int f){
    if(v==t) return f;
    for(int &i=iter[v]; i<G[v].size();i++){
        edge &e=G[v][i];
        if(e.cap>0 && level[v] < level[e.to]){
            int d=dfs(e.to,t,min(f,e.cap));
            if(d>0){
                e.cap-=d;
                G[e.to][e.rev].cap+=d;
                return d;
            }
        }
    }
    return 0;
}

int maxflow(int s,int t){
    int flow=0;
    for(;;){
        bfs(s);
        if(level[t]<0) return flow;
        memset(iter,0,sizeof(iter));
        int f;
        while((f=dfs(s,t,INF))>0){
            flow+=f;
        }
    }
}


int main(){
    ll v,e;
    cin>>v>>e;
    for(ll i=0;i<e;i++){
        ll x,y,z;
        cin>>x>>y>>z;
        add_edge(x,y,z);
    }
    cout<<maxflow(0,v-1)<<endl;
}


Measured memory_bytes: 3160
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cmath>
using namespace std;
int a[5],ans;
int main()
{
	for(int i=1;i<=3;i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+4);
	cout<<a[1]+a[2]<<endl;
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

n = input()
t, a = map(float, raw_input().split())
h = map(int, raw_input().split())

DOWN_RATE = 0.006
INF_TEMP = 50 + 100000 * DOWN_RATE

betterTemp = INF_TEMP
betterPlace = 0
for i in range(n):
    tempTemp = t - (h[i] * DOWN_RATE)
    tempDiff = abs(a-tempTemp)
    if tempDiff <= betterTemp:
        betterTemp = tempDiff
        betterPlace = i

print betterPlace + 1


Measured memory_bytes: 2696
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <ios>     // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
using namespace std;

// typedef
typedef long long ll;
typedef unsigned long ul;
// #define int long long

// macro
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (int i=0; i < (int)(n); i++)  // 0 ~ n-1
#define REPN(i, n) for (int i=1; i <= (int)(n); i++)  // 1 ~ n
#define DESCEND greater<int>()  // sort 降順 大きい順
#define UNIQUE(vec) (vec).erase(unique(ALL((vec))), (vec).end());  // 必ずsortを行なってから
#define MIN(vec) min_element(ALL((vec)))  // 値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)  // 直後の要素をパディング
#define space_pad(num) setfill(' ') << std::right << setw(num)  // 直後の要素をパディング

// func declaration
template <class T> void print2DVec(vector< vector<T> >&);
template <class T> void calcVec(vector<T>&, int, char);
int char_to_int(const char);

// const
const int INF = 10000000;

/*MEMO
・辞書順
abc < abcd, atcoder < atlas
・イテレータ
std::vector<int>::iterator とタイプするのは面倒なので、
 通常は型推論の auto を使用する。
 auto iter = max_element(ALL(vec));
・2次元配列
vector<vector<int>> vec = {{1, 2, 3}, {4, 5, 6}}
・20×10の配列
vector<vector<int>> vec(20, vector<int>(10, 0));
・(n, m)の多次元配列
vector< vector<int> > vec(n, vector<int>(m, 0))  // 0で初期化
*/

int main() {
    cin.tie();
    ios::sync_with_stdio(false);
    
    // input
    int X;
    cin >> X;
    if (X%10 == 9 || X/10 == 9) {
        cout << "Yes" << "\n";
    } else {
        cout << "No" << "\n";
    }
    
    return 0;
}


// function
template <class T> void print2DVec(vector< vector<T> >& vec) {
    REP(i, vec.size()) {
        REP(j, vec.front().size()) {
            cout << vec.at(i).at(j);
        }
        cout << endl;
    }
}

template <class T> void calcVec(vector<T> &vec, int num, char ch) {
    // vec全体への演算
    switch (ch) {
        case '+':
            REP(i, vec.size()) vec.at(i) += num; break;
        case '-':
            REP(i, vec.size()) vec.at(i) -= num; break;
        case '*':
            REP(i, vec.size()) vec.at(i) *= num; break;
        case '/':
            REP(i, vec.size()) vec.at(i) /= num; break;
        case '%':
            REP(i, vec.size()) vec.at(i) %= num; break;
        default:
            cout << "Incorrect Operator" << endl;
    }
}

int char_to_int(const char c) {
    if('0' <= c && c <= '9') return (c - '0');
    return -1;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        mut d_s: [i64; n]
    }
    d_s.sort();
    let front_last = n / 2 - 1;
    if d_s[front_last] == d_s[front_last + 1] {
        println!("0");
        return;
    }
    let diff = d_s[front_last + 1] - d_s[front_last];
    println!("{}", diff);
}


Measured memory_bytes: 4352
def digitsum(n):
    return eval("+".join(str(n)))

n = int(input())
k = str(n)
if (int(k[0])+1)*10**(len(k)-1)-n == 1:
    print(digitsum(n))
else:
    print((int(k[0])-1)+9*(len(k)-1))

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

using namespace std;

int main()
{
  int n,k;
  cin >> n >> k;
  vector<int>S(n+1);
  S[0] = 1;
  for(int i = 1; i <= n; i++)
  {
    S[i] = min(2*S[i-1], S[i-1] + k);
  }
  cout << S[n] << endl;
  return 0;
}


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

using namespace std;
using ll =long long;

#define SORT(a) sort((a).begin(),(a).end())
#define rSORT(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cout << #x << " = " << (x) << endl;
bool coY() {cout <<"Yes"<<endl;}
bool coN(){cout <<"No"<<endl;}

const ll INF = 1LL << 60;

ll n,m,h,w,k,a,b;
string s;
//Write From this Line

int main()
{
	cout << setprecision(10);

	cin >> n  >> m;
	//電球がk個のスイッチにつながってるって考えるよりも、あるスイッチは電球kにつながっている。って考えたほうがよさそう。
	//i番目のスイッチを押したらk番目のスイッチに＋1する。みたいな感じにしたい。
	map<int,vector<int>> Swi;
	rep(i,m){//m個の電球に関する情報が与えられる。
		cin >> k ;
		rep(j,k){//電球i+1は、k個のスイッチと繋がっている。
			cin >> a ;
			a--;
			Swi[a].push_back(i);
		}
	}
	rep(i,n){
		if(!Swi.count(i)){
			Swi[i].push_back(-1);
		}
	}
	vector<int> p(m);
	rep(i,m){
		cin >> p[i];
		//電球i+1は、繋がっているスイッチの個%2 == p[i]のときに光る
	}
//	for(auto x: Swi){
//		cout << x.first << ": " ;
//		rep(i,Swi[x.first].size()){
//			cout << Swi[x.first][i] <<" ";
//		}
//		cout << endl;
//	}
	//bit数がスイッチの数、スイッチが5個なら00000から11111までで全探索
	//01010なら2個目のスイッチと4個目のスイッチ(Swi[2]とSwi[4]を見て、Swi[2]に入っている要素（電球）の値を＋1する。みたいな処理
	ll ans = 0 ;
	for(int tmp = 0 ; tmp < ( 1 << n); tmp++){
		bitset<10> bit(tmp);
		vector<int> count(m,0);
		//debug(bit);
		for(int i = 0 ;i<n; i++){
			if(bit.test(i)){
				//i番目のビットが経っているなら、Swi[i]の中身を見る.
				for(auto x : Swi[i]){
					if(x==-1){
						continue;
					}
					count[x] ++;
				}
			}
		}
		for(int i = 0 ; i < m ; i ++){
			//cout << "count["<<i<<"]: "<<count[i] << endl;

		}
		//countに、それぞれの電球が何個押されてるかが入っている
		bool flag = true;
		for(int i = 0 ; i < m ; i ++){
			if(count[i] % 2 == p[i]){
				// ok
			}else{
				flag = false;
				break;
			}
		}
		if(flag){
			ans ++ ;
		}
		//debug(ans);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
#define sp(x) fixed << setprecision(x)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pil = pair<int, ll>;
using pli = pair<ll, int>;
using pll = pair<ll, ll>;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const int inf = (1<<30)-1;
const ll INF = (1LL<<60)-1;
const ld EPS = 1e-10;
template<typename T> bool chmax(T &x, const T &y) {return (x < y)? (x = y, true) : false;};
template<typename T> bool chmin(T &x, const T &y) {return (x > y)? (x = y, true) : false;};

int main(){
    ll N;
    cin >> N;
    ll comb[41][41];
    rep(i, 41) rep(j, 41) comb[i][j] = 0;
    comb[0][0] = 1;
    rep(i, 40){
        rep(j, i+1){
            comb[i+1][j] += comb[i][j];
            comb[i+1][j+1] += comb[i][j];
        }
    }
    int n;
    rep3(i, 39, 1){
        if(N >= (1LL<<i)-1) {n = i; break;}
    }
    N -= (1LL<<n)-1;
    n++;
    int now = 2;
    vector<int> res[n];
    rep3(i, (n-1)/2, 1){
        int cnt = N/comb[n][i], memo = now;
        rep(j, cnt){
            res[0].pb(now), res[i].pb(2*memo+cnt-1-now);
            now++;
        }
        N %= comb[n][i];
    }
    vector<int> ans;
    rep(i, n){
        for(auto &e: res[i]) ans.pb(e);
        ans.pb(1);
    }
    rep3(i, 39, 1){
        ll a = (1LL<<i)-1;
        int cnt = N/a;
        rep(j, cnt){
            rep(k, i+1) ans.pb(now);
            now++;
        }
        N %= a;
    }
    cout << sz(ans) << endl;
    for(auto &e: ans) cout << e << ' '; cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<iostream>
//#include<cstdio>
//#include<cstring>
//#include<string>
//#include<queue>
//#include<cmath>
//#include<algorithm>
//#define debug1 cout<<"?"<<endl;
//#define debug2 cout<<"?"<<i<<endl;
#define PII pair<int,int>
typedef long long ll;
const int maxn=3e5+9;
const double pi=acos(-1);
const int mod=1e9+7;
const int INF=0x3f3f3f3f;
const double ep=1e-7;
using namespace std;
int main()
{
	int a[4]={0};
	scanf("%d%d%d",&a[1],&a[2],&a[3]);
	sort(a+1,a+3);
	if(a[1]==a[2]&&a[1]!=a[3]||a[1]==a[3]&&a[1]!=a[2]||a[2]==a[3]&&a[1]!=a[2])puts("Yes");
	else puts("No");
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
#include <ios> 
#include <iomanip>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

int main() {
	int N, res;
    res = 0;
	cin >> N;
    vector<int> V, C;
    for (int i = 0; i < N; i++){
        int vi;
        cin >> vi;
        V.push_back(vi);
    }
    for (int i = 0; i < N; i++){
        int ci;
        cin >> ci;
        C.push_back(ci);
    }
    for (int i = 0; i < N; i++){
        if (V[i] > C[i]) {
            res += V[i] -C[i];
        }
    }
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int a,b;
	string s,t,u;
	cin >>s>>t;
	cin >>a>>b;
	cin >>u;
	
	if (s==u) a--;
	if (t==u) b--;
	cout << a <<" "<< b << endl;
	return 0;
}

Measured memory_bytes: 256