akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

int length(std::string a)
{
  int i = 0;
  while(a[i] != NULL)
  {
    i++;
  }
  return i;
}

int main()
{
  std::string a, b, result = "EQUAL";
  std::cin >> a >> b;
  
  int a_length = length(a);
  int b_length = length(b);
  
  if(a_length > b_length)
  {
    result = "GREATER";
  }
  else if(a_length < b_length)
  {
    result = "LESS";    
  }
  else
  {
    for(int i = 0; a[i] != NULL && b[i] != NULL; i++)
    {
      if(a[i] > b[i])
      {
        result = "GREATER";        
        break;
      }
      else if(a[i] < b[i])
      {
        result = "LESS";    
        break;
      }
    }
  }

  std::cout << result;
  return 0;
}

Measured memory_bytes: 3040
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>


using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define loop(n) FOR(i,0,n)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

bool isPrime(int n) {

	if (n == 1) return false;
	if (n == 2) return true;

	for (int i = 2; i*i <= n; i++) {
		if (n%i == 0)return false;
	}

	return true;
}

int main() {

	while (true) {
		int a, d, n; cin >> a >> d >> n;

		if (a == 0 && d == 0 && n == 0)return 0;
		int x = a;
		int cnt = 0;


		while (cnt!=n) {
			if (isPrime(x)) {
				cnt++;
			}

			x += d;
		}

		cout << x-d << endl;

		
	}

	return 0;
}


