akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES // M_PI
#include<cmath>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define rREP(i,a,n) for(int (i)=(n)-1; (i)>=(a);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr int INF = 2147483647;
constexpr ll mod = 1000000007;

template<class T>inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T>inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int n; cin >> n;
	vector<int>B(n - 1);
	rep(i, n - 1)cin >> B[i];
	vector<int>A(n);
	A[0] = B[0];
	A[n - 1] = B[n - 2];
	REP(i, 1, n - 1) {
		A[i] = min(B[i - 1], B[i]);
	}
	int cnt = 0;
	rep(i, n)cnt += A[i];
	cout << cnt << "\n";

	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 n = sc.nextInt();
    int x = sc.nextInt();
    int l[] = new int[n];
    int d = 0;
    int i = 0;
    for (int cnt = 0; cnt < n; cnt++) {
      l[cnt] = sc.nextInt();
      d += l[cnt];
      if (d > x) {
        i = cnt + 1;
        break;
      } else {
        i = n + 1;
      }
    }
    System.out.println(i);
    sc.close();
  }
}

Measured memory_bytes: 35764
/*
// Sample code to perform I/O:

cin >> name;                            // Reading input from STDIN
cout << "Hi, " << name << ".\n";        // Writing output to STDOUT

// Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
*/

// Write your code here


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define  boost ios_base::sync_with_stdio(false);cin.tie(NULL);

#define  mod 1000000007 

int main(){
    boost;
  ll ans=0;
  ll k;
  cin>>k;
  for(int i=1;i<=k;i++){
      for(int j=1;j<=k;j++){
          for(int kk=1;kk<=k;kk++){
              int  kkk=__gcd(i,j);
              if(kkk!=1)
              kkk=__gcd(kkk,kk);
              ans+=kkk;
              
          }
      }
  }
  cout<<ans;
  
    return 0;
}


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

#define all(x) (x).begin(), (x).end()
#define itn int
#define make_unique(x) sort((x).begin(), (x).end()); (x).erase(unique((x).begin(), (x).end()), (x).end())

using namespace std;

inline int nxt() {
	int x;
	scanf("%d", &x);
	return x;
}

int dp[20][20];

