akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define rrep(i, a, b) for (int i = (a); i < (b); ++i)
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    string s, t; cin>>s>>t;
    int n = sz(s);
    int m = sz(t);
    if (n + 1 != m) {
        cout<<"No"<<endl;
        return 0;
    }
    rep(i, n) {
        if (s[i] != t[i]) {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}

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

long long n,q,m,a,b;
string ss;
int main(){
    cin>>n>>m;
    for (int i=0; i<m; i++){
        cin>>a;
        b+=a;
    }
    if (b>=n){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
	int S=0,h=0,m=0,s=0,a=0;
	scanf("%d",&S);
	
	h=S/3600;
	a=S%3600;
	m=a/60;
	a=a%60;
	s=a;
	
	printf("%d:%d:%d\n",h,m,s);
	return 0;
}

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

int main(){
	int i,n,a[1000000];
	
	while(cin >> n && n){
		map<int,int> m;
		for(i=0;i<n;i++){
			cin >> a[i];
			m[a[i]]++;
		}
		
		for(i=0;i<n;i++)
			if(m[a[i]]>n/2){
				cout << a[i] << endl;
				break;
			}
		if(i==n)cout << "NO COLOR\n";
	}
}

Measured memory_bytes: 5844
#include<bits/stdc++.h>
using namespace std;
int dp[3005][3005];
int main(){
  string s,t;
  cin>>s>>t;
  int slen = s.length();
  int tlen = t.length();
  
  for(int i=0;i<=slen;++i){
    dp[i][0]= 0;
  }
  
  for(int i=0;i<=tlen;++i){
	dp[0][i]= 0;
  }
  
  for(int i=0;i<slen;++i){
    for(int j=0;j<tlen;++j){
      if(s[i]==t[j]){
        dp[i+1][j+1] = max(dp[i][j]+1,dp[i+1][j+1]);
      } else {
        dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j]);
      }
    }
  }
  /*
  for(int i=0;i<=slen;++i){
    for(int j=0;j<=tlen;++j){
      cout<<dp[i][j]<<" ";
    }
    cout<<endl;
  }
  
  cout<<dp[slen][tlen]<<endl;
  */
  string res = "";
  int i = slen;
  int j = tlen;
  
  while(i>0 && j>0 && dp[i][j]>0 ){
    while(dp[i-1][j]==dp[i][j]){
      --i;
    }
    while(dp[i][j-1]==dp[i][j]){
      --j;
    }
    //cout<<i<<" "<<j<<endl;
    res = s[i-1] + res;
    i--;
    j--;
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 35456
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

const int N = 110;

int n, a, b, d[2][N][N], s[2][N][N];
vector < pair < int, pair <int, int> > > q;
vector < pair < int, pair <int, int> > > g[2][N][N];

int main() {

	scanf("%d %d %d", &n, &a, &b);

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			d[0][i][j] = -1;
			d[1][i][j] = -1;
		}
	}

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			for (int k = 0; k < 2; k++) {
				int p = ((k == 0) ? i : j);
				for (int dir = -1; dir <= 1; dir += 2) {
					int w = p + dir;
					if (w < 1 || w > n || w == i || w == j) {
						continue;
					}
					if (k == 0) {
						s[k][i][j]++;
						g[1 - k][w][j].push_back(make_pair(k, make_pair(i, j)));
					} else {
						s[k][i][j]++;
						g[1 - k][i][w].push_back(make_pair(k, make_pair(i, j)));
					}
				}
			}
		}
	}

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			for (int k = 0; k < 2; k++) {
				if (s[k][i][j] == 0) {
					d[k][i][j] = 0;
					q.push_back(make_pair(k, make_pair(i, j)));
				}
			}
		}
	}

	for (int i = 0; i < q.size(); i++) {
		int x = q[i].first;
		int y = q[i].second.first;
		int z = q[i].second.second;
		for (int p = 0; p < g[x][y][z].size(); p++) {
			int nx = g[x][y][z][p].first;
			int ny = g[x][y][z][p].second.first;
			int nz = g[x][y][z][p].second.second;
			if (d[nx][ny][nz] != -1) {
				continue;
			}
			if (d[x][y][z] == 0) {
				d[nx][ny][nz] = 1;
				q.push_back(make_pair(nx, make_pair(ny, nz)));
				continue;
			}
			s[nx][ny][nz]--;
			if (s[nx][ny][nz] == 0) {
				d[nx][ny][nz] = 0;
				q.push_back(make_pair(nx, make_pair(ny, nz)));
			}
		}
	}

	if (d[0][a][b] == 0) {
		puts("Borys");
	} else if (d[0][a][b] == 1) {
		puts("Alice");
	} else {
		puts("Draw");
	}

	return 0;

}

Measured memory_bytes: 2112
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;

public class Main{
	public static void main(String[] args) {
		SC sc=new SC(System.in);
		String tmp="";
		String[] product=new String[2];
		int cn=1;
		while(true) {
			int W=sc.nextInt();
			if(W==0) {
				break;
			}
			else {
				int N=sc.nextInt();
				int[][] dp=new int[N+1][W+1];
				int[][] sina=new int[N][2];
				for(int i=0; i<=N; i++) {
					for(int j=0; j<=W; j++) {
						dp[i][j]=0;
					}
				}
				for(int i=0; i<N; i++) {
					tmp=sc.nextLine();
					product=tmp.split(",");
					sina[i][0]=Integer.parseInt(product[1]);
					sina[i][1]=Integer.parseInt(product[0]);
				}
				for(int i=0; i<N; i++) {
					for(int j=0; j<=W; j++) {
						if(j-sina[i][0]<0) {
							dp[i+1][j]=dp[i][j];
						}
						else {
							dp[i+1][j]=Math.max(dp[i][j], dp[i][j-sina[i][0]]+sina[i][1]);
						}
					}
				}
				int min=W;
				int kt=dp[N][W];
				for(int j=W; j>=0; j--) {
					if(kt==dp[N][j]) {
						min=Math.min(min, j);
					}
					else {
						break;
					}
				}
				pl("Case "+cn+":");
				pl(dp[N][W]);
				pl(min);
			}
			cn++;
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new UncheckedIOException(e);
			}
		}
	}
}



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

