akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;


//      DEEP

using namespace std;
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define all(v) v.begin(),v.end()
#define pb push_back
#define endl '\n'
#define mp make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pi;
typedef pair<long long,long long> pll;
typedef set<int> si;


/*
typedef tree<int,null_type,less<int>,rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
*/
/*
typedef tree<
pair<int, int>,
null_type,
less<pair<int, int>>,
rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
*/

const ll mod = 1e9 + 7;
const ll modl=998244353;
const double pie=3.1415926535;
                                                    //power
ull power(ull x,ull y){
   if(y==0) return 1;
   else{
     if(y%2==0) return power(x*x,y/2);
     else return x*power(x*x,(y-1)/2);
   }
}

                        //                    Modular Exponentiation

ll mod_power(ll x, ll y, ll m)
{
    ll r = 1;     // Initialize result

    x = x % m; // Update x if it is more than or equal to m

    if (x == 0) return 0; // In case x is divisible by m;

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            r = (r*x) % m;

        // y must be even now
        y = y/2;
        x = (x*x) % m;
    }
    return r;
}

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

/*
bool isPrime[100001];
void sieve(int N) {

        for(int i = 0; i <= N;++i) {
            isPrime[i]=true;
        }
        isPrime[0]=false;
        isPrime[1]=false;

        for(int i = 2; i * i <= N; ++i) {
             if(isPrime[i] == true) {
                 for(int j = i * i; j <= N ;j += i)
                     isPrime[j] = false;
            }
        }
    }
*/


 vector<pair<double,double> >point;
 vector<bool>visited;
 double ans=0;
 int n;
 void dfs(int x,vector<bool>visit,double sum){
  visit[x]=true;
  if(count(all(visit),false)==1){
    ans+=sum;
  }else{
  for(int i=1;i<=n;i++){
     if(!visit[i]){
       double c=sum;
       c+=sqrt((point[i].first - point[x].first)*(point[i].first - point[x].first) + (point[i].second - point[x].second)*(point[i].second - point[x].second));
       dfs(i,visit,c);
     }
  }
}

 }
int main(){
    boost;
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
      
      cin>>n;
      point=vector<pair<double,double> >(n+1);
      for(int i=1;i<=n;i++)cin>>point[i].first>>point[i].second;
      visited=vector<bool>(n+1,false);
  
      for(int i=1;i<=n;i++){
        dfs(i,visited,0.0);
      }
      int p=1;
      for(int i=1;i<=n;i++)p*=i;
      ans/=p;

      printf("%0.10f\n",ans);
    }
}












Measured memory_bytes: 3812
#include <iostream>
using namespace std;
using i64 = long long;

int main() {
    i64 k;
    i64 a = 0;
    i64 ans = 0;

    cin >> k;

    const i64 inf = 20000000;
    while (ans < inf) {
        ans++;
        a *= 10;
        a += 7;
        a %= k;
        if (a == 0) break;
    }

    if (ans >= inf) cout << -1 << endl;
    else cout << ans << endl;
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {
    set<ll> s;
    ll N, a;
    cin >> N;
    REP(i, N){
        cin >> a;
        if (s.find(a) != s.end()) s.erase(a);
        else s.insert(a);
    }
    cout << s.size() << endl;
    return 0;
}

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

typedef long long ll;

const int INF = 100000000;

int main() {
    string S;
    int cnt1 = 0;
    int cnt2 = 0;
    cin >> S;

    for (int i = 0; i < S.size(); i++) {
        if (S[i] == '0') {
            cnt1++;
        } else {
            cnt2++;
        }
    }

    cout << 2 * min(cnt1, cnt2) << endl;
}


Measured memory_bytes: 512
def bubbleSort(a):
    sw = 0
    for _ in range(len(a) - 1):
        for j in range(len(a) - 1, 0, -1):
            if (a[j] < a[j - 1]):
                a[j], a[j - 1] = a[j - 1], a[j]
                sw += 1
    return a, sw

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

a, sw = bubbleSort(a)

print(*a)
print(sw)



Measured memory_bytes: 5612
// AtCoder
// ABC 106 B - 105

#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <functional>
#include <random>
#include <vector>
#include <chrono>

using namespace std;

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

	// 制約確認
	if (N < 1 || 200 < N) {
		cout << "Nは条件を満たしていません!\n";
		return 0;
	}

	// 計算
	int cnt = 0;
	for (int i = 1; i <= N; i++) {
		int divisor = 0;
		if (i % 2 == 1) {
			for (int j = 1; j <= i; j++) {
				if (i % j == 0) {
					divisor++; 
				}
			}
			if (divisor == 8) {
				cnt = cnt+1;
			}
		}
	}
	cout << cnt << endl;
}



Measured memory_bytes: 256
#include<stdio.h>

int main()
{
    int a,b,c,d;
    int x[30],y,z[30];
    scanf("%d%d",&a,&b);
    for(int i = 0; i < a; i++)
    {
        x[i]=i+1;
    }
    for(int i = 0; i < b; i++)
    {
        scanf("%d,%d",&c,&d);
        y = x[c-1];
        x[c-1] = x[d-1];
        x[d-1] = y;
    }
    for(int i = 0; i < a; i++)
    {
        printf("%d\n",x[i]);
    }
    return 0;
}

Measured memory_bytes: 1024
import math
def calculateTri(a, b, theta):
    s = a * b * math.sin(math.radians(theta)) / 2
    c = math.sqrt(a * a + b * b - 2 * a * b * math.cos(math.radians(theta)))
    l = a + b + c
    h = s * 2.0 / a
    return s, l, h

