akhauriyash/Code-Regression huggingface dataset:
/* ****mittal**** */
#include<bits/stdc++.h>
#define ll          long long int 
#define pb          push_back
#define endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define repr(i,a,b)   for(ll int i=a;i>=b;i--)
#define lbnd    lower_bound
#define ubnd        upper_bound
#define mp          make_pair
using namespace std;
 
#define N  100005
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int TESTS=1;   
   //  cin>>TESTS;
    while(TESTS--)
    {
       ll n;
       cin>>n;
       ll b[105];
       for(int i=1;i<=n-1;i++)
       {
       	 cin>>b[i];
       }
       ll ans=b[1];
       ll x=b[1];
       for(int i=2;i<=n-1;i++)
       {
       	  if(b[i]>=x)
       	  {
       	  	 ans+=x;
       	  	 x=b[i];
       	  }
       	  else
       	  {
       	  	ans+=b[i];
       	  	x=b[i];
       	  }
       }
       ans+=x;
       cout<<ans;
    }

    return 0;
}

Measured memory_bytes: 256
Uses math;
var
	n,i,z,w,a,b:Longint;
begin
	read(n,z,w,b);
	if n=1 then begin
		writeln(abs(b-w));
		exit;
	end;
	for i:=2 to n do begin
		a:=b;
		read(b);
	end;
	writeln(Max(abs(b-w),abs(a-b)));
end.


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,l;
  cin >> n >> l ;
  string s[n];

  for(int i=0;i<n;i++){
    cin >> s[i];
  }
  sort(s, s+n);
  for(int i=0;i<n;i++){
  	cout << s[i];
  }
  cout << endl;
}

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

int main()
{
  int n, a[20], b[20], c[20], count=0;
  cin >> n;
  for(int i=0; i<n; ++i){
    cin >> a[i];
    --a[i];
  }
  for(int i=0; i<n; ++i) cin >> b[i];
  for(int i=0; i<n-1; ++i) cin >> c[i];
  
  for(int i=0; i<n; ++i){
    count += b[a[i]];
    if(a[i] == a[i-1]+1) count += c[a[i-1]];
  }
  cout << count << endl;
}


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