using namespace std;

void __start__() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifdef MY
    freopen("/home/ainur/CLionProjects/wow/input.txt", "r", stdin);
    freopen("/home/ainur/CLionProjects/wow/output.txt", "w", stdout);
#else
    //freopen("search.in", "r", stdin);
   // freopen("search.out", "w", stdout);
#endif
}

#define sz(x) (int)x.size()
#define yes cout<<"Yes\n"
#define  no cout << "No\n"
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define ft first
#define sd second
#define read(a) for(auto &qwqw:a)cin >> qwqw;
#define print(a) for(auto qwqw:a)cout<<qwqw<<' ';
#define print_plus(a) for(auto qwqw:a)cout<<qwqw+1<<' ';
//#define FOR(i, b, n) for(int i=b;i<n;i++) #define FOR(i, n) FOR(i, 0, n) #define FOR(n) FOR(i, 0, n)
mt19937_64 rnd(time(0));
using ll = long long;
using vi = vector<int>;
using ld = long double;
using vb = vector<bool>;
using pii = pair<int, int>;
using vd = vector<long double>;


int log2(int q) {
    int c = 0;
    while (q) {
        q >>= 1;
        c++;
    }
    return c;
}

#define int long long

void test_case() {
    int n, c=0;
    cin >> n;
    vi a(n);
    read(a);
    for (int i = 0; i < n; ++i) {
        for (int j = i+1; j < n; ++j) {
            for (int k = j+1; k < n; ++k) {
                c+=(a[i]+a[j]>a[k] && a[i]+a[k]>a[j] && a[j]+a[k]>a[i] && a[i]!=a[j] && a[i]!=a[k] && a[j]!=a[k]);
            }
        }
    }
    cout << c;

}

signed main() {
    __start__();
    int Q = 1;
    //cin >> Q;
    while (Q--) {
        test_case();
    }
}





Measured memory_bytes: 3652
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {x: usize, n: usize, p: [usize; n]};
    let p: Vec<usize> = p;
    let mut range = 0;

    loop {
        let x_m = x - range;
        let x_p = x + range;

        if !p.contains(&x_m) {
            println!("{}", x_m);
            break;
        }

        if !p.contains(&x_p) {
            println!("{}", x_p);
            break;
        }

        range += 1;
    }
}


Measured memory_bytes: 2196
import java.util.*;
class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b =sc.nextInt();
        int answer = Math.max(a+b,a-b);
        answer =Math.max(answer,a*b);
        System.out.println(answer);
    }
}

Measured memory_bytes: 22100
#include <iostream>
#include <algorithm>

using namespace std;

#define MAX_N 100001

int n,s[MAX_N],t[MAX_N];

int main(void)
{
	while(true)
	{
		cin >> n;
		if(n == 0)
			exit(0);
		for(int i = 1;i <= n;i++)
		{
			cin >> s[i];
		}
		for(int i = 1;i <= n;i++)
		{
			if(i % 2 == 1)
			{
				t[i] = s[i];
			}
			else
			{
				if(t[i-1] == s[i])
				{
					t[i] = s[i];
				}
				else
				{
					t[i] = s[i];
					for(int k = i - 1;t[k] != s[i] && k >= 1;k--)
					{
						t[k] = s[i];
					}
				}
			}
		}
		int count = 0;
		for(int i = 1;i <= n;i++)
		{
			if(t[i] == 0)
			{
				count++;
			}
		}
		cout << count << endl;
	}
}

Measured memory_bytes: 3728
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <functional>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>
#include <sstream>

#define rep(i, a) REP(i, 0, a)
#define REP(i, a, b) for(int i = a; i < b; ++i)
#define rrep(i, a) RREP(i, a, 0)
#define RREP(i, a, b) for(int i = a; i >= b; --i)
#define repll(i, a) REPLL(i, 0, a)
#define REPLL(i, a, b) for(ll i = a; i < b; ++i)
#define rrepll(i, a) RREPLL(i, a, 0)
#define RREPLL(i, a, b) for(ll i = a; i >= b; --i)

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> P;
typedef std::pair<int, P> PP;
const double PI = 3.14159265358979323846;
const double esp = 1e-9;
const int infi = (int)1e+9 + 10;
const ll infll = (ll)1e+18 + 10;

int n, q;
int s[10001], t[501];
int ans = 0;

int main(){
	std::cin >> n;
	rep(i, n)std::cin >> s[i];
	std::cin >> q;
	rep(i, q)std::cin >> t[i];

	std::sort(s, s + n);
	std::sort(t, t + q);

	rep(i, q){
		if (std::binary_search(s, s + n, t[i]))++ans;
	}

	std::cout << ans << std::endl;

	return 0;
}

Measured memory_bytes: 1216
n, m = map(int, input().split())
l = [0]*m
for i in range(m):
  a, b = map(int, input().split())
  l[i] = [b, a]
l.sort()

ans = 0
x = 0
for i in range(m):
  if x < l[i][1]:
    ans += 1
    x = l[i][0] -1
print(ans)

Measured memory_bytes: 20068
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,x;
    cin>>a;
    char b[a];
    for(int i=0;i<a;i++){
        cin>>b[i];
        for(int j=0;j<i;j++){
            if(b[i]==b[j]) goto c;
        }
        if(b[i]=='P'||b[i]=='W'||b[i]=='G'||b[i]=='Y') x++;
        c:;
    }
    if(x-3) cout<<"Four"<<endl;
    else cout<<"Three"<<endl;
}


Measured memory_bytes: 256
p,q=map(int,input().split())
if q>p:
  p,q=q,p
  
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)
  