Measured memory_bytes: 3104
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int maxd = 1e5+10;
int main()
{
    // freopen("a.in","r",stdin);
    // freopen("k.out","w",stdout);
    int n;
    scanf("%d",&n);
    printf("%d",n*n*n);
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
    long int a, b, c, k;
    int ans=0;
    scanf("%ld%ld%ld%ld", &a, &b, &c, &k);
    while(a>0 && k>0){
        ans+=1;
        a-=1;
        k-=1;
    }
    while(b>0 && k>0){
        b-=1;
        k-=1;
    }
    while(c>0 && k>0){
        ans-=1;
        c-=1;
        k-=1;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1708
using System;
using System.Collections.Generic;
namespace 令和{
    class ABC{
        static void Main(){
            int n = int.Parse(Console.ReadLine());
            //bool[] isEven = new bool[n-1];
            List<int[]>[] tonari = new List<int[]>[n+1];
            int[] ans = new int[n+1];
            for(int i=0;i<n+1;i++){
                tonari[i] = new List<int[]>();
                ans[i] = -1;
            }
            int u,v,w;
            for(int i=1;i<n;i++){
                string[] uvw = Console.ReadLine().Split();
                u = int.Parse(uvw[0]);
                v = int.Parse(uvw[1]);
                w = int.Parse(uvw[2]);
                tonari[u].Add(new int[2]{v,w});
                tonari[v].Add(new int[2]{u,w});
                /*
                if(w[i]%2==0){
                    isEven[i] = true;
                }else{
                    isEven[i] = false;
                }
                */
            }
            Queue<int> q = new Queue<int>();
            q.Enqueue(1);
            ans[1] = 0;
            while(q.Count!=0){
                int p = q.Dequeue();
                foreach(int[] tnr in tonari[p]){
                    if(ans[tnr[0]]==-1){
                        ans[tnr[0]] = (tnr[1]+ans[p])%2;
                        q.Enqueue(tnr[0]);
                    }
                }
            }
            for(int i=0;i<n;i++){
                Console.WriteLine(ans[i+1]);
            }


        }
    }
}


Measured memory_bytes: 38944
#include <iostream>


using namespace std;


int main()
{
    int a, b;
    cin >> a >> b;
    if (a < b )
       cout << "a < b" << endl;
    else if (a > b)
       cout << "a > b" <<endl;
    else
       cout << "a == b" << endl;
     
    return 0;
}





Measured memory_bytes: 3092
main =
    mapM_ putStrLn (map singleQQLine [(i,j) | i <- [1..9], j <- [1..9]])

singleQQLine :: (Int, Int) -> String
singleQQLine (a,b) =
    foldl (++) "" [(show a), "x", (show b), "=", (show (a*b))]

Measured memory_bytes: 3628
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

#define REP(i,n) for(int i=0;(i)<(n);(i)++)
#define ll long long

int main() {
	int x, y;
	cin >> x >> y;

	int ans = 0;
	if (abs(x) == abs(y)) {
		ans = ((x > 0) != (y > 0));
	}
	else if (abs(x) > abs(y)) {
		ans = (x > 0) + (abs(x) - abs(y)) + (y > 0);
	}
	else {
		ans = (x < 0) + (abs(y) - abs(x)) + (y < 0);
	}

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

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.lang.*;
public class Main {
	
	public static void main(String[] args) {
		MyScanner sc = new MyScanner();
		int n=sc.nextInt();
		double x[]=new double[n];
		String u[]=new String[n];
		double ans=0;
		for (int i = 0; i < n; i++) {
			x[i]=sc.nextDouble();
			u[i]=sc.next();
			if(u[i].equals("JPY")) {
				ans+=x[i];
			}else {
				ans+=x[i]*380000;
			}
			
		}
		System.out.println(ans);
		
	}
	
	
	
//----------------------------------------------------------
	static int l_min(int[] a) {
		Arrays.sort(a);
		return a[0];
	}
	static int l_max(int[] a) {
		int l=a.length;
		Arrays.sort(a);
		return a[l-1];
	}
	
	public static PrintWriter out;

	public static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

	}
	

}


Measured memory_bytes: 23124
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int GCD(ll, ll);

int main(){
    ll A, B;cin >> A >> B;
    ll x = max(A, B); ll y = min(A, B);
    ll g = GCD(x, y);
    cout << (A * B) / g << endl;
}
// a > b
int GCD(ll a, ll b){
    if (b == 1 or a % b == 0) return b;
    return GCD(b, a % b);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
bool b[3][3];
int m[3][3],n;
int main()
{
	for(int i=0;i<=2;i++)
	{
		for(int j=0;j<=2;j++)
		{
			scanf("%d",&m[i][j]);
		}
	}
	scanf("%d",&n);
	int a;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a);
		for(int j=0;j<=2;j++)
		{
			for(int k=0;k<=2;k++)
			{
//				printf("%d",m[j][k]);
				if(m[j][k]==a)
				{
					b[j][k]=1;
				}
			}
		}
	}
	if(b[0][0]==1&&b[0][1]==1&&b[0][2]==1)
	{
		printf("Yes");
	}
	else if(b[1][0]==1&&b[1][1]==1&&b[1][2]==1)
	{
		printf("Yes");
	}
	else if(b[2][0]==1&&b[2][1]==1&&b[2][2]==1)
	{
		printf("Yes");
	}
	else if(b[2][0]==1&&b[1][0]==1&&b[0][0]==1)
	{
		printf("Yes");
	}
	else if(b[0][1]==1&&b[1][1]==1&&b[2][1]==1)
	{
		printf("Yes");
	}
	else if(b[0][2]==1&&b[1][2]==1&&b[2][2]==1)
	{
		printf("Yes");
	}
	else if(b[0][0]==1&&b[1][1]==1&&b[2][2]==1)
	{
		printf("Yes");
	}
	else if(b[0][2]==1&&b[1][1]==1&&b[2][0]==1)
	{
		printf("Yes");
	}
	else
	{
		printf("No");
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

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

    int N; cin >> N;
    vector<int> A(N),B;
    rep(i,N) cin >> A[i];
    B = A;

    sort(A.begin(),A.end());
    int x = A[N/2 - 1],y = A[N/2];
    rep(i,N) {
        if (B[i] <= x) cout << y << '\n';
        else cout << x << '\n';
    }
    return 0;
}

Measured memory_bytes: 4776
from numba import njit
from numpy import int64,zeros
@njit('i8(i8[:],i8[:])',cache=True)
def func(s,x):
    last=zeros(26,int64)
    score=0
    for i,v in enumerate(x,1):
        last[v]=i
        c=0
        for j in range(26):
            c+=s[j]*(i-last[j])
        score+=s[i*26+v]-c
    return score
def main():
    d,*s=map(int,open(0).read().split())
    s=int64(s)
    x=s[26*-~d:d*27+26]-1
    for d,q in s[27*-~d:].reshape(-1,2):
        x[d-1]=q-1
        print(func(s,x))
main()

Measured memory_bytes: 122188
n=int(input())
l=list(map(int,input().split()))
ml=max(l)
m=[0]*(ml+1)
for i in l:
    m[i]+=1
for i in range(ml+1):
    if m[i]>=1:
        for j in range(2*i,ml+1,i):
            if m[j]>0:
                m[j]=0
                #print(j)
for i in range(ml+1):
    if m[i]>=2:
        m[i]=0
print(sum(m))


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

int main(){
  ll n,m;
  ll ans = 0;

  scanf("%lld %lld", &n, &m);

  if(2*n > m){
    printf("%lld\n", m/2);
  }

  else {
    m -= 2*n;
    ans += n + m/4;
    printf("%lld\n", ans);
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
#define x first
#define y second
#define vi vector<ll>
#define pii pair<ll, ll>
#define pb push_back
const ll m=1e9+7;
const ll N=1e6;
bool prime[N];
vector<int> p;
void sieve(int n)
{
	fill(prime, prime+n, true);
	for(int i=2;i<n;i++)
	{
		if(prime[i])p.pb(i);
		for(int j=0;j<p.size() and i*p[j]<n;j++)
		{
			prime[i*p[j]]=false;
			if(i%p[j]==0)break;
		}
	}
}
ll col(ll n)
{
	ll res=0;
	while(n>1)
	{
		if(n&1)
		n=3*n+1;
		else n=n>>1;
		res++;
		
	}
	return res;
}
ll modp(ll a, ll b)
{
	if(b==0)return 1;
	ll u=modp(a, b>>1);
	u=(u*u)%m;
	if(b&1)
	return (u*a)%m;
	return u;
}
int main()
{
   int  n,r;
	cin>>n>>r;
	if(n>=10)cout<<r;
	else
	{
		cout<<r+(10-n)*100;
	}




}

Measured memory_bytes: 256
using System;


class AOJ
{
    public static void Main()
    {
        while (true)
        {
            string ss = Console.ReadLine();
            if (ss == null) break;

            string[] s = ss.Split(' ');

            double x1 = double.Parse(s[0]);
            double y1 = double.Parse(s[1]);
            double x2 = double.Parse(s[2]);
            double y2 = double.Parse(s[3]);
            double x3 = double.Parse(s[4]);
            double y3 = double.Parse(s[5]);
            double xp = double.Parse(s[6]);
            double yp = double.Parse(s[7]);

            double s1, s2, s3,S;

            s1 = 0.5 * Math.Abs(x1 * y2 + x2 * yp + xp * y1 - y1 * x2 - y2 * xp - yp * x1);
            s2 = 0.5 * Math.Abs(x2 * y3 + x3 * yp + xp * y2 - y2 * x3 - y3 * xp - yp * x2);
            s3 = 0.5 * Math.Abs(x1 * y3 + x3 * yp + xp * y1 - y1 * x3 - y3 * xp - yp * x1);
            S  = 0.5 * Math.Abs(x1 * y2 + x2 * y3 + x3 * y1 - y1 * x2 - y2 * x3 - y3 * x1);

            if (S == s1 + s2 + s3 && s1 != 0 && s2 != 0 && s3 != 0)
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
        }       
    }
}

Measured memory_bytes: 5704
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MOD = 1000000007;

int main() {
	int H, W;
	cin >> H >> W;
	vector<string> X(H);
	int ans[1010][1010] = { 0 };
	for (int i = 0;i < H;i++) {
		cin >> X.at(i);
	}
	ans[0][0] = 1;
	for (int i = 0;i < H;i++) {
		for (int j = 0;j < W;j++) {
			if (i != H - 1 && X[i + 1][j] == '.')
				ans[i + 1][j] += ans[i][j];
			if (j != W - 1 && X[i][j + 1] == '.')
				ans[i][j + 1] += ans[i][j];
        	ans[i + 1][j] %= MOD;
        	ans[i][j + 1] %= MOD;
		}
	}
	cout << ans[H - 1][W - 1] << endl;
}

Measured memory_bytes: 5248
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        var a = Console.ReadLine().Split().Skip(1).Select(int.Parse).ToArray();
        int[] res = new int[5];
        bool hasStreak = false;
        int state = 0;
        for (int i = 1; i < a.Length; i++)
        {
            if (a[i - 1] == a[i])
            {
                hasStreak = true;
                continue;
            }
            var newState = Sign(a[i] - a[i - 1]);
            if (hasStreak)
            {
                if (state != 0)
                {
                    if (newState == state) res[2]++;
                    else if (state < 0) res[1]++;
                    else if (state > 0) res[0]++;
                }
                hasStreak = false;
            }
            else
            {
                if (state != newState)
                {
                    if (state > 0) res[3]++;
                    else if (state < 0) res[4]++;
                }
            }
            state = newState;
        }

        Console.WriteLine(string.Join(" ", res));
    }
}


Measured memory_bytes: 24300
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int t = Integer.parseInt(br.readLine());
		label:
		for (int x = 0; x < t; x++) {
			int n = Integer.parseInt(br.readLine());
			String[] sa = br.readLine().split(" ");
			long[] a = new long[n];
			for (int i = 0; i < n; i++) {
				a[i] = Long.parseLong(sa[i]);
			}
			char[] s = br.readLine().toCharArray();

			for (int i = n - 1; i >= 0; i--) {
				if (s[i] == '0') {
					for (int k = 0; k < 61; k++) {
						if ((a[i] >> k & 1) == 1) {
							for (int j = 0; j < n; j++) {
								if (i != j && (a[j] >> k & 1) == 1) {
									a[j] ^= a[i];
								}
							}
						}
					}
				} else {
					if (a[i] != 0) {
						System.out.println(1);
						continue label;
					}
				}
			}
			System.out.println(0);
		}
	}
}


