akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define ALL(c) (c).begin(), (c).end()

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

const int INF = TEN(9) + 10;

int main() {
    int N;
    cin >> N;
    V<pii> pt(N);
    ll rmin = INF, rmax = -1, bmin = INF, bmax = -1;
    rep(i, N) {
        int x, y;
        cin >> x >> y;
        if (x > y) swap(x, y);
        pt[i] = mp(x, y);
        chmin(rmin, x);
        chmax(rmax, x);
        chmin(bmin, y);
        chmax(bmax, y);
    }

    ll amax = max(rmax, bmax);
    ll amin = min(rmin, bmin);

    ll ans = (rmax - rmin) * (bmax - bmin);

    sort(ALL(pt));
    multiset<int> st;
    rep(i, N) st.insert(pt[i].fi);
    rep(i, N) {
        int x, y;
        tie(x, y) = pt[i];
        st.erase(st.find(x));
        st.insert(y);
        chmin(ans, (amax - amin) * (*st.rbegin() - *st.begin()));
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 11264
#define _DEBUG
#include "bits/stdc++.h"
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,a4,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define debug_5(x1,x2,x3,x4,x5) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<", "#x5<<": "<<x5<<endl
#ifdef _DEBUG
#define debug(...) CHOOSE((__VA_ARGS__,debug_5,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define debug(...)
#endif
#define rep(index,num) for(int index=0;index<(int)num;index++)
#define rep1(index,num) for(int index=1;index<=(int)num;index++)
#define brep(index,num) for(int index=(int)num-1;index>=0;index--)
#define brep1(index,num) for(int index=(int)num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=(ll)1e+18+1;
int INF=1e+9+1;
int main(){
	int X;
	scan(X);
	prin((1999-X)/200+1);
	return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define PB push_back
void solve()
{
    int n;
  cin>>n;
  vector <vector <int>> d(n,vector <int> (2));
  vector <int> a;
  for (int i=0;i<n;i++)
  {
    cin>>d[i][0]>>d[i][1];
    if (d[i][0]==d[i][1])
    {
      a.PB(i);
    }
  }
  if (a.size()<3)
  {
    cout<<"No";
  }
  else
  {
    int x=0,i=0;
    while (x==0 and i<a.size()-2)
    {
      if (a[i+1]==a[i]+1 and a[i+2]==a[i]+2)
      {
        x++;
      }
      i++;
    }
    if (x==0)
    {
      cout<<"No";
    }
    else
      cout<<"Yes";
  }
}
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    while (t--)
    {
        solve();
        cout<<"\n";
    }
    return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>

int main(){
	char S[50],num;
	int N,K;
	scanf("%d%d",&N,&K);
	scanf("%s",S);
	num=S[K-1];
	switch(num){
		case 'A':
			S[K-1]='a';
			break;
		case 'B':
			S[K-1]='b';
			break;
		case 'C':
			S[K-1]='c';
			break;
		default:
			break;
	}	
	printf("%s\n",S);
	return 0;
}

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

int main() {

  int N;
  cin >> N;
  
  vector<int> v(N);
  for(int i = 0; i < N; i++) {
    cin >> v.at(i);
  }
  
  sort(v.begin(), v.end());
  for(int i = 0; i < N; i++) {
  } 

  double ans = v.at(0);
  
  for(int i = 1; i < N; i++) {
    ans = (ans + v.at(i)) / 2; 
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3692
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;

template<class T, class Compare = greater<T> >
using MinHeap = priority_queue<T, vector<T>, Compare>;
template<class T, class Compare = less<T> >
using MaxHeap = priority_queue<T, vector<T>, Compare>;
using llong = long long;

llong x;
llong dp[100005];
llong d[] = {100, 101, 102, 103, 104, 105};

int main() {

    cin >> x;

    dp[0] = 1;

    for (int i = 0; i <= x; i++) {
        for (int j = 0; j < 6; j++) {
            if (i >= d[j]) dp[i] |= dp[i - d[j]];
        }
    }

    if (dp[x]) cout << 1 << endl;
    else cout << 0 << endl;

    return 0;
}


Measured memory_bytes: 1024
import sys
input = sys.stdin.readline

N = int(input())
x, y, h = zip(*[list(map(int, input().split())) for _ in range(N)])
j = -1
for i in range(N):
    if h[i] != 0:
        j = i
        break
for cx in range(101):
    for cy in range(101):
        H = h[j] + abs(x[j] - cx) + abs(y[j] - cy)
        for i in range(N):
            if h[i] != max(H - abs(x[i] - cx) - abs(y[i] - cy), 0):
                break
        else:
            print(cx, cy, H)



Measured memory_bytes: 73900
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        Node[] nodes = new Node[n+1];
        for(int i = 1; i <= n; i++) {
            nodes[i] = new Node(i);
        }
        for(int i = 0; i < m; i++) {
            int src = sc.nextInt();
            int dest = sc.nextInt();
            nodes[src].nexts.add(dest);
        }
        int s = sc.nextInt();
        int t = sc.nextInt();
        Node start = nodes[s];
        start.minCount = 0;
        ArrayDeque<Node> queue = new ArrayDeque<>();
        queue.addLast(start);
        while(!queue.isEmpty()) {
            Node curr = queue.removeFirst();
            if(curr.num == t) {
                System.out.println(curr.minCount);
                return;
            }
            int prev = curr.minCount;
            for(int next1: curr.nexts) {
                if(nodes[next1].steps.contains(1)) continue;
                nodes[next1].steps.add(1);
                for(int next2: nodes[next1].nexts) {
                    if(nodes[next2].steps.contains(2)) continue;
                    nodes[next2].steps.add(2);
                    for(int next3: nodes[next2].nexts) {
                        if(nodes[next3].steps.contains(3)) continue;
                        nodes[next3].steps.add(3);
                        if(nodes[next3].minCount != -1) continue;
                        nodes[next3].minCount = prev + 1;
                        queue.addLast(nodes[next3]);
                    }
                }
            }
        }
        System.out.println(-1);
    }
    static class Node{
        int num;
        int minCount;
        ArrayList<Integer> nexts;
        HashSet<Integer> steps;
        Node(int num) {
            this.num = num;
            minCount = -1;
            nexts = new ArrayList<>();
            steps = new HashSet<>();
        }
    }
}


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

int main(void) {
    string s;
    cin >> s;
    int a, z;

    for(int i = 0; i < s.length(); i++) {
        if(s[i] == 'A') {
            a = i;
            break;
        }
    }

    for(int i = s.length() - 1; i >= 0; i--) {
        if(s[i] == 'Z') {
            z = i;
            break;
        }
    }

    cout << z-a+1 << endl;
    
    return 0;
}

Measured memory_bytes: 640
//
// author  : Abhishek
//
#include <bits/stdc++.h>

#define ll long long
#define db double
#define deb(x) cout<<#x<<": "<<x<<"\n"
#define all(x) x.begin(),x.end()
#define fo(i, n) for(i=0 ; i<n ; i++)
#define Fo(i, k, n) for(i=k ; i<n ; i++)

using namespace std;

const ll mod = 1000000007;
const ll N = 300005;  // array size
const ll inf = 10000000000000000;


void print(vector<ll> v) {
    ll i;
    fo(i, v.size())cout << v[i] << " ";
    cout << "\n";
}

vector<ll> read(ll n) {
    ll i;
    vector<ll> arr(n, 0);
    fo(i, n)cin >> arr[i];
    return arr;
}

vector<ll> read(ll n, ll k) {
    ll i;
    vector<ll> arr(n + k, 0);
    Fo(i, k, n + k)cin >> arr[i];
    return arr;
}

bool isEven(ll n) {
    return n % 2 == 0;
}

bool isOdd(ll n) {
    return n % 2 != 0;
}


void solve() {
    ll t;
    cin >> (t);
    while (t--) {

        ll i, j, k, n, m, p, q, x, y, a, b, l, r;


    }
}

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

    ll i, j, k, n, m, p, q, x, y, a, b, l, r;


    cin>>n;

    Fo(i,1,10){
        Fo(j,1,10){
            if(i*j == n){
                cout<<"Yes\n";
                return 0;
            }
        }
    }

    cout<<"No\n";

    return 0;
}




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

int main() {
  int n;
  cin >> n;
  long long amin = 9999999999, bmin;
  long long amax = -9999999999, bmax;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    if (a < amin) {
      amin = a;
      bmin = b;
    }
    if (a > amax) {
      amax = a;
      bmax = b;
    }
  }
  long long ans = (amax - amin + 1) + (amin - 1) + bmax;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;
int sum[1002010],p[1010];
int main(){
	
	int n,m;
	
	while(cin>>n>>m,n){
		for(int i=0;i<n;i++)scanf("%d",&p[i]);
		p[n++]=0;//ここで0点分を作っておくことで
		int size=0;
		for(int i=0;i<n;i++)for(int j=0;j<n;j++)sum[size++]=p[i]+p[j];//ここでひとつ分も保存される
		sort(sum,sum+size);
		int ans=0;
		for(int i=0;i<size;i++){
			int rem=m-sum[i];
			if(rem<0)continue;
			int left=0,right=size;
			while(left<right){
				int center=(left+right)/2;
				if(rem>sum[center])left=center+1;
				else if(rem<sum[center])right=center;
				else break;
			}
			ans=max(ans,sum[i]+sum[right-1]);
			
		}
		printf("%d\n",ans);
		
	}
	
	
	return 0;
}


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

using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<bool> memo(k+1,false);
    vector<int> vals(n);
    for(auto& i : vals) {
        cin >> i;
    }
    sort(vals.begin(),vals.end());
    for(int j = 0; j <= k; j++) {
        for(auto i : vals) {
            if(j-i < 0) continue;
            memo[j] = memo[j] || !memo[j-i];
        }
    }
    if(memo[k]) {
        cout << "First" << endl;
    }
    else {
        cout << "Second" << endl;
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
const int MAX=15000000;
int cost[MAX];
int three[15];
int n,m;
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  three[0]=1;
  FOR(i,1,15)three[i]=three[i-1]*3;
  while(cin>>n>>m,n||m){
    int mask=0;
    FOR(i,0,3){
    int x;cin>>x;
    FOR(j,0,x){
      int a;cin>>a;
      a--;
      mask+=i*three[a];
    }
  }
  int all=0;
  FOR(i,0,n)all+=2*three[i];
  FOR(i,0,all+1)cost[i]=2e9;
  cost[mask]=0;
  //cout<<mask<<endl;
  queue<int> que;
  que.push(mask);
  bool next=false;
  while(!que.empty()){
    int now=que.front();que.pop();
    int mx[3];
    FOR(i,0,3)mx[i]=-1;
    int nownow=now;
    FOR(i,0,n){
      mx[nownow%3]=i;
      nownow/=3;
    }
    //cout<<now<<" "<<mx[0]<<" "<<mx[1]<< " "<<mx[2]<<endl;
    if(now==0||now==all){
      if(cost[now]<=m)cout<<cost[now]<<endl;
      else cout<<-1<<endl;
      next=true;
      break;
    }
    //0->1
    if(mx[0]>mx[1]){
      int mask2=now-0*three[mx[0]]+1*three[mx[0]];
      if(cost[mask2]>cost[now]+1){
        cost[mask2]=cost[now]+1;
        que.push(mask2);
      }
    }
    //1->0
    if(mx[1]>mx[0]){
      int mask2=now-1*three[mx[1]]+0*three[mx[1]];
      if(cost[mask2]>cost[now]+1){
        cost[mask2]=cost[now]+1;
        que.push(mask2);
      }
    }
    //1->2
    if(mx[1]>mx[2]){
      int mask2=now-1*three[mx[1]]+2*three[mx[1]];
      if(cost[mask2]>cost[now]+1){
        cost[mask2]=cost[now]+1;
        que.push(mask2);
      }
    }
    //2->1
    if(mx[2]>mx[1]){
      int mask2=now-2*three[mx[2]]+1*three[mx[2]];
      if(cost[mask2]>cost[now]+1){
        cost[mask2]=cost[now]+1;
        que.push(mask2);
      }
    }
  }
  if(!next)cout<<-1<<endl;
  }
  return 0;
}


Measured memory_bytes: 59140
#include "bits/stdc++.h"

using namespace ::std;

typedef long long ll;
typedef unsigned long long ull;

int px[] = {0, 1, 1, -1, 0, -1, -1, 1};
int py[] = {1, 0, 1, 1, -1, 0, -1, -1};

int main()
{
    int n, m, a, b, c;

    scanf("%d", &n);

    m = 360;

    while(m%n) m += 360;
    
    printf("%d\n", m/n);
}

Measured memory_bytes: 3824
// "include" {{{
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <tuple>
// }}}

using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int> 
#define int long long
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1e9+7;

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

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n,m;
	cin >> n >> m;
	vector<bool> br(n+1);
	vector<int> dp(n+1);
	rep(i,m){
		int a;
		cin >> a;
		br[a] = true;
	}
	dp[0] = 1;
	reps(i,n){
		if(br[i]) continue;
		if(i == 1) dp[i] = dp[i-1];
		else (dp[i] = dp[i-1] + dp[i-2]) %= mod;
	}
	cout << dp[n] << '\n';
	return 0;	
}


Measured memory_bytes: 1024
n, a, b = map(int, raw_input().split())
s = raw_input()
for e in s:
    if e == "a":
        if a > 0:
            print "Yes"
            a -= 1
        elif b > 0:
            print "Yes"
            b -= 1
        else:
            print "No"
    elif e == "b":
        if b > 0:
            print "Yes"
            b -= 1
        else:
            print "No"
    else:
        print "No"


Measured memory_bytes: 3076
s = input()
x, y = map(int, input().split())

MoveX, MoveY = [], []
dir = "X"
count = 0
for i in range(len(s)): 
    if s[i] == "T":
        if count:
            if dir == "X": MoveX.append(count)
            else: MoveY.append(count)
        count = 0
        dir = ("Y" if dir == "X" else "X")      
    else:
        count += 1
if s[-1] == "F":
    if dir == "X": MoveX.append(count)
    else: MoveY.append(count)

iniX = 0
if s[0] == "F":
    iniX = MoveX.pop(0)

def DP(i, z, ini, Move = list):
    canMove = set([ini])
    for j in range(i):
        temp = []
        for item in canMove:
            temp.append(item+Move[j])
            temp.append(item-Move[j])
        canMove = set(temp)
    return z in canMove

if DP(len(MoveX), x, iniX, MoveX) and DP(len(MoveY), y, 0, MoveY): print("Yes")
else: print("No")

Measured memory_bytes: 3848
n, m = map(int, input().split())
denq = []
for _ in range(m):
    ks = tuple(map(lambda x: int(x)-1, input().split()))
    denq.append(ks[1:])
P = tuple(map(int, input().split()))

ans = 0
for i in range(2**n):
    switch_states = [(i>>j)&1 for j in range(n)]
    for idq, dq in enumerate(denq):
        counts = 0
        for s in dq:
            counts += switch_states[s]
        if counts%2 != P[idq]:
            break
    else:
        ans += 1
print(ans)


Measured memory_bytes: 9212
#include <iostream>

using namespace std;

int main(){
    string s;
    cin>>s;
    bool ok = true;
    int ans = 1e9;
    
  
    for(int i=1;i<(int)s.length();i++){
        if(s[i]!=s[i-1]){
            ans = min(ans,max(i,(int)s.length()-i));
        }
    }
    if(ans == 1e9){
        cout<<s.length()<<endl;
        return 0;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}

int graph[55][55];
int N;

bool bfs(int s, int a, int b) {
    queue<int> q;
    vi visited(N, 0);
    q.push(s);
    visited[s] = true;
    while(!q.empty()) {
        int now = q.front();
        q.pop();
        rep(i, N) {
            if((now==a && i==b) || (now==b && i==a)) continue;
            if(!visited[i] && graph[now][i]) {
                q.push(i);
                visited[i] = 1;
            }
        }
    }

    bool res = true;
    rep(i, N) {
        if(!visited[i]) res = false;
    }
    return res;
}

signed main() {
    int M;
    cin >> N >> M;
    V(P) inp(M);
    rep(i, M) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        graph[a][b] = 1;
        graph[b][a] = 1;
        inp[i] = P(a, b);
    }

    int res = 0;
    int s = 0;
    rep(i, M) {
        int a = inp[i].fi, b = inp[i].se;
        if(!bfs(s, a, b)) res++;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
if(((x in a) and (y in a)) or ((x in b) and (y in b)) or ((x in c) and (y in c))):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
N, K = map(int, input().split())
array = [0 for _ in range(10**5)]
for _ in range(N):
    a, b = map(int, input().split())
    array[a-1] += b

num = 0
for i in range(len(array)):
    num += array[i]
    if num >= K:
        print(i+1)
        break


Measured memory_bytes: 5924
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>

using namespace std;
using namespace __gnu_pbds;

#define endl '\n'

typedef long long ll;
typedef pair<int, int> pii;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

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

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	string a, b;
	cin >> a >> b;
	
	cout << b + a << endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#define maxn 100005
using namespace std;

int h[maxn], dp[maxn];

// define dp[i] as the minimum cost from 0 to i - 1
// dp[i] = min(dp[i - 1] + abs(h[i - 2] - h[i]), 
//             dp[i - 2] + abs(h[i - 2] - h[i]))

int main(){
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i){
        cin >> h[i];
    }
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);
    for (int i = 2; i < n; ++i){
        dp[i] = min(dp[i - 1] + abs(h[i - 1] - h[i]), 
                    dp[i - 2] + abs(h[i - 2] - h[i]));
    }
    cout << dp[n - 1] << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cctype>

using std::cout;
using std::cin;
using std::endl;

int main()
{
    char raw;
    while ((raw = cin.get()) != '\n') {
        char capital = toupper(raw);
        char small = tolower(raw);
        if (raw == capital) {
            cout << small;
        } else {
            cout << capital;
        }
    }
    cout << endl;

    return 0;
}

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

int main()
{
  int n;
  cin >> n;
  vector<int> ans(n);

  for (int i = 0; i < n - 1; i++) {
    int t;
    cin >> t;
    ans[t - 1]++;
  }

  for (auto&& e : ans) {
    cout << e << endl;
  }
}


Measured memory_bytes: 4060
#include<bits/stdc++.h>
using namespace std;
int n,m,a[1000001],b[1000001];
bool f=true;
inline int read()
{
   int sum=0,x=1;
   char ch=getchar();
   while (ch<'0'||ch>'9')
   {
       if (ch=='-')
	     x=-1;
	   ch=getchar();
   }
   while (ch>='0'&&ch<='9')
   {
   	   sum=sum*10+ch-'0';
	   ch=getchar();
   }
   return sum*x;
}
inline void write(int x)
{
    if (x<0)
	{
        putchar('-');
        x=-x;
    }
    if (x>9)
      write(x/10);
    putchar(x%10+'0');
    return;
}
inline int find(int x)
{
    if (a[x]==x)
      return x;
    int r=find(a[x]);
    b[x]=b[a[x]]+b[x];
    return a[x]=r;
}
inline bool dfs(int x,int y,int z)
{
    int fx=find(x);
    int fy=find(y);
    if (fx==fy)
      return z==b[y]-b[x];
    a[fy]=fx;
    b[fy]=b[x]+z-b[y];
    return true;
}
int main()
{
    n=read();m=read();
    for (register int i=1;i<=n;++i)
      a[i]=i;
    for (register int i=1;i<=m;++i)
    {
    	int x,y,z; 
		x=read();y=read();z=read();
    	if (f)
    	  f=dfs(x,y,z);
	}
    if (f)
      cout<<"Yes\n";else
      cout<<"No\n";
    return 0;
} 

Measured memory_bytes: 4440
// ABC073 D-joisino's travel ワーシャルフロイド
// https://atcoder.jp/contests/abc073/tasks/abc073_d
// はまりポイント１　next_permutationは、sort(r.begin(),r.end());　してから使う
// はまりポイント２　cost[i][j] = INT_MAX; INT_MAX+INT_MAXすると・・・・
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    int N, M, R;
    cin >> N >> M >> R;
    vector<int> r;
    for(int i = 0; i < R; i++) {
        int temp;
        cin >> temp;
        r.push_back(temp);
    }
    int cost[N + 1][N + 1];
    for(int i = 0; i <= N; i++) {
        for(int j = 0; j <= N; j++) {
            if(i == j) {
                cost[i][j] = 0;
            } else {
                cost[i][j] = INT_MAX/2;
            }
        }
    }
    for(int i = 0; i < M; i++) {
        int A, B, C;
        cin >> A >> B >> C;
        cost[A][B] = C;
        cost[B][A] = C;
    }
    for(int k = 1; k <= N; ++k) {
        for(int i = 1; i <= N; ++i) {
            for(int j = 1; j <= N; ++j) {
                cost[i][j] = min(cost[i][j], cost[i][k] + cost[k][j]);
            }
        }
    }
    int min = INT_MAX;
    sort(r.begin(),r.end());
    do {
        int tempcost = 0;
        for(int i = 1; i < r.size(); i++) {
            tempcost += cost[r[i - 1]][r[i]];
        }
        if(tempcost < min)
            min = tempcost;
    } while(next_permutation(r.begin(), r.end()));

    cout << min << endl;
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
using Graph = vector<vector<int>>;
int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n,m;
    cin>>n;
    map<string,int>s;
    string S;
    rep(i,n){
        cin>>S;
        s[S]++;
    }
    cin>>m;
    rep(i,m){
        cin>>S;
        s[S]--;
    }
    int ans=0;
    for(auto i:s){
        ans=max(ans,i.second);
    }
    cout<<ans<<endl;

    return 0;
}


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


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; }
#define rep(i,n) for(int i=0; i<(int)n; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define COUT(x) cout << x << endl;
#define PB(x) push_back(x)
int gcd(int a,int b){return b?gcd(b,a%b):a;}
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int INF = 1e9;
const int MOD = 1e9+7;

