akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) x.begin(),x.end()
#define fi first
#define se second
#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
typedef vector<PII> VPII;
typedef vector<PLL> VPLL;
typedef vector<LL> VLL;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<char> VC;
typedef long double LD;
typedef pair<LD,LD> PLD;
typedef vector<LD> VLD;
typedef vector<PLD> VPLD;
typedef map<int, int> MII;
typedef map<int, VI> MIVI;
typedef map<LL, LL> MLLLL;
typedef map<LL, VLL> MLLVLL;

template<typename T>
void dbg(T a)
{
      #ifdef LOCAL
            cerr<<a<<"\n";
      #endif
}

template<typename T, typename ...Arg>
void dbg(T a,Arg ...arg)
{
      #ifdef LOCAL
            cerr<<a<<" ";
            dbg(arg...);
      #endif
}

const int maxn = (1e6)+7;
const int inf = (1e9)+7;
const LL LLinf = (1e18)+7;
const LD eps = 1e-9;
const LL mod = 1e9+7;

// ***************************** CODE ***************************** //

set<PII> pocz, kon;
int l[maxn], p[maxn];
int n;

LL rob()
{
      LL res = 0LL;
      int cur = maxn;
      for(int i = 1 ;i <= n;i++)
      {
            pocz.insert({l[i], i});
            kon.insert({p[i], i});
      }
      bool f = 0;
      while(SZ(pocz))
      {
            if(f == 0)
            {
                  auto it = pocz.end();
                  it--;
                  int gdzie = it->first;
                  int kto = it->second;
                  pocz.erase({l[kto], kto});
                  kon.erase({p[kto], kto});
                  res += (LL)max(0, gdzie - cur);
                  cur += max(0, gdzie - cur);
            }
            else
            {
                  auto it = kon.begin();
                  int gdzie = it->first;
                  int kto = it->second;
                  pocz.erase({l[kto], kto});
                  kon.erase({p[kto], kto});
                  res += (LL) max(0, cur - gdzie);
                  cur -= max(0, cur - gdzie);
            }
            f ^= 1;
      }
      res += abs(cur - maxn);
      return res;
}

int main()
{
      _upgrade
      cin>>n;
      for(int i = 1;i <=n;i++)
      {
            cin>>l[i]>>p[i];
            l[i] += maxn;
            p[i] += maxn;
      }
      LL res = rob();
      for(int i = 1;i <= n;i++)
      {
            l[i] = 2 * maxn - l[i];
            p[i] = 2 * maxn - p[i];
            swap(l[i], p[i]);
      }
      res = max(res, rob());
      cout<<res;
      return 0;
}


Measured memory_bytes: 14080
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
//1-indexed
#include<vector>
template<typename T>
struct BIT{
	int n;
	vector<T>bit;
	BIT(int n_=0):n(n_),bit(n_+1){}
	T sum(int i)
	{
		T ans=0;
		for(;i>0;i-=i&-i)ans+=bit[i];
		return ans;
	}
	void add(int i,T a)
	{
		if(i==0)return;
		for(;i<=n;i+=i&-i)bit[i]+=a;
	}
	int lower_bound(T k)//k<=sum(ret)
	{
		if(k<=0)return 0;
		int ret=0,i=1;
		while((i<<1)<=n)i<<=1;
		for(;i;i>>=1)
			if(ret+i<=n&&bit[ret+i]<k)k-=bit[ret+=i];
		return ret+1;
	}
};
int N;
int A[50],B[50];
main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>A[i];
	for(int i=0;i<N;i++)cin>>B[i];
	long ans=9e18;
	for(int i=0;i<1<<N;i++)
	{
		vector<pair<int,int> >now[2];
		for(int j=0;j<N;j++)
		{
			if(i>>j&1)
			{
				now[1-j%2].push_back(make_pair(B[j],j));
			}
			else
			{
				now[j%2].push_back(make_pair(A[j],j));
			}
		}
		if(now[0].size()!=(N+1)/2||now[1].size()!=N/2)continue;
		for(int j=0;j<2;j++)sort(now[j].begin(),now[j].end());
		vector<pair<int,int> >X;
		for(int i=0;i<now[0].size();i++)
		{
			X.push_back(now[0][i]);
			if(i<now[1].size())X.push_back(now[1][i]);
		}
		bool ok=true;
		for(int i=0;i<N-1;i++)
		{
			if(X[i].first>X[i+1].first)
			{
				ok=false;
				break;
			}
		}
		if(!ok)continue;
		BIT<int>P(N);
		long cnt=0;
		for(pair<int,int>p:X)
		{
			P.add(p.second+1,1);
			cnt+=p.second+1-P.sum(p.second+1);
		}
		ans=min(ans,cnt);
	}
	if(ans>6e18)ans=-1;
	cout<<ans<<endl;
}


Measured memory_bytes: 384
function Main(input) {
  line = input.split(' ');
  var sum = 0;
  for (var i = 0; i < line.length; i++) {
    sum += parseInt(line[i]);
  }
  console.log(sum);
}

function debug() {
  input = document.getElementById('id1').value;
  Main(input);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));



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

int main()
{
  string S;
  cin >> S;
  int cnt = 0;
  for (int i = 0; i < S.size(); i++)
  {
    if (S.at(i) == 'x')
      cnt++;
  }
  if (cnt >= 8)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
}


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

int main() {
  int x;
  cin >> x;
  int maxm = -1;
  for(int b = 1; b*b <= x; b++) {
    for(int q = 2; q <= 10; q++) {
      int ans = 1;
      rep(i, q) {
        ans *= b;
      }
      if(ans <= x) maxm = max(maxm, ans);
    }
  }
  cout << maxm << endl;
  return 0;
}
  

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int M = 1e6 + 5;
int n;