Measured memory_bytes: 39596
#include <iostream>
#include <cstdio>
using namespace std;
 
int main() {
    int n, data;
    while(1) {
        scanf("%d", &n);
        if (n == 0) break;
        int sum=0, max=0, min=1001;
        for (int i=0; i<n; i++) {
            scanf("%d", &data);
            sum+=data;
            if (max < data) max=data;
            if (data < min) min=data;
        }
        printf("%d\n", (sum-max-min)/(n-2));
    }
}

Measured memory_bytes: 3160
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define rrep(i,n) for(int i=1;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define maxs(a, b) a = max(a, b)
#define mins(a, b) a = min(a, b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll linf = 1001002003004005006ll;
const int inf = 1001001001;
const int mod = 1000000007;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	int ans = 0;
	int odd = 0, even = 0;
	rep(i, n) {
		if (a[i] % 2 == 0) even++;
		else odd++;
	}
	int res = pow(2, even) * pow(1, odd);
	cout << pow(3, n) - res << endl;
	return 0;
}

Measured memory_bytes: 512
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

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

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

print(ans)

Measured memory_bytes: 47548
def make_smpl(m):
    if m == 0:
        return [[]]
    tmp = make_smpl(m - 1)
    result = []
    for l in tmp:
        result += [[0] + list(l), [1] + list(l)]
    return result


def calc(N, M, X, B):
    result = sum([b[0] for b in B])
    p = False
    for smpl in make_smpl(N):
        a = [0] * (M + 1)
        for i in range(N):
            if smpl[i] == 1:
                for j in range(M + 1):
                    a[j] += B[i][j]
        q = True
        for j in range(M):
            if a[j + 1] < X:
                q = False
                break
        if q:
            result = min(result, a[0])
            p = True
    return result if p else -1
    

(N, M, X) = tuple([int(s) for s in input().split()])
B = [[int(s) for s in input().split()] for _ in range(N)]
print(calc(N, M, X, B))