bool G[200001];
bool S[200001];
int main() {
    int N, M; cin >> N >> M;
    rep (i,M) {
        int a, b;
        cin >> a >> b;
        if (a == 1) S[b] = true;
        if (b == N) G[a] = true;
    }
    for (int i = 1; i <= N; i++) {
        if (S[i] && G[i]) {
            cout << "POSSIBLE" << endl;
            return 0;
        }
    }
    cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>

#include <algorithm>

using namespace std;

int main() {
	int n, l;
	cin >> n >> l;
	vector<string> words;
	for(int i = 0; i < n; i++) {
		string s;
		cin >> s;
		words.push_back(s);
	}

	sort(words.begin(), words.end());

	string ans;
	
	for(auto itr = words.begin(); itr != words.end(); itr++) {
		ans += *itr;
	}

	cout << ans;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 998244353
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

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

    int n;cin>>n;
    string s;cin>>s;
    int m=3*n;

    ll ans=1;
    for(ll i=1;i<=n;i++) ans=ans*i%mod;
    ll r=0,g=0,b=0,rg=0,gb=0,br=0;
    rep(i,m){
        if(s[i]=='R'){
            if(gb){
                ans=ans*gb%mod;
                gb--;
            }
            else if(g){
                ans=ans*g%mod;
                g--;
                rg++;
            }
            else if(b){
                ans=ans*b%mod;
                b--;
                br++;
            }
            else{
                r++;
            }
        }
        if(s[i]=='G'){
            if(br){
                ans=ans*br%mod;
                br--;
            }
            else if(r){
                ans=ans*r%mod;
                r--;
                rg++;
            }
            else if(b){
                ans=ans*b%mod;
                b--;
                gb++;
            }
            else{
                g++;
            }
        }
        if(s[i]=='B'){
            if(rg){
                ans=ans*rg%mod;
                rg--;
            }
            else if(r){
                ans=ans*r%mod;
                r--;
                br++;
            }
            else if(g){
                ans=ans*g%mod;
                g--;
                gb++;
            }
            else{
                b++;
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 720
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define MOD 1000000007
typedef long long ll;
typedef pair<int,int> P;
#define int long long
#define All(v) (v.begin(),v.end())
int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int lcm(int a, int b) {
	return a / gcd(a, b)*b;
}
int modpow(int a,int b){
    if(!b)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    return modpow(a,b/2)*modpow(a,b/2)%MOD;
}
int fac(int a){
    int Ans=1;
    for(int i=1;i<=a;i++){
        Ans*=i;
        Ans%=MOD;
    }
    return Ans;
}//kaijo
int comb(int a,int b){
    return fac(a)*modpow(fac(a-b),MOD-2)%MOD*modpow(fac(b),MOD-2)%MOD;
}
signed main(){
	int n,a,b,c;
	cin>>n>>a>>b>>c;
	cout<<n-(a+b-c)<<endl;
	return 0;
}




Measured memory_bytes: 3108
#include "bits/stdc++.h"
using namespace std;

#define DEBUG(x) cout<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cout<<#v<<":";for(int i=0;i<v.size();i++) cout<<" "<<v[i]; cout<<endl

typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
const int inf = 1000000001;
const ll INF = 2e18;
const ll MOD = 1000000007;
const ll mod = 1000000009;
const double pi = 3.14159265358979323846;
#define Sp(p) cout<<setprecision(15)<< fixed<<p<<endl;
int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };


#define N 250
vii M(N, vi()); //グラフの隣接リスト表現
vi match(N); //マッチングのペア
vector<bool> used(N); //DFSですでに調べたかのフラグ
int n, m;
vi color(N, -1);

//二部グラフかどうかを判断
bool bipartite() {
	stack<int> st;
	color[0] = 0;
	st.push(0);
	int i, j;
	while (!st.empty()) {
		i = st.top();
		st.pop();
		for (j = 0; j < M[i].size(); j++) {
			if (color[M[i][j]] == color[i]) {
				//cout << "NO" << endl;
				return false;
			}
			else {
				if (color[M[i][j]] == -1) {
					color[M[i][j]] = 1 - color[i];
					st.push(M[i][j]);
				}
			}
		}
	}
	//cout << "YES" << endl;
	return true;
}

//マッチングに使う
bool dfs(int v) {
	used[v] = true;
	for (int i = 0; i < M[v].size(); i++) {
		int u = M[v][i], w = match[u];
		if (w < 0 || !used[w] && dfs(w)) {
			match[v] = u;
			match[u] = v;
			return true;
		}
	}
	return false;
}

//二部グラフの最大マッチングを求める
//二部グラフの最大マッチング = 最小点カバー = n-最小辺カバー = n-最大安定集合
int bipartite_matching() {
	int res = 0;
	fill(match.begin(), match.end(), -1);
	for (int v = 0; v < n; v++) {
		if (match[v] < 0) {
			fill(used.begin(), used.end(), 0);
			if (dfs(v)) {
				res++;
			}
		}
	}
	return res;
}



int main() {
	int n0;
	cin >> n0;
	vector<pii> rxy(n0), bxy(n0);
	rep(i, n0) {
		cin >> rxy[i].first >> rxy[i].second;
	}
	rep(i, n0) {
		cin >> bxy[i].first >> bxy[i].second;
	}
	n = 2 * n0;
	rep(i, n0) {
		rep(j, n0) {
			if (rxy[i].first < bxy[j].first && rxy[i].second < bxy[j].second) {
				M[i].push_back(j + n0);
				M[j + n0].push_back(i);
			}
		}
	}
	cout << bipartite_matching() << endl;
}

Measured memory_bytes: 256
MOD = 10 ** 9 + 7


def comb(n, k):
    N = n + k + 1
    fact = [1] * (N + 1)
    rfact = [1] * (N + 1)
    r = 1
    for i in range(1, N + 1):
        fact[i] = r = r * i % MOD

    rfact[N] = r = pow(fact[N], MOD - 2, MOD)
    for i in range(N, 0, -1):
        rfact[i - 1] = r = r * i % MOD
    return fact[n] * rfact[k] * rfact[n - k] % MOD


X, Y = map(int, input().split())
x = 2 * X - Y
y = 2 * Y - X

if (x % 3 and y % 3) or x < 0 or y < 0:
    print(0)
else:
    xx = x // 3
    yy = y // 3
    print(comb(xx + yy, xx))

Measured memory_bytes: 54256
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <bitset>
#include <utility>
#include <functional>
#include <numeric>
#include <limits>

template <class T>
using vec = std::vector<T>;

constexpr int nil = -1;
constexpr int inf = std::numeric_limits<int>::max();

struct Edge
{
    int to;
    int cost;

    bool operator<(const Edge& rhs) const
    {
        return cost < rhs.cost;
    }

    bool operator>(const Edge& rhs) const
    {
        return cost > rhs.cost;
    }
};



vec<int> dijkstra(const vec<vec<Edge>>& edges)
{
    using namespace std;

    const int n = edges.size();
    vec<int> distances(n, inf);
    vec<bool> reached(n, false);
    priority_queue<Edge, vector<Edge>, greater<Edge>> pqDist;

    pqDist.push({0, 0});

    while (true)
    {
        //始点からの最短点、コスト
        Edge d {nil, inf};

        //一番近い点を探す
        while (!pqDist.empty())
        {
            auto e = pqDist.top();
            pqDist.pop();

            if (!reached[e.to])
            {
                d = e;
                break;
            }
        }

        if (d.cost == inf)
            break;

        reached[d.to] = true;
        distances[d.to] = d.cost;

        for (auto& e : edges[d.to])
        {
            pqDist.push({e.to, d.cost + e.cost});
        }
    }

    return distances;
}

void solve()
{
    using namespace std;
    int n;
    cin >> n;

    //隣接リスト形式
    vec<vec<Edge>> edges(n);

    //入力
    for (int i = 0; i < n; ++i)
    {
        int v, k;
        cin >> v >> k;
        for (int j = 0; j < k; ++j)
        {
            int to, cost;
            cin >> to >> cost;
            edges[i].push_back({to, cost});
        }
    }

    auto d = dijkstra(edges);

    for (int i = 0; i < n; ++i)
    {
        cout << i << " " << d[i] << endl;
    }
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 11788
#include<stdio.h>

typedef struct {
  char mark;
  int value;
}kard;

void bubble (kard*,int);
void select (kard*,int);

int main(){
  kard A[36],B[36],C[36];
  int i,j,N,flag=0;

  scanf("%d",&N);
  for(i = 0 ; i < N;i++){
    scanf("%c",&A[i].mark);
    scanf("%c%d",&A[i].mark,&A[i].value);
    B[i] = A[i];
    C[i] = A[i];
  }
  bubble(B,N);
  printf("Stable\n");
  select(C,N);
  for(i = 0 ; i < N;i++){
    if(B[i].mark != C[i].mark) flag = 1;
      }
  if(flag == 1) printf("Not stable\n");
  else printf("Stable\n");
}

void bubble(kard* A,int N){
  kard num;
  int i,j;
  
for(i = 0; i < N; i++){
    for(j = N - 1; j > i ; j--){
      if(A[j].value < A[j-1].value){
	num = A[j-1];
	A[j-1] = A[j];
	A[j] = num;
      }
    }
  }
 for(i = 0 ; i < N;i++){
   if(i) printf(" ");
   printf("%c%d",A[i].mark,A[i].value);
 }
 printf("\n");
}

void select(kard* A,int N){
  kard num;
  int i,j,minj;
for(i = 0 ; i < N-1;i++){
    minj = i;
    for(j = i; j < N; j++){
      if(A[j].value < A[minj].value){
	minj = j;
      }
    }
    num = A[minj];
    A[minj] = A[i];
    A[i] = num;       
  }
 for(i = 0 ; i < N;i++){
   if(i) printf(" ");
   printf("%c%d",A[i].mark,A[i].value);
 }
 printf("\n");
}



Measured memory_bytes: 2064
def main():
    x1, y1, x2, y2 = map(int, input().split())
    habax = x1 - x2
    habay = y2 - y1
    x3, y3, y4, x4 = x1 - habax - habay, y2 - habax, y2 - habax - habay, x1 - habay
    print(x3, y3, x4, y4)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
import java.util.*;

public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    void run() {

        int n = sc.nextInt();
        int q = sc.nextInt();
        long[] a = new long[n];
        BIT bit = new BIT(n);
        for (int i=0; i<n; i++) a[i] = sc.nextLong();
        for (int i=0; i<n; i++) bit.add(i+1, a[i]);
        StringBuilder sb = new StringBuilder();
        for (int i=0; i<q; i++) {
            int t = sc.nextInt();
            if (t == 0) {
                int p = sc.nextInt();
                int x = sc.nextInt();
                bit.add(p+1, x);
            } else {
                int l = sc.nextInt();
                int r = sc.nextInt();
                long diff = bit.sum(r) - bit.sum(l);
                sb.append(diff + "\n");
            }
        }

        System.out.print(sb.toString());

    }

    class BIT {
        int n;
        long[] arr;

        public BIT(int n) {
            this.n = n;
            arr = new long[n + 1];
        }

        void add(int idx, long val) {
            for (int i = idx; i <= n; i += i & -i) {
//                System.out.print(i);
                arr[i] += val;
            }
        }

        long sum(int idx) {
            long sum = 0;
            for (int i = idx; i > 0; i -= i & -i) {
                sum += arr[i];
            }
            return sum;
        }
    }


}



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

using namespace std;

const int maxn = 110;

int n;
int arr[2][maxn];
int dp[2][maxn];

int main() {
    cin >> n;

    for(int i = 0; i < 2; i++) {
        for(int j = 0; j < n; j++) {
            cin >> arr[i][j];
        }
    }

    for(int i = n - 1; i >= 0; i--) {
        dp[1][i] = arr[1][i] + dp[1][i + 1];
        dp[0][i] = arr[0][i] + max(dp[1][i], dp[0][i + 1]);
    }

//    for(int i = 0; i < 2; i++) {
//        for(int j = 0; j < n; j++) {
//            cout << arr[i][j] << ' ';
//        }
//        cout << endl;
//    }

    cout << dp[0][0] << endl;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
S = str(input())
s_list = []
s_set = set()
for s in S:
    s_set.add(s)
    if s in s_list:
        s_list.remove(s)
    else:
        s_list.append(s)
        
if len(s_list) == 0 and len(s_set) == 2:
    print("Yes")
else:
    print("No")

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

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if(a + b > c + d) {
        cout << "Left" << endl;
    }
    else if(a + b < c + d) {
        cout << "Right" << endl;
    }
    else {
        cout << "Balanced" << endl;
    }
}


Measured memory_bytes: 3556
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define LLINF 1000000000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
ll N;
ll A[100100];
ll B[100100];
int main(){
	cin >> N;
	ll sum = 0ll;
	for(int i=0;i<N;i++){
		cin >> A[i];
		sum += A[i];
	}
	if(sum%(N*(N+1ll)/2ll)!=0ll){
		cout << "NO" << endl;
		return 0;
	}
	ll K = sum/(N*(N+1ll)/2ll);
	ll M = -LLINF;
	for(int i=0;i<N-1;i++){
		B[i] = A[i+1]-A[i];
		chmax(M,B[i]);
	}
	/*if(M<0ll){
		cout << "NO" << endl;
		return 0;
	}*/
	for(int i=0;i<N-1;i++){
		if((M-B[i])%N!=0ll){
			cout << "NO" << endl;
			return 0;
		}
	}
	if(M>=0ll){
		if(K-M<0ll || (K-M)%N!=0ll){
			cout << "NO" << endl;
			return 0;
		}
	}else{
		if(K-(N-1ll)*M<0ll || (K-(N-1ll)*M)%N!=0ll){
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long X = sc.nextLong();
		long K = sc.nextLong();
		long D = sc.nextLong();
		sc.close();

		//reigai
		if (X == 0) {
			if (K % 2 == 0) {
				System.out.println(Math.abs(0));
				return;
			} else {
				System.out.println(Math.abs(D));
				return;
			}
		}

		if (X < 0) {
			BigInteger a = new BigInteger(X+"").add(new BigInteger(K+"").multiply(new BigInteger(D+"")));
			if (a.compareTo(BigInteger.ZERO) < 0) {
				System.out.println(a.abs());
				return;
			}
			while (X < 0) {
				X = X + D;
				K--;
			}
			if (K % 2 == 0) {
				System.out.println(Math.abs(X));
				return;
			} else {
				System.out.println(Math.abs(X - D));
				return;
			}
		} else if (X > 0) {
			BigInteger a = new BigInteger(X+"").subtract(new BigInteger(K+"").multiply(new BigInteger(D+"")));
			if (a.compareTo(BigInteger.ZERO) > 0) {
				System.out.println(a.abs());
				return;
			}
			while (X > 0) {
				X = X - D;
				K--;
			}
			if (K % 2 == 0) {
				System.out.println(Math.abs(X));
				return;
			} else {
				System.out.println(Math.abs(X + D));
				return;
			}
		}
	}

}


Measured memory_bytes: 38764
#include <iostream>
#include <vector>
constexpr int MAX_N = 999;

int main() {
  int A, B;
  std::cin >> A >> B;

  std::vector<int> towers(MAX_N + 1);

  for (int i = 1; i <= MAX_N; i++) {
    towers[i] = towers[i-1] + i;
  }

  for (int i = 1; i <= MAX_N; i++) {
    const int x = towers[i] - A;

    if (x == towers[i + 1] - B) {
      std::cout << x << std::endl;
      break;
    }
  }
}


Measured memory_bytes: 256
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const n = nextInt()
    const a = nextIntArray()
    let b = []
    for(let i = 0; i<a.length; i++){
        b.push([i, a[i]])
    }
    b.sort((x,y) => x[1]-y[1])
    let ans = []
    for(let el of b){
        ans.push(el[0]+1)
    }
    console.log(ans.join(" "))
}
Main()


Measured memory_bytes: 64216
def main():
    N = int(input())
    P = list(map(int, input().split()))
    A = list(range(1, N + 1))
    x = 0

    if P == A:
        print("YES")
        return

    for i in range(len(P)):
        if P[i] != A[i]:
            x += 1

    if x == 2:
        print("YES")
    else:
        print("NO")

    return


if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
fn read<T: std::str::FromStr>() -> (T, T) {
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).ok();
    let mut iter = buf.split_whitespace().map(|x| x.parse().ok().unwrap());
    (iter.next().unwrap(), iter.next().unwrap())
}

fn main() {
    let (n, m) = read::<usize>();
    let mut v1 = vec![false; n + 1];
    let mut v2 = vec![false; n + 1];
    for _ in 0..m {
        let (a, b) = read::<usize>();
        if a == 1 {
            v1[b] = true;
        } else if b == n {
            v2[a] = true;
        }
    }
    if (1..n + 1).any(|i| v1[i] && v2[i]) {
        println!("POSSIBLE");
    } else {
        println!("IMPOSSIBLE");
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
using namespace std;
int n,a[101010],dp[101010],ans=0;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	int p=0,now=0;
	while(p<n-1)
	{
		p++;
		if(a[p]<=a[p-1])
		{
			now++;
		}
		else
		{
			ans=max(ans,now);
			now=0;
		}
	}
	cout<<max(ans,now)<<endl;
	return 0;
}

Measured memory_bytes: 640
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<list>
#include<set>
#include<cstring>
#include<string>
using namespace std;
int a[500005];
int main(){
    int n;
    scanf("%d",&n);
    while(n--){
        int x;
        scanf("%d",&x);
        a[x]++;
        a[x-1]++;
        a[x+1]++;
    }
    int maxv=0;
    for(int i=0;i<=500000;i++)
        if(a[i]>maxv)maxv=a[i];
    printf("%d",maxv);
    return 0;
} 

Measured memory_bytes: 640
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();

		do {
			c -= b;
			if(c <= 0) {
				System.out.print("Yes");
				return;
			}
			else {
				a -= d;
				if(a <= 0) {
					System.out.print("No");
					return;
				}
			}
		}while(a != 0 && c != 0);
	}
}

Measured memory_bytes: 26968
N = int(input())
xyh = [tuple(map(int, input().split())) for _ in range(N)]
for x in xyh:
    if x[2] > 0:
        base = x
        break
for i in range(101):
    for j in range(101):
        h = base[2] + abs(i-base[0]) + abs(j-base[1])
        for x in xyh:
            if x[2] != max(h-abs(i-x[0])-abs(j-x[1]),0):
                break
        else:
            print(i,j,h)
            exit()

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

int main() {
  int64_t N;
  cin >> N;
  vector<int64_t> L(N+2);
  L.at(0) = 2;
  L.at(1) = 1;
  for (int i =2; i<N+1; i++) {
    L.at(i) = L.at(i-1) + L.at(i-2);
  }
  cout << L.at(N) << endl;
}

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

const int MAX = 55;

class Student {
public:
    int x, y;
    int answer;
    vector<int> distance;
};


class Checkpoint {
public:
    int x, y;
    int sum;
};


int main()
{
    int n, m;
    cin >> n >> m;
    Student students[MAX];
    Checkpoint checkpoints[MAX];
    for (int i = 1; i <= n; i++) {
        cin >> students[i].x >> students[i].y;
    }
    for (int i = 1; i <= m; i++) {
        cin >> checkpoints[i].x >> checkpoints[i].y;
        checkpoints[i].sum = checkpoints[i].x + checkpoints[i].y;
    }

    /*n = 1; m = 4;
    students[1].x = 10; students[1].y = 10;
    checkpoints[1].x = 1; checkpoints[1].y = 2; checkpoints[1].sum = 3;
    checkpoints[2].x = 2; checkpoints[2].y = 3; checkpoints[2].sum = 5;
    checkpoints[3].x = 3; checkpoints[3].y = 5; checkpoints[3].sum = 8;
    checkpoints[4].x = 3; checkpoints[4].y = 5; checkpoints[4].sum = 8;*/

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            int temp = abs(students[i].x - checkpoints[j].x) + abs(students[i].y - checkpoints[j].y);
            students[i].distance.push_back(temp);
        }
        int min = students[i].distance[0];
        for (int j = 0; j < m; j++) {
            if (students[i].distance[j] < min) {
                min = students[i].distance[j];
            }
        }
        int counter = 0;
        for (int j = 0; j < m; j++) {
            if (students[i].distance[j] == min) {
                counter++;
            }
        }
        if (counter == 1) {
            int min_index;
            for (int j = 0; j < m; j++) {
                if (students[i].distance[j] == min) {
                    min_index = j + 1;
                }
            }
            students[i].answer = min_index;
        } else {
            vector<int> indexes;
            for (int j = 0; j < m; j++) {
                if (students[i].distance[j] == min) {
                    indexes.push_back(j + 1);
                }
            }
            int sum_min = checkpoints[indexes[0]].sum;
            int min_index = indexes[0];
            for (int j = 0; j < indexes.size(); j++) {
                if (checkpoints[indexes[j]].sum < sum_min) {
                    sum_min = checkpoints[indexes[j]].sum;
                    min_index = indexes[j];
                }
            }
            students[i].answer = min_index;
        }
    }

    for (int i = 1; i <= n; i++) {
        cout << students[i].answer << endl;
    }

    return 0;
}

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

