akhauriyash/Code-Regression huggingface dataset:
/*#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;

long long sum[511111], add[511111];

void push_down(int rt, int l, int r){
    add[rt << 1] += add[rt];
    add[rt << 1|1] += add[rt];
    int mid = (l + r) >> 1;
    sum[rt << 1] += (mid - l + 1) * add[rt];
    sum[rt << 1|1] += (r - mid) * add[rt];
    add[rt] = 0;
    return;
}

void update(int rt, int l, int r, int L, int R, int val){
    if(L <= l && R >= r){
        add[rt] += val;
        sum[rt] += (r - l + 1) * val;
        return;
    }
    if(add[rt]) push_down(rt, l, r);
    int mid = (l + r) >> 1;
    if(L <= mid){
        update(rt << 1, l, mid, L, R, val);
    }
    if(R > mid){
        update(rt << 1|1, mid + 1, r, L, R, val);
    }
    sum[rt] = sum[rt << 1] + sum[rt << 1|1];
    return;
}

long long query(int rt, int l, int r, int L, int R){
    if(L <= l && R >= r){
        return sum[rt];
    }
    int mid = (l + r) >> 1;
    if(add[rt]) push_down(rt, l, r);
    long long ans = 0;
    if(mid >= L){
        ans += query(rt << 1, l, mid, L, R);
    }
    if(R > mid){
        ans += query(rt << 1|1, mid + 1, r, L, R);
    }
    return ans;
}

int main(int argc,char *argv[])
{
    int n, m;
    while(scanf("%d%d", &n, &m) != EOF){
        memset(sum, 0, sizeof sum);
        memset(add, 0, sizeof add);
        for(int i = 1; i <= n; i++){
            int x;
            scanf("%d", &x);
            update(1, 1, n, i, i, x);
        }
        for(int i = 0; i < m; i++){
            char str[10];
            scanf("%s", str);
            if(str[0] == 'Q'){
                int l, r;
                scanf("%d%d", &l, &r);
                printf("%lld\n", query(1, 1, n, l, r));
            }
            else{
                int l, r, val;
                scanf("%d%d%d", &l, &r, &val);
                update(1, 1, n, l, r, val);
            }
        }
    }
}*/

#include<stdio.h>
#include<algorithm>
#include<string.h>

using namespace std;
int main(){
    char a[11111];
    while(scanf("%s", a)!=EOF){
        int len = strlen(a);
        printf("%c%d%c\n",a[0], len - 2, a[len - 1]);
    }
}

Measured memory_bytes: 128
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String s = sc.next();
		int k = sc.nextInt();
		char a= s.charAt(k-1);
		StringBuilder aa = new StringBuilder();
		aa.append(s);
		sc.close();
	for(int i =0; i<n; i++) {
    if(s.charAt(i)!=a)
    	aa.setCharAt(i, '*');
	}
	String ans = aa.toString();

	System.out.println(ans);

	}

}


Measured memory_bytes: 22740
#include <iostream> 
#include <sstream> 
#include <fstream> 
#include <string> 
#include <vector> 
#include <deque> 
#include <queue> 
#include <stack> 
#include <set> 
#include <map> 
#include <algorithm> 
#include <functional> 
#include <utility> 
#include <bitset> 
#include <cmath> 
#include <cstdlib> 
#include <ctime> 
#include <cstdio> 
using namespace std;

int main(){
	int n,m;
	cin>>n>>m;
	if(n-m>1||m-n>1) cout<<0<<endl;
	else if(n==m){
		long long ans=1;
		for(int i=1;i<=n;i++) ans=(ans*(n+1-i))%(1000000000+7);
		ans=(2*ans*ans)%(1000000000+7);
		cout<<ans<<endl;
	}
	else{
		long long ans=1;
		for(int i=1;i<=min(m,n);i++) ans=(ans*(min(m,n)+1-i))%(1000000000+7);
		for(int i=1;i<=max(m,n);i++) ans=(ans*(max(m,n)+1-i))%(1000000000+7);
		cout<<ans<<endl;
	}
return 0;
} 

Measured memory_bytes: 256
# S,Tのアルファベットが一対一で痴漢出来れば良い
import sys 
stdin = sys.stdin
ns = lambda : stdin.readline().rstrip()
 
s = ns()
t = ns()

s_cnt = []
t_cnt = []

for alp in "abcdefghijklmnopqrstuvwxyz":
  s_cnt.append(s.count(alp))
  t_cnt.append(t.count(alp))

s_cnt.sort()
t_cnt.sort()

if s_cnt == t_cnt:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 3632
#include<iostream>
#include<cstdio>
#include<queue>
#include<algorithm>

#define MAX 10000

using namespace std;

int n;
int unvisited=0,visited=1,comp_visited=2;
int INFTY=(1<<20);
vector<pair<int,int> > adj[MAX];

void dijkstra(){
	priority_queue<pair<int,int> > PQ;
	int state[MAX];
	int d[MAX];
	for(int i=0;i<n;i++){
		d[i]=INFTY;
		state[i]=unvisited;
	}
	d[0]=0;
	PQ.push(make_pair(0,0));
	state[0]=visited;
	while(!PQ.empty()){
		pair<int,int> f = PQ.top(); PQ.pop();
		int u=f.second;
		state[u]=comp_visited;
		
		//????°??????????????????????, ?????????????????§???????????°????????????.
		if(d[u]<f.first*(-1)) continue;
		
		for(int j=0;j<adj[u].size();j++){
			int v=adj[u][j].first;
			if(state[v]==comp_visited) continue;
			if(d[v] > d[u]+adj[u][j].second){
				d[v]=d[u]+adj[u][j].second;
				PQ.push(make_pair(d[v]*(-1),v));
				state[v]=visited;
			}
		}
	}
	for(int	i=0;i<n;i++){
		printf("%d %d\n",i,(d[i]==INFTY ? -1:d[i]));
	}
}

