akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define REP(i,x) for(int i=0,i##_len=(x);i<i##_len;++i)
#define rep(i,a,b) for(int i=(a),i##_len(b);i<i##_len;++i)
#define All(x) begin(x),end(x)
#define rAll(x) rbegin(x),rend(x)
using namespace std;
using ll = long long;

int main(){
    int N;cin>>N;
    map<int,ll> mp;
    vector<int> a(N);
    REP(i,N){
        cin>>a[i];
        mp[a[i]]++;
    }
    ll ans=0;
    for(auto v:mp){
        ans+=v.second*(v.second-1)/2;
    }
    REP(i,N){
        ll tmp=ans;
        tmp-=(mp[a[i]]-1)*mp[a[i]]/2;
        tmp+=(mp[a[i]]-2)*(mp[a[i]]-1)/2;
        cout<<tmp<<endl;
    }
}

Measured memory_bytes: 10240
package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)

	g := make([][]int, n+1)
	var u, v int
	for i := 0; i < m; i++ {
		fmt.Scan(&u, &v)
		g[u] = append(g[u], v)
	}
	var s, t int
	fmt.Scan(&s, &t)

	ds := make([][3]int, n+1)
	for i := 0; i < n+1; i++ {
		for j := 0; j < 3; j++ {
			ds[i][j] = -1
		}
	}

	q := make([][2]int, 0)
	q = append(q, [2]int{s, 0})
	ds[s][0] = 0
	for len(q) > 0 {
		u := q[0][0]
		d := q[0][1]
		q = q[1:]
		for _, v := range g[u] {
			nd := d + 1
			if ds[v][nd%3] == -1 {
				ds[v][nd%3] = nd
				q = append(q, [2]int{v, nd})
			}
		}
	}

	ans := ds[t][0]
	if ans != -1 {
		ans /= 3
	}
	fmt.Println(ans)
}


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

int main() {
  double A, B;
  int result;
  cin >> A >> B;

  int min_max;
  min_max = ceil(max(A/(0.08), 10*B) );

  if(min_max < (A+1)/0.08 && min_max < 10*(B+1) ){
    result = min_max;
  }else{
    result = -1;
  }

  cout << result << endl;
}

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

