akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i < (int)(n); i++)
#define INF 1e9
#define all(v) v.begin(), v.end()
typedef long long ll;

int main(){
  int n, m;
  cin >> n >> m;
  vector<vector<int> > s(m, vector<int>(10));
  rep(i, m){
    int k;
    cin >> k;
    rep(j, 10-k) s.at(i).pop_back();
    rep(j, k) cin >> s.at(i).at(j);
  }
  vector<int> p(m);
  rep(i, m) cin >> p.at(i);

  int ans = 0;
  rep(tmp, 1<<n){
    bitset<10> bs(tmp);
    rep(i, m){
      int cnt = 0;
      for(int x : s.at(i)){
        if(bs.test(x-1)) cnt++;
      }
      if(cnt%2 != p.at(i)) break;
      if(i == m-1) ans++;
    }
  }

  cout << ans << endl;

  return 0;
}


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

int main()
{
	int v[26] = {};
	string Q;
	

	while (getline(cin, Q))
	{
		for (int i = 0; i < Q.size(); i++)
		{
			if (Q[i] >= 'a' && Q[i] <= 'z') v[Q[i] - 'a']++;
			else if (Q[i] >= 'A' && Q[i] <= 'Z') v[Q[i] - 'A']++;
		}
	}


	for (int i = 97; i <=122; i++)
	{
		cout << char(i) << " : " << v[i - 97] << endl;
	}
}


Measured memory_bytes: 3204
#include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>

int main(){
    std::string s;
    std::cin>>s;
    std::vector<int> alphacnt(26,0);
    std::vector<std::vector<int>> imoalpha(26,std::vector<int>(s.size(),0));
    char t='0';
    for(size_t i = 0; i < s.size(); i++){
        if(s[i]==t){
            std::cout<<i<<" "<<i+1<<std::endl;
            return 0;
        }
        ++alphacnt[s[i]-'a'];
        ++imoalpha[s[i]-'a'][i];
        t=s[i];
    }
    auto me=std::max_element(alphacnt.begin(),alphacnt.end());
    if(*me*2>s.size()){
        std::cout<<1<<" "<<s.size()<<std::endl;
        return 0;
    }
    for(size_t i = 1; i < s.size(); i++){
        for(int j=0;j<26;++j){
            imoalpha[j][i]+=imoalpha[j][i-1];
        }
    }

    for(size_t i = 0; i+2 < s.size(); i++){
        if(s[i]==s[i+2]){
            std::cout<<i+1<<" "<<i+3<<std::endl;
            return 0;
        }    
    }    
    /*
    int l=3,r=*me * 2;
    int mid;
    while((l+r)/2!=mid){
        mid=(l+r)/2;
        for(size_t i = 0; i+mid <= s.size(); i++)//[i,mid)
        {
            int max_used_alpha=0;
            for(int j=0;j<26;++j){
                max_used_alpha=std::max(max_used_alpha,imoalpha[j][i+mid]-imoalpha[j][i+mid]);
            }
            if(max_used_alpha*2>mid){
                std::cout<<i+1<<" "<<i+mid<<std::endl;
                return 0;
            }
        }
        r=mid;        
    }
    */
    std::cout<<"-1 -1"<<std::endl;
    return 0;
}

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

char input[100010];

