akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<ll> a(n);
    for(int i=0; i<n; i++){
        cin >> a.at(i);
    }
    ll cnt1=0,cnt2=0;
    ll tot=0;
    for(int i=0; i<n;i++){
        ll after;
        if(i%2==0){
            after=max(a.at(i), 1-tot);
        }
        else{
            after=min(-1-tot, a.at(i));
        }
        tot+=after;
        cnt1+=abs(after-a.at(i));
    }
    tot=0;
    for(int i=0; i<n;i++){
        ll after;
        if(i%2==1){
            after=max(a.at(i), 1-tot);
        }
        else{
            after=min(-1-tot, a.at(i));
        }
        tot+=after;
        cnt2+=abs(after-a.at(i));
    }
    cout << min(cnt1, cnt2) << endl;
}

Measured memory_bytes: 4024
#include"bits/stdc++.h"
#include<boost/multi_array.hpp>
#include<boost/range/irange.hpp>
#include<boost/range/algorithm.hpp>
#include<boost/range/adaptors.hpp>

namespace adaptor = boost::adaptors;

void solve()
{
    int64_t D, T, S;
    std::cin >> D >> T >> S;
    std::string ans = S * T >= D ? "Yes" : "No";
    std::cout << ans << std::endl;
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    solve();
}


Measured memory_bytes: 3652
import math



n = int(input())
num_list = list(map(int,input().split()))

gcd = num_list[0]
mult = 1

for i in range(n):
    gcd = math.gcd(gcd,num_list[i])
    mult = mult*num_list[i]

mod_num = gcd*mult-1

c = 0

for i in range(n):
    c += mod_num % num_list[i]

print(c)

Measured memory_bytes: 9288
#include<bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
  int N;
  string S;
  cin >> N;
  cin >> S;

  int r=0, g=0, b=0;

  for(auto c : S) {
    if(c=='R') r++;
    if(c=='G') g++;
    if(c=='B') b++;
  }

  int ans = r * g * b;

  for(int w=1; w<=N/2; w++) {
    for(int i=0; i<N; i++) {
      if(i+w+w >= N) continue;
      char ci = S[i]; 
      char cj = S[i+w]; 
      char ck = S[i+w+w]; 
      if(ci != cj && cj != ck && ck != ci) ans--;
    }
  }
  cout << ans << endl;
}


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

int main(){
  int n,m,a,b;cin>>n>>m;
  vector<int> h(n),s(n,0);
  rep(i,n)cin>>h[i];

  rep(i,m){
      cin>>a>>b;a--;b--;
      if(h[a]>h[b])a=b;
      else if(h[a]==h[b]){
        s[b]++;
      }
      s[a]++;
  }
  int sum=0;
  rep(i,n){
    if(s[i]==0)sum++;
  }
  cout<<sum;
}



Measured memory_bytes: 4000
n = int(input())
s = input()

right = 0
left = 0

for i in range(n):
    temp = s[i]
    if temp == '(':right += 1
    else:
        if right == 0:
            left += 1
        else:
            right -= 1

ans = left * '(' + s + right * ')'
print(ans)

Measured memory_bytes: 3060
N = int(input())
A = list(map(int, input().split()))

MOD = 10 ** 9 + 7

lst = [0] * 65
for a in A:
    tmp = a
    for i in range(61):
        lst[i] += tmp % 2
        tmp //= 2
        if tmp == 0:
            break

calc = [1]
for i in range(65):
    calc.append((calc[-1] * 2) % MOD)

ans = 0
for a in A:
    tmp = a
    for i in range(61):
        n = tmp % 2
        tmp //= 2
        if n == 1:
            ans += calc[i] * (N - lst[i])
        else:
            ans += calc[i] * lst[i]
    ans %= MOD

def modinv(a, m): #mod m でのaの逆元 a^{-1}を計算する
    b = m
    u = 1
    v = 0
    while b:
        t = a//b
        a -= t * b
        a, b = b, a
        u -= t * v
        u, v = v, u
    
    u %= m
    if u < 0:
        u += m
    return u

# print (ans)
ans *= modinv(2, MOD)
print (ans % MOD)