int main() {
	int n = nxt();
	string s;
	cin >> s;

	long long ans = 0;
	for (int mask = 0; mask < (1 << n); ++mask) {
		string a[2] = {"", ""};
		for (int i = 0; i < n; ++i) {
			int j = (mask >> i) & 1;
			a[j] += s[i];
		}
		reverse(all(a[0]));
		reverse(all(a[1]));
		dp[0][0] = 1;
		for (int i = 0; i < n; ++i) {
			for (int j = 0; j <= i + 1; ++j) {
				dp[j][i + 1 - j] = 0;
			}
			for (int x = 0; x <= i; ++x) {
				int y = i - x;
				char c = s[n + i];

				if (x < (int)a[0].size() && a[0][x] == c) {
					dp[x + 1][y] += dp[x][y];
				}
				if (y < (int)a[1].size() && a[1][y] == c) {
					dp[x][y + 1] += dp[x][y];
				}
			}
		}
		ans += dp[a[0].size()][a[1].size()];
	}

	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vin=vector<int>;
using vll=vector<long long>;
using vvin=vector<vector<int>>;
using vvll=vector<vector<long long>>;
using vstr=vector<string>;
using vvstr=vector<vector<string>>;
using vch=vector<char>;
using vvch=vector<vector<char>>;
using vbo=vector<bool>;
using vvbo=vector<vector<bool>>;
using vpii=vector<pair<int,int>>;
using pqsin=priority_queue<int,vector<int>,greater<int>>;
#define mp make_pair
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep2(i,s,n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define decp(n) cout<<fixed<<setprecision((int)n)
#define _GLIBCXX_DEBUG
const int inf=1e9+7;

int main(){
    int n,k;cin>>n>>k;
    if(k==1){
        cout<<(ll)n*n*n<<endl;
        return 0;
    }
    vin r(k,0);
    if(n<k)rep(i,n)r[i+1]=1;
    else{
        rep(i,k)r[i]=n/k;
        rep(i,n%k)r[i+1]++;
    }
    if(k%2){
        cout<<(ll)r[0]*r[0]*r[0]<<endl;
        return 0;
    }
    cout<<(ll)r[0]*r[0]*r[0]+(ll)r[k/2]*r[k/2]*r[k/2]<<endl;

}


Measured memory_bytes: 1024
import sys
readline = sys.stdin.readline
write = sys.stdout.write
def dot3(p0, p1, p2):
    x0, y0 = p0; x1, y1 = p1; x2, y2 = p2
    return (x1 - x0) * (x2 - x0) + (y1 - y0) * (y2 - y0)
def cross3(p0, p1, p2):
    x0, y0 = p0; x1, y1 = p1; x2, y2 = p2
    return (x1 - x0) * (y2 - y0) - (y1 - y0) * (x2 - x0)
def dist2(p0, p1):
    x0, y0 = p0; x1, y1 = p1
    return (x0 - x1)**2 + (y0 - y1)**2
def solve():
    N = int(readline())
    P = [list(map(int, readline().split())) for i in range(N)]
    ok = 1
    for i in range(N-1):
        p0 = P[i]; p1 = P[i+1]
        d0 = dist2(p0, p1)**.5
        el0 = [-d0, d0]; el1 = [-d0, d0]
        er0 = [-d0, d0]; er1 = [-d0, d0]
        for j in range(i):
            q0 = P[j]
            d1 = dist2(p0, q0)**.5
            d2 = dist2(p1, q0)**.5
            sv = cross3(p0, p1, q0)

            cv0 = dot3(p0, p1, q0) / d1
            cv1 = dot3(p1, p0, q0) / d2
            if sv > 0:
                el0[0] = max(el0[0], cv0)
                el1[0] = max(el1[0], -cv1)
            else:
                er0[1] = min(er0[1], -cv0)
                er1[1] = min(er1[1], cv1)
        for j in range(i+2, N):
            q1 = P[j]
            d1 = dist2(p1, q1)**.5
            d2 = dist2(p0, q1)**.5
            sv = cross3(p1, p0, q1)

            cv0 = dot3(p1, p0, q1) / d1
            cv1 = dot3(p0, p1, q1) / d2
            if sv > 0:
                er1[0] = max(er1[0], cv0)
                er0[0] = max(er0[0], -cv1)
            else:
                el1[1] = min(el1[1], -cv0)
                el0[1] = min(el0[1], cv1)
        if (not max(el0[0], er0[0]) <= min(el0[1], er0[1])
         or not max(el1[0], er0[0]) <= min(el1[1], er1[1])):
            ok = 0
            break
    if ok:
        write("Possible\n")
    else:
        write("Impossible\n")
solve()


Measured memory_bytes: 5896
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code
from collections import Counter
def resolve():
    A=int(input())
    B=int(input())
    if A==B:print("EQUAL")
    else:print(["LESS","GREATER"][A>B])

#%%submit!
resolve()




Measured memory_bytes: 38384
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <functional>
#include <list>
#include <numeric>
#include <math.h>
#include <cstdlib>
#include <queue>
#include <iterator>
#include <limits>
#include <string>
#include <sstream>
#include <iomanip>
#include <bitset>
#include <mutex>
#include <condition_variable>
#include <atomic>
#include <stack>
#include <memory>
#include <deque>
#include <string_view>
#include <random>
#include <chrono>
#include <cstring>

using namespace std;

static int my_speed_up = []() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); return 0; }();
using ll = long long; using ull = unsigned long long;
template<class T> using v = vector<T>;
template<class T> using vv = vector<vector<T>>;
template<class T> using vvv = vector<vector<vector<T>>>;
template<class T> using vvvv = vector<vector<vector<vector<T>>>>;
#define for_b(i, b) for (int i = 0; i < (b); ++i)
#define for_ab(i, a, b) for (int i = a; i < (b); ++i)
#define what_is(x) cout << #x << " = " << x << endl;
#define what_are(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl;
#define pad(x) for_b(i, x) cout << "  ";
#define show_1d(___x) cout << #___x << " = "; for (auto& ___num : ___x) cout << ___num << ", "; cout << endl;
#define show_2d(___x) cout << #___x << endl; for (auto& ___row : ___x) { for (auto ___num : ___row) cout << ___num << ", "; cout << endl; }
#define show_3d(___x) cout << #___x << endl; for (auto& ___row : ___x) { for (auto& ___row2 : ___row) { for (auto ___num : ___row2) cout << ___num << ", "; cout << endl; }cout << endl; }


int main()
{
    int n;
    cin >> n;
    
    if (n == 0)
    {
        cout << 0 << endl;
        return 0;
    }
    
    string stones;
    cin >> stones;
    
    if (stones.size() <= 1) return 0;
    int l = 0, r = stones.size() - 1;
    
    int res = 0;
    while (l < r)
    {
        if (stones[l] == 'W' && stones[r] == 'R')
        {
            ++res;
            ++l; --r;
        }
        else
        {
            if (stones[r] == 'W')
                --r;
            if (stones[l] == 'R')
                ++l;
        }
    }
    cout << res << endl;
    
    return 0;
}

Measured memory_bytes: 3704
import itertools
import numpy as np
import sys
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

A,B,C,K = IL()

if K%2==0:
    if abs(A-B) <= int(10e10):
        print(A-B)
    else:
        print("Unfair")
else:
    if abs(B-A) <= int(10e10):
        print(B-A)
    else:
        print("Unfair")

Measured memory_bytes: 12392
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

ll gcd(ll a,ll b){
  if(b == 0) return a;
  return gcd(b , a % b);
}

ll mod(ll a){
  return a % 1000000007;
}

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


int main(){
  ll n; cin >> n; vl num ( n); ll sum = 0; bool flag = true;
  
  rep(i,n){ cin >> num[i]; sum += num[i]; } 
  
  for(ll i=0; i < n; i++){
    if(sum - num[i] <= num[i]){
      flag = false;
      break;
    }
  }
  
  if(flag) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a= sc.nextInt();
		int b =  sc.nextInt();
		if((a+b)==15)System.out.println("+");
		else if((a * b)==15)System.out.println("*");
		else System.out.println("x");
		
	return ;
	}
}