if __name__ == '__main__':
    a, b, t = map(float, input().split())
    s, l, h = calculateTri(a, b, t)
    print(' {0:.8f} '.format(s))
    print(' {0:.8f} '.format(l))
    print(' {0:.8f} '.format(h))


Measured memory_bytes: 5700
def main():
    ary = [str(i) for i in input()]
    make(ary)



def make(ary):
    moto = ['+','-']

    for i in moto:
        for j in moto:
            for k in moto:
                    pat = ary[0] + i + ary[1] + j + ary[2] + k + ary[3]
                    result = eval(pat)
                    if result == 7:
                        print(pat + '=' + str(result))
                        return 



if __name__ == '__main__':
    main()
    

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main(){
  int k,t,mx = 0;
  cin >> k >> t;
  vector<int> a(t);
  for(int i=0;i<t;i++){
    cin >> a[i];
    mx = max(mx, a[i]);
  }
  cout << max(mx-(k-mx)-1, 0) << endl;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <algorithm>

using namespace std;

inline long long mod_fibonacci_numberDiv2(int n)
{
	if (n < 3)
	{
		return n == 0 ? 0 : 1;
	}

	int dp[3] = { 1, 1, 2 };

	for (int i = 3; i < n; i += 3)
	{
		dp[0] = (dp[1] + dp[2]) % 1000000007;
		dp[1] = (dp[2] + dp[0]) % 1000000007;
		dp[2] = (dp[0] + dp[1]) % 1000000007;
	}

	return dp[(n - 1) % 3];
}

long long K;

int main()
{
	cin >> K;

	long long x_yDiv2 = 2 * sqrt(K - sqrt(K / 100) - 0.01) - 1; // x + y

	long long min_Div2 = ((x_yDiv2 + 1) * (x_yDiv2 + 1) / 4) + 1;
	long long max_Div2 = ((x_yDiv2 + 2) * (x_yDiv2 + 2) / 4);

	long long x, y;

	if (2 * K <= min_Div2 + max_Div2)
	{
		y = (K - min_Div2) * 2;
	}
	else
	{
		y = (max_Div2 - K) * 2 + 1;
	}

	x = x_yDiv2 - y;

	cout << (mod_fibonacci_numberDiv2(x + 2) * mod_fibonacci_numberDiv2(y + 2)) % 1000000007 << endl;

	return 0;
}

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

int main() {
    int n, count = 0;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];

    for (int j = 0; j < 100000000; j++) {
        for (int i = 0; i < n; i++) {
            if ( a[i] % 2 != 0) {
                cout << count << endl;
                return 0;
            }
            else {
                a[i] /= 2;
            }
        }
    count++;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>//Carefully Crafted by hetp111
using namespace std;
#define int long long
#define double long double
#define all(v) (v).begin(),(v).end()
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int,int>
#define vii vector<pii>
#define MOD (1000000007)
#define MOD2 (998244353)
#define MOD3 (1000000009)
#define PI acos(-1)
#define eps (1e-8)
#define INF (1e18)
#define FASTER ios_base::sync_with_stdio(0);cin.tie(0)
template<class A,class B>ostream&operator<<(ostream&out,const pair<A,B>&a){return out<<"("<<a.first<<","<<a.second<<")";}
template<class A>ostream&operator<<(ostream&out,const vector<A>&a){for(const A &it:a)out<<it<<" ";return out;}
template<class A,class B>istream&operator>>(istream&in,pair<A,B>&a){return in>>a.first>>a.second;}
template<class A>istream&operator>>(istream&in,vector<A>&a){for(A &i:a)in>>i;return in;}
ifstream cinn("input.txt");ofstream coutt("output.txt");

signed main(){
    FASTER;
    int a,b,c,k;cin>>a>>b>>c>>k;
    
    if(a>=k){
        cout<<k;
    }else if(a+b>=k){
        cout<<a;
    }else if(a+b+c>=k){
        cout<<a-(k-a-b);
    }
    
}

Measured memory_bytes: 3656
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner s = new Scanner(System.in);
		int n = s.nextInt();
		int[] h = new int[n+1];
		for (int i = 1; i <=n; i++) {
			h[i] = s.nextInt();
		}
		long[] a = new long[n+1];
		for (int i = 1; i <= n; i++)
			a[i] = s.nextLong();
		long[] dp = new long[n+1];
		long[] bit=new long[n+1];
		for(int i=1;i<=n;i++) {
			dp[i]=query(h[i]-1,bit)+a[i];
			update(h[i],dp[i],bit);
		}
		long best=0;
		for(int i=1;i<=n;i++) {
			best=Math.max(best, dp[i]);
		}
		System.out.println(best);
	}
	public static long query(int x, long[] bit) {
		long res=0;
		while(x>0) {
			res=Math.max(bit[x], res);
			x-=-x&x;
		}
		return res;
	}
	public static void update(int x, long val, long[] bit) {
		while(x<bit.length) {
			bit[x]=Math.max(bit[x],val);
			x+=-x&x;
		}
	}

}


Measured memory_bytes: 106736
from operator import itemgetter

N = int(input())
l = []
for i in range(N):
        s, p = input().split()
        p = int(p)
        l.append([s,p,1+i])
l.sort(key=itemgetter(0))
L = []
k = l[0][0]
ss = [l[0]]
for i in range(N-1):
        if l[i+1][0] == k :
                ss.append(l[i+1])
        else:
                L.append(ss)
                ss = [l[i+1]]
                k = l[i+1][0]
L.append(ss)
for i in L:
        i.sort(key=itemgetter(1), reverse=True)