def prime_factorize(n):
    a = set()
    while n % 2 == 0:
        a.add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.add(n)
    return a
  
g=gcd(p,q)
res=prime_factorize(g)
print(len(res)+1)

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

struct node {
    unsigned int key;
    struct node *next;
    struct node *prev;
};

typedef struct node *NodePointer;

NodePointer nil;

NodePointer listSearch(int key) { /* your code */
    NodePointer cur = nil->next;
    while (cur != nil && cur->key != key) {
        cur = cur->next;
    }
    return cur;
}

void init() {
    nil = (node *)malloc(sizeof(struct node));
    nil->next = nil;
    nil->prev = nil;
}

void printList() {
    NodePointer cur = nil->next;
    int isf = 1;
    while (1) {
        if (cur == nil) break;
        if (isf == 0) printf(" ");
        printf("%d", cur->key);
        cur = cur->next;
        isf = 0;
    }
    printf("\n");
}

void deleteNode(NodePointer t) { /* your code */
    if (t == nil) return;
    t->prev->next = t->next;
    t->next->prev = t->prev;
    free(t);
}

void deleteFirst() {
    NodePointer t = nil->next;
    if (t == nil) return;
    deleteNode(t);
}

void deleteLast() { /* your code */
    NodePointer t = nil->prev;
    if (t == nil) return;
    deleteNode(t);
}

void del(int key) { /* your code */
    deleteNode(listSearch(key));
}

void insert(int key) {
    NodePointer x;
    x = (node *)malloc(sizeof(struct node));
    x->key = key;

    x->next = nil->next;
    nil->next->prev = x;
    nil->next = x;
    x->prev = nil;
}

int main() {
    int key, n, i;
    int size = 0;
    char com[20];
    int np = 0, nd = 0;
    scanf("%d", &n);
    init();
    for (i = 0; i < n; i++) {
        scanf("%s%d", com, &key);
        if (com[0] == 'i') {
            insert(key);
            np++;
            size++;
        } else if (com[0] == 'd') {
            if (strlen(com) > 6) {
                if (com[6] == 'F')
                    deleteFirst();
                else if (com[6] == 'L')
                    deleteLast();
            } else {
                del(key);
                nd++;
            }
            size--;
        }
    }

    printList();
    return 0;
}



Measured memory_bytes: 34404
n = int(input())
X = list(map(int, input().split()))
mod = 10**9 + 7
last=X[-1]
X=[last-i for i in X[:-1]]
l, left = 1, [1]
for i in range(1, n - 1):
    l *= i
    l %= mod
    left.append(l)
r, right = 1, [1]
for i in range(n - 1, 1, -1):
    r *= i
    r %= mod
    right.append(r)
right.reverse()
flst=[(i*j%mod)%mod for i,j in zip(left,right)]
s = sum(i*j%mod for i,j in zip(X,flst))
print(s%mod)

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

int main() {
  char s[10];
  scanf("%s", s);
  sort (s, s + 4);
  printf((s[0] == s[1] && s[1] != s[2] && s[2] == s[3]) ? "Yes\n" : "No\n" );
  return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);

        int K = sc.nextInt();
        int[] x = new int[32];
        x[0] = 1;
        x[1] = 1;
        x[2] = 1;
        x[3] = 2;
        x[4] = 1;
        x[5] = 2;
        x[6] = 1;
        x[7] = 5;
        x[8] = 2;
        x[9] = 2;
        x[10] = 1;
        x[11] = 5;
        x[12] = 1;
        x[13] = 2;
        x[14] = 1;
        x[15] = 14;
        x[16] = 1;
        x[17] = 5; 
        x[18] = 1;
        x[19] = 5;
        x[20] = 2;
        x[21] = 2;
        x[22] = 1;
        x[23] = 15;
        x[24] = 2;
        x[25] = 2;
        x[26] = 5;
        x[27] = 4;
        x[28] = 1;
        x[29] = 4;
        x[30] = 1;
        x[31] = 51;

        System.out.println(x[K-1]);
    }
}

Measured memory_bytes: 22100
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

typedef struct{
    int x;
    int prev;   //先頭要素なら-1
    int next;   //末尾要素なら-1
}element;
typedef struct{
    element *e;
    int head,tail;
    int count;
}list;

void insert(list *l){
    int i;
    
    int x;
    scanf("%d\n",&x);
    
    if(l->count==0){
        l->e=(element*)malloc(sizeof(element));
        l->e[0].x=x;
        l->e[0].prev=-1;
        l->e[0].next=-1;
        l->count++;
        l->head=0;
        l->tail=0;
    }else{
        i=l->count;
        l->e=(element*)realloc(l->e,sizeof(element)*(i+1));
        l->e[i].x=x;
        l->e[i].prev=-1;
        l->e[i].next=l->head;
        if(l->head!=-1)l->e[l->head].prev=i;
        l->count++;
        l->head=i;
        if(l->tail==-1)l->tail=i;
    }
}
void del(list *l){
    int i;
    
    int x;
    scanf("%d\n",&x);
    
    i=l->head;
    while(l->e[i].x!=x){
        i=l->e[i].next;
        if(i==-1)return;
    }
    
    int prev,next;
    prev=l->e[i].prev;
    next=l->e[i].next;
    if(prev!=-1)l->e[prev].next=next;
    else l->head=next;
    if(next!=-1)l->e[next].prev=prev;
    else l->tail=prev;

    l->e[i].x=-1;
    
}
void delFirst(list *l){
    int head=l->head;
    int next=l->e[head].next;
    
    l->e[head].x=-1;
    if(next!=-1)l->e[next].prev=-1;
    else l->tail=-1;
    l->head=next;
}
void delLast(list *l){
    int tail=l->tail;
    int prev=l->e[tail].prev;
    
    l->e[tail].x=-1;
    if(prev!=-1)l->e[prev].next=-1;
    else l->head=-1;
    l->tail=prev;
}
int main(void){
    int i;
    
    int n;
    scanf("%d",&n);
    
    list l;
    l.head=-1;
    l.tail=-1;
    l.count=0;
    
    char command[12];
    for(i=0;i<n;i++){
        scanf(" \n%s",command);
        if(strcmp(command,"insert")==0){
            insert(&l);
        }else if(strcmp(command,"delete")==0){
            del(&l);
        }else if(strcmp(command,"deleteFirst")==0){
            delFirst(&l);
        }else if(strcmp(command,"deleteLast")==0){
            delLast(&l);
        }
    }
    
    i=l.head;
    printf("%d",l.e[i].x);
    i=l.e[i].next;
    while(i!=-1){
        printf(" %d",l.e[i].x);
        i=l.e[i].next;
    }
    printf("\n");
    
}