int main()
{
    input[0] = '1';
    int n,k;
    cin >> n >> k;
    cin >> &input[1];

    char *start,*cur;
    start = cur = input;
    int max = 0;

    while(*cur)
    {
        while(*cur && *cur == '1') cur++;
        if(!k) break;
        while(*cur && *cur == '0') cur++;
        k--;
    }
    max = cur - start - 1;
    while(*cur)
    {
        while(*start == '1') start++;
        while(*start == '0') start++;
        while(*cur && *cur == '0') cur++;
        while(*cur && *cur == '1') cur++;
        if (max < cur - start) max = cur - start;
    }

    cout << max << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
ll INF=1LL<<60;
ll MOD=1000000007;

int main(){
    ll N;
    cin >> N;
    ll k=sqrt(2*N)+1;
    if(k*(k-1)!=2*N){cout<<"No"<<endl;return 0;}
    cout<<"Yes"<<endl;
    cout<<k<<endl;
    vector<vector<ll>> S(k, vector<ll>(0));
    ll t=1;
    for(ll i=0;i<k-1;i++){
     for(ll j=i+1;j<k;j++){
         S[i].emplace_back(t);
         S[j].emplace_back(t);
         t++;
     ;}
    ;}
    for(ll i=0;i<k;i++){
        cout<<k-1;
        for(ll j=0;j<S[i].size();j++){
            cout<<" "<<S[i][j]
        ;}
        cout<<endl;
    ;}
    
    return 0;
}


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



int main() {
    long int X;
    cin >> X;
    
    long int m = 100;
    int cnt = 0;
    while (m < X) {
        m = m + m/100;
        cnt++;
    }
    
    cout << cnt << endl;
    
    return 0;
}


Measured memory_bytes: 3640
;;; Utils (quoted from https://competitive12.blogspot.com/2020/03/common-lisp.html)


;; Read fixnum

(declaim (ftype (function * (values fixnum &optional)) read-fixnum))
(defun read-fixnum (&optional (in *standard-input*))
  (declare (inline read-byte)
           #-swank (sb-kernel:ansi-stream in))
  (macrolet ((%read-byte ()
               `(the (unsigned-byte 8)
                     #+swank (char-code (read-char in nil #\Nul))
                     #-swank (read-byte in nil 0))))
    (let* ((minus nil)
           (result (loop (let ((byte (%read-byte)))
                           (cond ((<= 48 byte 57)
                                  (return (- byte 48)))
                                 ((zerop byte) ; #\Nul
                                  (error "Read EOF or #\Nul."))
                                 ((= byte #.(char-code #\-))
                                  (setq minus t)))))))
      (declare ((integer 0 #.most-positive-fixnum) result))
      (loop
        (let* ((byte (%read-byte)))
          (if (<= 48 byte 57)
              (setq result (+ (- byte 48) (the (integer 0 #.(floor most-positive-fixnum 10)) (* result 10))))
              (return (if minus (- result) result))))))))



;; invoke child process

#-swank
(unless (member :child-sbcl *features*)
  (quit
    :unix-status
    (process-exit-code
      (run-program *runtime-pathname*
                   `("--control-stack-size" "128MB"
                     "--noinform" "--disable-ldb" "--lose-on-corruption" "--end-runtime-options"
                     "--eval" "(push :child-sbcl *features*)"
                     "--script" ,(namestring *load-pathname*))
                                                                 :output t :error t :input t))))


;-------------------
; Write code here
;-------------------

(defparameter *inf* (expt 10 7))


;; scores: '((0 . score0) (1 . score1) ...)


(defun solve (n m x cost table)
  (labels ((dp (amount-of-books scores)
             (cond
               ((zerop amount-of-books)
                (if (every (lambda (score) (<= (rest score) 0)) scores)
                    0
                    *inf*))
               (t
                (min (dp (1- amount-of-books) scores)
                     (+ (dp (1- amount-of-books)
                            (mapcar (lambda (score)
                                      (cons (first score)
                                            (- (rest score) (aref table (1- amount-of-books) (first score)))))
                                    scores))
                        (aref cost (1- amount-of-books))))))))
    (let (scores)
      (dotimes (i m)
        (push `(,i . ,x) scores))
      (let ((ans (dp n (reverse scores))))
        (if (= ans *inf*)
            -1
            ans)))))


(defun main ()
  (let* ((n (read))
         (m (read))
         (x (read))
         (cost (make-array n))
         (table (make-array `(,n ,m))))
    (dotimes (i n)
      (setf (aref cost i) (read-fixnum))
      (dotimes (j m)
        (setf (aref table i j) (read-fixnum))))
    (princ (solve n m x cost table))
    (fresh-line)))

(main)


Measured memory_bytes: 27008
//============================================================================
// Name        : AOL.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cctype>
#include <algorithm>
using namespace std;
typedef long long ll;

int main() {


	ll a,b;

	cin>>a>>b;


	cout<<(a+b)/2<<endl;





}

Measured memory_bytes: 3096
def main(str)
  lines = str.split("\n").map { |x| x.split(' ').map(&:to_i) }
  x, _ = lines[0]
  ps = lines[1] || []
  (0..100000).each do |i|
    [x - i, x + i].each do |y|
      return y unless ps.include?(y)
    end
  end
end

unless ENV["TEST"]
  puts(main($stdin.read.chomp))
  exit(0)
end

require 'minitest/autorun'

class TestA < Minitest::Test
  def test_main
    assert_equal(8, main("6 5
4 7 10 6 5"))
    assert_equal(100, main("100 0
"))
  end
end




Measured memory_bytes: 14432
import java.util.Scanner;

public class Main {
    static Scanner sc =new Scanner(System.in);
    public static void main(String[] args) {
        double a = sc.nextInt();
        double b = sc.nextInt();
        double h = sc.nextDouble();
        double m = sc.nextDouble();

        double dig1 = ((h+m/60) / 12.0)  * 2 * Math.PI;
        double dig2 = m / 60.0 * 2 * Math.PI;
        double cos = Math.cos(Math.abs(dig1-dig2));


        System.out.println(
                Math.sqrt(a*a + b* b  - 2 * a *b *cos)
        );

    }
}

Measured memory_bytes: 37404
#include<bits/stdc++.h>
using namespace std;
int n,m;
char s[300][300];
int main()
{
	scanf("%d%d",&n,&m);
	getchar();
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=m;j++)
		s[i][j]=getchar();
		getchar();
	}
	for(int i=1;i<=2*n;i++)
	{
		for(int j=1;j<=m;j++)
		{
			cout<<s[(i+1)/2][j];
		}
		cout<<endl;
	}
	return 0;
}

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

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

  int count = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == b[i] && a[i] == c[i] && b[i] == c[i]) {
    } else if (a[i] == b[i] || a[i] == c[i] || b[i] == c[i]) {
      count += 1;
    } else {
      count += 2;
    }
  }

  cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
    using namespace std;
    typedef long long ll;
    typedef vector<int> vi;
    typedef vector<long long> vll;
    typedef vector<pair<int , int>> vpii;
    typedef pair<int , int> pii;
    typedef pair<long long  , long long> pll;
    typedef pair<double , double> pdd;
    #define eb emplace_back;
    #define mp make_pair;
     
    int main(){
        int n;
        cin>>n;
        ll sum = 0;
        for(int i = 1 ; i<=n ; i++){
            for(int j = 1 ; j<=n ; j++){
                for(int k = 1 ; k<=n ; k++){
                    sum+= __gcd(__gcd(i,j) , k);
                }
            }
        }
        cout<<sum;
        return 0;
    }

Measured memory_bytes: 3632
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
pdiff=[]
ndiff=[]
asum=0
bsum=0
cnt=0
for i in range(n):
  asum+=a[i]
  bsum+=b[i]
  if a[i]-b[i]>=0:
    pdiff.append(a[i]-b[i])
  else:
    ndiff.append(b[i]-a[i])
    cnt+=1
pdiff=sorted(pdiff,reverse=True)
if bsum>asum:
  print(-1)
else:
  psum=0
  nsum=sum(ndiff)
  ppos=0
  npos=0
  l=len(ndiff)
  while psum<nsum:
    psum+=pdiff[ppos]
    ppos+=1
  print(cnt+ppos)

Measured memory_bytes: 18932
A, B, K = map(int, input().split())
ans = []
for i in range(A, min(A+K, B+1)):
    ans += [i]
for i in range(max(A, B-K+1), B+1):
    ans += [i]

ans = list(set(ans))
ans = sorted(ans)
for a in ans:
    print(a)

Measured memory_bytes: 38256
//https://onlinejudge.u-aizu.ac.jp/challenges/sources/JOI/Prelim/0621?year=2016

#include <bits/stdc++.h>

using namespace std;

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

    int cnt[n][3]; //白=0,青=1,赤=2として行毎に色の個数を数える
    memset(cnt, 0, sizeof(cnt));

    map<char, int> mp;
    mp['W'] = 0;
    mp['B'] = 1;
    mp['R'] = 2;

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            char c;
            cin >> c;
            cnt[i][mp[c]]++;
        }
    }

    // 白，青，赤が順にx,y,n-x-y行あるとする
    int ans = 3000;
    for (int x = 1; x <= n - 2; ++x) {
        for (int y = 1; x + y <= n - 1; ++y) {
            int tmp = 0;
            for (int k = 0; k < x; ++k) {
                tmp += m - cnt[k][0];
            }
            for (int k = x; k < x + y; ++k) {
                tmp += m - cnt[k][1];
            }
            for (int k = x + y; k < n; ++k) {
                tmp += m - cnt[k][2];
            }
            ans = min(ans, tmp);
        }
    }

    cout << ans << endl;
    return 0;
}

