akhauriyash/Code-Regression huggingface dataset:
N = int(input())
S = input()

cnt = 0
for i in range(1000):
    key = str(i).zfill(3)
    ki = 0
    for j in range(N):
        if key[ki] == S[j]: ki += 1
        if ki == 3:
            cnt += 1
            break

print(cnt)


Measured memory_bytes: 41436
x,n=map(int, input().split())
if(n==0):
  print(x)
else:
  hoge=list(map(int, input().split()))
  ans=0
  flag=0
  val=9999
  for i in range(102):
    if(i in hoge):
      flag+=1
    else:
      if(val>abs(x-i)):
        val=abs(x-i)
        ans=i
  print(ans)

Measured memory_bytes: 9196
#include <iostream>
#include <string>
#include <vector>
#include <limits>
#include <algorithm>
using namespace std;

bool sortbysec(const pair<int,int> &a,
               const pair<int,int> &b)
{
    return (a.second < b.second);
}

int main()
{
    vector<pair<int,int>> vec;
    int N;
    cin >> N;
    for (int i=0;i<N;i++)
    {
        int a,b;
        cin >> a >> b;
        vec.push_back(make_pair(a, b));
    }
    sort(vec.begin(),vec.end(),sortbysec);
    int sum = 0;
    bool yes = true;
    for (int i=0;i<N;i++)
    {
        sum+=vec[i].first;
        if (sum > vec[i].second)
        {
            yes = false;
            break;
        }
    }
    if (yes)
    {
        cout << "Yes" << endl;
    }
    else
        cout << "No" << endl;
}


Measured memory_bytes: 2420
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>
#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int N, M; cin >> N >> M;
  map<ll, ll, greater<ll>> m;

  rep(i, N) { int A; cin >> A; m[A]++; }
  while(M>0) { 
    auto mm = m.begin();
    // cout << (*mm).first << " " << (*mm).second << " " << M << endl;
    if ((*mm).second<=M) {
      m.erase(mm);
      m[(*mm).first/2] += (*mm).second;
      M -= (*mm).second;
    }
    else {
      m[(*mm).first] -= M;
      m[(*mm).first/2] += M;
      M = 0;
    }
  }

  ll result = 0;
  for (auto x: m) { result += x.first * x.second; }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 6528
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		long a[] = new long[n];
		
		long xor = 0;
		for(int i=0;i<n;i++) {
			a[i] = s.nextInt();
			xor = xor^a[i];
		}
		
		for(int i=0;i<n;i++) {
			System.out.print((xor^a[i])+" ");
		}
		System.out.println();
	}

}


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

