akhauriyash/Code-Regression huggingface dataset:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()
print(A * B)

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

int main(){
    using namespace std;
    unsigned long N;
    cin >> N;
    
    unsigned long max{0}, ans{0};
    for(unsigned long i = 0, h; i < N; ++i){
        cin >> h;
        if(max <= h){
            ++ans;
            max = h;
        }
    }
    cout << ans << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <string>
#include <iostream>
#include <stdio.h>
#include <queue>
#include <cmath>
#include <utility>
#include <map>
#include <functional>

using namespace std;
typedef long long ll;
typedef vector<int> vecint;
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)




int main() {
	ll i, N, M, j,k;
	int A[51] = { 0 };

	cin >> N >> M;
	rep(i, 0, M) {
		int a, b;
		cin >> a >> b;
		A[--a] += 1;
		A[--b] += 1;
	}

	rep(i, 0, N)
		cout << A[i] << endl;
	return 0;
}



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

using namespace std;

template <typename T>
bool isprime(T n) {
  if (n == 0 || n == 1) return false;
  if (n == 2) return true;
  if (n % 2 == 0) return false;
  for (T i = 3; i * i <= n; i += 2) {
    if (n % i == 0) return false;
  }
  return true;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int X;
  cin >> X;
  while (!isprime(X)) {
    X++;
  }
  cout << X << '\n';
  return 0;
}


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

int main() {
    int N, M;
    cin >> N >> M;
    int L = 0, R = N + 1;
    for (int i = 0; i < M; i++) {
        int l, r;
        cin >> l >> r;
        L = max(L, l);
        R = min(R, r);
    }
    cout << max(0, R - L + 1) << endl;
}


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

using namespace std;

int main(){
    
    long long A, B, C, K;
    cin >> A >> B >> C >> K;

    if(K <= A){
        cout << K << endl;
    }
    
    else if(K <= A + B){
        cout << A << endl;
    }
    
    else{
        cout << A - (K - A - B) << endl;
    }
    
}


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int a,b,ans;
inline int read()
{
	int num=0,f=1;
	char c=getchar();
	for(;c<'0'||c>'9';c=getchar())
	if(c=='-')f=-1;
	for(;c>='0'&&c<='9';c=getchar())
	num=(num<<1)+(num<<3)+c-48;
	return num*f;
}
void init()
{
	a=read();b=read();
}
bool check(int k)
{
	int c[10],t=0;
	while(k>0)
	{
		c[++t]=k%10;
		k/=10;
	}
	if(c[1]==c[5]&&c[2]==c[4])return true;
	return false;
}
void work()
{
	for(int i=a;i<=b;++i)
	{
		if(check(i))ans++;
	}
	cout<<ans;
}
int main()
{
	init();
	work();
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
    
int main() {
    string s[3];
    int n[3] = {0, 0, 0};
    cin >> s[0] >> s[1] >> s[2];
    int id = 0;
    while (true) {
        if (n[id] >= s[id].size()) {
            break;
        } else {
            id = (int)(s[id][n[id]++] - 0x31) - (int)'0';
        }
    }
    cout << (char)(id + 65);
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const int dx[4] = { 0, -1, 1, 0 };
const int dy[4] = { -1, 0, 0, 1 };
const int INF = 1e9 + 7;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}

template<class T1, class T2> void chmin(T1 &a, T2 b) { if (a>b)a = b; }

template<class T1, class T2> void chmax(T1 &a, T2 b) { if (a<b)a = b; }
template<class T>
void Add(T &a, const T &b, const T &mod = 1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}
////////////////////////////////////////

int main() {
	int n;
	cin >> n;
	vector<ll>a(n);
	for (int i = 0; i < n; ++i)cin >> a[i];
	ll res = 0;
	ll right = 0;
	int sum = 0;
	for (int left = 0; left < n; ++left) {
		while (right < n && (sum^a[right]) == (sum + a[right])) {
			sum += a[right];
			++right;
		}
		res += right - left;
		if (left == right)++right;
		else {
			sum -= a[left];
		}
	}
	cout << res << endl;
	return 0;
}

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

using namespace std;

int main() {
	int d, t, s;
	scanf("%d %d %d", &d, &t, &s);
	double dd = d, dt = t, ds = s;
	printf(dd / ds <= dt ? "Yes\n" : "No\n");
	
	return 0;
}

Measured memory_bytes: 3824
#include <stdio.h>

int main(){
 int K,A,B;
 int check;
 scanf("%d", &K);
 scanf("%d %d", &A ,&B);
 
 
 for(int i=A; i<=B; i++){
 	if (i%K == 0){
 		check++;
	 }
 } if (check > 0){
 	printf("OK");
 }else{printf("NG");
 }
   
return 0;
}

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

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

    vector<bool> comp (2*n,false);
    

    for(int i=2;i<n;i++){
        if(comp[i]==false){
            for(int j=i+i; j<2*n ; j=j+i){
                comp[j]=true;
            }
        }
    }
    for(int i=n;i<2*n;i++){
        if (!comp[i]){
            cout<<i<<endl;
            return 0;
        }
    }
    return 1;
}

Measured memory_bytes: 256
io = STDIN