int c[5][5];

int main() {
   rep (i, 3) {
      rep (j, 3) {
         cin >> c[i][j];
      }
   }

   int b[5] = {0, c[0][1]-c[0][0], c[0][2]-c[0][0]};
   int a[5] = {c[0][0], c[1][0], c[2][0]};

   rep (i, 3) {
      rep (j, 3) {
         if (a[i]+b[j] != c[i][j]) {
            puts("No");
            return 0;
         }
      }
   }

   puts("Yes");

   return 0;
}

Measured memory_bytes: 256
S = str(input())

T = str(input())

length =len(S)

listS=list(S)

listT=list(T)

num = len(T)

res = 0

for i in range(length):

    if (listS[num-1] != listT[num-1]):

        res +=1

    num -=1

print(res)

Measured memory_bytes: 12440
#include <cstdio>
#include <iostream>
#include <cmath>
#include <ctype.h>
#include <string> 
#include <sstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <map>
#include <queue>
#include <utility>
#include <vector>
#include <set>
 
using namespace std;

int main()
{
    int n, m, p;
    while(1){
        cin >> n >> m >> p;
        if(n == 0) break;
        int x[100];
        int sum = 0;
        for(int i = 0; i < n; i++){
            cin >> x[i];
            sum += x[i] * 100;
        }
        int ans;
        if(x[m - 1] == 0) ans = 0;
        else ans = (sum * (100 - p)) / (100 * x[m - 1]);
        cout << ans << endl;
    }
    return 0;
}

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

