akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>

#define REP(i, a) for(int i=0;i<(int)a;++i)
typedef long long ll;
typedef long double ld;
using namespace std;

int a, b, c;
int cnt = 0;

void solver() {
    cin >> a >> b >> c;
    for (int i = a; i <= b; ++i) {
        if (c % i == 0)cnt++;
    }
    cout << cnt << endl;
}

int main() {
    solver();
    return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<vector<int>> G(N);
    vector<pair<int, int>> vp;
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
        vp.emplace_back(a, b);
    }

    int k = 0;
    map<pair<int, int>, int> I;
    vector<int> cs(N, 0);

    vector<int> used(N, 0);
    queue<int> que;
    used[0] = 1;
    que.emplace(0);
    while(!que.empty()) {
        int v = que.front(); que.pop();
        if (k < (int)G[v].size()) k = G[v].size();
        int cur = 1;
        for (int u: G[v]) {
            if (used[u]) continue;
            if (cur == cs[v]) cur++;
            cs[u] = I[make_pair(u, v)] = I[make_pair(v, u)] = cur++;
            used[u] = 1;
            que.emplace(u);
        }
    }

    cout << k << endl;
    for (auto p: vp) cout << I[p] << endl;
    return 0;
}

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

namespace ABC128A
{
    class Program
    {
        static void Main(string[] args)
        {
          
            {
                var word = Console.ReadLine().Split();
                int a = int.Parse(word[0]);
                int  b = int.Parse(word[1]);
                int max;
                max = ((a * 3) + b) / 2;
                Console.WriteLine(max);
                Console.ReadKey();



            }
        }
    }
}
    




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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    int ans=0;
    for(int i=1;i<n;++i){
        ans+=((n-1)/i);
    }
    cout << ans << "\n";
    return 0;
}   

Measured memory_bytes: 3636
from collections import deque
k=int(input())
num=[]

def dfs(lun):
  #print(lun)
  num.append(lun)
  if lun>3234566667:
    return
  now=lun%10
  for i in [-1,0,1]:
    if 0<=now+i<=9:
      dfs(lun*10+now+i)

for i in range(1,10):
  dfs(i)
num.sort()
print(num[k-1])
#print(num[0:k])


Measured memory_bytes: 24292
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const string ABC ="ABC";
const string ARC ="ARC";
void solve(std::string S){
    if(S==ABC){
        cout <<ARC <<endl;
    }else{
        cout <<ABC<<endl;
    }

}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 3628
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;

void solve(){

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

    int prime[100000]={};

    for(int i=2;i*i<=100000;i++){
        if(!prime[i]){
            for(int j=2;i*j<=100000;j++){
                prime[i*j]=1;
            }
        }
    }

    ll exprime[100000]={};
    for(int i=3;i<=100000;++++i){
        if(!prime[i]){
            int m = (i+1)/2;
            if(!prime[m]){
                exprime[i]=1;
            }
        }
    }

    ll cnt[100000]={};
    for(int i=2;i<=100000;i++){
        if(exprime[i]){
            cnt[i]=cnt[i-1]+1;
        }
        else{
            cnt[i]=cnt[i-1];
        }
    }

    prime[0]=1;
    prime[1]=1;

    int q;
    cin >> q;
    for(int i=0;i<q;i++){
        int l,r;
        cin >> l >> r;
        cout << cnt[r] - cnt[l-1] << endl;
    }

    // rep(i,20){
    //     cout << prime[i] << " "<< exprime[i] << endl;
    // }


    return 0;
}

Measured memory_bytes: 2560
<?php
  
fscanf(STDIN,"%d%d%d%d%d",$h1,$m1,$h2,$m2,$k);
$start_time = $h1*60+$m1;
$end_time = $h2*60+$m2;

$possble_end = $end_time-$k;
echo ($possble_end-$start_time);



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

int n;
vector<int> ve;

int main(void) {
    cin >> n;
    int x, i;
    for (i = 0; i < n; i++) {
        cin >> x;
        ve.push_back(x);
    }
    ve.erase(unique(ve.begin(), ve.end()), ve.end());
    printf("%d", ve[0]);
    for (i = 1; i < ve.size(); i++) {
        printf(" %d", ve[i]);
    }
    printf("\n");
}


Measured memory_bytes: 3520
S = input()

ans1 = 0
ans2 = 0
for i in range(len(S)) :
    if i%2 == 0 and S[i] == "0" :
        ans1 += 1
    elif i%2 == 1 and S[i] == "1" :
        ans1 += 1

for i in range(len(S)) :
    if i%2 == 0 and S[i] == "1" :
        ans2 += 1
    elif i%2 == 1 and S[i] == "0" :
        ans2 += 1

print(min(ans1,ans2))


Measured memory_bytes: 3188
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
using namespace std;
using ll = long long;
//using G = vector<vector<int>>;

int main(){
    int k;
    cin >> k;
    vector<ll> a;
    for(int i=1;i<=9;i++) a.push_back(i);//1桁目
    while (1)
    {
        //一周すると1桁増える
        if(k<=a.size()){//k番目のaの要素が答え
            cout << a[k-1] << endl;
            return 0;
        }
        k -= a.size();
        vector<ll> old;
        swap(old,a);//oldに前の桁が入っている
        for(ll x:old){
            for(int i=-1;i<=1;++i){
                int d = x%10+i;//xの末尾を変化させる
                if(d < 0 || d>9) continue;//dが1桁でない
                ll nx = x*10 + d;//一桁ふやして末尾の数字をくっつける
                a.push_back(nx);
            }
        }
    }
    
}

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

using namespace std;