for i in L:
        for j in range(len(i)):
                print(i[j][2])

Measured memory_bytes: 3064
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <cstring>
#include <climits>
#include <iomanip>
#include <bitset>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <list>
#include <map>

using namespace std;

int main() {
  int a, b;
  cin >> a >> b;
  if (a == 1 && b == 1) {
    cout << 1 << endl;
  } else if (a == 1 || b == 1) {
    cout << max(0, max(a, b) - 2) << endl;
  } else {
    cout << max(0ll, 1ll * (a - 2) * (b - 2)) << endl;
  }
  return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int D = sc.nextInt();
		if (1<=A&&A<=100 &&1<=B&&B<=100 &&1<=C&&C<=100 &&1<=D&&D<=100 ){
		}
		else{
			throw new IllegalArgumentException("不適切な数値です。");
		}
		while(A> 0 && C> 0){	
			C -= B;
			if (C > 0){
				A -= D;
			}else{
				System.out.println("Yes");
				return;
			}
		}
			System.out.println("No");
	}
	
}

Measured memory_bytes: 35812
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

using namespace std;

#define fori(x) for (int i = 0; i < x; ++i)
#define forj(x) for (int j = 0; j < x; ++j)

typedef long long ll;

const int INF = 2e9 + 5;
const int alength=100100;

