akhauriyash/Code-Regression huggingface dataset:
/*
confirm 0LL and 1LL
confirm cornercases such as 0
confirm times of cin < 10^6
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Pld = pair<ld, ld>;
using Vec = vector<ll>;
using VecP = vector<P>;
using VecB = vector<bool>;
using VecC = vector<char>;
using VecD = vector<ld>;
using VecS = vector<string>;
using Graph = vector<VecP>;
template <typename T>
using Vec1 = vector<T>;
template <typename T>
using Vec2 = vector<Vec1<T> >;
#define REP(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REPN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define REPR(i, m, n) for(ll (i) = (m)-1; (i) >= (n); --(i))
#define REPNR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) REP(i, 0, n)
#define repn(i, n) REPN(i, 1, n)
#define repr(i, n) REPR(i, n, 0)
#define repnr(i, n) REPNR(i, n, 1)
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define fs first
#define sc second
template <typename T>
bool chmax(T &a, const T b){if(a < b){a = b; return true;} return false;}
template <typename T>
bool chmin(T &a, const T b){if(a > b){a = b; return true;} return false;}
template <typename T>
ll pow2(const T n){return (1LL << n);}
template <typename T>
void cosp(const T n){cout << n << ' ';}
void co(void){cout << '\n';}
template <typename T>
void co(const T n){cout << n << '\n';}
template <typename T1, typename T2>
void co(pair<T1, T2> p){cout << p.fs << ' ' << p.sc << '\n';}
template <typename T>
void co(const Vec1<T> &v){for(T i : v) cosp(i); co();}
template <typename T>
void co(initializer_list<T> v){for(T i : v) cosp(i); co();}
template <typename T>
void ce(const T n){cerr << n << endl;}
void sonic(){ios::sync_with_stdio(false); cin.tie(0);}
void setp(const ll n){cout << fixed << setprecision(n);}
constexpr int INF = 1e9+1;
constexpr ll LINF = 1e18+1;
constexpr ll MOD = 1e9+7;
//constexpr ll MOD = 998244353;
constexpr ld EPS = 1e-11;
const ld PI = acos(-1);

int main(void){
	ll x, y, z;
	cin >> x >> y >> z;
	co({z, x, y});

	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define print(n) cout<<n<<endl
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
const int M=200111;
const int inf=1000000007;
const long long INF=1e18;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};


struct UnionFind {
	vector<int> par;
	UnionFind(int n) : par(n, -1) { }

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

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

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

vvl comb(int n, int r) {
	vvl v(n + 1,vl(n + 1, 0));
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int j = 1; j < v.size(); j++) {
		for (int k = 1; k < j; k++) {
			v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
		}
	}
	return v;
}

void sosu(ll x,bool f[]){
	ll y=x;
	for(ll i=2;i<=sqrt(y);i++){
		if(x%i==0){
			x/=i;
			f[i]=true;
			i--;
		}
	}
}

ll __gcd(ll x,ll y){
	if(x<y)swap(x,y);
	while(1){
		ll tmp=x%y;
		x=y;
		y=tmp;
		if(y==0)break;
	}
	return x;
}

int keta(ll a){
	int ke=1;
	while(a/=10)ke++;
	return ke;
}

int main(){
	ll h,n;
	ll a,sum=0;
	cin>>h>>n;
	rep(i,0,n)cin>>a,sum+=a;
	if(h>sum)print("No");
	else print("Yes");




}

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


int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 1;
  for(int i=1;i<n;i++){
    if(s.at(i) != s.at(i-1)){
      ans++;
    }
  }
  
  cout << ans << endl;
  
  return 0;
}

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

const int MAX_V = 100;
vector<int> G[MAX_V*2];
int color[MAX_V*2];

bool dfs(int s) {
    if (G[s].empty()) return false;
    if (color[s] > 0) return true;

    // cout << "# s: " << s << " -> ";
    // for (int i = 0; i < G[s].size(); i++) {
    //     cout << G[s][i] << " ";
    // }
    // cout << endl;

    color[s] = 1;
    for (int i = 0; i < G[s].size(); i++) {
        if (dfs(G[s][i])) {
            color[s] = -1;
            return true;
        }
    }
    color[s] = -1;

    return false;
}

int main(void) {
    int N; cin >> N;
    int u, v;
    string rel;
    for (int i = 0; i < N; i++) {
        cin >> u >> rel >> v;
        u--; v--;
        // ??????????????¢???????????????+MAX_V????????????????????????????????????????????????
        if (rel == "lock") {
            G[v+MAX_V].push_back(u);
        } else {                // wait
            G[u].push_back(v+MAX_V);
        }
    }

    fill(color, color+MAX_V*2, -1);
    bool ret = false;
    for (int i = 0; i < MAX_V; i++) {
        if (!G[i].empty()) {
            ret |= dfs(i);
        }
        if (ret) break;
    }

    if (ret) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }

    // for (int i = 0; i < MAX_V*2; i++)  {
    //     if (G[i].empty()) continue;

    //     cout << i+1 << ": ";
    //     for (int j = 0; j < G[i].size(); j++) {
    //         cout << G[i][j]+1 << " ";
    //     }
    //     cout << endl;
    // }

    return 0;
}

Measured memory_bytes: 3164
n,k = map(int,input().split())
win_rate = 0
if n >=k:
    win_rate += (n-k+1)/n
    for i in range(1,k):
        rate = 1
        while i < k:
            i *= 2
            rate *= 0.5
        win_rate += rate * (1/n)
    print(win_rate)
else:
    for i in range(1,n+1):
        rate = 1
        while i < k:
            i *= 2
            rate *= 0.5
        win_rate += rate * (1/n)
    print(win_rate)


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

int main(){
  int N;
  cin >> N;
  vector<int> Blue = vector<int>(N);
  for(int i = 0;i<N;i++){ 
    cin >> Blue.at(i);
  }
  
  sort(Blue.begin(),Blue.end());
  
  int ans=1,nowD=Blue.at(N-1);
  
   for(int i = N-2;i>=0;i--){
   	if(nowD>Blue.at(i)){
   		ans++;
      nowD=Blue.at(i);
   	}	
   }
  
  cout << ans <<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


signed main()
{
     ios_base::sync_with_stdio(false);
     cin.tie(NULL);  
//  #ifndef ONLINE_JUDGE
//     freopen ("INPUT.txt" , "r" , stdin);
//     freopen ("OUTPUT.txt" , "w" , stdout);
//  #endif
 
// -------------------------------------Code starts here---------------------------------------------------------------------     

   string s,t,u;
   cin>>s>>t;
   int a,b;
   cin>>a>>b;
   cin>>u;
   if(s==u)
      cout<<a-1<<" "<<b;
   else
      cout<<a<<" "<<b-1;

// -------------------------------------Code ends here------------------------------------------------------------------
     clock_t clk;
 	clk = clock();
 
    clk = clock() - clk;
 	cerr << fixed << setprecision(6) << "Time: " << ((double)clk)/CLOCKS_PER_SEC << "\n";
 	return 0;
 }


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


int main(void)
{
    int N;
    cin >> N;
    int p[N];
    for(int i = 0; i < N; i++){
        cin >> p[i];
    }
    sort(p, p + N);

    int res = 0;
    for(int i = 0; i < N; i++){
        if(i != N - 1)
            res += p[i];
        else
            res += (p[i]/2);
    }
    

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <map>
#include <sstream>
#include <algorithm>
using namespace std;
 
int main(){
    int n;
    while(cin >> n && n){
        string l;
        getline(cin,l);
        map<string,int> W;
        vector< pair<int,string> > S;
        for(int i = 0 ; i < n ; i++){
            getline(cin,l);
            if( l[l.size()-1] == '\r' ){
                l = l.substr(0,l.size()-1);
            }
             
            stringstream ss(l);
            while(ss >> l){
                W[l]--;
            }
        }
        for( map<string,int> :: iterator it = W.begin() ; it != W.end() ; it++){
            S.push_back(make_pair(it->second,it->first));
        }
        char b;
        cin >> b;
        sort(S.begin(),S.end());
        int k = 0;
        for(int i = 0 ; i < S.size() ; i++){
            if( S[i].second[0] == b && k < 5){
                cout << (k++?" ":"") << S[i].second;
            }
        }
        if( !k ) cout << "NA" << endl;
        else cout << endl;
    }
     
}

Measured memory_bytes: 1252
import java.util.Scanner;

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

		int[] cnt = new int[2];
		for (int i = 0; i < s.length(); i++) {
			cnt[s.charAt(i) - '0']++;
		}
		System.out.println(Math.min(cnt[0], cnt[1]) * 2);
	}
}


Measured memory_bytes: 24276
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <string>
#include <queue>
#include <fstream>
#include <string>
#include <math.h>
using namespace std;
typedef long long ll;
//typedef pair<ll, ll> P;
//typedef pair<double, P> T;

const ll mod = 1000000007;
const ll INF = 100000010000;

ll N, x[100010], sum[100010];

ll ans;

ll gcd(ll x, ll y)
{
	if (y == 0) return x;
	return gcd(y, x % y);
}

ll pow_mod(ll x, ll y)
{
	if (y == 0) return 1;
	if (y % 2 == 1)
	{
		return x * pow_mod(x, y - 1) % mod;
	}
	else
	{
		ll half = pow_mod(x, y / 2);
		return half * half % mod;
	}
}

ll div_mod(ll x)
{
	return pow_mod(x, mod - 2);
}

/*ll sum_bit(ll i)
{
	ll s = 0;
	while (i > 0)
	{
		s += bit[i];
		i -= i & -i;
	}
	return s;
}

void add_bit(ll i, ll x)
{
	while (i <= 2 * N + 10)
	{
		bit[i] += x;
		i += i & -i;
	}
}*/