const int MAXN=110000;
const int OO = INT_MAX;
int N;
long long int sol[MAXN], A[MAXN];
int main(){
	cin>>N;
	for(int i=0;i<N;i++){
		cin>>A[i];
		sol[i]=OO;	
	}
	sol[0]=0;
	for(int i=1;i<N;i++){
		if(sol[i-1]+abs(A[i]-A[i-1])<sol[i])
			sol[i] = sol[i-1]+abs(A[i]-A[i-1]);
		if(i>1 && sol[i-2]+abs(A[i]-A[i-2])<sol[i])
			sol[i] = sol[i-2]+abs(A[i]-A[i-2]);
	}
	cout<<sol[N-1];
}

Measured memory_bytes: 1792
n,m,q = [int(_) for _ in input().split()]

a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q

for i in range(q):
  a[i],b[i],c[i],d[i] = [int(_) for _ in input().split()]
  a[i] = a[i]-1 # 初期値を減らす
  b[i] = b[i]-1

def score(A):
  tmp = 0
  for ai,bi,ci,di in zip(a,b,c,d):
    if A[bi] - A[ai] == ci:
      tmp += di
  return tmp


def dfs(A):
  if len(A) == n: # ここで配列が出揃うので計算して返す
    return score(A)
  if len(A) > 0: # 最初は-1 がないからここで定義してやる
    prev_last = A[-1]
  else:
    prev_last = 1
  result = 0
  for v in range(prev_last,m+1):
    A.append(v)
    result = max(result,dfs(A))
    A.pop()
  return result

print(dfs([]))


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

using namespace std;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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

int main() { 
    string s;
    cin >> s;
    if(s[0] == s[2]) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0; 
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k,m;
	cin>>n>>k;
	vector<int>s(n);
	for(int i=0;i<n;i++){
		cin>>s.at(i);
	}
	m=0;
	sort(s.begin(),s.end());
	reverse(s.begin(),s.end());
	for(int i=0;i<k;i++){
		m+=s.at(i);
	}
	cout<<m<<endl;
}

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

int x(int i,int j,int N,int K,int *h,int *cost) {
  int ans;
  if(i-1<=K){ //h[1]からh[i]まで一度に飛べる
    if(j==1)
      return cost[1] + abs(h[i]-h[1]);
    ans = min(cost[j] + abs(h[i]-h[j]), x(i,j-1,N,K,h,cost));
  }
  else{ //h[1]からh[i]まで一度に飛べない
    if(j==i-K)
      return cost[i-K] + abs(h[i]-h[i-K]);    
    ans = min(cost[j] + abs(h[i]-h[j]), x(i,j-1,N,K,h,cost));
  }
  return ans;
}

int main() {
  int N,K;
  cin >> N >> K;
  int h[N] = {};
  for(int i=1; i<N+1; i++)
    cin >> h[i];
  int cost[N] = {};
  for(int i=0; i<N+1; i++)
    cost[i] = -1;
  cost[1] = 0;
  cost[2] = abs(h[2]-h[1]);
  for(int i=3; i<N+1; i++)
    cost[i] = x(i,i-1,N,K,h,cost);
  cout << cost[N] << endl;
}



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

int main() {
  int N;
  cin >> N;
  
  queue<string> q;
  q.push("a");
  for (int i = 1; i < N; i++) {
    int X = q.size();
    for (int j = 0; j < X; j++) {
      string S = q.front();
      sort(S.begin(), S.end());
      char C = S.at(S.size() - 1);
      char p = 'a';
      for (int k = 0; k < C - 'a' + 2; k++) {
        q.push(q.front() + p);
        p = p + 1;
      }
      q.pop();
    }
  }
  
  while (!q.empty()) {
    cout << q.front() << endl;
    q.pop();
  }
}

Measured memory_bytes: 7936
#include<iostream>
using namespace std;
int main()
{
	// スペース区切りの整数の入力
    int N,X,T;
    cin >> N >> X >> T;
    
    int i = 0;
  	if(N%X){
      i = 1;
    }
      
	int P = N/X + i;

    // 出力
    cout << P*T << endl;
    return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <string>
#include <cstring>
#include <bitset>
#include <functional>
#include <random>
#define REP(i,a,n) for(int i=a;i<=n;++i)
#define PER(i,a,n) for(int i=n;i>=a;--i)
#define hr putchar(10)
#define pb push_back
#define lc (o<<1)
#define rc (lc|1)
#define mid ((l+r)>>1)
#define ls lc,l,mid
#define rs rc,mid+1,r
#define x first
#define y second
#define io std::ios::sync_with_stdio(false)
#define endl '\n'
#define DB(a) ({REP(__i,1,n) cout<<a[__i]<<' ';hr;})
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int P = 1e9+7, INF = 0x3f3f3f3f;
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll qpow(ll a,ll n) {ll r=1%P;for (a%=P;n;a=a*a%P,n>>=1)if(n&1)r=r*a%P;return r;}
ll inv(ll x){return x<=1?1:inv(P%x)*(P-P/x)%P;}
inline int rd() {int x=0;char p=getchar();while(p<'0'||p>'9')p=getchar();while(p>='0'&&p<='9')x=x*10+p-'0',p=getchar();return x;}
//head



const int N = 1e6+50;
ll d[N],a[N];
ll b[N];

int main() {
	int n=rd(),D=rd();
	REP(i,1,n) d[i]=rd();
	a[0] = D;
	REP(i,1,n) a[i] = min(a[i-1],abs(a[i-1]-d[i]));
	b[n] = 1;
	PER(i,1,n-1) {
		if (b[i+1]<=d[i+1]/2) b[i]=b[i+1];
		else b[i]=b[i+1]+d[i+1];
	}
	int q=rd();
	REP(i,1,q) {
		int x = rd();
		puts(b[x]<=a[x-1]?"YES":"NO");
	}
}









Measured memory_bytes: 18304
#include <iostream>
#include <utility>
#include <tuple>
#include <string>
#include <cstdint>
#include <vector>
#include <array>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <cassert>
using namespace std;
using i64 = int64_t;
const i64 mod = 1e9 + 7;
i64 n, dp[3001][3001];
string s;
int main() {
    cin >> n >> s;
    s.insert(begin(s), '*');
    for (int j = 0; j <= n; ++j) {
        dp[0][j] = 1;
    }
    for (i64 i = 1; i < n; ++i) {
        if (s[i] == '<') {
            for (i64 j = 1; j <= n - i; ++j) {
                dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % mod;
            }
        } else {
            for (i64 j = n - i; j >= 1; --j) {
                dp[i][j] = (dp[i - 1][j + 1] + dp[i][j + 1]) % mod;
            }
        }
    }
    cout << dp[n - 1][1] << endl;
    return 0;
}

Measured memory_bytes: 70016
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
  int N = sc.nextInt();
  for(int i = 0;;i++){
    if(N<Math.pow(2,i)){
      System.out.println((int)Math.pow(2,i-1));
      break;
    }
  }
}}