int main(){
	
	char be[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
	char af[26]={'D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','A','B','C'};
	char str[1000];
	int i,j,c;
	
	scanf("%s",str);
	c=strlen(str);  //ツ閉カツ篠堋療アツづ個陳キツつウツづーツ堕ェツづゥ
	for(i=0;i<c;i++){
		for(j=0;j<26;j++){
			if(str[i]==af[j]){
				str[i]=be[j];
				break;
			}
		}
	}
	printf("%s\n",str);
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
#define MOD 1000000007

int getAll(int arr[], int n){
	int res = 1;
	for(int i = 0; i < n; i++)
		res = (res * arr[i])%MOD;

	res = (res + MOD)%MOD;
	return res;
}

int32_t main(){
	IOS;
	int n, k;
	cin >> n >> k;
	int arr[n], zc = 0;
	vector<int> pos, neg;
	for(int i = 0; i < n; i++){
		cin >> arr[i];
		if( arr[i] == 0 )
			zc++;
		arr[i] > 0 ? pos.push_back(arr[i]) : neg.push_back(arr[i]);
	}

	sort(arr, arr+n);
	sort(pos.begin(), pos.end());
	sort(neg.rbegin(), neg.rend());

	if( k == n ){
		cout << getAll(arr, n) << endl;
		return 0;
	}

	if( pos.size() + neg.size() - zc < k ){
		cout << 0 << endl;
		return 0;
	}

	if( pos.size() == 0 ){
		if( k&1 ){
			int ans = 1;
			for(int i = 0; i < k; i++)
				ans = (ans * neg[i])%MOD;

			ans = (ans + MOD)%MOD;
			cout << ans << endl;
		}else{
			int ans = 1;
			for(int i = 0, j = neg.size()-1; i < k; i++, j--)
				ans = (ans * neg[j])%MOD;

			ans = (ans + MOD)%MOD;
			cout << ans << endl;
		}
	}else{
		int ans = 1, st = 0, en = n-1;
		if( k&1 )
			ans = arr[n-1], k--, en--;
		while( k > 0 ){
			if( arr[st]*arr[st+1] > arr[en]*arr[en-1] )
				ans = (ans * ((arr[st]*arr[st+1])%MOD))%MOD, st += 2;
			else
				ans = (ans * ((arr[en]*arr[en-1])%MOD))%MOD, en -= 2;

			k -= 2;
		}

		ans = (ans + MOD)%MOD;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 7056
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define ALL(x) (x).begin(), (x).end()
#define REP(i ,n) for(int i = 0; i < (int)(n); i++)
#define pb push_back
typedef vector<int>vint;
typedef vector<ll>vll;
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename A,typename B>inline bool chmin(A &a,const B &b){if(a>b){a=b;return true;}else{return false;}}
template<typename A,typename B>inline bool chmax(A &a,const B &b){if(a<b){a=b;return true;}else{return false;}}

int main()
{
    int N;
    cin >> N;
    vint A(N);
    cin >> A;
    vint cnt(9);
    for(auto a:A){
        if(a >= 1 && a<= 399){
            cnt[0]++;
        }else if(a >= 400 && a <= 799){
            cnt[1]++;
        }else if(a >= 800 && a <= 1199){
            cnt[2]++;
        }else if(a >= 1200 && a <= 1599){
            cnt[3]++;
        }else if(a >= 1600 && a <= 1999){
            cnt[4]++;
        }else if(a >= 2000 && a <= 2399){
            cnt[5]++;
        }else if(a >= 2400 && a <= 2799){
            cnt[6]++;
        }else if(a >= 2800 && a <= 3199){
            cnt[7]++;
        }else{
            cnt[8]++;
        }
    }
    int ans = 0;
    REP(i,8){
        if(cnt[i] != 0){
            ans++;
        }
    }
    if(ans == 0){
        cnt[8]--;
        ans = 1;
    }
    cout << ans << " ";
    ans += cnt[8];
    cout << ans << endl;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
int getCost(int *arr, int index, vector<int>& mem){
    if(mem[index] != -1) return mem[index];

    int cost = INT_MAX;
    if(index+1 < mem.size())
        cost = min(cost, abs(arr[index] - arr[index+1])+ getCost(arr, index+1, mem));
    if(index+2 < mem.size())
        cost = min(cost, abs(arr[index] - arr[index+2])+getCost(arr, index+2, mem));
    
    if(cost == INT_MAX)
        cost = 0;
    mem[index] = cost;
    return cost;

}
int main(){
    int N;
    cin >> N;

    int *arr = new int[N];

    for(int i = 0; i < N; i++)
        cin >> arr[i];

    vector<int> mem(N, -1);

    int ans = getCost(arr, 0, mem);
    cout << ans << endl;
}

Measured memory_bytes: 10388
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <set>
#include <complex>
#include <functional>
#include <utility>
#include <iterator>

#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i, m, n) for(int i = (m); i < (int)(n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define INF 2000000000

#ifdef LOCAL
  #define eprintf(...) fprintf(stdout, __VA_ARGS__)
#else
  #define eprintf(...) 0
#endif

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef unsigned int uint;

const double PI = 3.1415926535897932384626433832795;

int main() {
  map<int, int> mp;
  int t;
  REP(i, 3) {
    cin >> t;
    mp[t]++;
  }
  for(auto m : mp) {
    if(m.second == 1) {
      cout << m.first << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 256
//404 Not Found {=}7 (o)7 (x)7
#include<bits/stdc++.h>
using namespace std;
#define apppend push_back
#define endl "\n"
#define dbug(x) cout<<#x<<"="<<x<<endl

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

const int maxn = 1e5, inf = 1e9, mod= 1e9+7;
int main(){
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    cout << setprecision(30);
    int n,m;
    cin >>n >> m;
    cout <<(n==m?"Yes":"No");
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>
using namespace std;
int main() {
	int n,t=0;
	cin >> n;
	vector<double>s(n,0);
	for (int i = 0; i < n; i++) {
		cin >> s[i];

	}
	sort(s.begin(), s.end());
	for (int i = 0; i<n;i++ ) {
		s[0]=(double) (s[0] + s[i]) / 2.0;
		//cout << s[i] << endl;
		//printf("%.1f", s[i]);
		/*for (int j = i + 1; j<n-1; j++) {
			s[j] = s[j + 1];
		}*/
	}
	printf("%.5f", s[0]);

}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

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

    char S;
    bool flag = false;
    for (int n = 0; n < N; n++) {
        cin >> S;
        if (S == 'Y') flag = true;
    }

    if (flag)
        cout << "Four" << endl;
    else
        cout << "Three" << endl;

    return 0;
}


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

int main() {
  ll X;
  cin >> X;
  bool ans = false;
  const ll n = X/100;
  const ll rem = X%100;
  for (ll a = 0; a <= n; a++) 
  for (ll b = 0; a+b <= n; b++)
  for (ll c = 0; a+b+c <= n; c++)
  for (ll d = 0; a+b+c+d <= n; d++)
  for (ll e = 0; a+b+c+d+e <= n; e++) 
    if (a+2*b+3*c+4*d+5*e == rem) {
      ans = true;
      goto LAST;
    }
  LAST:
  if (ans) cout << 1 << endl;
  else cout << 0 << endl;

  return 0;
}

Measured memory_bytes: 256
n=int(input())


def findTrailingZeros(n):
    # Initialize result
    count = 0

    i = 10

    while (i<=n):
        count+=n//i
        i *= 5

    return count


if n % 2 == 1:
    print(0)
else:
 get5s=findTrailingZeros(n)
 print(get5s)



Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,k,n=0,sum=0;
    cin>>a>>b>>c>>k;
    for(;n<k&&n<a;n++){
        sum++;
    }
    for(;n<k&&n<a+b;n++);
    for(;n<k&&n<a+b+c;n++){
        sum--;
    }
    cout<<sum<<"\n";
}


Measured memory_bytes: 3592
#include<iostream>
using namespace std;
int main ()
{
    int a[105][2],b[105][2],s1=0,s2=0,m=0,t,c=0,i,z;
    cin >> t;
    for(i=0;i<t;i++)
    {
        cin >> a[i][0];
        s1=s1+a[i][0];
        a[i][1]=s1;
    }
    for(i=0;i<t;i++)
    {
        cin >> b[i][0];
        s2=s2+b[i][0];
        b[i][1]=s2;
    }
    for(i=0;i<t;i++)
    {
        if(i==0)
        {
            c=a[i][0]+s2;
        }
        else if(i==t-1)
        {
            c=b[t-1][0]+s1;
        }
        else
        {
            c=a[i][1]+(s2-b[i-1][1]);
        }
        m=max(m,c);
    }
    cout << m;
    return 0;
}


Measured memory_bytes: 256
import math
import sys
import queue
from collections import Counter
from itertools import accumulate
from fractions import gcd
from functools import reduce


def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""
# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]

# 標準入力取得
## 文字列
    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())

## 数値
    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""

if __name__ == "__main__":
    N, i = map(int, sys.stdin.readline().split())
    print(N - i + 1)

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

typedef long long ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
#define EPS (1e-9)
#define INF (1e9)
#define INFL (1e18)
#define MOD (1000000007)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = (n - 1); i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define BIT(n) (1LL << (n))
// ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
// ll lcm(ll c, ll d) { return c / gcd(c, d) * d; }
template <int mod> struct ModInt {
    int x;

    ModInt() : x(0) {}

    ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

    ModInt &operator+=(const ModInt &p) {
        if ((x += p.x) >= mod)
            x -= mod;
        return *this;
    }

    ModInt &operator-=(const ModInt &p) {
        if ((x += mod - p.x) >= mod)
            x -= mod;
        return *this;
    }

    ModInt &operator*=(const ModInt &p) {
        x = (int)(1LL * x * p.x % mod);
        return *this;
    }

    ModInt &operator/=(const ModInt &p) {
        *this *= p.inverse();
        return *this;
    }

    ModInt operator-() const { return ModInt(-x); }

    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

    bool operator==(const ModInt &p) const { return x == p.x; }

    bool operator!=(const ModInt &p) const { return x != p.x; }

    ModInt inverse() const {
        int a = x, b = mod, u = 1, v = 0, t;
        while (b > 0) {
            t = a / b;
            swap(a -= t * b, b);
            swap(u -= t * v, v);
        }
        return ModInt(u);
    }

    ModInt pow(int64_t n) const {
        ModInt ret(1), mul(x);
        while (n > 0) {
            if (n & 1)
                ret *= mul;
            mul *= mul;
            n >>= 1;
        }
        return ret;
    }

    friend ostream &operator<<(ostream &os, const ModInt &p) {
        return os << p.x;
    }

    friend istream &operator>>(istream &is, ModInt &a) {
        int64_t t;
        is >> t;
        a = ModInt<mod>(t);
        return (is);
    }

    static int get_mod() { return mod; }
};

using mint = ModInt<MOD>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n, k;
    cin >> n >> k;
    vector<int> v(n);
    map<int, int> mp;
    mint ans = 0;
    REP(i, n) cin >> v[i];
    REP(i, n) {
        FOR(j, i + 1, n) {
            if (v[i] > v[j]) {
                ans += (k + 1) * k / 2LL;
            } else if (v[i] < v[j]) {
                ans += (k - 1) * k / 2LL;
            }
        }
    }
    cout << ans << endl;

    return 0;
}


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

vector<int> search(vector<int> &b)
{
    if (b.size() == 1 and b[0] == 1)
        return b;

    int index = -1;
    rep(i, 0, b.size())
    {
        if (b[i] == i+1)
            index = i;
    }

    vector<int> res;
    if (index == -1)
        return res;
    else
    {
        b.erase(b.begin() + index);
        res = search(b);
        if (res.size() == 0)
            return res;
        else
        {
            res.push_back(index+1);
            return res;
        }
    }
}

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

    vector<int> res;
    res = search(b);

    if (res.size() == 0)
        cout << -1 << endl;
    else
    {
        for (auto r: res)
            cout << r << endl;
    }
    return 0;
}

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

typedef long long ll;
typedef pair<int, int> pi;
#define F first
#define S second
#define PB push_back

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep_op(i, a, b) for (int i = a; i < b; i++)

const int MOD = 1000000007;

// int max = *std::max_element(vec.begin(), vec.end());
// int sum = accumulate(list, list + size, 0);

int main()
{
    int n, k; cin >> n >> k;
    int res = 0;
    rep (i, n) {
        int x; cin >> x;
        res += min(2 * x, 2 * k - 2 * x);
    }
    cout << res << endl;
} 


Measured memory_bytes: 256
#include <stdio.h>
#define N 100
#define INF 100000001

int dp[N+1][N+1],p[N+1];

int min(int x,int y){
    if(x<y) return x;
    else return y;
}

int calcmincost(int i, int j){
    int k;
    
    if(dp[i][j]!=INF) return dp[i][j];
    
    for(k=i;k<j;k++){
        dp[i][j]=min(dp[i][j],calcmincost(i,k)+calcmincost(k+1,j)+p[i-1]*p[k]*p[j]);
    }
    
    return dp[i][j];
}

int main(void){
    int i,j,n;
    
    scanf("%d",&n);
    for(i=1;i<=n;i++) scanf("%d %d",&p[i-1],&p[i]);
    
    for(i=1;i<=n;i++){
        for(j=1;j<=n;j++){
            if(i==j) dp[i][j]=0;
            else     dp[i][j]=INF;
        }
    }
    
    printf("%d\n",calcmincost(1,n));
    
    return 0;
}



Measured memory_bytes: 2052
import sys

a, b, c, k = map(int, input().split())
ans = 0

cnt = k - a
if cnt >= 0:
  ans += a
  cnt = cnt - b
else:
  ans += k
  print(ans)
  sys.exit()
if cnt >= 0:
  cnt = cnt - c
  pass
else:
  print(ans)
  sys.exit()
if cnt >= 0:
  ans -= c
  print(ans)
else:
  ans -= k - (a + b)
  print(ans)

Measured memory_bytes: 9144
#include <bits/stdc++.h>
using namespace std;
const int N=100005;
int n,a[N];
int Ha[N];
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
		scanf("%d",&a[i]),Ha[i]=a[i];
	sort(Ha+1,Ha+n+1);
	int tot=0;
	for (int i=1;i<=n;i++){
		a[i]=lower_bound(Ha+1,Ha+n+1,a[i])-Ha;
		if ((a[i]^i)&1)
			tot++;
	}
	printf("%d",tot/2);
	return 0;
}

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

int main() {
  string s;
  cin >> s;
  int sta, end;
  for(int i = 0; i < s.length(); i++){
    if(s[i] == 'A'){
      sta = i;
      break;
    }
  }
  for(int i = 0; i < s.length(); i++){
    if(s[i] == 'Z'){
      end = i;
    }
  }
    
  cout << end - sta + 1 << endl;
}


Measured memory_bytes: 640
inpl = lambda: list(map(int,input().split()))
class UnionFind:
    def __init__(self, N=None):
        if N is None or N < 1:
            self.parent = defaultdict(lambda: -1)
        else:
            self.parent = [-1]*int(N)

    def root_rec(self, n):
        if self.parent[n] < 0:
            return n
        else:
            m = self.root(self.parent[n])
            self.parent[n] = m
            return m

    def root(self, n):
        stack = []
        while n >= 0:
            stack.append(n)
            n = self.parent[n]
        m = stack.pop()
        while stack:
            self.parent[stack.pop()] = m
        return m

    def merge(self, m, n):
        rm = self.root(m)
        rn = self.root(n)
        if rm != rn:
            if -self.parent[rm] < -self.parent[rn]:
                rm, rn = rn, rm
            self.parent[rm] += self.parent[rn]
            self.parent[rn] = rm

    def size(self, n):
        return -self.parent[self.root(n)]
    
    def connected(self, m, n):
        return self.root(m) == self.root(n)

    def groups(self):
        if isinstance(self.parent,list):
            return list(filter(lambda i: self.parent[i]<0, range(len(self.parent))))
        else: # self.parent: defaultdict
            return list(filter(lambda i: self.parent[i]<0, self.parent.keys()))
 
    def groups_num(self):
        return len(self.groups())

    def elements(self):
        if isinstance(self.parent,list):
            return range(len(self.parent))
        else:
            return self.parent.keys()

N, M = inpl()
uf = UnionFind(N)
for _ in range(M):
    A, B = inpl()
    uf.merge(A-1, B-1)

ans = max(uf.size(g) for g in uf.groups())
print(ans)


Measured memory_bytes: 78464
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int S = sc.nextInt();
        int h = S / 3600;
        S -= h * 3600;
        int m = S / 60;
        int s = S - m * 60;
        System.out.println(h + ":" + m + ":" + s);
    }
}


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

int main(){
    long N,D;
    long X,Y;
    int count = 0;
    cin >> N >> D;
    for(int i=0; i < N; i++){
        cin >> X >> Y;
        if (D >= sqrt(X*X + Y*Y)){
            count += 1;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main(){
    int A,B,C;
    cin>>A>>B>>C;

    if(A==B){
        if(A==C){
            cout<<"No";
        }else
            cout<<"Yes";
    }else{ 
        if(B==C){
           cout<<"Yes";
        }else{
             if(A==C){
                cout<<"Yes";
            }else{
                cout<<"No";
            }
        }
    }
}

Measured memory_bytes: 256
import math
import copy
import bisect








def nCast(number):
    if type(number)==str:
        return int(number)
    for idx in range(0,len(number)):
        if type(number[idx])==str:

            number[idx]=int(number[idx])
        else:
            nCast(number[idx])
    return number
    
def inputArr(w):
    l=list()
    for idx in range(0,w):
        l.append(input())
    return l
def inputArr1(w):
    l=list()
    for idx in range(0,w):
        l.append(input().split())
    return l

n=nCast(inputArr1(3))


def func():
    if (n[0][0] in n[1] and n[0][0] in n[2]) or (n[0][1] in n[1] and n[0][1] in n[2]):
        return "NO"
    return "YES"
    
print(func()) 




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

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr ll MOD = 1000000007;
constexpr ll INF = 1LL << 60;
constexpr long double EPS = 1e-10;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};
constexpr ll N_MAX_SQRT = 1000000;

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    ll  n;
    cin >> n;

    ll ans = INF;
    for(ll i=1;i<=N_MAX_SQRT+1;++i) {
        if(n % i == 0) {
            ans = min(ans, i-1+n/i-1);
        }
    }

    cout << ans << endl;
}


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

using namespace std;

int main() {
    int n;
    int_fast64_t k;

    cin >> n >> k;

    vector<int> a(n);

    for(int i = 0; i < n; ++i) {
        cin >> a.at(i);
    }

    int count = 0;
    vector<int> b(200002);
    vector<int> visited(200002);

    for(int& v: visited) {
        v = -1;
    }

    b.at(count) = 1;

    while(visited.at(b.at(count) - 1) == -1) {
        visited.at(b.at(count) - 1) = count;
        count++;
        b.at(count) = a.at(b.at(count - 1) - 1);
    }

    int offset = visited.at(b.at(count) - 1);
    int period = count - offset;

    if(k < offset) {
        printf("%d\n", b.at(k));
    } else {
        printf("%d\n", b.at(offset + (k - offset) % period));
    }

    return 0;
}

Measured memory_bytes: 5636
#include <iostream>
#include <string>
#define int long long
using namespace std;

int gcd(int a,int b){
	if(a < b) swap(a,b);
	if(!b) return a;
	return gcd(b,a % b);
}

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

signed main(){
	int n,l = 1;
	cin >> n;
	for(int i = 0;i < n;i++){
		int a;
		cin >> a;
		l = lcm(l,a);
	}
	cout << l << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define All(V) v.begin(), v.end()
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1e9+7, INF = 1e9;

int main() 
{
  int a, b; cin >> a >> b;
  a--; b--;
  cout << a*b << endl;
  system("pause");
}

Measured memory_bytes: 504
from collections import deque
n = int(input())
s = [list(map(int, list(input()))) for _ in range(n)]
bord = [[] for _ in range(n)]
for i in range(n-1):
    for j in range(i+1, n):
        if s[i][j]==1:
            bord[i].append(j)
            bord[j].append(i)

result = []
for i in range(n):
    ch = True
    visit = [-1 for _ in range(n)]
    visit[i] = 1
    q = deque([i])
    while q:
        x = q.popleft()
        for y in bord[x]:
            if visit[y]<0:
                visit[y] = visit[x]+1
                q.append(y)
            elif (visit[y] == visit[x]+1) or (visit[y]==visit[x]-1):
                continue
            else:
                ch = False
                break
    if ch:
        result.append(max(visit))
    else:
        result = [-1]
        break
print(max(result))

Measured memory_bytes: 42972
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function unionFind(n){this.a=Array(n+1).fill(-1);}
unionFind.prototype={
  root:function(i){return this.a[i]<0?i:this.a[i]=this.root(this.a[i]);},
  same:function(x,y){return this.root(x)===this.root(y);},
  unite:function(x,y){x=this.root(x);y=this.root(y);if(x===y)return;if(this.a[x]>=this.a[y])this.a[y]+=this.a[x],this.a[x]=y;else this.a[x]+=this.a[y],this.a[y]=x;},
  size:function(i){return -this.a[this.root(i)];},
}

console.log(main());
function main(){
  var n = o.a();
  var m = o.a();
  var a = o.m(m);
  var ans = Array(m);
  var uf = new unionFind(n);
  ans[m-1] = n * (n-1) / 2;
  for(var i = m-1; i > 0; i--){
    if(uf.same(a[i][0],a[i][1]))ans[i-1] = ans[i];
    else{
      var s = uf.size(a[i][0]) * uf.size(a[i][1]);
      ans[i-1] = ans[i] - s;
      uf.unite(a[i][0], a[i][1]);
    }
  }
  return ans.join("\n");
}

Measured memory_bytes: 73360
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>


const long long INF =1001002003004005006ll ;
int a, b, c, d;
std::map<long long, long long> memo;

// 0 → x にかかるコストを求める
long long func(long long x){
	if(x == 0) return 0;
	if(memo.count(x)){
		return memo[x];
	}

	long long ans = INF;
	if(INF/d > x){
		ans = x * d;
	}

	auto func2 = [&](long long y){
		if(y >= x){ // 更新しても、小さくならなかったとき
			return INF;
		}
		return func(y);
	};

	{
		long long floo = x/2 * 2;
		long long cell = floo + 2;
		ans = std::min(ans, func2(floo/2) + a + (x-floo) * d);
		ans = std::min(ans, func2(cell/2) + a + (cell-x) * d);
	}
	{
		long long floo = x/3 * 3;
		long long cell = floo + 3;
		ans = std::min(ans, func2(floo/3) + b + (x-floo) * d);
		ans = std::min(ans, func2(cell/3) + b + (cell-x) * d);
	}
	{
		long long floo = x/5 * 5;
		long long cell = floo + 5;
		ans = std::min(ans, func2(floo/5) + c + (x-floo) * d);
		ans = std::min(ans, func2(cell/5) + c + (cell-x) * d);
	}

	return memo[x] = ans;
}

int main(){
	int t;
	std::cin >> t;
	std::vector<long long> ans(t);

	for(int i=0; i<t; i++){
		memo = std::map<long long, long long>();
		long long n;
		std::cin >> n >> a >> b >> c >> d;
		ans[i] = func(n);
	}
	for(int i=0; i<t; i++){
		std::cout << ans[i] << std::endl;
	}

	return 0;
}

Measured memory_bytes: 4752
n = int(input())
h = list(map(int, input().split()))

t = [0] * n
ans = 0

for i in range(n):
    while t[i] < h[i]:
        for j in range(i, n):
            if t[j] < h[j]:
                t[j] += 1
            else:
                break

        ans += 1

print(ans)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>

using namespace std;

typedef long long lli;
typedef long double ld;
typedef pair<lli, lli > plli;
typedef vector<lli> vlli;
typedef vector<plli > vplli;

#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define lcm(a, b) ((a * b) / gcd(a, b))
#define sqr(x) (x)*(x)
#define all(a) a.begin(),a.end()
#define UN(v) sort(all(v)), v.resize(unique(all(v))-v.begin())

#define endl '\n'

const long long INF = 100000000000000000;
const long long MOD = 1000000007;
const long long MAXN = 100005;
const double PI = acos(-1);

lli dx[]={0,0,-1,1,-1,-1,1,1};
lli dy[]={1,-1,0,0,1,-1,-1,1};

lli gcd(lli a , lli b) {
    if(b == 0) return a;
    a %= b;
    return gcd(b,a);
}

void solve() {
    lli n;
    cin >> n;
    pair<double, double> a[n];
    lli fact = 1;
    string s = "";
    for (int i = 0; i < n; i++) {
        cin >> a[i].first >> a[i].second;
        s += to_string(i);
        fact *= (i + 1);
    }

    double ans = 0.0;
    do {
        double temp = 0, res = 0;
        for (auto i = 1; i < s.size(); i++) {
            temp = (a[s[i] - '0'].first - a[s[i - 1] - '0'].first) * (a[s[i] - '0'].first - a[s[i - 1] - '0'].first)
                    + (a[s[i] - '0'].second - a[s[i - 1] - '0'].second) * (a[s[i] - '0'].second - a[s[i - 1] - '0'].second);
            res += sqrt(temp);
        }
        ans += res;
    } while (next_permutation(s.begin(), s.end()));

    ans /= (double)fact;
    cout << fixed << setprecision(8) << ans << endl;
}

int main()
{
    IOS;
    //comment it out
    //freopen("input.txt", "r", stdin);
    lli t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    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++)
typedef long long ll;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    int cnt = 0;
    for (int i = 0; i < n; i++) {
        if (a[i] >= k)
            cnt++;
    }
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
template<class T, class U> inline bool chmax(T& a,U b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class U> inline bool chmin(T& a,U b) { if (a > b) { a = b; return 1; } return 0; }
template<int mod> struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(long long y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}
    ModInt &operator+=(const ModInt &p) { if((x += p.x) >= mod) x -= mod; return *this; }
    ModInt &operator-=(const ModInt &p) { if((x += mod-p.x) >= mod) x -= mod; return *this; }
    ModInt &operator*=(const ModInt &p) { x = (int)(1LL*x*p.x%mod); return *this; }
    ModInt &operator/=(const ModInt &p) { *this *= p.inverse(); return *this; }
    ModInt operator-() const { return ModInt(-x); }
    ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }
    ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }
    ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }
    ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }
    bool operator==(const ModInt &p) const { return x == p.x; }
    bool operator!=(const ModInt &p) const { return x != p.x; }
    ModInt inverse() const {
        int a = x, b = mod, u = 1, v = 0, t;
        while(b > 0) { t = a/b; a -= t*b; swap(a, b); u -= t*v; swap(u, v); }
        return ModInt(u);
    }
    ModInt pow(int e){
        long long a = 1, p = x;
        while(e > 0) {
            if (e%2 == 0) { p = (p*p)%mod; e /= 2; }
            else { a = (a*p)%mod; e--; }
        }
        return ModInt(a);
    }
    friend ostream &operator<<(ostream &os, const ModInt<mod> &p) {
        return os << p.x;
    }
    friend istream &operator>>(istream &is, ModInt<mod> &a) {
        long long x;
        is >> x;
        a = ModInt<mod>(x);
        return (is);
    }
};