void init()
{
	cin >> N;

	for (int i = 1; i <= N; i++)
	{
		cin >> x[i];
	}
	
}

void output()
{
	cout << ans << endl;
}



void solve()
{
	ll pro = 0;
	for (int i = 1; i < N; i++)
	{
		(pro += div_mod(i)) %= mod;
		(ans += (x[i + 1] - x[i]) * pro % mod) %= mod;
	}
	for (int i = 1; i < N; i++)
	{
		(ans *= i) %= mod;
	}
}

int main()
{
	init();
	
	solve();

	

	output();
	ll N;
	cin >> N;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <string>
#include <climits>
#include <algorithm>
#include <queue>
#include <vector>
#define ll long long
using namespace std;
struct re
{
    int a;
    int id;
}p[100005];
bool cmp(re x,re y)
{
    return x.a < y.a;
}
int main()
{
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        int x;
        cin>>x;
        p[i].id =  i;
        p[i].a = x;
    }
    sort(p+1,p+n+1,cmp);
    for(int i=1;i<=n;i++)
    {
        cout<<p[i].id<<" ";
    }
    return 0;
}


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

signed main(){
  int A,B,H,M;
  cin>>A>>B>>H>>M;
  double PI=3.14159265358979323846264338327950L;
  double R=(H/12.0+(M/60.0)/12.0-M/60.0)*PI*2;
  double ans=A*A+B*B-2*A*B*cos(R);
  cout<<fixed<<setprecision(20)<<sqrt(ans)<<endl;
}

Measured memory_bytes: 4208
#include <iostream>
using namespace std;
 