int main(){

int n;
cin>>n;

int a[n];

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

for(int i=n-1;i>=0;i--){
    if(i==0){
        cout<<a[i]<<endl;
    }else{
        cout<<a[i]<<" ";
    }
}

return 0;
}


Measured memory_bytes: 3084
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <map>
#define ll long long
const int MOD = 1e9+7;
using namespace std;


int main(){
	string t = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	t += t;
	int n;
	string s;
	cin >> n >> s;
	for (int i = 0; i < s.length(); i++){
		for (int j = 0; ; j++){
			if (s[i] == t[j]){
				cout << t[j+n];
				break;
			}
		}
	}
	cout << endl;
	return 0;
}

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

vector< ll >a;

void solve()
{
  for(int i=0;i<3980;i++)a.push_back((ll)pow(i,5));
  return;
}
int bs(int s,int e,ll key)
{
  int mid=(s+e)/2;
  while(s<=e)
  {
    if(a[mid]==key)return mid;
    else if(a[mid]<=key)
    {
      s=mid+1;
    }
    else e=mid-1;
    mid=(s+e)/2;
  }
  return -1;
}

int main()
{
  
  int x;
  cin>>x;
  solve();
  for(int i=0;i<3979;i++)
  {
    ll t=a[i];
    ll A=x-t;
    int k=bs(0,3979,A);
    if(k!=-1)
    {
      cout<<k<<' '<<-i<<endl;
      return 0;
    }
  }
   for(int i=0;i<3979;i++)
  {
    ll t=a[i];
    ll A=x+t;
    int k=bs(0,3979,A);
    if(k!=-1)
    {
      cout<<k<<' '<<i<<endl;
      return 0;
    }
  }
  
  return 0;
}