const int MAX_N = 5050;
const int MAX_L = 5050;
const int MOD = 1e9+7;

int main() {
    int N;
    string S;
    cin >> N >> S;
    
    ModInt<MOD> dp[MAX_N][2*MAX_L];
    dp[0][0] = 1;
    
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= i*2; j++) {
            dp[i+1][j+1] += dp[i][j];
            if (0 < j) dp[i+1][j-1] += dp[i][j] * 2;
            else dp[i+1][0] += dp[i][j];
        }
    }
    
    cout << dp[N][(int)S.length()] << '\n';
    return 0;
}

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

int main() {
  int c1, c2, c3, c4, c5, c6, c7, c8, c9;
  cin >> c1 >> c2 >> c3 >> c4 >> c5 >> c6 >> c7 >> c8 >> c9;
  int total = (c1 + c5 + c9);
  if ( total == (c4 + c8 + c3) && total == (c7 + c2 + c6) && total == (c3 + c5 + c7) && total == (c6 + c8 + c1) && total == (c9 + c2 + c4)) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
};


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

template<typename T>
T pow(T a, long long n, T e = 1) {
    T ret = e;
    while (n) {
        if (n & 1) ret *= a;
        a *= a;
        n >>= 1;
    }
    return ret;
}

template<int mod>
struct ModInt {
    int x;
    ModInt() : x(0) {}
    ModInt(int x_) { if ((x = x_ % mod + mod) >= mod) x -= mod; }
    ModInt& operator+=(ModInt rhs) { if ((x += rhs.x) >= mod) x -= mod; return *this; }
    ModInt& operator-=(ModInt rhs) { if ((x -= rhs.x) < 0) x += mod; return *this; }
    ModInt& operator*=(ModInt rhs) { x = (unsigned long long) x * rhs.x % mod; return *this; }
    ModInt& operator/=(ModInt rhs) { x = (unsigned long long) x * rhs.inv().x % mod; return *this; }