bool check(string ans)
{
	int cur = 0;
	for(auto &c : ans)
	{
		cur += (c == '(' ? 1 : -1);
		if(cur < 0)
			return 0;
	}
	return cur == 0;
}
 
int32_t main() 
{
	ios_base::sync_with_stdio(0);	cin.tie(0);	cout.tie(0);
	cin >> n;
	vector <string> s(n);
	vector <pair <int, int>> pos, neg;
	string ans = "";
	for(int i = 0; i < n; i++)
	{
		cin >> s[i];
		int bal = 0, mn = 1e9;
		for(auto &c : s[i])
		{
			bal += (c == '(' ? 1 : -1);
			mn = min(mn, bal);
		}
		if(mn < 0)
		{
			if(bal > 0)	pos.push_back({mn, i});
			else		neg.push_back({mn - bal, i});
		}
		else	ans += s[i];
	}
	sort(pos.rbegin(), pos.rend());
	sort(neg.begin(), neg.end());
	for(auto &i : pos)
		ans += s[i.second];
	for(auto &i : neg)
		ans += s[i.second];
	// cout << ans << "\n";
	cout << (check(ans) ? "Yes" : "No"); 
    	return 0;
}

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

int main(void) {
    int c[3][3], x1, x2, y1, y2;
    bool flag = true;
    for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
            cin >> c[i][j];
        }
    }
    x1 = c[0][0] - c[0][1];
    x2 = c[0][1] - c[0][2];
    y1 = c[0][0] - c[1][0];
    y2 = c[1][0] - c[2][0];
    for (int i = 0; i < 3; i++) {
        if (c[i][0] - c[i][1] != x1 || c[i][1] - c[i][2] != x2) flag = false;
    }
    for (int j = 0; j < 3; j++) {
        if (c[0][j] - c[1][j] != y1 || c[1][j] - c[2][j] != y2) flag = false;
    }
    cout << (flag ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
#インポート
import sys
 
#入力用
def ILI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def ISI(): return map(int, sys.stdin.readline().rstrip().split())
def II(): return int(sys.stdin.readline().rstrip())
def ISS(): return sys.stdin.readline().rstrip().split()
def IS(): return sys.stdin.readline().rstrip()
 
N = II()
sum = N*(1+N)//2
print(sum-N)

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

int main() {
	int N;
	cin >> N;
	char left = ' ';
	int ans = 0;
	for (int i = 0; i < N; i++) {
		char c;
		cin >> c;
		if (left != c) ans++;
		left = c;
	}
	cout << ans << endl;
}

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

const int MAXN = 100000;

int main() {
	int n;
	long long m;
	cin >> n >> m;
	long long a[MAXN + 1];
	a[0] = 0;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	sort(a + 1, a + n + 1);
	long long left = a[1] * 2, right = a[n] * 2;
	auto count = [&](long long x) {
		long long result = 0;
		for (int i = 1, j = n; j > 0; j--) {
			while (i <= n && a[i] + a[j] < x) {
				i++;
			}
			result += n + 1 - i;
		}
		return result;
	};
	while (left < right) {
		long long mid = (left + right) / 2;
		if (count(mid) <= m) {
			right = mid;
		}
		else {
			left = mid + 1;
		}
	}
	long long finalCount = count(left);
	cerr << finalCount << " " << left << endl;
	if (finalCount > m) {
		cout << m * left << endl;
		return 0;
	}
	for (int i = 1; i <= n; i++) {
		a[i] += a[i - 1];
	}
	long long result = 0;
	for (int i = 1, j = n; j > 0; j--) {
		while (i <= n && a[i] - a[i - 1] + a[j] - a[j - 1] < left) {
			i++;
		}
		// cout << i << ' ' << j << ' ' << 2 * ((j - i + 1) * (a[i] - a[i - 1]) + a[j] - a[i - 1]) << endl;
		result += a[n] - a[i - 1] + (a[j] - a[j - 1]) * (n - i + 1);
	}
	cout << result + (m - finalCount) * (left - 1) << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main(){

  int w,h,x,y,r;
  scanf("%d%d%d%d%d",&w,&h,&x,&y,&r);
  if(x-r>=0 && y-r>=0 && x+r<=w && y+r<=h) printf("Yes\n");
  else printf("No\n");
  return 0;
}

Measured memory_bytes: 584
#include <bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp> 
//using namespace __gnu_pbds; 
#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int> >, rb_tree_tag,tree_order_statistics_node_update>
#define standardVar ll n,m,i,j,k,num,num1,num2,flag=0
#define nn <<"\n"
#define __ <<" "<<
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define ff first
#define ss second
#define all(v) v.begin(),v.end()
#define ittr(x,v) for(auto x=v.begin();x!=v.end();x++)
#define itr(x,n) for(x=0;x<n;x++)
#define itrab(x,a,b) for(x=a;x<b;x++)
#define itpr(v) ittr(x,v)cout<<*x<<" "; cout nn
#define itppr(v) ittr(x,v)cout<<(*x).ff<<" "<<(*x).ss<<"  "; cout nn
#define pi 3.14159265359
#define dTor(x) ((x)*pi)/180.0

typedef long long int ll;       //TYPEDEFS
typedef long double ld;
typedef vector<ll> vl;
typedef map<ll,ll> ml;
typedef set<ll> sl;
typedef string str;
typedef pair<ll, ll> pl;
typedef vector< pl > vpl;
typedef map<pl,ll> mpl;
typedef set< pl > spl;
typedef vector<str> vst;
typedef vector<vl> vvl;

const ll M=1000000007;          //COMMON MODULO
const ll N=998244353;

ll power(ll x, ll y, ll p){     //MODULAR EXPONENTIATION
    ll res=1;
    x=x%p;
    if(x==0)
        return 0;
    while(y>0){
        if(y&1)
            res=(res*x)%p;
        y=y>>1;
        x=(x*x)%p;
    }
    return res;
}
ll inv(ll x, ll m){             //FERMAT INVERSE
    return power(x,m-2,m);
}
struct comp{                    //COMPARISON ON PAIRS
    template<typename T>        
    bool operator()(const T &a, const T &b){
        if (a.ff==b.ff)
            return (a.ss<b.ss);
        else
            return (a.ff<b.ff);
    }
};
bool mod(const pair<ll,ll> &a, const pair<ll,ll> &b){   //COMPARATOR FOR PAIRS (SORTING)
    if(a.ff!=b.ff)
        return (a.ff<b.ff);
    else
        return (a.ss<b.ss);
}
void sieve(vl &prime){          //SIEVE OF ERATOSTHENES
    ll maxN=1e6;
    vector<bool> pr(maxN+1,1);
    for(int i=2;i*i<=maxN;i++)
        if(pr[i]==1)
            for(int j=i*i;j<=maxN;j+=i)
                pr[j]=0;
    for(ll i=2;i<=maxN;i++)
        if(pr[i]==1)
            prime.pb(i);
}
bool isValid(ll i, ll j, ll n, ll m){   //CHECKS FOR OVERFLOW
    if(i>=0&&i<n&&j>=0&&j<m){
        return true;
    }
    return false;
}

//MAIN FUNCTION STARTS HERE

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    standardVar;
    int t;
    cin>>t;
    cout<<t+t*t+t*t*t nn;
    return 0;
}

Measured memory_bytes: 3648
a = []
for i in range(3):
    a.append(list(map(int,input().split())))
n = int(input())
for i in range(n):
    b = int(input())
    for j in range(3):
        for k in range(3):
            if a[j][k] == b:
                a[j][k] = 0
if sum(a[0]) == 0 or sum(a[1]) == 0 or sum(a[2]) == 0:
    print('Yes')
elif a[0][0]+a[1][0]+a[2][0] == 0:
    print('Yes')
elif a[0][1]+a[1][1]+a[2][1] == 0:
    print('Yes')
elif a[0][2]+a[1][2]+a[2][2] == 0:
    print('Yes')
elif a[0][0]+a[1][1]+a[2][2] == 0:
    print('Yes')
elif a[0][2]+a[1][1]+a[2][0] == 0:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
long long mod = 1e9+7;

int main(void) {
  int n; cin >> n;
  vector<int> a(n);
  for(int i=0; i<n; i++) cin >> a[i];

  int cnt = 0;
  multiset<int> st;

  for(int i=0; i<n; i++) {
    auto it = st.upper_bound(-a[i]);

    if(it == st.end()) {
      cnt++;
    }else{
      st.erase(it);
    }
    st.insert(-a[i]);

  }

  cout << cnt << endl;

  return 0;
}

// EOF


Measured memory_bytes: 5376
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	int c[3][3];
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> c[i][j];
		}
	}
	int a[3], b[3];
	for (int i = 0; i < 100; i++) {
		bool ok = true;
		a[0] = i;
		for (int j = 0; j < 3; j++) b[j] = c[0][j] - a[0];
		for (int j = 1; j < 3; j++) a[j] = c[j][0] - b[0];
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {
				if (c[j][k] != a[j] + b[k]) ok = false;
			}
		}
		if (ok) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define int ll
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10; 