int main() {
  int n, k;
  cin >> n >> k;
  
  vector<int> hp(n);
  rep(i, n) cin >> hp[i];
  
  sort(hp.begin(), hp.end());
  reverse(hp.begin(), hp.end());
  
  ll int ans = 0;
  for(int i = k; i < n; ++i) ans += hp[i];
  
  cout << ans << endl;
    
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
struct segment_tree{
    const long INF = 2*1e9;
    long n = 1;
    long data[300013];
    segment_tree(int a){
        while(n<a) n*=2;
        for(int i = 0;i<2*n;i++) data[i] = INF;
    }
    //segment treeの大きさ取得
    long nreturn(){
        return n;
    }
    //0-indexでk番目の値をaに変更
    void change(long k,long a){
        k+=n-1;
        data[k] = a;
        while(k>0){
            k = (k-1)/2;
            data[k] = min(data[2*k+1],data[2*k+2]);
            //cout << "data" << k << "is changed to" << data[k] << endl;
        }
        return;
    }
    //区間[a,b)の最小値:呼ぶときはrmq(a,b,0,0,n)
    long rmq(long a,long b,long k,long l,long r){
        if(a>=r || b<=l) return INF;
        if(a<=l && b>=r) return data[k];
        long teml = rmq(a,b,2*k+1,l,(l+r)/2);
        long temr = rmq(a,b,2*k+2,(l+r)/2,r);
        return min(teml,temr);
    }
};
int main(){
    int n;
    cin >> n;
    pair<long,long> lr[n];
    rep(i,n) cin >> lr[i].first >> lr[i].second;
    sort(lr,lr+n); 
    segment_tree tree(n);
    rep(i,n) tree.change(i,lr[i].second);
    long ans = 0;
    long nn = tree.nreturn();
    for(int i = 0;i<n-1;i++){
        long tmp = max(long(0),long(1)+tree.rmq(0,i+1,0,0,nn)-lr[i].first);
        tmp+=max(long(0),long(1)+tree.rmq(i+1,nn,0,0,nn)-lr[n-1].first);
        ans=max(ans,tmp);
        tmp=0;
        tmp+=(lr[i].second-lr[i].first)+1;
        tmp+=max(long(0),long(1)+min(tree.rmq(0,i,0,0,nn),tree.rmq(i+1,nn,0,0,nn))-lr[n-1].first);
        ans=max(ans,tmp);
    }
    cout << ans << endl;
    /*segment_tree tree(7);
    for(int i = 0;i<7;i++) tree.change(i,i);
    for(int i = 0;i<15;i++) cout << tree.data[i] << " " ;
    cout << tree.rmq(1,2,0,0,7);*/
}

Measured memory_bytes: 3968
n = gets.to_i
home = gets.chomp.split(" ").map(&:to_i)
flag = [false, false, false, false, false, false, false, false]
max = 0
for i in 0..home.length-1
	case home[i]
	when (1..399) then flag[0] = true
		
	when (400..799) then flag[1] = true

	when (800..1199) then flag[2] = true

	when (1200..1599) then flag[3] = true

	when (1600..1999) then flag[4] = true

	when (2000..2399) then flag[5] = true

	when (2400..2799) then flag[6] = true

	when (2800..3199) then flag[7] = true

	when (3200..4800) then max += 1
	end
end
#p flag
result = flag.count(true)
max = result + max
if result == 0
	result = 1	
end
puts  [result, max].join(" ")



Measured memory_bytes: 1788
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define EACH(i, c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s, e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

//#define LOCAL 0
//#ifdef LOCAL
//#define DEBUG(s) cout << (s) << endl
//#define dump(x)  cerr << #x << " = " << (x) << endl
//#define BR cout << endl;
//#else
//#define DEBUG(s) do{}while(0)
//#define dump(x) do{}while(0)
//#define BR
//#endif


//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30)
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007
//ここから編集する

void solve(int n,int m){
    vector<int> v(n);
    rep(i,0,n){
        v[i] = i + 1;
    }
    rep(i,0,m){
        int p,c;
        cin >> p >> c;
        vector<int> tmp1(v.end() - p + 1 ,v.end());
        vector<int> tmp2(v.end() - p + 1 - c,v.end() - p + 1);

        rep(j,0,tmp1.size()){
            v[v.size() - p + 1 - c + j] = tmp1[j];
        }
        rep(j,0,tmp2.size()){
            v[v.size() - p + 1 - c + tmp1.size() + j] = tmp2[j];
        }


    }
    cout << v.back() << endl;

}

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

    while(true){
        int n,m;
        cin >> n >> m;
        if(n == 0) break;
        solve(n,m);

    }


    return 0;
}



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

int main() {
    int64_t N;
    cin >> N;
    int count = 0;
    for(int i = 1;i <= N;i++) {
        if((0 < i && i < 10) || (99 < i && i < 1000) || (9999 < i && i < 100000)) {
            count++;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, Alice = 0, Bob = 0;
  vector<int> a(100);
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  for (int j = 0; j < N; j+=2) {
    Alice += a.at(j);
  }
  for (int k = 1; k < N; k+=2) {
    Bob += a.at(k);
  }
    cout << abs(Bob - Alice) << endl;
}

Measured memory_bytes: 3644
a = int(input())
b = int(input())
c = int(input())
x = int(input())
count = 0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*i + 100*j + 50*k == x:
                count += 1
print(count)

Measured memory_bytes: 3060
from functools import reduce
import math
def xgcd(a, b):
    x0, y0, x1, y1 = 1, 0, 0, 1
    while b != 0:
        q, a, b = a // b, b, a % b
        x0, x1 = x1, x0 - q * x1
        y0, y1 = y1, y0 - q * y1
    return a, x0, y0
def modinv(a, m):
    g, x, y = xgcd(a, m)
    return x % m
def modmul(a,b):
    return a * b % 998244353
def comb(n,r,m):
    if r == 0: return 1
    return memf[n]*pow(memf[r],m-2,m)*pow(memf[n-r],m-2,m)
def mempow(a,b):
    temp = 1
    yield temp
    for i in range(b):
        temp = temp * a % 998244353
        yield temp
def memfact(a):
    temp = 1
    yield temp
    for i in range(1,a+1):
        temp = temp * i % 998244353
        yield temp

N,M,K = (int(x) for x in input().split())
memp = []
memf = []
mpappend = memp.append
mfappend = memf.append
for x in mempow(M-1,N-1):
    mpappend(x)
for x in memfact(N-1):
    mfappend(x)
ans = 0
if M == 1:
    if K + 1 < N:
        print('0')
    else:
        print('1')
else:
    i = 0
    for i in range(K+1):
        ans = (ans + (comb(N-1,i,998244353)*M*memp[N-i-1])) % 998244353
    print(ans)

Measured memory_bytes: 87900
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <sstream>
#include <numeric>
#include <queue>
#include <sstream>
#include <set>
using namespace std;

int64_t min(int64_t a,int64_t b) {
    if (a > b)
    {
        return b ;
    }else
    {
        return a ;
    }
}


int main(){
    int n ;
    cin >> n ;
    vector<int> a(n) ;
    for (size_t i = 0; i < n; i++)
    {
        cin >> a.at(i) ;
    }
    vector<int> c(9,0) ;
    for (size_t i = 0; i < n; i++)
    {
        int r = min(8,a.at(i)/400) ;
        c.at(r) ++ ;
    }
    int mini = 0 ;
    for (size_t i = 0; i < 8; i++)
    {
        if (c.at(i) > 0)
        {
            mini ++ ;
        }
        
    }
    int64_t maxi = mini+c.at(8) ;
    if (mini == 0)
    {
        if (c.at(8) > 0)
        {
            mini ++ ;
        }
        
    }
    
    cout << mini << " " << maxi << endl ;
}


Measured memory_bytes: 256
class Node(object):
    def __init__(self, num, prv = None, nxt = None):
        self.num = num
        self.prv = prv
        self.nxt = nxt
 
 
class DoublyLinkedList(object):
    def __init__(self):
        self.start = self.last = None
 
    def insert(self, num):
        new_elem = Node(num)
 
        if self.start is None:
            self.start = self.last = new_elem
        else:
            new_elem.nxt = self.start
            self.start.prv = new_elem
            self.start = new_elem
 
    def delete_num(self, target):
        it = self.start
        while it is not None:
            if it.num == target:
                if it.prv is None and it.nxt is None:
                    self.start = self.last = None
                else:
                    if it.prv is not None:
                        it.prv.nxt = it.nxt
                    else:
                        self.start = self.start.nxt
 
                    if it.nxt is not None:
                        it.nxt.prv = it.prv
                    else:
                        self.last = self.last.prv
                break
            it = it.nxt
 
    def delete_start(self):
        if self.start is self.last:
            self.start = self.last = None
        else:
            self.start.nxt.prv = None
            self.start = self.start.nxt
 
    def delete_last(self):
        if self.start is self.last:
            self.start = self.last = None
        else:
            self.last.prv.nxt = None
            self.last = self.last.prv
 
    def get_content(self):
        ret = []
        it = self.start
 
        while it is not None:
            ret.append(it.num)
            it = it.nxt
 
        return ' '.join(ret)
 
 
def _main():
    from sys import stdin
 
    n = int(input())
 
    lst = DoublyLinkedList()
     
    for _ in range(n):
        cmd = stdin.readline().strip().split()
        if cmd[0] == 'insert':
            lst.insert(cmd[1])
        elif cmd[0] == 'delete':
            lst.delete_num(cmd[1])
        elif cmd[0] == 'deleteFirst':
            lst.delete_start()
        elif cmd[0] == 'deleteLast':
            lst.delete_last()
 
    print(lst.get_content())
 
 
if __name__ == '__main__':
    _main()

Measured memory_bytes: 229216
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define INF 1<<30
#define LINF 1LL<<60

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll A,B,C,D; cin >> A >> B >> C >> D;
    ll res = max(min(B,D) - max(A,C),0LL);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
let [|n; k; q|] = stdin.ReadLine().Split() |> Array.map int
let l = [|for _ in 1..n -> k - q|]
[for _ in 1..q -> stdin.ReadLine() |> int] |> List.iter (fun x -> l.[x - 1] <- l.[x - 1] + 1)
l |> Array.iter (fun x -> (if x > 0 then "Yes" else "No") |> printfn "%s")

Measured memory_bytes: 24016
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Scan()
	n, _ := strconv.Atoi(sc.Text())

	h := make([]int, n)
	for i := range h {
		sc.Scan()
		h[i], _ = strconv.Atoi(sc.Text())
	}

	max := 0
	for i := range h {
		if max-h[i] >= 2 {
			fmt.Println("No")
			return
		}
		if max < h[i] {
			max = h[i]
		}
	}

	fmt.Println("Yes")
}


Measured memory_bytes: 3072
#include<iostream>
#include<string>
#include<algorithm>
#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;

int main()
{
    string s,t;
    cin >> s >> t;
    sort(s.begin(), s.end());
    sort(t.begin(), t.end(), greater<char>());
    if (s < t){
        cout << "Yes" << endl;
    } else{
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 888
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace Tasks
{
    public class B
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine().ToCharArray().Select(x => x == 'I' ? 1 : -1).ToArray();
            var answer = 0;
            var current = 0;
            for (var i = 0; i < N; i++)
            {
                current += S[i];
                answer = Math.Max(answer, current);
            }

            Console.WriteLine(answer);
        }
    }
}


Measured memory_bytes: 28272
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define N 22
int a[N][N], f[1 << N] = {1}, n;
int main() {
scanf("%d", &n);
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) scanf("%d", &a[i][j]);
for (int s = 0; s < (1 << n); s++) {
int i = __builtin_popcount(s);
for (int j = 1; j <= n; j++)
if (s & (1 << (j - 1)) && a[i][j])
f[s] = (f[s] + f[s ^ (1 << (j - 1))]) % mod;
}
printf("%d\n", f[(1 << n) - 1]);
return 0;
}

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

int MOD=1000000007;

int modpow(int a,int x){
  if(a<0)a+=MOD;
  int ans=1;
  while(x>0){
    if(x&1) ans=ans*a%MOD;
      a=a*a%MOD;
      x>>=1;
  }
  return ans;
}
int gyaku(int n){
    return modpow(n,MOD-2);
}
signed main() {
int n;
cin>>n;
vector<vector<int>>g(n,vector<int>(0));
vector<pair<int,int>>v(n-1);
rep(i,n-1){
  int a,b;
  cin>>a>>b;
  a--;b--;
  if(a>b)swap(a,b);
  v[i].first=a;
  v[i].second=b;
  g[a].push_back(b);
  g[b].push_back(a);
}

int ans=0;
rep(i,n){
  int k=g[i].size();
  ans=max(k,ans);
}

map<pair<int,int>,int>color;
vector<bool>visited(n);

queue<pair<int,int>>q;

visited[0]=true;
rep(i,g[0].size()){
  int t=g[0][i];
  visited[t]=true;
  pair<int,int>p(t,i+1);
  q.push(p);
  pair<int,int>p2(0,t);
  color[p2]=(i+1);
}

while(!q.empty()){
  pair<int,int>t=q.front();
  q.pop();
  int a=t.first;
  int b=t.second;
  int cnt=0;
  rep(i,g[a].size()){
    
    if(!visited[g[a][i]]){
      visited[g[a][i]]=true;
      int c=(b+cnt)%ans+1;
      pair<int,int>p(g[a][i],c);
      int x=min(a,g[a][i]),y=max(a,g[a][i]);
      pair<int,int>p2(x,y);
      color[p2]=c;
      q.push(p);
      cnt++;
    }
  }
}
cout<<ans<<endl;
rep(i,n-1){
  auto p=v[i];
  cout<<color[p]<<endl;
}
}


Measured memory_bytes: 17060
#include<bits/stdc++.h>
 
#define hell                         1000000007
#define hell2                        998244353
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define all(v)                       v.begin(),v.end()
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(ll i=a;i<b;i++)
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'
 
const ll MAX=200005;
const ll SQN=330;
const ll LG=22;
const double PI=atan(1)*4;
using namespace std;

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

    ll n;
    cin >> n;
    ll r=n%1000;
    if(r==0) cout << 0 << endl;
    else cout << 1000-r << endl;
}