Measured memory_bytes: 4216
#include <iostream>
#include <cstdio>
using namespace std;
#define rep(x,to) for(int x=0; x<(to); (x)++)

int main() {
	int n, m;
	cin >> n >> m;
	int w[100000+10] = {};
	int hi = 0;
	rep(i,n) {
		cin >> w[i];
		hi += w[i];
	}
	int lo = 0;
	while(hi - lo > 1) {
		int mid = (lo + hi) / 2;
		int sum = 0;
		int cnt = 1;
		bool f = 0;
		rep(i,n) {
			if(mid < sum + w[i]) {
				sum = 0;
				cnt++;
			}
			sum += w[i];
			if(mid < w[i]) {
				f = 1;
				break;
			}
		}
		if(f) lo = mid;
		if(!f && cnt <= m) hi = mid;
		else lo = mid;
	}
	cout << lo + 1 << endl;
	return 0;
}

Measured memory_bytes: 1560
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define DEF_ELEM_MAX 1000
#define DEF_VMAX 10000
#ifndef min
#define min(a, b)            (((a) < (b)) ? (a) : (b))
#endif
int A[DEF_ELEM_MAX];
int B[DEF_ELEM_MAX];
int VD[DEF_ELEM_MAX];
int N;

int search(int x)
{
  int i;
  for ( i = 0 ; i < N ; i++ ) {
    if ( A[i] == x ) {
      break;
    }
  }
  return i;
}
 