Measured memory_bytes: 22100
#include<bits/stdc++.h>
using namespace std;
const int INF = 1 << 28;

int main(){
  int n, m;
  map< string, int > peace;
  
  
  while(cin >> n, n){
    for(int i = 0; i < n; i++){
      string s;
      int p;
      cin >> s >> p;
      peace.insert( make_pair( s, p));
    }
    cin >> m;
    for(int i = 0; i < m; i++){
      string a;
      int c, cost = 0;
      cin >> a >> c;
      while(c--){
        string b;
        cin >> b;
        cost += peace[b];
      }
      peace[a] = min( peace[a], cost);
    }
    string query;
    cin >> query;
    cout << peace[query] << endl;
    peace.clear();
  }
}

Measured memory_bytes: 1224
/*
    Author:zeke

    pass System Test!
    GET AC!!
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
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;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;
// cout << "Case #" << index << " :IMPOSSIBLE";
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    ll n,m,k;
    cin>>n>>m>>k;
    V vec1(n+1),vec2(m);
    rep3(i,1,n+1)cin>>vec1[i];
    rep(i,m)cin>>vec2[i];
    rep3(i,1,n+1)vec1[i]+=vec1[i-1];
    rep3(i,1,m)vec2[i]+=vec2[i-1];
    ll res=0;
    //for(auto i:vec1)cout<<i<<" ";
    //cout<<endl;
    rep(i,n+1){
        ll amari=k-vec1[i];
       // cout<<k<<" "<<vec1[i]<<" "<<amari<<endl;
        if(amari<0){
            break;
        }
       // amari++;
        ll f=upper_bound(all(vec2),amari)-vec2.begin();
       // cout<<f<<endl;
        chmax(res,f+i);
    }
    cout<<res<<endl;
}


Measured memory_bytes: 6348
import java.util.Scanner;

class Main{
	public static void main(String args[]){
		Scanner in = new Scanner(System.in);
		while(in.hasNext()){
			int a = in.nextInt();
			int b = in.nextInt();
			int c = (int)Math.log10(a+b) + 1;
			System.out.println(c);
		}
	}
}

Measured memory_bytes: 26332
#include <bits/stdc++.h>
#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)
#define rep(i, n) FOR(i, 0, n)
#define REP(i, n) FOR(i, 1, ll(n) + 1)
#define ALL(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;

constexpr ll mod = 1e9 + 7;
constexpr ll inf = 1LL << 60;

template <typename T> inline bool chmax(T &a, const T b) {
    if(a >= b) return false;
    a = b;
    return true;
}
template <typename T> inline bool chmin(T &a, const T b) {
    if(a <= b) return false;
    a = b;
    return true;
}

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

struct MAX {
    ll mx1, mx2;
    void f(const ll a) {
        if(mx1 < a) {
            mx2 = mx1;
            mx1 = a;
        } else
            chmax(mx2, a);
    }
    void f(const MAX m) {
        f(m.mx1);
        f(m.mx2);
    }
    ll sum() { return mx1 + mx2; }
};

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

    int n;
    cin >> n;

    vector<MAX> mx(1 << n);
    rep(i, 1 << n) {
        ll a;
        cin >> a;
        mx[i] = {a, -inf};
    }
    rep(j, n) rep(i, 1 << n) {
        if(!(i >> j & 1)) i |= 1 << j;
        mx[i].f(mx[i ^ (1 << j)]);
    }

    ll ret = 0;
    FOR(i, 1, 1 << n) cout << (ret = max(ret, mx[i].sum())) << endl;
}

Measured memory_bytes: 7168
#include <bits/stdc++.h>
using namespace std;
    
#define IOS cin.sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define rep(i, n) for (int i = 0; i < n; i++)
#define repn(i, a, b) for (int i = a;i<=b;i++)
#define ll long long int
#define pb push_back
//#define mp make_pair
#define ff first
#define ss second
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define mem(x) memset(x, 0, sizeof(x))
#define ritr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define pai pair < int, int> 
#define pal pair < ll, ll> 
#define vi vector <int> 
#define vl vector < ll > 
#define vpai vector < pii > 

const int mod = 1e9+7;
const int INF = INT_MAX;
const int sze = 3005;

map<string,int>mp;

void solve(string str,int val=0) {
    cout<<str<<" x "<<mp[str]<<endl;
}

int main() {
    IOS;

    int t = 1;
    cin >> t;
    while (t--) {
        string str;
       //solve();
       cin>>str;
       mp[str]++;
    }
    
     solve("AC");
     
      solve("WA");
       solve("TLE"); solve("RE");

  return 0;
}

Measured memory_bytes: 3688
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1001001001;
const ll mod = 1000000007;
const int MAX = 1000100;

int main(){
    int m; cin >> m;
    ll s = 0, d = 0;
    for(int i = 0; i < m; i++){
        ll a, b; cin >> a >> b;
        s += a * b;
        d += b;
    }
    cout << d - 1 + (s - 1) / 9 << endl;
}

Measured memory_bytes: 3620
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP

██╗███████╗████████╗██╗ █████╗ ██╗  ██╗
██║██╔════╝╚══██╔══╝██║██╔══██╗██║ ██╔╝
██║███████╗   ██║   ██║███████║█████╔╝
██║╚════██║   ██║   ██║██╔══██║██╔═██╗
██║███████║   ██║   ██║██║  ██║██║  ██╗
╚═╝╚══════╝   ╚═╝   ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝




*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    double t,r=1,r1=0,r2=0,k=0,a,b,c=1,m,d=0,n,e,f=0,x=0,g,p=0,q=0,y=0,z=0;

    vector<pair<long long,long long>>v;
    vector<long long>u;
    map<string,long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4,s5,s6;
   cin>>n;
   m=n/3.0;
   cout<<setprecision(12)<<fixed<<pow(m,3)<<endl;



}


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

typedef std::pair <int, int> pr;
const int N = 100054, mod = 1000000007;

int n, m, nR, nH;
int r[N], h[N];
pr p[N];

inline void add(int &x, const int y) {x += y - mod, x += x >> 31 & mod;}

namespace BIT {
	#define lowbit(x) (x & -x)
	int x[N];

	int sum(int h) {int s = 0; for (; h > 0; h -= lowbit(h)) ::add(s, x[h]); return s;}
	void add(int h, int v) {for (; h <= m; h += lowbit(h)) ::add(x[h], v);}
}

namespace DC {
	int F[N]; pr D[N];

	int Discretize(int n) {
		int i, cnt = 0;
		std::sort(D, D + n);
		for (i = 0; i < n; ++i)
			F[D[i].second] = (i && D[i].first == D[i - 1].first ? cnt - 1 : (D[cnt] = D[i], cnt++));
		return cnt;
	}
}

int main() {
	int i, j = 0, t, ans = 1;
	scanf("%d%d", &nR, &nH);
	for (i = 0; i < nR; ++i) scanf("%d", r + i);
	for (i = 0; i < nH; ++i) scanf("%d", h + i);
	for (i = 0; i < nR; ++i) {
		for (; j < nH && h[j] < r[i]; ++j);
		if (!j || j == nH) continue;
		p[n++] = pr(r[i] - h[j - 1], r[i] - h[j]);
	}
	std::sort(p, p + n), n = std::unique(p, p + n) - p;
	for (i = 0; i < n; ++i) DC::D[i] = pr(-p[i].second, i);
	m = DC::Discretize(n);
	for (i = 0; i < n; ++i) add(ans, t = BIT::sum(DC::F[i]) + 1), BIT::add(DC::F[i] + 1, t);
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 3072
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long n2 = sc.nextInt();

        if(n >= 10 || n2 >= 10){
            System.out.println(-1);
        }else{
            System.out.println(n * n2);
        }

        //String n = sc.next();




    }
}


Measured memory_bytes: 22740
#include <bits/stdc++.h>
using namespace std;
int main(){
  int a;
  cin>>a;
  double b;
  b=a;
  if(a==1){cout<<1<<endl;}
  else if(a%2==1){cout<<(a/2+1)/b<<endl;}
  else{cout<<0.5<<endl;}
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	
	int a,b,c;
	
	scanf("%d %d %d",&a,&b,&c);
	
	if(a<b && b<c){
		printf("Yes\n");
	}else{
		printf("No\n");
	}
		
	return 0;
}


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

int main(){
  string s;
  int half;
  int sum=0;
  int a;
  cin>>s;
  int size=s.length();
   rep(i,size){
     a=size-1-i;
    if(s[i]!=s[a])sum++;
  }
  sum/=2;
  cout<<sum<<endl;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
using namespace std;
typedef long long ll;
#define free  freopen ("input.txt", "r", stdin);freopen ("output.txt", "w", stdout);
#define Fast  ios::sync_with_stdio(false); cin.tie(0);
#define pb push_back
#define mp make_pair
#define F first
#define S second

bool vowel(char che)
{
    if (che == 'A' || che == 'E' || che == 'I' || che == 'O' || che == 'U' || che == 'Y')
        return true;
    else
        return false;
}

const int N = 1e6+5;
const int mod = 1e9+7;
ll a[N], b[N], c[N], d, dp[N], dis;
//pair <ll, ll> p[N], p1[N];
char o;
bool mark[N], h;
string s;
//stack <int> st;
//set <ll> st1, st2;
//deque <int> dq;
//vector <ll> vm, vp, vt[N];
//int a1[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int main()
{
    Fast
    ll t, n, m, k = 0, f = 0, sum = 0, ans = 0;
    cin >> n >> m >> k;
    f = (n+k-1)/k;
    if (m >= f)
        cout << "Yes\n";
    else
        cout << "No\n";
}


Measured memory_bytes: 3600
n,w=map(int,raw_input().split())
vw=[map(int,raw_input().split()) for _ in xrange(n)]
dp=[0]*(w+1)
for i in xrange(n):
    for j in xrange(w,vw[i][1]-1,-1):
        dp[j]=max(dp[j],dp[j-vw[i][1]]+vw[i][0])
print(dp[w])

Measured memory_bytes: 6568
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, x;
	cin >> n >> x;
	vector<int> a(n), b;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	b = a;
	long long ans = 1LL << 60;
	for (int i = 0; i < n; i++) {
		long long tmp = 1LL * i * x;
		for (int j = 0; j < n; j++) {
			b[j] = min(b[j], a[(j - i + n) % n]);
		}
		for (int j = 0; j < n; j++) {
			tmp += b[j];
		}
		ans = min(tmp, ans);
	}
	cout << ans << '\n'; 
	return 0;	
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n; cin >> n;
    vector < int > v(n); int mn = 0,mx = 1e9+100;
    for (int x=0;x<n;x++){
        cin>> v[x];
        mn = max(mn, v[x]);
        mx= min(mx,v[x]);
    }

    if (n==2) {
        cout << max(v[0],v[1]) << endl;
        return 0;
    }

    set < int > s;
    for (int x=1;x*x<=mn;x++){
        if (mn%x==0){
            s.insert(x);
            s.insert(mn/x);
        }
    }
    for (int x=1;x*x<mx;x++){
        if (mx%x==0){
            s.insert(x);
            s.insert(mx/x);
        }
    }
    vector < int > ans;
    for (auto it=s.begin();it!=s.end();it++){
        ans.push_back(*it);
    }
    reverse(ans.begin(),ans.end());
    int c=0;
    for (int i=0;i<ans.size();i++){
        c=0;
        for (int x=0;x<n;x++){
            if (v[x]%ans[i]!=0) c++;
            if (c>1) break;
        }
        if (c<2){
            cout << ans[i]<<endl;
        break;
        }
    }
}


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

using namespace std;
#define ll  long long
#define ld  long double

#define endl '\n'
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = 1000000007;
const double PI = 3.141592653589793238463;
const int MAXN=1e5 + 5;
int arr[10];
int main() {
  int a,b,c;
  cin>>a>>b>>c;
  arr[a]++;
  arr[b]++;
  arr[c]++;
  if(arr[5]==2 && arr[7]==1)
      cout<<"YES"<<endl;
  else
      cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;
    if(b==0&&a!=0)cout<<"No";
    else if(b%2==0&&b/2==a)cout << "Yes";
    else if(b%4==0&&b/4==a) cout <<"Yes";
    else
    {
        int f=1;
        for(int i=2,j=1;i<=b;i+=2,j++)
        {
            if((b-i)%4==0&&(b-i)/4+j==a){cout << "Yes";f=0;break;}
        }
            if(f)cout << "No";
    }
}


Measured memory_bytes: 3632
#include <stdio.h>
    #include <math.h>
     
    int main(int argc, char *argv[])
    {
            long long a;
      		long long  b;
      		long long c;
            scanf("%lld", &a);
      		scanf("%lld", &b);
     		 scanf("%lld", &c);
      		
      		if (c-a-b>0 && 4*a*b < (a+b-c)*(a+b-c)){
    			printf("Yes");          
            }else{
                printf("No");
                 
            }
     
            return 0;
    }

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

#ifndef INCLUDE_BOOL_ARRAY_HPP
#define INCLUDE_BOOL_ARRAY_HPP

#include <cstring>
#include <limits>
#include <cassert>

namespace orliv {
template<unsigned int CAP>
struct BoolArray {
  typedef int memory_t;
  memory_t K;
  memory_t data[CAP];
  BoolArray() { clear_deep(); }
  void clear_deep(){ std::memset(data, sizeof(data), 0); K = 1; }
  void clear(){ K++; }
  bool within_k(int x, int k){ return data[x] + k >= K; }
  inline bool get(int x){ return data[x] == K; }
  inline void set(int x){ data[x] = K; }
};
}

#endif

using namespace std;

typedef long long ll;
typedef long double ld;
typedef tuple<int, int> duo;
const int dx[] = {0, 0, 1, -1, 1, 1, -1, -1};
const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
const int Mod = 1000000000 + 0;
//{{{ templates
#define TT_ template<typename T>inline
#define TTF_ template<typename T,typename F>inline
TT_ T sq(T x){return x*x;}
TT_ T In(){T x;cin>>x;return x;}
TT_ void Out(T&x){cout<<x;}
TT_ void sort(T&v){sort(begin(v),end(v));}
TT_ void revs(T&v){reverse(begin(v),end(v));}
TT_ void uniq(T&v){sort(v);v.erase(unique(begin(v),end(v)),end(v));}
TT_ int ubnd(T&v,typename T::value_type x){return upper_bound(begin(v),end(v),x)-begin(v);}
TT_ int lbnd(T&v,typename T::value_type x){return lower_bound(begin(v),end(v),x)-begin(v);}
TTF_ void inpt(T&v,int n,F f){for(v.reserve(n);n--;v.emplace_back(f()));}
TTF_ void show(T&v,F f,string d=" ",string e="\n"){int i=0;for(auto&x:v)i++&&(cout<<d),f(x);cout<<e;}
TT_ typename T::iterator minel(T&v){return min_element(begin(v),end(v));}
TT_ typename T::iterator maxel(T&v){return max_element(begin(v),end(v));}

inline void fast_io(){ios_base::sync_with_stdio(0);cin.tie(0);}
inline int in(){int x;scanf("%d",&x);return x;}
inline ll pow_mod(ll a,ll k,ll m){ll r=1;for(;k>0;a=a*a%m,k>>=1)if(k&1)r=r*a%m;return r;}
inline ll mod_inv(ll a,ll p){return pow_mod(a,p-2,p);}
//}}} priority_queue queue deque front stringstream max_element min_element insert count make_tuple

const int MAX_N = 10100100;
orliv::BoolArray<MAX_N> dp;
bool sieve[MAX_N];

int main()
{
  sieve[0] = sieve[1] = true;
  for (int i = 2; i * i <= MAX_N; i++){
    if (sieve[i]) continue;
    for (int j = i * i; j <= MAX_N; j += i){
      sieve[j] = true;
    }
  }

  int n, x;
  while (n = in(), x = in(), n){
    dp.set(0);
    for (int i = 0; i < n; i++){
      int cost = in();
      for (int j = 0; j + cost <= x; j++){
        if (dp.get(j)) dp.set(j + cost);
      }
    }
    for (int i = x; i > 0; i--){
      if (!sieve[i] && dp.get(i)){
        printf("%d\n", i);
        goto END;
      }
    }
    puts("NA");
END:;
    dp.clear();
  }
  return 0;
}

Measured memory_bytes: 15500
package main

import (
	"bufio"
	"fmt"
	"log"
	"math"
	"os"
	"strconv"
	"strings"
)

func main() {
	scanner := makeWordScanner()
	h := eGetInt(scanner)
	count := 0
	hit := 0
	hit += pow(2, count)
	for {
		if h <= 1 {
			break
		}
		h = h / 2
		count++
		hit += pow(2, count)
	}
	fmt.Println(hit)
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeCharScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanRunes)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}
func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func pow(a, n int) int {
	return int(math.Pow(float64(a), float64(n)))
}
func countBitOfOn(i, numbits int) int {
	count := 0
	var bit uint64
	for bit = 0; bit < uint64(numbits); bit++ {
		t := 1 << bit
		if i&t > 0 {
			count++
		}
	}
	return count
}


Measured memory_bytes: 640
program third
  implicit none

  integer :: lo, le, n, i
  character(50) :: o, e
  character(100) :: ans

  read(*,*) o
  read(*,*) e

  lo = len(trim(o))
  le = len(trim(e))
  
  ans = ''
  n = lo
  
  if (lo == le) then
     do i = 1, n
        ans = trim(ans)//o(i:i)
        ans = trim(ans)//e(i:i)
     end do
     write(*,*) ans
     stop
  else
     do i = 1, n-1
        ans = trim(ans)//o(i:i)
        ans = trim(ans)//e(i:i)
     end do
     ans = trim(ans)//o(n:n)

     write(*,*) ans

  end if

  stop
end program third


     
     
  


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <algorithm>
#include <math.h>
using namespace std;

bool IsPrime(long long int num)
{
    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(){
    cin.tie(0);
   	ios::sync_with_stdio(false);

    long long int N;
    cin>>N;

    long long int c=INFINITY;

    if(IsPrime(N)==true){
        cout<<N-1<<"\n";
        return 0;
    }else{
        for(long long int i=2;i<=sqrt(N);i++){
           if(N%i==0){
               if((i-1)+((N/i)-1)<c){
                   c=(i-1)+((N/i)-1);
                   
               }
            }
        }
        cout<<c<<"\n";
        return 0;
    }
    

}

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

#define ioso ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define kholo freopen("input.txt","r",stdin), freopen("output.txt","w",stdout);
#define laglo cerr << "Ti : " << clock() * 1.0 / CLOCKS_PER_SEC  << endl;
#define endl '\n';
#define ll long long

int main() {
	ioso;// kholo;
	ll a, b; cin >> a>> b;
	
	ll k = 0;
	ll ans = -1;
	for(int i=10;i<=999999;i++) {
		ll t1 = floor(i*0.08);
		ll t2 = floor(i*0.1);
		if(t1==a and t2==b) {
			ans = i;k=1; break;
		}
		
	}

	
		cout << ans << endl;
	
	//laglo;
}

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

int main()
{
	int a[5];
	int m = 0, n = 10;

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

	for (int i = 0; i < 5; i++) {
		m += (a[i] + 9) / 10;
		if (a[i] % 10 > 0)
			n = min(n, a[i] % 10);
	}

	if (n == 10)
		cout << m * 10 << endl;
	else
		cout << (m - 1) * 10 + n << endl;

	return 0;
}


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

const int INF = 1e9;

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

    int n, k;
    cin >> n >> k;    
    vector<int> a(n);
    bool dp[k + 1];
    memset(dp, false, sizeof dp);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i <= k; i++) {
        for (int j = 0; j < n; j++) {
            if (i + a[j] <= k) {
                dp[i + a[j]] |= !dp[i];
            }
        }
    }
    if (dp[k])
        cout << "First" << endl;
    else
        cout << "Second" << endl;

	return 0;
}

Measured memory_bytes: 3712
def main():
    N, A = map(int, input().split())
    X = tuple(map(int, input().split()))

    x = [i - A for i in X]
    nx = max(A, max(x)) * N
    dp = [[0] * (2 * nx + 1) for _ in [0] * (N + 1)]
    for i in range(N + 1):
        for j in range(2 * nx + 1):
            if not i:
                if j == nx:
                    dp[i][j] = 1
            elif j - x[i-1] < 0 or j - x[i-1] > 2 * nx:
                dp[i][j] = dp[i-1][j]
            elif 0 <= j - x[i-1] <= 2 * nx:
                dp[i][j] = dp[i-1][j] + dp[i-1][j - x[i-1]]
    print(dp[N][nx] - 1)

main()


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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()
#define vprint(v) for(auto e:v){cout<<e<<" ";};cout<<endl;
#define vvprint(vv) for(auto v:vv)vprint(v);

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(20);

    ll N, A, B, C;
    cin >> N >> A >> B >> C;
    vector<string> s(N);
    rep(i, N) cin >> s[i];

    vector<char> a;
    rep(i, N){
        if(s[i]=="AB"){
            if(A>B || A>=2){
                --A, ++B;
                a.push_back('B');
            }
            else if(A<B){
                ++A, --B;
                a.push_back('A');
            }
            else if(A==0){
                cout << "No" << endl;
                return 0;
            }
            else if(i==N-1) a.push_back('A');
            else{
                string next = s[i+1];
                if(next=="AC" || next=="AB"){
                    ++A, --B;
                    a.push_back('A');
                }
                else{
                    --A, ++B;
                    a.push_back('B');
                }
            }
        }
        else if(s[i]=="BC"){
            if(B>C || B>=2){
                --B, ++C;
                a.push_back('C');
            }
            else if(B<C){
                ++B, --C;
                a.push_back('B');
            }
            else if(B==0){
                cout << "No" << endl;
                return 0;
            }
            else if(i==N-1) a.push_back('B');
            else{
                string next = s[i+1];
                if(next=="AB" || next=="BC"){
                    ++B, --C;
                    a.push_back('B');
                }
                else{
                    --B, ++C;
                    a.push_back('C');
                }
            }
        }
        else {
            if(A>C || A>=2){
                --A, ++C;
                a.push_back('C');
            }
            else if(A<C){
                ++A, --C;
                a.push_back('A');
            }
            else if(A==0){
                cout << "No" << endl;
                return 0;
            }
            else if(i==N-1) a.push_back('A');
            else{
                string next = s[i+1];
                if(next=="AB" || next=="AC"){
                    ++A, --C;
                    a.push_back('A');
                }
                else{
                    --A, ++C;
                    a.push_back('C');
                }
            }
        }
    }
    cout << "Yes" << endl;
    rep(i, N){
        cout << a[i] << endl;
    }
}


Measured memory_bytes: 6692
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <random>
#include <utility>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include <vector>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<int> G[100005];
std::vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
ll i,j,k;
ll n,m;
ll x,y;
ll a,b,c;
ll num=0;

int main(){
	cin>>a>>b>>c>>x>>y;
	if(2*c<a+b)num=2*c;
	else num=a+b;
	ll ans=0;
	ll k = min(x,y);
	ans = k*num + (x-k)*min(a,num)+(y-k)*min(b,num);
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 4992
a1 = list(map(int, input().split()))
a2 = list(map(int, input().split()))
a3 = list(map(int, input().split()))
n = int(input())
for i  in range(n):
  b = int(input())
  if b in a1:
    a1[a1.index(b)] = 0
  elif b in a2:
    a2[a2.index(b)] = 0
  elif b in a3:
    a3[a3.index(b)] = 0

ans = ''
if sum(a1) == 0 or sum(a2) == 0 or sum(a3) == 0:
  ans = 'Yes'
elif a1[0] + a2[0] + a3[0] == 0 or a1[1] + a2[1] + a3[1] == 0 or a1[2] + a2[2] + a3[2] == 0:
  ans = 'Yes'
elif a1[0] + a2[1] + a3[2] == 0 or a1[2] + a2[1] + a3[0] == 0:
  ans = 'Yes'
else:
  ans = 'No'
print(ans)

Measured memory_bytes: 3064
n,m,x,y=map(int,input().split())
s=list(map(int,input().split()))
t=list(map(int,input().split()))
ss=max(s)
tt=min(t)
for i in range(x+1,y+1):
  if ss<i<=tt:
    print("No War")
    exit()
print("War")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<string>> vvs;
typedef vector<vector<char>> vvc;
typedef vector<vector<bool>> vvb;
typedef pair<int,int> P;
typedef pair<ll, ll> Pll;
#define vrep(v,n) for(int i=0;i<n;i++){cin >> v.at(i);} 
#define rep(i, l, n) for (int i = l; i < (int)(n); i++)
#define repn(i, l, n) for (int i = l; i <= (int)(n); i++)
#define pb push_back 
#define sort(v) sort(v.begin(), v.end())
#define sortr(v) sort(v.rbegin(), v.rend())
void chmin(int &a, int b) {if(a > b) a = b;}
void chmax(int &a, int b) {if(a < b) a = b;}

const int mod = 1000000007;
const int inf = 1e9;
#define PI 3.14159265369;
int dx[4] = {1,-1,0,0};
int dy[4] = {0,0,1,-1};


int main(){
    int n;
    cin >> n;
    map<int, int> mp;
    rep(i,0,n){
        int a;
        cin >> a;
        mp[a]++;
        if(mp[a] == 2){
            cout << "NO";
            return 0;
        }
    }
    cout << "YES";
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>


/* 
*    coder :: ATUL_PANDEY_2608
*        >>> INDIA <<<
*/
using namespace std;
using namespace __gnu_pbds;