Measured memory_bytes: 123056
# include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<int,int>
typedef long long ll;
ll n,m,k,a[200005],b[200005];;
int binser(ll x){
    int ki=0,ka=m;
    int pos=0;
    while(ki<=ka){
        int mid=(ki+ka)/2;
        if(b[mid]<=x){
            pos=mid;
            ki=mid+1;
        }
        else ka=mid-1;

    }
    return pos;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>n>>m>>k;
    for(int i=1;i<=n;i++){
        ll x;cin>>x;
        a[i]=a[i-1]+x;
    }
    for(int i=1;i<=m;i++){
        ll x;cin>>x;
        b[i]=b[i-1]+x;
    }
    int ans=0;;
    for(int i=0;i<=n;i++){
        if(a[i]>k) break;
        ans=max(ans,i+binser(k-a[i]));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6692
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
        return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

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

        if ((b - a) % 2 == 0) {
                cout << (b - a) / 2 << endl; 
        } else {
                cout << min(a+(b-a-1)/2, n-b+(b-a-1)/2+1) << endl;
        }

        return 0;
}


Measured memory_bytes: 256
#include <cstdio>
int coin[]={500,100,50,10,5,1};
int main() {
	int value;
	while(scanf("%d",&value),value) {
		value=1000-value;
		int ans=0;
		for(int i=0;i<6;i++) {
			ans+=value/coin[i];
			value%=coin[i];
		}
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
#define rep(i,s,n) for (int i=s;i<n;++i)
#define drep(i,s,n) for (int i=n;i>=s;--i)
#define all(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define print(x) cout<<(x)<<endl
using namespace std;
typedef long long ll;

int gcd(int a,int b)
{if (a%b == 0) return(b);
 else          return(gcd(b,a%b));}
int lcm(int a,int b)
{return a*b/gcd(a,b);}
void printv(vector<auto> v) {cout<<'[';rep(i,0,v.size()){cout<<v[i]<<',';}cout<<']'<<endl;}
void printvv(vector<vector<auto>> vv)
{
  cout<<'['<<endl;
  rep(q,0,vv.size()){cout<<'[';rep(p,0,vv.at(q).size())cout<<vv.at(q).at(p)<<',';cout <<']'<<endl;}
  cout<<']'<<endl;
}
void solve(); int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}
int step_x[] = {-1,0,0,1};
int step_y[] = {0,-1,1,0};
ll INF=10e12;
//------------------------------------------------------------
ll N,M,X;
void solve() {
  cin>>N>>M>>X;

  vector<ll> C(N);
  vector<vector<ll>> A(N, vector<ll>(M));

  rep(i,0,N)
  {
    cin>>C[i];
    rep(j,0,M) cin >> A[i][j];
  }

  ll num = pow(2, N);
  vector<ll> ans(num);

  vector<vector<ll>> V(num, vector<ll>(M,0));
  // v[0]は全て0
  V[1].assign(all(A[0]));
  ans[1] += C[0];

  

  rep(i,1,N)
  {
    ll cn=pow(2,i);
    rep(j, 0, cn)
    {
      rep(k,0,M) V[cn+j][k] = V[j][k]+A[i][k];
      ans[cn+j] = ans[j]+C[i];
    }
  }

  ll count=INF;
  rep(i,0,num)
  {
    bool flag=true;
    rep(j,0,M) if(V[i][j]<X) {flag=false;break;}
    if(flag)count=min(count, ans[i]);
  }

  if(count<INF) print(count);
  else print(-1);

  return;
}



Measured memory_bytes: 4224
// Package main provides
//
// File:  b.go
// Author: ymiyamoto
//
// Created on Sun Jan  6 00:23:11 2019
//
package main

import "fmt"

func main() {
	var N int
	fmt.Scan(&N)

	var i int
	for ; i*i <= N; i++ {
	}
	fmt.Println((i - 1) * (i - 1))
}


Measured memory_bytes: 512
#include<vector>
#include<iostream>
#include<queue>
#include<climits>
using namespace std;
static const int INF = INT_MAX / 3;
struct edge{
  int from,to,cap,rev;
};
using graph = vector<vector<edge>>;
int dfs(int f,int v,int t,graph &g,vector<int> &level,vector<int> iter){
  if (v == t){
    return f;
  } 
  for(int &i = iter[v]; i <  g[v].size();i++){
    auto &e = g[v][i];
    if(e.cap > 0 and
       level[e.to] > level[v]){
      int d = dfs(min(f,e.cap), e.to, t, g, level,iter);
      if(d > 0){
        e.cap -= d;
        g[e.to][e.rev].cap += d;
        return d;
      }
    }
  }
  return 0;
}

int bfs(int s,int t,graph &g){
  using node = int;
  queue<node> q;
  vector<int> level(g.size(),-1);
  q.push(s);
  level[s] = 0;
  while(not q.empty()){
    auto v = q.front();q.pop();
    for(auto &e: g[v]){
      if(level[e.to] >= 0
         or e.cap <= 0) continue;
      q.push(e.to);
      level[e.to] = level[v] + 1;
    }
  }
  int d = 0,dd;
  vector<int> iter(g.size(),0);
  while((dd = dfs(INF,s,t,g,level,iter)) != 0){
    d += dd;
  }
  return d;
}

int max_flow(int s,int t,graph &g){
  int f = 0;
  while(true){
    int df = bfs(s,t,g);
    if (df == 0) break;
    f += df;
  }
  return f;
}

int main(){
  int v,e;
  cin >> v >> e;
  graph g(v);
  for(int i = 0; i < e;i++){
    int u,v,c;
    cin >> u >> v >> c;
    g[u].push_back({u,v,c,(int)g[v].size()});
    g[v].push_back({v,u,0,(int)g[u].size() - 1});
  }
  cout << max_flow(0,v-1,g) << endl;
}

Measured memory_bytes: 3152
import java.util.Map.Entry;
import java.util.*;
import java.math.*;
import org.w3c.dom.css.Counter;
  
public class Main{
    public static void main(final String[] args){
       
        final Scanner sc = new Scanner(System.in);
        //int N =sc.nextInt();
        //ArrayList<Integer>  allmen =new ArrayList <Integer>();
        //HashSet doubled =new HashSet<Integer>();
        String str = sc.next();
        if( Character.isUpperCase( str.charAt( 0 ) ) ) {
            System.out.println( "A" );
        }
        else {
            System.out.println( "a" );
        }
        //System.out.println(ans);
    }
}

Measured memory_bytes: 35692
using System;

namespace ABC045 {
    class Program {
        static void Main(string[] args) {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int h = int.Parse(Console.ReadLine());
            Console.WriteLine((a + b) * h / 2);
        }      
    }
}


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

const int M = 305;
const ll p = 1e9+7;

int c[M][M], n, r;
ll p2[M*M], dp[M][M];

ll ans = 0;

int compr() {
	for (int i = 0; i < n; ++i) {
		int ind = -1, m = n;
		for (int j = i; j < n; ++j) {
			for (int k = 0; k < n; ++k)
				if (c[j][k] == 1) {
					if (k < m)
						m = k, ind = j;
					break;
				}
		}
		if (ind == -1)
			return i;
		for (int j = 0; j < n; ++j)
			swap(c[i][j], c[ind][j]);
		for (int j = i+1; j < n; ++j)
			if (c[j][m] == 1)
				for (int k = 0; k < n; ++k)
					c[j][k] ^= c[i][k];
	}

	return n;
}

int main() {
	p2[0] = 1;
	for (int i = 1; i < M*M; ++i)
		p2[i] = 2*p2[i-1]%p;
	cin >> n;
	for (int i = 0; i < n; ++i)
		for (int j = 0; j < n; ++j)
			cin >> c[i][j];

	r = compr(); // cout << r << endl;
	dp[r][r] = 1;

	for (int i = 1; i <= r; ++i)
		dp[r][r] = dp[r][r]*(p+p2[n]-p2[i-1])%p;

	for (int i = r; i <= n-1; ++i)
		for (int j = r; j <= n-1; ++j) {
			dp[i+1][j] += dp[i][j]*p2[j-r];
			dp[i+1][j] %= p;
			dp[i+1][j+1] += dp[i][j]*(p+p2[n]-p2[j]);
			dp[i+1][j+1] %= p;
		}

	for (int i = 0; i <= n; ++i) {
		ans += dp[n][i]*p2[n*(n-i)];
		ans %= p;
	}

	cout << ans << endl;
}


Measured memory_bytes: 2048
#include<iostream>
#include<stack>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<iomanip>
#include<set>
#include<bitset>
#include<cmath>
#include<numeric>
#include<limits>

#define REP(i, m, n) for(int i = (m); i < (n); i++)
#define rep(i,n) REP(i,0,n)
#define NIL -1
using namespace std;
typedef long long ll;
typedef long long int lli;
static const int MOD = 10000007;
static const int MAX = 100005;


int N;
lli A[MAX];


int main(){
  cin >> N;
  rep(i,N) {
    int a;
    cin >> a; A[i] = a;
  }
  lli cnt1 = 0, cnt2 = 0;
  lli sum = 0;
  rep(i,N) {
    sum += A[i];
    if (i % 2 == 0) {
      if(sum <= 0) {
        cnt1 += (-1)*sum + 1;
        sum = 1;
      }
    } else {
      if (sum >= 0) {
        cnt1 += sum + 1;
        sum = -1;
      }
    }
  }

  sum = 0;
  rep(i, N) {
    sum += A[i];
    if (i % 2 == 1) {
      if(sum <= 0) {
        cnt2 += (-1)*sum + 1;
        sum = 1;
      }
    } else {
      if (sum >= 0) {
        cnt2 += sum + 1;
        sum = -1;
      }
    }
  }
  cout << min(cnt1, cnt2) << endl;
}


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

int N, T, E;
int x;

int main() {
    while (cin >> N >> T >> E) {
        int res = -1;
        for (int i = 0; i < N; ++i) {
            cin >> x;
            for (int j = T-E; j <= T+E; ++j) if (j % x == 0) res = i+1;
        }
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 1164
#include <stdio.h>
int main(void)
{
int i,j,n,k=1;	
	
i=100000;
scanf("%d",&n);

if(n==0){
printf("%d\n",i);
return 0;}

do{
	j=i*0.05;
i+=j;
if(i%1000!=0)i=i+1000-(i%1000);
k++;
}while(k<=n);

printf("%d\n",i);
return 0;
}

Measured memory_bytes: 592
N = int(input())
a = list(map(int,input().split()))

dic = {}
for i in range(1,N+1):
  dic[i] = a[i-1]
  
dic = sorted(dic.items(),key=lambda x:x[1])
l = [k[0] for k in dic]
print(' '.join(map(str,l)))

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

int main(){
  double l, r;
  string s;
  vector<int> L(4, 0), R(4, 0);
  while (std::getline(std::cin, s)) {
    sscanf(s.data(), "%lf %lf", &l, &r);
    if(l >= 1.1){
      L[0]++;
    }else if(l >= 0.6){
      L[1]++;
    }else if(l >= 0.2){
      L[2]++;
    }else{
      L[3]++;
    }
    if(r >= 1.1){
      R[0]++;
    }else if(r >= 0.6){
      R[1]++;
    }else if(r >= 0.2){
      R[2]++;
    }else{
      R[3]++;
    }
  }
  for (int i = 0; i < 4; i++) {
    std::cout << L[i] << " " << R[i] << std::endl;
  }
  return 0;
}




Measured memory_bytes: 3308
#pragma GCC optimize("Ofast")
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include<cmath>
#include <functional>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// --------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    vector<int> cnt(26,0);
    string S;
    cin >> S;
    for(int i=0; i<S.size(); i++){
        cnt[S[i]-'a']++;
    }
    for(int i=0; i<26; i++){
        if(cnt[i]%2){
            cout << "No\n";
            return 0;
        }
    }
    cout << "Yes\n";
    return 0;
}


Measured memory_bytes: 3652
#coding: utf-8
import numpy as np

valueA = list(map(int,input().split()))

valueB = [0] * valueA[0]

for i in range(valueA[0]):
    valueB[i] = input()
    
array = np.array(valueB)

array1 = np.sort(array)

for i in range(len(array1)):
    print(array1[i],end="")

Measured memory_bytes: 12508
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>

using namespace std;

void b_foods_loved_by_everyone(void) {
	int n, m,k;
	int* food;
	cin >> n >> m;
	food = (int*)calloc(m, sizeof(int));

	for (int i = 0; i < n; i++) {
		cin >> k;
		for (int j = 0; j < k; j++) {
			int x;
			cin >> x;
			food[x-1]++;
		}
	}

	int cnt = 0;
	for (int i = 0; i < m; i++) {
		if (food[i] == n) cnt++;
	}

	cout << cnt << endl;
}

int main()
{
    b_foods_loved_by_everyone();

    return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.flush();
	ll h,a;
	cin>>h>>a;
	ll p=h/a;
	if(h%a!=0)
	{
		p=p+1;}
		cout<<p<<endl;


return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>

#include <iostream>

#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>

#include <algorithm>

using namespace std;

int main(){
	int n, k;
	cin >> n >> k;
	string s;
	int res = 0;
	cin >> s;
	if (n == 1) {
		cout << 1 << endl;
		return 0;
	}
	vector<int> v;
	int index = 0;
	while (index < s.size()) {
		int c = 1;
		index++;
		while (index < s.size() && s[index] == s[index - 1]) {
			index++;
			c++;
		}
		v.push_back(c);
	}
	
	if (s[0] == '1') {
		if (v.size() <= 2 * k + 1) {
			for (auto vv : v)
				res += vv;
			cout << res << endl;
			return 0;
		}
		int temp = 0;
		int s = 0, e = 2 * k;
		for (int i = s; i <= e; i++)
			temp += v[i];
		res = max(res, temp);
		while (s + 1 < v.size() && e < v.size()) {
			temp -= v[s] + v[s+1];
			s += 2;
			if (e + 2 < v.size()) {
				temp += v[e + 2] + v[e+1];
				e+=2;
				res = max(res, temp);
			}
			else if (e + 1 < v.size()) {
				temp += v[e + 1];
				e += 1;
				res = max(res ,temp);
				cout << res << endl;
				return 0;
			}
		}
	}
	else {
		if (v.size() <= 2 * k) {
			for (auto vv : v)
				res += vv;
			cout << res << endl;
			return 0;
		}
		int temp = 0;
		int s = 0, e = 2 * k - 1;
		for (int i = s; i <= e; i++)
			temp += v[i];
		res = max(res, temp);
		while (s < v.size() && e < v.size()) {
			if (s == 0) { 
				temp -= v[s];
				s++;
			}
			else {
				if (s + 1 >= v.size()) {
					cout << res << endl;
					return 0;
				}
 				temp -= v[s] + v[s+1];
				s += 2;
			}
			if (e + 2 < v.size()) {
				temp += v[e + 2] + v[e+1];
				e+=2;
				res = max(res, temp);
			}
			else if (e + 1 < v.size()) {
				temp += v[e + 1];
				e += 1;
				res = max(res ,temp);
				cout << res << endl;
				return 0;
			}
		}
	}
	cout << res << endl;



}

Measured memory_bytes: 1020
//
// Created by kuroneko on 2019-09-07.
//

#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>

using namespace std;

typedef long long ll;

#define INF 1000000000000009LL
#define MOD 1000000007LL

typedef int Weight;
struct Edge {
    int src, dst;
    Weight weight;
    Edge(int src, int dst, Weight weight):src(src), dst(dst), weight(weight) {}
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

typedef vector<Weight> Array;
typedef vector<Array> Matrix;

int main() {
    int N, K; cin >> N >> K;
    string s; cin >> s;

    int res = 0;
    for (int i = 1; i < int(s.size()); i++) {
        if (s[i-1] == s[i]) res++;
    }

    vector<int> R, L;
    int idx = 0, r=0, l=0;
    while (idx != N && s[idx] != 'R') idx++;
    while (idx != N) {
        while (idx != N && s[idx] != 'L') idx++;
        while (idx != N && s[idx] != 'R') idx++;
        if (idx != N) l++;
    }
    idx = 0;
    while (idx != N && s[idx] != 'R') idx++;
    while (idx != N) {
        while (idx != N && s[idx] != 'R') idx++;
        while (idx != N && s[idx] != 'L') idx++;
        if (idx != N) r++;
    }

    if (r==0 || l==0) {
        cout << N - 1 << endl;
        return 0;
    }
    int sr=0, sl=0;
    if (s[0] == 'L') sl++;
    else sr++;
    if (s[int(s.size())-1] == 'L') sl++;
    else sr++;

    if (K >= min(r+sr, l+sl)) {
        cout << N-1 << endl;
        return 0;
    } else if (K >= min(r, l)){
        cout << res + min(r, l)*2 << endl;
    } else {
        cout << res + K*2 << endl;
    }
    return 0;


}


Measured memory_bytes: 888
#include <stdio.h>

#define MAX 100000

int linearSearch(int*,int,int);

int main(){

int n,s[MAX],q,t[MAX],i,j,count=0;

scanf("%d",&n);
for(i=0;i<n;i++) scanf("%d",&s[i]);
scanf("%d",&q);
for(i=0;i<q;i++) scanf("%d",&t[i]);

/*for(i=0;i<n;i++){
for(j=0;j<q;j++){

if(s[i]==t[j]) count++;

}
}*/

for(i=0;i<q;i++){

if(linearSearch(&s[0],n,t[i])==1) count++;

}

printf("%d\n",count);

return 0;

}

int linearSearch(int A[], int n, int key){

int i;

for(i=0;i<n;i++){

if(A[i]==key) return 1;

} 

return 0;

}

Measured memory_bytes: 648
use std::io::*;
use std::str::FromStr;

#[allow(dead_code)]
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 s: String = read();
    println!("{}{}", "2018/", s.split("/").skip(1).collect::<Vec<&str>>().join("/"));
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

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

signed main() {
  init();
  ll a, b;
  cin >> a >> b;

  ll ans = a;
  if (a > b) {
    ans--;
  }
  COUT(ans);
  return 0;
}

Measured memory_bytes: 3620
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;
namespace atcoder151
{
    public class MainClass
    {
        public static void Main(string[] args)
        {
            new MainClass().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            string[] array = Console.ReadLine().Split(' ').ToArray();
            int H = int.Parse(array[0]);
            int Y = int.Parse(array[1]);
            int ans = 0;
            if (H <= Y)
            {
                ans = 1;
            }
            else if (H % Y == 0)
            {
                ans = H / Y;
            }
            else {
                ans = H / Y + 1;
            }


            WriteLine(ans);
        }



        public class ConsoleInput
        {
            //string[] arr;
            //int x;
            //int y;
            //        for (int i = 0; i<n; i++)
            //        {
            //            arr = Console.ReadLine().Split(' ').ToArray();
            //x = int.Parse(arr[0]);
            //y = int.Parse(arr[1]);
            //var power = Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2));
            //            if (power <= d)
            //            {
            //                counter++;
            //            }
            //        }
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;
            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }
            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }
            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }

        }
    }
}


Measured memory_bytes: 28288
#!/usr/bin/env python3
#ABC84 D

import sys
import math
import bisect
from heapq import heappush, heappop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
mod = 10**9 + 7


def get_prime(n):
    is_prime = [True]*(n+1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2,n+1):
        for j in range(i*2,n+1,i):
            is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]

prime = get_prime(10**5)
ansprime = [float('inf')]*(10**5)
for i in range(1,10**5+1,2):
    if i not in prime:
        continue
    if (i+1)//2 not in prime:
        continue
    ansprime[i] = i
ansprime.sort()
q = int(input())
for _ in range(q):
    l,r = map(int,input().split())
    li = bisect.bisect_left(ansprime,l)
    ri = bisect.bisect_right(ansprime,r)
    print(ri-li)


Measured memory_bytes: 56268
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  FastIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
typedef long long ll;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VP = vector<P>;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }

int ans, n;

bool ok(ll x){
    vector<int> d(10);
    while(x){
        d[x%10]++;
        x /= 10;
    }
    if (d[3] >= 1 && d[5] >= 1 && d[7] >= 1) return true;
    else return false;
}

void dfs(ll x){
    if (x > n) return;
    if (ok(x)) ans++;
    x *= 10;
    for(int i =3; i <= 7; i += 2){
        dfs(x + i);
    }
}

int main(){
    cin >> n;
    ans = 0;
    dfs(0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i,m,n) for(int i=m;i<n;i++)
ll mod=1e9+7;

int main(){
  int n,k;
  cin>>n>>k;
  bool p[n];
  rep(i,0,n){
    p[i]=false;
  }
  rep(i,0,k){
    int d;
    cin>>d;
    rep(i,0,d){
      int a;
      cin>>a;
      p[a-1]=true;
    }
  }
  int ans=0;
  rep(i,0,n){
    if(!p[i]) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3636
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.Exception
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val m = sc.nextInt()
    val adj = Array(n) { mutableSetOf<Int>() }
    for (i in 0 until m) {
        val u = sc.nextInt() - 1
        val v = sc.nextInt() - 1
        adj[u].add(v)
        adj[v].add(u)
    }
    var isbipartite = true
    val color = Array(n) { 0 }
    val stack = Stack<Pair<Int, Int>>()
    stack.add(0 to 1)
    color[0] = 1
    while (stack.count() > 0) {
        val (v, c) = stack.pop()
        for (w in adj[v]) {
            if (color[w] == c) {
                isbipartite = false
                stack.clear()
                break
            } else if (color[w] == 0) {
                color[w] = -c
                stack.add(w to -c)
            }
        }
    }
    if (isbipartite) {
        val n1 = color.count { it == 1 }.toLong()
        val n2 = n - n1
        println(n1 * n2 - m)
    } else {
        println(n * (n - 1L) / 2 - m)
    }
}

fun main() {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}


Measured memory_bytes: 86144
#include<queue>
#include <bits/stdc++.h>
#include<cstdio>
#include <stdio.h>
#include <iostream>
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (n); i++)
#define MAX_N 50
#define MAX_K 50
using namespace std;
using ll = long long;

int n,K,cnt;
struct point {
    ll x, y;
};

int main(){
    cin >> n >> K;
    vector<long long> x(n), y(n);
    vector<point> xy(n);
    rep(i,n){
      cin >> x[i] >> y[i];
      xy[i] = {x[i], y[i]};
    }

    sort(all(x));
    sort(all(y));

    ll ans = (x[n-1]-x[0]) * (y[n-1] - y[0]);
    rep(i,n){
      rep(j,n){
        rep(k,n){
          rep(l,n){
            if (xy[l].x < xy[k].x && xy[j].y < xy[i].y){
              cnt = 0;
              rep(m,n){
                if(xy[l].x <= xy[m].x && xy[m].x <= xy[k].x && xy[j].y <= xy[m].y && xy[m].y <= xy[i].y){
                  cnt++;
                }
              }
              if(cnt >= K){
                ll S = (xy[i].y - xy[j].y)*(xy[k].x - xy[l].x);
                ans = min(ans,S);
            }
          }
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#define INFINITY 100000001
#define MAX 100
#define WHITE 0
#define GRAY 1
#define BLACK 2

int n,M[MAX][MAX];

void dijkstra(){
  int u, minv;
  int d[MAX], color[MAX];
  int i, v;
  
  for(i = 0; i < n; i++){
    d[i] = INFINITY;
    color[i] = WHITE;
  }

  d[0] = 0;
  color[0] = GRAY;

  while(1){
    minv = INFINITY;
    u = -1;
    for(i = 0; i < n; i++){
      if(minv > d[i] && color[i] != BLACK){
	u = i;
	minv = d[i];
      }
    }
    
    if(u == -1) break;
    color[u] = BLACK;

    for(v = 0; v < n; v++){
      if(color[v] != BLACK && M[u][v] != INFINITY){
	if(d[v] > d[u] + M[u][v]){
	  d[v] = d[u] + M[u][v];
	  color[v] = GRAY;
	}
      }
    }
  }
  for(i = 0; i < n; i++){
    printf("%d %d\n",i,d[i] == INFINITY ? -1 : d[i]);
  }
}

int main(){
  int i, j, k, c, u, v;
  
  scanf("%d",&n);

  for(i = 0; i < n; i++){
    for(j = 0; j < n; j++){
      M[i][j] = INFINITY;
    }
  }

  for(i = 0; i < n; i++){
    scanf("%d%d",&u,&k);
    for(j = 0; j < k; j++){
      scanf("%d%d",&v,&c);
      M[u][v] = c;
    }
  }

  dijkstra();
  
  return 0;
}



Measured memory_bytes: 2112
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(os.Stdout)

	n := getNextInt(scanner)
	ans := 0
	for i := 1; i <= n; i++ {
		if i >= 10 && i < 100 {
			continue
		}
		if i >= 1000 && i < 10000 {
			continue
		}
		if i >= 100000 && i < 1000000 {
			continue
		}
		ans++
	}

	fmt.Fprintln(writer, ans)

	writer.Flush()
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}
struct edge {
  ll to, cost;
};

int main() {
  int N; cin >> N;
  vector<ll> L(N); REP(i, N) cin >> L[i];
  int ans = 0;
  for(int i = 0; i < N; ++i) {
    for(int k = i + 1; k < N; ++k) {
      for(int m = k + 1; m < N; ++m) {
        if(L[i] == L[k] || L[i] == L[m] || L[k] == L[m]) continue;
        ll a = L[i] + L[k];
        ll b = L[m] + L[k];
        ll c = L[i] + L[m];
        if(a > L[m] && b > L[i] && c > L[k]) {
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<stdlib.h>

int main(){
  long int a,v,b,w,t;

  scanf("%ld %ld",&a,&v);
  scanf("%ld %ld",&b,&w);
  scanf("%ld",&t);

  if(v <= w){
    printf("NO");
    exit(0);
  }
  else{
    if(((double)labs(a-b)/(double)(v-w)) <= t)
      printf("YES");
    else
      printf("NO");
  }
}


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

using namespace std;

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

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

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

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

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

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

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

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

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    PUTS(s[0] == s[1] && s[1] == s[2] ? "No":"Yes");
}

Measured memory_bytes: 256
def main():
    H, W = map(int, input().split())

    MAX_BIAS = 80 * (H + W - 1)

    A = []
    for _ in range(H):
        A += map(int, input().split())  # 速度のため一次元で管理
    B = []
    for _ in range(H):
        B += map(int, input().split())  # 速度のため一次元で管理

    dp = [0] * (H * W)  # 速度のため一次元で管理,dp[pos]:=bit,[-80*(H+W-1),80*(H+W-1)]->[0,2*80*(H+W-1)]
    dp[0] |= (1 << MAX_BIAS)

    for r in range(H):
        for c in range(W):
            p = r * W + c
            d = abs(A[p] - B[p])
            x = dp[p]
            if r > 0:
                x |= dp[p - W]
            if c > 0:
                x |= dp[p - 1]
            dp[p] = (x << d) | (x >> d)

    ans = MAX_BIAS
    for j in range(2 * MAX_BIAS + 1):
        if (dp[H * W - 1] >> j) & 1:
            t = j - MAX_BIAS
            if ans > abs(t):
                ans = abs(t)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 57436
a = [int(input()) for _ in range(5)]
mn = 100
for i in range(5):
    amari = a[i]%10
    if a[i]%10==0:
        amari = 10
        
    if mn>amari:
        mn = amari
        mn1 = i
        
ans = 0
for i in range(5):
    if i==mn1:
        continue
    else:
        if a[i]%10==0:
            ans1 = a[i]//10
        else:
            ans1 = (a[i]//10)+1
        ans += (ans1)*10
ans += a[mn1]
print(ans)

Measured memory_bytes: 38384
//https://atcoder.jp/contests/abc141/tasks/abc141_a
#include <iostream>
#include <string>

using namespace std;

int main(){
	string s;
	cin >> s;

	if(s == "Sunny")
		cout << "Cloudy\n";
	else if(s == "Cloudy")
		cout << "Rainy\n";
	else
		cout << "Sunny\n";
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
public static void main(String[] args) {
  Scanner sc = new Scanner(System.in);
  int num = sc.nextInt();
  int line = sc.nextInt();
  int moveNum = 0;
  for(int i = 0; i < num; i++) {
    int point = sc.nextInt();
    if (point <= line/2) {
      moveNum += point;
    } else {
      moveNum += line-point;
    }
  }
  System.out.println(moveNum * 2);
}}


Measured memory_bytes: 23764
fun main(args : Array<String>) {
    val (N, M, K) = readLine()!!.split(" ").map { it.toInt() }

    val MOD = 1000000007L
    val allConbination = nCk(N*M -2, K -2, MOD.toInt()) % MOD
    val NN = N * N % MOD
    val MM = M * M % MOD

    var costX = 0L
    var costY = 0L
    (1..M).forEach { m ->
        costX += allConbination * NN * m * (M-m) % MOD
    }
    (1..N).forEach { n ->
        costX += allConbination * MM * n * (N-n) % MOD
    }
    println((costX + costY) % MOD)
}


fun pow(a: Long, b: Long, M: Int): Long {
    var b = b
    var ret: Long = 1
    var tmp = a
    while (b > 0) {
        if (b and 1 == 1L) ret = ret * tmp % M
        tmp = tmp * tmp % M
        b = b shr 1
    }
    return ret
}

//return nCk mod M (M must be prime number) O(min(k,n-k)*logM)
fun nCk(n: Int, k: Int, M: Int): Int {
    var ret: Long = 1
    val min = Math.min(k, n - k)
    for (i in 1..min) {
        ret = ret * pow(i.toLong(), (M - 2).toLong(), M) % M
    }
    for (i in n - min + 1..n) {
        ret = ret * i % M
    }
    return ret.toInt()
}

Measured memory_bytes: 37924
#include <stdio.h>

int main(void) {
	int n=0,i,j=0;
	int tmp;
	int max,min;
	long long int ALL =0;
	
	scanf("%d",&n);
	
	int a[n];
	
	for(i=0;i<n;i++){
		scanf("%lld",&a[i]);
		ALL += a[i];
	}
	
	
	for(i=0;i<n-1;i++){
		for(j=i+1;j<n;j++){
			if(a[i] < a[j]){
				tmp = a[i];
				a[i] = a[j];
				a[j] = tmp;
			
			}
		}
	}
	min = a[n-1];
	
	printf("%d %d %lld\n",min,a[0],ALL);
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
using namespace std;
static const int MAX = 200000;

int main() {
    int R[MAX], n;
    cin >> n;
    for (int i = 0; i < n; i++) cin >> R[i];

    int max_profit = R[1] - R[0];
    int min_price = min(R[0], R[1]);

    for (int i = 2; i < n ; i++) {
    max_profit = max(max_profit, R[i] - min_price);
    min_price = min(min_price, R[i]);
    }
    cout << max_profit << endl;

    return 0;
}

Measured memory_bytes: 3888
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <chrono>
#include <random>

using namespace std;

#define int long long
#define ll long long
//#define double long double
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()

const int INF = 2e9;
const int MB = 20;
const int MOD = 1e9 + 7;

void solve() {
    string s;
    cin >> s;
    set<char> st;
    for (char c : s) st.insert(c);
    cout << (st.size() == 1 ? "No" : "Yes");
}
signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    solve();
}

Measured memory_bytes: 256
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int n, t; readV(n, t);
  int[] a; readA(n, a);

  auto m = new int[](n);
  m[$-1] = a[$-1];
  foreach_reverse (i; 0..n-1) m[i] = max(m[i+1], a[i]);

  auto r = 0;
  foreach (i; 0..n-1) r = max(r, m[i+1]-a[i]);

  auto c = 0;
  foreach (i; 0..n-1)
    if (m[i+1]-a[i] == r) ++c;

  writeln(c);
}


Measured memory_bytes: 4732
void main() {
  problem();
}

void problem() {
  const N = scan!ulong;

  ulong solve() {
    ulong ans;
    foreach(i; 1..N) {
      ans += (N - 1) / i;
    }
    return ans;
  }

  solve().writeln;
}

// ----------------------------------------------

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

// -----------------------------------------------


Measured memory_bytes: 2752
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long x = sc.nextLong();
    long ans = 0;
    ans = 2 * (x / (long)11);
    long t = (x % (long)11);
    if((t > 0) && (t <= 6)) ans++;
    if(t > 6) ans += 2;
    System.out.println(ans);
  }
}


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

using namespace std;

int main()
{
	string cad;	cin >> cad;
	int q;	scanf("%d", &q);
	list <char> li;
	for (int i = 0; i < cad.size(); i++)
		li.push_back(cad[i]);
	
	bool sw = 0;
	while (q--)
	{
		int t;	scanf("%d", &t);
		if (t == 1)
			sw = (sw == 1 ? 0 : 1);
		else
		{
			int	f;	char c;		scanf("%d %c", &f, &c);
			if (f == 1)
			{
				if (sw)
					li.push_back(c);
				else
					li.push_front(c);
			}
			else
			{
				if (sw)
					li.push_front(c);
				else
					li.push_back(c);
			}
		
		}
	}
	if (sw)
		reverse(li.begin(), li.end());
	for (auto x:li)
		cout << x;
}

Measured memory_bytes: 9984
#include<bits/stdc++.h>
using namespace std;
int main(){
  	int n;cin >> n;
  	vector<int> a(4, 0);
  	for(int i=0;i<n;i++){
      	string s;cin >> s;
      	if(s == "AC") a[0]++;
      	else if(s == "WA") a[1]++;
      	else if(s == "TLE") a[2]++;
      	else a[3]++;
    }
  	cout << "AC x " << a[0] << endl;
	cout << "WA x " << a[1] << endl;
	cout << "TLE x " << a[2] << endl;
	cout << "RE x " << a[3] << endl;
  	return 0;
}

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

string s;
int k;
set<string> ans;

int main()
{
    cin>>s>>k;
    string crt = "";
    for (int i=0;i<s.size();i++){
        crt.clear();
        for (int ln = i;ln < min((int)s.size(), i+k); ln++){
            crt += s[ln];
            ans.insert(crt);
        }
    }

    auto it = ans.begin();
    for (int i=1;i<k;i++)
        it++;
    cout<<*it;

    return 0;
}


Measured memory_bytes: 1664
#include <iostream>
#include <string>

int main() {
	int n, s[13], h[13], c[13], d[13], nn; std::string t;
	for (int i = 0; i < 13; ++i) {
		s[i] = i+1;
		h[i] = i+1;
		c[i] = i+1;
		d[i] = i+1;
	}
	std::cin >> n;
	for (int i = 1; i <= n; ++i) {
		std::cin >> t;
		std::cin >> nn;
		if (t == "S") {
			s[nn - 1] = 0;
		}
		else if (t == "H") {
			h[nn - 1] = 0;
		}
		else if (t == "C") {
			c[nn - 1] = 0;
		}
		else if (t == "D") {
			d[nn - 1] = 0;
		}
	}
	for (int i = 0; i < 13; ++i) {
		if (!s[i] == 0) {
			std::cout << "S ";
			std::cout << s[i] << std::endl;
		}
	}
	for (int i = 0; i < 13; ++i) {
		if (!h[i] == 0) {
			std::cout << "H ";
			std::cout << h[i] << std::endl;
		}
	}
	for (int i = 0; i < 13; ++i) {
		if (!c[i] == 0) {
			std::cout << "C ";
			std::cout << c[i] << std::endl;
		}
	}
	for (int i = 0; i < 13; ++i) {
		if (!d[i] == 0) {
			std::cout << "D ";
			std::cout << d[i] << std::endl;
		}
	}
}


Measured memory_bytes: 3148
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
#include <set>
#include <queue>
#include <cstdio>
#include <cmath>
using namespace std;
typedef long long LL;
const int N=100;

int n,m;
char s[N][N];

bool check(int i,int j) {
	if(s[i+1][j]=='#') return 1;
	if(s[i][j+1]=='#') return 1;
	if(s[i-1][j]=='#') return 1;
	if(s[i][j-1]=='#') return 1;
	return 0;
}

int main() {
	scanf("%d %d",&n,&m);
	for(int i=1;i<=n;i++) {
		scanf("%s",s[i]+1);
	}
	bool ok=1;
	for(int i=0;i<=n;i++) {
		for(int j=1;j<=m;j++) {
			if(s[i][j]=='#') {
				ok=ok&check(i,j);
			}
		}
	}
	printf("%s\n",ok?"Yes":"No");
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 0x1fffffffffffffff;
template<class T> bool chmin(T& a, const T& b){ if(a > b){ a = b; return 1; } return 0; }

int main(){
    ll n;
    cin >> n;
    vector<ll> min(26, INF);
    for(ll i = 0; i < n; i++){
        string s;
        cin >> s;
        vector<ll> cnt(26);
        for(auto& i : s) cnt[i - 'a']++;
        for(ll i = 0; i < 26; i++) chmin(min[i], cnt[i]);
    }
    for(ll i = 0; i < 26; i++) for(ll j = 0; j < min[i]; j++) cout << char('a' + i);
    cout << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{ 
	char s[4];
	int n,i;
	scanf("%s",&s);
	n=0;
	for(i=0;i<=2;i++){
	if(s[i]=='1'){
	n=n+1;
	}}
	printf("%d\n",n);
	return 0;
}

Measured memory_bytes: 128
n, x = map(int, input().split())
ans = n
y, x = n-x, x
if x > y:
  y, x = x, y
while True:
  q, r = divmod(y, x)
  if r == 0:
    ans += (2*q-1)*x
    break
  ans += 2*q*x
  y, x = x, r
print(ans)

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

const int MOD = 1000000007;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

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

//最大公約数 
unsigned gcd(unsigned a, unsigned b) {
  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

  
int main() {

int X, Y, Z, K;
cin >> X >> Y >> Z >> K;

vector<ll> A(X), B(Y), C(Z);
REP(i, X) cin >> A.at(i);
REP(i, Y) cin >> B.at(i);
REP(i, Z) cin >> C.at(i);
vector<ll>AB;
REP(i, X)REP(j, Y){
    AB.push_back(A.at(i) + B.at(j));
}
sort(all(AB));
reverse(all(AB));

vector<ll>ans;
REP(i, min(K,(int)AB.size()))REP(j, Z){
    ans.push_back(AB.at(i) + C.at(j));
}

sort(all(ans));
reverse(all(ans));
REP(i, K) print(ans.at(i));

}

Measured memory_bytes: 43368