    ModInt operator-() const { return -x < 0 ? mod - x : -x; }
    ModInt operator+(ModInt rhs) const { return ModInt(*this) += rhs; }
    ModInt operator-(ModInt rhs) const { return ModInt(*this) -= rhs; }
    ModInt operator*(ModInt rhs) const { return ModInt(*this) *= rhs; }
    ModInt operator/(ModInt rhs) const { return ModInt(*this) /= rhs; }
    bool operator==(ModInt rhs) const { return x == rhs.x; }
    bool operator!=(ModInt rhs) const { return x != rhs.x; }
    ModInt inv() const { return pow(*this, mod - 2); }

    friend ostream& operator<<(ostream& s, ModInt<mod> a) { s << a.x; return s; }
    friend istream& operator>>(istream& s, ModInt<mod>& a) { s >> a.x; return s; }
};

using mint = ModInt<(int) 1e9 + 7>;

// https://blog.knshnb.com/posts/mujin_pc_2018_f/

mint fact[101010];
mint factinv[101010];

void init() {
    fact[0] = 1;
    for (int i = 1; i < 101010; i++) {
        fact[i] = fact[i - 1] * i;
    }
    factinv[101010 - 1] = fact[101010 - 1].inv();
    for (int i = 101010 - 2; i >= 0; i--) {
        factinv[i] = factinv[i + 1] * (i + 1);
    }
    assert(factinv[0] == 1);
}