int main() {
	int n,m,x,y;
	cin>>n>>m>>x>>y;--x;--y;
	int xa[100]={},ya[100]={};
	fori(n){cin>>xa[i];--xa[i];}
	fori(m){cin>>ya[i];--ya[i];}
	sort(xa,xa+n,greater<int>());
	sort(ya,ya+m);
	for(int z=x+1;z<=y;++z){
		if(z>xa[0]&&z<=ya[0]){
			cout<<"No War";
			return 0;
		}
	}
	cout<<"War";
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>

using namespace std;


int main(){
    int N;
    cin >> N;
    string A, B, C;
    cin >> A >> B >> C;

    int ans = 0;
    for (int i = 0; i < N; i++){
        if (A[i] == B[i]){
            if (A[i] != C[i]){
                ans ++;
            }
        }else if(A[i] == C[i]){
            ans ++;
        }else if(B[i] == C[i]){
            ans ++;
        }else{
            ans += 2;
        }
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
<?php
list($N, $W) = array_map("intval", explode(" ", trim(fgets(STDIN))));
for($i = 0; $i < $N; $i++){
    $map[] = array_map("intval", explode(" ", trim(fgets(STDIN))));
}
array_unshift($map,[]);

for($j = 0; $j <= $W; $j++){
    $dp[0][$j] = 0;
}
for($i = 1; $i <= $N; $i++){
    list($w, $p) = $map[$i];
    for($j = 0; $j <= $W; $j++){
        $dp[$i][$j] = $dp[$i-1][$j];
    }
    for($j = $map[$i][0]; $j <= $W; $j++){
        $dp[$i][$j] = max($dp[$i][$j], $dp[$i-1][$j - $w] + $p);
    }
}
echo $dp[$N][$W];


Measured memory_bytes: 420328
#include <cstdio>
#include <cstring>
#include <algorithm>
#define ll long long
#define inf 1<<30
#define il inline 
#define in1(a) read(a)
#define in2(a,b) in1(a),in1(b)
#define in3(a,b,c) in2(a,b),in1(c)
#define in4(a,b,c,d) in2(a,b),in2(c,d)
il void readl(ll &x){
    x=0;ll f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    x*=f;
}
il void read(int &x){
    x=0;int f=1;char c=getchar();
    while(c<'0'||c>'9'){if(c=='-')f=-f;c=getchar();}
    while(c>='0'&&c<='9'){x=x*10+c-'0';c=getchar();}
    x*=f;
}
using namespace std;
/*===================Header Template=====================*/
#define N 100010
bool check(int x){
	int ans=0;
	for(int i=1;i<=x;i++){
		if(!(x%i))ans++;
	}
	if(ans==8)return 1;
	return 0;
}
int main(){
	int n;in1(n);int ans=0;
	for(int i=1;i<=n;i+=2){
		if(check(i))ans++;
	}
	printf("%d\n",ans);
}


Measured memory_bytes: 128
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <math.h>
#include <algorithm>

using namespace std;


int main() {
	string s;
	cin >> s;
	if (s == "ABC") {
		cout << "ARC" << endl;
	}
	else cout << "ABC" << endl;

	return 0;
}

Measured memory_bytes: 3508
from collections import Counter
import heapq

n = int(input())
sc = Counter()

for x in range(n):
  s = input()
  sc.update([s])

max_num = sc.most_common()[0][1]
q = []
for v in sc.items():
  if v[1] == max_num:
    heapq.heappush(q, v[0])

for _ in range(len(q)):
  print(heapq.heappop(q))



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

typedef long long ll;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const ll INF = 1<<21;
// static const ll MOD = 1e9 + 7;

// bool compPair(const pair<int, int>& arg1, const pair<int, int>& arg2) {
//     return arg1.first > arg2.first;
// }

int main(void) {
    ll k;
    cin >> k;

    priority_queue<ll, vector<ll>, greater<ll>> pq;
    for(int i=0;i<9;i++) {
        pq.push(i+1);
    }

    ll ans, before=0, r, ik=0;
    while(ik<k) {
        ans = pq.top(); pq.pop();
        if(before==ans) continue;
        r = ans % 10;
        if(r!=0) pq.push(10*ans+r-1);
        pq.push(10*ans+r);
        if(r!=9) pq.push(10*ans+r+1);
        before = ans;
        ik++;
    }
    
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define ll long long
#define ar array

int N , Q, tmp;
int arr[500001];
int last[500001];
int ans[500001];
int t[500001];

void add(int i, int x){
    while(i < N+1){
        t[i] += x;
        i += i & -i;   
    }
}

int sum(int i){
    int s = 0;
    while(i > 0){
        s += t[i];
        i -= i&-i;
    }
    return s;
}

int sum(int l, int r){

    return sum(r)-sum(l-1);
}

struct v{
    int left, right, indx;
};


bool comp(v a, v b){
    return a.right < b.right;
}
v out[500001];

void solve(){
    cin >> N >> Q;

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

    int l,r ;
    for (int i = 0; i < Q; i++)
    {
        v tmp;
        cin >> tmp.left >> tmp.right;
        tmp.indx = i;
        out[i] = tmp;
    }


    sort(out,out+Q,comp);


    for (int i = 1; i < N+1; i++)
    {
        last[i] = -1;
        t[i] = 0;
    }

    int query = 0;
    for (int i = 1; i < N+1; i++)
    {
        
        if(last[arr[i]] != -1){
            add(last[arr[i]], -1);
        }
        add(i,1);
        last[arr[i]] = i;


        while (out[query].right <= i && query < Q)
        {
            ans[out[query].indx] = sum(out[query].left, out[query].right );
            query++;
        }
        
        
    }
    
 
    for (int i = 0; i < Q; i++)
    {
        cout << ans[i] << endl;
    }
}





int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);

    solve();

}

Measured memory_bytes: 17472
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

string s[3];

int main(){
	while (cin >> s[0]){
		bool f1 = 0, f2 = 0;
		if (s[0] == "0")break;
		cin >> s[1] >> s[2];
		REP(i, 3){
			if (s[i][0] == s[i][1] && s[i][1] == s[i][2]){
				if (s[i][0] == 'w')f1 = 1;
				if (s[i][0] == 'b')f2 = 1;
			}
			if (s[0][i] == s[1][i] && s[1][i] == s[2][i]){
				if (s[0][i] == 'w')f1 = 1;
				if (s[0][i] == 'b')f2 = 1;
			}
		}
		if (s[0][0] == s[1][1] && s[1][1] == s[2][2]){
			if (s[0][0] == 'w')f1 = 1;
			if (s[0][0] == 'b')f2 = 1;
		}
		if (s[0][2] == s[1][1] && s[1][1] == s[2][0]){
			if (s[0][2] == 'w')f1 = 1;
			if (s[0][2] == 'b')f2 = 1;
		}
		if (f1)cout << "w" << endl;
		else if (f2)cout << "b" << endl;
		else cout << "NA" << endl;
	}
}

Measured memory_bytes: 1180
import java.util.*;

public class Main{
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		boolean flag = false;
		for(int i = 0; i < 3; i++) {
			if(s.charAt(i) == '7')flag = true;
		}
		System.out.println((flag)?"Yes":"No");
	}
}

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

using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define REP(i, n) for(ll i = n-1; i >= 0; i--)
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << " = " << x << endl
#define mp(a, b) make_pair(a, b)
#define pb push_back

const long long MOD = 1000000007;


int main(){
    ll n, k;
    cin >> n >> k;

    ll c = 0;
    rep(i, n){
        ll h;
        cin >> h;
        if(h >= k){
            c++;
        }
    }
    
    cout << c << endl;

    return 0;
}


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

int main() {
    ll N, M; cin >> N >> M;
    vector<ll> H(N);
    rep(i,N) cin >> H.at(i);
    vector<vector<int>> G(N+1);
    rep(i,M) {
        ll A, B; cin >> A >> B;
        G[A].push_back(B);
        G[B].push_back(A);
    }
    ll good = 0;
    rep(i,N) {
        vector<int> &G2 = G[i+1];
        for (int x : G2) {
            if (H[i] <= H[x-1]) goto CONT;
        }
//        cout << i+1 << " is good! " << endl;
        good++;
CONT:;
    }
    cout << good << endl;
}


Measured memory_bytes: 9068
#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007
#A
"""
def A():
    t,x = LI()
    print(t/x)
    return
"""
#B
"""
def B():
    n = I()
    a = LI()
    m = max(a)
    if m >= sum(a)-m:
        print("No")
    else:
        print("Yes")
    return
"""
#C
"""
def C():
    n,m = LI()
    x = LI()
    x.sort()
    l = [x[i+1]-x[i] for i in range(m-1)]
    l.sort()
    l = l[::-1]
    ans = sum(l[max(n-1,0):])
    print(ans)
    return
"""
#D
def D():
    n,k = LI()
    a = LI()
    k = list(map(int,list(bin(k)[2:])))
    l = len(k)
    for i in range(n):
        a[i] = list(map(int,list(bin(a[i])[2:])))
        l = max(l,len(a[i]))
    for i in range(n):
        for j in range(l-len(a[i])):
            a[i].insert(0,0)
    for j in range(l-len(k)):
        k.insert(0,0)
    s = [[0,0] for i in range(l)]
    pow2 = [1 for i in range(l)]
    for i in range(l-1)[::-1]:
        pow2[i] = pow2[i+1]*2
    for i in a:
        for j in range(l):
            s[j][0] += pow2[j]*i[j]
            s[j][1] += pow2[j]*(not i[j])
    dp = [0 for i in range(l+1)]
    small = False
    for i in range(l):
        if not small:
            if not k[i]:
                dp[i+1] += dp[i]+s[i][0]
            else:
                if s[i][0] >= s[i][1]:
                    dp[i+1] += dp[i]+s[i][0]
                    small = True
                else:
                    dp[i+1] += dp[i]+s[i][1]
        else:
            dp[i+1] += dp[i]+max(s[i])
    print(dp[l])
    return
#E
if __name__ == "__main__":
    D()

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


Measured memory_bytes: 115488
#include <iostream>
using namespace std;
const int MAX = 1000001;
 
int main(){
  int n,s;
 
  while(cin >> n ,n){
    int m[MAX]={0};
    int ans = 0,num = 0;
    for(int i = 0 ; i < n ; i++){
      cin >> s;
      m[s]++;
 
      if(ans < m[s]){
	ans = m[s];
	num = s;
      }
    }
 
    if(ans > n / 2) cout << num << endl;
    else cout << "NO COLOR" << endl;
  }
 
  return 0;
}

Measured memory_bytes: 5068
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second

signed main(){
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif

	int n,d;
	cin >> n >> d;
	int x,y;
	int c=0;
	for(int i=0; i<n; i++){
		cin >> x >> y;
		if(x*x + y*y <= d*d)
			c++;
	}
	cout << c;


	
	

	return 0;
}

Measured memory_bytes: 3672
#include<set>    
#include<map>    
#include<stack>    
#include<ctime>    
#include<cstdio>    
#include<queue>    
#include<cmath>    
#include<vector>    
#include<cstring>   
#include<climits>    
#include<iostream>   
#include<algorithm>   
using namespace std;
#define LL long long
int read(){   
    int f=1,x=0;char c=getchar();   
    while(c<'0'||'9'<c){if(c=='-')f=-1;c=getchar();}   
    while('0'<=c&&c<='9'){x=x*10+c-'0';c=getchar();}   
    return f*x;
}
#define MAXN int(5e6)
#define INF 0x3f3f3f3f
const LL P=924844033,g=5,rg=554906420;
LL Lim=1,lg2,a[MAXN+5],b[MAXN+5],rev[MAXN+5];
LL Pow(LL x,int y){
	LL ret=1;
	while(y){
		if(y&1) ret=(ret*x)%P;
		x=(x*x)%P;
		y>>=1;
	}
	return ret;
}
#define limit Lim
#define G g
#define Gi rg
void NTT(LL *A, int type) {
    for(int i=0;i<limit;i++) 
        if(i<rev[i]) swap(A[i],A[rev[i]]);
    for(int mid=1;mid<limit;mid <<=1) {  
        LL Wn=Pow(type==1?G:Gi,(P-1)/(mid<<1));
        for(int j=0;j<limit;j+=(mid<<1)) {
            LL w=1;
            for(int k=0;k<mid;k++,w=(w*Wn)%P) {
				int x=A[j+k],y=w*A[j+k+mid]%P;
				A[j+k]=(x+y)%P,A[j+k+mid]=(x-y+P)%P;
            }
        }
    }
}
vector<int> Gra[MAXN+5];
int N,siz[MAXN+5],cnt[MAXN+5];
void DFS(int u,int fa){
	siz[u]=1;
	for(int i=0;i<(int)Gra[u].size();i++){
		int v=Gra[u][i];
		if(v==fa) continue;
		DFS(v,u),siz[u]+=siz[v];
	}
	if(fa!=0)
		cnt[N]++,cnt[siz[u]]--,cnt[N-siz[u]]--;
	return ;
}
LL fac[MAXN+5],inv[MAXN+5];
int main(){
	N=read();
	fac[0]=1;
	for(int i=1;i<=N;i++)
		fac[i]=fac[i-1]*i%P;
	inv[N]=Pow(fac[N],P-2);
	for(int i=N-1;i>=0;i--)
		inv[i]=inv[i+1]*(i+1)%P;
	for(int i=1;i<N;i++){
		int u=read(),v=read();
		Gra[u].push_back(v);
		Gra[v].push_back(u);
	}
	DFS(1,0),cnt[N]=N;
	//
	int n=N,m=N;
	for(int i=0;i<=n;i++)
		a[i]=cnt[i]*fac[i]%P;
	for(int i=0;i<=m;i++)
		b[m-i]=inv[i];
	while(Lim<=n+m) Lim<<=1,lg2++;
	for(int i=0;i<Lim;i++)
		rev[i]=(rev[i>>1]>>1)|((i&1)<<(lg2-1));
	NTT(a,1),NTT(b,1);
	for(int i=0;i<Lim;i++)
		a[i]=(a[i]*b[i])%P;
	NTT(a,-1);
	LL inv_Lim=Pow(Lim,P-2);
	for(int i=0;i<=n+m;i++)
		a[i]=a[i]*inv_Lim%P;
	for(int i=1;i<=n;i++)
		printf("%lld\n",a[n+i]*inv[i]%P);
	return 0;
}//

Measured memory_bytes: 166656
#include<stdio.h>
#define MAX 10000
#define NIL -1

struct Node { int p, l, r;};
struct Node T[MAX];
int n;

/* 先行順巡回 */
void preParse( int u ){
	if ( u==NIL ) return;
	printf(" %d",u);
	preParse(T[u].l);
	preParse(T[u].r);
}

/*中間順巡回*/
void inParse( int u ){
	if( u == NIL ) return;
	inParse(T[u].l);
	printf(" %d",u);
	inParse(T[u].r);
}

/*後行順巡回*/
void postParse( int u ){
	if ( u==NIL ) return;
	postParse(T[u].l);
	postParse(T[u].r);
	printf(" %d",u);
}

int main(){
	int i, v, l, r, root;
	
	scanf("%d",&n);
	for( i=0; i<n; i++){
		T[i].p = NIL;
	}
	
	for( i=0; i<n; i++){
		scanf("%d %d %d",&v,&l,&r);
		T[v].l = l;
		T[v].r = r;
		if( l != NIL ) T[l].p =v;
		if( r != NIL ) T[r].p =v;
	}
	
	for( i=0; i<n; i++) if( T[i].p == NIL ) root = i;
	
	printf("Preorder\n");
	preParse(root);
	printf("\n");
	printf("Inorder\n");
	inParse(root);
	printf("\n");
	printf("Postorder\n");
	postParse(root);
	printf("\n");
	
	return 0;
}



Measured memory_bytes: 2088
#include<bits/stdc++.h>
        #define F first
        #define S second
        using ll = long long;
        const ll mod = 1000000007;
        const ll infi = 1000000000000000;
        const ll md = 998244353;
        using namespace std;
        using vl = vector<ll>;
        using pll =  pair<ll,ll>;
        
       
        void solve(){
           int n; cin>>n;
           vl a(n); for(int i=0;i<n;i++) cin>>a[i];
           vl c(3,-1);
           ll ans=1;
           for(int i=0;i<n;i++){
               int cnt = 0;
               for(int j=0;j<3;j++)
                    if(a[i]  == c[j] + 1) cnt++;
               if(cnt ==0){
                   cout<<0;
                   return;
               }
               ans = (ans * cnt)%mod;
               if(a[i] == c[0]+1){ c[0]++;}
               else if(a[i] == c[1]+1){ c[1]++;}
               else if(a[i] == c[2]+1){ c[2]++;}
           }
           cout<<ans;    
           
        }
        
        int main() {
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            solve();
            return 0;
        } 

Measured memory_bytes: 1024
#include <stdio.h>
#include <math.h>


int main(void)
{
    double S, L, h;
    double a, b, c;
    double rad;

    scanf("%lf", &a);
    scanf("%lf", &b);
    scanf("%lf", &c);

    rad = c * M_PI / 180.0;
    S = (a * b * sin(rad))/2;
    L = a + b + sqrt(a * a + b * b - 2 * a * b * cos(rad));
    h = 2 * S / a;

    printf("%lf\n", S);
    printf("%lf\n", L);
    printf("%lf\n", h);
    return (0);
}


Measured memory_bytes: 2084
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ACantWaitForHoliday solver = new ACantWaitForHoliday();
        solver.solve(1, in, out);
        out.close();
    }

    static class ACantWaitForHoliday {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String s = in.next();
            if (s.equals("SUN")) out.println(7);
            else if (s.equals("MON")) out.println(6);
            else if (s.equals("TUE")) out.println(5);
            else if (s.equals("WED")) out.println(4);
            else if (s.equals("THU")) out.println(3);
            else if (s.equals("FRI")) out.println(2);
            else if (s.equals("SAT")) out.println(1);

        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



Measured memory_bytes: 21460
import * as fs from 'fs'

const process = (na: number[]): string => {
  const [x, a] = na
  if (x < a) {
    return '0'
  }
  return '10'
}

const Main = (input: string): string => {
  const a: string[] = input.split(' ')
  const na: number[] = a.map((e) => parseInt(e))

  const res = process(na) + ''
  console.log(res)
  return res
}
Main(fs.readFileSync("/dev/stdin", "utf8"))


Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
typedef long long ll;
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}else{return 0;}}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}else{return 0;}}
template <class T> inline T GCD(T a,T b){T c;while(b!=0){c=a%b;a=b;b=c;}return a;}
template <class T> inline T LCM(T a,T b){return a*b/GCD(a,b);}


