akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
int a[550][550];
int main()
{
    int n,m,q;
    cin>>n>>m>>q;
    while(m--)
    {
        int x,y;
        cin>>x>>y;
        a[x][y]++;
    }
    for(int i=1;i<=n;i++)
        for(int j=1;j<=n;j++)
        a[i][j]+=a[i][j-1];
    while(q--)
    {
        int x,y,sum=0;
        cin>>x>>y;
        for(int i=x;i<=y;i++)
            sum+=a[i][y];
        cout<<sum<<endl;
    }
}


Measured memory_bytes: 2048
//by kcz 1552920354@qq.com
//if you find any bug in my code
//please tell me
#include<bits/stdc++.h>
using namespace std;

template <typename T> void chmin(T&x,const T &y)
{
	if(x>y)x=y;
}
template <typename T> void chmax(T &x,const T &y)
{
	if(x<y)x=y;
}
typedef long long s64;
typedef unsigned long long u64;
typedef unsigned int u32;
typedef pair<int,int> pii;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
#define pb push_back
#define gc (c=getchar())
int read()
{
	char c;
	while(gc<'-');
	if(c=='-')
	{
		int x=gc-'0';
		while(gc>='0')x=x*10+c-'0';
		return -x;
	}
	int x=c-'0';
	while(gc>='0')x=x*10+c-'0';
	return x;
}
#undef gc
int s(s64 n)
{
	int ans=0;
	while(n){ans+=n%10;n/=10;}
	return ans;
}
s64 P[20];
int k;
void dfs(s64 n,int i)
{
	if(!k)return ;
	if(i==-1)
	{
		--k;
		printf("%lld\n",n);
		return ;
	}
	rep(j,0,8)
	{
		s64 _n=n+(j+1)*P[i]-1;
		if(_n*(s(_n)+1)<=(_n+P[i])*s(_n))dfs(n+j*P[i],i-1);
	}
	dfs(n+9*P[i],i-1);
}

int main()
{
	//freopen("1.in","r",stdin);//freopen("1.out","w",stdout);
	cin>>k;
	P[0]=1;
	rep(i,1,16)P[i]=P[i-1]*10;
	for(int i=0;k;++i)
	{
		rep(j,1,9)dfs(j*P[i],i-1);
	}
}



Measured memory_bytes: 256
#coding:utf-8

#data = list(map(int, input().split(" ")))

def check_honest(bits):
    honest = [-1 for _ in range(n)]
    for j in range(n):
        if bits[j] == "1":
            if honest[j] == 0:
                return False
            honest[j] = 1
            for ans in all[j]:
                if honest[ans[0] - 1] == -1:
                    honest[ans[0] - 1] = int(ans[1])
                elif honest[ans[0] - 1] != int(ans[1]):
                    return False
        else:
            if honest[j] == 1:
                return False
            honest[j] = 0
    else:
        return True
    
    
n = int(input())

all = []
for _ in range(n):
    total_ans = int(input())
    answers = []
    for _ in range(total_ans):
        answers.append(list(map(int, input().split(" "))))
    all.append(answers)


for i in reversed(range(2 ** n)):
    bits = str(bin(i))[2:].zfill(n)
    if check_honest(bits):
        print(bits.count("1"))
        break
else:
    print("0")
                


Measured memory_bytes: 3064
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
	map<int,int> m;
	vector<int> v;
	int n,sum=0;
	cin>>n;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		if(m[x]==0)v.push_back(x);
		m[x]++;
	}
	for(int i=0;i<v.size();i++){
		if(v[i]>m[v[i]])sum+=m[v[i]];
		else sum+=abs(m[v[i]]-v[i]);
	}
	cout<<sum;
}

Measured memory_bytes: 5112
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
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;}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(vec) vec.begin(),vec.end()
typedef long long ll;
typedef pair<ll,ll> l_l;
typedef pair<int,int> i_i;
const ll MOD=1e9+7;
const int INF=1<<30;

int main(){
  int N; cin >> N;
  vector<ll> a(N);
  rep(i,N) cin >> a[i];
  vector<ll> b(N);
  rep(i,N) cin >> b[i];
  vector<ll> c(N);
  rep(i,N) cin >> c[i];
  sort(all(a));
  sort(all(c));
  ll ans=0;
  rep(i,N){
    ll x=lower_bound(all(a),b[i])-a.begin();
    ll y=upper_bound(all(c),b[i])-c.begin();
    ans+=x*(N-y);
  }
  cout << ans << endl;
}

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

int main(){
	// sengen
	int n;
	// nyuryoku
	cin >> n;
	int a[n],b[n];
	for(int i=0;i<n;i++){
		cin >> a[i];
		b[i] = a[i];
	}
	// keisan
	sort(a,a+n,greater<int>());
	for(int i=0;i<n;i++){
		if(b[i] == a[0]){
			cout << a[1] << endl;
		}else{
			cout << a[0] << endl;
		}
	}
	// syutsuryoku
}

Measured memory_bytes: 5140
# include <cstdio>
# include <cstring>

using namespace std;

int main()
{
	char a[100005];
	
	scanf("%s",a);
	int len = strlen(a);
	
	for(int i = 0;i < len-2;i++)
	{
		if(a[i] == a[i+1])
		{
			printf("%d %d\n",i+1,i+2);
			return 0;
		}
		if(a[i] == a[i+2])
		{
			printf("%d %d\n",i+1,i+3);
			return 0;
		}
	}
	if(a[len-1] == a[len-2])
	{
		printf("%d %d\n",len-1,len);
	}else{
		printf("-1 -1\n");
	}
	
	return 0;
}

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


typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;

typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 1e6 + 3;

#define _  %  MOD
#define __ %= MOD

#define      each(it,s)        for(auto it = s.begin(); it != s.end(); ++it)
#define      sortA(v)          sort(v.begin(), v.end())
#define      sortD(v)          sort(v.begin(), v.end(), greater<auto>())
#define      fill(a)           memset(a, 0, sizeof (a))