Measured memory_bytes: 3648
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <tuple>
#include <cmath>
#include <bitset>
#include <cctype>
#include <set>
#include <map>
#include <unordered_map>
#include <numeric>
#include <functional>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = 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; }
inline void Yes(bool condition){ if(condition) PRINT("Yes"); else PRINT("No"); }
template<class itr> void cins(itr first,itr last){
    for (auto i = first;i != last;i++){
        cin >> (*i);
    }
}
template<class itr> void array_output(itr start,itr goal){
    string ans = "",k = " ";
    for (auto i = start;i != goal;i++) ans += to_string(*i)+k;
    if (!ans.empty()) ans.pop_back();
    PRINT(ans);
}
ll gcd(ll a, ll b) {
    return a ? gcd(b%a,a) : b;
}
const ll INF = 1e18;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
typedef pair<ll,ll> P;
typedef pair<double,double> point;
const ll MAX = 200000;
constexpr ll nx[8] = {1,0,-1,0,1,-1,1,-1};
constexpr ll ny[8] = {0,1,0,-1,1,1,-1,-1};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll x;
    cin >> x;
    ll r = x%11;
    if (r == 0) PRINT(x/11*2);
    else if (r <= 6) PRINT(x/11*2+1);
    else PRINT(x/11*2+2);
}


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