int main(){
  ll x,y;
  cin >> x >> y;
  ll ans=0;
  while(x<=y){
    ans++;
    x*=2;
  }

  cout << ans << endl;

}


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

using namespace std;

// input
int n,k;
vector<int> rod;

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

    cin >> n >> k;

    int num;
    
    while(cin >> num){
        rod.push_back(num);
    }

    sort(rod.begin(),rod.end(),greater<int>());

    int ans = 0;

    for(int i = 0;i < k;i++){
        ans += rod[i];
    }

    cout << ans << "\n";
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void)
{
     int D,N;
     scanf("%d %d",&D,&N);
     if(N!=100){
     switch(D){
     	case 0:printf("%d\n",N);break;
     	case 1:printf("%d\n",100*N);break;
     	case 2:printf("%d\n",10000*N);break;
     }
     }else{
     	switch(D){
     	case 0:printf("%d\n",N+1);break;
     	case 1:printf("%d\n",100*N+100);break;
     	case 2:printf("%d\n",10000*N+10000);break;
     }
     }
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define MOD 1000000007
#define ll long long int
#define db double
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define endl "\n"
#define mp make_pair
#define f first
#define se second
#define pi 3.14159265358979
//ll string_inp() {cin.get(); for(int i =0;i<n;i++){ getline(cin,s[i]);}}
ll gcd(ll a, ll b){ if (a == 0) return b;  return gcd(b % a, a);  }
ll power(ll x, ll y, ll mod = 2e18) {ll ans = 1;x %= mod;while(y){if(y&1) ans = (x * ans) % mod;x = (x * x) % mod;y >>= 1;}return ans;}
ll modInverse(ll a, ll m) { ll m0 = m; ll y = 0, x = 1; if (m == 1) return 0; while (a > 1) { ll q = a / m; ll t = m; m = a % m,a = t; t = y; y = x - q * y; x = t; } if(x < 0) x += m0;return x;}
int takemod(int a, int mod = MOD){a%=mod;if(a<0)a+=mod;return a;}
ll binsearch(std::vector<ll>& nums, ll target) {ll n = nums.size();ll l = 0;ll r = n-1;while(l<=r){ll mid = l+ (r-l)/2;if(nums[mid]==target)return mid;else if(nums[mid]>target)r = mid-1;else l = mid+1;}return -1;}
bool isPowerOfTwo (int x) {return x && (!(x&(x-1))); }

using namespace std;

int main()
{
   fastio
   ll t;
   cin>>t;
  cout<<(1000-(t%1000))%1000<<endl;


}




Measured memory_bytes: 3656
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
 
using namespace std;
 
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)
 