#define      swap(a,b)        {a=a+b;b=a-b;a=a-b;}
#define      rep(i, n)         for(ll i = 0; i < (n); ++i)
#define      repA(i, a, n)     for(ll i = a; i <= (n); ++i)
#define      repD(i, a, n)     for(ll i = a; i >= (n); --i)
#define watch(x) cout << (#x) << " is " << (x) <<endl

#define fi first
#define se second
#define mp make_pair
#define pb push_back

#define fbo find_by_order
#define ook order_of_key

ll gcd(ll a,ll b){if(b==0) return a; else return gcd(b,a%b);}
ll power(ll x,ll y){ll res=1; while(y>0){if(y&1) res=res*x;y=y>>1;x=x*x;}return res;} // modular exponent

int main()
{
    ios_base::sync_with_stdio(false); // don't use printf and scanf
    cin.tie(NULL); // cout<<fixed<<setprecision
    int n,m;
    cin>>n>>m;
    int ans=(n*(n-1))/2 + (m*(m-1))/2;
    cout<<ans<<'\n';
    return 0;
}

Measured memory_bytes: 256
/*|In The Name Of Allah|*/
//This Month Will Be Expert ISA
#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+5;

const int mod = 1e9+7;

int main(){
    int a;
    cin >> a;
    for(int i = 1; i <= 9; i++){
        for(int j = 1; j <= 9; j++){
            if(i*j == a){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
    
    int x,y;
    scanf("%d %d",&x,&y);
    
    if(x==4||x==6||x==9||x==11)x=1;
    else if(x==2);
    else x=3;
    
    if(y==4||y==6||y==9||y==11)y=1;
    else if(y==2);
    else y=3;

    if(x==y)printf("Yes");
    else printf("No");
    
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<vector>
#include<cmath>

int main() {
  int N;
  std::cin >> N;
  std::vector<std::vector<int>> point(N,std::vector<int>(2));
  for (int i=0; i < N; i++) {
    std::cin >> point.at(i).at(0) >> point.at(i).at(1);
  }
  double sum = 0;
  for (int i = 0; i<N-1; i++) {
    for (int j = i+1; j < N; j++) {
      double x_dif = (point.at(i).at(0)-point.at(j).at(0))*(point.at(i).at(0)-point.at(j).at(0));
      double y_dif = (point.at(i).at(1)-point.at(j).at(1))*(point.at(i).at(1)-point.at(j).at(1));
      sum += std::sqrt(x_dif+y_dif);
    }
  }
  sum *= N-1;
  sum /= (N * (N-1) / 2);
  
  printf("%f", sum);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int n, m, x, c[12], a[12][12], b = 1, p = 10000000, p2, r[12], flag;
	cin >> n >> m >> x;
	for(int i = 0;i < n;i++){
		b *= 2;
		cin >> c[i];
		for(int j = 0;j < m;j++){
			cin >> a[i][j];
		}
	}
	for(int i = 0;i < b;i++){
		p2 = 0;
		for(int j = 0;j < m;j++){
			r[j] = 0;
		}
		for(int k = 0;k < n;k++){
			if((i >> k) % 2){
				for(int j = 0;j < m;j++){
					r[j] += a[k][j];
				}
				p2 += c[k];
			}
		}
		flag = 1;
		for(int j = 0;j < m;j++){
			if(r[j] < x){
				flag = 0;
			}
		}
		if(flag == 1){
			p = min(p, p2);
		}
	}
	if(p == 10000000){
		cout << -1 << endl;
	}else{
		cout << p << endl;
	}
}

Measured memory_bytes: 3564
//A.cpp
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <math.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int main(){
  int n;
  string s;
  cin >> n >> s;
  if(n%2 != 0){
    printf("No\n");
    return 0;
  }else{

    for(int i = 0; i < n/2; i++){
      if(s.substr(i,1) != s.substr(i+n/2,1)){
        printf("No\n");
        return 0;
      }
    }
  }
  printf("Yes\n"); 
  return 0;
}


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

using namespace std;

int n;
bool p[100005];
int main() {
  cin >> n;

  for(int i = 1; i <= n; i++) {
    int pp;
    cin >> pp;
    if(i == pp) p[i] = true;
  }

  int ans = 0;
  for(int i = 1; i <= n; i++) {
    if(p[i]) {
      int k = 0;
      while(i <= n && p[i]) {
	i++;
	k++;
      }
      ans += k / 2;
      if(k % 2 == 1) ans++;
    }
  }

  cout << ans << endl;
}
  


Measured memory_bytes: 384
def main():
	ac_ans = 0
	wa_ans = 0
	tle_ans = 0
	re_ans = 0
	n = int(input())
	for i in range(n):
		t = str(input())
		if t == "AC":
			ac_ans += 1
		elif t == "WA":
			wa_ans += 1
		elif t == "TLE":
			tle_ans += 1
		elif t == "RE":
			re_ans += 1

	print("AC x",ac_ans)
	print("WA x",wa_ans)
	print("TLE x",tle_ans)
	print("RE x",re_ans)

if __name__ == '__main__':
	main()

Measured memory_bytes: 69876
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

int main(void)
{
	int test; 
	scanf("%d", &test);
	for (int T = 0; T < test; ++T)
	{
		LL arr[9];
		for (int i = 0; i < 9; ++i)
		{
			scanf("%llx", arr + i);
		}
		LL key = 0;
		int carry = 0;
		for (int i = 0; i < 32; ++i)
		{
			int sumraw = 0;
			for (int j = 0; j < 8; ++j)
			{
				sumraw += (arr[j] & (1 << i)) ? 1 : 0;
			}
			if (((sumraw + carry) % 2) == ((arr[8] & (1 << i)) ? 1 : 0))
			{}
			else
			{
				key += (1 << i);
				sumraw = 8 - sumraw;
			}
			int sum = carry + sumraw;
			carry = sum / 2;
		}
		printf("%x\n", (unsigned int)key);
	}
	return 0;
}

Measured memory_bytes: 3192
import re

n=int(input())
li = [input() for i in range(n)]
x = input()

i = 0
li0 = [re.sub("\\D", "", li[i]) for i in range(n)]

for i in range(n):
  if x in li[i]:
    j = i+1
    break
  else:
    j = 0

k = 0

for m in range(j,n):
  k = k + int (li0[m])

print(k)


Measured memory_bytes: 3316
n,k,q = gets.chomp.split(" ").map(&:to_i)

score = k - q
ary = Array.new(n, score)

while a=gets do
  a = a.chomp.to_i
  ary[a-1] += 1
end

ary.size.times do |i|
  a = ary.shift
  if a > 0 
    puts 'Yes'
  else
    puts 'No'
  end
end


Measured memory_bytes: 4860
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N=2e5+5;
int n,ans;
int a[N],sum[N];
signed main(){
	scanf("%lld",&n);
	for (register int i=1; i<=n; ++i) 
	{
		scanf("%lld",&a[i]);
		sum[a[i]]++;
	}
	for (register int i=1; i<=n; ++i) 
	if (sum[i]>=2) ans+=sum[i]*(sum[i]-1)/2;
	for (register int i=1; i<=n; ++i)
	if (sum[a[i]]>=2) 
	{
		ans-=sum[a[i]]*(sum[a[i]]-1)/2;
		sum[a[i]]--;
		if (sum[a[i]]>=2) ans+=sum[a[i]]*(sum[a[i]]-1)/2;
		printf("%lld\n",ans);
		if (sum[a[i]]>=2) ans-=sum[a[i]]*(sum[a[i]]-1)/2;
		sum[a[i]]++;
		ans+=sum[a[i]]*(sum[a[i]]-1)/2;
	}
	else printf("%lld\n",ans);
	
return 0;	
}

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

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

	int n; cin >> n;
	int x = n % 10;
	if (x == 3){
		cout << "bon";
	}
	else if (x == 0 || x == 1 || x == 6 || x == 8){
		cout << "pon";
	}
	else {
		cout << "hon";
	}
	

    
    return 0; 
}


Measured memory_bytes: 3644
// #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <map>
#include <queue>
using namespace std;
typedef long long int lo;
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define inf 1e9
lo a,b,c,d,e,x,n,m,t,y,a2[100005],a3[100005];
bool vis[10][10];
lo a1[100][100];
string s1, s2, s3;
int main() {
    // freopen("gir.gir","r",stdin);
    // freopen("cik.cik","w",stdout);
    cin >> s1 >> s2;
    cin >> a >> b;
    cin >> s3;
    if(s1 == s3){
        cout << a - 1 << " " << b << endl;
        return 0;
    }
    if(s2 == s3){
        cout << a << " " << b - 1 << endl;
        return 0;
    }
    cout << a << " " << b << endl;
    return 0;
}
//__builtin_popcount(n) n'in kac bitinin 1 oldugunu soyler

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;

int main()
{
    int a, b, t;
    cin >> a >> b >> t;
    int ans = 0;
    for (int i = a; i <= t; i += a)
    {
        ans += b;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
/* * * *   * * *   	* * * */
#define ll  long long
#define ld long double
#define ms(a,v) memset(a,v,sizeof a)
#define pii pair<int, int>
/* * * *   * * *   	* * * */
/* *
 *
 * Author: Hamkor
 *
 * */

int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n; cin>>n;
	int a[n];
	for (int i=0; i<n-1; ++i) cin>>a[i];
	int ans = a[0]+a[n-2];
	for (int i=0; i<n-2; ++i) ans+= min(a[i], a[i+1]);
	cout<<ans;
	return 0;
}


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

using namespace std;

#define lp(i,n) for(int i = 0; i <n;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define MP make_pair
#define SZ(v) ((int)((v).size()))
typedef long long ll;

const ll MOD = 1e9 + 7;
const int OO = (int)1e6;
const int N = (int)1e7;

void init(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int main() {
	#   ifdef LOCAL_PROJECT
        freopen("in.txt", "r", stdin);
    #   endif
    string t;
    cin>>t;
    int f=t[0]-'0';
    int s=t[1]-'0';
    int th=t[2]-'0';
    int fo =t[3]-'0';
    if(f*10+s>0&&f*10+s<13&&th*10+fo>0&&th*10+fo<13){
        cout<<"AMBIGUOUS";
    }else if(f*10+s>0&&f*10+s<13){
        cout<<"MMYY";
    }else if(th*10+fo>0&&th*10+fo<13){
        cout<<"YYMM";
    }else{
        cout<<"NA";
    }
  
    
    return 0;
}

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

# define x first
# define y second
# define mp make_pair
// everything goes according to my plan
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1    Y_U_NO_y1
# define left  Y_U_NO_left
# define right Y_U_NO_right

//put debug temp

using namespace std;

typedef pair <int, int> pii;
typedef long long ll;
typedef long double ld;

const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
  ios_base :: sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
  unsigned int seed;
  asm ("rdtsc" : "=A"(seed));
  srand (seed);
}
void files (string problem) {
  if (fopen ((problem + ".in").c_str(),"r")) {
    freopen ((problem + ".in").c_str(),"r",stdin);
    freopen ((problem + ".out").c_str(),"w",stdout);
  }
}
void localInput(const char in[] = "s") {
  if (fopen (in, "r")) {
    freopen (in, "r", stdin);
  }
  else
    cerr << "Warning: Input file not found" << endl;
}


int main()
{
  # ifdef Local
    //localInput();
  # endif
  Read_rap();
  int x, y;
  cin >> x >> y;
  if (x % y == 0)
    cout << -1;
  else
    cout << x;

  return 0;
}





// Coded by Z..

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

int N;

struct Trie {
  struct node {
    node(){
      memset(v,-1,sizeof(v));
      ef = false;
    }
    node(char c):c(c){
      memset(v,-1,sizeof(v));
      ef = false;
    }
    ~node(){}
    char c;
    int v[28];
    bool ef;
  };


  node* root;
  void init(){
    vs.clear();
    root = new node();
    vs.emplace_back( root );
  }

  void push(const string& s, node* v, int id){
    if((int)s.size() == id) {
      v->ef = true; return;
    }
    int nx = s[id]-'a';
    if( v->v[nx]==-1 ){
      vs.emplace_back( new node(s[id]) );
      v->v[nx] = vs.size()-1;
    }
    push( s, vs[v->v[nx]], id+1 );
  }
  void push(const string& s){    
    push( s, root, 0 );
  }  
  
  vector<node*> vs;
  node* operator[](size_t id) {
    return vs[id];
  }
};

string nexs[] = {"",
                 "",
                 "abc",
                 "def",
                 "ghi",
                 "jkl",
                 "mno",
                 "pqrs",
                 "tuv",
                 "wxyz"};

Trie T;
string S;
bool dp[333][5111];
vector<string> res;
vector<char> tms;

void init(){
  T.init();
  for(int i=0;i<=300;i++)
    for(int j=0;j<=5001;j++)
      dp[i][j] = true;
  res.clear();
  tms.clear();
}

bool solve(int id,int v){
  //cout << id <<  " " << v << " " << dp[id][v] << endl;
  if( !dp[id][v] ) return dp[id][v];
  bool rf = false;
  auto nv = T[v];
  if( id == (int)S.size() ){
    if( nv->ef ) {
      string ns = "";
      for( char c : tms )
        ns += c;
      ns += ".";
      res.emplace_back( ns );
      rf = true;
    }
    return dp[id][v] = rf;
  }
  int p = S[id]-'0';
  if( nv->ef ) {
    tms.emplace_back( ' ' );
    rf |= solve(id,0);
    tms.pop_back();
  }
  for(char c : nexs[p]){
    int to = c-'a';
    if( nv->v[to] == -1 ) continue;
    tms.emplace_back( c );
    rf |= solve( id+1, nv->v[to] );
    tms.pop_back();
  }
  return dp[id][v] = rf;
}

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

  while( cin >> N && N ){
    init();
    for(int i=0;i<N;i++){      
      string w; cin >> w;
      T.push(w);
    }
    cin >> S;
    solve(0,0);
    
    for(string s:res) cout << s << endl;
    cout << "--" << endl;
  }
  
}

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

using namespace std;

typedef long long int LL;

#define st first
#define nd second
#define PLL pair <LL, LL>
#define PII pair <int, int>

const int S = 2048;
const int N = 5e5 + 7;
const int MX = 998244353;

int n;
vector <int> G[N];

int last[N];
int color[N];

int dp[N];
int cur[N];

int tmp[N];
int pre[N];

int getMagic(){
	int cur = 1000 * 1000 * 1000 % MX;
	return 1LL * cur * cur % MX;
}

void add(int &a, int b){
	a += b;
	if(a >= MX)
		a -= MX;
}

void getMex(int u){
	for(auto v: G[u])
		if(v > u)
			last[color[v]] = u;
	
	for(int t = 0; true; ++t)
		if(last[t] != u){
			color[u] = t;
			break;
		}
}

void solve(int id){
	int m;
	scanf("%d", &m);
	
	last[0] = n + 1;
	for(int i = 1; i <= n; ++i){
		G[i].clear();
		color[i] = 0;
		last[i] = n + 1;
	}
	
	for(int i = 1; i <= m; ++i){
		int u, v;
		scanf("%d %d", &u, &v);
		
		G[u].push_back(v);
		G[v].push_back(u);
	}
	
	for(int i = 0; i < S; ++i)
		cur[i] = 0;
	
	for(int i = n; i >= 1; --i){
		getMex(i);
		add(cur[color[i]], pre[i]);
	}
	
	for(int i = 0; i < S; ++i){
		tmp[i] = dp[i];
		dp[i] = 0;
	}
	
	for(int i = 0; i < S; ++i)
		for(int j = 0; j < S; ++j)
			add(dp[i ^ j], 1LL * tmp[i] * cur[j] % MX);
}

int main(){
	pre[0] = 1;
	for(int i = 1; i < N; ++i)
		pre[i] = 1LL * pre[i - 1] * getMagic() % MX;
	dp[0] = 1;

	scanf("%d", &n);
	for(int t = 1; t <= 3; ++t)
		solve(t);
	
	printf("%d\n", dp[0]);
	return 0;
}

Measured memory_bytes: 27136
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < (n); i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define REP(i, vec) for(auto i = vec.begin(); i != vec.end(); ++i)

const int mod = 1000000007;
const int inf = (1 << 21);
const long long INF = 1LL << 60;

using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vd = vector<double>;
using vb = vector<bool>;
using vl = vector<ll>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvb = vector<vector<bool>>;
using vii = vector<pair<int, int>>;
using vll = vector<pair<ll, ll>>;

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; }
template<class T> inline T GCD(T a, T b) { return b ? GCD(b, a % b) : a; }
template<class T> inline T LCM(T a, T b) { return (a + (b - 1)) / b; }

int round_int(int a, int b) { return (a + (b - 1)) / b; }

constexpr array<int, 9> dx = { 0, 1, 0, -1, -1, 1, 1, -1, 0 };
constexpr array<int, 9> dy = { 1, 0, -1, 0, 1, 1, -1, -1, 0 };

// ──────────────────────────────────────────────────────────────────

int main() {
	string s;
	ll k;

	cin >> s >> k;

	ll idx, ans;
	rep(i, s.size()) {
		if (s[i] - '0' > 1) {
			idx = i;
			ans = s[i] - '0';
			break;
		}
	}
	//cout << idx << endl;
	if (k <= idx) cout << 1 << endl;
	else cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      string x, s, y, X, S, Y, connect;
      
      cin >> x >> s >> y;
      X = x.at(0);
      S = s.at(0);
      Y = y.at(0);
      connect = X + S + Y;
      
      cout << connect << endl;
    }

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <iomanip>
#include <math.h>
#include <utility>
#include <vector>
#include <map>
#include <unordered_map>
#include <cstdlib>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
using ll = long long;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll x;

    cin >> x;

    if(x % 11 == 0){
        cout << x/11*2 << endl;
    }

    else if(x % 11 <= 6){
        cout << x/11*2 + 1 << endl;
    }
    else{
        cout << (x/11+1)*2 << endl;
    }

    return 0;
}

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

const double pi = 3.14159265358979323846;
const ll mod = 1000000007;


int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
	string s; cin >> s;
	rep(i,3){
		if(s.at(i) == '1') cout << '9';
		else cout << '1';
	}
} 

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