s=io.gets.chomp
len=s.size
x='01'*(len/2)
y='10'*(len/2)
if len.odd?
  x=x+"0"
  y=y+"1"
end
bins=s.to_i(2)
binx=x.to_i(2)
biny=y.to_i(2)
def popcount(x)
  x.to_s(2).count("1")
end
puts [popcount(bins^binx),popcount(bins^biny)].min


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

int main() {
	int H, W, A, B;
	cin >> H >> W >> A >> B;
	vector<vector<int>> ans(H, vector<int>(W));
	for (int i = 0; i < B; i++) {
		for (int j = A; j < W; j++) ans[i][j] = 1;
	}
	for (int i = B; i < H; i++) {
		for (int j = 0; j < A; j++) ans[i][j] = 1;
	}
	for (vector<int>& i : ans) {
		for (int& j : i) cout << j;
		cout << endl;
	}
}

Measured memory_bytes: 5120
import os,re,sys,operator
from collections import Counter,deque
from operator import itemgetter
from itertools import accumulate,combinations,groupby
from sys import stdin,setrecursionlimit
from copy import deepcopy
import heapq

setrecursionlimit(10**6)
while 1:
    n=int(stdin.readline().rstrip())
    if n==0:
        break
    a=[int(i) for i in stdin.readline().rstrip().split()]
    mean=sum(a)/n
    cnt=0
    for i in a:
        if i<=mean:
            cnt+=1
    print(cnt)


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

typedef struct Point {
  double x;
  double y;
} point;


void print(point num);
void koch(int d, point p1, point p2);

int main(void){
  int n;
  point p1,p2;
  
  scanf("%d",&n);
  
  p1.x = 0;
  p2.x = 100;
  
  p1.y = 0;
  p2.y = 0;
  
  print(p1);
  koch(n,p1,p2);
  print(p2);
  
  return 0;
}





void print(point num){
  printf("%.8f %8f\n",num.x,num.y);
}



void koch(int d,point p1, point p2){
  point s,t,u;
  double th = M_PI*60.0/180.0;
  
  if(d == 0){
    return;
  }

  s.x = (2.0*p1.x + 1.0*p2.x)/3.0;
  s.y = (2.0*p1.y + 1.0*p2.y)/3.0;
  t.x = (1.0*p1.x + 2.0*p2.x)/3.0;
  t.y = (1.0*p1.y + 2.0*p2.y)/3.0;
  u.x = (t.x-s.x)*cos(th) - (t.y-s.y)*sin(th) + s.x;
  u.y = (t.x-s.x)*sin(th) + (t.y-s.y)*cos(th) + s.y;

  koch(d-1,p1,s);
  print(s);
  
  koch(d-1,s,u);
  print(u);
  
  koch(d-1,u,t);
  print(t);
  
  koch(d-1,t,p2);
}





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

#define ll long long
#define pb push_back
#define INF 1e9+7
#define cases int t;cin>>t;while(t--)
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define per(i,a,b) for(ll i=a;i>=b;i--)
#define ff first
#define ss second

#define test4(x,y,z,a) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<"		a is "<<a<<endl;
#define test3(x,y,z) cout<<"x is "<<x<<"		y is "<<y<<"		z is "<<z<<endl;
#define test2(x,y) cout<<"x is "<<x<<"		y is "<<y<<endl;
#define test1(x) cout<<"x is "<<x<<endl;

int main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	
	ll x,y;
	cin>>x>>y;
	ll b=y-2*x;
	if(b%2==0&&b>=0){
		b/=2;
		if(x-b>=0){
			cout<<"Yes";
		}
		else{
			cout<<"No";
		}
	}
	else{
		cout<<"No";
	}
	
	
	
	return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>

using namespace std;


int main() {

    int n; cin >> n;
    map<int, int> odd;
    map<int, int> even;
    int tmp;
    for(int i=0; i < n; i++) {
        cin >> tmp;
        if(i % 2 == 0) {
            even[tmp]++;
        } else {
            odd[tmp]++;
        }
    }

    priority_queue<pair<int, int>> even_pq;
    for(auto itr = even.begin(); itr != even.end(); itr++) {
        even_pq.push(make_pair(itr->second, itr->first));
    }

    priority_queue<pair<int, int>> odd_pq;
    for(auto itr = odd.begin(); itr != odd.end(); itr++) {
        odd_pq.push(make_pair(itr->second, itr->first));
    }

    int ans = 0;

    if(even_pq.top() != odd_pq.top()) {
        ans += ((n+1)/2) - even_pq.top().first;
        ans += ((n+1)/2) - odd_pq.top().first;
    } else {
        int tmp_odd_c = ((n+1)/2) - odd_pq.top().first;
        int tmp_even_c = ((n+1)/2) - even_pq.top().first;

        int ans_ptn_1=0, ans_ptn_2=0;
        // 偶数の方を2番目の頻出値に変える場合
        even_pq.pop();
        if(!even_pq.empty()) {
            ans_ptn_1 = tmp_odd_c + ((n+1)/2) - even_pq.top().first;
        } else {
            ans_ptn_1 = tmp_odd_c + ((n+1)/2);
        }

        // 奇数の方を2番目の頻出値に変える場合
        odd_pq.pop();
        if(!odd_pq.empty()) {
            ans_ptn_2 = tmp_even_c + ((n+1)/2) - odd_pq.top().first;
        } else {
            ans_ptn_2 = tmp_even_c + ((n+1)/2);
        }

        ans = min(ans_ptn_1, ans_ptn_2);
    }

    cout << ans << endl;
    return 0;

}