signed main(){
   int n; cin >> n;
   vector<int> a(n);
   vector<vector<int>> x(n),y(n);
    rep(i,n){
        cin >> a[i];
        x[i].resize(a[i]);
        y[i].resize(a[i]);
        rep(j,a[i]){
            cin >> x[i][j] >> y[i][j];
            x[i][j]--;
        }
    } 

    int res=0;
    

    for(int bit=0; bit<(1<<n); bit++){
        bool can=true;
        for(int i=0; i<n; i++){
            //iが正直者なら
            if(bit&(1<<i)){
                for(int j=0; j<x[i].size(); j++){
                    //矛盾が生じた時
                    //if(  (bit&(1<<x[i][j]))^y[i][j]  ) can=false;
                    if(  ((bit>>x[i][j])&1)^y[i][j]  ) can=false;
                }
            }
        }
        if(can) chmax(res,__builtin_popcount(bit));
    }
    cout<<res<<endl;
}

Measured memory_bytes: 256
#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
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;

int MOD = 998244353;

ll v[200100] = {0};
vector<ll> G[200010];
int used[200010] = {0};

void dfs(ll x){
    used[x] = 1;
    for(auto xx:G[x]){
        if(used[xx] == 0){
            v[xx] += v[x];
            dfs(xx);
        }
    }
    return;
}