mint choose(int n, int r) {
    return fact[n] * factinv[r] * factinv[n - r];
}

mint arrange(int n, int m) {
    return fact[n * m] * factinv[n] * pow(factinv[m], n);
}

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

    mint dp[1010][1010] = {};
    dp[a][n] = 1;
    vector<int> ds = {0};
    for (int i = c; i <= d; i++) {
        ds.push_back(i);
    }
    for (int i = a; i <= b; i++) {
        for (int j = 0; j <= n; j++) {
            for (int k : ds) {
                if (j - k * i < 0) break;
                dp[i + 1][j - k * i] += dp[i][j] * choose(j, k * i) * arrange(k, i);
            }
        }
    }
    cout << dp[b + 1][0] << endl;
}


Measured memory_bytes: 4992
#include <iostream>
#include <cmath>
#define INF 100000000
using namespace std;

int main(){
	int d[10][10];
	int n;
	while(cin >> n,n){
		for(int i = 0;i < 10;i++){
			for(int j = 0;j < 10;j++){
				d[i][j] = INF;
			}
			d[i][i] = 0;
		}
		int num = 0;
		for(int i = 0;i < n;i++){
			int a,b,c;
			cin >> a >> b >> c;
			num = max(num,max(a,b));
			d[a][b] = c;
			d[b][a] = c;
		}
		num++;
		for(int k = 0;k < num;k++){
			for(int i = 0;i < num;i++){
				for(int j = 0;j < num;j++) d[i][j] = min(d[i][j],d[i][k] + d[k][j]);
			}
		}
		int res = INF,minnum = -1;
		for(int i = 0;i < num;i++){
			int sum = 0;
			for(int j = 0;j < num;j++){
				sum += d[i][j];
			}
			if(sum < res){
				res = sum;
				minnum = i;
			}
		}
		cout << minnum << " " << res << endl;
	}
	return 0;
}

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