int main() {
    int f=-1;
    string s;
    cin>>s;
    REP(i,s.size()){
        if(i%2==0&&s[i]=='L'){
            cout<<"No"<<endl;
            return 0;
        }
        if(i%2==1&&s[i]=='R'){
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String []args){
        Scanner sc = new Scanner( System.in );
        String s = sc.nextLine();
        String t = sc.nextLine();
        int n = s.length();
        int ans = 0;
        for(int i = 0 ; i < n ;i++){
            if(s.charAt( i )!=t.charAt( i ))
                ans++;
        }
        System.out.println( ans );
    }

}


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

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

    // 引数の受け取り
    //
    cin >> a >> b ;
    a+=b;
    if(a>=24) a-=24;

    // 出力
    cout << a << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

void solve() {
    int n, k;
    cin >> n >> k;
    int l[n];
    for (int i=0; i<n; ++i)
        cin >> l[i];
    sort(l, l+n);
    int ans = 0;
    for (int i=0; i<k; ++i)
        ans += l[n-1-i];
    cout << ans;

}

int main() {

	solve();
    return 0;
}


Measured memory_bytes: 3156
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>
#include <bitset>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    int n, k;
    cin >> n >> k;
    vvll a(n, vll(n));
    ll big = 1ll << 40;
    mcf_graph<ll, ll> g(2*n + 2);
    int s = 2*n, t = 2*n + 1;
    g.add_edge(s, t, n * k, big);
    rep(i, n) rep(j, n) {
        ll a;
        cin >> a;
        g.add_edge(i, n+j, 1, big - a);
    }
    rep(i, n) {
        g.add_edge(s, i, k, 0);
        g.add_edge(n+i, t, k, 0);
    }
    auto res = g.flow(s, t, n * k);
    cout << big * n * k - res.second << endl;
    vector<string> ans(n, string(n, '.'));
    auto ve = g.edges();
    for(auto e : ve) {
        if(e.from == s || e.to == t || e.flow == 0) continue;
        int i = e.from;
        int j = e.to - n;
        ans[i][j] = 'X';
    }
    for(auto _ans : ans) cout << _ans << endl;
    return;
}

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