int int_sort( const void * a , const void * b ){
  int p = *( int * )a;
  int q = *( int * )b;
  if( p < q ) {
    return -1;
  }  else if( p == q  ) {
    return 0;
  }
  return 1;
}

int sillysort( void ){
  int s,cost=0,i,amin,sum,n,x;
  s = B[0];
  for ( i = 0 ; i < N ; i++ ) {
    x = i;
    n = sum = 0;
    amin = DEF_VMAX;
    while ( VD[x] == 0 ) {
      VD[x] = 1;
            n++;
            sum += A[x];
            amin = min(amin, A[x]);
            x = search(B[x]);
        }
        if ( n > 1 ) { 
            cost += min(sum+(n-2)*amin, sum+amin+(n+1)*s);
        }
    }
    return cost;
}

int main(void){
  int i,ans;
    scanf("%d", &N);
    for ( i = 0 ; i < N ; i++ ) {
        scanf("%d", &A[i] );
        B[i] = A[i];
    }
    qsort(B, N , sizeof( int ), int_sort );
    ans = sillysort();
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 656
#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>
#include<functional>
#include<assert.h>
#include<numeric>
#include <cstring>
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)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dp[100010];
const int nmax=110;
int ary[nmax];
int n;

int rec(int x)
{
    if (dp[x]!=-1) return dp[x];

    bool flag = false;
    rep(i,n)
    {
        if (x-ary[i]>=0)
        {
            if (!rec(x-ary[i]))
            {
                flag = true;
            }
        }
    }

    if (flag)
    {
        return dp[x] = 1;
    }
    else
    {
        return dp[x] = 0;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    cin>>n;
    int k;
    cin>>k;
    rep(i,n) cin>>ary[i];
    sort(ary, ary+n);
    memset(dp, -1, sizeof(dp));
    // 1->first, 0->second -1->初期値
    rep(i,n)
    {
        dp[ary[i]]=1;
    }
    // 一番小さいのでもだめなら最初の人の負け
    rep(i, ary[0])
    {
        dp[i] = 0;
    }

    if (rec(k)==1)
    {
        cout << "First" << endl;
    }
    else
    {
        cout << "Second" << endl;
    }
}


Measured memory_bytes: 5376
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }



void solve(void)
{
  int N;cin>>N;
  vector<int> vec (N,0);
  for (int i = 0; i < N; i++)
  {
     cin>>vec[i];
  }
  int init = 1;
  int MODE =-1;
  int ANS = 1;
  for (int i = 0; i < N - 1; i++)
  {
    if(init == 1)
    {
      if(vec[i+ 1] > vec[i]) MODE = 1;
      else if(vec[i+1] == vec[i])continue;
      else MODE = 0;
      init = 0;
    }
    else
    {
      if(MODE == 1)
      {
        if(vec[i+1] < vec[i])
        {
          init = 1;
          ANS++;
        }
      }
      if(MODE == 0)
      {
        if(vec[i+1] > vec[i])
        {
          init = 1;
          ANS++;
        }
      }
    }
    
  }
  cout<<ANS<<endl;
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
std::ios::sync_with_stdio(false);
std::cin.tie(0);

std::cout << std::fixed;
std::cout << std::setprecision(9);
solve();

return 0;
}


Measured memory_bytes: 1024
//#pragma GCC optimize "trapv"
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand rng
#define fios ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define M_PI 3.14159265358979323846
typedef long long ll;



int main() {
	//fios;
	ll a, b, c, d;
	cin >> a >> b >> c >> d;

	ll ans = max({a*c, a*d, b*c, b*d});
	cout << ans << endl;
}

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

using namespace std;

using int64 = long long;
const int mod = 924844033;

struct Combination
{
  int mod;
  vector< int64_t > mfact, rfact;

  Combination(int sz, int mod) : mfact(sz + 1), rfact(sz + 1), mod(mod)
  {
    mfact[0] = 1;
    for(int i = 1; i < mfact.size(); i++) {
      mfact[i] = mfact[i - 1] * i % mod;
    }
    rfact[sz] = inv(mfact[sz]);
    for(int i = sz - 1; i >= 0; i--) {
      rfact[i] = rfact[i + 1] * (i + 1) % mod;
    }
  }

  int64_t fact(int k) const
  {
    return (mfact[k]);
  }

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

  int64_t inv(int64_t x) const
  {
    return (pow(x, mod - 2));
  }

  int64_t P(int n, int r) const
  {
    if(r < 0 || n < r) return (0);
    return (mfact[n] * rfact[n - r] % mod);
  }

  int64_t C(int p, int q) const
  {
    if(q < 0 || p < q) return (0);
    return (mfact[p] * rfact[q] % mod * rfact[p - q] % mod);
  }

  int64_t H(int n, int r) const
  {
    if(n < 0 || r < 0) return (0);
    return (r == 0 ? 1 : C(n + r - 1, r));
  }
};