signed main(){

    ll n,q;
    cin >> n >> q;
    rep(i,n-1){
        ll a,b;
        cin >> a >> b;
        a--;b--;
        G[a].pb(b);
        G[b].pb(a);
    }
    rep(i,q){
        ll p,x;
        cin >> p >> x;
        v[p-1] += x;
    }
    dfs(0);
    rep(i,n)cout << v[i] << " ";
    cout << endl;


    return 0;
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://cf17-final-open.contest.atcoder.jp/tasks/cf17_final_a
// rm -r -f test;oj dl http://abc138.contest.atcoder.jp/tasks/abc138_b

Measured memory_bytes: 22656
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string S;
	cin >> S;
	vector<int> C(3, 0);
	bool f = false;
	for (int i = 0; i < S.size(); i++) {
		C[(int)(S[i] - 'a')]++;
	}
	sort(C.begin(), C.end());
	if (C[2] - C[0] <= 1) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}
	
}

Measured memory_bytes: 512
#include <iostream>
#include <cstring>
#define prim 1000000007
#define LL long long
using namespace std;

LL N,M,a[3010],C[3010][3010],inv[3010],l[3010],r[3010],K,dp[3010],s[3010],ndp[3010];

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> N >> M;

    int i,j; char c;
    s[0]=0;
    for (i=1; i<=N; i++){
        cin >> c;
        a[i]=c-'0';
        s[i]=s[i-1];
        if (a[i]==0) s[i]++;
    }

    C[0][0]=1;
    for (i=1; i<=N; i++){
        C[i][0]=1;
        for (j=1; j<=i; j++)
            C[i][j]=(C[i-1][j]+C[i-1][j-1])%prim;
    }

    inv[1]=1;
    for (i=2; i<=N; i++){
        inv[i]=(-inv[prim%i]*(prim/i))%prim;
        inv[i]+=prim;
    }

    for (i=1; i<=M; i++){
        K++;
        cin >> l[K] >> r[K];
        if (r[K]<=r[K-1]) K--;
        else if (l[K]==l[K-1]){
            l[K-1]=l[K],r[K-1]=r[K],K--;
        }
    }

    LL res=1,aux,cnt=0,len,k;


    for (i=1; i<=K; i++){
        if (r[i]<l[i+1] || i==K){
            aux=0;
            if (cnt==0)
                res=(res*C[r[i]-l[i]+1][s[r[i]]-s[l[i]-1]])%prim;
            else{
                for (j=0; j<=r[i-1]-l[i]+1; j++)
                    aux=(aux+dp[j]*C[r[i]-l[i]+1][s[r[i]]-s[r[i-1]]+j])%prim;
                res=(res*aux)%prim;
            }
            cnt=0;
        }
        else{
            if (cnt==0){
                memset(dp,0,sizeof(dp));
                for (j=0; j<=r[i]-l[i+1]+1 && j<=s[r[i]]-s[l[i]-1]; j++)
                    dp[j]=C[l[i+1]-l[i]][s[r[i]]-s[l[i]-1]-j];
            }
            else{
                memset(ndp,0,sizeof(ndp));
                len=r[i]-l[i+1]+1;
                for (j=0; j<=len; j++)
                    for (k=0; k<=r[i-1]-l[i]+1; k++){
                        if (k+s[r[i]]-s[r[i-1]]<j) continue;
                        ndp[j]=(ndp[j]+dp[k]*C[r[i]-l[i]+1-len][k+s[r[i]]-s[r[i-1]]-j])%prim;
                    }

                memset(dp,0,sizeof(dp));
                for (j=0; j<=len; j++)
                    dp[j]=ndp[j];

            }
            cnt++;
        }
    }

    cout << res << "\n";
    return 0;
}