using namespace std;

int main()
{
    int K,S;
    long long ans=0;
    
    scanf("%d%d",&K,&S);
    
    for(int i=0;i<=K;i++)
    {
        for(int j=0;j<=K;j++)
        {
            if(i+j<=S && S-(i+j)<=K)
                ans++;
        }
    }
    
    printf("%lld",ans);
    
    return 0;
}

Measured memory_bytes: 3832
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main() {
    char s[10];
    scanf("%s", s);
    if(!strcmp(s,"hi")){
        printf("Yes");
        return 0;
    }else if(!strcmp(s,"hihi")){
        printf("Yes");
        return 0;
    }else if(!strcmp(s,"hihihi")){
        printf("Yes");
        return 0;
    }else if(!strcmp(s,"hihihihi")){
        printf("Yes");
        return 0;
    }else if(!strcmp(s,"hihihihihi")){
        printf("Yes");
        return 0;
    }else{
        printf("No");
        return 0;
    }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int t; cin >> t; cin.ignore(); while(t--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<'\n'
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<'\n'
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<'\n';
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
bool check1;
ld xpow(ld n, ll m){if(m==0){return 1;}else{ld x = xpow(n, m/2);if(m&1){ld res = x*x*n;if(res>1e7){check1=1;};return res;}else{ld res = x*x;if(res>1e7){check1=1;}return res;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}
 
int main(){
    fast();
 
/* you get what you work for not what you wish for */
    
    inp(n);
    string s;
    cin >> s;
    if(n&1){
        cout << "No" << endl;
    }
    else{
        string r = "";
        for(int i=0; i<n/2; i++){
            r+=s[i];
        }
        r = r+r;
        if(r==s){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl; 
        }
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;

typedef tree<pair<long long,int>, null_type, less<pair<long long,int>>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;

#define f first
#define se second
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pi pair<int, int>
#define all(num) num.begin(), num.end()
#define lp(i, nodess) for (int i = 0; i < nodess; i++)
#define mem(u, vis) memset(u, vis, sizeof(u))
#define X real()
#define Y imag()
#define angle(u) (atan2(u.Y, u.X))
#define vec(u, v) ((v) - (u))
//#define length(u) (hypot(u.Y , u.X))
#define normalize(u) (u) / length(u)
#define dotP(u, v) ((conj(u) * v).X)
#define crossP(u, v) ((conj(u) * v).Y)
#define same(p1, p2) (dotP(vec(p1, p2), vec(p1, p2)) < EPS)
#define lengthSqr(u) dotP(u, u)
#define rotate0(p, ang) ((p)*exp(point(0, ang)))
#define rotateA(p, ang, about) (rotate0(vec(about, p), ang) + about)
#define reflect0(vis, m) conj(vis / m) * m
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const double PI = acos(-1.0);
const double EPS = (1e-10);
const long long int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
typedef long long int ll;
typedef unsigned long long ull;
typedef complex<double> point;
long long fastpow(ll nodess, ll num) {
  if (!num)
    return 1;
  if (num % 2)
    return nodess * fastpow(nodess, num - 1)/*%mod*/;
  ll p = fastpow(nodess, num / 2);
 // p %= mod;
  p *= p;
 // p %= mod;
  return p;
}

ll my_mod(ll num, ll mod) {
  ll reto = num % mod;
  while (reto < 0)
    reto += mod;
  return reto;
}

ll gcd(ll u, ll v) { return !u ? v : gcd(v % u, u); }
long long dist(pair<ll, ll> u, pair<ll, ll> v) {
  return 
      abs(u.f - v.f)  + abs(u.se - v.se);
}



/*vector<int> ap;
int np[MX+5];
void s(){
    mem(np , 1);
    np[1] = np[0] = 0;
    for(ll i = 2 ; i*i<= MX ;i++){
        if(np[i]){
            for(ll j= i*i ; j <=MX; j+=i) np[j] = 0;
        }
    }
    int idx = 1;
    for(ll i = 2 ; i<= MX ; i++){
		if(np[i]){
			np[i] = idx;
			idx++; 
			ap.pb(i);
		}
	}
	//cout<<idx;
}*/
const int MX = 1e5 + 9;


int main()
{
    IO;
	int n;
	string s,t;
	cin>>n>>s>>t;
	string ans = "";
	for(int i =0 ;i <n ;i++) ans += string(1,s[i])+ string(1,t[i]);
	cout<<ans;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
int GCD(int a,int b){return b?GCD(b,a%b):a;}
int LCM(int a,int b){return (a*b)/GCD(a,b);}
int abs(int x){return x>0?x:-x;}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	string s;
	cin >> s;
	ll sum = 0;
	int len = (int)s.size();
	vector<int> index_b;
	for (int i = 0; i < len; i++){
		if (s[i] == 'B') index_b.push_back(i);
	}

	reverse(ALL(index_b));
	len--;
	for (auto x : index_b){
		sum += (len--) - x;
	}

	cout << sum << endl;
}


Measured memory_bytes: 1532
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
#define ll long long
using lint=long long;
typedef pair<int,int> P;
const int inf=1000000007;
const int MOD=1000000007;
signed main(){
  int n,t;cin>>n>>t;
  vector<P> input(n);
  rep(i,n)cin>>input[i].first>>input[i].second;
  sort(input.begin(),input.end());
  vector<int> a(n);
  vector<int> b(n);
  rep(i,n){
      a[i]=input[i].first;b[i]=input[i].second;
  }
  int mx=b[n-1];
  vector<vector<int>> dp(n,vector<int>(t+5,0));
  for(int i=a[0];i<t;++i)dp[0][i]=b[0];
  rep1(i,n-1){
      for(int j=t-1;j>0;--j){
          dp[i][j]=dp[i-1][j];
          if(j<a[i])continue;
          dp[i][j]=max(dp[i][j],dp[i-1][j-a[i]]+b[i]);
      }
  }
  int res=0;
  for(int i=n-1;i>0;--i){
      mx=max(mx,b[i]);
      res=max(res,dp[i-1][t-1]+mx);
  }
  cout<<res<<"\n";
  return 0;
}

Measured memory_bytes: 38504
from collections import Counter
n = int(input())
s = input()
c = Counter(s)
tmp = c['E']
best = tmp - (1 if s[0] == 'E' else 0)
for i in range(1, n):
    if s[i - 1] == 'W':
        tmp += 1
    else:
        tmp -= 1
    if tmp - (1 if s[i] == 'E' else 0) < best:
        best = tmp - (1 if s[i] == 'E' else 0)
print(best)


Measured memory_bytes: 41944
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部定数
#define D_CNT_MAX		100005									// 最大回数

// 内部変数
static FILE *szpFpI;											// 入力
static int siJCnt;												// じゃんけん回数
static int siK;													// K
static int siRVal, siSVal, siPVal;								// 各スコア
static char sc1Str[D_CNT_MAX];									// 手
static int si2Max[D_CNT_MAX][2];								// 最大スコア[手数][勝敗]

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 実行メイン
int
fMain(
)
{
	int i, j;
	char lc1Buf[1024];

	// 回数・K - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d%d", &siJCnt, &siK);

	// 各スコア - 取得
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d%d%d", &siRVal, &siSVal, &siPVal);

	// 手 - 取得
	fgets(sc1Str, sizeof(sc1Str), szpFpI);

	// 初期化
	si2Max[0][0] = 0;
	si2Max[0][1] = 0;

	// 最大スコア - 取得
	int liSum = 0;
	for (i = 0; i < siK; i++) {

		// 最大スコア - セット
		int liPos = i;
		for (j = 1; ; j++) {

			// 負->負
			si2Max[j][0] = si2Max[j - 1][0];

			// 勝->負
			if (si2Max[j][0] < si2Max[j - 1][1]) {
				si2Max[j][0] = si2Max[j - 1][1];
			}

			// スコア
			int liSCore;
			switch (sc1Str[liPos]) {
			case 'r':	liSCore = siPVal;	break;
			case 's':	liSCore = siRVal;	break;
			case 'p':	liSCore = siSVal;	break;
			}

			// 負->勝
			si2Max[j][1] = si2Max[j - 1][0] + liSCore;

			// 勝->勝
			int liPNo = liPos - siK;
			if (liPNo < 0 || sc1Str[liPNo] != sc1Str[liPos]) {
				int liVal = si2Max[j - 1][1] + liSCore;
				if (si2Max[j][1] < liVal) {
					si2Max[j][1] = liVal;
				}
			}

			// 次の位置
			liPos += siK;
			if (liPos >= siJCnt) {
				break;
			}
		}

		// 最大スコア - 加算
		if (si2Max[j][0] > si2Max[j][1]) {
			liSum += si2Max[j][0];
		}
		else {
			liSum += si2Max[j][1];
		}
	}

	return liSum;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// データ - 初期化
	memset(sc1Str, 0, sizeof(sc1Str));							// 手

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 出力
	sprintf(lc1Buf, "%d\n", liRet);
	fOutLine(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



Measured memory_bytes: 1024
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.1415926535897932384626;
long long int mod = 1000000007;
 
vector<ll> G[500005];
vector<P> tree[500010];
priority_queue <ll> pql;
priority_queue <P> pqp;
//big priority queue
priority_queue <ll,vector<ll>,greater<ll> > pqls;
priority_queue <P,vector<P>,greater<P> > pqps;
//small priority queue
//top pop

int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
//↓,→,↑,←
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define deba(x) cout<< #x << " = " << x <<endl

ll rui(ll abc,ll bed){
	//abcのbed乗を計算する
	if(bed==0){return 1;}
	else{
		ll ced = rui(abc,bed/2);
		ced *= ced;
		ced %= mod;
		if(bed%2==1){ced*=abc; ced%=mod;}
		return ced;
	}
} 

ll  fact[400000];
ll rfact[400000];

ll mpow(ll x, ll y, ll m) {
    x %= m;
    ll result = 1;
    while (y > 0) {
        if (y & 1) result = (result * x) % m;
        x = (x * x) % m;
        y >>= 1;
    }
    return result;
}
 
unsigned long long int minverse(unsigned long long int x, unsigned long long int m) {
    return mpow(x, m-2, m);
}
 
void c3_init(ll m){
    fact[0]  = rfact[0] = 1;
    for(ll xxxx=1; xxxx<400000; xxxx++){
        fact[xxxx] = (fact[xxxx-1]*xxxx)%m;
        rfact[xxxx] = minverse(fact[xxxx],m);
    }
}
ll c3(ll n, ll abc, ll m){
    return (((fact[n] * rfact[abc])%m) * rfact[n-abc])%m;
}



ll i,j,k,ii,jj;
ll n,m,num,sumxor,sum,ans;
ll a,b,c,d,e,f,g,h,w,v;
ll x[800005],y[800005],z[900005];
char s[500005];
ll dp[85][5005];



int main(){	
	c3_init(mod);
	cin >> n >> m;
	a = m;
	ans = 1;
	for(i=2;i<=m;i++){
		if(a%i==0){
			num = 0;
			while(a%i==0){
				num ++;
				a /= i;
			}
			ans *= c3(num+n-1,num,mod)%mod;
			ans %= mod;
		}
		if(a==1)break;
	}
	p(ans);


		
	return 0;
}

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

int main() {
	int x,y;
	while(1){
	cin >> x >> y;
	if(x > y){
		swap(x,y);
	}
	if(x == 0 && y == 0){
		break;
	}
	cout << x << " " << y << endl;
	}
	return 0;
}

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

 int main(){
    int n,k,ans=1e9;
    cin >> n >> k;
    vector<int> v(n);
    for(int i=0;i<n;i++){
       cin >> v.at(i) ;
    }
    sort(v.begin(),v.end());
    for(int i=0;i+k-1<n;i++){
       if(ans>v.at(i+k-1)-v.at(i)){
          ans=v.at(i+k-1)-v.at(i);
       }
    }
    cout << ans << endl;
 }

Measured memory_bytes: 640
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cctype>
#include <bitset>
#include <cassert>
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
const int MX = 100005, INF = 1001001001;
const ll LINF = 1e18;
const double eps = 1e-10;
const int DIV = 1e9+7;

ll x;

int main(){
  cin >> x;
  ll ans = 0;
  ans += (x / 11) * 2;
  if((x % 11) > 6) ans += 2;
  else if ((x % 11) != 0) ans += 1;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
// Copyright (C) 2017 __debug.

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; If not, see <http://www.gnu.org/licenses/>.


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>

#define x first
#define y second
#define MP std::make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif

using std::pair;
using std::vector;
using std::string;

typedef long long LL;
typedef pair<int, int> Pii;

const int oo = 0x3f3f3f3f;

template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; }
template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, true : false; }
string procStatus()
{
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}
template<typename T> T read(T &x)
{
    int f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar())
        f = (ch == '-' ? -1 : 1);
    for (x = 0; isdigit(ch); ch = getchar())
        x = 10 * x + ch - '0';
    return x *= f;
}
template<typename T> void write(T x)
{
    if (x == 0) {
        putchar('0');
        return;
    }
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    static char s[20];
    int top = 0;
    for (; x; x /= 10)
        s[++top] = x % 10 + '0';
    while (top)
        putchar(s[top--]);
}
// EOT

const int MAXN = 1e5 + 5;

int N;
int A[MAXN];

void input()
{
    read(N);
    for (int i = 1; i <= N; ++i) {
        read(A[i]);
    }
}

void solve()
{
    if (N == 2) {
        puts((A[1] + A[2]) & 1 ? "First" : "Second");
        return;
    }

    for (int side = 0; ; side ^= 1) {
        LL cntodd = 0, sum = 0, cnt1 = 0;
        for (int i = 1; i <= N; ++i) {
            sum += A[i];
            if (A[i] & 1)
                ++cntodd;
            if (A[i] == 1)
                ++cnt1;
        }
        if ((sum - N) & 1) {
            puts(side ? "Second" : "First");
            break;
        }
        if (cnt1 != 0 || cntodd != 1) {
            puts(side ? "First" : "Second");
            break;
        }
        int g = 0;
        for (int i = 1; i <= N; ++i) {
            if (A[i] & 1) --A[i];
            g = std::__gcd(g, A[i]);
        }
        assert(g != 1);
        for (int i = 1; i <= N; ++i) {
            A[i] /= g;
        }
    }
}

int main()
{
#ifdef __DEBUG
    freopen("D.in", "r", stdin);
    freopen("D.out", "w", stdout);
#endif

    input();
    solve();

    return 0;
}

// 月出惊山鸟，时鸣春涧中。
//     -- 王维《鸟鸣涧》


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 1e5 + 7, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
string array1[]={"gray","brown","green","cyan","blue","yellow","orange","red"};
int main()
{
int n,i,num,mini=0,maxi=0,counter=0;
set<int>visited;
scanf("%d",&n);
for(i=0;i<n;++i){
    scanf("%d",&num);
    if(num>=3200){
        counter++;
    }
    else{
        int choice=floor(1.0*num/400.0);
        visited.insert(choice);
    }
}
mini=visited.size();
if(mini==0){
    mini=1;
    maxi=counter;
}
else{
    maxi=mini+counter;
}
printf("%d %d",mini,maxi);


    return 0;
}


Measured memory_bytes: 3704
#include <bits/stdc++.h>
#define ll long long
#define pb                      push_back
#define MOD                     1000000007
#define endl                    "\n"

using namespace std;	
int main() {

	  int n;
	  cin>>n;
	  int arr[n][3];
	  for(int i=0;i<n;i++)
	  {
	  	for(int j=0;j<3;j++)
        {
          cin>>arr[i][j];
        }
      }
  int dp[n][3];
  for(int j=0;j<3;j++)
    dp[0][j]= arr[0][j];
  for(int i=1;i<n;i++)
  {
    for(int j=0;j<3;j++)
    { int maxi = INT_MIN;
     for(int k=0;k<3;k++)
     {
       if(j!=k)
         maxi = max(dp[i-1][k],maxi);
     }
     dp[i][j]= maxi + arr[i][j];
    }
  } int maxi = INT_MIN;
  for(int j=0;j<3;j++)
    maxi = max(maxi,dp[n-1][j]);
  cout<<maxi<<endl;
	}


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

import static java.lang.Character.isUpperCase;

public class Main {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        int A = in.nextInt();
        int B = in.nextInt();
        int C = in.nextInt();

        if(A==B && B==C && C==A || A!=B && B!=C && C!=A)
        {
            System.out.println("No");
        }
        else
            {
                System.out.println("Yes");
            }





    }


 }













Measured memory_bytes: 35520
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
	const int mod=1000000007;
	static void Main(){
		int[] s=Array.ConvertAll(Console.ReadLine().Split(),int.Parse);
		long[,] dp=new long[s[0]+1,s[0]+1];
		dp[0,0]=1;
		long[] f=new long[s[0]+1];
		f[0]=1;
		for(int i=1;i<=s[0];i++){f[i]=(f[i-1]*i)%mod;}
		for(int i=1;i<=s[0];i++){
			dp[i,0]=1;
			for(int j=1;j<=s[0];j++){
				dp[j,i]+=dp[j-1,i];
				if(s[1]<=j&&j<=s[2]){
					long q=1;
					for(int x=1;x<=i/j&&x<=s[4];x++){
						q=(((q*((f[i-j*(x-1)]*mi((f[j]*f[i-j*(x-1)-j])%mod))%mod))%mod)*mi(x))%mod;
						if(x>=s[3]){dp[j,i]=(dp[j,i]+((((dp[j-1,i-j*x]*q)%mod))%mod))%mod;}
					}
				}
			}
		}
		Console.WriteLine("{0}",dp[s[0],s[0]]);
	}
	static long mi(long a){
		long b=mod,u=1,v=0;
		while(b>0){
			long t=a/b;
			a-=t*b;a^=b;b^=a;a^=b;
			u-=t*v;u^=v;v^=u;u^=v;
		}
		u%=mod;
		if(u<0){u+=mod;}
		return u%mod;
	}
}

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

#define mem( arr, i ) fill( arr, arr + sizeof (arr), i )
#define MEM( arr, i ) memset( arr, i, sizeof (arr) )
typedef unsigned long long ull;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vcI;
typedef vector<lli> vcL;
typedef vector<pii> vPI;
typedef vector<pll> vPL;
const lli I_MAX = 1LL << 60;
const lli mod = 1000000007;

lli c_mn[ 100000+99 ][ 30+5 ];

lli get_ans(int n, int x) {
	return c_mn[ n+x-1 ][x];
}

void precal() {
	for (int i = 0; i <= 100050; ++i) c_mn[i][0] = 1;
	for (int j = 0; j <= 32; ++j) c_mn[j][j] = 1;
	
	
	for (int i = 2; i <= 100050; ++i) {
		for (int j = 1; j <= 32 and j < i; ++j) {
			c_mn[i][j] = ( c_mn[ i-1 ][j] + c_mn[ i-1 ][ j-1 ] ) % mod;
		}
	}
	
	return;
}

void solve() {
	lli n, m, ans = 1;
	cin >> n >> m;
	
	vPI pd;
	
	for (int i = 2; i*i <= m; ++i) {
		if ( m%i == 0 ) {
			pd.push_back( { i, 0 } );
		}
		while ( m%i == 0 ) {
			(*pd.rbegin()).second++ ;
			m /= i;
		}
	}
	
	if ( m != 1 ) pd.push_back( { m, 1 } );
	
	for (auto x : pd) {
//		cout << x.second << ' ' << get_ans( n, x.second ) << '\n';
		ans = ans * get_ans( n, x.second ) % mod;
	}
	
	cout << ans << '\n';
}

int main() {
	precal();
	int t = 1;
//	cin >> t;
	for (int i = 1; i <= t; ++i) {
//		printf("Case #%d: ", i );
		solve();
	}
	return 0;
}


Measured memory_bytes: 27648
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#define REP(i, n) for (int i = 0; i < (n); i++)

using namespace std;

int main() {
  int N;
  string S;
  cin >> N >> S;
  int allw = count(S.begin(), S.end(), '.');
  int w = 0;
  int b = 0;
  int ans = 1e9;
  REP(i, N+1) {
    int d = 0;
    d += b;
    d += allw - w;
    ans = min(ans, d);
    if (i < N) {
      if (S[i] == '.') w++;
      if (S[i] == '#') b++;
    }
  }
  cout << ans << '\n';
}


Measured memory_bytes: 640
import collections
H,W,K = map(int,input().split())
s1,e1,s2,e2 = map(int,input().split())
s1-=1
e1-=1
s2-=1
e2-=1
L = []
board = []
for _ in range(H):
    a = input()
    L.append(a)
for i in range(H):
    l = L[i]
    tmp = []
    for j in range(len(l)):
        tmp.append(l[j])
    board.append(tmp)

queue = collections.deque()
queue.append([0,s1,e1])
seen = [[float('inf')]*(W) for _ in range(H)]
destination = [(1,0),(-1,0),(0,1),(0,-1)]
while queue:
    cost,x,y = queue.popleft()
    seen[x][y] = cost
    if x==s2 and y ==e2:
        print(cost);exit()
        break
    for dx,dy in destination:
        X,Y = x,y
        for i in range(1,K+1):
            NX = X +i*dx
            NY = Y + i*dy
            if 0>NX or NX>=H or 0>NY or NY>=W or seen[NX][NY] < seen[X][Y]+1: break
            else:
                if board[NX][NY]=='@':
                    break
                elif seen[NX][NY] ==float('inf'):
                    queue.append([cost+1,NX,NY])
                    seen[NX][NY] = cost+1

print(-1)

Measured memory_bytes: 170788
#include<iostream>
#include<string>
#include<cmath>
#include<algorithm>


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


	int min_ = 1000;
	for (unsigned i{}; i < s.size() - 2; ++i) {
		auto x = std::stoi( s.substr(i, 3) );
		min_ = std::min(std::abs(753-x), min_);
	}

	std::cout << min_ << "\n";

	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  int g[] = {0, 1, 3, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1};
  if (g[a] == g[b]) cout << "Yes";
  else cout << "No";
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <limits>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <vector>
#include <deque>
#include <cmath>

using namespace std;

string s;

// len[i] = len[i-1] + 1 if (s[i] == R)
//          0 otherwise

int main() {
    int max_ans = 0;
    int len[3];
    cin >> s;

    if (s[0] == 'R') {
        len[0] = 1;
        max_ans = 1;
    } else {
        len[0] = 0;
    }
    for (int i = 1; i < s.length(); ++i) {
        if (s[i] == 'R') {
            len[i] = len[i - 1] + 1;
            max_ans = max(max_ans, len[i]);
        } else if (s[i] == 'S') {
            len[i] = 0;
        }
    }
    cout << max_ans << "\n";
    return 0;
}


Measured memory_bytes: 3580
N=int(input())
A = list(map(int, input().split()))
# for i in range(N):
#     a=map(int,input().split())
#     A.append(a) 

x=0
B=A[0]
for i in range(N):
    if B<=A[i]:
        x+=1
        B=A[i]

print(x)





Measured memory_bytes: 38384
#pragma comment(linker, "/STACK:1000000000")
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cstring>
#include<map>
#include<set>
#include<deque>
#include<cassert>
#include<ctime>
#include<unordered_map>
#include<cmath>
using namespace std;

#define sz(x) (int)(x.size())
#define fi(a,b) for(int i=a;i<b;++i)
#define fj(a,b) for(int j=a;j<b;++j)
#define fo(a,b) for(int o=a;o<b;++o)
#define fdi(a,b) for(int i=a-1;i>=b;--i)
#define fdj(a,b) for(int j=a-1;j>=b;--j)
#define fdo(a,b) for(int o=a-1;o>=b;--o)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef unsigned long long ull;
typedef long double ld;
//////////////////////

int const N = 1e5 + 41;

int n, m, a[N], b[N], v[N];
int ans;
int q[N];

void solve(){
	fi(0, n) q[i] = 1;
	v[0] = 1;
	fi(0, m){
		--q[a[i]];
		v[b[i]] |= v[a[i]];
		if(q[a[i]] == 0) v[a[i]] = 0;
		++q[b[i]];
	}
	fi(0, n) ans += v[i];
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	scanf("%d %d",&n,&m);
	fi(0, m){
		scanf("%d %d",&a[i],&b[i]);
		--a[i];--b[i];
	}

	solve();

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

	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define FOR(i,k,n) for(ll i=(k);i<(ll)(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(x) begin(x),end(x)
 
using namespace std;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin>>n;
  vecint a(n+1);
  for(auto&&e:a)cin>>e;
  if (n == 0) {
    if (a[0] == 1) {
      cout<<1<<"\n";
    } else {
      cout<<-1<<"\n";
    }
    return 0;
  }
  if (a[0] > 0) {
    cout<<-1<<"\n";
    return 0;
  }
  ll leaves = 0;
  REP(i,n+1) leaves += a[i];
  ll cnt = 1;
  ll sum = 0;
  FOR(i,0,n+1) {
    sum += cnt;
    if (a[i] > cnt) {
      cout<<-1<<endl;
      return 0;
    }
    cnt -= a[i];
    cnt *= 2;
    leaves -= a[i];
    cnt = min(cnt, leaves);
  }
  cout<<sum<<endl;
  return 0;
}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 10;
char ch[N];
signed main() {
	cin >> ch + 1;
	int fl = 1;
	if (strlen(ch + 1) % 2) {
		cout << "No " << endl;
		return 0;
	}

	for (int i = 1; i <= strlen(ch + 1); i++) {
		if (i % 2 == 0) {
			if (ch[i] != 'i') {
				fl = 0;
				break;
			}
		}
		else {
			if (ch[i] != 'h') {
				fl = 0;
				break;
			}
		}
	}
	if (fl) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256