int main(void){

    int a, b, c;
    int x, y;

    cin >> a >> b >> c;

    if(b > c){
        x = c;
    }else{
        x = b;
    }

    y = a - (b + c);
    if (y > 0){
        y = 0;
    }

    cout << x << " " << abs(y) << endl;

    return 0;
}


Measured memory_bytes: 384
#include<stdio.h>
 
int main(void){
 char S[2000010],T[200010];
 int i=0,count=0;
 if(scanf("%s",S));
 if(scanf("%s",T));
 
 for(i=0;S[i] != '\0';i++){
  if(S[i] != T[i]){
   count++;
  }
 }
 printf("%d\n",count);
 return 0;
}

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

void SpecialCase(ll m)
{
  int x;
  cin >> x;
  cin >> x;
  for (ll i = 1; i < m; i++)
  {
    int s,c;
    cin >> s >> c;
    if ( x != c )
    {
      cout << -1 << endl;
      return;
    }
  }
  cout << x << endl;
  
}

int main()
{
  ll n,m;
  cin >> n >> m;
  vector<int> A(n+1,-1);

  if(n==1)
  {
    SpecialCase(m);
    return 0;
  }

  for (ll i = 0; i < m; i++)
  {
    int s,c;
    cin >> s >> c;

    if( s==1 && c==0 )
    {
      cout << "-1" << endl;
      return 0;
    }

    if( A[s]!=-1 && A[s]!=c )
    {
      cout << -1 << endl;
      return 0;
    } else {
      A[s] = c;
    }
  }

  A[1] = max(A[1],1);

  for (int i = 1; i < n+1; i++)
  {
    cout << max(A[i],0);
  }
  cout << endl; 

  return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;

int main() {
    int A,B,C;cin>>A>>B>>C;
    if(A+B+C>=22)cout<<"bust"<<endl;
    else cout<<"win"<<endl;
}

Measured memory_bytes: 3596
#include <iostream>
#include <queue>
#include <utility>
#include <vector>

struct Edge {
  int from, to, weight;
  Edge(int from, int to, int weight) : from(from), to(to), weight(weight) {}
};

struct Node {
  std::vector<Edge> ongoingEdges;
  void addEdge(Edge edge) {
    ongoingEdges.push_back(edge);
  }
};

class Graph {
private:
  std::vector<Node> nodes;
  int size;
public:
  Graph(int size): size(size) {
    nodes.resize(size);
  }
  void addEdge(Edge edge) {
    nodes[edge.from].addEdge(edge);
  }

  std::vector<int> calculateDist(int source) {
    std::vector<int> dist(size, (1 << 30));
    std::priority_queue< std::pair<int, int>, std::vector< std::pair<int, int> >, std::greater< std::pair<int, int> > > pq;

    pq.push(std::make_pair(0, source));
    dist[source] = 0;

    while(!pq.empty()) {
      int from = pq.top().second;
      pq.pop();

      for(Edge edge: nodes[from].ongoingEdges) {
        if(dist[edge.to] > dist[from] + edge.weight) {
          dist[edge.to] = dist[from] + edge.weight;
          pq.push({dist[edge.to], edge.to});
        }
      }

    }

    return dist;
  }
};

int main() {
  int n;
  std::cin >> n;
  Graph graph(n);

  for(int i = 0; i < n; i++) {
    int u, k;
    std::cin >> u >> k;

    for(int i = 0; i < k; i++) {
      int v, c;
      std::cin >> v >> c;
      graph.addEdge(Edge(u, v, c));
    }

  }

  std::vector<int> dist = graph.calculateDist(0);

  for(int i = 0; i < n; i++) {
    std::cout << i << ' ' << dist[i] << std::endl;
  }

}

Measured memory_bytes: 9828
import math

def primeFactors(n):
	result = list()
	while n % 2 == 0:
		result.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			result.append(i)
			n = n / i
	if n > 2:
		result.append(n)
	return sorted(result)

n = int(input())
print('%d:' % (n), end='')
result = primeFactors(n)
for i in range(len(result)):
	print(' %d' % (result[i]), end='' if i < len(result) - 1 else '\n')


Measured memory_bytes: 5672
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <bitset>
#include <utility>
#include <numeric>
#include <queue>
#include <stack>

using ll = long long;
using namespace std;

constexpr int MOD = 1e9 + 7;
constexpr ll MOD_LL = ll(1e9) + 7;

int main(void) {
	string s;
	cin >> s;
	
	int n = (int)s.size();
	map<char, int> mp;
	for(int i = 0; i < n; ++i) {
		mp[s[i]]++;
	}
	
	bool yes = true;
	for(auto &x : mp) {
		if( x.second > 1 ) {
			yes = false;
			break;
		}
	}
	
	if( yes ) cout << "yes" << endl;
	else cout << "no" << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define VV vector
#define pb push_back
#define bitc  __builtin_popcountl
#define m_p make_pair
#define inf 1000000000000000000ll
#define MAXN 1000001
#define eps 0.0000000001
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
string char_to_str(char c){string tem(1,c);return tem;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<class T>//usage rand<long long>()
T rand() {
    return uniform_int_distribution<T>()(rng);
}

// string to integer stuuu()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();

//////////////

#define S second
#define F first
#define int long long  
///////

signed main()
{
	fastio;
	#ifdef ANIKET_GOYAL
		freopen("inputf.in","r",stdin);
		freopen("outputf.in","w",stdout);
	#endif
	string s;;
	cin>>s;
	int c=0;
	for(int i=0;i<s.length();++i)
	{
		if(s[i]=='o')
			++c;
	}
	c+=15-s.length();
	if(c>=8)
		cout<<"YES";
	else
		cout<<"NO";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
	ll n,ans=0;
	cin>>n;
	for(ll i=1;i<=n;i++){
	    ll num=n/i;
	    ll sum=(num*(num+1))/2;
	    ans+=(i*sum);
	}
	cout<<ans;
    return 0;
}

Measured memory_bytes: 3596
n, k = map(int, input().split())

answer = 0

for i in range(1, n + 1):
    score = i
    coin = 0
    while 1 <= score <= k - 1:
        score = score * 2
        coin += 1

    answer += (1 / n) * (0.5 ** coin)

print(answer)


Measured memory_bytes: 2940
import numpy as np

n = int(input())
d, x = map(int, input().split(" "))

a = np.zeros(n, np.int)
for i in range(n):
    a[i] = int(input())

for i in a:
    k = 1
    while(k <= d):
        x += 1
        k += i

print(x)

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


int main() {
  char a, b, c, d, e, f;
  cin >> a >> b >> c >> d >> e >> f;
  if(a == f && b == e){
    if(c == d){
      cout << "YES";
      return 0;
    }
  }
  cout << "NO";
  
    
  return 0;
}






Measured memory_bytes: 3604
#include <bits/stdc++.h>
#define rep(n) for (int I = 0; (I) < (n); ++(I) )
#define repeat(i, n) for( int i = 0; (i) < (n); ++(i) )
#define repeat_to(i, n) for( int i = 0; (i) <= (n); ++(i) )
#define repeat_from(i, m, n) for( int i = (m); (i) < (n); ++(i) )
#define repeat_from_to(i, m, n) for( int i = (m); (i) <= (n); ++(i) )
#define dump(x) cout << " " << #x << "=" << x
#define vdump(v) for(size_t T=0; T<v.size(); ++T){cout << " " << #v << "[" << T << "]=" << v[T];} cout << endl
using namespace std;
using lint = long long;
using ld = long double;

int main(void) {
    vector<string> s(3);
    repeat(i, 3) cin >> s[i];
    repeat(i, 3) cout << (char)(s[i][0] + ('A' - 'a'));
    cout << endl;
    return 0;
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sperase(v,n) (v).erase(remove(all(v), n), (v).end())
#define vdelete(v) (v).erase(unique(all(v)), (v).end())
#define pb(n) push_back(n)
#define mp make_pair
#define MOD 1000000007
#define INF LONG_LONG_MAX

int n,h[100000],sum,ans;

signed main() {
    cin >> n;
    rep(i,n) cin >> h[i];
    repm(i,n-1) {
        if (h[i] >= h[i+1]) sum++;
        else ans = max(ans, sum),sum = 0;
    }
    ans = max(ans, sum);
    cout << ans << endl;
}





Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <string>
#include <random>
#include <stack>
#include <set>
#include <unordered_set>

using namespace std;
typedef long long ll;
const int maxn = 100005;
const ll mm = (1LL<<60);
int n;
ll a[maxn];
ll f[maxn][2];

int main() {
#ifdef suiyuan2009
  freopen("/Users/suiyuan2009/CLionProjects/icpc/input.txt", "r", stdin);
#endif
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  f[0][0]=a[0];
  f[0][1]=-mm;
  for(int i=1;i<n;i++)
    for(int j=0;j<2;j++){
      f[i][j]=-mm;
      for(int k=0;k<2;k++){
        ll add = 0;
        if(k){
          // -a[i-1] -> a[i-1]-a[i]
          if(j)add=2*a[i-1]-a[i];
          else add=a[i];
        } else {
          if(j)add=-2*a[i-1]-a[i];
          else add=a[i];
        }
        f[i][j]=max(f[i][j], f[i-1][k]+add);
      }
    }
  //cout<<f[2][1]<<endl;
  cout<<max(f[n-1][0],f[n-1][1])<<endl;
  return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int[] west = new int[N + 2];
		int[] east = new int[N + 2];
		String S = sc.next();
		for(int i = 0; i < N ; i++) {
			if(S.charAt(i) == 'W') west[i + 1]++;
			else east[i + 1]++;
		}
		for(int i = 1; i <= N; i++) {
			west[i] += west[i - 1];
			east[i] += east[i - 1];
		}
		int ans = Integer.MAX_VALUE;
		for(int i = 1; i <= N; i++) {
			ans = Math.min(ans, west[i - 1] + east[N] - east[i]);
		}
		System.out.println(ans);
	}
}

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

const int MAX = 5000000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


int main(){
  int X,Y;
  cin >> X >> Y;
  if ((X+Y)%3!=0){
    cout << 0;
    return 0;
  }
  int r=(X+Y)/3;
  X-=r;
  Y-=r;
  COMinit();
  if(X<0&&Y<0){
    cout << 0;
  }else {
    cout << COM(X+Y,Y)%1000000007;
  }
}

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

int main() {
    int n, k;
    cin >> n >> k;
    ll ans = k;
    for (int i = 0; i < n - 1; i++)
        ans *= (k - 1);
    cout << ans << endl;
    return 0;
}

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

#define rep(i, n) for(int i=0; i < n; i++)
#define REP(i, n, m) for(int i=n; i < m; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

ll mod=1000000007;

const ll INF = 1LL << 60;

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

int main(){
  int n;cin>>n;
  vector<string> s(n);
  rep(i,n)cin>>s[i];
  sort(ALL(s));
  s.erase(unique(ALL(s)),s.end());
  cout <<s.size();
}


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

long long dp[105][405][105];
long long www[405];
long long vvv[405];

int main(){
    long long n,w;
    cin>>n>>w;
    memset(dp,0,sizeof(dp));
    for(long long i=0;i<n;i++){
        cin>>www[i]>>vvv[i];
    }
    long long tmp=www[0]-1;
    for(long long i=1;i<n;i++){
        www[i]-=www[0];
    }
    www[0]=0;
    for(long long i=1;i<405;i++)
        dp[0][i][1]=vvv[0];
    for(long long i=0;i<n;i++) www[i]++;
    for(long long i=1;i<n;i++){
        for(long long j=0;j<402;j++){
            for(long long k=1;k<=n;k++){
                //if(i==1&&j==1&&k==1) cout<<"~~~~~~~~~~ "<<dp[i-1][j][k]<<endl;
                if(j>=www[i])
                    dp[i][j][k]=max(dp[i-1][j][k],dp[i-1][j-www[i]][k-1]+vvv[i]);
                else
                    dp[i][j][k]=dp[i-1][j][k];
            }
        }
    }
    long long ans=0;
        for(long long j=0;j<405;j++){
            for(long long k=0;k<=n;k++){
                if(k*tmp+j<=w){
                  //  cout<<k*tmp+j<<' '<<dp[n-1][j][k]<<endl;
                 //   cout<<dp[n-1][j][k]<<endl;
                    ans=max(ans,dp[n-1][j][k]);
                }
            }
        }
        cout<<ans<<endl;
}


Measured memory_bytes: 35072
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <cstring>
#include <map>
#include <vector>
 
using namespace std;
 
int cost[9][9];
 
struct node{
    string num;
    int cost;
    node(string n, int c):num(n), cost(c){}
    node(){}
    bool operator >(const node &arg) const{
        return cost > arg.cost;
    }
};
 
int main(){
    int n;
    string str="";
    cin >> n;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cin >> cost[i][j];
        }
    }
 
    for(int i=0;i<n;i++) str += (char)('1' + i);
 
    priority_queue<node, vector<node>, greater<node> > q;
    map<string,bool> mb;
    map<string,int> mi;
    string tmpstr,working;
    int tmpcost;
    node tmpnode;
    q.push(node(str, 0));
    while(!q.empty()){
        tmpnode = q.top(); q.pop();
        tmpstr = tmpnode.num;
        tmpcost = tmpnode.cost;
 
        if(mb[tmpstr] == true) continue;
        mb[tmpstr] = true;
        mi[tmpstr] = tmpcost;
 
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                working = tmpstr;
                swap(working[i], working[j]);
                if(mb[working] == false){
                    q.push(node(working, tmpcost + cost[working[i] - '1'][working[j] - '1']));
                }
            }
        }
    }
    map<string,int>::iterator it = mi.begin();
    int ret = -1;
    while(it != mi.end()){
        ret = max(ret, (*it).second);
        ++it;
    }
    cout << ret << endl;
}