int idx(int N, int k) {
    int cnt = 0;
    while(k < N) {
        ++cnt; k *= 2;
    }
    return cnt;
}

double power_denom(double num, int x) {
    double ans = 1;
    int i;
    for(i = 0; i < x; ++i) {
        ans /= num;
    }
    return ans;
}

void solve(int N, int K) {
    int i, xtmp;
    double ans = 0.0;
    for(i = 1; i <= N; ++i) {
        xtmp = idx(K, i);
        //printf("i:%d x:%d\n", i, xtmp);
        ans += 1.0/(double)N*power_denom(2.0,xtmp);
    }
    printf("%.11lf\n", ans);
}

int main(void){
    int N,K;
    scanf("%d %d", &N, &K);
    solve(N, K);
    return 0;
}

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

using namespace std;

int main()
{
    string A,B,C;
    cin >> A >> B >> C;
    int cnt = 0;
    char tmp = 'a';
    bool flag = 1;

    while (flag) {
        switch (tmp) {
        case 'a':
            if (A.empty()) {
                cout << "A\n";
                flag = 0;
            }
            tmp = A[0];
            A.erase(0,1);
            break;
        case 'b':
            if (B.empty()) {
                cout << "B\n";
                flag = 0;
            }
            tmp = B[0];
            B.erase(0,1);
            break;
        case 'c':
            if (C.empty()) {
                cout << "C\n";
                flag = 0;
            }
            tmp = C[0];
            C.erase(0,1);
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define ll long long
#define P pair<int, int>

using namespace std;
int mod = 1000000007;

int extgcd(int a, int b, int &x, int &y) {
  int d = a;
  if (b != 0) {
    d = extgcd(b, a%b, y, x);
    y -= (a/b)*x;
  } else {
    x = 1;
    y = 0;
  }
  return d;
}

int mod_inverse(int a, int m) {
  int x, y;
  extgcd(a, m, x, y);
  return (m + x%m)%m;
}

int n;
int main() {
  cin >> n;
  vector<int> a(n+1);
  bool used[n+1];
  int lastpos;

  rep(i, n+1) {
    used[i] = false;
  }

  int dup;
  rep(i, n+1) {
    cin >> a.at(i);
    if (used[a.at(i)]) {
      lastpos = i;
      dup = a.at(i);
    } else {
      used[a.at(i)] = true;
    }
  }

  int firstpos;
  rep(i, n+1) {
    if (a.at(i) == dup) {
      firstpos = i;
      break;
    }
  }

  int k = firstpos;
  int m = n-lastpos;
  int km = k+m;

  vector<ll> combn1(n+2);
  vector<ll> combkm(n+2);
  vector<ll> mod_inv(n+1);
  for(int i=1; i<=n; i++) {
    mod_inv.at(i) = mod_inverse(i, mod);
  }

  combn1.at(0) = 1;
  combkm.at(0) = 1;
  for(int i=1; i<=n+1; i++) {
    if (i>n-1) {
      combn1.at(i) = 0;
    } else {
      combn1.at(i) = combn1.at(i - 1) * (n - i);
      combn1.at(i) %= mod;
      combn1.at(i) *= mod_inv.at(i);
      combn1.at(i) %= mod;
    }
    if (i>km) {
      combkm.at(i) = 0;
    } else {
      combkm.at(i) = combkm.at(i - 1) * (km - i + 1);
      combkm.at(i) %= mod;
      combkm.at(i) *= mod_inv.at(i);
      combkm.at(i) %= mod;
    }
  }

  for(int i=1; i<=n+1; i++) {
    if (i==1) {
      cout << n << endl;
      continue;
    }
    if (i==n+1) {
      cout << 1 << endl;
      continue;
    }
    ll ans = 0;
    ans += combn1.at(i) + combn1.at(i-2) + 2*combn1.at(i-1);
    ans -= combkm.at(i-1);
    ans += mod;
    ans %= mod;
    cout << ans << endl;
  }
}


Measured memory_bytes: 4096
#include <stdio.h>

int prime[200000];

int main(void)
{
    int n;
    int len;
    int i, j;

    prime[0] = 2;
    len = 1;
    for (i = 3; i < 999999; i += 2){
        for (j = 3; j * j < i; j += 2){
            if (i % j == 0){
                break;
            }
        }
        if (j * j > i){
            prime[len] = i;
            ++len;
        }
    }

    while (scanf("%d", &n) != EOF){
        for (i = 0; i < len; ++i){
            if (prime[i] > n){
                break;
            }
        }
        printf("%d\n", i);
    }

    return (0);
}

Measured memory_bytes: 904
#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define int long long
#define pb push_back
#define mod 1000000007
#define pll pair<long long,long long>
using namespace std;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
}
bool prime(int n){
    for(int i=2;i*i<=n;i++){
        if(n%i==0)return false;
    }
    return true;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int x=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                if(a[i]!=a[j]&&a[j]!=a[k]&&a[k]!=a[i]&&(a[i]+a[j])>a[k]&&(a[j]+a[k])>a[i]&&(a[k]+a[i])>a[j]){
                    x++;
                }
            }
        }
    }
    cout<<x;
    return 0;
}

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