Measured memory_bytes: 23252
def main():
  h, w = map(int, input().split())
  S = h*w
  if S%3==0:
    return 0

  ds = [h, w]
  
  h1 = (h+1)//3
  s1 = h1*w; s2 = w//2*(h-h1); s3 = S-s1-s2
  ds.append(max(s1,s2,s3)-min(s1,s2,s3))
  
  w1 = (w+1)//3
  s1 = w1*h; s2 = h//2*(w-w1); s3 = S-s1-s2
  ds.append(max(s1,s2,s3)-min(s1,s2,s3))
  
  return min(ds)

print(main())

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

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

const long long INF = 1LL << 60;

int N;
long long h[100010];

long long dp[100010];

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

  for (int i = 0; i < 100010; i++) dp[i] = INF;

  dp[0] = 0;
  for (int i = 1; i < N; i++) {
    chmin(dp[i], dp[i-1] + abs(h[i]-h[i-1]));
    if(i > 1) chmin(dp[i], dp[i-2] + abs(h[i]-h[i-2]));
  }
  std::cout << dp[N-1] << '\n';
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, from, to) for (int i = from; i < (to); ++i)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
using ll = long long;
using vin=vector<int>;
using vll=vector<ll>;
using P = pair<int, int>;
const int inf=1e9+7;
const ll INF=1e18;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }

int main() {
  int n;
  cin>>n;
  vll a(n);
  rep(i,0,n) cin>>a[i];
  /////////////////////
  sort(all(a));
  ll sum=a[0];
  int ans=0;
  rep(i,0,n-1){
     if(sum*2>=a[i+1]){
       sum+=a[i+1];
     }
    else{
     ans=i+1;
      sum+=a[i+1];
    }
  }
  cout<<n-ans<<endl;
}









Measured memory_bytes: 1024
pr = Array.new(10**6,1)
(2..1000).each{|i|
	j = i * i
	while j < 10**6
		pr[j] = 0
		j += i
	end
}
pr[0] = pr[1] = 0
(2..10**6).each{|i|
	pr[i] = pr[i] == 1 ? pr[i-1]+1 : pr[i-1]
}
while gets
	p pr[$_.to_i]
end

Measured memory_bytes: 13904
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
#define all(x) (x).begin(),(x).end()
#define debug(x) cerr<<#x<<": "<<x<<endl
#define debug_vec(v) cerr<<#v<<":";rep(i,v.size())cerr<<" "<<v[i];cerr<<endl
using namespace std;
int MOD = 1000000007;
vector<int> G[100100];

signed main(){
    string s;
    cin >> s;
    int mx = 0;
    int cnt = 0;
    rep(i,s.size()){
        if(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
            cnt++;
            mx = max(mx,cnt);
        }else{
            cnt = 0;
        }
    }
    cout << mx << endl;
    
    return 0; 
}

// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://yahoo-procon2019-qual.contest.atcoder.jp/tasks/yahoo_procon2019_qual_d
// rm -r -f test;oj dl http://abc122.contest.atcoder.jp/tasks/abc122_a

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

using ll = long long;

constexpr ll mod = 1000000007;

int solve() {
	int N, M; cin >> N >> M;
	ll r = 0, c = 0;
	vector<bool> nr(N*M, false), nc(N*M, false);
	for (int i = 0; i < N; i++) {
		int x; cin >> x; x--; if (nr[x]) return 0;
		nr[x] = true;
	}
	for (int i = 0; i < M; i++) {
		int x; cin >> x; x--; if (nc[x]) return 0;
		nc[x] = true;
	}
	ll res = 1;
	for (int i = N * M - 1; i >= 0; i--) {
		if (nr[i]) r++;
		if (nc[i]) c++;
		if (nr[i] && nc[i]) continue;
		else if (nr[i]) res *= c;
		else if (nc[i]) res *= r;
		else res *= (r * c - (N * M - 1 - i));
		res %= mod;
	}
	return res;
}