Measured memory_bytes: 74780
//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
  input: process.stdin, output: process.stdout
});
var obj; var inLine = [];
read.on('line', function(input){inLine.push(input);});
read.on('close', function(){
  obj = init(inLine);
  console.error("\n");
  var start = Date.now();
  Main();
  var end = Date.now() - start;
  myerr("time : " + end + "ms");
  myerr("memory : " + Math.round(process.memoryUsage().heapTotal / 1024) + "KB");
});
function makeClone(obj){return JSON.parse(JSON.stringify(obj));}
function nextInt(){return myconv(next(),1);} function nextStrArray(){return myconv(next(),2);}
function nextIntArray(){return myconv(next(),4);} function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();}
function init(input){  
  return {
    list : input, index : 0, max : input.length,
    hasNext : function(){return (this.index < this.max);},
    next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw "ArrayIndexOutOfBoundsException ‚There is no more input";}}
  };
}
function myout(s){console.log(s);}
function myerr(s){console.error("debug:" + require("util").inspect(s,false,null));}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map(Number);case 6:return i.split("");case 7:return i.split("").map(Number);case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
  var N = nextInt();
  for(var i = 1; i <= 9; i++){
    if((N / i < 10) && (N % i == 0)){
      myout("Yes");
      return;
    }
  }
  myout("No");
}


Measured memory_bytes: 31112
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import math 
def main():
    A, B = map(int, readline().split())
    def gcd(x, y):
        if not x%y:
            return y
        return gcd(y, x%y)
    
    def factorize(x):
        res = []
        for i in range(2, int(math.sqrt(x))+1):
            if x%i != 0:
                continue
            cnt = 0
            while x%i == 0:
                x //= i
                cnt += 1 
            res.append((i, cnt))
        if x != 1:
            res.append((x, 1))
        return res

    print(len(factorize(gcd(A, B)))+1) 
if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
/*g++ main.cpp -o main.out*/
/*./main.out*/

#include<bits/stdc++.h>
using namespace std;

#define LL long long
#define LD long double
#define Mod 1000000007
#define L_Mod 17100000013

const double eps = 1e-9;
const int INF = 0x3f3f3f3f;
const double PI = 3.1415926535;

#define NO_TLE std::ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

#define ree(a,n) memset(a,n,sizeof(a));

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define red(i,l,u) for(int (i)=(int)(l);(i)>=(int)(u);--(i))

int a[100005];

int main()
{
    NO_TLE
    int n,x;
    cin>>n;
    rer(i,1,n)
    {
        cin>>x;
        if(x>a[i-1])
            x--;
        a[i]=x;
    }
    int f=1;
    rer(i,1,n)
    {
        if(a[i]<a[i-1])
        {
            f=0;
            break;
        }
    }
    if(f)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}







































Measured memory_bytes: 640
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	bool InRange(int t, int l, int r){ return l <= t && t < r; }
	public void Solve(){
		
		int mi = 0;
		int ma = 1 << M;
		if(!InRange(K, mi, ma)){
			Console.WriteLine(-1);
			return;
		}
		int MM = (1 << M) * 2;
		int[] ans = new int[MM];
		if(K == 0){
			for(int i=0;i< MM / 2;i++){
				ans[2 * i] = i;
				ans[2 * i + 1] = i;
			}
			
			Console.WriteLine(String.Join(" ",ans));
			return;
		} else {
			if(M == 1){
				Console.WriteLine(-1);
				return;
			}
			ans[0] = 0;
			ans[1] = K;
			ans[2] = 0;
			int idx = 3;
			for(int j=1;j<ma;j++){
				if(j == K) continue;
				ans[idx] = j;
				idx++;
			}
			ans[idx] = K;
			idx++;
			for(int j=ma-1;j>=1;j--){
				if(j == K) continue;
				ans[idx] = j;
				idx++;
			}
			Console.WriteLine(String.Join(" ",ans));
		}
		
		
		
	}
	int M,K;
	public Sol(){
		var d = ria();
		M = d[0]; K = d[1];
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


Measured memory_bytes: 27224
# -*- coding: utf-8 -*-

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())


def calc(N):
    r = N % 10
    if r == 0:
        r = 10
    count = N + 10 - r
    return r, count


set_list = [a, b, c, d, e]
remainder_list = [0] * 5
counts = [0] * 5

for i in range(5):
    r, count = calc(set_list[i])
    remainder_list[i] = r
    counts[i] = count

print(sum(counts) + min(remainder_list) - 10)

Measured memory_bytes: 3064
### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    memo=[0]*(2*(10**5)+2)
    #n,m,k=map(int, readline().rstrip().split())
    n=int(readline())
    arr=list(map(int, readline().rstrip().split()))
    for a in arr:
        memo[a]+=1
    
    for i in range(n):
        print(memo[i+1])
    #ss=readline().rstrip()
    #yn(1)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

Measured memory_bytes: 41948
n=int(input())
ls=list(map(int,input().split()))

cnt=0
for i in range(n-2):
  a=ls[i]
  for j in range(i+1,n-1):
    b=ls[j]
    if a==b:
      continue
    for k in range(j+1,n):
      c=ls[k]
      if a==c or b==c:
        continue
      if a+b <= c or a+c <= b or b+c <= a:
        continue
      else:
        cnt+=1
print(cnt)
      
  


Measured memory_bytes: 8928
#include <iostream>
#include <vector>
#include <algorithm>
#define N 1000000

using namespace std;
typedef long long ll;