/*
 * 全検索
 */


Measured memory_bytes: 3072
from collections import Counter
n=int(input())
list1=[input() for i in range(n)]

counter=Counter(list1)
m=max(counter.values())

ans=[]
for word,c in counter.most_common():
    if c==m:
        ans.append(word)
    else:
        break

for i in sorted(ans):
    print(i)

Measured memory_bytes: 120016
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define quick                    \
    ios::sync_with_stdio(false); \
    cin.tie(0);
#define time cerr << (0.1 * clock()) / CLOCKS_PER_SEC << endl;
#define mod 1000000007
typedef long long ll;
typedef pair<ll, ll> pl;
#define forn(n) for (ll i = 0; i < ll(n); i++)

void solve() {
    ll n;
    cin >> n;
    vector<ll> v(n);
    vector<int> count(1e5 + 5);
    ll sum = 0;
    forn(n) {
        cin >> v[i];
        count[v[i]]++;
        sum += v[i];
    }
    int q;
    cin >> q;
    while (q--) {
        ll b, c;
        cin >> b >> c;
        ll co = count[b];
        count[b] -= co;
        sum -= (co * b);
        sum += (co * c);
        count[c] += co;
        cout << sum << '\n';
    }
}

int main() {
    quick;
    solve();
    // ll t;
    // cin >> t;
    // while (t--) {
    //     solve();
    // }
}

Measured memory_bytes: 4500
import sys
input = sys.stdin.buffer.readline

#sys.setrecursionlimit(10**9)
#from functools import lru_cache

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int,input().split()))
def LF(): return list(map(float,input().split()))
def TI(): return tuple(map(int,input().split()))
# rstrip().decode()

def main():
	n,k=MI()

	kk=(n-1)*(n-2)//2-k

	if kk<0:
		print(-1)
		exit()

	ans=[]
	#print(kk)
	for i in range(1,n):
		ans.append([i,n])
	#print(ans)

	for i in range(1,n):
		for j in range(i+1,n):
			if kk>0:
				kk-=1
				ans.append([i,j])

	print(len(ans))
	for i,j in ans:
		print(i,j)













if __name__ == "__main__":
	main()


Measured memory_bytes: 75120
import java.util.Scanner;
public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int count = 0;
        int flg = 0;
        int n = sc.nextInt();  
        int a[] = new int[n];  
        for(int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
        }
        boolean sw = true;
        while(sw == true){
	    for(int i = 0; i < n; i++){
			if(a[i]%2==0) {
			flg++;
			a[i] = a[i] / 2;
			}
			}
			if(flg==n){
				count++;
				flg = 0;
			} 
			else
			{
			sw = false;
			break;
			}
		}
        System.out.println(count);
    }
}

Measured memory_bytes: 23124
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextStr() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt64() int64 {
	i, _ := strconv.ParseInt(nextStr(), 10, 64)
	return i
}

func absInt64(x int64) int64 {
	if x < 0 {
		x = -x
	}
	return x
}

func minInt64(x, y int64) int64 {
	if x > y {
		return y
	}
	return x
}

func main() {
	scanner.Split(bufio.ScanWords)
	x := nextInt64()
	k := nextInt64()
	d := nextInt64()

	var ans int64

	abs_x := absInt64(x)

	counts := abs_x / d
	if counts > k {
		ans = abs_x - k*d
	} else {
		if (k-counts)%2 == 0 {
			// 残り回数が偶数
			ans = abs_x % d
		} else {
			// 残り回数が奇数
			ans = minInt64(absInt64(abs_x%d+d), absInt64(abs_x%d-d))
		}
	}
	fmt.Println(ans)
}


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