int32_t main(){
   ios::sync_with_stdio(false);
   cin.tie(NULL);
   string s;
   cin >> s;
   int c = 0;
   for(auto &e : s){
      c |= (e == '7');
   }
   if(c){
      cout << "Yes\n";
   }else{
      cout << "No\n";
   }
   return 0;
} 


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
using ll = long long;
using namespace std;
template <typename T> using vec = std::vector<T>;

int main() {
    int N;
    string S;
    cin >> N >> S;
    int now = 0;
    int ans = 0;
    for (auto e : S) {
        if (e == 'I') ++now;
        else
            --now;
        ans = max(ans, now);
    }
    cout << ans << '\n';
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> a(N);
  vector<int> b(N);
  vector<int> c(M);
  vector<int> d(M);
  for (int i = 0; i < N; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < M; i++) {
    cin >> c[i] >> d[i];
  }
  for (int i = 0; i < N; i++) {
    int Min = 999999999, MinN = 0;
    for (int j = 0; j < M; j++) {
      int dist = abs(a[i] - c[j]) + abs(b[i] - d[j]);
      if (dist < Min) {
        Min = dist;
        MinN = j;
      }
    }
    cout << MinN + 1 << endl;
  }
}

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

int main(){
    int a,b;
    string s,t,u;
    cin >> s >> t >> a >> b >> u;

    if(u == s){
        a--;
    }
    if(u == t){
        b--;
    }
    cout << a << " " << b << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] L = new int[N]; 
        int max = 0;
        int sum = 0;
        
        for(int i = 0; i < N; i++){
            L[i] = sc.nextInt();
        }
        
        for(int i = 0; i < N; i++){
            if(max < L[i]){
                max = L[i];
            }
            sum += L[i];
        }
        
        if(max < sum - max){
                System.out.println("Yes");
        }else{
                System.out.println("No");
        }
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include <iomanip>
#include <math.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define PI 3.14159265359
using namespace std;
using ll = long long;
using P = pair<int, int>;

const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

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

ll abs(ll a, ll b) {
  return a > b ? a - b : b - a;
}