int main(void) {
	ll i, j, num, k, ans, a = 0;
	cin >> num >> k;
	if (num == 1)
		ans = k;
	else {
		while (!(k & 1)) {
			a++;
			k >>= 1;
		}
		ans = max(1ll, 1ll << (a / num));
		for (i = 3; i < min((ll)N, k); i += 2) {
			a = 0;
			while (k % i == 0) {
				a++;
				k /= i;
			}
			for(j = 0; j < a / num; j++)
				ans *= i;
			if (k == 1)
				break;
		}
	}
	cout << ans << "\n";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define doublecout(a) cout<<fixed<<setprecision(15)<<a<<endl;
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k;
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s,t;
bool fl;
struct edge{int to,cost;};
vector<ll> ty;

//-------------------------↓↓↓↓↓↓------------------------

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

    cin>>n>>s>>t;
    rep(i,n){
        if(s[i]==s[i+1]){
            i++;
            ty.push_back(0);
        }
        else{
            ty.push_back(1);
        }
    }
    rep(i,Size(ty)){
        if(i==0){
            if(ty[i]==0)ans=6;
            else ans=3;
        }
        else{
            if(ty[i]==0&&ty[i-1]==1)ans*=2;
            if(ty[i]==1&&ty[i-1]==1)ans*=2;
            if(ty[i]==0&&ty[i-1]==0)ans*=3;
        }
        ans%=MOD;
    }
    Cout(ans);
    return 0;
}


Measured memory_bytes: 256
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 area = a*b;
		int length = (a+b)*2;

		System.out.println(area +" "+ length);

	}

}

Measured memory_bytes: 17300
N = int(input())
previous_p = [{'t': 0, 'x': 0, 'y': 0}]
next_p = [{'t': t, 'x': x, 'y': y} for _ in range(N) for t, x, y in [map(int, input().split())]]
previous_p += next_p

answer = 'Yes'
for p_p, n_p in zip(previous_p, next_p):
  time = n_p['t'] - p_p['t']
  distance = abs(n_p['x'] - p_p['x']) + abs(n_p['y'] - p_p['y'])
  if time < distance or time % 2 != distance % 2:
    answer = 'No'
    break
  
print(answer)

Measured memory_bytes: 40692
res = []
while True :
    n = int(input())
    
    if n == 0 :
        break
    else :
        li = [int(x) for x in input().split()]
        avg = sum(li) / n
        res.append(sum([1 if x <= avg else 0 for x in li]))
        
for r in res :
    print(r)


Measured memory_bytes: 6612
package main

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

var T int
var X int

func main() {
	T = nextInt()
	X = nextInt()
	ans := float64(T) / float64(X)
	fmt.Printf("%v", ans)
}

func nextInt() int {
	v, _ := strconv.Atoi(nextReader())
	return v
}

func nextInts(n int) []int {
	r := make([]int, n)
	for i := 0; i < n; i++ {
		r[i] = nextInt()
	}
	return r
}

var nextReader func() string

func init() {
	nextReader = NewScanner()
}

func NewScanner() func() string {
	r := bufio.NewScanner(os.Stdin)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)
	return func() string {
		r.Scan()
		return r.Text()
	}
}

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

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

func MinIn2Values(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

func Abs(a int) int {
	if a < 0 {
		return a * -1
	}
	return a
}


Measured memory_bytes: 640
using System;

namespace atcoder
{
	class problem1
	{
		static void Main(string[] args)
		{
			string[] str = Console.ReadLine().Split(' ');
			int a = int.Parse(str[0]);
			int b = int.Parse(str[1]);
			if ((a * b) % 2 == 1)
			{
				Console.WriteLine("Odd");
			}else if((a*b)%2==0){
				Console.WriteLine("Even");
			}
		}
	}
}


Measured memory_bytes: 11092
package main

import (
	"fmt"
)

func main() {
	res := make([]int, 5)
	for i := 0; i < 5; i++ {
		fmt.Scan(&res[i])
	}
	for i, _ := range res {
		if res[i] == 0 {
			fmt.Println(i + 1)
			return
		}
	}
}


Measured memory_bytes: 1752
#include <bits/stdc++.h>
using namespace std;
#define pi pair<int, int>
#define ppi pair<int, pi>

ppi dp[3003][3003];

int main() {
	string s, t;
	cin >> s >> t;
	int n = s.length(), m = t.length();
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			if (s[i - 1] == t[j - 1]) {
				dp[i][j] = ppi(dp[i - 1][j - 1].first + 1, pi(i - 1, j - 1));
			}
			else {
				if (dp[i - 1][j].first > dp[i][j - 1].first) {
					dp[i][j] = ppi(dp[i - 1][j].first, pi(i - 1, j));
				}
				else {
					dp[i][j] = ppi(dp[i][j - 1].first, pi(i, j - 1));
				}
			}
		}
	}
	string ans;
	for (pi state = pi(n, m); state != pi(0, 0); state = dp[state.first][state.second].second) {
		int i = state.first, j = state.second;
		if (dp[i][j].second == pi(i - 1, j - 1)) {
			ans = s[i - 1] + ans;
		}
	}
	cout << ans;
}

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

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

constexpr int MAX_DIGIT = 80;

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

    while (data_num--) {
        std::string in01_str, in02_str;
        cin >> in01_str >> in02_str;

        vector<char> in01_ch(in01_str.rbegin(), in01_str.rend());
        vector<char> in02_ch(in02_str.rbegin(), in02_str.rend());

        std::size_t size;
        if (in01_ch.size() < in02_ch.size()) {
            size = in02_ch.size();
            in01_ch.resize(size, '0');
        } else {
            size = in01_ch.size();
            in02_ch.resize(size, '0');
        }

        vector<int> in01(size), in02(size);
        for (unsigned i = 0; i < size; i++) {
            in01.at(i) = in01_ch.at(i) - '0';
            in02.at(i) = in02_ch.at(i) - '0';
        }

        vector<int> out;
        bool is_over = false;
        for (unsigned i = 0; i < size; i++) {
            int num = in01.at(i) + in02.at(i) + (is_over? 1: 0);
            is_over = (num > 9)? true: false;

            out.push_back(num % 10);
        }
        if (is_over) {
            out.push_back(1);
        }

        if (out.size() > MAX_DIGIT) {
            cout << "overflow" << endl;
            continue;
        }

        for (unsigned i = 0; i < out.size(); i++) {
            cout << out.at(out.size() - 1 - i);
        }
        cout << endl;
    }

    return 0;
}