// #define  part ..
#define pb(a) push_back(a)
#define all(a) a.begin(),a.end() 
#define mod 1000000007
//#define maxx 200006
#define ll long long 
#define quick    ios_base::sync_with_stdio(NULL),cin.tie(0);
#define listll vector< long long > 
#define listi vector< int> 
#define pii   pair<int , int> 
#define pll pair<long long , long long > 
#define minheap priority_queue<long long , vector< long long >, greater<long long > >
#define rep(i,a,b) for(int i=a;i<b;i++)
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}


template < class T > using oset = tree< T , null_type, less  < T  > , rb_tree_tag , tree_order_statistics_node_update > ;


// end of #define 

// define globals ...
const int maxx = 2e5+26;

//write function from here ...







int Main(){



string s;
cin>>s;

ll sum =0 ;

for(auto it: s)
{
	sum+=(it - '0');
	
}

if(sum%9==0)
cout<<"Yes\n";
else
cout<<"No\n";


return 0;

}

















int main(){
 quick;
int t =1; 
//cin>>t;
while(t-- )
 Main();

 return 0;


}


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

int main() {
  string a, b, c;
  cin >> a >> b >> c;
  if ((a.at(a.size() - 1) == b.at(0)) && (b.at(b.size() - 1) == c.at(0))) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <numeric>
#include <array>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long
static const int MAX = 10000;
static const ll INFTY = 1e12;

using Graph = vector<vector<int>>;
// 入力
int H, W;
vector<vector<char>> field;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};