int main(){
  string S;
  cin >> S;
  if (S.at(0) != S.at(1) || S.at(1) != S.at(2) || S.at(2) != S.at(0)) {
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int price, receive, m;
    cin >> price;
    if (price % 1000 == 0)
        receive = 0;
    else{
        m = price / 1000;
        receive = (m + 1) * 1000 - price;
    }
    cout << receive;
    system("pause");
    return 0;
}

Measured memory_bytes: 3664
"""
    こんにちは。これはクシャルです
    
    Author : thekushalghosh (クシャル)
    Team   : CodeDiggers
 
    I prefer Python language over the C++ language :p :D
        
    Visit my website : thekushalghosh.github.io
"""
import sys,math,cmath,time,itertools
start_time = time.time()
##########################################################################
################# ---- THE ACTUAL CODE STARTS BELOW ---- #################

def solve():
    n = inp()
    a = inlt()
    c = 0
    for i in range(n):
        if i % 2 == 0 and a[i] % 2 != 0:
            c = c + 1
    print(c)
    
################## ---- THE ACTUAL CODE ENDS ABOVE ---- ##################
##########################################################################
 
def main():
    global tt
    if not ONLINE_JUDGE:
        sys.stdin = open("input.txt","r")
        sys.stdout = open("output.txt","w")
    t = 1
    for tt in range(t):
        solve()
    if not ONLINE_JUDGE:
        print("Time Elapsed :",time.time() - start_time,"seconds")
        sys.stdout.close()
    
#---------------------- USER DEFINED INPUT FUNCTIONS ----------------------#
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    return(input().strip())
def invr():
    return(map(int,input().split()))
 
#------------------ USER DEFINED PROGRAMMING FUNCTIONS ------------------#
def counter(a):
    q = [0] * max(a)
    for i in range(len(a)):
        q[a[i] - 1] = q[a[i] - 1] + 1
    return(q)

def counter_elements(a):
    q = dict()
    for i in range(len(a)):
        if a[i] not in q:
            q[a[i]] = 0
        q[a[i]] = q[a[i]] + 1
    return(q)

def string_counter(a):
    q = [0] * 26
    for i in range(len(a)):
        q[ord(a[i]) - 97] = q[ord(a[i]) - 97],1
    return(q)
 
def factors(n):
    q = []
    for i in range(1,int(n ** 0.5) + 1):
        if n % i == 0: q.append(i); q.append(n // i)
    return(list(sorted(list(set(q)))))
 
def prime_factors(n):
    q = []
    while n % 2 == 0: q.append(2); n = n // 2
    for i in range(3,int(n ** 0.5) + 1,2):
        while n % i == 0: q.append(i); n = n // i
    if n > 2: q.append(n)
    return(list(sorted(q)))

def transpose(a):
    n,m = len(a),len(a[0])
    b = [[0] * n for i in range(m)]
    for i in range(m): 
        for j in range(n): 
            b[i][j] = a[j][i]
    return(b)

#-----------------------------------------------------------------------#
        
ONLINE_JUDGE = __debug__
if ONLINE_JUDGE:
    input = sys.stdin.readline
    
    
main()

Measured memory_bytes: 62836
#include<bits/stdc++.h>
#define pi 3.1415
#define ll long long
#define pii pair<int,int>
#define debug(a) cout<<a<<'\n'
#define maxn 200009
#define MOD 200009
#define inp freopen("input.txt", "r", stdin)
#define out freopen("out.txt", "w", stdout)
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    int n,d;
    cin>>n>>d;
    cout<<((n+2*d)/(2*d+1))<<endl;
    return 0;
}   


Measured memory_bytes: 384
# E - League
import sys
from collections import deque
from typing import Deque, List

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    N = int(readline())
    A: List[Deque[int]] = [deque()] + [
        deque(map(int, line.split())) for line in readlines()
    ]
    matched_games_cnt = 0
    next_opponent, last_games_day = [0] * (N + 1), [0] * (N + 1)
    queue = deque(range(1, N + 1))
    while queue:
        player = queue.popleft()
        if not A[player]:  # The player has finished all games.
            continue
        opponent = A[player].popleft()

        # The opponent will have another game before playing against x.
        if next_opponent[opponent] != player:
            next_opponent[player] = opponent
            continue

        # The opponent's next game is against the player and vice versa.
        matched_games_cnt += 1
        last_games_day[player] = last_games_day[opponent] = (
            max(last_games_day[player], last_games_day[opponent]) + 1
        )
        # No next game is currently planned.
        next_opponent[player] = next_opponent[opponent] = 0
        queue.append(player), queue.append(opponent)

    print(max(last_games_day) if matched_games_cnt == N * (N - 1) // 2 else -1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 46164
import sys

INF = 10**60

inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inm())
instr = lambda: sys.stdin.readline()
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()

min_sum = INF

i = 0
j = 0

for k in range(1,n):
    if k > n**0.5:
        break
    if n/k % 1 != 0:
        continue
    i = k
    j = n/k
    if i+j < min_sum:
        min_sum = i+j

print(int(min_sum - 2))


Measured memory_bytes: 65196
#include <stdio.h>

int main() {
	char str[20], newStr[20] = {};
	scanf("%s", str);
	int j = 0;
	
	for(int i = 0; str[i] != '\0'; i++) {
		if(str[i] == '1') {
			newStr[j] = '1';
			j++;
		} else if(str[i] == '0') {
			newStr[j] = '0';
			j++;
		} else if(j != 0) {
			if(str[i] == 'B') {
				newStr[j - 1] = '\0';
				j -= 2;
			}
			j++;
		}
	}
	newStr[j] = '\0';
	printf("%s", newStr);
	
	return 0;
}

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

int main() {
	int n, T;
	int t1, t;
	int ans = 0;
	cin >> n >> T;
	cin >> t1;
	int old_t;
	for (int i = 1; i < n; i++) {
		old_t = t1;
		cin >> t1;
		t = t1 - old_t;
		ans += min(t, T);
	}
	ans += T;
	cout << ans << endl;
	return 0;
}

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

int a[N],b[N],n,m,cnt,t;

inline int rd() {
	int x=0,f=1;char ch=getchar();
	while (ch>'9'||ch<'0') {if(ch=='-')f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}
	return x*f;
}

int main() {
	n = rd(), m = rd();
	for (int _=1;_<=m;_++) a[_] = rd();
	sort(a+1,a+m+1, greater<int>() );
	
	if (m==1) {
		
		if (n==1) {printf("1\n1\n1\n"); return 0;}
		
		printf("%d\n",a[1]);
		printf("2\n");
		printf("%d %d\n",a[1]-1,1);
		return 0;
	}
	
	for (int _=1;_<=m;_++) (a[_]&1) ? ++cnt : 0;
	if (cnt > 2) return puts("Impossible"), 0;
	for (int _=2;_<=m-1;_++)
		if (a[_]&1) (a[1]&1) ? swap(a[_],a[m]) : swap(a[_],a[1]);
	for (int _=1;_<=m;_++) printf("%d%c",a[_],_==m?'\n':' ');
	(a[1]==1) ? (t=2) : (t=1);
	printf("%d\n",m-t+1);
	memcpy(b,a,sizeof(a));
	b[1]--, b[m]++;
	for (int _=t;_<=m;_++) printf("%d%c",b[_],_==m?'\n':' ');
	return 0;
}


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

int main(){
	int N;
	string board;
	string str;
	bool make, imp;
	int pt, res;
	
	cin >> N;
	cin >> board;
	
	res = 0;
	for(int i = 0; i < N; i++){
		cin >> str;
		make = false;
		for(int p = 0; p < str.size(); p++){
			if(str[p] == board[0]){
				for(int sh = 1; sh * (board.size() - 1) + p < str.size(); sh++){
					pt = 1;
					for(int q = p + sh; ; q += sh){
						if(str[q] != board[pt]) break;
						pt++;
						if(pt == board.size()){
							res++;
							make = true;
							break;
						}
					}
					if(make) break;
				}
			}
			if(make) break;
		}
	}
	
	cout << res << endl;
	
	return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iomanip>
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i,a,b) for(int i=(a); i<(b); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const ll INFLL = 100100100100100100;
const int MOD = (int)1e9 + 7;
const ll MODLL = (ll)1e9 + 7;
const double EPS = 1e-9;
 
int main () {

    string s; cin >>s;

    if(s[0] == s[1] && s[1] == s[2]) {
        cout << "Yes" << endl;
    } else if (s[1] == s[2] && s[3] == s[2]) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    } 

    return 0;
}


Measured memory_bytes: 256
# 定数
INF = 10e3

include Math
# 2D平面の点の構造体
P = Struct.new(:x,:y)

# 入力
N = gets.to_i
red = []
blue = []
a = []
b = []
N.times do |i|
  a[i], b[i] = gets.split.map(&:to_i)
  red[i] = P.new(a[i], b[i])
end
c = []
d = []
N.times do |i|
  c[i], d[i] = gets.split.map(&:to_i)
  blue[i] = P.new(c[i], d[i])
end

# 赤点をy座標で降順ソート
red = red.sort{
  |p1,p2| p2.y <=> p1.y
}

partner = {}
# redの各点をy座標の降順で見ていく
red.each do |r|
  pair_di = INF
  blue.each do |b|
    # ペアの条件を満たすならば
    if r.x < b.x && r.y < b.y
      # x座標が最小のbをマッチさせる
      if b.x < pair_di
        pair_di = b.x
        partner[r] = b
      end
    end
  end
  # puts "#{r} #{partner[r]}"
  if partner[r] != nil
    blue.delete_at(blue.find_index(partner[r]))
  end
end

# puts "#{partner}"
puts partner.size

Measured memory_bytes: 3836
#include <bits/stdc++.h>
#include <cstdlib>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Graph= vector<vector<int>>; 
#define rep(i,n) for (ll i=0; i < (n); ++i)
#define rep2(i,n,m) for(ll i=n;i<=m;i++)
#define rep3(i,n,m) for(ll i=n;i>=m;i--)
#define pb push_back
#define eb emplace_back
#define ppb pop_back
#define mpa make_pair
#define fi first
#define se second 
#define set20 cout<<fixed<<setprecision(20) ;
const ll INF=1e18 ;
inline void chmax(ll& a,ll b){a=max(a,b);}
inline void chmin(ll& a,ll b){a=min(a,b);}
double pi=acos(-1) ;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int main(){
 ll n ,x, y ; cin>>n>>x>>y ;
 x-- ; y-- ;
 vector<ll> d(n-1) ; rep(i,n-1) d[i]= 0;
 rep(i,n-1){
     rep2(j,i+1,n-1){
         ll c= abs(i-j) ; ll r= abs( i-x) + abs(j-y) + 1 ;
         ll p= min(c,r )-1 ;
         d[p]++ ;
     }
 }
 rep(i,n-1){
     cout<< d[i]<<endl ;
 }
 return 0 ; 
}



Measured memory_bytes: 3608
#define DEBUG 0

/**
 * File    : C.cpp
 * Author  : Kazune Takahashi
 * Created : 6/9/2019, 9:04:45 PM
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <random>
#include <chrono>
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

typedef long long ll;

/*
void Yes()
{
  cout << "Yes" << endl;
  exit(0);
}

void No()
{
  cout << "No" << endl;
  exit(0);
}
*/

/*
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
*/

const ll MOD = 1000000007;

int N, M;
bool ok[100010];
ll dp[100010];

int main()
{
  cin >> N >> M;
  fill(ok, ok + 100010, true);
  for (auto i = 0; i < M; i++)
  {
    int a;
    cin >> a;
    ok[a] = false;
  }
  dp[0] = 1;
  for (auto i = 0; i < N; i++)
  {
    if (ok[i + 1])
    {
      dp[i + 1] += dp[i];
      dp[i + 1] %= MOD;
    }
    if (ok[i + 2])
    {
      dp[i + 2] += dp[i];
      dp[i + 2] %= MOD;
    }
  }
  cout << dp[N] << endl;
}

Measured memory_bytes: 1152
// Etavioxy
#include<cstdio>
#include<cctype>
#include<cstring>
#include<algorithm>
#include<cmath>
#define il inline
#define ll long long
#define rep(i,s,t) for(register int i=(s);i<=(t);i++)
#define rev_rep(i,s,t) for(register int i=(s);i>=(t);i--)
#define each(i,u) for(int i=head[u];i;i=bow[i].nxt)
#define file(s) freopen(s".in" ,"r",stdin),freopen(s".out","w",stdout)
#define pt(x) putchar(x)
using namespace std;
il int ci(){
	register char ch;int f=1;
	while(!isdigit(ch=getchar()))f=ch=='-'?-1:1;
	register int x=ch^'0';
	while(isdigit(ch=getchar()))x=(x*10)+(ch^'0');
	return f*x;
}

int main(){
	printf("%c\n",getchar()+1);
	return 0;
}


Measured memory_bytes: 128
N = int(input())
D, X = map(int, input().split()) #D:Day X:あまり
A = []
for i in range(N):
  A.append(int(input()))
c = 0
n = 0
s = 0
for a in A:
  n = (D-1)//a + 1
  #print(n)
  s += n
  #print((n+1)*(2+a*n)//2)
print(X+s)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
 
  // ここにプログラムを追記
  string arare;
  bool isThree = true;
  for(int i = 0; i < N; i++){
    cin >> arare;
	if (arare == "Y") {
      cout << "Four" << endl;
      isThree = false;
      break;
    }
  }
  if (isThree)
    cout << "Three" << endl;
}

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