int main() {
	int n;
	cin>>n;
	set<string> a;
	for(int i=0; i< n;i++){
		string x;
		cin>>x;
		a.insert(x);
	}
	cout<<a.size();
	// your code goes here
	return 0;
}

Measured memory_bytes: 19220
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char S[3];
   gets(S);
   int j=1;
   int k=2;
   for(int i=0;i<1;i++)
   {
       if(S[i]=='a')
       {
           if(S[j]=='b')
           {
               if(S[k]=='c')
               {
                   cout<<"Yes";
               }
               else{
                    cout<<"No";
                   }
           }
           else if(S[j]=='c')
           {
               if(S[k]=='b')
               {
                   cout<<"Yes";
               }
               else{
                    cout<<"No";
                   }
           }
           else{
                    cout<<"No";
            }
       }
       else if(S[i]=='b')
       {
           if(S[j]=='c')
           {
               if(S[k]=='a')
               {
                   cout<<"Yes";
               }
               else{
                    cout<<"No";
                   }
           }
           else if(S[j]=='a')
           {
               if(S[k]=='c')
               {
                   cout<<"Yes";
               }
               else{
                    cout<<"No";
                   }
           }
           else{
                    cout<<"No";
                   }
       }
       else if(S[i]=='c')
       {
           if(S[j]=='b')
           {
               if(S[k]=='a')
               {
                   cout<<"Yes";
               }
               else{
                    cout<<"No";
                   }
           }
           else if(S[j]=='a')
           {
               if(S[k]=='b')
               {
                   cout<<"Yes";
               }
               else{
                    cout<<"No";
                   }
           }
           else{
                    cout<<"No";
                   }
       }


   }

}


Measured memory_bytes: 256
from collections import deque