int main() {

    int N;
    cin >> N;
    int ans = 0;
    
    if(N < 10){
        cout << N << endl;
        return 0;
    } 
    if(N < 100){
        cout << 9 << endl;
        return 0;
    } 
    if(N < 1000){
        cout << 9 + (N-100+1) << endl;
        return 0;
    } 
    if(N < 10000){
        cout << 9 + 900 << endl;
        return 0;
    } 
    if(N < 100000){
        cout << 909 + (N-10000+1) << endl;
        return 0;
    } 
    cout << 90909 << endl;
    return 0;


    return 0;
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/

Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll;
#pragma endregion
int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	int N;
	cin >> N;

	cout << (N + 1) / 2 << '\n';
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		try(Scanner input = new Scanner(System.in)){
			int number = Integer.parseInt(input.nextLine());
			String str = input.nextLine();
			solution(number, str);
		}
	}
	public static void solution(int number, String str){
		if (str.length() <= number){
			System.out.println(str);
		}
		else{
			String ans = "";
			for (int i =0; i <number;i++){
				ans+=str.charAt(i);
			}
			ans+="...";
			System.out.println(ans);
		}
		
	}
}


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

int main(){
  int N,M;
  
  cin >> N;
  vector<string> s(N);
  for(int i=0;i<N;i=i+1)cin >> s.at(i);
  
  cin >> M;
  vector<string> t(M);
  for(int i=0;i<M;i=i+1)cin >> t.at(i);
  
  map<string,int> cnt;
  
  for(string x:s){
    if(cnt.count(x)){
      cnt.at(x) = cnt.at(x) + 1;
    }
    else{
      cnt[x] = 1;
    }
  }
  
  for(string x:t){
    if(cnt.count(x)){
      cnt.at(x) = cnt.at(x) - 1;
    }
    else{
      cnt[x] = -1;
    }
  }
  int max_yen = 0;
  for(string x:s){
    max_yen = max(max_yen,cnt.at(x));
  }
  for(string x:t){
    max_yen = max(max_yen,cnt.at(x));
  }
  cout << max_yen << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) FOR(i, 0, (n))