int main(){
	int k,u,v,c;
	
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d %d",&u,&k);
		for(int j=0;j<k;j++){
			scanf("%d %d",&v,&c);
			adj[u].push_back(make_pair(v,c));
		}
	}
	dijkstra();
}

Measured memory_bytes: 8028
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int a[200001],b[200001];
int b_m[200001];

int main(void){
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	for(int i=0;i<n;i++){
		scanf("%d",&b[i]);
	}
	int ans=0;
	for(int i=0;i<29;i++){
		for(int j=0;j<n;j++){
			b_m[j]=b[j]%(1<<(i+1));
		}
		sort(b_m,b_m+n);
		ll cnt=0;
		for(int j=0;j<n;j++){
			int ga=a[j]%(1<<(i+1));
			int v=lower_bound(b_m,b_m+n,(1<<i)-ga)-b_m;
			int v2=lower_bound(b_m,b_m+n,(1<<i)*2-ga)-b_m;
			cnt+=(ll)v2-v;
			v=lower_bound(b_m,b_m+n,(1<<i)*3-ga)-b_m;
			v2=lower_bound(b_m,b_m+n,(1<<i)*4-ga)-b_m;
			cnt+=(ll)v2-v;
		}
		if(cnt%2==1){
			ans+=1<<i;
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

using ll=long long;
int main(){
    ll a,b;
    cin>>a>>b;
    if(a==b){
        cout<<1<<endl;
        return 0;
    }
    for(int i=62;i>=0;i--){
        if(((a>>i)&1)!=((b>>i)&1)){
            ll res=(1LL<<i)-a;
            int mbit=0;
            for(int j=0;j<i;j++){
                if((b>>j)&1) mbit=j+1;
            }
            if((1LL<<mbit)>=a){
                res+=(1LL<<i);
            }
            else{
                res+=(1LL<<mbit)+(1LL<<i)-a;
            }
            cout<<res<<endl;
            return 0;            
        }
        else{
            if((a>>i)&1){
                a-=1LL<<i;
                b-=1LL<<i;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        long K = sc.nextLong();
        long a = N % K;
        long b = Math.abs(N % K - K);
        System.out.println(Math.min(a, b));
    }
}


Measured memory_bytes: 21076
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
// #include <numeric>
#include <complex>

#define FAST ios_base::sync_with_stdio(false); cin.tie(0)
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define repr(i, a, b) for(int i=int(a); i>=int(b); i--)
#define reps(i,n) for(int i=1;i<=int(n);++i)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define iceil(x,y) (x+y-1)/y
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define all(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

int gcd(int a,int b){return b?gcd(b,a%b):a;}

using namespace std;
typedef long long int ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<int, PII> PP;

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

int main()
{
	FAST;

	int n;
	cin >> n;
	if (n==1) cout << "Hello World\n";
	else {
		int a,b;
		cin >> a >> b;
		cout << a+b <<"\n";
	}

	return 0;
}

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

const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<string, vector<string>, greater<string> > PQ_ASK;

#include <iostream>
#include <vector>

using namespace std;

void warshall_floyd(int n, vector<vector<ll>> &distances) {
    for (int k = 0; k < n; k++) {       // 経由する頂点
        for (int i = 0; i < n; i++) {    // 始点
            for (int j = 0; j < n; j++) {  // 終点
                if (distances[i][j] == INF && (distances[i][k] == INF || distances[k][j] == INF)) {
                    distances[i][j] = INF;
                } else {
                    distances[i][j] = min(distances[i][j], distances[i][k] + distances[k][j]);
                }
            }
        }
    }
}


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

    vector<vector<bool>> has_edges(n, vector<bool>(n));
    rep(i, n) rep(j, n) {
            char c;
            cin >> c;
            has_edges[i][j] = c == '1';
        }

    vector<vector<ll>> distance(n, vector<ll>(n, INF));
    rep(i, n) distance[i][i] = 0;
    rep(i, n)rep(j, n) if (has_edges[i][j]) distance[i][j] = true;

    warshall_floyd(n, distance);

    rep(i, n) {
        vector<set<int>> v(n);
        rep(j, n) {
            int d = distance[i][j];
            v[d].insert(j);
        }
        rep(j, n) {
            for (ll k : v[j]) {
                for (ll l : v[j]) {
                    if (k == l) continue;
                    if (has_edges[k][l]) {
                        cout << -1 << endl;
                        ret();
                    }
                }
            }
        }
    }

    ll ans = -1;
    rep(i, n)rep(j, n) cmax(ans, distance[i][j] + 1);
    cout << ans << endl;

}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<queue>
#include<cstring>
#include<utility>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<bitset>
#include<deque>
#include<cctype>
using namespace std;
int main()
{
    int n,k;
    int a[50+7];
    scanf("%d%d",&n,&k);
    int sum=0;
    for(int i=0;i<n;i++)
        scanf("%d",&a[i]);
    sort(a,a+n);
    for(int i=n-1;n-i<=k;i--)
        sum+=a[i];    
    printf("%d",sum);
    return 0;
 }

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

int main() {
  int n, i, count = 0;
  cin >> n;
  
  vector<int> a(n);
  for(i = 0; i < n; i++){
    cin >> a.at(i);
    if(a.at(i) % 2 == 1){
      count++;
    }
  }
  
  if(count % 2 == 0){
    cout << "YES" << endl;
  }
  else{
    cout << "NO" << endl;
  }
}


Measured memory_bytes: 768
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL n;
    cin>>n;
    VL a(n);
    REP(i,n)cin>>a[i];
    string ans = "YES";
    SORT(a);
    REP(i,n-1){
        if(a[i] == a[i+1]){
            ans = "NO";
            break;
        }
    }
    PUTS(ans);
}

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

const int TOP = 0,FRONT = 1,LEFT = 3, RIGHT = 2,BACK = 4,BOTTOM = 5;
class Dice{
public:
  vector<int> val;
  Dice():val(6){for(int i=0;i<6;i++) val[i] = i;}
  Dice(int val[6]){for(int i=0;i<6;i++) this->val[i] = val[i];}
  Dice(vector<int> val):val(val){assert(val.size() == 6);}
  int& operator [](int a){return val[a];}
  
  void rot(string s){
    if(s == "N" || s == "B") rotN();
    else if(s == "S" || s == "F") rotS();
    else if(s == "E" || s == "R") rotE();
    else if(s == "W" || s == "L") rotW();
    else if(s == "CW") rotCW();
    else if(s == "CCW") rotCCW();
    else assert(!"rot error"); /*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
  }

  
  void rot(char ch){rot(string(1,ch));}
  
  //奥に転がす
  void rotN(){
    swap(val[TOP],val[FRONT]);
    swap(val[FRONT],val[BOTTOM]);
    swap(val[BOTTOM],val[BACK]);
  }

  //手前に転がす
  void rotS(){
    //rotN(),rotN(),rotN();
    swap(val[TOP],val[BACK]);
    swap(val[BACK],val[BOTTOM]);
    swap(val[BOTTOM],val[FRONT]);
  }
  
  //右に転がす
  void rotE(){
    swap(val[TOP],val[LEFT]);
    swap(val[LEFT],val[BOTTOM]);
    swap(val[BOTTOM],val[RIGHT]);
  }

  //左に転がす
  void rotW(){
    //rotE(),rotE(),rotE();
    swap(val[TOP],val[RIGHT]);
    swap(val[RIGHT],val[BOTTOM]);
    swap(val[BOTTOM],val[LEFT]);
  }

  //上から見て時計回りに回す
  void rotCW(){
    swap(val[FRONT],val[RIGHT]);
    swap(val[RIGHT],val[BACK]);
    swap(val[BACK],val[LEFT]);
  }

  //上からみて反時計回りに回す。
  void rotCCW(){
    //rotCW(),rotCW(),rotCW();
    swap(val[FRONT],val[LEFT]);
    swap(val[LEFT],val[BACK]);
    swap(val[BACK],val[RIGHT]);
  }

  void init(int top,int front){
    for(int i=0;i<6;i++){
      for(int j=0;j<4;j++){
        if(val[TOP] == top && val[FRONT] == front) return;
        rotCW();
      }
      i%2? rotN():rotE();
    }
    assert(!"can not find");
  }
};

int main(){
  Dice D;
  for(int i=0;i<6;i++) cin>>D[i];
  
  int q;
  cin>>q;
  while(q--) {
    int top,front;
    cin>>top>>front;
    D.init(top,front);
    cout<<D[RIGHT]<<endl;
  }
  return 0;
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long long mod = 1000000007;
    long long N; cin >> N;
    //全部で何通りか
    long long tmp1 = 1;
    for(int i = 0; i < N; i++){
        tmp1 *= 10;
        tmp1 %= mod;
    }

    //0or9が出ない組み合わせの数
    long long tmp2 = 1;
    for(int i = 0; i < N; i++){
        tmp2 *= 9;
        tmp2 %= mod;
    }

    //0も9も出ない組み合わせの数
    long long tmp3 = 1;
    for(int i = 0; i < N; i++){
        tmp3 *= 8;
        tmp3 %= mod;
    }

    long long a = tmp1;
    long long b = tmp2 * 2 % mod;
    long long c = tmp3;
    long long d = b - c;
    if(d < 0) d += mod;
    long long ans = a - d;
    if(ans < 0) ans += mod;
    cout << ans << endl;
}

Measured memory_bytes: 3596
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define _GLIBCXX_DEBUG
#define INF 100000010
 #define PI 3.14159265359

using namespace std;
const int mod = 1000000007;
const int tmpMod = 998244353;

int main() {
 
  int64_t N,M,K;
  cin>>N>>M>>K;
  vector<int64_t> A(N),B(M),a(N,0),b(M,0);
  int ap=0,bp=0,ans=-1,amax=-10,bmax=-10;
  for(int i=0; i<N; i++){
    cin>>A[i];
    if(i==0)a[i]=A[i];
    if(i!=0)a[i]=a[i-1]+A[i];
    // if(i==0 && A[i])
    if(amax==-10 && a[i]>K)amax=i-1;
    if(i==N-1&&amax==-10)amax=N-1;
  }
  for(int i=0; i<M; i++){
    cin>>B[i];
    if(i==0)b[i]=B[i];
    if(i!=0)b[i]=b[i-1]+B[i];
    if(bmax==-10 && b[i]>K)bmax=i-1;
    if(i==M-1&&bmax==-10)bmax=M-1;
    
  }
  ans=max(amax+1,bmax+1);
  //   cout << amax << endl;
  // cout << bmax << endl;
  while(true){
    if(amax==-1 && bmax==-1){ans=0;break;}
    if(a[ap]+b[bmax] <= K){
     ans=max(ans,ap+1+bmax+1);
      if(ap<N-1)ap++;
      else if(ap==N-1)break;
    }
    else if(bmax>0)bmax--;
    else if(bmax==0)break;
  }
  while(true){
    if(amax==-1 && bmax==-1){ans=0;break;}
    if(a[amax]+b[bp] <= K){
     ans=max(ans,bp+1+amax+1);
      if(bp<M-1)bp++;
      else if(bp==M-1)break;
    }
    else if(amax>0)amax--;
    else if(amax==0)break;
  }
  //vector<vector<int> > A(N,vector<int>(M));
  //for(int i=0; i<N; i++){for(int j=0; j<M; j++){cin>>A[i][j];}}
  //sort(A.begin(),A.end());
  //for (int i = 0; i < N; i++) { maximum = max(maximum , A[i]);}
  //for (int i = 0; i < N; i++) { minimum = min(minimum , A[i]);}
  cout << ans << endl;

}


Measured memory_bytes: 9572
N, M = map(int, input().split())
L = []
R = []
for i in range(M):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)

if min(R) < max(L):
    print(0)
else:
    print(min(R) - max(L) + 1)

Measured memory_bytes: 11020
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define OP ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair<int, int> pii;
const int inf = int(1e9);
const int mod = inf + 7;
const double PI = acos(-1.0);
using namespace std;
const int N = 1e5 + 155;
template<typename T>
inline void read(T&x){
    x=0;int f=1;char ch = getchar();
    while(ch<'0' ||ch>'9'){ if(ch=='-')f=-1;ch=getchar(); }
    while(ch>='0' && ch<='9'){ x=x*10+ch-'0'; ch=getchar(); }
    x*=f;
}
 
 
ll bp(ll a, ll n){
	ll r = 1;
	while(n){
		if(n & 1) r = (r * a) % mod;
		a = (a * a) % mod;
		n >>= 1;
	}
	return r;
}

 
void solve(){
	string s;
	cin >> s;
	unordered_map<char, int> m;
	for(char c: s) m[c]++;
	for(auto it: m) {
		if (it.second % 2) {
			cout << "No";
			return;
		}
	}
	cout << "Yes";
}

int main(){
    OP
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int t = 1;
	//cin >> t;
    for(int i = 1; i <= t; i++) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n;
	int p;
	int d1, d2;
	int num, max;
	int i;
	
	while (1){
		scanf("%d", &n);
		
		if (n == 0){
			break;
		}
		num = 0;
		max = 0;
		
		for (i = 0; i < n; i++){
			scanf("%d %d %d", &p, &d1, &d2);
			
			if (max < d1 + d2){
				num = p;
				max = d1 + d2;
			}
		}
		printf("%d %d\n", num, max);
	}
	
	return (0);
}

Measured memory_bytes: 600
for line in open(0).readlines():
    N = int(line)
    lim = min(9, N)
    ans = 0
    if 0 <= N <= 36:
        for a in range(0, lim+1):
            for b in range(0, lim+1):
                for c in range(0, lim+1):
                    d = N - a - b - c
                    if 0 <= d <= lim:
                        ans += 1
    print(ans)



Measured memory_bytes: 5592
N = int(input())
xys = []
for i in range(N):
    A = int(input())
    xy = []
    for _ in range(A):
        x, y = map(int, input().split())
        xy.append((x, y))
    xys.append(xy)

ans = 0
for i in range(2**N):
    temp_ans = 0
    network = [0] * N
    for j in range(N):
        if (i >> j) & 1:
            temp_ans += 1
            network[j] = 1
    for hito in range(N):
        flg = False
        if network[hito] == 1:
            for x, y in xys[hito]:
                if network[x - 1] != y:
                    flg = True
                    break
            if flg:
                break
    else:
        # print(ans, temp_ans, i)
        ans = max(ans, temp_ans)
print(ans)


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


void solve(long long N, std::vector<std::string> S){

  vector<long long> counter(5, 0);

  for(auto i=0;i<N;++i){
    if(S[i][0]=='M')counter[0]++;
    else if(S[i][0]=='A')counter[1]++;
    else if(S[i][0]=='R')counter[2]++;
    else if(S[i][0]=='C')counter[3]++;
    else if(S[i][0]=='H')counter[4]++;
  }

  long long ans=0;
  for(auto i=0;i<5;++i){
    for(auto j=i+1;j<5;++j){
      for(auto k=j+1;k<5;++k){
        ans += counter[i]*counter[j]*counter[k];
      }
    }
  }
  cout<<ans<<endl;
}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
  long long N;
  scanf("%lld",&N);
  std::vector<std::string> S(N);
  for(int i = 0 ; i < N ; i++){
    std::cin >> S[i];
  }
  solve(N, std::move(S));
  return 0;
}


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

int main(){
	int n,a,b;
	cin >> n >> a >> b;

	if(n*a < b) cout << n*a << endl;
	else cout << b << endl;

	return 0; 
}

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

int main(){
  int h,w;
  cin>>h>>w;
  
  vector<vector<char>>c(w,vector<char>(h));
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      cin>>c.at(j).at(i);
    }
  }
  
  for(int i=0;i<h;i++){
    for(int j=0;j<2;j++){
      for(int k=0;k<w;k++){
        cout<<c.at(k).at(i);
      }
  	  cout<<endl;
    }
  }
  
  return 0;
}

Measured memory_bytes: 3648
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define EPS 1e-9
#define MOD	1000000007
#define int	long long
#define sz(x) (int)x.size()
#define all(a) (a).begin(),(a).end()
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;


#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << "[" << *it << " = " << a << "]" << " ";
	err(++it, args...);
}


int32_t main(){
	int n;
	cin >> n;
	vector<pii> v(n);
	for(int i = 0; i < n; i++)
		cin >> v[i].F >> v[i].S;
	
	sort(v.begin(),v.end(),[&](pii a, pii b){
		return a.S < b.S;
	});
	
	int temp = 0;
	for(int i = 0; i < n; i++){
		if(temp + v[i].F > v[i].S){
			cout << "No";
			return 0;
		}
		temp += v[i].F;
	}
	cout << "Yes";

	return 0;
}



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

using ll = long long;

ll a[100010];

int main(void){
    // Here your code !
    
    ll n;
    cin >> n;
    
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    
    ll res = 1,dassyutu = 0;
    
    for(int i = 0; i < n; i++){
        
        //cout << res << " " << a[i] << " " << 2*(i-dassyutu)+1 << endl;
        
        if(a[i] >= 2*(i-dassyutu)+1){
            
        }else{
            res *= i-dassyutu+1;
            dassyutu++;
            res %= 1000000007;
        }
        
    }
    
    //cout << res << endl;

    for(int i = 1; i <= n-dassyutu; i++){
        res *= i;
        res %= 1000000007;
    }
    
    cout << res << endl;
    
}


Measured memory_bytes: 1024
import java.util.*;

public class Main {
	public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int mochiCount = sc.nextInt();
        Map<Integer, Integer> mochiMap = new TreeMap<>(Comparator.reverseOrder());
        for (int i = 0; i < mochiCount; i++) {
            int mochi = sc.nextInt();
            if (mochiMap.containsKey(mochi)) {
                mochiMap.put(mochi, (mochiMap.get(mochi) + 1));
            } else {
                mochiMap.put(mochi, 1);
            }
        }
        
        int result = 0;
        for(Integer mochiKey : mochiMap.keySet()) {
            result++;
        }
        System.out.println(result);
    }
}


Measured memory_bytes: 23252
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] cumsum = new long[n + 1];
        for (int i = 0; i < n; i++) {
            int num = sc.nextInt();
            cumsum[i + 1] = cumsum[i] + num; 
        }
        
        long sum = cumsum[n];
        long min = Long.MAX_VALUE;
        for (int i = 1; i < n; i++) {
            min = Math.min(min, Math.abs((sum - cumsum[i]) - cumsum[i]));
        }
        
        System.out.println(min);
    }
}


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

int main(){
    int N, M;
    
    cin >> N >> M;

    int s[M];
    int c[M];

    for (int i = 0; i < M; ++i ){
        cin >> s[i] >> c[i];
    }

    if(N==1){
        int counter = 0;
        int answer = -1;
        if(M==0){
            cout << 0 << endl;
            return 0;
        }
        if(M > 1){
            cout << -1 << endl;
            return 0;
        }
        for(int i=0; i < M; ++i){
            if(s[i]==1 && counter == 0){
                answer=c[i];
                ++counter;
            }
        }
        cout << answer << endl;
        return 0;
    }else{
        int answer[N];
        int checker[N];
        for(int i = 0; i< N; ++i){
            answer[i] = 0;
            checker[i] = 0;
        }
        answer[0] = 1;
        
        for(int i=0; i < M; ++i){
            int index = s[i]-1;
            if(s[i] == 1 && c[i] == 0){
                cout << -1 << endl;
                return 0;
            }
            if(checker[index] == 0 || checker[index] == c[i]){
                answer[index] = c[i];
                checker[index] = c[i];
            }else{
                cout << -1 << endl;
                return 0;
            }
        }
        // cout << "checker: " << checker << endl;
        // cout << "answer: " << answer << endl;
        for(int i = 0; i < N; ++i){
            cout << answer[i];
        }
        cout << endl;
        return 0;
    }

}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int n,i,j,tmp,flag,count=0;
    int A[100];

    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
       scanf("%d",&A[i]); 
    }

    
 for(i=0;i<n;i++)
 {
    for(j=n-1;j>i;j--)
    {
        if(A[j] < A[j-1])
        {
            tmp = A[j-1];
            A[j-1] = A[j];
            A[j] = tmp;
            
            count++;
        }
    }
  }

    for(i=0;i<n;i++)
    {
        if(i>0)printf(" ");
        printf("%d",A[i]);
    }
    printf("\n%d\n",count);

}


Measured memory_bytes: 2124
import java.util.*;
import java.lang.*;


public class Main {
	static int h;
	static int w;
	static char[][] masu;
	static long black;
	static long white;
	static boolean[][] used;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		h = sc.nextInt();
		w = sc.nextInt();
		masu = new char[h + 2][w + 2];
		for (int i = 0; i < w + 2; i++) {
			masu[0][i] = 'n';
			masu[h + 1][i] = 'n';
		}
		for (int i = 0; i < h + 2; i++) {
			masu[i][0] = 'n';
			masu[i][w + 1] = 'n';
		}
		for (int i = 1; i <= h; i++) {
			String tmp = sc.next();
			for (int j = 1; j <= w; j++) {
				masu[i][j] = tmp.charAt(j - 1);
			}
		}
		used = new boolean[h + 2][w + 2];
		long count = 0;
		for (int i = 1; i <= h; i++) {
			for (int j = 1; j <= w; j++) {
				if (masu[i][j] == '#' && !used[i][j]) {
					black = 0;
					white = 0;
					dfs(i, j);
					count += black * white;
				}
			}
		}
		System.out.println(count);
	}
	static void dfs(int i, int j) {
		used[i][j] = true;
		if (masu[i][j] == '#') {
			black++;
		} else if (masu[i][j] == '.') {
			white++;
		} else {
			return;
		}
		int[] dih = {-1, 0, 1, 0};
		int[] diw = {0, -1, 0, 1};
		for (int k = 0; k < 4; k++) {
			if (masu[i + dih[k]][j + diw[k]] != masu[i][j] && !used[i + dih[k]][j + diw[k]]) {
				dfs(i + dih[k], j + diw[k]);
			}
		}
	}
}

Measured memory_bytes: 53756
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str1 = sc.next();
		String str2 = sc.next();
		int a = 0;
		for(int i = 0; i < 3 ; i++) {
			if(str1.charAt(i) == str2.charAt(2-i)) {
				a += 1;
			}else {
				a += 0;
			}
		}
		if(a == 3){
			System.out.println("YES");
		}else{
			System.out.println("NO");
		}

	}

}


Measured memory_bytes: 21844
n=int(input())
w=list(map(int,input().split()))
S=sum(w)
diff=abs(S)
index=0
buf=0
for i in range(n):
    buf+=w[i]
    S-=w[i]
    if diff>abs(buf-S):
        diff=abs(buf-S)
print(diff)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 


int main() {
	ll l,r,ans=INF;
	cin>>l>>r;
	r=min(r,l+2019);
	for(ll i=l;i<r;i++){
		ll sum=0;
		for(ll j=i+1;j<=r;j++){
			sum=(i*j)%2019;
			ans=min(ans,sum);
		}
	}
	cout <<ans;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int t = Integer.parseInt(bf.readLine());
 		if (t%2 == 0 || t%5 == 0)
 			out.println(-1);
 		else{
 			long prod = 1;
 			
 			long sum = 0;
 			int i = 1;
 			for(i = 1;i<=1000000;i++){
 				sum+=(7*prod)%t;
 				sum%= t;
 				if (sum%t == 0)
 					break;
 				prod = prod*10;
 				prod%=t;
 			}
 			
 			out.println(i);
 		}
 		
 		
 		out.println();
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
 
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




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

#############
# Libraries #
#############

import sys
input = sys.stdin.readline

import math
from collections import deque
from fractions import gcd
from functools import lru_cache


#############
# Constants #
#############

MOD = 10**9+7
INF = float('inf')

#############
# Functions #
#############

######INPUT######
def inputI(): return int(input().strip())
def inputS(): return input().strip()
def inputIL(): return list(map(int,input().split()))
def inputSL(): return list(map(str,input().split()))
def inputILs(n): return list(int(input()) for _ in range(n))
def inputSLs(n): return list(input().strip() for _ in range(n))
def inputILL(n): return [list(map(int, input().split())) for _ in range(n)]
def inputSLL(n): return [list(map(str, input().split())) for _ in range(n)]

#####Inverse#####
def inv(n): return pow(n, MOD-2, MOD)

######Combination######
kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

######Factorization######
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])
    return arr

#####LCM#####
def lcm(a, b):
    return a * b // gcd (a, b)

#############
# Main Code #
#############

N = inputS()

if N[0]=="7" or N[1]=="7" or N[2]=="7":
  print("Yes")
else:
  print("No")

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

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;

const long long INF = 1LL << 60;

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

int main()
{
    ll N, K;
    cin >> N >> K;

    vector<ll> A(N);

    rep(i, N) cin >> A[i];

    ll gcd_m = INF;
    ll max_n = A[0];
    repd(i, 1, N) {
        max_n = max(max_n, A[i]);
        gcd_m = min(gcd_m, gcd(A[i - 1], A[i]));
    }

    bool flag = false;

    if (K > max_n) {
        cout << "IMPOSSIBLE" << endl;
    }
    else {
        rep(i, N) {
            if (A[i] % gcd_m == K % gcd_m) {
                flag = true;
                break;
            }
        }
        if (flag) {
            cout << "POSSIBLE" << endl;
        }
        else {
            cout << "IMPOSSIBLE" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdlib>

using namespace std;

struct Node
{
    Node *parent;
    Node *left;
    Node *right;
    int key;
};

const int MAX = 500000;

void insert(Node **root, int num)
{
    Node *newNode = (Node *)malloc(sizeof(Node));

    newNode->key = num;
    newNode->left = newNode->right = NULL;

    Node *targetParent = NULL;
    for (Node *x = *root; x != NULL; )
    {
        targetParent = x;
        x = (newNode->key < x->key) ? x->left : x->right;
    }

    newNode->parent = targetParent;
    // データがまだない場合は、今回作成したノードを根にする
    if (targetParent == NULL)
        *root = newNode;
    else
    {
        if (newNode->key < targetParent->key)
            targetParent->left = newNode;
        else
            targetParent->right = newNode;
    }
}

void inorder(Node *u)
{
    if (u == NULL) return;
    inorder(u->left);
    cout << " " << (u->key);
    inorder(u->right);
}
void preorder(Node *u)
{
    if (u == NULL) return;
    cout << " " << (u->key);
    preorder(u->left);
    preorder(u->right);
}

void freedive(Node *u)
{
    if (u == NULL) return;
    if (u->left != NULL) freedive(u->left);
    if (u->right != NULL) freedive(u->right);
    free(u);
}

int main(int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    Node *root = NULL;

    int n;
    cin >> n;
    cin.ignore();

    for (int i = 0; i < n; i++)
    {
        string line;
        getline(cin, line); // 改行が現れるまで読む。改行はスキップ

        const string TARGET("insert ");

        if (line.find(TARGET) != string::npos)
        {
            int num =  std::atoi(line.substr(TARGET.size()).c_str());
            insert(&root, num);
        }
        else
        {
            inorder(root);
            cout << endl;
            preorder(root);
            cout << endl;
        }
    }

    freedive(root);

    return 0;
}


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

#define ll long long
#define ld long double
#define ull unsigned long long

#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"

using namespace std;

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

    int N, M;
    cin >> N >> M;
    vector<pair<int, int>> students(N), checkpoints(M);

    for (auto &x : students)
        cin >> x.first >> x.second;

    for (auto &x : checkpoints)
        cin >> x.first >> x.second;

    for (auto x : students)
    {
        int min_dist = INT_MAX, min_index = 0;
        int index = 0;
        for (auto y : checkpoints)
        {
            ++index;
            int dist = abs(x.first - y.first) + abs(x.second - y.second);
            if (min_dist > dist)
            {
                min_dist = dist;
                min_index = index;
            }
        }
        cout << min_index << '\n';
    }

    return 0;
}

Measured memory_bytes: 256
n = int(input())
data = list(map(int, input().split()))

resp = 0
for var1 in range(0,len(data)):
	for var2 in range(0,len(data)):
		if var1 == var2:
			pass
		else:
			resp = resp + data[var1]*data[var2]

resp = resp/2



print(int(resp))

Measured memory_bytes: 3060
#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
using namespace std;
using namespace __gnu_pbds;

#define TRACE

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

#define lsc(x)      scanf("%lld",&x)
#define sc(x)       scanf("%d",&x)
#define lpr(x)      printf("%lld ",(long long)x)
#define pr(x)       printf("%d ",x)
#define n_l         printf("\n")
#define VI          vector<int>
#define VII         vector<long long int>
#define m_p         make_pair
#define pb          push_back
#define fi           first
#define se           second
#define mset(x,y)   memset(x,y,sizeof(x))
#define sz(v)       (int)v.size()
#define all(v)      v.begin(), v.end()
#define fr(i, a, n) for(int i=a;i<=n;i++)
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
mt19937 rng32(chrono::steady_clock::now().time_since_epoch().count());
const int N=(int)1e6+5;
const int mod = 1000000007;
typedef long long ll;
// order_of_key (val): returns the no. of values strictly less than val
// find_by_order (k): returns the kth largest element iterator.(0-based)
// vector<int>::iterator itr=lower_bound(v.begin(),v.end(),x);
// s.substr(pos[0-indexed], len(default=till end))
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

ll fmod(ll x){if (x<mod) return x;return x%mod;}
ll mul(ll a, ll b, ll c){
	ll ret=0;while(b){if (b%2) ret=(ret+a)%c;a=(a*2)%c;b>>=1;}
    return ret;
}
int modpow(ll a, ll b){
    ll ret=1;while(b){if (b%2) ret=(ret*a)%mod;a=(a*a)%mod;b>>=1;}
    return (int)ret;
}
inline int inv(int x){ return modpow(x, mod-2);}
int isprime[N];
void calc_prime(){
	isprime[1]=1;for(ll i=2;i<N;i++) if (!isprime[i]) for(ll j=i*i;j<N;j+=i) isprime[j]=1;
}
int main(){
    string s, t;cin>>s>>t;
    int ans = t.length();
    int slen = sz(s);
    int tlen = sz(t);
    fr(i, 0, slen-tlen){
        
        int tmp = 0;
        fr(j, i, i+tlen-1){
            tmp += (t[j-i]!=s[j]);
        }
        ans = min(ans, tmp);
    }
    pr(ans);n_l;
    return 0;
}



Measured memory_bytes: 3732
#include<iostream>
#include<vector>
#include<algorithm>
#include<stdlib.h>
#include<utility>
#include<functional>
#include<cfenv>
#include<cmath>
#include<string>
#include<queue>
#include<stack>
#include<map>
#include<set>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define vint vector<ll>
#define vvint vector<vint>
#define P pair<ll,ll>
#define INT_MAX 2147483647
#define MOD 998244353
#define PI 3.14159265358979323846
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;

#define MAX 1000000000000

int main(void) {
	string s;
	cin >> s;
	int ans=0;
	rep(i, s.size()) {
		ans += s[i] - '0';
	}
	if (ans % 9 == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}


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

int main()
{
	string S, T;
	cin >> S >> T;

	int N = S.size();
	map<char, char> mp;
	map<char, char> mp1;
	string ans = "Yes";
	for( int i = 0; i < N; i++ ) {
		if( mp.count( S[i] ) ) {
			if( mp[ S[i] ] != T[i] ) {
				ans = "No";
				break;
			}
		}
		else mp[ S[i] ] = T[i];
		if( mp1.count( T[i] ) ) {
			if( mp1[ T[i] ] != S[i] ) {
				ans = "No";
				break;
			}
		}
		else mp1[ T[i] ] = S[i];
	}

	cout << ans << endl;
}


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

#define FAST_IO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long
#define FOR(i,l,r) for(long long i=l; i<r; i++)
#define FOR_REV(i,r,l) for(long long i=r; i>=l; i--)
#define pb push_back
#define mp make_pair

ll power(ll x, ll y) 
{ 
    ll res = 1;
   
    while (y > 0) 
    { 
        if (y & 1) 
            res = res*x; 
   
        y = y>>1;
        x = x*x;
    } 
    return res; 
}

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

    ll x = floor(log2(n));

    ll ans = 0;

    FOR(i,0,x+1)
    {
        ans += power(2,i);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
char s[10];
int main()
{
	scanf("%s",s);
	if(strcmp(s,"SUN")==0)
		printf("7");
	else if(strcmp(s,"MON")==0)
		printf("6");
	else if(strcmp(s,"TUE")==0)
		printf("5");
	else if(strcmp(s,"WED")==0)
		printf("4");
	else if(strcmp(s,"THU")==0)
		printf("3");
	else if(strcmp(s,"FRI")==0)
		printf("2");
	else
		printf("1");
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
//define int long long
int a[100000][30];
signed main(){
    int n,C;
    cin>>n>>C;
    for(int i=0;i<100000;i++)for(int j=0;j<C;j++)a[i][j]=0;
    int s,t,c;
    for(int i=0;i<n;i++){
        cin>>s>>t>>c;
        a[s-1][c-1]++;
        a[t-1][c-1]--;
    }
    int ans=0,count=0,m=0;
    for(int i=0;i<100000;i++){
        for(int j=0;j<C;j++){
            if(a[i][j]>0)count++;
            if(a[i][j]<0)m--;
        }
        ans=max(ans,count);
        count+=m;
        m=0;
    }
    cout<<ans;
    return 0;
}

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

bool dame(string & s) {
    if (s == "") return true;
    int n = stoi(s.c_str());
    if (n < 0 || 255 < n) return true;
    if (n == 0 && s != "0") return true;
    if (n != 0 && s[0] == '0') return true;
    return false;
}

int main() {
    string s;
    cin >> s;
    int n = s.size();
    int ans = 0;
    range (i, 1, n) range (j, i + 1, n) range (k, j + 1, n) {
        string a, b, c, d;
        a = b = c = d = "";
        rep (l, i) a += s[l];
        if (dame(a)) continue;
        range (l, i, j) b += s[l];
        if (dame(b)) continue;
        range (l, j, k) c += s[l];
        if (dame(c)) continue;
        range (l, k, n) d += s[l];
        if (dame(d)) continue;
        ans++;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3176
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
string s;
int main() {
	cin >> s;
	bool ret = (s == "ABC");
	while (!ret) {
		vector<int> v(s.size(), 0);
		for (int i = 2; i < s.size(); i++) {
			if (s[i - 2] == 'A' && s[i - 1] == 'B' && s[i] == 'C') {
				v[i - 2] = v[i - 1] = v[i] = 1;
			}
		}
		vector<int> ok(3, 1);
		for (int i = 0; i < s.size(); i++) ok[s[i] - 65] &= v[i];
		if (ok[0] + ok[1] + ok[2] != 1) break;
		int z = -1;
		for (int i = 0; i < 3; i++) if (ok[i]) z = i;
		string res;
		for (int j = 0; j < s.size();) {
			if (j <= s.size() - 3 && v[j] == 1) res += (char)(z + 65), j += 3;
			else res += s[j], j++;
		}
		if (res == "ABC") { ret = true; break; }
		if (res.size() != s.size()) s = res;
		else break;
	}
	cout << (ret ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 3208
#include<iostream>

using namespace std;

int main() {
  int a,b;
  int max = 0;
  cin >> a >> b;
  for (int i = 0; i<2; i++){
    if (a>b){
      max += a;
      a--;
  }else{
      max += b;
      b--;
    }
  }
  cout << max << endl;
  return 0;
}


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

typedef long long ll;
const ll MOD = 1e9+7;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int a,b,x,y;
    cin>>a>>b>>x>>y;

    cout<<fixed<<setprecision(6)<<(double)a*b/2<<" ";
    if(2*x==a&&2*y==b)cout<<1;
    else cout<<0;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
       Scanner sc = new Scanner(System.in);   
       //値の取得
	   long N = sc.nextLong();
      //高橋君の位置
       long i = 1;
       long j = 1;
       long a = 1;
      
      //最終的な位置
      while(a<=N/a){
        if(N%a==0){
          i = a;
          j = N/i;
        }
        a++;
      }
      
      System.out.println(i+j-2);
    }
}

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

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back

int n;


int main(){
    int dy[]={0,1,0,-1};
    int dx[]={-1,0,1,0};
    
    while(cin>>n){
        int data[500][500]={};
        if(n==0)break;
        
        vector<pii> point(300);
        
        point[0]=pii(250,250);
        data[point[0].first][point[0].second]=1;
        
        rep(i,n-1){
            int num,dir;
            cin>>num>>dir;
            data[point[num].first + dy[dir]][point[num].second + dx[dir]]=1;
            point[i+1]=pii(point[num].first + dy[dir],point[num].second + dx[dir]);
        }

        int maxw=0;
        int left=1000,right=-1;
        rep(i,500){
            rep(j,500){
                if(data[i][j]==1){
                    left=min(left,j);
                    right=max(right,j);
                }
            }
        }
        maxw=max(maxw,right-left+1);


        int maxh=0;
        int up=1000,down=-1;
        rep(j,500){
            rep(i,500){
                if(data[i][j]==1){
                    up=min(up,i);
                    down=max(down,i);
                }
            }
        }
        maxh=max(maxh,down-up+1);
        cout<<maxw<<" "<<maxh<<endl;
        
    }
    
    
    return 0;
}

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

int divisor(int n){
  int d = 0;
  for(int i = 1; i <= n; i++){
    if(n % i == 0) d++;
  }
  return d;
}

int main(){
  int N;
  cin >> N;
  int ans = 0;
  for(int i = 1; i <= N; i++){
    if((i % 2) && (divisor(i) == 8)) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256