Measured memory_bytes: 6136
// We only fail when we stop trying
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;

int main()
{
  int H1, M1, H2, M2, P;
  cin >> H1 >> M1 >> H2 >> M2 >> P;
  int a = H1 * 60 + M1;
  int b = H2 * 60 + M2;
  cout << b - a - P << endl;
  return 0;
}


Measured memory_bytes: 3640
/*Author: Gautam*/
 
 
#include<bits/stdc++.h>
#define FastIO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
#define MOD 1000000007
#define ull unsigned long long int
#define newline cout<<endl
 
 
/* TYPE DEFINITIONS */
typedef     long long       ll;
typedef     vector<ll>     vi;
typedef     pair<int,int>   pi;
 
 
 
/* ALGEBRA */
bool isPrime(ull n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ull i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
} 
 
ll binpow(ll a, ll b, ll m) {
    a %= m;
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
 
/* MACROS */
 
#define  all(A)         (A).begin() , (A).end()
#define  arrall(A,n)    (A),((A)+(n))
#define  rall(A)        (A).rbegin() , (A).rend()
#define  sz(A)          (int)(A).size()
#define  pb             push_back
#define  ppb            pop_back
#define  mp             make_pair
#define  ln(X)          (int)(X).length()
#define  square(X)      ((X)*(X))
#define  cube(X)        ((X)*(X)*(X))
#define  forn(i, n)  for (int i = 0; i < int(n); i++)
#define  forr(i, n)  for (int i = int(n - 1); i >= 0; i--)
#define  fora(i, a, b)  for (int i = int(a); i <= int(b); i++)
#define  forb(i, a, b)  for (int i = int(a); i >= int(b); i--)
#define  fore(it, a)    for(__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++) 
void solve()
{  
    int n,k;
    cin>>n>>k;
    int arr[n];
    forn(i,n)cin>>arr[i];
    int c=0;
    forn(i,n)if(arr[i]>=k)c++;
    cout<<c<<endl;
    
}
    
int main()
{
    FastIO;
    ll t=1;
    
    //cin>>t;
    while(t--)
    {  // memo();
        solve();
    }
}

Measured memory_bytes: 640
#include <iostream>
#include <set>

bool ok(const long long N, const long long num){
    return (num >= 2 && num <= N);
}

bool check(long long N, const long long num){
    while(N % num == 0) N /= num;
    return ((N - 1) % num == 0);
}

int main(){
    long long N;
    std::cin >> N;
    long long ans = 0;
    for(long long i = 1; i * i <= N - 1; ++i){
        if((N - 1) % i == 0){
            if(ok(N, i)) ++ans;
            if(i != (N - 1) / i && ok(N, (N - 1) / i)) ++ans;
        }
    }
    for(long long i = 1; i * i <= N; ++i){
        if(N % i == 0){
            if(ok(N, i) && check(N, i)) ++ans;
            if(i != N / i && ok(N, N / i) && check(N, N / i)) ++ans;
        }
    }
    std::cout << ans << "\n";
}

Measured memory_bytes: 256
#include <stdio.h>
int main( void )
{
  	int N;
	scanf("%d", &N ) ;
    int M=0,V=0;
    for( int i = 0 ; i < N ; i++ ) {
		int H;
		scanf("%d", &H ) ;
      	if( H >= M ) {
          	V++;
          	M = H ;
        }
    }
  	printf("%d", V ) ;
  	return 0 ;
}

Measured memory_bytes: 128
//set many funcs template
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int a,b;
    scanf("%d%d",&a,&b);
    if(a+b>=10){printf("error\n");}else{printf("%d\n",a+b);}
    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
 
int main(){
  char c;
  cin >> c;
  if(c=='A')cout << 'T' << endl;
  else if(c=='T')cout << 'A' << endl;
  else if(c=='C')cout << 'G' << endl;
  else cout << 'C' << endl;
return 0;}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
    
using namespace std;    
typedef long long ll;


int main(){
    
    vector<ll> a(3);
    ll k;

    cin >> a[0] >> a[1] >> a[2];
    cin >> k;

    sort(a.begin(),a.end());
    for(int i = 0; i < k; i++){
        a[2] *= 2;
    }

    cout << accumulate(a.begin(), a.end(), 0ll) << endl;

}

Measured memory_bytes: 256
nums=[int(e) for e in input().split()]
A=[int(e) for e in input().split()]
B=[int(e) for e in input().split()]

a, b = [0], [0]
for i in range(nums[0]):
    a.append(a[i]+A[i])
for i in range(nums[1]):
    b.append(b[i]+B[i])

ans, j = 0, nums[1]
for i in range(nums[0]+1):
    if a[i] > nums[2]:
        break
    while b[j] > nums[2] - a[i]:
        j -= 1
    ans = max(ans, i+j)

print(ans)


Measured memory_bytes: 47412
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n,k;
    cin >> n >> k;
    vector <long long>h(n);
    for(long long i = 0; i < n; i++){
        cin >> h[i];
    }
    vector <long long> dp(n,0);

    for(long long i = 0; i < k; i++){
        if(i<n){
            dp[i] = abs(h[i]-h[0]);
        }else{
            break;
        }
    }
    for(long long i = k; i < n; i++){
        dp[i]=LONG_LONG_MAX;
        //long long baseDp = 0;
        //if(i!=0)baseDp=dp[i-1];
        for(long long j = 1; j <= k; j++){
            //if(i==9)cout<<abs(h[i]-h[i-j])<<endl;
            dp[i]=min(dp[i],dp[i-j]+abs(h[i]-h[i-j]));
        }
    }
    //for(long long i = 0; i < n; i++){
        //cout << dp[i] << " ";
    //}
    //cout << endl;
    cout << dp.back() << endl;
    return 0;
}