#define FOR(i, a, b) for(ll i=(a); i<(b); i++)
#define LAR(a, b) ((a)=max((a),(b)))
#define SML(a, b) ((a)=min((a),(b)))
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vpii;
typedef pair<int, int> pii;
#define PB push_back
#define EB emplace_back
#ifdef LOCAL_DEBUG
#define DEBUG(...) printf(__VA_ARGS__)
#else
#define DEBUG(...)
#endif

int main(){
	ll a, b; scanf("%lld%lld", &a, &b); b++;
	ll ans = INT_MAX;
	FOR(i, a, min(b, a+2020)){
		FOR(j, i+1, min(b, a+2020)){
			SML(ans, i*j%2019);
		}
	}
	printf("%lld\n", ans);
	return 0;
	int c=a/2019, d=b/2019;
	// int ans;
	if(c!=d){
		ans = 0;
	}else{
		a%=2019, b%=2019;
		b++;
		ans = INT_MAX;
		FOR(i, a, b){
			FOR(j, a+1, b){
				SML(ans, i*j%2019);
			}
		}
	}
	printf("%d\n", ans);
}


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

const int MaxN=1e5+5;

int N,M,K,Cnt0,Cnt1;
int Fa[MaxN],Size[MaxN],Col[MaxN];

vector<int> To[MaxN];