#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

signed main(){
	int h, w;
	cin >> h >> w;
	for(int i = 0;i < h;i++){
		string s;
		cin >> s;
		cout << s << endl;
		cout << s << endl;
	}

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
long abs(long);
int main(){
  int n,k,h[100000];
  long dp[100000],min;
  scanf("%d%d",&n,&k);
  for (int i=0;i<n;i++) scanf("%d",&h[i]);
  dp[0]=0;
  for (int i=1;i<n;i++){
    min=1000000000;
    if (i<k){
      for (int j=1;j<=i;j++){
        if (min>dp[i-j]+abs(h[i]-h[i-j])) min=dp[i-j]+abs(h[i]-h[i-j]);
      }
    }
    else {
      for (int j=1;j<=k;j++){
        if (min>dp[i-j]+abs(h[i]-h[i-j])) min=dp[i-j]+abs(h[i]-h[i-j]);
      }
    }
    dp[i]=min;
  }
  printf("%ld\n",(long)dp[n-1]);
  return 0;
}
long abs(long num){
  if (num<0) num=-num;
  return num;
}


Measured memory_bytes: 1280
// AOJ 1603: 500-yen Saving
// 2018.1.30 bal4u

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

#define MAX 49900

int p[101];
int dp[2][101][50000];

//#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int main()
{
	int n, i, j, c, s, a, b, f, g;

	while (n = in()) {
		for (i = 0; i < n; i++) p[i] = in();
		memset(dp[0], -1, sizeof(dp[0])), memset(dp[1], 0, sizeof(dp[1]));
        dp[0][0][0] = 0;

		for (i = 0; i < n; i++) for (j = 0; j <= MAX; j++) if (dp[0][i][j] >= 0) {
            if (dp[0][i+1][j] < dp[0][i][j] || dp[0][i][j] == dp[0][i+1][j] && dp[1][i][j] < dp[1][i+1][j]) {
                dp[0][i+1][j] = dp[0][i][j], dp[1][i+1][j] = dp[1][i][j];
            }
            a = dp[0][i][j], b = dp[1][i][j] + p[i];
            f = (5000 - p[i]) % 1000, g = j + f;
            if (g >= 500) a++, g -= 500;
            if (dp[0][i+1][g] < a || dp[0][i+1][g] == a && b < dp[1][i+1][g]) dp[0][i+1][g] = a, dp[1][i+1][g] = b;
        }
        c = s = 0;
		for (j = 0; j <= MAX; j++) {
			if (c < dp[0][n][j] || dp[0][n][j] == c && dp[1][n][j] < s)
				c = dp[0][n][j], s = dp[1][n][j];
		}
        printf("%d %d\n", c, s);
	}
	return 0;
}


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

int main(void){
  int A, B;
  string S;
  cin>>A;
  cin>>B;
  cin>>S;
  for(int i=0;i<A;i++){
    if(! ('0'<=S.at(i) && S.at(i)<='9') ){
      cout<<"No"<<endl;
      return 0;
    }
  }
  if(S.at(A)!='-'){
      cout<<"No"<<endl;
      return 0;
  }
  for(int j=A+1;j<=(A+B);j++){
    if(! ('0'<=S.at(j) && S.at(j)<='9') ){
      cout<<"No"<<endl;
      return 0;
    }
  }
  cout<<"Yes"<<endl;
  return 0;
}

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

bool check(vector<int> a,int l,int r){
    for(int i=l+1;i<=r;i++){
        if(a[l]!=a[i]){
            return false;
        }
    }
    return true;
}

int main(){

    while(1){
        int h;
        cin >> h;
        if(h==0){
            break;
        }
        vector<vector<int>> m(h+1,vector<int>(6,0));
        for(int i=1;i<=h;i++){
            for(int j=0;j<5;j++){
                cin >> m[i][j];
            }
        }
        int ans=0;
        while(1){
            int at=ans;
            for(int i=1;i<=h;i++){
                bool f=false;
                int tt=0;
                for(int j=0;j<3;j++){
                    for(int k=4;k>j+1;k--){
                        f=check(m[i],j,k);
                        if(f){
                            tt+=m[i][j]*(k-j+1);
                            for(int l=j;l<=k;l++){
                                m[i][l]=0;
                            }
                            break;
                        }
                    }
                    if(f)break;
                }
                at+=tt;
            }
            // for(int i=0;i<=h;i++){
            //     for(int j=0;j<=5;j++){
            //         cout << m[i][j] << " " ;
            //     }cout << endl;
            // }cout << endl;
            if(at==ans){
                cout << ans << endl;
                break;
            }
            ans=at;
            vector<vector<int>> tt(m);
            while(1){
                for(int i=0;i<5;i++){
                    for(int j=h;j>0;j--){
                        if(m[j][i]==0){
                            for(int k=j;k>0;k--){
                                m[k][i]=m[k-1][i];
                            }
                        }
                    }
                }
                if(m==tt){
                    break;
                }else{
                    tt=m;
                }
            }
            // for(int i=1;i<=h;i++){
            //     for(int j=0;j<5;j++){
            //         cout << m[i][j] << " " ;
            //     }cout << endl;
            // }cout << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3108
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long x = sc.nextLong();
		long a = sc.nextLong();
		long b = sc.nextLong();
		System.out.println(b <= a ? "delicious" : b <= x + a ? "safe" : "dangerous");
	}
}

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

int main() {
  int s,a,b,c;
  cin >> s;
  a=s/100;
  b=(s-a*100)/10;
  c=(s-a*100-b*10);
  cout << a+b+c << endl;
  
    
  
}

Measured memory_bytes: 256
n,k=map(int,input().split())
p=list(map(float,input().split()))
x=[0.0]*n
for i in range(n):
	x[i]=(p[i]*(p[i]+1)/2)/p[i]
v=[0.0]*(n-k+1)
for i in range(n-k+1):
	if(i!=0):
		v[i]=v[i-1]-x[i-1]+x[i+k-1]
	else:
		for j in range(k):
			v[0]+=x[i+j]
print(max(v)+0.000000001)

Measured memory_bytes: 23148
/*
Author: Racer5x
 ***************************************   UNAUTHORISED COPYING OF CODE PROHIBITED   **********************************
*/
 
// #pragma GCC optimize("O3")
// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
#include<bits/stdc++.h>
#define int         long long
#define double      long double
#define pb          emplace_back
#define pf          emplace_front
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define x           first
#define y           second
#define endl        '\n'
#define hell        998244353 
#define PI          3.141592653589
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MAX         2000000000000000000
#define M           1000000007
using namespace std;
 
signed main()
{
    tezz
    
    vi v(3);
    mi m;
    for(int &x:v){
        cin>>x;
        m[x]++;
    }

    for(int x:v){
        if(m[x] == 1) {cout<<x; break;}
    }
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define sc(a) scanf("%d", &a)
#define sc2(a,b) scanf("%d%d", &a, &b)
#define sc3(a,b,c) scanf("%d%d%d", &a, &b, &c)
#define pri(x) printf("%d\n", x)
#define mp make_pair
#define pb push_back
#define BUFF ios::sync_with_stdio(false);
#define imprime(v) for(int X=0;X<v.size();X++) printf("%d ", v[X]); printf("\n");
#define endl "\n"
const int INF= 0x3f3f3f3f;
const long double pi= acos(-1);
typedef long long int ll;
typedef long double ld;
typedef pair<int,ll> ii;
typedef vector<int> vi;
typedef vector< vector< int > > vvi;
const int MOD=1e9+7;
const ll LINF=0x3f3f3f3f3f3f3f3f;
int n;
ll sz[100005],ps[100005];
int memo[100005];

ll dp(int i)
{
  if(i>=n) return true;
  if(memo[i]!=-1) return memo[i];
  int first=upper_bound(sz+1,sz+1+n,sz[i]*2)-sz;
  first--;
  int next=upper_bound(sz+1,sz+1+n,ps[first]*2LL)-sz;
  next--;
  if(next==i) return memo[i]=0;
  return memo[i]=dp(next);
}
int main()
{
  memset(memo,-1,sizeof(memo));
  BUFF;
  cin>>n;
  for(int i=1;i<=n;i++) cin>>sz[i];
  sort(sz+1,sz+n+1);
  for(int i=1;i<=n;i++) ps[i]=ps[i-1]+sz[i];
  ll resp=0;
  for(int i=1;i<=n;i++)
  {
    if(dp(i)) resp++;
  }
  cout<<resp<<endl;
  return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define int long long
#define INF 1000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int N; cin >> N;
    vec A(N); readvec(A);

    int ans = 0;

    int z = N;
    N--;
    while(N >= 0){
        if(A[N] > N || N - A[N] > z){
            cout << -1;
            return 0;
        }
        z = N - A[N];
        int n = N, a = A[N];
        ans += a;
        REP(i, n + 1){
            if(A[n - i] != a - i) break;
            N--;
        }
    }

    cout << ans;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define MAXN 100000
struct node
{
    int num,cnt;
}A[MAXN+5],B[MAXN+5];
int a[MAXN+5];
int n;
bool cmp(node s1,node s2)
{return s1.cnt>s2.cnt;}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=MAXN;i++)
    A[i].num=B[i].num=i;
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
        if(i%2)A[a[i]].cnt++;
        else B[a[i]].cnt++;
    }
    sort(A+1,A+MAXN+1,cmp);
    sort(B+1,B+MAXN+1,cmp);
    if(A[1].num!=B[1].num)printf("%d",n-A[1].cnt-B[1].cnt);
    else if(A[1].cnt+B[1].cnt==n)printf("%d",n/2);
    else if(A[1].cnt==(n+1)/2)printf("%d",n-A[1].cnt-B[2].cnt);
    else if(B[1].cnt==n/2)printf("%d",n-A[2].cnt-B[1].cnt);
    else printf("%d",min(n-A[1].cnt-B[2].cnt,n-A[2].cnt-B[1].cnt));
}


Measured memory_bytes: 2176
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

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

    int n;
    cin >> n;

    int f[100][10] = {}, p[100][11] = {};
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 10; j++) {
            cin >> f[i][j];
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < 11; j++) {
            cin >> p[i][j];
        }
    }

    int r = -(1 << 30);
    for (int k = 1; k < 1 << 10; k++) {
        int s = 0;
        for (int i = 0; i < n; i++) {
            int c = 0;
            for (int j = 0; j < 10; j++) {
                if (f[i][j] && k & 1 << j) c++;
            }
            s += p[i][c];
        }
        r = max(r, s);
    }

    cout << r << endl;

    return 0;
}

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