using namespace std;

int main()
{
	string g[13];
	int x,y;
	g[1]="A";
	g[2]="C";
	g[3]="A";
	g[4]="B";
	g[5]="A";
	g[6]="B";
	g[7]="A";
	g[8]="A";
	g[9]="B";
	g[10]="A";
	g[11]="B";
	g[12]="A";
	cin>>x>>y;
	if(g[x]==g[y])
	{
		cout<<"Yes"<<endl;
	}else{
		cout<<"No"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
//#include <iomanip>
#include <string>
#include <vector>
//#include <algorithm>
//#include <utility>
//#include <set>
//#include <map>
//#include <queue>
//#include <deque>
//#include <bitset>
//#include <math.h>
using namespace std ;
using ll = long long ;
//using ld = long double ;
using vll = vector<ll> ;
//using vvll = vector<vll> ;
//using vc = vector<char> ;
//using vvc = vector<vc> ;
//using vb = vector<bool> ;
//using vvb = vector<vb> ;
//using pll = pair<ll,ll> ;
//#define all(v) v.begin(),v.end()
//ll mod = 1000000007 ;
//long double pie = acos(-1) ;
//ll INF = 1000000000000 ;

//void yorn(bool a){if(a) cout << "Yes" << endl ; else cout << "No" << endl ;}
//void YorN(bool a){if(a) cout << "YES" << endl ; else cout << "NO" << endl ;}
//ll gcd(long long a,long long b){if(b==0) return a ; return gcd(b,a%b) ;}
//ll lcm(long long a,long long b){return a/gcd(a,b)*b ;}
//ll sa(long long a,long long b){if(a>b) return a-b ; return b-a ;}
//void mysort(vector<long long> &a){sort(a.begin(),a.end()) ;}
//void myrev(vector<long long> &a){reverse(a.begin(),a.end()) ;}
//void fix_cout(){cout << fixed << setprecision(20) ;}

int main(){
	ll n ; cin >> n ;
	string s ; cin >> s ;
	vll r(n+1,0),g(n+1,0),b(n+1,0) ;
	for(int i=0;i<n;i++){
		r.at(i+1) = r.at(i)+(s.at(i)=='R') ;
		g.at(i+1) = g.at(i)+(s.at(i)=='G') ;
		b.at(i+1) = b.at(i)+(s.at(i)=='B') ;
	}
	ll ans = 0 ;
	for(int i=0;i<n-2;i++){
		for(int j=i+1;j<n-1;j++){
			if(s.at(i)==s.at(j)) continue ;
			if(s.at(i)!='B'&&s.at(j)!='B'){
				ans += b.at(n)-b.at(j+1) ;
				if(j+j-i<n) ans -= (s.at(j+j-i)=='B') ;
			}
			if(s.at(i)!='G'&&s.at(j)!='G'){
				ans += g.at(n)-g.at(j+1) ;
				if(j+j-i<n) ans -= (s.at(j+j-i)=='G') ;
			}
			if(s.at(i)!='R'&&s.at(j)!='R'){
				ans += r.at(n)-r.at(j+1) ;
				if(j+j-i<n) ans -= (s.at(j+j-i)=='R') ;
			}
		}
	}
	cout << ans << endl ;
}


Measured memory_bytes: 3692
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <string>
#include <iostream>
#include <vector>
#include <climits>
#include <algorithm>
#include <cmath>

using namespace std;

void SolveA()
{
	int a, b;
	scanf("%d %d", &a, &b);

	int x = ceil((a + b) / 2.0);
	printf("%d\n", x);
}

void SolveB()
{
	//string s, t;
	//cin >> s;
	//cin >> t;

	//sort(s.begin(), s.end());
	//sort(t.begin(), t.end());

	//int lengthS = s.length();
	//int lengthT = t.length();
	//const char *charS = s.c_str();
	//const char *charT = t.c_str();

	//int loop = min(lengthS, lengthT);

	//for (int i = 0; i < loop; i++)
	//{

	//}

	string s, t;
	cin >> s;	// s
	cin >> t;	// t

	sort(s.begin(), s.end());	// sの中身を昇順ソート
	sort(t.rbegin(), t.rend());	// tの中身を降順ソート

	if (s < t)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
}

int main()
{
	//SolveA();
	SolveB();
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int A,B;
    cin >>A>>B;
    if(A==1) A=14;
    if(B==1) B=14;
    if(A==B) cout <<"Draw" << endl;
    else if(A>B) cout << "Alice" <<endl;
    else cout << "Bob"<<endl;



}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cassert>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
#include <queue>
#include <type_traits>
#include <fstream>
//#include <bits/stdc++.h>

typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// print(x, y, z);
// printVec(va.begin(), va.end());
void print(){ std::cout << std::endl; }
template <typename Head> void print(Head&& head) { std::cout << head << std::endl; }
template <typename Head, typename... Tail> void print(Head&& head, Tail&&... tail)
{
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...); // or print(tail...);
}
template<typename Iterator> void printVec(Iterator begin, Iterator end)
{
  for (Iterator it = begin; it != end; it++) {
    std::cout << "[" << it - begin << "] " << *it << " ";
    if ((it - begin) % 20 == 19 || it == end - 1) { std::cout << std::endl; }
  }
}
template<typename Iterator> void printVecPair(Iterator begin, Iterator end)
{
  for (Iterator it = begin; it != end; it++) {
    std::cout << "[" << it - begin << "] " << it->first << " " << it->second << " ";
    if ((it - begin) % 10 == 9 || it == end - 1) std::cout << std::endl;
  }
}

template<typename T> T bitnum(T x)
{
  T cnt = 1;
  T ret = 0;
  while (x > 0) {
    ret += (x % 2) * cnt;
    x /= 2;
    cnt *= 10;
  }
  return ret;
}

template<typename T> T lminimum(const std::vector< T >& v) {return *std::min_element(v.begin(), v.end());}
template<typename T> T lmaximum(const std::vector< T >& v) {return *std::max_element(v.begin(), v.end());}
template<typename T> void lunique(std::vector< T >& v) {v.erase(std::unique(v.begin(), v.end()), v.end());}
template<typename T> void lsort(std::vector< T >& v) {std::sort(v.begin(), v.end());}
template<typename T> void lgreatersort(std::vector< T >& v) {std::sort(v.begin(), v.end(), std::greater<>());}
template<typename T> bool lnext_permutation(std::vector< T >& v) {return std::next_permutation(v.begin(), v.end());}

int main(int argc, char* argv[])
{
  ll N;
  std::cin >> N;
  std::vector< long double > vx(N, 0LL);
  std::vector< std::string > vs(N, "");

  long double sum = 0.0;
  for (ll i = 0; i < N; i++) {
    std::cin >> vx[i] >> vs[i];
    if (vs[i] == "BTC") {
      sum += 380000.0 * vx[i];
    } else {
      sum += vx[i];
    }
  }
  printf("%.6Lf\n", sum);

  return 0;
}


Measured memory_bytes: 384
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {
    int N, K;
    cin >> N >> K;
    double result = 0;
    for (int i = 1; i <= N; i++) {
        if (i >= K) {
            result += (double)1.0 / N;
        } else {
            result += (double)1.0 / pow(2, ceil(log2((double)K / i))) / N;
            
        }
    }
    cout << setprecision(14) << result << endl;
    return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
using namespace std;
int main(){
    int n, m;
    scanf("%d %d", &n, &m);
    int ans = 0;
    if(n >= 2){
        ans += (n * (n - 1) / 2);
    }
    if(m >= 2) ans += (m * (m - 1) / 2);
    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e11;
const long double PI = (acos(-1));


signed main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	int turn = 0;
	while (1) {
		if (A <= 0) {
			cout << "No";
			return 0;
		}
		if (C <= 0) {
			cout << "Yes";
			return 0;
		}
		if (turn == 0) {
			C -= B;
			turn = 1;
		}
		else {
			A -= D;
			turn = 0;
		}
	}
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int N,M;
  cin>>N>>M;
  vector<int> k(N);
  vector<vector<int>> v(N, vector<int>(M));
  rep(i,N){
    cin>>k[i];
    rep(j,k[i]) cin>>v[i][j];
  }
  int ans=0;
  rep(i,M){//M種類につき、何人が好きか
    int sum=0;
    rep(j,N){
      rep(k,M){
        if(v[j][k]==i+1) sum++;
      }
    }
    if(sum==N) ans++;
  }
  cout<<ans<<endl;
  return 0;
}

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

using namespace std;

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


	if (s == "Sunny")
	{
		cout << "Cloudy" << endl;
	}
	else if( s == "Cloudy")
	{
		cout << "Rainy" << endl;
	}
	else if (s == "Rainy")
	{
		cout << "Sunny" << endl;
	}
}

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

int main() {
  ll x;
  cin >> x;

  ll ans = 0;
  ll num = x / 11 + 1;
  if (x % 11 == 0) num--;
  if (num * 6 + (num - 1) * 5 >= x) {
    ans = num * 2 - 1;
  } else {
    ans = num * 2;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3584
n=int(input())
a=list(map(int,input().split()))

odd=0
even=0

for aa in a:
    if aa%2==0:
        even+=1
    else:
        odd+=1

#odd+odd=even
#even+even=even

#もし奇数がペアが作れない場合,NO
if odd%2==1 and even>0:
    print("NO")
else:
    print("YES")


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

int main(int argc, const char * argv[]) {
    // insert code here...
    int N, K, X, Y;
    cin >> N >> K >> X >> Y;
    
    int total = 0;
    for (int i = 1; i <= N; i++) {
        if (i <= K) total += X;
        else total += Y;
    }
    
    cout << total << endl;
    
    return 0;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)
N,M=map(int,input().split())

class union_find():

    def __init__(self,n):
        self.n = n
        self.root = [-1]*n
        self.rank = [0]*n

    def find_root(self,x):
        if self.root[x]<0:
            return x
        else:
            self.root[x]=self.find_root(self.root[x])
            return self.root[x]

    def unite(self,x,y):
        x = self.find_root(x)
        y = self.find_root(y)
        if x==y:
            return
        elif self.rank[x]>self.rank[y]:
            self.root[x]+=self.root[y]
            self.root[y]=x
        else:
            self.root[y]+=self.root[x]
            self.root[x]=y
            if self.rank[x]==self.rank[y]:
                self.rank[y]+=1

    def same(self,x,y):
        x = self.find_root(x)
        y = self.find_root(y)
        if x==y:
            return True
        else:
            return False

    def count(self,x):
        return -self.root[self.find_root(x)]

G = union_find(N)
for i in range(M):
    a,b=map(int,input().split())
    a-=1
    b-=1
    G.unite(a,b)

ans = 0
for i in range(N):
    tmp = G.count(i)
    ans = max(ans,tmp)

print(ans)

Measured memory_bytes: 81240
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int n;
  cin >> n;
  cout << n*(n+1)/2 << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<stdlib.h>
#include<iostream>
#include<math.h>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long
#define INF 2000000000
#define Min(a,b) (a<b?a:b)
#define Max(a,b) (a>b?a:b)
#define PI 3.1415926535897932
using namespace std;




int main()
{
IOS;
int n;
cin>>n;
int count=0;
while(n--){
	int a,b;
	cin>>a>>b;
	
	if(a==b){
		count++;
		if(count==3){
			cout<<"Yes"<<endl;
			goto abc;
		}
	}
	else{
		count=0;
	}


}
cout<<"No"<<endl;
abc:
;

return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
long long INF = (long long)1E17;
#define i_7 (long long)(1E9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}

//typedef long long ll;
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}

//配列のSIZEは問題ごとに定義する必要がある。
const int SIZE = 500010;
long long inv[SIZE+1];//各iの逆元を格納する配列。
long long kai[SIZE+1];//i!のmodを格納する配列。
long long invkai[SIZE+1];//各i!の逆元を格納する配列。
const int MOD=i_7;
void invinit(){//上の配列を初期化する関数。
    inv[1]=1;
    for(int i=2;i<=SIZE;i++){
        inv[i] = MOD - ((MOD/i)*inv[MOD%i])%MOD;
    }
    
    kai[0]=invkai[0]=1;
    for(int i=1;i<=SIZE;i++){
        kai[i]=(kai[i-1]*i)%MOD;
        invkai[i]=(invkai[i-1]*inv[i])%MOD;
    }
}

long long comb(long long a, long long b){
    if(b<0 || a<b){
        return 0;
    }
    return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
}

int main(){
  invinit();
  using namespace std;
  long long n, m;
  cin>>n>>m;
  long long all_cases = po(mod(comb(m, n) * kai[n]), 2);
  long long negate = 0;
  for(long long k = 1; k <= n; k++){
    long long temp = mod(comb(m, k) * kai[k]);
    temp *= po(mod(comb(m - k, n - k) * kai[n - k]), 2);
    temp = mod(temp);
    temp *= comb(n, k);
    temp = mod(temp);
    if(k % 2){
      negate += temp;
    }else{
      negate -= temp;
    }
    negate = mod(negate);
  }
  long long ans = mod(all_cases - negate);
  cout << ans << endl;
  return 0;
}

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

using namespace std;
using ll = long long;

int main() {
	ll a;
	string b;
	string strb;
	ll bb;
	ll ans;
	cin >> a >> b;
	for (int i = 0,j = 0; i<b.size();i++) {
		if (b.at(i) != '.') {
			strb.push_back(b.at(i));
		}
	}
	bb = atoi(strb.c_str());
	ans = a*bb;
	ans /= 100;
	cout << ans << endl;
	return 0;
}


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

int main(){
  int N;
  cin>>N;
  //1番目の数を見て、それよりも小さい数はいくつあるかを判定する
  vector<int> vec(N);
  for(int i = 0;i<N;i++) cin>>vec.at(i);
  
  int ans = 0;
  int a=0;
  a=vec.at(0);
  for(int i=0;i<N;i++){
    if(a>=vec.at(i)){
    a=vec.at(i);
    ans++;
    }
  }

  cout<<ans<<endl;
}



Measured memory_bytes: 1024
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<string>
using namespace std;

int h[100100];
vector<int> G[100100];
bool used[100100];

bool flag;
int Max;


int main(void){
        int i,j,s,t;
        int n,m;
        int ans = 0;


        scanf("%d%d",&n,&m);
        for(i=1;i<=n;i++){
                scanf("%d",&h[i]);
        }
        for(i=0;i<m;i++){
                scanf("%d%d",&s,&t);
                G[s].push_back(t);
                G[t].push_back(s);
        }
        
        for(i=1;i<=n;i++){
                flag = true;
                for(auto it = G[i].begin(); it != G[i].end(); ++it){
                        if(h[*it]>=h[i]){
                                flag = false;
                        }
                }
                if(flag){
                        ans++;
                }
        }
        printf("%d\n",ans);

        return 0;
}


Measured memory_bytes: 9400
import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		long[] T = new long[N];
		for (int i = 0; i < T.length; i++) {
			T[i] = in.nextLong();
		}
		long ans = T[0];
		for (int i = 1; i < T.length; i++) {
			ans = lcm(ans, T[i]);
		}
		System.out.println(ans);
		in.close();
	}

	static long gcd(long m, long n) {
		if (m < n) {
			long tmp = n;
			n = m;
			m = tmp;
		}
		if (n == 0) {
			return m;
		}
		long temp;
		while (m % n != 0) {
			temp = n;
			n = m % n;
			m = temp;
		}
		return n;
	}

	static long lcm(long m, long n) {
		BigInteger a = new BigInteger(String.valueOf(m)).multiply(new BigInteger(String.valueOf(n)))
				.divide(new BigInteger(String.valueOf(gcd(m, n))));
		return a.longValue();
	}
}

Measured memory_bytes: 22100
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

int main(void){
	while(true){
		int n, x;
		cin >> n >> x;
		if(n == 0 && x == 0){
			break;
		}
		int ans = 0;
		for(int i = 1;i <= n; ++i){
			for(int j = i+1;j <= n; ++j){
				for(int k = j+1;k <= n; ++k){
					if(i+j+k == x){
						++ans;
					}
				}
			}
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <bitset>
using namespace std;

const int MAX_ROW = 1005;
const int MAX_COL = 1005;

struct BitMatrix {
    int H, W;
    bitset<MAX_COL> val[MAX_ROW];
    BitMatrix(int n = 1, int m = 1) : H(n), W(m) {}
    inline bitset<MAX_COL> &operator[] (int i) { return val[i]; }
};

// O(HW)
int gauss_jordan(BitMatrix &A, bool extended = false) {
    int rank = 0;
    for (int col = 0; col < A.W; col++) {
        if (extended && col == A.W - 1) break;
        int pivot = -1;
        for (int row = rank; row < A.H; row++) {
            if (A[row][col]) {
                pivot = row;
                break;
            }
        }
        if (pivot == -1) continue;
        swap(A[rank], A[pivot]);
        for (int row = 0; row < A.H; row++) {
            if (row != rank && A[row][col]) A[row] ^= A[rank];
        }
        ++rank;
    }
    return rank;
}

int linear_equation(BitMatrix &A, vector<int> const &b, vector<int> &ans) {
    int n = A.H;
    int m = A.W;
    BitMatrix M(n, m+1);
    for (int i = 0; i < n; i++) {
        M[i] = A[i];
        M[i][m] = b[i];
    }
    int rank = gauss_jordan(M, true);

    ans.resize(0);
    for (int i = rank; i < n; i++) if (M[i][m]) return rank;
    ans.resize(n, 0);
    for (int i = 0; i < rank; i++) ans[i] = M[i][m];
    return rank;
}

// Aizu1308 - Awkward Lights
bool solve() {
    int M, N, D;
    cin >> M >> N >> D;
    if (!(M || N || D)) return false;
    vector<int> b(M*N);
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            int a;
            cin >> a;
            b[i * M + j] = a;
        }
    }
    BitMatrix A(N*M, N*M);
    for (int r1 = 0; r1 < N; r1++) {
        for (int c1 = 0; c1 < M; c1++) {
            for (int r2 = 0; r2 < N; r2++) {
                for (int c2 = 0; c2 < M; c2++) {
                    int dis = abs(r1 - r2) + abs(c1 - c2);
                    if (dis == 0 || dis == D) A[r1 * M + c1][r2 * M + c2] = true;
                }
            }
        }
    }
    vector<int> ans;
    linear_equation(A, b, ans);
    if (ans.size() > 0) cout << 1 << endl;
    else cout << 0 << endl;
    return true;
}

int main() {
    bool flag = true;
    while (flag) flag = solve();
}


Measured memory_bytes: 3348