def bfs():
    d = [[float("inf")] * w for i in range(h)]

    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]

    que = deque([])
    que.append((sx, sy))
    d[sx][sy] = 0

    while que:
        p = que.popleft()
        if p[0] == gx and p[1] == gy:
            break
        for i in range(4):
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]

            if 0 <= nx < h and 0 <= ny < w and maze[nx][ny] != "#" and d[nx][ny] == float("inf"):
                que.append((nx, ny))
                d[nx][ny] = d[p[0]][p[1]] + 1

    return d[gx][gy]


h, w = map(int, input().split())
maze = [list(input()) for i in range(h)]
sx, sy = 0, 0
gx, gy = h - 1, w - 1

# 白いマスを数える
white = 0
for i in range(h):
    for j in range(w):
        if maze[i][j] == ".":
            white += 1

res = bfs()
if 0 < res < float("inf"):
    # 白いマスの数から最短経路でかかるコスト分を引く
    # ゴールを黒いマスに変えることはできないためその分も引く
    print(white - res - 1)
else:
    print(-1)

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

int main() {
  
  int N, tmpMin; cin >> N >> tmpMin; int ans = 1;
  
  for (int i = 0; i < N - 1; i++) {
    int P; cin >> P;
    if (P <= tmpMin) {
      ans++;
    }
    tmpMin = min(tmpMin, P);
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef pair<int, int> Pint;
typedef pair<int64_t, int64_t> Pll;


int main() {
    int N, K, S;
    cin >> N >> K >> S;
    for (int i = 0; i < K; i++){
        cout << S;
        if (i != N - 1){
            cout << " ";
        }
    }
    for (int i = K; i < N; i++){
        if (S == 1000000000){
            cout << S - 1;
        }
        else {
            cout << S + 1;
        }
        if (i != N - 1){
            cout << " ";
        }
    }
    cout << endl;

}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e6;
const long long int inf = 1e9+7;
typedef pair<ll,ll> pairs;
vector<pairs> p;


ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

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

int main(){
    ll n;
    cin>>n;
    ll a[n];
    a[0]=0;
    for(ll i=1;i<n;++i){
        cin>>a[i];
    }
    ll b[n+1];
    for(ll i=0;i<n;++i){
        b[i]=0;
    }
    b[n]=0;

    for(ll i=0;i<n;++i){
        b[a[i]]++;
    }

    for(ll i=0;i<n;++i){
        cout<<b[i+1]<<endl;
    }
}

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

using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, x;
  cin >> n >> x;
  vi m(n);
  int min_m = INT_MAX;
  int sum = 0;
  for (int i = 0; i < n; i++) {
    cin >> m[i];
    sum += m[i];
    min_m = min(min_m, m[i]);
  }
  cout << n + (x - sum) / min_m << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define L long long
using namespace std;
int n,m,a,b,x[510][510];
int main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int i,j;
	scanf("%d%d%d%d",&n,&m,&a,&b);
	if(n%a==0 && m%b==0)
	  {
	   printf("No\n");
	   return 0;
	  }
	for(i=1;i<=n;i++)
	  for(j=1;j<=m;j++)
	    x[i][j]=1000;
	if(n%a)
	  for(i=a;i<=n;i+=a)
	    for(j=1;j<=m;j++)
	      x[i][j]*=-a+1;
	else
	  for(i=1;i<=n;i++)
	    for(j=b;j<=m;j+=b)
	      x[i][j]*=-b+1;
	for(i=1;i<=n;i+=a)
	  for(j=1;j<=m;j+=b)
	    x[i][j]--;
	printf("Yes\n");
	for(i=1;i<=n;i++)
	  {
	   for(j=1;j<=m;j++)
	     printf("%d ",x[i][j]);
	   printf("\n");
	  }
	return 0;
}


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

using namespace std;

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

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  cout << max(b + c - a, 0) << endl;
  return 0;
}

Measured memory_bytes: 764
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
ll mod = 1000000007;

signed main(){
    ll n;
    ll a[200009];
    ll b[200009];
    ll k[200009];
    vector<ll> ss;
    cin>>n;
    rep(i,n) cin>>a[i];
    rep(i,n) b[i]=0,k[i]=0;
    ll fk=0;
    rep(i,n){
        ll ni=n-1-i;
        for(ll j=1;((ni+1)*j-1)<n;j++){
            if(k[(ni+1)*j-1]==1) b[ni]++;
        }
        if(a[ni]!=(b[ni]%2)) {
            k[ni]++; 
            if(fk<ni) fk=ni;
        }
    }
    ll ks=0;
    rep(i,n) ks += k[i]; 
    cout<<ks<<endl;
    rep(i,n){
        if(i!=fk&&k[i]==1) cout<<i+1<<" ";
        else if(k[i]==1) cout<<i+1<<endl;
    }
}


Measured memory_bytes: 5504
#include <iostream>
#include <stdio.h>

#define rep(i,min,sup) for(int i=min;i<sup;i++)
#define per(i,min,sup) for(int i=(sup-1);i>=min;i--)
#define swap(a,b) {a+=b;b=a-b;a-=b;}
#define ll long long

using namespace std;

main(){
  int N,Q;
  string ST;
  cin>>ST;
  N=ST.size();
  char S[N];
  rep(i,0,N)S[i]=ST[i];
  scanf("%d",&Q);
  int direct=1;
  char Spre[Q],Spost[Q];
  int pr=0,ps=0;
  
  int T,F;
  char C;
  rep(i,0,Q){
    scanf("%d",&T);
    if(T==1)direct=3-direct;
    else{
      scanf("%d %c",&F,&C);
      if(direct==F)Spre[pr++]=C;
      else Spost[ps++]=C;
    }
  }
  
  if(direct==1){
    per(i,0,pr)printf("%c",Spre[i]);
    rep(i,0,N)printf("%c",S[i]);
    rep(i,0,ps)printf("%c",Spost[i]);
  }else{
    per(i,0,ps)printf("%c",Spost[i]);
    per(i,0,N)printf("%c",S[i]);
    rep(i,0,pr)printf("%c",Spre[i]);
  }
}

Measured memory_bytes: 1024