Measured memory_bytes: 3996
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <algorithm>
using namespace std;
using ll = long long;
const double EPS = 1e-10;
const ll MOD = 7+(1e+9);

int main(){
  ll n,ans;
  ll bx,xa,ba;
  ans=0;
  cin>>n;
  bx=xa=ba=0;
  vector<string>v(n);
  for(ll i=0;i<n;i++){
    cin>>v[i];
    ll f=0;
    for(ll j=0;j<v[i].size();j++){
      if(v[i][j]=='A')f=1;
      else if(f==1&&v[i][j]=='B')f=0,ans++;
      else f=0;
    }
    if(v[i][0]=='B')bx++;
    if(v[i][v[i].size()-1]=='A')xa++;
    if(v[i][0]=='B'&&v[i][v[i].size()-1]=='A'){
      bx--;
      xa--;
      ba++;
    }
  }
  ll k=0;
  k=ba+min(bx,xa);
  if((bx==0&&ba)&&(xa==0&&ba))k--;
  cout<<ans+k<<endl;
}


Measured memory_bytes: 512
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
#include<limits.h>
#include<unordered_map>
#include<unordered_set>
#include<deque>
#include<cstdio>
using namespace std;
typedef long long int ll;
const int N = 1000000;
const ll INF = std::numeric_limits<long long>::max();
#define rep(i,n) for(ll i=(ll)0;i<(ll)n;++i)
#define ALL(x) x.begin(),x.end()
#define pp pair<ll,ll>
#define fi first
#define se second
#define sz size
string YN(bool b) { return(b ? "YES" : "NO"); }
string yn(bool b) { return(b ? "Yes" : "No"); }
ll n, m;
string s;
vector<int>ints;
vector<string>strings;
int main() {
	cin >> n;
	rep(i, n) {
		cin >> s;
		bool b = 0;
		rep(j, strings.size()) {
			if (s == strings[j]) { b = 1; ints[j]++; break; }
		}
		if (b == 0) { strings.push_back(s); ints.push_back(1); }
	}
	cin >> m;
	rep(i, m) {
		cin >> s;
		bool b = 0;
		rep(j, strings.size()) {
			if (s == strings[j]) { b = 1; ints[j]--; break; }
		}
		if (b == 0) { strings.push_back(s); ints.push_back(-1); }
	}
	sort(ALL(ints));
	cout << max(0,ints[ints.size() - 1]) << endl;
	return 0;

}

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