int main() {
	cout << solve() << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <list>
#include <queue>
#include <cmath>
#include <numeric>
using namespace std;

int inf = (1 << 30);
int mod = 1e9 + 7;
int64_t inf64 = (1LL << 60);

template <typename T>
T gcd(T a, T b) {
    if(b == 0) return a;
    else return gcd(b, a % b);
}

template <typename T>
T lcm(T a, T b) {
    T g = gcd(a, b);
    return a / g * b;
}

bool check(vector<int> a, int index, int key){
    if(a[index] >= key) return true;
    else return false;
}

int lower_bound(vector<int> a, int key){
    int left = -1, right = a.size();
    while(right - left > 1){
        int mid = left + (left + right) / 2;
        if(check(a, mid, key)) right = mid;
        else left = mid;
    }
    return right;
}

int main(){

    int N;
    cin >> N;
    map<pair<string, int>, int> SP; // city, point, index
    for(int i = 1; i <= N; i++){
        string city;
        int point;
        cin >> city >> point;
        SP.insert(make_pair(make_pair(city, -point), i));
    }

    for(auto itr = SP.begin(); itr != SP.end(); itr++){
        cout << itr->second << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<sstream>
#include<cmath>
#include<numeric>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<set>
using namespace std;
int mod = 1e9+7;

int main() {
  vector<int> a(3, 0);
  cin >> a[0] >> a[1] >> a[2];

  int cnt = 0;
  if( a[0] == a[1] && a[1] == a[2] && a[0]%2 == 0 ){
    cout << -1 << endl;
    return 0;
  }
  if( a[0]%2 == 1 || a[1]%2 == 1 || a[2]%2 == 1 ){
    cout << 0 << endl;
    return 0;
  }
  while(true) {
    vector<int> b(3, 0);
    b[0] = (a[1]/2) + (a[2]/2);
    b[1] = (a[0]/2) + (a[2]/2);
    b[2] = (a[0]/2) + (a[1]/2);
    cnt++;
    cerr << b[0] << " " << b[1] << " " << b[2] << endl;
    if( b[0]%2 == 1 || b[1]%2== 1 || b[2]%2 == 1 ) break;
    a = b;
  }
  cout << cnt << endl;

  return 0;
}




//


Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    io.Source.stdin.getLines foreach (n => println(pi(n.toInt)))
  }
  val primes: IndexedSeq[Int] = prime_sieve(1000)
  val pi_cache: collection.mutable.Map[Int, Int] = collection.mutable.Map.empty
  val phi_cache: collection.mutable.Map[(Int, Int), Int] = collection.mutable.Map.empty
  def prime_sieve(x: Int): IndexedSeq[Int] = {
    val n = x - x % 6 + 6
    val correction = if (x % 6 > 1) 1 else 2
    val sieve = Array.fill(n/3)(true)
    for (i <- 1 to (Math.sqrt(n) / 3).toInt if sieve(i)) {
      val k = (3 * i + 1) | 1
      for (j <- (k * k) / 3 until sieve.length by 2*k) sieve(j) = false
      for (j <- (k*(k-2*(i&1)+4))/3 until sieve.length by 2*k) sieve(j) = false
    }
    2 +: 3 +: (for (i <- 1 until n / 3 - correction if sieve(i)) yield (3*i+1)|1)
  }
  def bisect(n: Int): Int = {
    def loop(left: Int, right: Int): Int = {
      val mid = (left + right) / 2
      if (primes(mid) <= n && n < primes(mid+1)) mid+1
      else if (n < primes(mid)) loop(left, mid)
      else loop(mid+1, right)
    }
    if (n < primes.head) 0
    else if (n >= primes.last) primes.length
    else loop(0, primes.length)
  }
  def pi(x: Int): Int =
    pi_cache.getOrElseUpdate(x,
      if (x <= primes.last) bisect(x)
      else {
        val a = pi(Math.sqrt(Math.sqrt(x)).toInt)
        val b = pi(Math.sqrt(x).toInt)
        val c = pi(Math.cbrt(x).toInt)

        var result = phi(x, a) + ((b + a - 2) * (b - a + 1)) / 2
        for (i <- a + 1 to b) {
          val w = x / primes(i - 1)
          val b_i = pi(Math.sqrt(w).toInt)
          result -= pi(w)
          if (i <= c)
            for (j <- i to b_i)
              result = result - pi(w / primes(j - 1)) + j - 1
        }
        result
      }
    )
  def phi(x: Int, a:Int): Int =
    phi_cache.getOrElseUpdate(
      (x,a),
      {
        if (a == 1) (x + 1) / 2
        else phi(x, a - 1) - phi(x / primes(a - 1), a - 1)
      }
    )
}

Measured memory_bytes: 48072
#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 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(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

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 n;
int a[11];

void bitBruteForth() {
   bool printed = false;
   rep (mask, (1<<10)) {
      bool ok = true;
      int oldA = -1, oldB = -1;
      rep (j, 10) {
         if ((mask>>j)&1) {
            if (a[j] > oldA) {
               oldA = a[j];
            } else {
               ok = false;
            }
         } else {
            if (a[j] > oldB) {
               oldB = a[j];
            } else {
               ok = false;
            }
         }
      }
      if (ok) {
         puts("YES");
         printed = true;
         break;
      }
   }
   if (!printed) puts("NO");
}

bool rec(int idx, int l, int r) {
   if (idx == 10) return true;

   bool x = false, y = false;
   int val = a[idx];
   if (l < val) x = rec(idx+1, val, r);
   if (r < val) y = rec(idx+1, l, val);

   return x || y;
}

int main() {
   cin >> n;
   while (n--) {
      rep (i, 10) cin >> a[i];
      puts(rec(0, -1, -1)?"YES":"NO");
   }

   return 0;
}


Measured memory_bytes: 2908
#include<iostream>
#include<cmath>
#include<vector>
#include<set>
#include<algorithm>
#include<tuple>
#include<utility>
#include<cctype>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0;i<n;++i)
#define RUP(a,b) ((a+b-1)/(b))
#define ENT "\n"

typedef long long ll;
typedef tuple<int,int,bool> Tb;

int atcoder(){
    int v[3][3];
    REP(i,3){
        REP(j,3) cin >> v[i][j];
    }
    bool ans = true;

    REP(i,2){
        if(v[0][i]-v[0][i+1]!=v[1][i]-v[1][i+1] || v[1][i]-v[1][i+1]!=v[2][i]-v[2][i+1]){
            ans =false;
        }
    }
    
    if(ans) cout << "Yes" <<ENT;
    else cout << "No" <<ENT;
    return 0;
}

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


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

int main() {
    int n; cin>>n;
    bool ok=false;
    vector <int> v(n);
    for(int i=0; i<n; i++){
        cin>>v[i];
    }
    sort(v.begin(), v.end());
    for(int i=0; i<n; i++){
            if(v[i]==v[i+1]){cout<<"NO"; ok=true; break;}
    }
    if(ok==false)cout<<"YES";
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define AB_BHI_NI_DEGI                \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define int long long
#define pb push_back
#define N 100009
#define inf 1e18
const double PI = 3.141592653589793238462643383279;
int mod = 1e9 + 7;
//int mod = 998244353;
#define P pair<int, int>
#define F first
#define S second
#define all(v) v.begin(), v.end()
#define vi vector<int>
#define ld long double

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

void solve()
{
    int n;
    cin >> n;
    int ans = n - 1;
    for (int i = 2; i < n; i++)
    {
        int x = n / i;
        if (n % i == 0)
            x--;
        ans += x;
    }
    cout << ans << "\n";
}
int32_t main()
{
    AB_BHI_NI_DEGI
    int Test = 1;
    //cin >> Test;
    //init();
    while (Test--)
        solve();
    return 0;
}
/*

*/

Measured memory_bytes: 3688
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < j; ++i)
#define FOR(i, j, k) for(int i = j; i < k; ++i)
#define P pair<int, int>

vector<string> split(string str){
  stringstream ss(str);
  string tmp;
  vector<string> ret;
  while(getline(ss, tmp, ' ')) ret.push_back(tmp);
  return ret;
}

string make_s(vector<string> &v){
  stringstream ss;
  REP(i, 4 - v[0].size()) ss << "0";
  ss << v[0];
  REP(i, 2 - v[1].size()) ss << "0";
  ss << v[1];
  REP(i, 2 - v[2].size()) ss << "0";
  ss << v[2];
  return ss.str();
}

int main() {
  string str;
  while(getline(cin, str)){
    vector<string> tmp = split(str);
    string s = make_s(tmp);
    int y = atoi(tmp[0].c_str()), m = atoi(tmp[1].c_str()), d = atoi(tmp[2].c_str()), s_i = atoi(s.c_str());

    if(s_i < 18680908){
      cout <<"pre-meiji" <<endl;
    } else if(s_i < 19120730){
      cout <<"meiji " <<y - 1868 + 1 <<" " <<m <<" " <<d <<endl;
    } else if(s_i < 19261225){
      cout <<"taisho " <<y - 1912 + 1 <<" " <<m <<" " <<d <<endl;
    } else if(s_i < 19890108){
      cout <<"showa " <<y - 1926 + 1 <<" " <<m <<" " <<d <<endl;
    } else{
      cout <<"heisei " <<y - 1989 + 1 <<" " <<m <<" " <<d <<endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1216
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm> 
#include <stdio.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <list>
#include <utility>
#include <set>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <random>

using namespace std;

static const double EPS = 1e-9;
template<class T> bool INRANGE(T x, T a, T b) { return a <= x && x <= b; }
template<class T> void amin(T &a, T v) { if (a > v) a = v; }
template<class T> void amax(T &a, T v) { if (a < v) a = v; }
int ROUND(double x) { return (int)(x + 0.5); }
bool ISINT(double x) { return fabs(ROUND(x) - x) <= EPS; }
bool ISEQUAL(double x, double y) { return fabs(x - y) <= EPS * max(1.0, max(fabs(x), fabs(y))); }
double SQSUM(double x, double y) { return x * x + y * y; }
#define PI  (acos(-1))
#define ARRAY_NUM(a) (sizeof(a)/sizeof(a[0])) 
#define NG (-1)
#define BIG ((int)1e9+10)
#define BIGLL ((ll)4e18)
#define SZ(a) ((int)(a).size())
#define SQ(a) ((a)*(a))
typedef unsigned long long ull;
typedef long long ll;

int main()
{
	int freq[5] = {};
	for (int i=0;i<6;++i)
	{
		int tmp;
		cin >> tmp;
		freq[tmp]++;
	}

	map <int, int> mp;
	for (int i=1;i<=4;++i)
	{
		mp[freq[i]]++;
	}

	if (mp[2] == 2 && mp[1] == 2)
	{
		printf("YES\n");
	}
	else
	{
		printf("NO\n");
	}

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;


public class Main {

    public static int ctoi(char c) {
        switch (c) {
            case '0': return 0;
            case '1': return 1;
            case '2': return 2;
            case '3': return 3;
            case '4': return 4;
            case '5': return 5;
            case '6': return 6;
            case '7': return 7;
            case '8': return 8;
            case '9': return 9;
            default: return 0;
        }
    }

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

        while (true) {
            int sum = 0;
            String str = new String();
            str = input.next();
            char d = str.charAt(0);
            int c = ctoi(d);
            if (c == 0) {
                break;
            }
            for (int i = 0; i < str.length(); i++) {
                char a = str.charAt(i);
                int b = ctoi(a);
                sum += b;
            }
            System.out.println(sum);
        }

    }
}


Measured memory_bytes: 26708
#include<stdio.h>

int main(void) {
	long L, R;
	scanf("%ld%ld", &L, &R);

	int l, r;
	int ls, rs;

	int i, j;

	l = L % 2019;
	r = R % 2019;
	ls = L / 2019;
	rs = R / 2019;
	int min = 2019;

	if (rs - ls >= 1) {
		printf("0");
	}
	else {
		for (i = l;i < r;i++) {
			for (j = i + 1;j <= r;j++) {
				if (min > (i * j) % 2019) {
					min = (i * j) % 2019;
				}
			}
		}

		printf("%d", min);
	}

	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
#include <cstdint>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph = vector<vector<int>>;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, N) for(int i = 0; i < N; i++)
#define rep2(i, l, r) for (ll i = (ll)l; i < (ll)(r); i++)
#define INF 1000000000000000
#define MAX 200001

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
const ll MOD = 1000000007;

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

int main(){
    ll N;
    cin >> N;
    ll ans = 0;
    for(int a = 1; a < N; a++){
        if(N % a == 0){
            ans += N/a-1;
        }
        else{
            ans += N/a;
        }
    }
    cout << ans << endl;
}

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

int main(){
    int n;
    int an[100];
    cin >> n;
    for (int x = 0; x < n; x++) cin >> an[x];
    
    for (int x = n -1 ; x >= 0; x--) {
        if (x != n -1) cout << " ";
        cout   << an[x];
    }
    cout << endl;
   
    return 0;
}

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

score = dict()

for i in range(N):
	if A[i] in score:
		score[A[i]] += 1
	else:
		score[A[i]] = 1
		
score_sorted = sorted(score.items(), key=lambda x:x[1])
# print(score_sorted)
ret = 0

if len(score_sorted) - K > 0:
	for i in range(len(score_sorted) - K):
		ret += score_sorted[i][1]
	print(ret)
else:
	print(0)

Measured memory_bytes: 98504
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include <functional>
#include <limits>


using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

class BIT{
	vector<int> bit;
	
public:
	
	BIT(){
	}
	
	BIT(int size){
		init(size);
	}
	
	void init(int size){
		bit.clear();
		bit.resize(size+1);
	}
	
	int sum(int i){
		int s = 0;
		while(i > 0){
			s += bit[i];
			i -= i & -i;
		}
		return s;
	}

	void add(int i , int x){
		while(i < bit.size()){
			bit[i] += x;
			i += i & -i;
		}
	}

	int lower_bound(int w){
		if(w <= 0) return 0;
		int x = 0, t = 1;
		while(t*2 < bit.size()) t *= 2;
		
		for(int k = t; k > 0; k /= 2){
			if(x + k < bit.size() && bit[x + k] < w){
				w -= bit[x + k];
				x += k;
			}
		}
		return x + 1;
	}
};


signed main(){
	// cin.tie(nullptr);
	// ios::sync_with_stdio(false);
	// cout<<fixed<<setprecision(10);
	
	int N, Q;
	string S;
	vector<BIT> bit(26);
	
	cin>>N;
	cin>>S;
	cin>>Q;
	
	for(int i = 0; i < 26; i++){
		bit[i].init(N+10);
	}
	
	for(int i = 0; i < N; i++){
		bit[S[i] - 'a'].add(i+1, 1);
	}
	
	for(int i = 0; i < Q; i++){
		int a, b;
		
		cin>>a>>b;
		
		
		if(a == 1) {
			char c;
			
			cin>>c;
			
			bit[S[b-1] - 'a'].add(b, -1);
			bit[c - 'a'].add(b, 1);
			S[b-1] = c;
			
		} else {
			int r;
			cin>>r;
			
			int con = 0;
			for(int j = 0; j < 26; j++){
				if(bit[j].sum(r) - bit[j].sum(b-1) >= 1) con++;
			}
			
			cout<<con<<endl;
		}
	}
	
	return 0;
}

Measured memory_bytes: 102528
#include<iostream>
using namespace std;
int main() {
    int a,b,c,t;
    cin >> a >> b >> c;
    if (a > b){
        t = a; a = b; b = t;
    }
    if (b > c){
        t = b; b = c; c = t;
    }
    if (a > b){
        t = a; a = b; b = t;
    }
    cout << a << " " << b << " " << c << endl;
    
    return 0;
}


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

#define int long long
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

const unsigned int mod = 1e9 + 7;

using namespace std;

int32_t main() {
	fastio;

	int r;
	cin >> r;
	cout << 2.0 * 3.14 * r;

	return 0;
}


Measured memory_bytes: 3808
#include <iostream>
#include <algorithm>
#include <vector> //動的配列
#include <string>
#include <list> //双方向リスト
#include <map> //連想配列
#include <set> //集合
#include <stack>
#include <queue>
#include <deque>
#include <cmath>
#include <bitset>
#include <numeric>



typedef long long ll;


using namespace std;

typedef pair<int, int> P;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)



ll fast_pow(ll x,ll n,ll mod){
    if (n==0) return 1;
    ll res=fast_pow(x*x %mod,n/2,mod);
    if (n&1) res=res*x%mod;
    return res;
}

template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

//小さい順から取り出すヒープ
//priority_queue<ll, vector<ll>, greater<ll> > pque1;




int main(){
    ll l,r;
    cin>>l>>r;
    ll nmin=l;
    ll nmax=min(l+2019,r);
    ll cnt;
    ll ans=20000;
    for (ll i=nmin;i<nmax;i++){
        for (ll j=i+1;j<=nmax;j++){
            cnt=i*j;
            ans=min(cnt%2019,ans);
        }
    }
    cout<<ans;
    
    
    return 0;
    cout<<nmax<<nmin;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

#define mod 998244353

const long double PI = 3.141592653589793236L;

typedef long long int ll;
typedef long double ld;

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t;
    t=1;
    //cin>>t;
    while(t--)
    {
        ll n;
        cin>>n;
        if(n>=30) cout<<"Yes";
        else cout<<"No";
    }
    return 0;
}


Measured memory_bytes: 3096
#include<iostream>
#include<queue>
#include<algorithm>
#include<numeric>
#include<string>
#include<map>
#include<bitset>

using namespace std;
using int_greater_PQ = priority_queue<int,vector<int>,greater<int>>;


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

    map<int,int>A;
    for(int i=0;i<N;++i)
    {
        int a;
        cin>>a;
        A.emplace(a,i+1);
    }

    for(const auto&a:A)
    {
        cout<<a.second<<" ";
    }
    cout<<endl;
}

Measured memory_bytes: 8264
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

/*  Macros from Endagorion */
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;


int main(){
        
    ios_base::sync_with_stdio(0);
    
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int n,k;
    cin>>n>>k;
    int x[n][k];
    for(int i=0;i<n;i++)
        for(int j=0;j<k;j++)    x[i][j] =0 ;
    for(int i=0;i<k;i++){
        int d;
        cin>>d;
        for(int j=0;j<d;j++){
            int p;
            cin>>p;
            p--;
            x[p][i]++;
        }
    }
    int cnt=0;
    for(int i=0;i<n;i++){
        bool flag = true;
        for(int j=0;j<k;j++){
            if(x[i][j]>0)  {
                flag=false; 
                break;
            }
        }
        if(flag)    cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}



Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
const char newl = '\n';
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL<<60;
int main(){
    int k;
    string s;
    cin >> k >> s;
    if(s.size()<=k) cout << s << endl;
    else{
        rep(i,k){
            cout << s[i];
        }
        cout << "..." << endl;
    }
    return 0;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
// #define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    string a, b, c; cin >> a >> b >> c;
    char aa = toupper(a[0]);
    char bb = toupper(b[0]);
    char cc = toupper(c[0]);
    cout << aa << bb << cc << endl;
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 7672
fn main() {
    let nums: Vec<i64> = read_vec();
    println!("{}", nums[0] - nums[1] + 1);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
using namespace std;
#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 Forr(i,m,n) for(int i=m;i>n;i--)
#define Sort(a) sort(a.begin(),a.end())
#define pb push_back
#define vl vector<ll>
#define vll vector<vector<ll>>
#define INF 999999999999

int main(){
  int a;string s;
  cin>>a>>s;
  if(a>=3200) cout<<s<<endl;
  else cout<<"red"<<endl;
return 0;
}


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

using namespace std; 

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

    int cnt = 1;
    int res=0;
    for (int& a: A) {
        if (a == cnt) {
            ++cnt;
        } else {
            ++res;
        }
    }

    if (res == N) {
        res = -1;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1024
#include<iostream>

using namespace std;
using ll = long long;

int n;
ll x;
ll a[100005];

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

ll solve(){
  ll current = 0;
  ll ans = 0;
  for(int i = 0; i < n - 1; ++i){
    current = a[i];
    if(current > x){
      ans += current - x;
      current = x;
    }
    current += a[i + 1];
    if(current > x){
      ans += current - x;
      a[i + 1] -= (current - x);
      current = a[i + 1];
    }
  }
  return ans;
}

int main(){
  input();
  cout << solve() << endl;
}

Measured memory_bytes: 1024
#if 1
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <set>
#include <map>
#include <numeric>
#include <cassert>

using namespace std;
#define int long long
#define uint unsigned long long
constexpr int MOD = 1000000007;
constexpr int INF = 1145141919810;

#define LOADVEC(type,name,N) std::vector<type>name(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name[nnn]; \
}

#define LOADVEC2(type,name0,name1,N) std::vector<type>name0(N),name1(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name0[nnn];cin >> name1[nnn]; \
}

#define LOADVEC3(type,name0,name1,name2,N) std::vector<type>name0(N),name1(N),name2(N); \
for (int nnn = 0; nnn < N; ++nnn) { \
	cin >> name0[nnn];cin >> name1[nnn];cin >> name2[nnn]; \
}

#define LOAD(type,name) type name; \
cin >> name;


void proc();

signed main() {
	ios::sync_with_stdio(false);
	proc();
	return 0;
}

/*
--------------------------------------------------------
--------------------------------------------------------
---------------    template      ----------------------
--------------------------------------------------------
--------------------------------------------------------
*/


void proc() {
	LOAD(int, N);
	LOADVEC(int, V, N);
	LOADVEC(int, C, N);
	int res = 0;
	for (int i = 0; i < N; ++i) {
		res += std::max({ 0ll, V[i] - C[i] });
	}
	cout << res << endl;
}


#endif


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
int main(){
  int i,n,a[100010],dp[100010];
  scanf("%d\n",&n);
  for(i=1;i<=n;i++){
    scanf("%d\n",&a[i]);
  }
  for(i=0;i<=n;i++){
    dp[i]=1500000000;
  }
  dp[1]=0;
  for(i=2;i<=n;i++){
    if(abs(a[i-1]-a[i])+dp[i-1]<dp[i]){
      dp[i]=abs(a[i-1]-a[i])+dp[i-1];
    }
    if(i!=2){
    if(abs(a[i-2]-a[i])+dp[i-2]<dp[i]){
      dp[i]=abs(a[i-2]-a[i])+dp[i-2];
    }
    }
  }
  printf("%d\n",dp[n]);
  return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <queue>
#include <tuple>
#include <functional>

#define PI 3.14159265359
#define INF 100100100100100100
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,a,n) for(int i = a; i < n; i++)
#define in(a) cin >> a
#define out(a) cout << a << endl

using namespace std;

typedef long long ll;
typedef pair<ll, ll> PLL;

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



Measured memory_bytes: 256
#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

def main():
    a, b = map(int, sys.stdin.readline().split())
    s = sys.stdin.readline().strip()

    for i, c in enumerate(s):
        if i != a:
            if c.isdigit() == True and 0 <= int(c) <= 9:
                continue
        elif c == '-':
            continue
        break
    else:
        print('Yes')
        sys.exit()

    print('No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
int a[3][3],n;
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;


int main() {
    int x;
	cin >> x;
	bool a[1001]={false};
	a[1]=true;
	for (double i = 2;i <= 1000;i++){
		for (double j = 2;pow(i,j) <= 1000;j++){
		
			a[(int)pow(i,j)] = true;
			//cout << (int)pow(i,j) << "  " << int(pow(i,j)) << endl;
			
		}
	}
	
	for (int i = x;i>=0;i--){
		if (a[i]) {
			cout << i << endl;
			return 0;
		}
		
		}
	}





Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long INF = 1LL << 60;
const ll C = 1e9+7;

int main() {
    int N;
    cin >> N;
    ll F[N][10], P[N][11];

    //店Nが開いている時間帯
    for(int i=0; i<N; i++) for(int j=0; j<10; j++) cin >> F[i][j];
    //i:店N j:joisino共に開いている時間帯の個数
    for(int i=0; i<N; i++) for(int j=0; j<11; j++) cin >> P[i][j];

    ll res = -INF;
    for(int bit=1; bit<(1<<10); bit++) {
        ll cc = 0;
        for(int i=0; i<N; i++) {
            ll c = 0;
            for(int j=0; j<10; j++) {
                if((bit>>j&1) && (F[i][j] == 1)) c++;
            }
            cc += P[i][c];
        }
        if(res < cc) res = cc;
    }
    cout << res << endl;
}

Measured memory_bytes: 3632
import java.util.*;

public class Main{

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long x = sc.nextLong();
        long A = a/x;
        long B = b/x;
       
        if(a%x == 0){
          System.out.println(B-A+1);
        }else{
          System.out.println(B-A);
        }
	}
}

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

int main(void){
   ll a,b;
   cin >> a >> b;
   string A,B;
   rep(i,b){
       A+=a+'0';
   }
   rep(i,a){
       B+=b+'0';
   }
   if(a<b){
      cout << A << endl; 
   }
   else{
       cout << B << endl;
   }
   
}


Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int judge(int a,int b,int c,int l)
{
    int k=0;
    if(a<l)
        k++;
    if(b<l)
        k++;
    if(c<l)
        k++;
    return k;
}
int main()
{
    int a,b,c,sum=0,max1=0;
    scanf("%d%d%d",&a,&b,&c);
    max1=max(a,b);max1=max(max1,c);
    while((max1-a)>=2)
    {
        a+=2;
        sum++;
    }
    while((max1-b)>=2)
    {
        b+=2;
        sum++;
    }
    while((max1-c)>=2)
    {
        c+=2;
        sum++;
    }

    if(judge(a,b,c,max1)==0)
        printf("%d\n",sum);
    else if(judge(a,b,c,max1)==2)
        printf("%d\n",sum+1);
    else
        printf("%d\n",sum+2);
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long int;

ll A[5010];
bool used[5010][5010];
int main() {
    int N; scanf("%d", &N);
    for(int i=0; i<N; i++) {
        scanf("%lld", &A[i]);
    }

    sort(A, A+N);
    int ans = 0;
    for(int i=0; i<N; i++) {
        for(int j=i+1; j<N; j++) {
            if(used[i][j]) continue;
            used[i][j] = true;
            ll diff = A[j] - A[i]; int tmp = 2, pre = j;
            for(ll k=A[j]+diff; ; k+=diff) {
                int itr = lower_bound(A, A+N, k) - A;
                if(itr == N or A[itr] != k) break;
                tmp++;
                used[pre][itr] = true;
                pre = itr;
            }
            ans = max(ans, tmp);
        }
    }
    printf("%d\n", ans);
    return 0;
}



Measured memory_bytes: 26884