Measured memory_bytes: 1252
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define pb push_back
#define mp make_pair
#define y1 y114514
#define y2 y1919810
//#define int long long
#define lsh(i) (1 << (i))
#define lshll(i) (1LL << (i))
#define repn(i, n) for (int i = 1; i <= (int)n; i++)
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define range(i, s, t) for (int i = s; i <= (int)t; i++)
#define RESET(x) memset((x), 0, sizeof(x))
const int INF = 0x3f3f3f3f;
const long double EPS = 1e-6;
const int N = 500050;
int tr[N], last[N];
int n;
int a[N], ans[N];
vector<pair<int, int> > q[N];
void add(int pos, int x) {
  for (; pos <= n; pos += pos & -pos) tr[pos] += x;
}
int sum(int pos) {
  int ans = 0;
  for (; pos > 0; pos -= pos & -pos) ans += tr[pos];
  return ans;
}
void solve() {
  cin >> n;
  int Q;
  cin >> Q;
  repn(i, n) cin >> a[i];
  repn(i, Q) {
    int l, r;
    cin >> l >> r;
    q[r].pb(mp(l, i));
  }
  repn(i, n) {
    add(i, +1);
    if (last[a[i]]) add(last[a[i]], -1);
    last[a[i]] = i;
    for (auto p : q[i]) ans[p.second] = sum(i) - sum(p.first - 1);
  }
  repn(i, Q) cout << ans[i] << endl;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int T = 1;
  // cin >> T;
  while (T--) solve();
  return 0;
}


Measured memory_bytes: 33212
import sys
# input関係の定義
sys.setrecursionlimit(200000)
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def fi(): return float(input())
def mfi(): return map(float, input().rstrip().split())
def lmfi(): return list(map(float, input().rstrip().split()))
def li(): return list(input().rstrip())
def debug(*args, sep=" ", end="\n"): print("debug:", *args, file=sys.stderr, sep=sep, end=end) if not __debug__ else None
def exit(*arg): print(*arg); sys.exit()
# template

# BEGIN CUT HERE
class RollingHash():
    """ロリハ。容易に衝突するので注意。"""
    BASE1 = 1007
    BASE2 = 2009
    MOD1 = 1000000007
    MOD2 = 1000000009

    def __init__(self, s, opt=2):
        self.n = len(s)
        self.opt = opt
        self.hash1 = [0] * (self.n + 1)
        self.power1 = [1] * (self.n + 1)
        if opt == 2:  # rollinghash by 2 mod
            self.hash2 = [0] * (self.n + 1)
            self.power2 = [1] * (self.n + 1)

        for i, e in enumerate(s):
            self.hash1[i + 1] = (self.hash1[i] * self.__class__.BASE1 + ord(e)) % self.__class__.MOD1
            self.power1[i + 1] = (self.power1[i] * self.__class__.BASE1) % self.__class__.MOD1
        if opt == 2:  # rollinghash by 2 mod
            for i, e in enumerate(s):
                self.hash2[i + 1] = (self.hash2[i] * self.__class__.BASE2 + ord(e)) % self.__class__.MOD2
                self.power2[i + 1] = (self.power2[i] * self.__class__.BASE2) % self.__class__.MOD2

    def get(self, l: int, r: int):
        res1 = self.hash1[r] - self.hash1[l] * self.power1[r - l] % self.__class__.MOD1
        if(res1 < 0):
            res1 += self.__class__.MOD1
        if self.opt == 2:
            res2 = self.hash2[r] - self.hash2[l] * self.power2[r - l] % self.__class__.MOD2
            if(res2 < 0):
                res2 += self.__class__.MOD2
        return (res1, res2) if self.opt == 2 else res1
# END CUT HERE

def ABC131E():
    N = ii()
    S = li()
    rh = RollingHash(S, opt=1)
    def check(n: int):
        d = dict()
        for i in range(N - n + 1):
            p = rh.get(i, i + n)
            if p in d:
                if(i - d[p] >= n):
                    return True
            else:
                d[p] = i
        return False
    ok, ng = 0, N // 2 + 1
    while ng - ok > 1:
        mid = (ok + ng) // 2
        if check(mid):
            ok = mid
        else:
            ng = mid
    print(ok)



if __name__ == '__main__':
    ABC131E()


Measured memory_bytes: 42992
def prime(n)
  primes = Array.new(n + 1){|i|i}
  primes[1] = nil
  for i in 2..n ** 0.5
    if primes[i]
      for j in 2..n / i
        primes[i * j] = nil
      end
    end
  end
  return primes.select{|i|i} # !> shadowing outer local variable - i
end
def main(input = STDIN)
  primes = prime(104743)
  while (n = input.gets.to_i) != 0
    puts primes[0..n].inject{|i, sum|i + sum}
  end
end
main

Measured memory_bytes: 7792
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
using namespace std;
using namespace __gnu_pbds;