ll sign(ll a, ll b) {
  return ((a > 0) && (b > 0)) || ((a < 0) && (b < 0)) ? 1 : -1;
}

void swap(ll& a, ll& b) {
  ll tmp = a; a = b; b = tmp;
  return;
}

void init_vec(ll a, ll b, map<pair<ll, ll>, P>& groups) {
  map<pair<ll, ll>, P>::iterator ite;
  ite = groups.find(make_pair(a, b));
  if (ite == groups.end()) {
    groups[make_pair(a, b)].first = 0;
    groups[make_pair(a, b)].second = 0;
  }
  return;
}

int main() {
  int n;
  cin >> n;
  map<pair<ll, ll>, P> groups;
  mint cnt00 = 0; int cnt01 = 0, cnt10 = 0;
  rep(i, n) {
    ll a, b;
    cin >> a >> b;
    if ((a == 0) && (b == 0)) {
      cnt00 += 1;
    } else if (a == 0) {
      cnt01 += 1;
    } else if (b == 0) {
      cnt10 += 1;
    } else {
      ll g = gcd(abs(a), abs(b));
      a /= g; b /= g;

      if (sign(a, b) == 1) {
        init_vec(abs(a), abs(b), groups);
        groups[make_pair(abs(a), abs(b))].first += 1;
      }

      else {
        swap(a, b);
        init_vec(abs(a), abs(b), groups);
        groups[make_pair(abs(a), abs(b))].second += 1;
      }

    }
  }
  mint two = 2;
  mint cnt1 = two.pow(cnt01) - 1, cnt2 = two.pow(cnt10) - 1, cnt3 = 1;
  for (auto p : groups) {
    mint cnt = cnt1 + cnt2 + cnt3;
    cnt1 = cnt * (two.pow(p.second.first) - 1);
    cnt2 = cnt * (two.pow(p.second.second) - 1);
    cnt3 = cnt;
  }
  cnt00 += cnt1 + cnt2 + cnt3 - 1;
  cout << cnt00.x << endl;
  
  return 0;
}

/*
6
1 2
4 -2
-3 6
8 4
5 10
-5 10

9
3 4
6 1
2 4
5 3
4 6
1 5
6 2
4 5
5 6
*/

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

int main() {
    int n,w;
    cin>>n>>w;
    long long val[n];
    long long  weight[n];
    
    int i,j;
    for(i= 0 ;i < n; i++)
    {
        cin>>weight[i];
        cin>>val[i];
    }
    
    long long dp[n+1][w+1];
    memset(dp, 0, sizeof(dp));
    
    for(i= 1 ;i <= n; i++)
    {
        for(j= 1; j <= w ;j++)
        {
            if(weight[i-1] <= j)
            {
                dp[i][j] = max(val[i-1] + dp[i-1][j - weight[i-1]], dp[i-1][j]);
            }
            else
                dp[i][j] = dp[i-1][j];
        }
    }

    cout<<dp[n][w];
}

Measured memory_bytes: 79104
#include <iostream>

using namespace std;

int main(int argc, char const *argv[]) {
  long long int n, temp;
  cin >> n;
  long long int sn;
  temp = n;
  while (temp > 0) {
    sn += temp % 10;
    temp /= 10;
  }
  if (n % sn == 0) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


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

using ll = long long int;
using vi = vector<int>;
using vii = vector<vi>;

#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i, a, b) for(int (i) = a; (i) < (b);(i)++)
#define MAX(a, b) ((a > b) ? a : b)
#define MIN(a, b) ((a > b) ? b : a)

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};