int main(){
  int N;
  cin>>N;
  int i,j;
  long long a[N];
  for(i=0;i<N;i++) cin>>a[i];
  sort(a,a+N);
  long long b[N];
  b[0]=a[0];
  for(i=1;i<N;i++){
	b[i]=b[i-1]+a[i];
  }
  int g=N-1;
  while(b[g-1]*2>=a[g]&&g>=1){
	g-=1;
  }
  cout<<N-g<<endl;
  return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define cyes cout<<"YES"<<endl
#define cno cout<<"NO"<<endl
#define sp <<" "<<
#define cst(x) cout<<fixed<<setprecision(x)
#define pi 3.14159265359
#define mod 1000000007
using namespace std;
using ll = long long;
using ld = long double;
using Graph = vector<vector<int>>;
using que_a = priority_queue<int, vector<int>, greater<int> >;
using que_d = priority_queue<int>;
using pint = pair<int,int>;

int main(){

    int n; cin >> n;
    vector<int> a(n+1),b(n+1),c(n+1);
    for(int i = 1; i <=n; i++) cin >> a.at(i) >> b.at(i) >> c.at(i);
    vector<vector<int>> dp(n+1,vector<int>(3,1e9));
    rep(i,3) dp.at(0).at(i) = 0;

    for(int i = 1; i <= n; i++){
        rep(j,3){
            if(j == 0) dp.at(i).at(j) = max(dp.at(i-1).at(1) ,dp.at(i-1).at(2)) + a.at(i);
            if(j == 1) dp.at(i).at(j) = max(dp.at(i-1).at(0) ,dp.at(i-1).at(2)) + b.at(i);
            if(j == 2) dp.at(i).at(j) = max(dp.at(i-1).at(0) ,dp.at(i-1).at(1)) + c.at(i);
        }
    }
    cout << max(max(dp.at(n).at(0),dp.at(n).at(1)),dp.at(n).at(2)) << endl;
    return 0;   
}


Measured memory_bytes: 6912
#include <iostream>
#include <string>
int main(){
std::string a,b,c;
std::cin >> a >> b >> c;
if(a[a.size()-1]==b[0] && b[b.size()-1]==c[0])
std::cout << "YES" << std::endl;
else
std::cout << "NO" << std::endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <set>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iterator>
#include <functional>
#include <numeric>
#include <cmath>

using namespace std;

#define ll long long
#define f0(i,n)for(i=0;i<n;i++)
#define f1(i,n)for(i=1;i<=n;i++)
#define fc(i,c,n)for(i=c;i<=n;i++)
#define f0r(i,n)for(i=n-1;i>=0;i--)
#define f1r(i,n)for(i=n;i>0;i--)
#define fcr(i,c,n)for(i=c;i>=0;i--)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define co(a) cout<<a<<endl;
#define coc(a) cout<<a<<" ";

typedef list<ll> LST;
typedef vector<ll> VEC;
typedef map<ll, ll> MAP;

ll i, j, q;
ll n, m, p, k, t, s, h, f;
ll a, b, c, d;
ll x, y, z, l, r;
ll one = 1, zero = 0, ans = 0;
ll mod = 1000000007;
ll INF = 1000000000000000000;
ll a1, a2, a3, a4, a5, a6;
string st1, st2, st3;
char ch1, ch2, ch3;

int main() {
	IO;
	ifstream fin("Text.txt");
	cin >> n;
	VEC vc(n + 3),vc2(n+3),vc3(n+3);

	f0(i, n) {
		cin >> vc[i+1];
	}
	f0(i, n+1) {
		vc2[i + 1] = vc2[i] + abs(vc[i + 1] - vc[i]);
		vc3[n - i] = vc3[n-i+1] + abs(vc[n-i] - vc[n-i+1]);
	}
	f1(i, n) {
		ans = vc2[i - 1] + vc3[i + 1] + abs(vc[i - 1] - vc[i + 1]);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3584
#include <iostream>

using namespace std;

int n, k;
int a[1000005];

int main(void)
{
	cin >> n >> k;
	for(int i = 0; i < n; i++) cin >> a[i];
	
	cout << (n-1+k-2)/(k-1) << endl;
	return 0;
}

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

int main(void){
    int s, cnt=1;
    int *a;
    a = (int*)malloc(sizeof(int)*1000000);
    cin >> s;
    ++a[s];
    while(true){
        ++cnt;
        if(s%2==0){
            s = s/2;
        }else{
            s = 3*s + 1;
        }
        ++a[s];
        if(a[s]==2) break;
    }
    cout << cnt << endl;
}

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

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

  bool easy = true;
  for (int i = 0; i < s.size(); i += 2) {
    if (!(s.at(i) == 'R' || s.at(i) == 'U' || s.at(i) == 'D')) {
      easy = false;
    }
  }

  for (int i = 1; i < s.size(); i += 2) {
    if (!(s.at(i) == 'L' || s.at(i) == 'U' || s.at(i) == 'D')) {
      easy = false;
    }
  }

  if (easy == true) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pld pair<ld,ld>
using namespace std;
int main(){
    char s[3];
    for(int i=0; i<3; i++)cin>>s[i];
    sort(s, s+3);
    if(s[0]==s[2])cout<<"No"<<endl;
    else cout<<"Yes"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 1000007
#define INF63 1061109567
#define INF127 9187201950435737471
#define F first
#define S second
#define ll long long
using namespace std;
string s;
ll ans=0,dp[1000010][2];
int main(){
	int i,p;
	cin>>s;
	memset(dp,127,sizeof(dp));
	dp[0][0]=11-(s[0]-'0');
	dp[0][1]=(s[0]-'0');
	for(i=1;i<s.size();i++)
	{
		p=s[i]-'0';
		dp[i][0]=min(dp[i-1][0]+9-p,dp[i-1][1]+11-p);
		dp[i][1]=min(dp[i-1][0]+p,dp[i-1][1]+p);
	}
	cout<<min(dp[s.size()-1][0],dp[s.size()-1][1])<<endl;
	return 0;
}

Measured memory_bytes: 17028
import sys
input = sys.stdin.readline

N, M, Q = map(int, input().split())

D = [[0 for j in range(N)] for i in range(N)]

for _ in range(M):
    l, r = map(int, input().split())
    D[l - 1][r - 1] += 1

for i in range(N):
    for j in range(1, N):
        D[i][j] += D[i][j - 1]

for j in range(N):
    for i in range(N - 1)[::-1]:
        D[i][j] += D[i + 1][j]

for _ in range(Q):
    p, q = map(int, input().split())
    print(D[p - 1][q - 1])

Measured memory_bytes: 55516
package main

import (
	"fmt"
)

func main() {
	var x, y int
	fmt.Scan(&x, &y)

	switch {
	case x < 2 && y < 2:
		fmt.Println("Brown")
	case x-y < 2 && y-x < 2:
		fmt.Println("Brown")
	default:
		fmt.Println("Alice")
	}
}


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

int main(){
    ios_base::sync_with_stdio(0);
    int n,y;
    cin>>n>>y;
    int ans = 0;
    y=y/1000;
    for(int i=0;i<=2000;i++){
        if(i*10>y||i>n) break;
        for(int j=0;j<=2000;j++){
            if(i*10+j*5>y||i+j>n) break;
            for(int k=0;k<=2000;k++){
                if(i*10+5*j+k>y||i+j+k>n) break;
                if(y==10*i+5*j+k&&i+j+k==n){
                    cout<<i<<' '<<j<<' '<<k;
                    return 0;
                }
            }
        }
    }
    cout<<"-1 -1 -1";
    return 0;
}


Measured memory_bytes: 256
program abc44
 implicit none
 integer(8)::N,ia,ib,ans=0,r
 integer(8),allocatable::A(:)
 read(*,*)N
 allocate(A(N))
 read(*,*)(A(ia),ia=1,N)
 r=A(1)
 do ib=2,N
  if(r>A(ib))then
   ans=ans+r-A(ib)
  else
   r=A(ib)
  end if
 end do
 print'(i0)',ans
 deallocate(A)
end program abc44

Measured memory_bytes: 4596
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
using namespace std;

const int MAX_N = 1000;
map<string, int> h;
map<int,string> h_inv;
vector<int> G[MAX_N];
bool used[MAX_N];
int n, ans, id;

void init(){
	h.clear();
	h_inv.clear();
	for(int i = 0 ; i < MAX_N ; i++ ){
		G[i].clear();
	}
	fill(used, used + MAX_N, false);
	ans = id = 0;
}

void split(const string& s, string& start, int k){
	string str;
	int from, pos, to;
	
	for(int i = 0 ; i < s.size() ; i++ ){
		if( s[i] == ':' ){
			pos = i;
			break;
		}
		str.push_back(s[i]);
	}
	
	if( k == 0 ) start = str;
	
	if( h.count(str) ){
		from = h[str];
	}else{
		h_inv[id] = str;
		h[str] = id++;
		from = h[str];
	}
	str.clear();
	
	for(int i = pos + 1 ; i < s.size() ; i++ ){
		if( s[i] == '.' || s[i] == ',' ){
			if( h.count(str) ){
				to = h[str];
				str.clear();
				G[from].push_back(to);
			}else{
				h_inv[id] = str;
				h[str] = id++;
				to = h[str];
				str.clear();
				G[from].push_back( to );
			}
		}else{
			str.push_back(s[i]);
		}
	}
}

 
void solve(int v){
	if( used[v] ) return;
	used[v] = true;
	
	if( G[v].size() == 0 ){
		ans++;
	}else{
		for(int i = 0 ; i < G[v].size() ; i++ ){
			solve( G[v][i] );
		}
	}
}

int main(){
	while( cin >> n, n ){
		init();
		
		string start;
		for(int i = 0 ; i < n ; i++ ){
			string s;
			cin >> s;
			split(s, start, i);
		}
		
		solve(h[start]);
		cout << ans << endl;
	}
}

Measured memory_bytes: 1464
<?php
fscanf(STDIN, "%d", $N);
$A = array_map('intval', explode(' ', trim(fgets(STDIN))));
$sum = array_count_values($A);
$ans = [];
for ($i = 1; $i <= $N; $i++) {
    $ans[] = isset($sum[$i]) ? $sum[$i] : 0;
}
echo implode(PHP_EOL, $ans);


Measured memory_bytes: 45248
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>
#include <string.h>
#include <set>

using namespace std;

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> void printvec(const vector<T>& v) {
  for (auto x : v) { cout << x << " "; }
  cout << endl;
}
template<class T> void printtree(const vector< vector<T> >& tree) {
  for (long long i = 0; i < tree.size(); ++i) {
    cout << i + 1 << ": "; printvec(tree[i]);
  }
}
template<class T, class U> void printmap(const map<T, U>& mp) {
  for (auto x : mp) { cout << x.first << "=>" << x.second << endl; }
}

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

#define rep(i, n) for(ll i = 0; i < n; ++i)
#define all(s) s.begin(), s.end()
#define sz(x) (ll)(x).size()
#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> triple;
typedef double D;
typedef vector<ll> vl;
typedef vector<P> vp;

const ll INF = 1e9;
const ll MOD = 1000000007;  // 1e9 + 7

vector<ll> build_z(const string& s) {
  ll n = s.size();
  vector<ll> z(n, 0);
  ll l = -1, r = -1;
  for (ll i = 1; i < n; ++i) {
    if (i <= r) {
      z[i] = min<ll>(r - i + 1, z[i - l]);
    }
    while (i + z[i] < n && s[i + z[i]] == s[z[i]]) {
      ++z[i];
    }
    if (i + z[i] - 1 > r) {
      r = i + z[i] - 1;
      l = i;
    }
  }
  return z;
}

void search(const string& text, const string& pattern, vector<ll>& result) {
  vector<ll> z = build_z(pattern + "$" + text);

  ll p = pattern.length();
  for (ll i = p + 1; i < z.size(); ++i) {
    if (z[i] == p) {
      result.push_back(i-p-1);
    }
  }
}

// int main(int argc, char** argv) {
//   string s, t;
//   cin >> s;
//   cin >> t;
//
//   vector<ll> matches;
//   search(s, t, matches);
//
//   for (ll idx : matches) {
//     cout << idx << endl;
//   }
//
//   cout << s << endl;
//   cout << t << endl;
// }

int main(int argc, char** argv) {
  cin.tie(NULL);
  cout.tie(NULL);
  ios_base::sync_with_stdio(false);
  //cout << setprecision(10) << fixed;

  ll n;
  cin >> n;
  string S;
  cin >> S;

  ll ans = 0;
  for (ll i = 1; i < n; ++i) { // prefix..[0..i), suffix..[i,n)
    string pre = S.substr(0,i);
    string suf = S.substr(i);
    string nexS = suf + "$" + pre;
    vector<ll> z = build_z(suf+"$"+pre);
    for (ll j = n+1-i; j < n+1; ++j) {
      chmax(ans, z[j]);
    }
  }
  cout << ans << endl;
}


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

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

Node *root, *NIL;

void insert(int key) {
  Node *x, *y, *z;
  x = root;
  y = NIL;
  z = new Node;

  while (x != NIL) {
    y = x;
    if (key < x->key) x = x->left;
    else x = x->right;    
  }

  if (y == NIL) root = z;
  else if (key < y->key) y->left = z;
  else y->right = z;

  z->parent = y;
  z->key = key;
  z->left = NIL;
  z->right = NIL;
}

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

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

void print() {
  inorder(root);
  cout << endl;
  preorder(root);
  cout << endl;
}

int main() {
  int m, key;
  string com;

  // init
  root = NIL;

  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> com;
    if (com[0] == 'i') {
      cin >> key;
      insert(key);
    } else {
      print();
    }
  }  

  return 0;
}



Measured memory_bytes: 26444