#define sp << " " <<
#define mod 1000000007
#define PI 3.14159265358979323
#define y second
#define x first
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define pqueue priority_queue< ll >
//#define pdqueue priority_queue< ll,vector<ll> ,greater< ll > >
#define codejamDebug(x) cout<<"Case #"<<x<<": ";
#define debug(x) cout<<#x<<" :"<<x<<endl;
#define rep(i,n) for(long long i=0;i<n;i++)
#define f(i,a,b) for(long long i = a; i < b; i++)
#define fd(i,a,b) for(long long i = a; i >=b; i--)
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long int           ll;
typedef long double             ld;
typedef unsigned long long int ull;
typedef vector <int>            vi;
typedef vector <ll>            vll;
typedef pair <int, int>        pii;
typedef pair <ll, ll>          pll;
typedef vector < pii >        vpii;
typedef vector < pll >        vpll;
typedef vector <string>         vs;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//Handle:cyber_rajat

int main(int argc, char const *argv[])
{
	sync;
	ll a, b, c, k;
	cin >> a >> b >> c >> k;
	if(k >= a ){
		k -= a;
		if(k >= b){
			k -= b;
			cout << a - k << endl;
		}else{
			cout << a << endl;
		}
	}else{
		cout << k << endl;
	}
	return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  for(int i = 0; i < n; i++) cin >> a[i];
  
  map<int, int> mp;
  for(int i = 0; i < n; i++) mp[a[i]]++;
  vector<int> b;
  for(auto x : mp) b.push_back(x.second);
  sort(b.begin(), b.end());
  int x = b.size() - k;
  int ans = 0;
  for(int i = 0; i < x; i++) ans += b[i];
  cout << ans << endl;
}

Measured memory_bytes: 11516
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace mondai0025
{
	class Program
	{
		static void Main(string[] args)
		{
			while( true ) {
				var	a_s	= Console.ReadLine();
				if( a_s == null ) {
					break;
				}
				var	b_s	= Console.ReadLine();
				var	a	= Array.ConvertAll( a_s.Split( new char[ 0 ], StringSplitOptions.RemoveEmptyEntries ), aa => int.Parse( aa ) );
				var	b	= Array.ConvertAll( b_s.Split( new char[ 0 ], StringSplitOptions.RemoveEmptyEntries ), bb => int.Parse( bb ) );
				
				int	hit		= 0;
				int	blow	= 0;
				for( int i = 0; i < a.Length; i++ ) {
					for( int j = 0; j < b.Length; j++ ) {
						if( a[ i ] == b[ j ] ) {
							if( i == j ) {
								hit++;
							} else {
								blow++;
							}
							break;
						}
					}
				}
				Console.WriteLine( hit + " " + blow );
			}
		}
	}
}

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

const int INF = 1001001001;

int main() {
    int n, x, y; cin >> n >> x >> y;
    x--; y--;
    vector<int> ans(n, 0);
    for (int sv = 0; sv < n; sv++) {
        vector<int> dist(n, INF);
        queue<int> q;
        auto push = [&](int v, int d) {
            if (dist[v] != INF) return;
            dist[v] = d;
            q.push(v);
        };
        push(sv, 0);
        while (!q.empty()) {
            int v = q.front(); q.pop();
            int d = dist[v];
            if (0 <= v - 1) push(v - 1, d + 1);
            if (v + 1 < n) push(v + 1, d + 1);
            if (v == x) push(y, d + 1);
            if (v == y) push(x, d + 1);
        }
        for (int i = 0; i < n; i++) {
            ans[dist[i]]++;
        }
    }
    for (int i = 0; i < n; i++) ans[i] /= 2;
    for (int i = 1; i <= n-1; i++) {
        cout << ans[i] << endl;
    }
    return 0;
}

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

#define rep(i, x, n) for (int i = x; i < n; i++)
typedef long long ll;

const int INF = 1e9 + 7;

using namespace std;

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

    int n;
    cin >> n;

    vector<int> a(n);
    rep (i, 0, n)
	cin >> a[i];

    vector<int> num(n);
    vector<int> ans;
    for (int i = n - 1; i >= 0; i--) {
	if (num[i] % 2 != a[i]) {
	    num[i] += 1;
	    ans.push_back(i + 1);

	    for (int j = 1; j*j <= (i + 1); j++) {
		if ((i + 1) % j == 0) {
		    num[j - 1] += 1;
		    if (j != 1 && j*j != (i + 1)) {
			num[(i + 1)/j - 1] += 1;
		    }
		}
	    }
 	}
    }

    cout << ans.size() << endl;
    for (auto it = ans.rbegin(); it != ans.rend(); it++) {
	cout << *it << endl;
    }

    
    return 0;
}


Measured memory_bytes: 3192
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,C,K;
  cin >> N >> C >> K;
  vector<int> vec(N);
  for(int i=0; i<N; i++){
    cin >> vec.at(i);
  }
  sort(vec.begin(),vec.end());
  int bus = 0;
  int pep = 1;
  int x = vec.at(0);
  for(int i=1; i<N; i++){
    if(vec.at(i) - x <= K && pep < C){
      pep++;
    }
    else{
      bus++;
      pep = 1;
      x = vec.at(i);
    }
  }
  if(pep > 0){
    bus++;
  }
  cout << bus << endl;
}

Measured memory_bytes: 640
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author ExplodingFreeze
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define f(i,a,b) for(int i=(a);i<(b);i++)
const int MOD=1e9+7;
using pii=std::pair<int,int>;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//using namespace __gnu_pbds;
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

using namespace std;

int n;
string s,t;
class ABC148B {
public:
	void solve(std::istream& in, std::ostream& out) {
		in >> n >> s >>t;
		f(i,0,n)
			out << s[i] << t[i];
		out << "\n";
	}
};