int main()
{
  Combination comb(2001, mod);

  int N, K;
  cin >> N >> K;
  vector< int > line[2001];
  for(int i = 0; i < N; i++) line[i % K].push_back(i);

  int ret = 0;
  int sz = 1;
  vector< int > dp(sz);
  dp[0] = 1;
  for(int i = 0; i < 2 * K; i++) {
    vector< int > dp2(sz + line[i % K].size());
    for(int j = 0; (int) line[i % K].size() - j >= 0; j++) {
      auto add = comb.C((int) line[i % K].size() - j, j);
      for(int k = 0; k < sz; k++) {
        (dp2[j + k] += 1LL * dp[k] * add % mod) %= mod;
      }
    }
    dp.swap(dp2);
    sz += line[i % K].size();
  }

  for(int i = 0; i <= N; i++) {
    auto sub = dp[i] * comb.fact(N - i) % mod;
    if(i % 2 == 0) (ret += sub) %= mod;
    else (ret += mod - sub) %= mod;
  }
  cout << ret << endl;
}



Measured memory_bytes: 384
#include <stdio.h>
int main()
{
  int i, j, t, n;
  int d[100];
  while(1)
    {
      for (i = 0; i < 100; i++)
	{
	  d[100] = 0;
	}
      scanf("%d", &n);
      if ( n == 0 ) return 0;
      for( i = 0; i < n; i++)
	{
	  scanf("%d", &d[i]);
	}
      for ( i = 0; i < n - 1; i++)
	{
	  for ( j = i+1; j < n; j++)
	    {
	      if ( d[i] > d[j] )
		{
		  t  = d[i];
		  d[i] = d[j];
		  d[j] = t;
		}
	    }
	}
      t = 0;
      for ( i = 1; i < n - 1; i++)
	{
	  t += d[i];
	}
      printf("%d\n", t / (n - 2));
    }
  return 0;
}

Measured memory_bytes: 600
n = int(input())
xy = [list(map(int,input().split())) for _ in range(n)]

for x in range(101):
    for y in range(101):
        h_memo = 0
        for i in range(n):
            if xy[i][2] != 0:
                h_memo = xy[i][2] + abs(xy[i][0]-x) + abs(xy[i][1]-y)
                break
        for i in range(n):
            if xy[i][2] != max(0,h_memo-abs(xy[i][0]-x)-abs(xy[i][1]-y)):
                break

        else:               
            #print(x+1,y+1,h[0])

            print(x,y,h_memo)
            break
                


Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
#define debug(x) cerr << #x << ": " << x << endl
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2017/10/11  Problem: N18_b  / Link:   ----- */
/* ------問題------



-----問題ここまで----- */
/* -----解説等-----



----解説ここまで---- */

LL N;
LL ans = 0LL;

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

	cin >> N;
	VL a(N,0);
	FOR(i, 0, N)cin >> a[i];
	SORT(a);

	VL sum(N + 1,0);
	sum[0] = 0;
	FOR(i, 1, N+1) {
		sum[i] = sum[i - 1] + a[i-1];
	}
	ans = 1;
	int f = 1;

	FORR(i, N-2, -1) {
		if (a[i+1] <= 2 * sum[i+1 ]&&f)ans++;
		else f = 0;
	}
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 1792
# 初期入力 2020-0730-2150
from bisect import bisect_left
import sys
input = sys.stdin.readline  #文字列では使わない
N,K = map(int, input().split())
x = list(map(int, input().split()))
x_shift =[i +abs(x[0]) for i in x]
 
dist =[]
for i in range(N-K+1):
    d_end =x_shift[i+K-1] -x_shift[i] #ローソクK本の内、端と端の距離
    d_left =abs(x[i])
    d_right =abs(x[i+K-1])
    dist.append(d_end +min(d_left,d_right))
print(min(dist))

Measured memory_bytes: 20232
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ans = 0
for i in range(n):
  if i == 0:
    ans += b[a[i]-1]
  else:
    ans += b[a[i]-1]
    if a[i]-a[i-1] == 1:
      ans += c[a[i]-2]
print(ans)