int Get_Fa(int x){
	return x==Fa[x]?x:Fa[x]=Get_Fa(Fa[x]);
}

bool Check(int u){
	int i,v;
	for(i=0;i<To[u].size();i++)
		if(!Col[v=To[u][i]]){
			Col[v]=3-Col[u];
			if(!Check(v))
				return false;
		}
		else if(Col[u]==Col[v])
			return false;
	return true;
}

int main(){
	int i,u,v,r1,r2;
	scanf("%d%d",&N,&M);
	for(i=1;i<=N;i++)
		Fa[i]=i,Size[i]=1;
	while(M--){
		scanf("%d%d",&u,&v);
		To[u].push_back(v);
		To[v].push_back(u);
		if((r1=Get_Fa(u))^(r2=Get_Fa(v)))
			Fa[r1]=r2,Size[r2]+=Size[r1];
	}
	for(i=1;i<=N;i++)
		if(i==Get_Fa(i)){
			if(Size[i]<2)
				K++;
			else{
				Col[i]=1;
				Check(i)?Cnt0++:Cnt1++;
			}
		}
	printf("%lld\n",2ll*K*N-1ll*K*K+2ll*Cnt0*Cnt0+1ll*Cnt1*Cnt1+2ll*Cnt0*Cnt1);
	return 0;
}

Measured memory_bytes: 8064
import java.util.*;
public class Main {
    static PriorityQueue<Long> queue;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        queue = new PriorityQueue<>();
        for(int i = 1; i<10; i++) {
            int depth = 10;
            if(i>=4) depth--;
            queue.add((long)i);
            addRunRun(1 ,i,(long)i, depth);
        }
        for(int i = 0; i<n-1; i++) {
            //System.err.println(queue.peek());
            queue.poll();
        }
        System.out.println(queue.poll());

    }
    public static void addRunRun(int cnt,long total, long i, int depth) {
        if(cnt == depth) return;
        queue.add(total*10+i);
        addRunRun(cnt+1, total*10+i, i, depth);
    
        if(i!=9) {
            queue.add(total*10+i+1);
            addRunRun(cnt+1, total*10+i+1, i+1, depth);
        }
        if(i!=0) {
            queue.add(total*10+i-1);
            addRunRun(cnt+1, total*10+i-1, i-1, depth);
        }
    }
}

Measured memory_bytes: 32476