Measured memory_bytes: 4756
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const ll INFl=(ll)9223372036854775807;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
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 dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}


string s;
int main(){
	int ans=0;
	int k=0;
	cin>>s;
	string b="";
	while(k<s.size()){
		if((b.size()==1&&b[0]!=s[k])||(b.size()!=1)){
			b=s[k];
			k++;
		}else{
			b="";
			k+=2;
		}
		if(k<=s.size())
		ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
package main

import(
    "fmt"
)



func main() {
    var a,b,c int
    fmt.Scan(&a,&b,&c)
    ans := "NO"
    if b-a == c-b{
        ans = "YES"
    }
    fmt.Println(ans)
}





func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define dev 998244353 //tenka1
#define P pair<int,int>
#define F first
#define S second
string s,t;
int ans=0;
signed main(){
    cin>>s>>t;
    rep(i,3){
        if(s[i]==t[i])ans++;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
ll func(ll x) {
	x++;  ll ans = 0;
	if ((x / 2) & 1) ans ^= 1;
	if (x & 1) ans ^= (x-1);
	return ans;
}
int main(void) {
	ll a, b; 
	scanf("%lld %lld", &a, &b);
	ll ans = func(a) ^ func(b);
	printf("%lld\n", ans ^ a);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>


using namespace std;
int digitsum(int x){
    int s=0;
    while(x>0){
        s+=x%10;
        x/=10;
    }
    return s;
}
int main()
{
    int a,b,n,t=0,i;
    cin>>n;
    cin>>a>>b;
    for(i=1;i<=n;i++){
        if(a<=digitsum(i) && digitsum(i)<=b) t+=i;
    }
    cout<<t;
    return 0;
}

Measured memory_bytes: 256
n=int(input())
ans=0
temp=[0]*101

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr
  
for i in range(1,n+1):
  a=factorization(i)
  for j in range(len(a)):
    temp[a[j][0]]=temp[a[j][0]]+a[j][1]
t75=0
t25=0
t15=0
t5=0
t3=0
t1=0
for i in range(n):
  if temp[i]>=74:
    t75=t75+1
  if temp[i]>=24:
    t25=t25+1
  if temp[i]>=14:
    t15=t15+1
  if temp[i]>=4:
    t5=t5+1
  if temp[i]>=2:
    t3=t3+1
  if temp[i]>=1:
    t1=t1+1
print(t75+t25*(t3-1)+t15*(t5-1)+t5*(t5-1)*(t3-2)//2)

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

int main(){
  int N; cin >> N;
  vector<int> a(N+1);
  rep(i, N) cin >> a[i+1];
  
  int count = 0;
  int i = 1;
  bool is_two = false;
  while(!is_two && count <= N){
    count++;
    i = a[i];
    if(i == 2) is_two = true;
  }
  if(is_two) cout << count << endl;
  else cout << -1 << endl;
}


Measured memory_bytes: 640
import fractions
A,B = map(int,input().split())

def Prime_factorization(n):
    ans = []
    tmp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if tmp%i == 0:
            count = 0
            while tmp%i == 0:
                count += 1
                tmp //= i
            ans.append([i,count])
    if tmp != 1:
        ans.append([tmp, 1])
    return ans
print(len(Prime_factorization(fractions.gcd(A,B)))+1)

Measured memory_bytes: 5304
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# 二分探索
N, K = lr()
A = np.array(lr())
F = np.array(lr())
A.sort()
F = np.sort(F)[::-1]

def check(x):
    count = np.maximum(0, (A - (x // F))).sum()
    return count <= K

left = 10 ** 12 # 可能
right = -1 # 不可能
while left > right + 1:
    mid = (left+right) // 2
    if check(mid):
        left = mid
    else:
        right = mid

print(left)
# 51

Measured memory_bytes: 37156
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
		int N, K;
		cin >> N >> K;
		vector<int> h(N, 0);
		for ( int i = 0; i < N; i++ ) cin >> h[i];

		sort(h.begin(), h.end());
		vector<int> v(N - K + 1, 0);
		for (int i = 0; i < N - K + 1; i++) {
				v[i] = h[i + K - 1] - h[i];
		}
		
		sort(v.begin(), v.end());
		cout << v[0] << endl;

		return 0;
}


Measured memory_bytes: 1024
import * as fs from 'fs';
const input = fs.readFileSync("/dev/stdin", "utf8").split(/\n/);

// B-文字列大好きいろはちゃんイージー

const N = parseInt(input[0].split(' ')[0]);
const targetText = new Array<string>();
let result = "";

for (let i = 1; i < 1 + N; i++) {
    targetText.push(input[i]);
}

targetText.sort();

targetText.forEach(x => {
    result += x;
});
console.log(result);



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

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

    ll a,b,n; cin >> a >> b >> n;
    if(n < b) cout << (a*n/b) - a*(n/b) << endl;
    else cout << (a*(b-1))/b - a*((b-1)/b) << endl;
}

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

int main( int argc, char *argv[] )
{
    int k, a, b;

    scanf( "%d %d %d", &k, &a, &b );

    for( int i=a; i<=b; i++ ) {
        if( i % k == 0 ) {
            puts( "OK" );
            exit( 0 );
        }
    }

    puts( "NG" );
}


Measured memory_bytes: 1660
import java.util.Scanner;

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

        long[] a = new long[n];
        for(int i=0; i<n; i++) {
            a[i] = sc.nextLong();
        }
        long[] b = new long[m];
        for(int i=0; i<m; i++) {
            b[i] = sc.nextLong();
        }

        long[] ca = new long[n+1];
        for(int i=0; i<a.length; i++) ca[i+1] = ca[i] + a[i];

        long[] cb = new long[m+1];
        for(int i=0; i<b.length; i++) cb[i+1]+= cb[i] + b[i];

        int cnt = 0;
        int j = m;
        for(int i=0; i<n+1; i++) {
            if(ca[i] > k) {
                break;
            }
            while(cb[j] > k-ca[i]) {
                j--;
            }
            cnt = Math.max(cnt, i+j);
        }
        System.out.println(cnt);
    }
}


Measured memory_bytes: 63456
#include <iostream>

using namespace std;

int main(){
  int N, M;
  cin >> N >> M;
  
  int sum1 = N * (N-1) / 2;
  int sum2 = M * (M-1) / 2;
  
  cout << sum1 + sum2 << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
using namespace std;
int main() {
	int a = 0, b = 0, c = 0, d[100000], e[100000], f = 0, g = 0, h = 0, count = 0;
	char rikka, toka[100000];
	string saya, homu, kyok, mami,mado[100];
	int manji, nk[26] = {false};
	cin >> saya;
	for (int i = 0; i < saya.length(); i++) {
		nk[saya[i]- 'a'] = true;
	}
	for (int k = 0; k < 26; k++) {
		if (nk[k] == false) {
			rikka = 'a' + k;
			cout << rikka << endl;
			return 0;
		}
		
			
		
	}
	cout << "None" << endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
using namespace std;
int main()
{
	int a[100], n, i, e;
	cin >> n;
	n <= 100 ;
	for (i = 0 ; i <= n; i++)
		cin >> a[i];
	for (e = n - 1 ; e >= 1 ; e--)
	{
		cout << a[e] << " " ;
	}
	  cout << a[0] ;
	  cout << endl;
}

Measured memory_bytes: 1160
#define rep(i, n) for (int i = 0; i < (n); i++)
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
// MAX int 2,147,483,647 -> 10桁
// MAX ll 9,223,372,036,854,775,807 -> 19桁
// MAX O(n) 10^18 -> 18回
// double pi = M_PI or acos(-1)
// printf("%.10f\n", ans);

int main() {
    int n;
    cin >> n;
    vector<int> x(n);
    rep(i, n) cin >> x.at(i);

    int ans = MOD;
    rep(p, 300) {
        int sum = 0;
        rep(i, n) {
            sum += (x.at(i) - p) * (x.at(i) - p);
        }
        ans = min(ans, sum);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3496
#include <iostream> 
#include <vector>
#include <string>
#include <math.h>
#include <stack>
#include <fstream>
using namespace std;
#define ll long long int


int main( ) {
  int n,ans = 1;
  cin >> n;
  vector <int> h(n);
  for ( int i = 0; i < n; ++i ) {
    cin >> h[i];  
  }
  int M = h[0];
  for ( int i = 0; i < n; ++i ) {
    if (i == 0 ) continue;
    if( M <= h[i] ){
      M = h[i];
      ans++;
    }  
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  int64_t b;

  while (cin >> b, b) {
    for (int64_t d = sqrt(2 * b); d > 0; --d) {
      int64_t a = (2 * b + d - d * d) / (2 * d);
      if (a <= 0 || b < a) continue;
      if ((a + d) * (a + d - 1) - a * (a - 1) == 2 * b) {
        cout << a << " " << d << endl;
        break;
      }
    }
  }
}



Measured memory_bytes: 3080
h, w, k = (list)(map(int, input().split()))

mat = [[0 for _ in range(w)] for __ in range(h+1)]
mat[0][0] = 1


def num(n):
    ret = 0
    if n == 0:
        return 1
    for i in range(2**(n-1)):
        dig = format(i, 'b')
        if not '11' in dig:
            ret += 1

    return ret


if w == 1:
    print('1')
    exit()

for col in range(1, h+1):
    for row in range(w):
        if row == 0:
            mat[col][row] = mat[col-1][row] * \
                num(w-1) + mat[col-1][row+1]*num(w-2)
        elif row == w-1:
            mat[col][row] = mat[col-1][row] * \
                num(w-1) + mat[col-1][row-1]*num(w-2)
        else:
            mat[col][row] = mat[col-1][row] * (num(row)*num(w-row-1)) \
                + mat[col-1][row-1]*(num(row-1)*num(w-row-1))\
                + mat[col-1][row+1]*(num(row)*num(w-row-2))
print(mat[h][k-1] % 1000000007)

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define repa(X,A,Y) for (int (X) = A;(X) <= (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int c[5];
int a[3], b[3];

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

  rep(i, 3) cin >> a[i] >> b[i];

  rep(i, 3) {
    ++c[a[i]];
    ++c[b[i]];
  }

  int count = 0;
  for (int i = 1; i <= 4; ++i) {
    if (c[i] == 1) ++count;
  }

  if (count == 2) cout << "YES" << endl;
  else cout << "NO" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <cstring>

using namespace std;

class Node{
public:
	int x, y, face, dir;
	Node(int x, int y, int face, int dir) : x(x), y(y), face(face), dir(dir) {}
};

int dx[2][3] = { {1, -1, 0}, {1, 0, -1} };
int dy[2][3] = { {0,  0, 1}, {0, -1,  0} };
int next[20][3] = {
	{1, 4, 5}, {2, 0, 6}, {3, 1, 7}, {4, 2, 8}, {0, 3, 9},
	{0, 10, 11}, {1, 11, 12}, {2, 12, 13}, {3, 13, 14}, {4, 14, 10},
	{5, 9, 15}, {6, 5, 16}, {7, 6, 17}, {8, 7, 18}, {9, 8, 19},
	{10, 19, 16}, {11, 15, 17}, {12, 16, 18}, {13, 17, 19}, {14, 18, 15}
};

int main(){
	int n;
	static int res[3][20][201][201]; // [dir][face][x][y]
	memset(res, -1, sizeof(res));
	queue<Node> qu; qu.push(Node(100, 100, 0, 0));
	res[0][0][100][100] = 0;
	while(!qu.empty()){
		Node nd = qu.front(); qu.pop();
		int px = nd.x, py = nd.y, face = nd.face, dir = nd.dir;
		if(res[dir][face][px][py]==100) continue;
		for(int i=0;i<3;i++){
			int x = px+dx[(px+py)%2][i], y = py+dy[(px+py)%2][i];
			int nface = next[face][(i+dir)%3];
			int ndir = 0;
			for(int j=0;j<3;j++){
				int nx = x+dx[(x+y)%2][j], ny = y+dy[(x+y)%2][j];
				if(nx==px && ny == py){
					for(int k=0;k<3;k++)
						if(next[nface][k] == face) ndir = (k-j+3)%3;
				}
			}
			if(res[ndir][nface][x][y]==-1){
				res[ndir][nface][x][y] = res[dir][face][px][py]+1;
				qu.push(Node(x, y, nface, ndir));
			}
		}
	}

	int x, y, f;
	while(cin >> x >> y >> f, x|y|f){
		int step = 100;
		for(int i=0;i<3;i++){
			if(res[i][f][x+100][y+100]!=-1)
				step = min(step, res[i][f][x+100][y+100]);
		}
		cout << step << endl;
	}
}

Measured memory_bytes: 10000
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2

using namespace std;

int MOD = 1000000007;

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

    int ans = INF;
    for(int i = 0;i <= s.size()-3;i++){
        int x = (s[i]-'0')*100 + (s[i+1]-'0')*10 +s[i+2]-'0';
        ans = min(ans,abs(753-x));
    }
    cout << ans <<endl;

    return 0;
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (ll)(n); ++i)
#define be(v) (v).begin(), (v).end()
#define dcout cout << fixed << setprecision(20) 
ll INF = 1LL << 60;
ll mod = 1e9 + 7;

int main() {
	int n; cin >> n;
	cout << n/3 << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {


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

		// input
		int price = scan.nextInt();

		// check
		int nums = price / 100;
		int tail = price % 100;
		boolean flag = false;
		for(int i = 0; i < nums; i++){
			if(tail >= 5){
				tail -= 5;
			} else if(tail >= 4){
				tail -= 4;
			} else if(tail >= 3){
				tail -= 3;
			} else if(tail >= 2){
				tail -= 2;
			} else if(tail >= 1){
				tail -= 1;
			}
			if(tail == 0){
				flag = true;
				break;
			}
		}

		// answer
		if(flag){
			System.out.println(1);
		} else {
			System.out.println(0);
		}

	}
}


Measured memory_bytes: 23124
#include <iostream>
#include <unordered_map>
using namespace std;
typedef long long ll;

int main() {
    int N; cin >> N;
    unordered_map<ll, ll> mp;
    ll ans = 0;
    for (int i = 0; i < N; i++) {
        int A; cin >> A;
        mp[A]++;
        ans += A;
    }
    int Q; cin >> Q;
    for (int i = 0; i < Q; i++) {
        int B, C; cin >> B >> C;
        ll n = 0;
        auto ite = mp.find(B);
        if (ite != mp.end()) {
            ans += (C - B) * ite->second;
            mp[C] += ite->second;
            ite->second = 0;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 6680
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <cstring>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

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);
    }
}

template <typename T>
void output(T a, int precision) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

int main(int argc, const char * argv[]) {
    int N = inputValue();
    int A[100000];
    int Y[100000];
    inputArray(A, N);
    Y[0] = 0;
    rep(j,N){
      if(j % 2 == 0)
        Y[0] += A[j];
      else
        Y[0] -= A[j];
    }
    repd(i,1,N){
      Y[i] = 2*A[i-1] - Y[i-1];
    }
    
    rep(i,N){
      cout << Y[i] << " ";
    }
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 2048
#include<iostream>
#include<cstdio>
#include<queue>
#include<cstring>
#include<vector>
#include<set>
using namespace std;
typedef long long ll;
int H,W,N;
char mm[1005][1005];
bool v[1005][1005];
int xx,yy;
struct node{
    int x,y,step;
};
queue<node> que;
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
bool check(int x,int  y){
    if(1<=x&&x<=H&&1<=y&&y<=W&&!v[x][y]&&mm[x][y]!='X')return true;
    else return false;
}
int bfs(int g){
    while(!que.empty())que.pop();
    node t;
    t.x=xx;
    t.y=yy;
    t.step=0;
    v[xx][yy]=1;
    que.push(t);
    while(!que.empty()){
        t=que.front();
        que.pop();
        for(int i=0;i<4;i++){
            int nx=t.x+dx[i];
            int ny=t.y+dy[i];
            if(check(nx,ny)){
                if(mm[nx][ny]==g+'0'){
                    xx=nx;
                    yy=ny;
                    return t.step+1;
                }
                node tt;
                tt.x=nx;
                tt.y=ny;
                tt.step=t.step+1;
                v[nx][ny]=1;
                que.push(tt);
            }
        }
    }
}
int main(){
    while(~scanf("%d%d%d",&H,&W,&N)){
        for(int i=1;i<=H;i++){
            scanf("%s",mm[i]+1);
        }
        for(int i=1;i<=H;i++){
            for(int j=1;j<=W;j++){
                if(mm[i][j]=='S'){
                    xx=i;
                    yy=j;
                }
            }
        }
        int ans=0;
        for(int i=1;i<=N;i++){
            memset(v,0,sizeof(v));
            ans+=bfs(i);
        }
        printf("%d\n",ans);
    }
    return 0; 
}


Measured memory_bytes: 5148
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<'\n';
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b;
    cin>>a>>b;
    if(a+b>=10) cout<<"error"<<endl;
    else cout<<a+b<<endl;
}

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

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

    int n;
    std::cin >> n;

    std::vector <int> v(2*n);

    for(auto& it: v){
        std::cin >> it;
    }
    int cnt = 0;
    for(int i = 1; i < 2*n; i+=2){
        if(v[i] == v[i-1])
            cnt++;
        else cnt = 0;

        if(cnt == 3)
        {
            std::cout << "Yes\n";\
            return 0;
        }
    }
    std::cout << "No\n";
}

Measured memory_bytes: 3636
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define pii pair<int,int>
#define pp pair<pair<ll, ll>,pair<ll, ll>>
#define pll pair<ll,ll>
#define pdd pair<double,double>
#define vii vector<int>
#define vll vector<ll>
#define mat vector<vector<ll>>
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define fi first
#define sc second
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll) (x).size()
#define pq priority_queue<ll>
#define pqg priority_queue<ll,vector<ll>,greater<ll>>
#define LB(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define UB(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
#define ERASE(v) sort(v.begin(),v.end());v.erase(unique(v.begin(),v.end()),v.end())
#define int ll
using namespace std;
const ll INF = (1 << 30 ) - 1;
const ll LLINF = (1LL << 60LL);
const ll MOD = 1000000007;
const ll mod = 998244353;
const ll MAX = 1100000;
const double pi = acos(-1);
const double eps = 1e-10;
ll dx[4] ={1,0,-1,0} , dy[4] ={0,1,0,-1};

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

struct Timer{
    chrono::system_clock::time_point start, end;
    Timer(){ start = chrono::system_clock::now(); }
    ~Timer(){
        end = chrono::system_clock::now();
        auto msec = chrono::duration_cast<chrono::milliseconds>(end - start).count();
        cerr<<"time : "<<msec<<" ms"<<endl;
    }
};


void solve(){
    ll a,b;
    cin>>a>>b;
    ll ans=a-1;
    if(b>=a) ans++;
    cout<<ans<<endl;
}



signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // Timer TM;
    
    solve();

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long mod=1e9+7;

int main() {
  int h,w;
  cin >> h >> w;
  vector<string> maze(h);
  for(int i=0;i<h;i++) {
    cin >> maze.at(i);
  }
  vector<vector<long long>> dp(h,vector<long long> (w,0));
  dp.at(0).at(0)=1;
  for(int i=0;i<h;i++) {
    for(int j=0;j<w;j++) {
      if(i<h-1) {
        if(maze.at(i+1).at(j)=='.') {
          dp.at(i+1).at(j)=(dp.at(i+1).at(j)+dp.at(i).at(j))%mod;
        }
      }
      if(j<w-1) {
        if(maze.at(i).at(j+1)=='.') {
          dp.at(i).at(j+1)=(dp.at(i).at(j+1)+dp.at(i).at(j))%mod;
        }
      }
    }
  }
  cout << dp.at(h-1).at(w-1) << endl;
}

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

int main() {
  int N;
  cin >> N;
  vector<int> p(N);
  for (int i = 0; i < N; ++i)
    cin >> p[i];

  int ans = 0;
  vector<int> p_flag(N);
  for (int i = 0; i < N - 1; ++i)
    if (!p_flag[i] && !p_flag[i + 1] && p[i] == i + 1 && p[i + 1] == i + 2)
      p_flag[i] = true, p_flag[i + 1] = true, ++ans;

  for (int i = 0; i < N; ++i)
    if (!p_flag[i] && p[i] == i + 1)
      ++ans;

  cout << ans << endl;
}


Measured memory_bytes: 1024
def func():
    A, B, C = map(int, input().split())
    cand1 = A * 10 + B + C
    cand2 = B * 10 + A + C
    cand3 = C * 10 + A + B
    print(max(cand1, cand2, cand3))


if __name__ == '__main__':
    func()


Measured memory_bytes: 38384
A = int(input())
a = [input() for i in range(A)]
a = map(int,a)
a = sorted(a)

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

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

for i in range(A-1):
    b=lcm(a[0],a[1])
    del a[0:2]
    a.insert(0,b)
print(a[0])


Measured memory_bytes: 38384
#include <stdio.h>

int a, b;

int main(){
	scanf("%d %d", &a, &b);
	if (a < b){
		printf("a < b\n");
	} else if (a == b){
		printf("a == b\n");
	} else if (a > b){
		printf("a > b\n");
	}
	return 0;
}


Measured memory_bytes: 2024
#include<stdio.h>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	int kai = 38, num = kai*(kai - 1) + 1;
	printf("%d %d\n", num, kai);
	for (int i = 0; i < kai; i++)
	{
		printf("1");
		for (int j = 0; j < kai - 1; j++)printf(" %d", i*(kai - 1) + j + 2);
		printf("\n");
	}
	for (int i = 0; i < kai - 1; i++)
	{
		for (int j = 0; j < kai - 1; j++)
		{
			printf("%d", i + 2);
			for (int k = 0; k < kai - 1; k++)
			{
				printf(" %d", k*(kai - 1) + 1 + kai + (i*k+j) % (kai - 1));
			}
			printf("\n");
		}
	}
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
#define F first
#define S second
#define mod 1000000007
#define pb push_back
#define FOR(i,a,n) for(int i=a;i<n;i++)
#define REV(i,a,n) for(int i=a;i>=n;i--)
#define all(a) a.begin(),a.end()
#define UB upper_bound
#define LB lower_bound
const int NUM = 2e5 + 5;

int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int num_tests=1; 
    //cin >> num_tests;
    while(num_tests-->0){
        int h,w,k; cin >> h >> w >> k;
        string s[h];
        FOR(i,0,h) cin >> s[i];
        int ans = 0;
        FOR(i,0,1<<h)
            FOR(j,0,1<<w){
                int cnt = 0;
                FOR(i2,0,h)
                FOR(j2,0,w)
                    if(i >> i2 & 1 && j >> j2 & 1 and s[i2][j2] == '#')
                        cnt++;
                if(cnt == k) ans++;
            }
        cout << ans;
    }   
}

Measured memory_bytes: 3660
#include <stdio.h>
#include <stdlib.h>
 
int main()
{
  int i, j, n, max, pmin, num;
  scanf("%d", &n);
  scanf("%d%d", &pmin, &num);
  max = num - pmin;
  if(pmin > num) pmin = num;
  for(i=2; i<n; i++){
    scanf("%d", &num);
    max = (max > num-pmin ? max : num-pmin);
    pmin = (pmin < num ? pmin : num); 
  }
  printf("%d\n", max);
  return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <cmath>

using namespace std;

int main(void) {
  int D, T, S;
  cin >> D >> T >> S;
  if(ceil((double)D/S) <= T) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3632
use proconio::input;

fn main() {
    input! {
        n: usize,
        av: [usize; n]
    };

    let mut counts = vec![0; n];
    for a in av {
        counts[a] += 1;
    }
    let is_ok = if n % 2 == 0 {
        (1..=n - 1).step_by(2).all(|x| counts[x] == 2)
    } else {
        (2..=n - 1).step_by(2).all(|x| counts[x] == 2) && counts[0] == 1
    };
    if !is_ok {
        println!("0");
        return;
    }
    let res = (1..=n / 2).fold(1_u64, |acc, _| acc * 2 % 1_000_000_007);
    println!("{}", res);
}


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

int fairfield(int y,int m,int d)
{
  if(m<3)
    {
      y--;
      m+=12;
    }
  return 365*y+(y/4)-(y/100)+(y/400)+(306*(m+1)/10)+d-428;
}

int main()
{
  int y1,m1,d1,y2,m2,d2;
  for(;cin>>y1>>m1>>d1>>y2>>m2>>d2,y1!=-1;)
    {
      cout<<fairfield(y2,m2,d2)-fairfield(y1,m1,d1)<<endl;
    }
}

Measured memory_bytes: 1160