Measured memory_bytes: 38256
#include<iostream>
#include<cstring>
#include<vector>
#include<stack>
#include<cstdio>
using namespace std;
int main()
{
	int n,a,b,c,flag=1,ans=0;
	int x[2][3];
	scanf("%d",&n);
	for(int i=0;i<n;++i)
	{
		scanf("%d%d%d",&a,&b,&c);
		if(i==0)
		{
			x[i][0]=a;
		    x[i][1]=b;
		    x[i][2]=c;
		    continue;
		}
		x[flag][0]=a+max(x[1-flag][1],x[1-flag][2]);
		x[flag][1]=b+max(x[1-flag][2],x[1-flag][0]);
		x[flag][2]=c+max(x[1-flag][1],x[1-flag][0]);
		flag=1-flag;
	}
	ans=max(x[1-flag][0],max(x[1-flag][1],x[1-flag][2]));
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<list>
#include <array>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define INF I64_MAX
#define MOD 1000000007
#define MEM_SIZE = 1e5+5;

template<typename T> void DEBUG(T e){std::cout << e << std::endl;}
template<class T> void DEBUG(string str, T e){std::cout <<str << ">>" << e << std::endl;}
template<typename T> void DEBUG(const std::vector<T>& v){for(const auto& e : v){ std::cout << e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){ for(const auto& v : vv){ DEBUG(v); } }
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}

//-----CODE------//

void solve(void)
{
  int N,M;
  cin>>N>>M;
  if(N == M)
  {
    cout<<"Yes";
  }
  else
  {
    cout<<"No"<<endl;
  }
  

  return;
}


int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(8);
  solve();

 
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int mod = 1e9+7;

int main()
{
    int n;
    cin >> n;
    ll ans = 1;
    for(int i = 0; i < n; i++){
        ll t; cin >> t;
        ans = ans/__gcd(ans,t)*t;
    }

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

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <set>
#include <string>
#include <utility>
#include <vector>

using namespace std;

#define all(collection) (collection).begin(), (collection).end()
#define loop(i, times) for(int i = 0; i < times; i++)
#define seloop(i, start_index, end_index) for(int i = start_index; i < end_index; i++)
#define eqseloop(i, start_index, end_index) for(int i = start_index; i <= end_index; i++)

class NyaGadgetCpp17
{
public:
	/**
	@brief 最大公約数を計算する関数
	@note
	 aとbの最大公約数を返す
	**/
	template <typename T> static T Gcd(T a, T b)
	{
		return b ? Gcd(b, a % b) : a;
	}
};

int main()
{
	int a; cin >> a;
	int b; cin >> b;
	int k; cin >> k;


	int count = 0;
	int ans = 100;
	int max = 100;
	while (count != k)
	{
		if (a % max == 0 && b % max == 0)
		{
			ans = max;
			count++;
		}
		max--;
	}
	
	cout << ans;
	return 0;
}

Measured memory_bytes: 256
n = input()
ab = [int(i) for i in input().split()]
a = ab[0]
b = ab[1]
p = [int(i) for i in input().split()]

num1,num2,num3 = 0,0,0
for num in p:
    if num <= a:
        num1 += 1
    elif num <= b:
        num2 += 1
    else:
        num3 += 1
print(min(num1,num2,num3))

Measured memory_bytes: 38384
#coding:utf-8
m, d = map(int, input().split())
ans = 0

for i in range(10, d+1):
  i1 = i % 10
  i10 = i // 10

  if i1 >= 2 and i10 >= 2 and i1*i10 <= m:
    ans += 1

print(ans)


Measured memory_bytes: 2940
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		int b = 0;
		int[] c = new int[n - 1];

		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}

		for (int i = 0; i < n; i++) {
			b += sc.nextInt();
		}

		for (int i = 0; i < n - 1; i++) {
			c[i] = sc.nextInt();
		}

		for (int i = 1; i < n; i++) {
			int r = a[i];
			int f = a[i - 1];
			if ((r - f) == 1) {
				b += c[f - 1];
			}
		}
		System.out.println(b);
	}
}

Measured memory_bytes: 21844
import math as m
a,b,x=map(int,input().split())
x/=a
P=m.acos(-1.0)
if x>a*b/2:print(m.atan2((a*b-x)*2,a*a)*180/P)
else:print(m.atan2(b*b,x*2)*180/P)

Measured memory_bytes: 9224
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <sstream>
#include <cmath>
#include <cstring>
using namespace std;

#define FOR(i, n) for(int i=0;i<(int)n;i++)
#define ALL(c) (c).begin(),(c).end()
#define VCI vector<int>
#define VCS vector<string>
#define pb push_back
#define SZ size()

#define INF 2147483647

int dp[110][110];

int main() {
	int n;
	cin >> n;
	
	VCI a(n);
	VCI b(n);
	for (int i=0; i<n; i++) {
		cin >> a[i] >> b[i];
		for (int j=0; j<n; j++)
			i==j ? dp[i][j] = 0 : dp[i][j] = INF;
	}

	for (int i=0; i+1<n; i++)
		dp[i][i+1] = a[i]*b[i]*a[i+1]*b[i+1];

	for (int i=2; i<=n; i++) {
		for (int j=0; j+i<n; j++) {
			for (int k=0; k<i; k++) {
				dp[j][j+i] = min(dp[j][j+i], dp[j][j+k]+dp[j+k+1][j+i]+a[j]*b[j+k]*a[j+k+1]*b[j+i]);
			}
		}
	}

	cout << dp[0][n-1] << endl;

	return 0;
}

Measured memory_bytes: 1228
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, A, B;
  cin>>N>>A>>B;
  string S;
  cin>>S;
  int anum=0, bnum=0;
  for(int i=0;i<N;++i) {
    //cout<<anum<<" "<<bnum<<endl;
    if(S[i]=='a') {
      if(anum+bnum>=A+B) cout<<"No"<<endl;
      else {
        cout<<"Yes"<<endl;
        anum++;
      }
    }
    else if(S[i]=='b') {
      if(anum+bnum>=A+B || bnum>=B) cout<<"No"<<endl;
      else {
        cout<<"Yes"<<endl;
        bnum++;
      }
    }
    else cout<<"No"<<endl;
  }
}



Measured memory_bytes: 3744
#include <bits/stdc++.h>
#define ll long long
#define WEIGHTSUM weight + (it -> first)
#define VALUESUM (it -> second) + value
using namespace std;
map <int, ll> maxValue;

int main() {
	ll n, w, weight, value;

	cin >> n >> w;
	for (int i = 1; i <= n; i++) {
		cin >> weight >> value;

		for (map <int, ll> :: reverse_iterator it = maxValue.rbegin(); it != maxValue.rend(); it++)
			if (WEIGHTSUM <= w)
				maxValue[WEIGHTSUM] = max(maxValue[WEIGHTSUM], VALUESUM);

		maxValue[weight] = max(maxValue[weight], value);
	}

	ll result = 0;
    for (pair <int, ll> value : maxValue)
    	result = max(result, value.second);
    cout << result;

	return 0;
}


Measured memory_bytes: 9764