int main() {
int N,K,ans,M;
string S;
cin>>N>>K;
M=N;
  for(int i=0;M>=pow(K,i);i++){
    N/=K;
    ans++;
  }

  cout<<ans;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<vector>
typedef long long ll;
using namespace std;
ll n,d,ans=0;
int main()
{
  scanf("%lld%lld",&n,&d);
  ans=n/(d+d+1);
  if ((n%(d+d+1))!=0) ans++;
  printf("%lld",ans);
  return 0;
} 

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class B { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		long N = GetLong();
		long cnt = 0;
		bool ok = false;
		for(long i = 0; i < N; i++)
		{
			if(GetLong() == GetLong())
				cnt++;
			else
				cnt = 0;

			if(cnt >= 3)
				ok = true;
		}
		WriteLine(ok ? "Yes" : "No");
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


Measured memory_bytes: 27468
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N, X;
  cin >> N >> X;
  vector<int> l(N);
  for(int i = 0; i < N; i++){
    cin >> l.at(i);
  }
  int count = 0; int D = 0; 
  for(int i = 0; i < N; i++){
    if(D > X)
      break;
    D += l.at(i);
    count++;
    if((i == (N - 1)) && (D  <= X))
      count = N + 1;
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>

int main()
{
	int size;
	std::cin >> size;
	std::vector<int> nums;
	int S1 = 0, S2 = 0;
	for (int i = 0; i < size; i++)
	{
		int num;
		std::cin >> num;
		nums.push_back(num);
		S2 += num;
	}
	int sub = 100;
	for (int num : nums)
	{
		S1 += num;
		S2 -= num;
		sub = std::min(sub, std::abs(S2 - S1));
	}
	std::cout << sub;
}

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

typedef long long int ll;
typedef long long unsigned int ull;
typedef long double ld;
typedef vector<int> vr;
typedef pair<int, int> pr;
#define pb push_back
#define ff first
#define ss second
#define INF 1999999999
#define MODA 1000000007
#define PI 3.1415926535897932384626433
#define endl "\n"
//cout << fixed << setprecision(2);

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin >> s;
    int len = s.size();
    int cnt = 0;
    if(len % 2 != 0){
        cout << "No" << endl;
        exit(0);
    }
    for(int i = 0; i < len; i+=2){
        if(s[i] != 'h' || s[i+1] != 'i'){
            //cout << s[i] << " " << s[i+1] << endl;
            cout << "No" << endl;
            exit(0);
        }
    }
    cout << "Yes" << endl;
    return 0;
}



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

struct Node {
    int key;
    Node* left;
    Node* right;
    Node(int key_in){
        key   = key_in;
        left  = NULL;
        right = NULL;
    }
};

class Tree {
    Node* root;
    void inorder(Node* n){
        if (n == NULL) return;
        inorder(n->left);
        cout << " " << n->key;
        inorder(n->right);
    }
    void preorder(Node* n){
        if (n == NULL) return;
        cout << " " << n->key;
        preorder(n->left);
        preorder(n->right);
    }
public:
    Tree(){
        root = NULL;
    }
    void insert(int key){
        Node* z = new Node(key);
        if (root == NULL) {
            root = z;
            return;
        }
        Node* x = root;
        while(1) {
            if (key < x->key) {
                if (x->left == NULL) {
                    x->left = z;
                    break;
                }
                x = x->left;
            } else {
                if (x->right == NULL) {
                    x->right = z;
                    break;
                }
                x = x->right;
            }
        }
    }
    void print(){
        inorder(root);
        cout << endl;
        preorder(root);
        cout << endl;
    }
    void find(int key){
        for (Node* x = root; x != NULL;) {
            if (key == x->key) {
                cout << "yes" << endl;
                return;
            }
            if (key < x->key) {
                x = x->left;
            } else {
                x = x->right;
            }
        }
        cout << "no" << endl;
        return;
    }
};


int main(){
    int m;
    cin >> m;
    Tree T;
    for (int i = 0; i < m; i++) {
        string str;
        cin >> str;
        if (str == "print") {
            T.print();
            continue;
        }
        int num;
        cin >> num;
        if (str == "insert") {
            T.insert(num);
            continue;
        }
        if (str == "find") {
            T.find(num);
            continue;
        }
    }
    return 0;
}

Measured memory_bytes: 15608
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    REP(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    REP(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

int main()
{
	int N = inputValue();
	double s = 0;
	REP(i, N){
		int v = inputValue();
		s += 1.0 / v;
	}
	s = 1.0 / s;
	cout << fixed;
	cout << setprecision(8) << s << endl;
}


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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

typedef long long ll;
//typedef pair<int,int> P;
//typedef pair<int,P> PP;

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

template< typename T >
struct Edge {
	int from,to;
	T cost;

	Edge(int to,T cost):from(-1),to(to),cost(cost) {}
	Edge(int from,int to,T cost):from(from),to(to),cost(cost) {}
};

template< typename T >
using Edges=vector< Edge<T> >;

template< typename T >
using WeightedGraph=vector< Edges<T> >;

template< typename T >
T prim(WeightedGraph<T> &G) {
	using P=pair<T,int>;

	T res=0;
	vector<bool> visited((int)G.size(),false);
	priority_queue< P,vector<P>,greater<P> > Q;
	Q.emplace(0,0);
	while(!Q.empty()) {
		P p=Q.top();Q.pop();
		int v=p.second;
		if(visited[v]) continue;
		visited[v]=true;
		res+=p.first;
		for(auto e:G[v]) Q.emplace(e.cost,e.to);
	}
	return res;
}

using Weight=long long;

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

	int V,E;
	cin>>V>>E;
	WeightedGraph<Weight> G(V);
	for(int i=0;i<E;i++) {
		int s,t;Weight w;
		cin>>s>>t>>w;
		G[s].emplace_back(t,w);
		G[t].emplace_back(s,w);
	}
	cout<<prim(G)<<endl;

	return 0;
}



Measured memory_bytes: 12444