int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ABC148B solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

int main(){
  int A,B,C,D;
  string S;
  
  cin >> S;
  
  A = S[0] - '0';
  B = S[1] - '0';
  C = S[2] - '0';
  D = S[3] - '0';
  
  char op1,op2,op3;
  op1 = '+';
  op2 = '+';
  op3 = '+';
  
  for(int tmp=0; tmp<(1<<3);tmp++){
    bitset<3> s(tmp);
    
    B = abs(B);
    C = abs(C);
    D = abs(D);
    
    op1 = '+';
  	op2 = '+';
  	op3 = '+';
    
    if(s.test(0)){
      B *= -1;
      op1 = '-';
    }
    if(s.test(1)){
      C *= -1;
      op2 = '-';
    }
    if(s.test(2)){
      D *= -1;
      op3 = '-';
    }
    
    if(A+B+C+D == 7) break;
    
  }
  
  cout << A << op1 << abs(B) << op2 << abs(C) << op3 << abs(D) << "=7" << endl;
}

Measured memory_bytes: 256
import itertools

N = int(input())
evidence = list()
for _ in range(N):
    A_k = int(input())
    A_dict = dict()
    for i in range(A_k):
        x, y = map(int, input().split())
        A_dict[x-1] = y
    evidence.append(A_dict)
    
A = [0, 1]
product = list(itertools.product(A, repeat=N))
count_max = 0
for evi in product:
    check = 0
    for i, e in enumerate(evi):
        if e == 1:
            for k, v in evidence[i].items():
                if evi[k] != v:
                    check = 1
                    break
    if check == 0:
        count = sum(evi)
        if count > count_max:
            count_max = count
print(count_max)

Measured memory_bytes: 8820
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long x,a,b,c,ans=0;
    cin>>a>>b>>c>>x;
    for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)for(int z=0;z<=c;z++){
                int k=i*500+j*100+z*50;
                if(k==x)ans++;
                if(k>x)break;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
ll LCM(ll a,ll b){return (a*b)/GCD(a,b);}
 
//const int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

int main()
{
	int n, d;
	cin >> n >> d;
	double x[n][d];
	double tmp = 0;
	ll ans = 0;
	REP(i, n) REP(j, d) cin >> x[i][j];
	REP(i, n){
		REP(j, i){
			tmp = 0;
			REP(k, d) tmp += pow(x[i][k] - x[j][k], 2);
			tmp = sqrt(tmp);
			if (tmp == (int)tmp) ans++;
		}
	}

	cout << ans << endl;

}


Measured memory_bytes: 256
///apigs property
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(0) , cin.tie(0) , cout.tie(0)
#define F first
#define S second
#define pb push_back
#define vll vector< ll >
#define vi vector< int >
#define pll pair< ll , ll >
#define pi pair< int , int >
#define all(s) s.begin() , s.end()
#define sz(s) s.size()
#define md (s + e) / 2
#define mid (l + r) / 2
using namespace std;
typedef long long ll;
ll q, dp[1005][1005], a[555555] , b[555555], k, l, m, n, o, p;
map < ll , ll > mp;
vll adj[555555];
char s[1005][1005];
const ll mod = 1e9+7;
ll mem(ll i , ll j){
	if(i == n && j == m)return 1;
	if(i > n || j > m || s[i][j] == '#')return 0;
	ll &r = dp[i][j];
	if(r != -1)return r;
	r = 0;
	return r = (mem(i + 1 , j) % mod + mem(i , j + 1) % mod ) % mod;
}
void solve(){
	memset(dp , -1 , sizeof dp);
	cin >> n >> m;
	for(ll i = 1 ; i <= n ; i++){
		for(ll j = 1 ; j <= m ; j++){
			cin >>s[i][j];
		}
	}
	cout << mem(1 , 1) << endl;
	/*for(ll i = 1 ; i <= n ; i++){
		for(ll j = 1 ; j <= m ; j++){
			cout << dp[i][j] << " ";
		}
		cout << endl;
	}*/
}
int main() {
    fast ;
	// cin >> q;
    q = 1;
    while(q--){
    	solve();
	}
}



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

using namespace std;

#define REP1(i,n) for(int i=1, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define pow(x) x*x
#define ll long long

static const ll MAX = 1000000;
static const ll INFTY = 1e12;
static const ll MOD = 1000000007;

template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

struct edge {
    ll to, cost;
};

using Graph = vector<vector<int>>;
using _Graph = vector<vector<edge>>;


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

// 深さ優先探索
vector<bool> seen;
vector<int> colors;

int H, W, N;
int sx, sy, gx, gy; 
vector<vector<char>> field;
vector<vector<int>> dist;
//vector<pair<int, int>> gx, gy;
deque<pair<int, int>> que;

typedef vector<vector<int> > Matrix;

const ll INF = 1e18;

int main() {

    int N, M, X, Y;
    cin >> N >> M >> X >> Y;
    vector<int> x(N), y(M);
    REP(i, N){
        cin >> x[i];
    }
    REP(i, M){
        cin >> y[i];
    }
    sort(x.begin(), x.end(), greater<int>());
    sort(y.begin(), y.end());
    // cout << x[0] << " " << y[0] << endl;

    for(int i = X+1; i <= Y; i++){
        if(i <= y[0]){
            if(i>x[0]){
                cout << "No War" << endl;
                return 0;
            }
        }
    }
    cout << "War" << endl;



 

}

/*
みんな、くるくるぱーにな〜れ
　∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/



Measured memory_bytes: 256