Measured memory_bytes: 46592
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

template <class T>
class CuSum {
private:
	vector<T> cusum;

public:
	CuSum(vector<T> const &vec) : cusum(vec.size() + 1) {
		for (int i = 0; i < (int)vec.size(); i++) cusum[i + 1] = cusum[i] + vec[i];
		DMP(cusum);
	}
	CuSum(const int N) : cusum(N + 1) {}
	void add(const int i, const T &x) { cusum[i + 1] += x; }
	void build() { for (int i = 0; i < (int)cusum.size() - 1; i++) cusum[i + 1] += cusum[i]; }

	// partial sum of 0-indexed [l, r)
	T operator()(int l, int r) {
		if (r < l || r < 0) {
			assert(0);
			return T(0);
		}
		else return cusum[r] - cusum[l];
	}
	// 0-indexed
	const T &operator[](int i) { return cusum[i + 1]; }
	T back() { return cusum.back(); }
};

int main() {

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

	int N, K;
	cin >> N >> K;

	vector<lint> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	CuSum<lint> cuA(A);

	map<lint, vector<lint>> mp;
	for (int i = 0; i <= N; i++) mp[(cuA(0, i) - (i + 1) % K + K) % K].emplace_back(i);

	lint ans = 0;
	for (const auto &e : mp) {
		auto vec = e.second;
		for (int i = 0; i < vec.size(); i++) {
			ans += lower_bound(vec.begin(), vec.end(), vec[i] + K) - vec.begin() - i - 1;
		}
	}

	cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 25216
N = gets.chomp.to_i
X = gets.chomp.split().map(&:to_i)
sorted_X = X.sort

ml = sorted_X[sorted_X.length/2 - 1]
mr = sorted_X[sorted_X.length/2]

X.each do |x|
  puts(x <= ml ? mr : ml)
end


Measured memory_bytes: 36924
import copy

class Card:
    def __init__(self):
        self.suit = ''
        self.value = 0

def bubbleSort(C, N):
    for i in reversed(range(N)):
        for j in range(i):
            if C[j].value > C[j+1].value:
                C[j], C[j+1] = C[j+1], C[j]

def selectionSort(C, N):
    for i in range(N):
        minj = i
        for j in range(i, N):
            if C[j].value < C[minj].value:
                minj = j
        C[i], C[minj] = C[minj], C[i]

def isSame(C1, C2, N):
    for i in range(N):
        if C1[i].suit != C2[i].suit:
            return False
    return True

def main():
    N = int(input())
    list = input().split(" ")
    
    cards1 = []
    for i in range(N):
        card = Card()
        card.suit = list[i][0]
        card.value = int(list[i][1:])
        cards1.append(card)
    cards2 = copy.deepcopy(cards1)

    bubbleSort(cards1, N)
    selectionSort(cards2, N)

    for c in cards1:
        if c == cards1[len(cards1)-1]:
            print(c.suit + str(c.value))
            print("Stable")
        else:
            print(c.suit + str(c.value), end=" ")

    for c in cards2:
        if c == cards2[len(cards2)-1]:
            print(c.suit + str(c.value))
            if isSame(cards1,cards2,N):
                print("Stable")
            else:
                print("Not stable")
        else:
            print(c.suit + str(c.value), end=" ")

if __name__ == "__main__":
    main()


Measured memory_bytes: 6348
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vl = vector<long>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvb = vector<vector<bool>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
using pll = pair<long, long>;
#define fix20 cout << fixed << setprecision(20);
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define MOD 1000000007

int main(){
  int x;
  cin >> x;
  if(x < 100){
    cout << 0 << endl;
    return 0;
  }
  long tmp = 0;
  rep(a,1001){
    tmp += 100*a;
    if(tmp > x) {
      tmp -= 100*a;
      break;
    }
    rep(b,1001){
      tmp += 101*b;
      if(tmp > x) {
        tmp -= 101*b;
        break;
      }
      rep(c,1001){
        tmp += 102*c;
        if(tmp > x) {
          tmp -= 102*c;
          break;
        }
        rep(d,1001){
          tmp += 103*d;
          if(tmp > x) {
            tmp -= 103*d;
            break;
          }
          rep(e,1001){
            tmp += 104*e;
            if(tmp > x) {
              tmp -= 104*e;
              break;
            }
            rep(f,1001){
              tmp += 105*f;
              if(tmp > x) {
                tmp -= 105*f;
                break;
              }
              if(tmp == x){
                cout << 1 << endl;
                return 0;
              }
              tmp -= 105*f;
            }
            tmp -= 104*e;
          }
          tmp -= 103*d;
        }
        tmp -= 102*c;
      }
      tmp -= 101*b;
    }
    tmp -= 100*a;
  }
  cout << 0 << endl;
}


Measured memory_bytes: 256
func (_:_:(-1):_) = []
func (a:b:n:_) = let m = a`div`b
             in m : (func [((a-(m*b))*10), b, (n-1)])

main = do{
    getContents>>=mapM_ print.map (sum.tail.func.map (read::String->Int).words).lines;
}

Measured memory_bytes: 4132
#include<bits/stdc++.h>
using namespace std;
long long n,m,v,p,a[100005];
bool cmp(long long x,long long y){
	return x>y;
}
bool check(long long x){
	v=v-(n-x);
	long long lastn=m*v-m,bgt=0,sum=0;
	v=v+(n-x);
	vector<long long>vv;
	for(int i=1;i<x;i++)
		if(a[x]+m<a[i])
		{
			bgt++;
			if(bgt>=p)
				return 0;
			lastn-=m;
		}
		else
			vv.push_back(a[i]);
	if(lastn<=0)return 1;
	sort(vv.begin(),vv.end(),cmp);
	for(int i=0;i<p-1-bgt;i++)
		sum+=m;
	for(int i=p-bgt-1;i<vv.size();i++)sum+=(m-vv[i]+a[x]);
	if(sum>=lastn)return 1;
	return 0;
}
int main(){
	scanf("%lld%lld%lld%lld",&n,&m,&v,&p);
	for(long long i=1;i<=n;i++)scanf("%lld",a+i);
	sort(a+1,a+n+1,cmp);
	long long l=p,r=n;
	while(l!=r){
		long long mid=(l+r)/2;
		if(check(mid))
			l=mid;
		else
			r=mid-1;
		if(check(r)==0)r--;
		if(check(l+1))l++;
	}
	cout<<l;
}

Measured memory_bytes: 2892
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

k = int(input())
print(a[k - 1])

Measured memory_bytes: 2940
while True:
    n, x = list(map(int, input().split()))
    if n == 0 and x == 0:
        break

    count = 0
    for x1 in range(1, n + 1):
        for x2 in range(x1 + 1, n + 1):
            for x3 in range(x2 + 1, n + 1):
                if x1 + x2 + x3 == x:
                    count += 1
    print(count)


Measured memory_bytes: 5596
from bisect import *
N=int(input())
A=list(map(int,input().split()))
B=[0]*(N+1)
for i in range(N):
  B[A[i]]+=1
C=[0]*(N+1)
for i in range(N+1):
  C[B[i]]+=1
D=[0]
E=[0]
for i in range(N+1):
  D.append(D[i]+i*C[i])
  E.append(E[i]+C[-i-1])
E=E[::-1]
F=[]
for i in range(1,N+1):
  F.append((D[i+1]//i)+E[i+1])
F=F[::-1]
for i in range(N):
  print(N-bisect_left(F,i+1))

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

int main(){
  int n;
  cin >> n;
  int const cake = 4, donut = 7;
  int i = 0;
  while(cake*i<=n){
    int j=0;
    while(cake*i+donut*j<=n){
      if(cake*i+donut*j == n){
        cout << "Yes" << endl;
        return 0;
      }
      j++;
    }
    i++;
  }
  cout << "No" << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n)for(int i=0;i<(n);i++)
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;

int main(){
    string s, t; cin >> s >> t;
    sort(ALL(s));
    sort(RALL(t));
    if(s < t) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#ifdef rd
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char *names, Arg1 &&arg1, Args &&... args) {
	const char *comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
#else
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef float f80;
#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
//const int mod=998244353;
const int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int powm(int a, int b, int mod) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

    int arr[200005];

void solve()
{

  int n;
  cin>>n;
 bool ans=true;
  for(int j=0; j<n; j++){
  cin>>arr[j];
  }
  int maxx=arr[0];
for(int i=0; i<n-1; i++)
  {
      if(arr[i]>maxx)
        maxx=arr[i];
      if((arr[i]-arr[i+1] )>1 || (maxx-arr[i+1])>1)// && (arr[i+1]-arr[i+2] )<-1 )
      {

          ans=false;
          break;
      }


  }
  if(ans)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;

/*
    ll n;
    cin>>n;
    if(n<10)
        cout<<n;
    else if(n<100)
        cout<<"9";
    else if(n<1000)
        cout<<n-100+1+9;
    else if(n<10000)
        cout<<900+9;
    else
        cout<<n-10000+1+899+9;
*/


}


signed main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(10);
	int t=1;
 	//cin>>t;
	fr(i,1,t) {
		solve();
	}
#ifdef rd
	cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}
/// template by rahuldugar



Measured memory_bytes: 1024
/****Author: Barish Namazov****/
#include <bits/stdc++.h>

using namespace std;

/***TEMPLATE***/
#define intt long long
#define pii pair<intt,intt>

#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

#define F first
#define S second
#define pb push_back

#define IO ios_base::sync_with_stdio(false);cin.tie();
#define endl '\n'

const intt max4 = 10004;
const intt maxx = 100005;
const intt max6 = 1000006;
const intt max7 = 10000007;

const intt lg4 = 13;
const intt lg5 = 17;
const intt lg6 = 20;

const intt INF = 2LL * 1000000000;

/***************/

intt powmod (intt a, intt b, intt mod) {
    intt res = 1;
    a %= mod;
    for (; b; b >>= 1) {
        if (b & 1)
            res = (res * a) % mod;
        a = (a * a) % mod;
    }
    return res;
}

intt gcd (intt a, intt b) {
    while (b > 0) {
        intt t = a % b;
        a = b, b = t;
    }
    return a;
}

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

intt is_prime (intt n) {
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (intt i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}

/**************************/

intt cnt[maxx];
int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    IO;
    intt n, x;
    cin >> n;
    for (intt i = 1; i <= n; i++) {
        cin >> x; cnt[x - 1] ++, cnt[x] ++, cnt[x + 1] ++;
    }
    intt res = 0;
    for (intt i = -1; i < maxx; i++)
        res = max (res, cnt[i]);
    cout << res << endl;
    return 0;
}


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

long long gcd(long long a, long long b) //GCDを求める. Euclidの互除法を再帰関数で実装する. ベースケースはa = p * bでresidue = 0
{
	if (a%b==0)
	{
		return(b);
    }
	else
	{
		return(gcd(b,a%b));
    }
}

long long lcm(long long a, long long b){
    return a  / gcd(a, b) * b; //LCMの求め方: LCM * GCD = a * bより求める //a * b / gcdとするとオーバーフローを起こすため注意せよ
}

int main(void){
    int n;
    std::cin >> n;

    std::vector<long long> t(n);
    for(int i = 0; i < n; i++){
        std::cin >> t[i];
    }

    long long lowest_common_multiple = 1;
    for(int i = 0; i < n; i++){
        lowest_common_multiple = lcm(t[i], lowest_common_multiple); //２つの数に対してCMを順次求めて, LCMを更新していく
    }
    std::cout << lowest_common_multiple << std::endl;
    return 0;
}

Measured memory_bytes: 256
import sys
import itertools
# import numpy as np
import time
import math

sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

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

S = input()

ans = [0 for i in range(len(S))]

i = 0
while i < len(S):
    rc = 0
    lc = 0
    pos = 0
    while i < len(S) and S[i] != 'L':
        rc += 1
        i += 1
    pos = i
    while i < len(S) and S[i] != 'R':
        lc += 1
        i += 1
    ans[pos] += rc // 2
    ans[pos - 1] += rc // 2 + rc % 2
    ans[pos - 1] += lc // 2
    ans[pos] += lc // 2 + lc % 2

print(" ".join(map(str, ans)))

Measured memory_bytes: 52268
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()
#define ll long long
using namespace std;
using vll = vector<long long>;
using vvll = vector<vll>;

long long combi(long long n, long long k) {
  if (n == k || k == 0)
    return 1;
  else {
    return combi(n - 1, k - 1) + combi(n - 1, k);
  }
}

int main(){
  ll N,P;
  cin>>N>>P;
  ll odd=0;
  ll even=0;
  ll a;
  rep(i,N){
    cin>>a;
    if(a%2==0) even++;
    else odd++;
  }
  ll oddans=0;
  ll i;
  if(P==1) i=1;
  else i=0;
  while(true){
      if(i>odd) break;
      oddans+=(combi(odd,i));
      i+=2;
  }
  rep(j,even){
    oddans*=2;
  }
  cout<<oddans<<endl;
}


Measured memory_bytes: 256
/* https://codeforces.com/contest/1360/problem/H */
#include<bits/stdc++.h>

using namespace std;
using ll = long long;
using vs = vector<string>;
using vi = vector<int>;
using vl = vector<ll>;
using vb = vector<bool>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using vpi = vector<pair<int, int>>;
using vpl = vector<pair<ll, ll>>;
using ld = double;

#define f first
#define s second 
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)
#define pb push_back
#define	lb lower_bound
#define	ub upper_bound
#define	sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
#define ins insert

const int MAX = INT_MAX;

int main() {
	int N;
	cin>>N;
	int cnt = 0;
	for (int i = 0;i < N;++i) {
		int x, y;
		cin>>x>>y;
		if (x == y) cnt++;
		else cnt = 0;
		if (cnt == 3) {
			cout<<"Yes"<<endl;
			return 0;
		}
	}

	cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#define MOD 1000000007
using namespace std;
typedef long long ll;

int main(void) {
	int num, i;
	ll ans = 1;
	cin >> num;
	vector<int> s(num), t(num), ss(num, false), tt(num, false);
	for (i = 0; i < num; i++)
		scanf("%d", &s[i]);
	for (i = 0; i < num; i++)
		scanf("%d", &t[i]);
	for (i = num - 1; i > 0; i--) {
		if (s[i] != s[i - 1])
			ss[i] = true;
	}
	for (i = 0; i < num - 1; i++) {
		if (t[i] != t[i + 1])
			tt[i] = true;
	}
	ss[0] = true;
	tt[num - 1] = true;
	for (i = 0; i < num; i++) {
		if (ss[i]) {
			if (s[i] > t[i])
				ans = 0;
			if (tt[i] && s[i] != t[i])
				ans = 0;
			s[i] = 1;
		}
		else if (tt[i]) {
			if (t[i] > s[i])
				ans = 0;
			t[i] = 1;
		}
		ans *= (ll)min(s[i], t[i]);
		ans %= MOD;
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
 
#define int long long
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}
 
int N,M;
int A[50],B[50];
const int INF=1001001001001001001ll;
 
int memo[55][55][105][2][2];
int dfs(int a,int b,int s,int p,int f,int sumA,int sumB){
    int &ret=memo[a][b][s][p][f];
    if(ret!=-INF)return ret;
 
    if(!p){
        ret=-INF;
        if(a){
            if(A[a-1]>=0)chmax(ret,dfs(a-1,b,s+1,1,0,sumA+A[a-1],sumB));
            else chmax(ret,dfs(a-1,b,s+1,1,0,sumA,0));
        }
        if(s){
            chmax(ret,dfs(a,b,0,1,0,0,0)+sumA-sumB);
        }
        else{
            if(!f)chmax(ret,dfs(a,b,0,1,1,0,0));
            else chmax(ret,0);
        }
    }
 
    else{
        ret=INF;
        if(b){
            if(B[b-1]>=0)chmin(ret,dfs(a,b-1,s+1,0,0,sumA,sumB+B[b-1]));
            else chmin(ret,dfs(a,b-1,s+1,0,0,0,sumB));
        }
        if(s){
            chmin(ret,dfs(a,b,0,0,0,0,0)+sumA-sumB);
        }
        else{
            if(!f)chmin(ret,dfs(a,b,0,0,1,0,0));
            else chmin(ret,0);
        }
    }
    return ret;
}
 
signed main(){
    cin>>N>>M;
    rep(i,N)cin>>A[i];reverse(A,A+N);
    rep(i,M)cin>>B[i];reverse(B,B+M);
 
    fill_n(****memo,55*55*105*2*2,-INF);
    cout<<dfs(N,M,0,0,0,0,0)<<endl;
    return 0;
}

Measured memory_bytes: 13000