int main(){
  string s;
  cin >> s;
  int n = s.size(), ans = 0;
  REP(i, n-1){
    if(s.at(i) != s.at(i + 1)){
      ans++;
    }
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 512
arr = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
a_count = Array.new(26)
s_count = 0
count = 0
26.times do |i|
  a_count[i] = 0
end
s = []
while s[s_count] = gets
  s[s_count] = s[s_count].downcase.split("")
  s_count += 1
end
s.flatten!
arr.each do |item|
  s.size.times do |i|
    if s[i] == item
      a_count[count] += 1
    end
  end
  puts "#{item} : #{a_count[count]}"
  count += 1
end

Measured memory_bytes: 8708
fun main(args: Array<String>) {
  val (n, a, b)= readLine()!!.split(" ").map(String::toInt)
//  if (a == 1) {
//    if (b == n) {
//      println((1..n).toList().joinToString(" "))
//      return
//    } else {
//      println(-1)
//      return
//    }
//  }
//  if (b == 1) {
//    if (a == n) {
//      println((n downTo 1).toList().joinToString(" "))
//      return
//    } else {
//      println(-1)
//      return
//    }
//  }

  if (a + b > n + 1) {
    println(-1)
    return
  }

  if (a.toLong() * b.toLong() < n.toLong()) {
    println(-1)
    return
  }

  val ys = IntArray(a)
  ys[0] = b
  for (k in 0 until (n - b)) {
    ys[k % (a - 1) + 1]++
  }

  val xs = mutableListOf<Int>()
  var base = 0
  for (y in ys) {
    for (x in base + y downTo base + 1) {
      xs.add(x)
    }
    base += y
  }
  println(xs.joinToString(" "))
}


Measured memory_bytes: 63180
/*
ID: flashysport101
LANG: C++
TASK:
*/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ld, ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;

#define F0R(i, a, b) for (int i = (a); i < (b); i++)
#define FOR(i, a) for (int i = 0; i < (a); i++)
#define F0RR(i, a, b) for (int i = (b) - 1; i >= (a); i--)
#define FORR(i, a) for (int i = (a) - 1; i >= 0; i--)

#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound

#define n << "\n"
#define k << " " <<

const int MOD = 1000000007;
const ll INF = 1e18;
const int MAXN = 1e5;
const string name = "paintbarn";

int main() {
  //ifstream cin(name + ".in"); ofstream fout(name + ".out");
  int N, A, B; cin >> N >> A >> B;
  cout << min(N*A,B) n;
}





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

unordered_map<int64_t,int64_t> freq_list(vector<int64_t> a){
  unordered_map<int64_t,int64_t> S;
  for(int i=0;i<a.size();++i){
    S[a.at(i)]=S[a.at(i)]+1;
  }
  return S;
}

int main(){
  int N;
  cin>>N;
  vector<int64_t> a(N);
  for(int i=0;i<N;++i){
    cin>>a.at(i);
  }

  unordered_map<int64_t,int64_t> S=freq_list(a);
  int sum=0;
  for(auto p:S){
    if(p.first>p.second){
      sum=sum+p.second;
    }
    else{
      sum=sum+(p.second-p.first);
    }
  }

  cout<<sum<<endl;

}

Measured memory_bytes: 5796
#include <bits/stdc++.h>
using namespace std;
double kyori (int x1,int x2,int y1,int y2){
    double A = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
    return A;
}
int main(void){
        cout << fixed << setprecision(100);
    int N;
    cin >> N;
    vector<int> X(N),Y(N);
    vector<double> Z(N);
    for(int i = 0; i < N; i++){
        cin >> X[i] >> Y[i];
    }
    double S = 0;
    for(int i = 0; i < N; i++){
        for(int j = 0; j < N; j++){
            Z[i] = kyori(X[i],X[j],Y[i],Y[j]);
            S += Z[i];
        }
    }
    cout << S / N << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

        public static void main(String[] args) {
            int n ,k,x,y;
            Scanner input =  new Scanner(System.in);
            n=input.nextInt();
            k=input.nextInt();
            x=input.nextInt();
            y=input.nextInt();
            if(n>k){
            System.out.println((k*x)+((n-k)*y));}
            else{
                System.out.println(n*x);
            }
        }

}

Measured memory_bytes: 26968
#include<bits/stdc++.h>
using namespace std;
int main(){

    int n,m,sum=0;
    cin>>n>>m;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    for(int i=0;i<m;i++){
        sum+=a[i];
    }
    cout<<sum<<endl;



}


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

int main()
{
    int r, c;

    cin >> r >> c;

    int array[128][128] = {0};
    int sum = 0;
    for (int i = 0; i < r; i++){
        for (int j = 0; j < c; j++){
            cin >> array[i][j];
            array[i][c] += array[i][j];
            array[r][j] += array[i][j];
            sum += array[i][j];
        }
    }
    array[r][c] = sum;
    for (int i = 0; i <= r; i++){
        for (int j = 0; j <= c; j++){
            cout << array[i][j] << "\n "[j < c];
        }
    }

    return 0;
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
using namespace std;
long long dp[101][123456];
int main(void){
	int N,W;
	cin >> N >> W;
	long long w[N],v[N];
	for(int i=0;i<N;i++){
		cin >> w[i] >> v[i];
	}
	//vの最大値を求める。
	
	//dp[i][j]i-1番目までを選んで総重量がj以下のときの価値の最大値
	for(int i=0;i<N;i++){
		for(int j=0;j<=W;j++){
			if(j-w[i]>=0){
				dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i]);
			}else{
				dp[i+1][j]=max(dp[i][j],dp[i+1][j]);
			}
		}
	}
	cout << dp[N][W] << endl;
}

Measured memory_bytes: 96128
#include <iostream>

using namespace std;

int main() {
  ios_base::sync_with_stdio(false);
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  if (e - a > k) cout << ":(" << endl;
  else cout << "Yay!" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

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 (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cout << a[i] << " "; cout << "\n"; }
ll dbgt = 1; void err() { cout << "passed " << dbgt++ << "\n"; }
template<class H, class... T> void err(H&& h,T&&... t){ cout<< h << (sizeof...(t)?" ":"\n"); if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
struct E{
    ll to, i;
    E(ll a, ll b) : to(a), i(b){};
};
ll R[30];
vvc<E> G;

bool dfs(ll now, ll goal, ll p, ll id){
    if (now == goal) return true;
    repa(e, G[now]){
        if (e.to == p) continue;
        if(dfs(e.to, goal, now, id)){
            R[id] |= 1LL << e.i;
            return true;
        }
    }
    return false;
}

int main() {
    init();
    ll N;
    cin >> N;
    G.resize(N);
    rep(i,N-1){
        ll a, b;
        cin >> a >> b;
        a--, b--;
        G[a].eb(b, i);
        G[b].eb(a, i);
    }

    ll M;
    cin >> M;
    rep(i,M){
        ll u, v;
        cin >> u >> v;
        u--, v--;
        dfs(u, v, -1, i);
    }

    ll ans = 0;
    rep(b, 1<<M){
        ll es = 0;
        rep(m, M) if (b & (1 << m)) es |= R[m];
        ll cnt = 1LL << (N - 1 - __builtin_popcountll(es)); //自由な辺の組合せの総数
        ans += (__builtin_popcountll(b) % 2 ? -cnt : cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
n=gets.to_i
h=gets.split.map &:to_i
c1=0
c2=0
(n-1).times do |i|
  if h[i]>=h[i+1]
    c1+=1
    c2=c1 if i==n-2&&c2<c1
  else
    c2=c1 if c2<c1
    c1=0
  end
end
puts c2

Measured memory_bytes: 9732
// 

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

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

using namespace std;

int main(){
    int a, b;
    cin >> a >> b;
    for(int i = 0; i <= 1001; i++){
        int t8 = i * 0.08;
        int t10 = i * 0.1;
        if(t8 == a && t10 == b){
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
s = input()
t = 'AKIHABARA'
if len(s) > len(t):
    print('NO')
    exit()
s += (len(t) - len(s)) * '#'
j = 0
for i in range(len(t)):
    if s[j] == t[i]:
        j += 1
    elif not (s[j] != 'A' and t[i] == 'A'):
        print('NO')
        exit()
print('YES')

Measured memory_bytes: 3064
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
    int N; cin >> N;
    int M = 0;
    int ans = 0;
    rep(i,N){
        int a,b; cin >> a >> b;
        if(M < a){
            ans = a+b;
            M = a;
        }
    }
    cout << ans << endl;
}

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

int64_t gcd(int64_t a, int64_t b) {
	int64_t c;
	while(a) {
		c = a; a = b%a; b = c;
	}
	return b;
}


int main() {
    #ifdef DEBUG
    std::ifstream in("/home/share/inputf.in");
    std::cin.rdbuf(in.rdbuf());
    #endif

    int64_t N, X;
    cin >> N >> X;
    int64_t ans = -1;
    for(int i = 0; i < N; i++) {
        int64_t tmp;
        cin >> tmp;
        if(ans < 0) {
            ans = abs(tmp - X);
        } else {
            ans = gcd(abs(tmp - X), ans);
        }
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()
#define sortAl(v) sort(all(v))
#define sortAlr(v)          \
  sort(v.begin(), v.end()); \
  reverse(v.begin(), v.end())

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T &a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T &a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
#define INF LLONG_MAX

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

  string s;
  cin >> s;

  ll n = s.size();

  vvll dp(n + 1, vll(2));

  dp[0][0] = s[n - 1] - '0';
  dp[0][1] = 1 + 10 - dp[0][0];

  REP(i, n) {
    ll v = s[n - 1 - i] - '0';

    dp[i][0] = v + min(dp[i - 1][0], dp[i - 1][1]);

    dp[i][1] = 11 - v + dp[i - 1][0];
    chmin(dp[i][1], 9 - v + dp[i - 1][1]);
  }

  cout << min(dp[n - 1][0], dp[n - 1][1]) << endl;

  return 0;
}


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

using namespace std;

int main()
{

    int N;
    string S;
//    string S_usiro;

    cin >> N >> S;

    long long  R_count = count(S.cbegin(), S.cend(), 'R');
    long long B_count = count(S.cbegin(), S.cend(), 'B');
    long long G_count = count(S.cbegin(), S.cend(), 'G');

    long long sum = R_count * B_count * G_count;

    for(int i=0;i<N-2;i++){
        for(int diff=1; i+(2*diff)<N;diff++){
            if(S[i]!=S[i+diff] && S[i+diff]!=S[i+(2*diff)] && S[i]!=S[i+(2*diff)]){
                sum--;
            }
        }
    }
   cout << sum << endl;

   return 0;
}

Measured memory_bytes: 3644
#define CIN_ONLY 1
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
const int MOD = 1000000007;
const ld PI = acos(ld(-1));
int fix(ll n) { return (n % MOD + MOD) % MOD; }
int fix(ll n, int MOD) { return (n % MOD + MOD) % MOD; }

int getLeast(int n)
{
  int pow2 = 1 << 30;
  while (pow2) {
    if (n & pow2) {
      return pow2 << 1;
    }
    pow2 >>= 1;
  }
  return 0;
}

int main()
{
  if (CIN_ONLY) {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  }
  int n;
  cin >> n;
  multiset<int> s;
  for (int i = 0; i < n; ++i) {
    int v;
    cin >> v;
    s.insert(v); 
  }
  int ans = 0;
  while (!s.empty()) {
    auto it = s.rbegin();
    int a = *it;
    int b = getLeast(a) - a;
    s.erase(next(it).base());
    auto it2 = s.find(b);
    if (it2 != s.end()) {
      s.erase(it2);
      ++ans;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 9600
/*
 *
 *   Author     : Amit Kumar
 *   Date    	: August 30 , 2019
 * 
 */

#include <climits>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <memory.h>
#include <cassert>
#define FAST_INPUT_OUTPUT
//#define MORE_THAN_ONE_TESTCASE // COMMENT IT

#define vi vector<int>
#define vl vector<long long>
#define mii map<int , int>
#define mll map<long long , long long>
#define msi map<string , i>
#define msl map<string , long long>
#define umii unordered_map<int,int>
#define umll unordered_map<long long ,long long>
#define umsi unordered_map<string , int>
#define umsl map<string , long long> 
#define si set<int>
#define sl set<long long>
#define pii pair<int , int >
#define psi pair<string,int>
#define psl pair<string , long > 
#define pll pair<long long , long long>
#define vpii vector<pii>
#define vpll vector<pll>
#define vpsi vector<psi>
#define vpsl vector<psl>
#define pqi priority_queue<int>
#define pql priority_queue<long long>
#define ub upper_bound
#define lb lower_bound
#define bint long long int
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define iv(v) for(auto &i:v){cin>>i;}
#define ov(v) for(auto i:v){cout<<i<<" ";}cout<<endl;
#define ovn(v) for(auto i:v){cout<<i<<endl;}
#define euv(v) for(auto i:v){cerr<<i<<" ";}cerr<<endl;
#define eovn(v) for(auto i:v){cerr<<i<<endl;}
#define os(s) for(auto itr:s){cout<<itr<<" ";}cout<<endl;
#define osn(s) for(auto itr:s){cout<<itr<<endl;}
#define eos(s) for(auto itr:s){cerr<<itr<<" ";}cerr<<endl;
#define eosn(s) for(auto itr:s){cerr<<itr<<endl;}
#define rep(i,x) for(auto (i)=0 ; (i)<(x); ++(i))
#define _rep(a,b) for(auto i=(a); i<(b); ++i)
#define ef else if
#define wh while
#define el else
#define ivv(x) int x; cin>>x
#define lv(x) bint x; cin>>x
#define sv(x) string x; cin>>x
#define cv(x) char x; cin>>x
#define fv(x) float x; cin>>x
#define dv(x) double x; cin>>x
#define endl '\n'
using namespace std;






auto SOLUTION_FUNCTION( void ) ->void {
    // your solution goes here 
    ivv(n);ivv(k);
    sv(s);
    k--;
    s[k] = tolower(s[k]);
    cout<<s<<endl;
    return ;
}




int main(void){
#ifdef FAST_INPUT_OUTPUT
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cout<<setprecision(10);
    cout<<fixed;
    cout<<boolalpha;
#endif
#ifdef MY_LOCAL_PROJECT
    freopen("input","r",stdin);
    freopen("output","w",stdout);
#endif
    int testcase = 1;


#ifdef MORE_THAN_ONE_TESTCASE
    cin>>testcase;
#endif
    
    while(testcase--){
        SOLUTION_FUNCTION();
    }

#ifdef MY_LOCAL_PROJECT
    cout<<"Time : "<<1.0*(double)clock()/CLOCKS_PER_SEC<<endl;
#endif
    return 0;
}

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

typedef struct _st{
    int id;
    int ac;
    int pena;
} status;

bool cmp(status& a, status& b){
    if(a.ac != b.ac){
        return a.ac > b.ac;
    }else if(a.pena != b.pena){
        return a.pena < b.pena;
    }else{
        return a.id < b.id;
    }
}

int main(){
    while(1){
        int t,p,r;
        cin >> t >> p >> r;
        if(t==0) break;

        vector<status> st(t);
        for(int i=0; i<t; i++){
            st[i].id=i+1;
            st[i].ac=0;
            st[i].pena=0;
        }
        vector<vector<int> > wrong(t+1, vector<int>(p+1, 0));
        for(int i=0; i<r; i++){
            int tid,pid,time;
            string msg;
            cin >> tid >> pid >> time >> msg;
            if(msg[0] == 'W'){
                wrong[tid][pid]++;
            }else{
                st[tid-1].ac++;
                st[tid-1].pena += wrong[tid][pid]*1200 + time;
            }
        }

        sort(st.begin(), st.end(),cmp);
        for(int i=0; i<t; i++){
            cout << st[i].id << " " << st[i].ac << " " << st[i].pena << endl;
        }
    }
    return 0;
}
    

Measured memory_bytes: 3172
import java.util.Scanner;

public class Main {
	private static int n = 0;
	private static int[] take = new int[4];
	private static int[] sozai;
	private static int ans = Integer.MAX_VALUE;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		n = sc.nextInt();
		take[1] = sc.nextInt();
		take[2] = sc.nextInt();
		take[3] = sc.nextInt();
		sozai = new int[n];
		for (int i = 0; i < n; i++) {
			sozai[i] = sc.nextInt();
		}
		sc.close();

		search("");
		System.out.println(ans);
	}

	private static void search(String pattern) {
		if (pattern.length() == n) {
			ans = Math.min(ans, calc(pattern));
			return;
		}
		for (int p = 0; p <= 3; p++) {
			search(pattern + p);
		}
	}

	private static int calc(String pattern) {
		int[] cnt = new int[4];
		int[] len = new int[4];
		for (int i = 0; i < pattern.length(); i++) {
			int p = Character.getNumericValue(pattern.charAt(i));
			cnt[p]++;
			len[p] += sozai[i];
		}

		int cost = 0;
		for (int p = 1; p <= 3; p++) {
			if (cnt[p] == 0) {
				return Integer.MAX_VALUE;
			}
			cost += Math.abs(take[p] - len[p]);
		}
		cost += (n - cnt[0] - 3) * 10;
//		System.out.println(pattern + ": " + cost);
		return cost;
	}
}


Measured memory_bytes: 40564
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");

  var tmp = input[0].split( ' ' );
  var e = parseInt( tmp[0] );
  var o = parseInt( tmp[1] );
  
  var a1 = combination( e, 2 );
  var a2 = combination( o, 2 );
  console.log( ( a1 + a2 ) );
}

function combination( n, m ){
  var r = 1;
  for( var i = 0; i < m; i ++ ){
    r *= ( n - i );
  }
  for( var i = 1; i <= m; i ++ ){
    r /= i;
  }
  
  return r;
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 25160
#include <bits/stdc++.h>
using namespace std;
int main(void){
    string n;
    cin>>n;
    for (int i=0;i<n.size();i++) {
        if (n.at(i)=='1') {
            cout<<9;
        } else if (n.at(i)=='9') {
            cout<<1;
        } else {
            cout<<n.at(i);
        }
    }
    cout<<endl;
}


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

using namespace std;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, m, cnt1 = 0, cnt2 = 0;
    cin >> n >> m;
    vector<int> a(n + 1, 0);
    vector<int> bad(n + 1, 0);
    for (int i = 0; i < m; i++)
    {
        int p;
        string s;
        cin >> p >> s;
        if (s == "AC")
        {
            if (a[p] == 0)
            {
                a[p] = 1;
                cnt1++;
            }
        } else
        {
            if (a[p] == 0)
                bad[p]++;
        }
    }

    for (int i = 1; i <= n; i++)
        if (a[i] == 1)
            cnt2 += bad[i];

    cout << cnt1 << " " << cnt2 << "\n";
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#define endl "\n"
using namespace std;

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

    int sum = a + b;
    if(sum >= 10)
    	cout << "error" << endl;
    else
    	cout << sum << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> p(n),q(n);
    rep(i,n) cin >> p[i];
    rep(i,n) cin >> q[i];
    vector<int> a(n);
    rep(i,n) a[i] = i+1;

    map<vector<int>, int> mp;
    do{
        mp[a] = mp.size();
    } while (next_permutation(a.begin(), a.end()));

    int ans = abs(mp[p] - mp[q]);
    cout << ans << endl;
}

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

int main(){
	int n, k;
  	string s;
  	cin >> n >> k >> s;
  
  	int score = 0;
  	rep(i, n-1){
    	if(s[i] == s[i+1]) score++;
    }
  	int ans = min(score+2*k, n-1);
  	cout << ans << endl;
}

Measured memory_bytes: 3756
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <numeric>
#include <math.h>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
#define mp make_pair;

const ll prime = 1000000000 + 7;
const ld PI = 2 * acos(0.0);

/*
cout << fixed << setprecision(10);
*/

bool my_comp(pll a, pll b) {
	if (a.first != b.first) {
		return a.first < b.first;
	}

	return a.second < b.second;
}

int main() {

	ll n;
	string s;
	cin >> n >> s;
	vector<char> a(3);
	ll cnt = 0;
	ll index;
	for (ll i = 0; i < 1000; i++)
	{
		a[0] = '0' + i % 10;
		a[1] = '0' + (i / 10) % 10;
		a[2] = '0' + (i / 100) % 10;

		index = 0;
		for (ll j = 0; j < s.size(); j++)
		{
			if (int(s[j]) == a[index]) {
				if (index == 2) {
					cnt++;
					break;
				}
				else {
					index++;
				}
			}
		}
	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 888
#include<cstdio>
#define rep(i,a) for( int i = 0; i != (a); ++i )

int main()
{
	int b[3];
	rep( i, 3 )
		scanf( "%d", b+i );

	puts( b[0]&b[1] || b[2] ? "Open" : "Close" );

	return 0;
}

Measured memory_bytes: 1012
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string ma;
	while (cin >> ma)
	{
		if (ma=="0")break;
		int sum = 0;
		for (int i = 0; i < ma.length(); i++)
			sum += (static_cast<int>(ma[i])-48);
		cout << sum << endl;
	}
	return 0;
}


Measured memory_bytes: 3224
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
typedef long long ll;
typedef pair<ll,int> P;
int main(){
	int a,b;
	cin>>a>>b;
	cout<<a*b<<" "<<2*a+2*b<<endl;
	return 0;
}


Measured memory_bytes: 3108
/*
    飲んだ魔剤で家が建つ。
    created at: 2020-04-09 16:31:34
*/

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

#define all(x) (x).begin(),(x).end()
#define rev(x) greater<x>()
#define MOD 1000000007
#define INF 1000000000

typedef long long LL;
typedef long double LD;

bool compare_by_b(pair<int, int> a, pair<int, int> b)
{
    if (a.second != b.second) {
        return a.second < b.second;
    } else {
        return a.first < b.first;
    }
}

LL modpower(LL n, LL m, LL mod)
{
    if (m == 0) {
        return 1;
    } else if (m % 2 == 0) {
        LL p = modpower(n, m/2, mod);
        return p*p % mod;
    } else {
        return n*modpower(n, m-1, mod) % mod;
    }
}

LL modinv(LL n, LL mod)
{
    return modpower(n, mod-2, mod);
}

LL modcombination(LL n, LL r, LL mod)
{
    LL ret = 1;

    for (int i = 0; i < r; i++) {
        ret *= (n-i);
        ret %= mod;
        ret *= modinv(i+1, mod);
        ret % mod;
    }

    return ret % mod;
}

int gcd(int k, int l)
{
    if (l > 0) return gcd(l, k%l);
    else return k;
}

struct UnionFind
{
    vector<int> par;

    UnionFind(int n) : par(n) {
        for (int i = 0; i < n; i++) par[i] = i;
    }

    int root(int x) {
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry) return;
        par[rx] = ry;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

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

    if (a + b >= c) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;

public class Main{
    static MyReader in = new MyReader();
    static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args){
        int N = in.i();
        char[] S = in.s().toCharArray();

        int ans = 0;
        for(int i = 0; i < 1000; i++){
            int ii = i;
            int key = ii%10;
            int count = 0;
            for(int j = 0; j < N; j++){
                if(key == S[j]-'0'){
                    if(++count == 3){
                        ans++;
                        break;
                    }
                    ii /= 10;
                    key = ii%10;
                }
            }
        }
        System.out.println(ans);
    }

    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }

        String s(){
            try{return readLine();}catch(IOException e){return "";}
        }

        String[] ss(){
            return s().split(" ");
        }

        int i(){
            return Integer.parseInt(s());
        }

        int[] ii(){
            String[] ss = ss();
            int[] ii = new int[ss.length];
            for(int j = 0; j < ss.length; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }

        ArrayList<Integer> li(){
            String[] ss = ss();
            ArrayList<Integer> li = new ArrayList<>();
            for(int j = 0; j < ss.length; j++) li.add(Integer.parseInt(ss[j]));
            return li;
        }

        long l(){
            return Long.parseLong(s());
        }

        long[] ll(){
            String[] ss = ss();
            long[] ll = new long[ss.length];
            for(int j = 0; j < ss.length; j++) ll[j] = Long.parseLong(ss[j]);
            return ll;
        }
    }
}


Measured memory_bytes: 22996