Measured memory_bytes: 25000
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vc = vector<char>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using stkll = vector<pll>;
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
#define rep(i, n) for (ll i = 0; i < (n); i++)
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
#ifndef ONLINE_JUDGE
    #define debug(x) cerr << #x << ": " << x << endl;
#else
    #define debug(x)
#endif

ll dp[20][110000];

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

    ll N;
    cin >> N;
    vll x(N);
    rep(i, N) cin >> x[i];
    ll L, Q;
    cin >> L >> Q;

    rep(i, N) dp[0][i] = upper_bound(x.begin(), x.end(), x[i]+L) - x.begin() - 1;

    rep(i, 19) rep(j, N) dp[i+1][j] = dp[i][dp[i][j]];

    rep(i, Q) {
        ll a, b;
        cin >> a >> b;
        a--, b--;
        if(a > b) swap(a, b);

        ll ans = 1;
        for(ll i = 19; i >= 0; i--) {
            if(dp[i][a] < b) {
                a = dp[i][a];
                ans += 1LL<<i;
            }
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 18560
#include <iostream>
using namespace std;
#include <math.h> 

#include <algorithm>
int main() {
	// your code goes here
	long long h;
	cin>>h;
	long long h1=h;
	long long sum=0;
	int i=0;
	while(h1>1)
	{
	    sum=sum+(long long)pow(2,i++);
	    h1/=2;
	}
	if(h1==1)
	sum=sum+pow(2,i);
	cout<<sum;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

		int a = in.nextInt();

		if (a / 100 == a % 10) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21844
#include <cstdio>
 
using namespace std;
 
#define MAX 10000
#define NIL -1
 
struct Node { int parent, left, right;};
 
Node T[MAX];
int n, D[MAX], H[MAX];
 
void setDepth(int u,int d) {
    if(u == NIL) return;
    D[u] = d;
    setDepth(T[u].left, d+1);
    setDepth(T[u].right,d+1);
}
 
int setHeight(int u) {
    int h1 = 0, h2 = 0;
    if(T[u].left != NIL)
        h1 = setHeight(T[u].left)  + 1;
    if(T[u].right != NIL)
        h2 = setHeight(T[u].right) + 1;
    return H[u] = (h1 > h2 ? h1 : h2);
}
 
// 接点 u の兄弟を返す
int getSibling(int u) {
    if( T[u].parent == NIL ) return NIL;
    if(T[T[u].parent].left != u && T[T[u].parent].left != NIL )
        return T[T[u].parent].left;
    if(T[T[u].parent].right != u && T[T[u].parent].right != NIL )
        return T[T[u].parent].right;
    return NIL;
}
 
void print(int u) {
    printf("node %d: ",u);
    printf("parent = %d, ",T[u].parent);
    printf("sibling = %d, ",getSibling(u));
    int deg = 0;
    if(T[u].left  != NIL) deg++;
    if(T[u].right != NIL) deg++;
    printf("degree = %d, ",deg);
    printf("depth = %d, ",D[u]);
    printf("height = %d, ",H[u]);
     
    if(T[u].parent == NIL) {
        printf("root\n");
    } else if(T[u].left == NIL && T[u].right == NIL) {
        printf("leaf\n");
    } else {
        printf("internal node\n");
    }
}
 
int main(void) {
    int v, l, r, root = 0;
    scanf("%d",&n);
    for(int i=0;i<n;i++) T[i].parent = NIL;
    for(int i=0;i<n;i++) {
        scanf("%d %d %d",&v,&l,&r);
        T[v].left  = l;
        T[v].right = r;
        if(l != NIL) T[l].parent = v;
        if(r != NIL) T[r].parent = v;
    }
     
    for(int i=0; i<n; i++)
    if(T[i].parent == NIL) root = i;
     
    setDepth(root,0);
    setHeight(root);
     
    for(int i=0;i<n;i++) print(i);
     
    return 0;
}


Measured memory_bytes: 2716
import java.util.Scanner;

public class Main {

	private static void core(){
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		int count = 0;
		for(int i=1;i<s.length();i++){
			if(s.charAt(i-1)!=s.charAt(i)){
				count++;
			}
		}
		System.out.println(count);
	}
	
	/*
	Scanner sc = new Scanner(System.in);
	*/

	
	public static void main(String[] args) {
		core();
	}
	
}


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

int main(void) {
	string S;
	cin >> S;

	int ans = 0;
	for (int i = 0; i < 3; ++i) {
		if (S[i] == 'R')
			++ans;
	}
	if (ans == 2 && S[1] == 'S')
		ans = 1;

	cout << ans << '\n';
	return 0;
}


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

int main() {
	int a[3];
	int n; cin >> n;
	rep(i,n) {
		cin >> a[0] >> a[1] >> a[2];
		sort(a, a + 3);
		if (a[2] * a[2] == a[0] * a[0] + a[1] * a[1])puts("YES");
		else puts("NO");
	}
	return 0;
}

Measured memory_bytes: 1132
#include <stdio.h>

int main(void){

   int N,K;
   
   scanf("%d %d",&N,&K);

   if(K == 1){
      printf("YES\n");
   }
   else if(N%2 == 0){
      if(K <= N/2){
         printf("YES\n");
      }
      else {
         printf("NO\n");
      }
   }
   else {
      if(K <= (N+1)/2){
         printf("YES\n");
      }
      else {
         printf("NO\n");
      }
   }

   return 0;
}


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

using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int> v;
  for(int i = 0;i < n;i++){
    int a;
    cin >> a;
    v.push_back(a);
  }
  if(n == 2)
  {
    double a = v[0]+v[1];
    a /= 2;
    cout << a << endl;
    return 0;
  }
  sort(v.rbegin(),v.rend());
  double ans = v[n-1];
  for(int i = n-2;i >= 0;i--){
    ans += v[i];
    ans /= 2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int q,h,s,d,n;
  scanf("%d %d %d %d", &q,&h,&s,&d);
  scanf("%d", &n);
  int max_s=0;
  if(4*q>2*h)max_s=2*h;
  else max_s=4*q;
  if(max_s>s)max_s=s;
  long long int price=0;
  if(max_s*2>d){
    //printf("1\n");
    price=(long long int)(n/2)*d+max_s*(n%2);
  }
  else{
    //printf("%d %d %lld\n",n,max_s,(long long int) n*max_s);
    price=(long long int)n*max_s;
  }
  printf("%lld\n",price);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
struct info{
  int a, b;
};
typedef struct info Info;

int main()
{
  int n;
  cin >> n;
  vector<Info> sets(n);
  for (int i = 0; i < n; ++i) cin >> sets[i].a >> sets[i].b;
  sort(sets.begin(), sets.end(), [](const Info &x, const Info &y) {
    return x.b < y.b;
  });
  long sum = 0;
  int flag = 0;
  for (int i = 0; i < n; ++i) {
    sum += sets[i].a;
    if (sum > sets[i].b) {
      flag = 1;
      break;
    }
  }
  string ans = (flag == 0) ? "Yes" : "No";
  cout << ans << endl;
       
  return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  long long int an;
  long long int a;
  long long int aa[100001] = {0};
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> an;
    if(an == 0){
      cout << "0" << endl;
      return 0;
    }
    aa[i] = an;
  }
  a = aa[0];
  for(int i = 1; i < n; i++){
    if(to_string(a).length() + to_string(aa[i]).length() - 1 > 18 && a * aa[i] != 1000000000000000000){
      a = -1;
      break;
    }

      a *= aa[i];
      if(a > 1000000000000000000|| a < 0){
        a = -1;
        break;
      }
  }

  cout << a << endl;
}


Measured memory_bytes: 4480
a,b = map(int,input().split())

for i in range(1,1300):
    ans = i
    aa = int(ans * 0.08)
    bb = int(ans * 0.1)
    if a == aa and b == bb:
        break

if ans < 1299:
    print(str(ans))
else:
    print('-1')

Measured memory_bytes: 40656
n = int(input())
ans = [0 for i in range(10100)]
for x in range(1, 101):
    for y in range(1, 101):
        for z in range(1, 101):
            if x*x+y*y+z*z+x*y+y*z+z*x < 10001:
                ans[x*x+y*y+z*z+x*y+y*z+z*x-1] += 1

for i in range(n):
    print(ans[i])


Measured memory_bytes: 9280
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
#define erep(i,n) for(int i = 0;i<=n;i++)
#define rep1(i,n) for(int i = 1;i<n;i++)
#define erep1(i,n) for(int i = 1;i<=n;i++)
typedef long long ll;
#define vint vector<int>
#define vstring vector<string>
#define vll vector<ll>
#define vbool vector<bool>
#define INF 100000000

int main(){
  vint dx = {0,-1,1,0};
  vint dy = {-1,0,0,1};
  int n;
  cin >> n;
  int nowx = 0;
  int nowy = 0;
  int nowt = 0;
  bool ok = true;
  rep(i,n){
    int t,x,y;
    cin >> t >> x >> y;
    if(t-nowt >= abs(x - nowx) + abs(y - nowy) && (abs(x - nowx) + abs(y - nowy)) % 2 == (t - nowt) % 2){
      nowx = x;
      nowy = y;
      nowt = t;
    }
    else{
      ok = false;
      break;
    }
  }
  if(ok) cout << "Yes" << endl; else cout << "No" << endl;
}

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

int main() {
    int n, k ;
    cin >> n >> k;
    vector<int> p (n);
    rep(i,n){
        cin >> p[i] ;
    }
    sort(p.begin(), p.end());
    int tot = 0;
    rep(i,k){
        tot += p[i];
    }
    cout << tot << endl;
}

Measured memory_bytes: 3628
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include<set>
#include<map>
using namespace std;


int main() {
    char a, b;
    cin >> a >> b;
    if(a < b){
        cout << "<";
    }
    else if( a > b)
    {
        cout << ">";
    }
    else
    {
        cout << "=";
    }
    
    
    cout << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int result = 0;

		if(n > 1) {
			result += (n * (n - 1)) / 2;
		}

		if(m > 1) {
			result += (m * (m - 1)) / 2;
		}

		System.out.println(result);
		sc.close();
	}
}


Measured memory_bytes: 22100
// ABC139D.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//

//#include "pch.h"
#include <iostream>
using namespace std;
int main()
{
	long N;
	cin >> N;
	cout << N * (N - 1) / 2 << endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>

using namespace std;

int main()
{
	int N;
	
	cin >> N;
	
	vector<long long> A(N);
	
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}
	
	bool loop = true;
	int count = 0;
	
	while (true) {
		for (int i = 0; i < N; i++) {
			if (A[i] % 2 != 0) {
				loop = false;
				break;
			}
			
			A[i] /= 2;
		}
		
		if (loop) {
			count++;
		}
		else {
			break;
		}
	}
	
	cout << count << endl;
}


Measured memory_bytes: 256
n, m = map(int,input().split())
alist=[0]*n
blist=[0]*n
pena=0
ok=0

for i in range(m):
    p, s =input().split()
    toi=int(p)-1
    if s=='AC':
        if alist[toi]!=1:
            alist[toi]=1
            pena+=blist[toi]
            ok+=1
    else:
        if alist[toi]!=1:
            blist[toi]+=1

print(ok, pena)

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

using namespace std;

const int MOD = 1e9 + 7;
    
int main() {
    string s;
    cin >> s;
    reverse(s.begin(), s.end());
    vector<long long> pos, po(s.size());
    po[0] = 1;
    for (int i = 0; i < s.size(); ++i) {
        if (s[i] & 1) {
            pos.push_back(i);
        }
        if (i > 0) {
            po[i] = (po[i-1] * 3) % MOD;
        }
    }
    long long ans = 0, two = 1;
    reverse(pos.begin(), pos.end());
    for (int x : pos) {
        ans = (ans + (two * po[x]) % MOD) % MOD;
        two = (two * 2ll) % MOD;
    }
    cout << (ans + two) % MOD;
    return 0;
}

Measured memory_bytes: 2296
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;
typedef long long int64;
int64 n;
vector<int> meth[2];
int m;
int main()
{
    scanf("%lld", &n), ++n;
    for(int i = 1; n > 1; ++i) meth[n&1].push_back(i), n = n&1?(n-1):(n>>1);
    m = meth[0].size()+meth[1].size(); printf("%d\n", m<<1);    
    for(int i = 0; i < meth[1].size(); ++i) printf("%d ", meth[1][i]);
    for(int i = meth[0].size()-1; ~i; --i) printf("%d ", meth[0][i]);
    for(int i = 1; i <= m; ++i) printf("%d ", m-i+1);
    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <bitset>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#define endl '\n'
#define fast ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define zy 2333333
#define bql 2147483647
using namespace std;
int m,d,ans; 
int main()
{
	fast;
	cin>>m>>d;
	for (int i=1;i<=m;i++)
	   for (int j=10;j<=d;j++)
	   {
	   	   if (j/10>=2 && j%10>=2 && (j/10)*(j%10)==i)
	   	      ans++;
	   	   
	   }
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep_(i, n, m) for (int i = n; i < (int)(m); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

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

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define ALL(A) A.begin(), A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod = 1000000007;
const LL LINF = 1LL<<62;
const LL INF = 1<< 17;

int main(){
    vector<int>x(4,0);
    for(int i=0;i<3;i++){
        int a,b;cin >> a >> b;
        a--;b--;
        x[a]++;x[b]++;
    }
    for(int i=0;i<4;i++){
        if(x[i]>= 3){
            puts("NO");
            return 0;
        }
    }
    puts("YES");
    return 0;
}


Measured memory_bytes: 256
// AtCoder Beginner Contest 070
// B - Two Switches

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;


int A, B, C, D;

int main() {

    int st, ed;

    cin >> A >> B >> C >> D;

    st = max(A, C);
    ed = min(B, D);

    cout << max(0, ed - st) << endl;

    return 0;

}





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

#define SIZE 250000
#define INF

unsigned long a[SIZE];
unsigned long dp[SIZE][5];

unsigned long score(unsigned long a, int t) {
	if (t == 0 || t == 4) return a;
    if (t == 2) return (a + 1) % 2;
    if (a == 0) return 2;
    return a % 2;
}

int main() {
    long l;
    unsigned long v;
    cin >> l;
    for (int i = 0; i < l; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i <= l; ++i) {
        for (int j = 0; j < 5; ++j) {
            dp[i][j] = numeric_limits<unsigned long>::max();
        }
    }
    for (int j = 0; j < 5; ++j) dp[0][j] = 0;
    for (int i = 0; i < l; ++i) {
        for (int j = 0; j < 5; ++j) {
            if (j > 0) {
                dp[i][j] = min(dp[i][j], dp[i][j - 1]);
            }
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j] + score(a[i], j));
        }
    }

    unsigned long minimum = numeric_limits<unsigned long>::max();
    for (int j = 0; j < 5; ++j) {
        minimum = min(minimum, dp[l][j]);
    }
    cout << minimum << endl;
}

Measured memory_bytes: 10112
n=int(input())
s=list(map(int,input().split()))
q=int(input())
t=list(map(int,input().split()))
ans=0

def f(i,s):
    r=n-1
    l=0
    m=(r+l)//2
    while r-l>-1:
        if s[m]==i:
            return True
        elif s[m]>i:
            r=m-1
            m=(r+l)//2
        else:
            l=m+1
            m=(r+l)//2
for i in t:
    if f(i,s):
        ans+=1
print(ans)



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

typedef struct {
  int len;
  int c;
} node;

int increment(node *s,int *top,int len,int m){
  int i;
  int sum=0;
  for(i=*top-1;i>=0;i--){
    if(s[i].c<m-1) break;
    sum+=s[i].len;
  }
  if(i<0) return 0;
  int c=s[i].c+1;
  if(s[i].len>1){
    s[i].len--;
    i++;
  }
  s[i]=(node){1,c};
  i++;
  if(sum>0){
    s[i]=(node){sum,0};
    i++;
  }
  *top=i;
  return 1;
}

int can(const int m,const int *a,const int n){
  static node *s=NULL;
  if(s==NULL) s=(node *)calloc(n,sizeof(node));
  int top=0;
  s[top++]=(node){a[0],0};
  int len=a[0];
  int i;
  for(i=1;i<n;i++){
    if(len<a[i]){
      s[top++]=(node){a[i]-len,0};
      len=a[i];
      continue;
    }
    while(len-s[top-1].len>=a[i]){
      len-=s[top-1].len;
      top--;
    }
    s[top-1]=(node){s[top-1].len-(len-a[i]),s[top-1].c};
    len=a[i];
    if(!increment(s,&top,len,m)) return 0;
  }
  return 1;
}

void run(void){
  int n;
  scanf("%d",&n);
  int *a=(int *)calloc(n,sizeof(int));
  int i;
  for(i=0;i<n;i++) scanf("%d",a+i);
  int l=0;
  int r=n;
  while(r-l>1){
    int m=(l+r)/2;
    if(can(m,a,n)){
      r=m;
    } else {
      l=m;
    }
  }
  printf("%d\n",r);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 2560
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  int N, K, S;
  cin >> N >> K >> S;
  vector<int> A(N);
  int M = 1000000000;
  if (S == M) {
    rep(i, 0, N) A[i] = M - 1;
  } else {
    rep(i, 0, N) A[i] = M;
  }
  rep(i, 0, K) A[i] = S;
  cout << A << endl;
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 2176
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

x = ii()
l = [0]
i = 0
num = 0
while num < 10**15:
    i += 1
    num = i**5
    l.append(num)
#print(l[-1]-l[-2])
l = set(l)
for item in l:
    if item > x:
        if item - x in l:
            print(int(item**0.2),int((item-x)**0.2))
            exit()
    else:
        if x - item in l:
            print(int(item**0.2),int((x-item)**0.2)*(-1))
            exit()

'''
    if x - item in l:#Aがitemでx-itemは-B**5
        print(int(item**0.2),int(abs(item-x)**0.2)*(-1))
        exit()
    elif item - x in l:#Aがitemでx-itemはB**5
#        print(item,item-x)
        print(int(item**0.2),int(abs(item-x)**0.2)*(-1))
        exit()
'''

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

int main() {
    int n;
    cin >> n;

    list<int> li;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (i % 2 == 0) {
            li.push_back(x);
        } else {
            li.push_front(x);
        }
    }

    if(n & 1) {
        reverse(li.begin(), li.end());
    }

    vector<int> v;
    for (int x : li) {
        v.push_back(x);
    }

    cout << v[0];
    for (int i = 1; i < n; i++) {
        cout << " " << v[i];
    }
    cout << endl;


    return 0;
}

Measured memory_bytes: 9336
#include<cstdio>
#include<cmath>
#include<string>
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<map>
#include<set>
#include<limits>
#include<bitset>
#include<array>
#include<numeric>
#include<iomanip>
#include<functional>
#include<deque>

using namespace std;
typedef long long int ll;

#define C cout<<
#define E <<endl

ll n,m,a,b,c,x,y,z,aa[200010],ab[200010],ac[1010][1010];
bool r,ra,rb,rc;
string s,sa,sb,sc;
char ca,cb,cc,cd[1010][1010];
vector<ll> va,vb,vc;

int main(){
    cin>>a>>b>>c;
    x=1;
    if(a!=b)x++;
    if(a!=c and b!=c)x++;
    C x E;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
typedef pair<int, int> P;
int R, C;
int get(int x, int y) {
	if (y == 0) return x;
	if (x == C) return C + y;
	if (y == R) return C + R + (C - x);
	return 2 * C + R + (R - y);
}
int main() {
	int N;
	cin >> C >> R >> N;
	vector<P> v;
	for (int i = 1; i <= N; i++) {
		int x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		if ((x1 == 0 || x1 == C || y1 == 0 || y1 == R) && (x2 == 0 || x2 == C || y2 == 0 || y2 == R)) {
			int a = get(x1, y1), b = get(x2, y2);
			if (a > b) swap(a, b);
			v.emplace_back(a, i);
			v.emplace_back(b, -i);
		}
	}
	sort(v.begin(), v.end());
	stack<int> S;
	for (int i = 0; i < v.size(); i++) {
		if (v[i].second > 0) S.push(v[i].second);
		else if (S.empty() || S.top() != -v[i].second) {
			cout << "NO" << endl;
			return 0;
		}
		else {
			S.pop();
		}
	}
	cout << "YES" << endl;
 }

Measured memory_bytes: 2420