Measured memory_bytes: 14804
#include <bits/stdc++.h>
using namespace std;
int main(){
string s;
string t;
cin >>s;
cin >>t;
int p;
for (int i=0;i<3;i++){
	if (s.at(i)==t.at(i)){
     p+=1;
 	}
}
cout <<p<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

ll d[3][3];

int main() {
  rep(y,0,3){
    rep(x,0,3){
      ll a;
      cin>>a;
      d[y][x] = a;
    }
  }
  rep(i,0,101){
    rep(j,0,101){
      rep(k,0,101){
        ll dd[3][3];
        rep(y,0,3){
          rep(x,0,3){
            dd[y][x] = d[y][x];
          }
        }
        rep(x,0,3){
          dd[0][x] -= i;
          dd[1][x] -= j;
          dd[2][x] -= k;
        }
        ll flag = 1;
        rep(x,0,3){
          if(dd[0][x]!=dd[1][x]||dd[1][x]!=dd[2][x])flag = 0;
        }
        if(flag==1){
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  }
  cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define F(i,s,e) for(int i=s;i<e;++i)

int main(){
    int k,x;
    cin >> k >>x;
    if(500*k>=x) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define str string
#define pb push_back
#define optimizator ios_base::sync_with_stdio(0);
using namespace std;
int main(){
	optimizator;
	int a,b,c;
	cin>>a>>b>>c;
	if((a==b && a!=c) || (a==c && c!=b) || (b==c && c!=a)){
		cout<<"Yes";
	}
	else{
		cout<<"No";	
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N; cin >> N;
  string S; cin >> S;
  int ans = 0;
  REP(i, N-2){
    if(S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C') ans++;
  }
  cout << ans << endl;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int a,b,k;
    cin>>a>>b>>k;
    if((b-a+2)/2<=k){
        for(int i=a;i<=b;i++)cout<<i<<endl;
    }else{
        for(int i=a;i<a+k;i++)cout<<i<<endl;
        for(int i=b-k+1;i<=b;i++)cout<<i<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
n,k=map(int,input().split())
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
if k>=n:
  k=n-1
ans=0
for i in range(n-k,n+1):
  ans+=cmb(n,i,mod)*cmb(n-1,i-1,mod)
  ans%=mod
if k==1:
  ans=(ans-1+mod)%mod
print(ans)

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

int main() {
  int d;
  cin >> d;
  int tmp = d % 10;
  if (tmp == 2) cout << "Christmas Eve Eve Eve" << endl;
  else if (tmp == 3) cout << "Christmas Eve Eve" << endl;
  else if (tmp == 4) cout << "Christmas Eve" << endl;
  else cout << "Christmas" << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
s = input() # 入力が1つ
# map(int, input().split()) # 入力が複数
one = 0
zero = 0
for i in s:
    if i == '1':
        one += 1
    elif i == '0':
        zero += 1
print(min(one, zero) * 2)

Measured memory_bytes: 3188
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}
int main() {
    ll n,w[1000];
    std::cin >> n;
    ll sum=0;
    ll su[1000];
    su[0]=0;
    for (int i = 0; i < n; i++) {
        std::cin >> w[i];
        su[i+1]=w[i]+su[i];
        sum+=w[i];
    }
    ll result = 10000000000;
    
    for (int i = 0; i <= n; i++) {
        result=min(result,(ll)abs(sum-2*su[i]));
    }
    std::cout << result << std::endl;
    
}   

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

#define ll long long
using namespace std;

#define MAXN 

void solve()
{
	int M;
	cin>>M;
	ll ans = -1, d, c;
	int a = 0;
	for(int i=0; i<M; ++i)
	{
		cin>>d>>c;
		ll z = d*c;
		ans += c;
		ll x = z%9;
		ll y = z/9;
		if(x==0 && y>1)
		{
			x=9;
			y--;
		}
		ans+=y;
		a = a+x;
		if(a>9)
		{
			a-=9;
			ans++;
		}
	}
	cout<<ans<<endl;
	
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
		solve();
		
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main
{
  public static void main(String[] args)
  {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int k=sc.nextInt();
    int a[]=new int[n];
    int c=0;
    for(int j=0;j<n;j++)
      {
       a[j]=0;
      }
    for(int i=1;i<=k;i++)
    {
      int d=sc.nextInt();
      for(int j=0;j<d;j++)
      {
        int x=sc.nextInt();
        a[x-1]=1;
      }
    }
    for(int j=0;j<n;j++)
      {
       if(a[j]==0)
         c++;
      }
      System.out.println(c);
    
  }
}

Measured memory_bytes: 46280
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int aPrice = stdIn.nextInt();
		int bPrice = stdIn.nextInt();
		int abPrice = stdIn.nextInt();

		int aNeeds = stdIn.nextInt();
		int bNeeds = stdIn.nextInt();

		// 全部ハーフで買う枚数
		int halfAll = Integer.max(aNeeds, bNeeds) * 2;
		int priceAllHalf = halfAll * abPrice;

		// 共通部分はハーフで買う
		int halfCommon = Integer.min(aNeeds, bNeeds) * 2;
		int rest = Math.abs(aNeeds - bNeeds);
		int priceHalfCommon = (halfCommon * abPrice) + (aNeeds > bNeeds ? rest * aPrice : rest * bPrice);

		// 全部別々に買う
		int priceSimply = aPrice * aNeeds + bPrice * bNeeds;
		stdIn.close();


		System.out.println(Integer.min(Integer.min(priceAllHalf, priceHalfCommon),priceSimply));
	}

}


Measured memory_bytes: 22100
use std::io::*;
use std::str::FromStr;
   
fn read<T: FromStr>() -> T {
	let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
	let n: u32 = read();
	let s: String = read();

	let l = s.chars().count();
	if l % 2 != 0 {
		println!("No");
	} else {
		if &s[0..(l/2)] == &s[(l/2)..l] {
			println!("Yes");
		} else {
			println!("No");
		}
	}
}

Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
int main()
{
  long long int i,j,k;
  long long int N,M;
  long long int space;

  scanf("%lld",&N);
  long long int sum[N+1];
  for(i=1;i<=N;i++){
    sum[i] = 0;
  }
  
  for(i=1;i<N;i++){
    scanf("%lld",&j);
    sum[j]++;
  }
  
  for(i=1;i<=N;i++){
    printf("%lld\n",sum[i]);
  }
  
  return 0; 
  
}

Measured memory_bytes: 3268
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <cmath>
#include <vector>

typedef long long ll;

using namespace std;

int main()
{
    ll n;

    cin >> n;

    vector<float> p(n);

    for (auto &i: p)
        cin >> i;

    sort(p.begin(), p.end(), greater<ll>());

    float sum = p[0]*0.5;

    for (ll j=1; j<n; j++)
    {
        sum += p[j];
    }

    cout << floor(sum) << endl;

    return 0;
}


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

int main(){
	cin.tie(0),ios::sync_with_stdio(false);
	int n; cin>>n;
	vector<int>a(n); for(auto&i:a)cin>>i;
	sort(a.begin(),a.end());
	int ai=a.back(),aj=a.front(),abm=abs(ai-aj*2);
	for(auto&taj:a){
		int tmp=abs(ai-taj*2);
		if(tmp>=abm)continue;
		aj=taj,abm=tmp;
	}
	cout<<ai<<" "s<<aj<<"\n"s;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
typedef  long long ll;
ll gcd(ll x,ll y){
   if(y==0) return x;
   else return gcd(y,x%y);
}
ll lcm(ll x,ll y){
   return x/gcd(x,y)*y;
}
using namespace std;
int main(){ 
   int n,x;
   cin>>n>>x;
   int sum=0;
   vector<int> a(n);
   rep(i,n){
      cin>>a[i];
      sum+=a[i];
   }
   x=x-sum;

   int ans=n;
   sort(a.begin(),a.end());
   ans+=(x/a[0]);
   cout<<ans;

   
      return 0;
}

Measured memory_bytes: 256
#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)
#define all(x) (x).begin(),(x).end()
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;
typedef pair<int, int> P;
int main()
{
    int N;
    cin >> N;

    vector<vector<P>> xy(N);
    int ans = 0;
    rep(i, N) {
        int A;
        cin >> A;
        rep(j, A) {
            int x, y;
            cin >> x >> y;
            xy[i].push_back(P(x, y));
        }
    }

    for (int bit = 1; bit < (1 << N); bit++) {
        vector<int> check(N, 0), han(N, -1);
        bool flag = true;
        int cnt = 0;
        for (int i = 0; i < N; i++) {
            if (bit & (1 << i)) {
                check[i] = 1;
                for (int j = 0; j < (int)xy[i].size(); j++) {
                    P p = xy[i][j];
                    if (p.second == 1) check[p.first - 1] = 1;
                }
            }
        }
        for (int i = 0; i < N; i++) {
            if (check[i] == 1) {
                for (int j = 0; j < (int)xy[i].size(); j++) {
                    P p = xy[i][j];
                    if (p.second == 1) check[p.first - 1] = 1;
                }
            }
        }
        for (int i = 0; i < N; i++) {
            if (check[i] == 1) {
                for (int j = 0; j < (int)xy[i].size(); j++) {
                    P p = xy[i][j];
                    /*
                    if (check[p.first - 1] == -1) {
                        check[p.first - 1] = p.second;
                    }
                    else {
                        */
                        if (check[p.first - 1] != p.second) {
                            flag = false;
                            break;
                        }
                    //}
                }
            }
        }
        /*
        cout << endl << bit << endl;
        rep(i, N) {
            cout << check[i] << " ";
        }
        */
        if (flag) {
            rep(i, N) cnt += max(check[i], 0);
        }
        if (flag) ans = max(ans, cnt);
    }

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

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

using namespace std;

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

#define ABC 001
#define ARC 010
#define AGC 100

int main(void){
    int r;
    cin >> r;
    int frag = AGC;
    if(r < 1200){
        frag |= ABC;
        frag |= ARC;
    }else if( r < 2800){
        frag |= ARC;
    }
    if(frag & ABC)cout << "ABC" << endl;
    else if(frag & ARC)cout << "ARC" << endl;
    else cout << "AGC" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define mp make_pair
#define pb(x) push_back(x)
#define vi vector<int>
#define vs vector<string>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define pil pair<int, long long>
#define pli pair<long long, int>
#define pcc pair<char, char>
#define pdd pair<double, double>
#define mll map<long long, long long>
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define flsh fflush(stdout)
#define gcd __gcd
#define clr(x) memset(x, 0, sizeof(x))
#define mod 1000000007LL
#define mod2 998244353LL
#define INF 1000000000007
 

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> o_tree;


void solve()
{
    string s;
    cin>>s;
    ll a=0,b=0;
    for(ll i=0;i<3;i++)
    {
        if(s[i]=='A')a++;
        else if(s[i]=='B')b++;
    }
    if(a>0&&b>0)
    {
        cout<<"Yes\n";
        return;
    }
    cout<<"No\n";
}


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


if (fopen("input.txt","r" ))
  {
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
  }
cout<<setprecision(20);


ll t=1;


// cin>>t;


while(t--)
{
solve();
} 


return 0;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
#define pb push_back
#define ld long double
#define f first
#define s second
#define in insert
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int INF = 1e18 + 5;
const int mod = 1e9 + 7;
const int  N = 2e5 + 314;
const long double pi = 3.1415926535897932384626433832795;
void solve(){
	string s;
	cin>>s;
	int i = sz(s)-1;
	for(;i>= 0;i--){
		if(s[i]=='r'&&s[i-1]=='e'&&s[i-2]=='s'&&s[i-3]=='a'&&s[i-4]=='r'&&s[i-5]=='e')i-=5;
		else if(s[i]=='r'&&s[i-1]=='e'&&s[i-2]=='m'&&s[i-3]=='a'&&s[i-4]=='e'&&s[i-5]=='r'&&s[i-6]=='d')i-=6;
		else if(s[i]=='e'&&s[i-1]=='s'&&s[i-2]=='a'&&s[i-3]=='r'&&s[i-4]=='e')i-=4;
		else if(s[i]=='m'&&s[i-1]=='a'&&s[i-2]=='e'&&s[i-3]=='r'&&s[i-4]=='d')i-=4;
		else{
			cout<<"NO";
			return;
		}
	}	
	cout<<"YES\n";
}
signed main(){
	speed;
	int t=1;
	//cin>>t;
	while(t--)solve();
}

Measured memory_bytes: 3728
#include <bits/stdc++.h>
using namespace std;
int main () {
  string S;
  cin >> S;
  int i,j=0;
  while (i<S.size()){
    if (i%2==0){
      if (S.at(i)!='R'&&S.at(i)!='U'&&S.at(i)!='D'){
      	j=1;
      	break;
      }
      i++;
    }
    else{
      if (S.at(i)!='L'&&S.at(i)!='U'&&S.at(i)!='D'){
      		j=1;
      		break;
      }
      i++;
	}
  }
  if (j==0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;
}

Measured memory_bytes: 256
h, n = map(int, input().split())
a = []
b = []

for i in range(n):
    a_e, b_e = map(int, input().split())
    a.append(a_e), b.append(b_e)

h_dp = h + max(a)

dp = [[float("inf")] * (h_dp + 1) for _ in range(n+1)]
dp[0][0] = 0

for i in range(n):
    dp[i][0] = 0
    for j in range(h_dp+1):
        if a[i] > h_dp:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = min(dp[i][j], dp[i+1][j-a[i]] + b[i])

ans = float("inf")
for i in range(h, h_dp+1):
    ans = min(ans, dp[n][i])

print(ans)

Measured memory_bytes: 312072
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>


using namespace std;
//文字列中の "abc"の数を出力
int main ()
{
  int n;
  string s;
  cin >> n;
  cin >> s;

  //ここでsの中にあるABCを数える
  int num = 0;
  while ( true )
  {
    size_t pos = s.find("ABC"); 
    if ( pos == string::npos ) break;
    s = s.substr(pos + 3, s.length() - (pos+3));
    //cout << s << "\n";
    num++;
  }
  cout << num << "\n";
  return 0;
}


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

typedef long long int ll;
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    vector<int> v(26, 0);
    int len = s.size();
    sort(s.begin(), s.end());
    for(int i = 0; i < len; i++){
        v[s[i] - 'a']++;
    }
    for(int i = 0; i < 26; i++){
        if(v[i] == 0){
            char ch = v[i] + 'a' + i;
            cout << ch << endl;
            return 0;
        }
    }
    cout << "None" << endl;

    return 0;
}


Measured memory_bytes: 512
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 27 21:41:45 2019

@author: yuta
"""

N = int(input())
a = input().split()
a = list(map(int,a))

def main(a):
        card = sorted(a,reverse = True)
        Alice = sum(card[::2])
        Bob = sum(card[1::2])
        print(Alice - Bob)

main(a)

Measured memory_bytes: 3060
(ns Atcoder.ABC088-A)

(defn solve [X Y]
  (loop [x X cnt 0]
    (if (> x Y)
      cnt
      (recur (* x 2) (inc cnt))
      )
    )
  )
(def input (map read-string (clojure.string/split (read-line) #" ")))
(println (solve (first input) (second input)))

Measured memory_bytes: 68904
import math

def koch_kurve(n, p1=[0, 0], p2=[100, 0]):
  if n == 0: return

  s, t, u = make_edge_list(p1, p2)

  koch_kurve(n-1, p1, s)
  # print(s)
  # print(s)
  print(" ".join([ str(i) for i in s ]))
  koch_kurve(n-1, s, u)
  print(" ".join([ str(i) for i in u ]))
  koch_kurve(n-1, u, t)
  print(" ".join([ str(i) for i in t ]))
  koch_kurve(n-1, t, p2)


def make_edge_list(p1, p2):
  sx = 2 / 3 * p1[0] + 1 / 3 * p2[0]
  sy = 2 / 3 * p1[1] + 1 / 3 * p2[1]
  # s = (sx, sy)
  s = [sx, sy]

  tx = 1 / 3 * p1[0] + 2 / 3 * p2[0]
  ty = 1 / 3 * p1[1] + 2 / 3 * p2[1]
  t = [tx, ty]

  theta = math.radians(60)
  ux = math.cos(theta) * (tx - sx) - math.sin(theta) * (ty - sy) + sx
  uy = math.sin(theta) * (tx - sx) + math.cos(theta) * (ty - sy) + sy
  u = [ux, uy]

  return s, t, u

n = int(input())
print("0 0")
koch_kurve(n)
print("100 0")




Measured memory_bytes: 5748
// include
// ------------------------------------------------
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <math.h>

using namespace std;

// func
// ------------------------------------------------
int CalcSumOfDigit(int n);      // 各桁の和を計算する。
long long getDigit(long long n);      // 数字の桁数を取得する。
string upper(string str);       // 英字を大文字に変換する。
string lower(string str);       // 英字を小文字に変換する。

// define
// ------------------------------------------------
#define all(a)        (a).begin(),(a).end()
#define rall(a)       (a).rbegin(),(a).rend()
#define sz(a)         int((a).size())
#define rep(i,n)      for(int(i)=0;(i)<(n);(i)++)
#define repe(i,n)     for(int(i)=0;(i)<=(n);(i)++)
#define vsort(v)      sort((v).begin(),(v).end())
#define rvsort(v)     sort(rall((v)))
#define vi            vector<int>
#define GCD(a,b)      __gcd((a),(b))
#define LCM(a,b)      ((a)/GCD((a),(b))*(b))
#define kiriage(a,b)  ((a)+(b)-1)/(b)

const int INF = 1e9;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vll;

// code
// ------------------------------------------------
int main()
{
  ll n;
  cin >> n;
  vll a(n);
  rep(i,n)
  { 
    cin >> a[i];
    a[i]--;
  }
  ll ans = 0;

  rep(i,n)
  {
    if(i == a[a[i]])
    {
      ans++;
    }
  }

  cout << ans / 2 << endl;


  return 0;
}
// funcの実体
// ------------------------------------------------
ll getDigit(ll n)
{
  int i = 1;
  while(1)
  {
    n = n / 10;
    if(n == 0)
      break;
    i++;
  }
  return i;
}
ll CalcSumOfDigit(ll n)
{
  ll s = 0;
  while(n)
  {
    s += n % 10;
    n = n / 10;
  }
  return s;
}

string upper(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(97 <= *itr && *itr <= 122)
    {
      *itr = *itr - 32;
    }
  }
  return str;
}

string lower(string str)
{
  for(auto itr = str.begin();itr != str.end() ; itr++)
  {
    if(65 <= *itr && *itr <= 90)
    {
      *itr = *itr + 32;
    }
  }
  return str;
}


Measured memory_bytes: 1024
N,M=map(int,input().split())
A=[[int(i) for i in input().split()] for _ in range(N)]
R=[0 for i in range(M)]
for i in range(N):
    R[A[i][0]-1]+=1
P=0
Q=0
S=set()
for i in range(N):
    if R[A[i][0]-1]>=P:
        P=R[A[i][0]-1]
        Q=A[i][0]
S.add(Q)
while(len(S)<M):
    Pd=0
    Qd=0
    R=[0 for i in range(M)]
    for i in range(N):
        for j in range(M):
            if not(set([A[i][j]]) <= S):
                R[A[i][j]-1]+=1
                break
    for j in range(M):
        if R[j]>=Pd:
            Pd=R[j]
            Qd=j+1
    if Pd<P:
        P=Pd
    S.add(Qd)
print(P)


Measured memory_bytes: 45404
#include<iostream>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c>>d;

   for(int i = 1 ; ; i++)

   {
     if(i%2!=0) c=c-b;
     else a=a-d;


    if(c<1)
    {
    cout<<"Yes";
    break;
    }

    else if (a<1){
            cout<<"No";
    break;
    }


   }
}


Measured memory_bytes: 3628
//#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cstring>
#include <cassert>

using namespace std;

#ifdef LOCAL_DEBUG
#include <local_debug.h>
#define DEBUG(...) DBG2::print(#__VA_ARGS__, __LINE__, __VA_ARGS__)
#else
#define DEBUG(...)
#endif

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;



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

   string S;
   cin >> S;

   int sum = 0;
   for (char c : S)
      sum += c - '0';

   cout << ((sum % 9) == 0 ? "Yes" : "No") << endl;

   return 0;
}


Measured memory_bytes: 3776
s = str(input())
check = s.replace('x', '')

if check == check[::-1]:
  left = 0
  right = len(s)-1
  ans = 0
  while left < right:
    if s[left] == s[right]:
      left += 1
      right -= 1
    else:
      if s[left] == 'x':
        s = s[:right+1] + 'x' + s[right+1:]
      else:
        s = s[:left] + 'x' + s[left:]
      left += 1
      ans += 1
  print(ans)
else:
  print(-1)

Measured memory_bytes: 10532
#include"bits/stdc++.h"
#include<cassert>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 998244353;
const long long inf = 1ll << 61;
const double eps = 0.000000000001;
typedef pair<int, int> P;
typedef pair<P, int>PP;
struct edge { int to; int cost;};
int x[200006], y[200006];
vector<PP>V,V2;
int ans[4][200006];
int bit[200007];
int N;
int sum(int i) {
	int s = 0;
	while (i > 0) {
		s += bit[i];
		i -= i&-i;
	}
	return s;
}
void add(int i, int x) {
	while (i <= N) {
		bit[i] += x;
		i += i&-i;
	}
}

int modpow(int x, int n, int mod) {
	if (!n)return 1;
	int res = modpow(x*x%mod, n / 2, mod);
	if (n & 1)res = res*x%mod;
	return res;
}

signed main() {
	int n; cin >> n;
	rep(i, n)cin >> x[i] >> y[i];
	map<int, int>M1, M2;
	rep(i, n)M1[x[i]]++;
	int cnt = 0;
	for (auto itr = M1.begin(); itr != M1.end(); itr++) {
		M2[itr->first] = cnt;
		cnt++;
	}
	map<int, int>M3, M4;
	rep(i, n)M3[y[i]]++;
	cnt = 0;
	for (auto itr = M3.begin(); itr != M3.end(); itr++) {
		M4[itr->first] = cnt;
		cnt++;
	}

	rep(i, n) {
		V.push_back(PP(P(M2[x[i]], M4[y[i]]),i));
	}
	sort(V.begin(), V.end());
	N = n;

	rep(i, n)add(V[i].first.second + 1, 1);
	rep(i, n) {
		ans[0][V[i].second] = sum(V[i].first.second);
		ans[1][V[i].second] = n-i-1-ans[0][V[i].second];
		add(V[i].first.second + 1, -1);
	}
	fill(bit, bit + 200004, 0);

	rep(i, n)add(V[i].first.second + 1, 1);
	for(int i=n-1;i>=0;i--) {
		ans[2][V[i].second] = sum(V[i].first.second);
		ans[3][V[i].second] = i - ans[2][V[i].second];
		add(V[i].first.second + 1, -1);
	}

	int sum = n*modpow(2, n - 1, mod);
	rep(i, n) {
		int S0 = modpow(2, ans[0][i], mod);
		int S1 = modpow(2, ans[1][i], mod);
		int S2 = modpow(2, ans[2][i], mod);
		int S3 = modpow(2, ans[3][i], mod);
		sum += (S0-1)*(S3-1)%mod;
		sum += (S1-1)*(S2-1)%mod;
		sum += (S0 - 1)*(S3 - 1)%mod*(S1 + S2 - 2) % mod;
		sum += (S1 - 1)*(S2 - 1)%mod*(S0 + S3 - 2) % mod;
		sum += (S0 - 1)*(S1 - 1) % mod*(S2 - 1) % mod*(S3 - 1) % mod;
		sum %= mod;
	}
	cout << sum << endl;
}

Measured memory_bytes: 67436
#include<bits/stdc++.h>
using namespace std;
long long n,k,t,u,v,l,d[210],a,p,q;

int main(){
  cin>>n>>k>>t>>u>>v>>l;
  for(int i=1;i<=n;i++)cin>>d[i];
  d[n+1]=l;
  for(int i=1;i<=n+1;i++){
    q=d[i]-d[i-1];
    if(a>q){
      a-=q;
      a=min(a+v*t,v*t*(k+1));
    }
    else p+=q-a,a=v*t;
  }
  printf("%.8f\n",1.0*p/u+1.0*(l-p)/v);
  return 0;
}

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

int main(){
  long long a, b;
  cin >> a >> b;
  
  long long ans = 0;
  if(a % 2) ans += a++;
  if(b % 2 == 0) ans ^= b--;
  if((b - a + 1) % 4) ans ^= 1;
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(int argc, char* argv[]) {
    int N, T;
    std::cin >> N >> T;

    auto c = new int[N];
    auto t = new int[N];
    for (int i = 0; i < N; i++) {
        std::cin >> c[i] >> t[i];
    }

    int min = 1001;
    for (int i = 0; i < N; i++) {
        if (t[i] <= T) {
            if (min > c[i])
                min = c[i];
        }
    }
    if (min == 1001) 
        std::cout << "TLE" << std::endl;
    else
        std::cout << min << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n,hantei_before=0,hantei=0;
  cin >>n;
  ll x[n],y[n];
  bool out=false;
  for(ll i=0;i<n;i++){
    cin >>x[i] >>y[i];
    hantei=(abs(x[i])+abs(y[i]))%2;
    if(i!=0 && hantei_before!=hantei){
      out=true;
      cerr<<hantei_before<<" "<<hantei;
    }
    hantei_before=hantei;
  }
  if(out)cout <<-1<<endl;
  else if(hantei%2==1){
    ll m=31;
    ll d[m];
    d[m-1]=1;
    cout <<m <<endl;
    for(ll i=m-2;i>=0;i--)d[i]=d[i+1]*2;
    for(ll i=0;i<m-1;i++)cout <<d[i]<<" ";
    cout <<d[m-1]<<endl;
    for(ll i=0;i<n;i++){
      for(ll j=0;j<m;j++){
        if(abs(x[i])>abs(y[i]) && x[i]>0){
          cout<<"R";
          x[i]-=d[j];
        }
        else if(abs(x[i])<abs(y[i]) && y[i]>0){
          cout<<"U";
          y[i]-=d[j];
        }
        else if(abs(x[i])>abs(y[i]) && x[i]<0){
          cout <<"L";
          x[i]+=d[j];
        }
        else if(abs(x[i])<abs(y[i]) && y[i]<0){
          cout <<"D";
          y[i]+=d[j];
        }
      }
      cout <<endl;
    }
    
  }
  else if(hantei%2==0){
    ll m=32;
    ll d[m];
    d[m-1]=1;
    d[m-2]=1;
    cout <<m <<endl;
    for(ll i=m-3;i>=0;i--)d[i]=d[i+1]*2;
    for(ll i=0;i<m-1;i++)cout <<d[i]<<" ";
    cout <<d[m-1]<<endl;
    for(ll i=0;i<n;i++){
      x[i]--;
      for(ll j=0;j<m-1;j++){
        if(abs(x[i])>abs(y[i]) && x[i]>0){
          cout<<"R";
          x[i]-=d[j];
        }
        else if(abs(x[i])<abs(y[i]) && y[i]>0){
          cout<<"U";
          y[i]-=d[j];
        }
        else if(abs(x[i])>abs(y[i]) && x[i]<0){
          cout <<"L";
          x[i]+=d[j];
        }
        else if(abs(x[i])<abs(y[i]) && y[i]<0){
          cout <<"D";
          y[i]+=d[j];
        }
      }
      cout <<"R";
      cout <<endl;
    }
    
  }
}

Measured memory_bytes: 256
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

n = onem()

a = list(input())

a = s(a)

print(len(a))



Measured memory_bytes: 49520
#include <stdio.h>

int solve(int*,int,int);
int n;

int main(){

  int i,q,m;

  scanf("%d",&n);
  int A[n];
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&m);
    if(solve(A,0,m) == 1) printf("yes\n");
    if(solve(A,0,m) == 0) printf("no\n");
  }

  return 0;
}

int solve(int A[],int k,int m){
  
  if(m == 0) return 1;
  
  if(k >= n) return 0;

  return solve(A,k + 1, m) || solve(A,k + 1, m - A[k]);
  

}



Measured memory_bytes: 2052