akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>


#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}


int main(void) {

	lli x;
	cin >> x;

	lli five_hundred = x / 500;
	lli five = (x % 500) / 5;
	five_hundred *= 1000;
	five *= 5;

	cout << five_hundred + five << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
signed main(){
  int X,t;
  cin>>X>>t;
  cout<<max(0LL,X-t);
  }


Measured memory_bytes: 256
#include <stdio.h>

static const int N=100;

int min(int x,int y){
  if(x>y) return y;
  else if(x==y) return x;
}

int main(){
  int n,l,k,i,j,p[N+1],m[N+1][N+1];
  scanf("%d",&n);
  for(i=1 ; i<=n ; i++){
    scanf("%d %d" ,&p[i-1],&p[i]);
  }
  for(i=1 ; i<=n ; i++) m[i][i]=0;
  for(j=2 ; j<=n ; j++){
    for(i=1 ; i<=n-j+1 ; i++){
      l=i+j-1;
      m[i][l] = (1<<21);
      for(k=i ; k<=l-1 ; k++){
        m[i][l] = min(m[i][l],m[i][k]+m[k+1][l]+p[i-1]*p[k]*p[l]);
      }
    }
  }
  printf("%d\n",m[1][n]);
  return 0;
}







Measured memory_bytes: 2056
#include<bits/stdc++.h>
#define ll long long
#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 dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }


using namespace std;

int main(){
     ll N;
     cin >> N;
     ll ans = 1000;
     for(ll i = 1; i <= (int)sqrt(N); ++i) {
         if (N % i == 0){
             ll res = i;
             ll res1 = N/i;
             ll l = 0;
             while(res > 0) {
                 res/= 10;
                 l++;
             }
             ll l1 = 0;
             while(res1 > 0) {
                 res1/= 10;
                 l1++;
             }
             chmin(ans, max(l, l1));
         }
     }

     cout << ans << endl;
}

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

#define int long long
#define forn(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int) (x).size())


int32_t main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s;
	cin >> s;
	int ans = -1;
	if (s == "SUN") ans = 7;
	if (s == "MON") ans = 6;
	if (s == "TUE") ans = 5;
	if (s == "WED") ans = 4;
	if (s == "THU") ans = 3;
	if (s == "FRI") ans = 2;
	if (s == "SAT") ans = 1;
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mod 1000000007
#define fi first
#define se second
#define pb push_back
#define IOS ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);

using namespace std;

int main()
{
    IOS;
    int n,m;
    cin>>n>>m;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    sort(a,a+n);
    pair<int,int> q[m];
    for(int i=0;i<m;i++)
    {
        cin>>q[i].se>>q[i].fi;
    }
    sort(q,q+m);
    reverse(q,q+m);
    int i=0,j=0;
    while(i<n && j<m)
    {
        //cout<<a[i]<<" "<<q[j].fi<<endl;
        if(q[j].fi<=a[i])
        {
            break;
        }
        else{
            a[i]=q[j].fi;
            i++;
            q[j].se--;
            if(q[j].se==0) j++;
        }
    }
    ll s=0;
    for(int i=0;i<n;i++)
    {
        s=s+(ll)a[i];
    }
    cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 1408
# from math import log2
from math import log
from bisect import bisect_left


def log2(x):
    return log(x, 2)


def getComp(n):
    return (1 << (1 + int(log2(n)))) - n


N = int(input())
A = [int(s) for s in input().split()]
A.sort()
B = []
C = []
i = 0
while i < len(A):
    j = i
    count = 1
    while i+1 < len(A) and A[j] == A[i+1]:
        count += 1
        i += 1
    B.append(A[j])
    C.append(count)
    i += 1

count = 0
i = len(B) - 1
while i >= 0:
    comp = getComp(B[i])
    j = bisect_left(B, comp)
    if i == j and C[i] < 2:
        i -= 1
        continue
    if B[j] != comp:
        i -= 1
        continue
    if not C[i] or not C[j]:
        i -= 1
        continue
    C[i] -= 1
    C[j] -= 1
    count += 1

print(count)


Measured memory_bytes: 112080
#include<bits/stdc++.h>
using namespace std;
int n,m;
int p[80],CLKJFDLKJFOSDJFOSDFJLSDJFL;
int PPPPPPPPPPPPPPPPPDDDDDDDDDDDDDD(int x){
	for(int i=2;i*i<=x;i++)
		if(x%i==0)return 0;
	return 1;
}
int main(){
	for(int i=2;i<=10005;i++){
		if(PPPPPPPPPPPPPPPPPDDDDDDDDDDDDDD(i) && i%10==1){
			p[CLKJFDLKJFOSDJFOSDFJLSDJFL++]=i;
		}
		if(CLKJFDLKJFOSDJFOSDFJLSDJFL>=70)break;
	}
	cin>>n;
	for(int i=0;i<n;i++){
		if(i!=0)cout<<" ";
		 cout<<p[i];
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<stack>
#include<cctype>
#include<climits>
#include<string>
#include<bitset>
#include<cfloat>
#include<iomanip>
#include<numeric>

//#define int long long
#define repi(i,start,end) for(int (i)=(start),TemPNuM=(int)(end);(i)<TemPNuM;++(i))
#define rep(i,end) repi((i),0,(end))
#define rfor(x,v) for(auto& (x) : (v))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define fsort(v,lambda) sort(all((v)),(lambda))
#define vin(v) rep(i,(v).size())cin >> (v)[i];
#define vpin(v) rep(i,(v).size())cin>>v[i].first>>v[i].second

using namespace std;
using ll =  long long;
using pint =  pair<int,int>;
using vint = vector<int>;
using vvint = vector<vint>;
using vpint = vector<pint>;

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; }
template<class T>void put_double(T a){if(cout.precision()!=12)cout<<setprecision(12);cout<<a<<endl;}
template<class T>void print(T a){cout << a << endl;}
//lambda: [](int x, int y){return x<y;}

signed main(void) {
    int n; cin >> n;
    vint a(n); vin(a);
    int g = a[0];
    rep(i, n) {
        g = __gcd(g, a[i]);
    }
    print(g);

    return 0;
}


Measured memory_bytes: 640
#!/usr/bin/env python
# coding: utf-8

import fractions

def ri():
    return int(input())

def rl():
    return list(input().split())

def rli():
    return list(map(int, input().split()))

def calc(n, x):
    return n // x

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

def main():
    l, r = rli()
    mod = [[None for _ in range(2019)] for _ in range(2019)]
    for i in range(2019):
        for j in range(i+1, 2019):
            mod[i][j] = i*j % 2019
    if r - l >= 2019:
        print(0)
        return
    l_mod = l % 2019
    r_mod = r % 2019
    if l_mod < r_mod:
        cand = list(range(l_mod, r_mod+1))
    else:
        cand = list(range(l_mod, 2019)) + list(range(0, r_mod+1))
    ans = 2018
    for i in cand:
        for j in cand:
            if i >= j:
                continue
            ans = min(ans, mod[i][j])
    print(ans)



if __name__ == '__main__':
    main()


Measured memory_bytes: 94412
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int n=sc.nextInt();
    if((n%10)==(n/10%10)||(n/10%10)==(n/100%10)||(n/100%10)==(n/1000)){
        System.out.println("Bad");
    }else{
        System.out.println("Good");
    }
  }
}


Measured memory_bytes: 23252
#include <iostream>
#include <string>
#include <cctype>
using namespace std;

int number(string::const_iterator &c){//number
	int ret = 0;
	while(isdigit(*c)){
		ret*=10;
		ret+=*c-'0';
		c++;
	}
	return ret;
}

int expression(string::const_iterator&);
int factor(string::const_iterator &c) {
	int ret;
	if (*c=='(') {
    	c++;
		ret = expression(c);
		c++;
	}else return number(c);
	return ret;
}

int term(string::const_iterator &c){//*or/
	int ret = factor(c);
	for(;;){
		if(*c=='*'){
			c++;
			ret*=factor(c);
		}else if(*c=='/'){
			c++;
			ret/=factor(c);
		}else break;
	}
	return ret;
}

int expression(string::const_iterator &c){//all
	int ret = term(c);
	for(;;){
		if(*c=='+'){
			c++;
			ret+=term(c);
		}else if(*c=='-'){
			c++;
			ret-=term(c);
		}else break;
	}
	return ret;
}

int main(){
	int n;
	cin>>n;
	cin.ignore();
	while(n--){
		string s;
		getline(cin,s);
		string::const_iterator c=s.begin();
		cout<<expression(c)<<"\n";
	}
	return 0;
}

Measured memory_bytes: 0
n = int(input())
v = [int(value) for value in input().split(" ")]
c = [int(value) for value in input().split(" ")]

listdayo = []

for index in range(n):

    if v[index] - c[index] > 0:
        listdayo.append(v[index] - c[index])

print(sum(listdayo))

Measured memory_bytes: 3060
import java.io.PrintWriter;
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		
		int N = sc.nextInt();
		
		int[] a = new int[N];
		int min = 0;
		int max = 0;
		for(int i=0; i<N; i++) {
			a[i] = sc.nextInt();
			if(a[i]<a[min])
				min = i;
			if(a[i]>a[max])
				max = i;
		}
		
		pw.println(2*N-1);
		if(Math.abs(a[max]) >= Math.abs(a[min])) {
			for(int i=0; i<N; i++)
				pw.println((max+1)+" "+(i+1));
			for(int i=0; i<N-1; i++)
				pw.println((i+1)+" "+(i+2));
		} else {
			for(int i=0; i<N; i++)
				pw.println((min+1)+" "+(i+1));
			for(int i=N-1; i>0; i--)
				pw.println((i+1)+" "+i);
		}
		
		sc.close();
		pw.close();
	}
}


Measured memory_bytes: 21972
#include <bits/stdc++.h>
using namespace std;
using ll=long long int;
using ld=long double;
using VI=vector<ll>;
using VD=vector<ld>;
using VVI=vector<VI>;
using VC=vector<char>;
using VVC=vector<VC>;
using VS=vector<string>;
using PLL =pair<ll,ll>;
using PLD=pair<ld,ld>;
using VPLL=vector<PLL>;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element((x).begin(),(x).end())
#define MIN(x) *min_element((x).begin(),(x).end())
#define SORTR(x) sort((x).rbegin(),(x).rend())
#define SORT(x) sort((x).begin(),(x).end())
#define SUM(x) accumulate((x).begin(),(x).end(), 0)
#define FILL(x,a) fill(x.begin(),x.end(),a)
#define EACH(i,x) for(typeof((x).begin()) i=(x).begin(); i!=(x).end(); ++i)

const long long  int INF = 1e18;
const ld EPS   = 1e-10;
const int MOD  = int(1e9)+7;
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; }
template <class BidirectionalIterator>
bool next_partial_permutation(BidirectionalIterator first, BidirectionalIterator middle,BidirectionalIterator last){reverse(middle, last); return next_permutation(first , last);}
#define COUT(x) cout<<x<<"\n"


void Main()
{
	ll N;
	ll result=1;
	string S;
	cin>>N;
	VI vec(N);
	while(true){
		if(N==1) break;
		N/=2;
		result*=2;
	}
	
	cout << result << "\n";
	return;
}

int main()
{
	std::cin.tie(0);
	std::ios_base::sync_with_stdio(false);
	std::cout << std::fixed << std::setprecision(15);
	Main();
}


Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
#define ll long long 
using namespace std;
ll arr[100001];
ll n,k;
ll dp[100001];
ll solve(int start){
    
    if(start==n) return 0;
    
    if(dp[start]!=-1) return dp[start];
    ll ans = 0;
    
    int i = 1;
    
    if(start+1<n) ans = abs(arr[start+1]-arr[start]) + solve(start+1);
    i++;
    while(i<=k){
        if(start+i<n) ans = min(ans,abs(arr[start+i]-arr[start])+ solve(start+i));
        i++;
    }
    
    
    
    //if(start+2<n) ans=  min(ans,abs(arr[start+2]-arr[start])+ solve(start+2));
    
    return dp[start] = ans;

}



int main() {

	cin>>n>>k;
	memset(dp,-1,sizeof dp);
	for(ll i=0;i<n;i++) cin>>arr[i];
	ll ans = solve(0);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 8064
#include<bits/stdc++.h>
typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)

using namespace std;
int main(){
    ll N;scanf("%lld",&N);

    int temp = 0;
    temp = (N-2)*180;
    cout << temp << endl;



    return 0;
}

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

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using   P = pair<int, int>;
using llP = pair<ll, ll>;
using DoP = pair<double, double>;

// 汎用マクロ
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOREACH(i,q) for (auto &i : q)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define SZ(x) ((int)(x).size())
template <class T>inline bool chmin(T &a, const T b) {if (a > b) { a = b; return true;} return false;}
template <class T>inline bool chmax(T &a, const T b) {if (a < b) { a = b; return true;} return false;}
template <class T>inline void line_out(const vector<T> vec) {int n = SZ(vec); rep(i, n) { cout << vec[i]; if(i < n-1) cout << " ";}cout << endl;}
const int di[] = {0, 1, 0, -1, 1, 1, -1, -1};
const int dj[] = {1, 0, -1, 0, 1, -1, 1, -1};
const int INF = 1 << 28;
const ll INF64 = 1ll << 60;
const int mod = 1000000007;
//const int mod = 998244353;
struct mint
{
  ll x; // typedef long long ll;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint &operator+=(const mint a)
  {
    if ((x += a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator-=(const mint a)
  {
    if ((x += mod - a.x) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator*=(const mint a)
  {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const
  {
    mint res(*this);
    return res += a;
  }
  mint operator-(const mint a) const
  {
    mint res(*this);
    return res -= a;
  }
  mint &operator++()
  {
    if ((x += 1) >= mod)
      x -= mod;
    return *this;
  }
  mint &operator--()
  {
    if ((x += mod - 1) >= mod)
      x -= mod;
    return *this;
  }
  mint operator*(const mint a) const
  {
    mint res(*this);
    return res *= a;
  }
  mint pow(ll t) const
  {
    if (!t)
      return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1)
      a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const
  {
    return pow(mod - 2);
  }
  mint &operator/=(const mint a)
  {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const
  {
    mint res(*this);
    return res /= a;
  }
};


int main()
{
  string s; cin >> s;
  int n = s.size();
  set<char> st;
  for(auto c : s) st.insert(c);
  if(st.size() < 26) {
    for(char c = 'a'; c <= 'z'; ++c) if(st.find(c) == st.end()) {
      s += c;
      cout << s << endl;
      return 0;
    }
  }

  rep(i, n) {
    string t = s.substr(i, n-i);
    bool ok = true;
    rep(j, t.size()-1) if(t[j] <= t[j+1]) ok = false;

    if(ok) {
      if(i == 0) cout << -1 << endl;
      else {
        set<char> st;
        for(auto c : t) st.insert(c);
        for(auto c : st) if(s[i-1] < c) {
          cout << s.substr(0, i-1) + c << endl;
          break;
        }
      }
      return 0;
    }
  }
}


Measured memory_bytes: 3572
import sys
import math
from fractions import gcd
# import queue
# from collections import Counter
# from itertools import accumulate
# from functools import reduce

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

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

big_prime = 1000000007

"""
# 標準入力取得
## 文字列
 =  sys.stdin.readline().rstrip()
 =  list(sys.stdin.readline().rstrip())

## 数値
 =  int(sys.stdin.readline())
 =  map(int, sys.stdin.readline().split())
 =  list(map(int, sys.stdin.readline().split()))
 =  [list(map(int,list(sys.stdin.readline().split()))) for i in range(N)]
"""


N =  int(sys.stdin.readline())
A =  list(map(int, sys.stdin.readline().split()))
B =  list(map(int, sys.stdin.readline().split()))
C =  list(map(int, sys.stdin.readline().split()))

ans = 0
prev = -1
for i in range(N):
    cur = A[i]
    ans += B[cur - 1]
    if prev == cur - 1:
        ans += C[cur - 2]
    prev = cur

print(ans)


Measured memory_bytes: 66156
#include <bits/stdc++.h>
#pragma once
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
const int MOD = 1000000007;
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 


////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////
int x,y,a,b,c,p[110000],q[110000],r[110000],pp[110000],qq[110000],rr[110000];
signed main(){
  cin>>x>>y>>a>>b>>c;
  rep(i,a)cin>>p[i+1];
  rep(i,b)cin>>q[i+1];
  rep(i,c)cin>>r[i+1];
  sort(p+1,p+a+1, greater<int>());sort(q+1,q+b+1, greater<int>());sort(r+1,r+c+1, greater<int>());
  rep(i,a+1)pp[i] = p[i];
  rep(i,b+1)qq[i] = q[i];
  rep(i,c+1)rr[i] = r[i];
  rep(i,a)p[i+1] += p[i];
  rep(i,b)q[i+1] += q[i];
  rep(i,c)r[i+1] += r[i];
  int ans = 0;
  rep(i,x+1){
    if(x - i > c)continue;
    int restC = c-(x-i);
    int ng = y+1, ok = max(0LL,y-restC-1);
    while(abs(ok-ng)>1){
      int mid = (ok+ng)/2;
      if(qq[mid] > rr[x+y-i-mid+1])ok = mid;
      else ng = mid;
    }
    chmax(ans, p[i]+q[ok]+r[x+y-i-ok]);
  }
  cout << ans << endl;
}


Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=998244353;
const LL LINF=1LL<<62;
const int INF=1<<20;



int main(){
    int N;cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    int ans=a[0];
    for (int i = 0; i < N; i++) {
        ans=__gcd(a[i],ans);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 640
function Main(input){
  
  var str = input.trim();
  var s = str;
  var n = str.length;
  //console.log(n);
  var h = s.split("");
  var a = [];
  var b = [];
  
 for(i=0;i<n;i++){
    if(i%2==0){
      a.push(parseInt(h[i],10));
    }//gusuu ha a
   else if(i%2==1){
     b.push(parseInt(h[i],10));
   }//kisuu ha b
    
 }//for end
  
 //a.map( str => parseInt(str, 10) );
 //b.map( str => parseInt(str, 10) );  
var sum  = function(arr) {
    var sum = 0;
    arr.forEach(function(elm) {
        sum += elm;
    });
    return sum;
};
        //console.log("a:"+a); 
        //console.log("b:"+b);
  var anum = a.length;
  var bnum = b.length;
      //console.log("anum:"+anum);
      //console.log("bnum:"+bnum);
  
  var asum = sum(a);
  var bsum = sum(b);
      //console.log("asum:"+asum);
      //console.log("bsum:"+bsum);
  
  var top0 = anum - asum + bsum;
  var top1 = bnum - bsum + asum;
  
    //console.log("top0:"+top0);
    //console.log("top1:"+top1);
  
  
  if(top0-top1>0){
    var kekka = top1;
  }
  else if (top1-top0>0){
    var kekka = top0;
  }else{
    var kekka = top0;
  }
  
  console.log(kekka);
 
}//function end
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 10816
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

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

        String[] str = sc.nextLine().split(" ");

        Map<String, Integer> map = new HashMap<>();
        String maxStr = "";
        for (int i = 0; i < str.length; i++) {
            if (!map.containsKey(str[i])) map.put(str[i], 0);

            map.put(str[i], map.get(str[i]) + 1);

            if (maxStr.length() < str[i].length()) {
                maxStr = str[i];
            }
        }

        Map.Entry<String, Integer> mapEntry = null;
        for (Map.Entry<String, Integer> entry : map.entrySet()) {
            if (mapEntry == null || entry.getValue().compareTo(mapEntry.getValue()) > 0) mapEntry = entry;
        }

        System.out.printf("%s %s\n", mapEntry.getKey(), maxStr);
    }
}

Measured memory_bytes: 26280
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args)
	{
		Scanner s=new Scanner(System.in);
		
		int k=s.nextInt();
		
		long ans=0;
		
		for(int i=1;i<=k;i++)
		{
			for(int j=1;j<=k;j++)
			{
				for(int l=1;l<=k;l++)
				{
					ans=ans+gcd(i,gcd(j,l));
				}
			}
		}
		
		System.out.println(ans);
		
	}
	
	public static int gcd(int a, int b) 
    { 
      if (b == 0) 
        return a; 
      return gcd(b, a % b);  
    } 
	
}

Measured memory_bytes: 35760
//
// Created by tac on 2016/10/12.
//

#include <algorithm>
#include <cstdlib>
#include <iostream>

int main() {
    int a, b;
    while (true) {
        std::cin >> a >> b;
        if (a <= 0 && b <= 0) {
            break;
        }
        std::cout << std::min(a, b) << " " << std::max(a, b) << std::endl;
    }
    return EXIT_SUCCESS;
}

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

int main(){
	int a, b, c, result;
	while(cin >> a >> b){
		c = a + b;
		result = 0;
		while(c > 0){
			result++;
			c /= 10;
		}
		cout << result << endl;
	}
	return 0;
}

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

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

    if (A == 7 && B == 5 && C == 5) {
        cout << "YES" << endl;
    }
    else if (A == 5 && B == 7 && C == 5) {
        cout << "YES" << endl;
    }
    else if (A == 5 && B == 5 && C == 7) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <string>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>
#include <climits>

using namespace std;
using ll=long long;

void solve(){
  while(true){
    int num,m,p;
    cin >> num >> m >> p;
    if(!(num|m|p))return;
    int sum=0,mm;
    for(int i=0;i<num;i++){
      int x;
      cin >> x;
      sum+=x;
      if(m-1==i)mm=x;
    }
    if(mm==0)
    {cout << 0 << endl;continue;}
    sum*=100;
    double re=sum*(double)(100-p)/100;
    cout << (int)(re/mm) << endl;
  }
}

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



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

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define ALLTRUE(xs) all_of(ALL(xs),[](bool x){return x;})
#define AND(x,y,z) set_intersection((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define ANYTRUE(xs) any_of(ALL(xs),[](bool x){return x;})
#define CONCAT(x,y) (x).insert((x).end(),(y).begin(),(y).end())
#define DUMP(xs) for (auto x:xs) cout<<x<<' ';cout<<endl
#define DUMPP(xs) for (auto x:xs) cout<<'('<<x.first<<','<<x.second<<')';cout<<endl
#define FOR(i,a,b) for (int i=(int)(a);i<(int)(b);++i)
#define OR(x,y,z) set_union((x).begin(),(x).end(),(y).begin(),(y).end(),inserter((z),(z).end()))
#define OUT(x) cout<<x<<endl
#define REP(i,n) FOR(i,0,n)

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

struct edge { int to,cost; };

int main() {
  int N,x;cin>>N>>x;
  vector<int> as(N);
  REP(i,N) cin>>as[i];

  ll res = 0;
  int pre = as[0];
  FOR(i,1,N) {
    ll tmp = pre+as[i];
    if (tmp<=x) {
      pre = as[i];
      continue;
    }

    res += tmp-x;

    if (tmp-x>as[i]) {
      pre = 0;
    } else {
      pre = as[i]-tmp+x;
    }
  }

  OUT(res);
  return 0;
}

Measured memory_bytes: 640
S=input()

even=[S[i] for i in range(len(S)) if i%2==0]
odd=[S[i] for i in range(len(S)) if i%2==1]

even=set(even)
odd=set(odd)

#print(even,odd)

if even <= {"R","U","D"} and odd <= {"L","U","D"}:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 3060
/*
"Won't stop until I'm phenomenal."
- Phenomenal, Eminem
 */
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define ff first
#define Shazam ios_base::sync_with_stdio(false);   cin.tie(NULL); cout.tie(NULL);
#define ss second
#define all(c) c.begin(),c.end()
#define endl "\n"
#define test() int t; cin>>t; while(t--)
#define fl(i,a,b) for(int i = a ; i <b ;i++)
#define get(a) fl(i,0,a.size())  cin>>a[i];
#define pra(a) fl(i,0,a.size()) cout<<a[i]<<" ";	cout<<endl;
#define pr(a,n) fl(i,0,n) cout<<a[i]<<" ";	cout<<endl;
const ll INF = 2e18;
const int inf = 2e9;
const int mod1 = 1e9 + 7;



int main(){
    Shazam;
    int n; cin>>n;
    vector<vector<int>> cnt(10,vector<int>(10));
    for(int i = 1; i <=n; i++){
        string s = to_string(i);
        int x = s.back() - '0';
        int y = s.front() -'0';
        cnt[x][y]++;
    }
    ll ans = 0;
    for(int i = 1;i < 10; i++){
        for(int j = 1; j < 10; j++){
            ans += 1LL*cnt[i][j]*cnt[j][i];
        }
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(){
  int N;
  int A[2][110];

  cin >> N;
  rep(i,2){
    rep(j,N){
      cin >> A[i][j];
    }
  }

  rep(j,N-1){
    A[0][j+1] += A[0][j];
  }

  A[1][0] += A[0][0];

  rep(j,N-1){
    A[1][j+1] += max(A[0][j+1], A[1][j]);
  }

  cout << A[1][N-1] << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for (int i = x; i < (int)(n); ++i)
const int N = 1e5, M = 7 + 1e9;
int n, k, a[100], dp[N+1][2];
bool cal(int sum, bool player){
	if(sum < a[0])
		return 0;
	int &ret = dp[sum][player];
	if(~ret)
		return ret;
	ret = 0;
	f(i, 0, n)
		if(sum >= a[i])
			ret |= !cal(sum-a[i], !player);
	return ret;
}
int main()
{
	memset(dp, -1, sizeof dp);
	cin >> n >> k;
	f(i, 0, n)
		cin >> a[i];
	cout << (cal(k, 0) ? "First" : "Second");

}

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

int main()
{
  ll n, h; cin >> n >> h;
  vector<pair<ll, ll>> v;
  ll aa = 0;
  rep(i, n) {
    ll a, b; cin >> a >> b;
    v.push_back(make_pair(b, a));
    aa = max(aa, a);
  }
  sort(v.rbegin(),v.rend());

  ll ans = 0;
  rep(i, n) {
    if (aa > v[i].first) break;
    h -= v[i].first;
    ans++;
    if (h < 1) {
      cout << ans << endl;
      return 0;
    }
  }
  ans += (h+aa-1)/aa;
  cout << ans << endl;

  return 0;
}


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

int main() {
    long long N;
    cin >> N;
    vector<pair<long long, bool>> a(N);
    for (long long i = 0; i < N; i++) {
        cin >> a[i].first;
    }

    long long nextindex = 0;
    long long ans = 0;
    for (long long i = 0; i < N; i++) {
        if (a[nextindex].second) {
            cout << "-1" << endl;
            return 0;
        }
        if (a[nextindex].first == 2) {
            cout << ans + 1 << endl;
            return 0;
        }
        a[nextindex].second = true;
        nextindex = a[nextindex].first - 1;
        ans++;
    }

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;

ll a[101];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	ll sum=0;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	if(sum%10==0)
	{
		sort(a,a+n);
		for(int i=0;i<n;i++)
		{
			if(a[i]%10!=0)
			{
				cout<<sum-a[i]<<'\n';
				return 0;
			}
		}
		cout<<0<<'\n';
	}
	else
	{
		cout<<sum<<'\n';
	}
}


Measured memory_bytes: 256
let n = Int(readLine()!)!
var result = [0, 0, 0, 0]
for _ in 0..<n {
  let s = readLine()!
  if s == "AC" { result[0] += 1 }
  else if s == "WA" { result[1] += 1 }
  else if s == "TLE" { result[2] += 1 }
  else { result[3] += 1 }
}
print("AC x \(result[0])")
print("WA x \(result[1])")
print("TLE x \(result[2])")
print("RE x \(result[3])")

Measured memory_bytes: 7928
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n, r;
    cin >> n >> r;
    if (n >= 10)
    {
        cout << r << endl;
    }
    else
    {
        cout << (r + (100 * (10 - n))) << endl;
    }
    return 0;
}

Measured memory_bytes: 256
// Maximam Profit
#include <stdio.h>

int maxProfit(int*, int);

int main(){
    int i, n, A[200000], max;
    scanf("%d", &n);
    for(i=0; i < n; i++){
        scanf("%d", &A[i]);
    }
    max = maxProfit(A, n); // 最大の利益を求める
    printf("%d\n", max);
    return 0;
}

int maxProfit(int *A, int n){
    int i, num, max, min;
    min = A[0];
    for(i=1; i < n; i++){
        if(i == 1)max = A[i]-min; // 最大値を更新
        else if(A[i]-min > max)max = A[i]-min; // 最大値を更新
        if(min > A[i])min = A[i]; // 最小値を更新
    }
    return max;
}



Measured memory_bytes: 2540
#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 LL long long

const int MAXSSTN = 100010;
class StarrySkyTree{
public:
  int size=0;
  int depth=0; // the depth of the tree
  int best=0;  // the index of maximum element
  int start=0; // the initial index of inputs
  long long dat_add[4 * MAXSSTN];
  long long dat[4 * MAXSSTN];
  
  StarrySkyTree(int n,long long* v){
    size=n;
    while((1<<depth)<n)depth++;
    start=(1<<depth)-1;
    for(int i=start;i<(1<<(depth+1));i++){
      if(i<start+n)
	dat[i]=v[i-start];
      else
	dat[i]=1e15;
    }
    for(int i=start;i<start+n;i++){
      int tmp=i;
      while(par(tmp)!=-1){
	dat[par(tmp)]=min(dat[tmp],dat[(tmp+1)/2*4-1-tmp]);
	tmp=par(tmp);
      }
    }
    int i=0;
    while(i<start)i=(dat[i]==dat[2*i+1])?2*i+1:2*i+2;
    best=i-start;
  }
  long long max_element(int a, int b){ return max_element(a, b, 0, 0, (1<<depth)); }
  void add(int s, int t, int x){ add(s, t, 0, 0, (1<<depth), x); }
  void add(int i, int x){ add(i, i + 1, 0, 0, (1<<depth), x); }

  int par(int i){
    if(i==0)
      return -1;
    return (i-1)/2;
  }

  void update(int d,long long x){
    int i=d+start;
    dat[i]=x;
    while(par(i)!=-1){
      dat[par(i)]=min(dat[i],dat[(i+1)/2*4-1-i]);
      i=par(i);
    }
    i=0;
    while(i<start){
      i=(dat[i]==dat[2*i+1])?2*i+1:2*i+2;
    }
    best=i-start;
  }
  void dump(){
    for(int i=0;i<(1<<(depth+1));i++){
      cerr<<dat[i]<<" ";
    }
    cerr<<endl;
  }
private:
  long long max_element(int a, int b, int k, int l, int r){
    if(b <= l || r <= a) return 1e15;
    if(a <= l && r <= b) return dat[k] + dat_add[k];

    long long vl = max_element(a, b, k * 2+1, l, (l + r) / 2);
    long long vr = max_element(a, b, k * 2+2, (l + r) / 2, r);
    return min(vl, vr) + dat_add[k];
  }
  void add(int a, int b, int k, int l, int r, long long x){
    if(b <= l || r <= a) return;
    if(a <= l && r <= b){
      dat_add[k] += x;
    }else{
      add(a, b, k * 2+1, l, (l + r) / 2, x);
      add(a, b, k * 2+2, (l + r) / 2, r, x);
      dat[k] = min(dat[k * 2+1] + dat_add[k * 2+1], dat[k * 2 + 2] + dat_add[k * 2 + 2]);
    }
  }
};

int n,q;
LL a[100000];

int main(){
  cin>>n>>q;
  REP(i,n)
    a[i]=0;
  StarrySkyTree sst(n,a);
  int tmp;
  LL s,t,x;
  REP(i,q){
    cin>>tmp;
    if(tmp){
        cin>>s>>t;
        cout<<sst.max_element((int)s,(int)t+1)<<endl;
    }else {
        cin>>s>>t>>x;
        sst.add((int)s,(int)t+1,x);
    } 
  }
  return 0;
}



Measured memory_bytes: 7296
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
using str=string;
typedef pair<int,int> P;
typedef vector<int> vi;

ll gcd(ll a,ll b){
    ll v0=a,v1=b,v2=a%b;
    while(v2!=0){
        v0=v1;
        v1=v2;
        v2=v0%v1;
    }
    return v1;
}

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

int main(){
    ios::sync_with_stdio(false);
    int n,k;
    double p[n];
    double q[n-k+1]={0};
    cin >> n >> k;
    rep(i,n){
        cin >> p[i];
    }
    rep(i,k){
        q[0]+=(p[i]+1)/2.0;
    }
    for(int i=1;i<n-k+1;i++){
        q[i]=q[i-1]-(p[i-1]+1)/2.0+(p[i-1+k]+1)/2.0;
    }
    double ans=0.0;
    rep(i,n-k+1){
        ans=max(ans,q[i]);
    }
    printf("%.10f", ans);
    return 0;
}



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

using namespace std;
int main(void){
    // Your code here!
    int n, k;
    cin >> n >> k;
    
    vector<int> H(n);
    for(int i = 0; i < n; i++) cin >> H[i];
    
    long long ans = 0;
    //long long temp = 0
    
    sort(H.rbegin(), H.rend());
    
    for (int i = 0; i < n; i++) ans += H[i];
    
    int index = min(n, k);
    
    for(int i = 0; i < index; i++) ans -= H[i];
    
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<string>
#include<sstream>
using namespace std;
int inf = 1000000000;

int main(){

  int n; cin >> n;

  vector<int> dp(n+1, inf);
  dp[0] = 0;
  for(int i=1; i<=n; i++){
    dp[i] = min(dp[i], dp[i-1] + 1);
    int a = 6;
    while(true){
      if(i-a >= 0) dp[i] = min(dp[i], dp[i-a] + 1);
      else break;
      a *= 6;
    }
    a = 9;
    while(true){
      if(i-a >= 0) dp[i] = min(dp[i], dp[i-a] + 1);
      else break;
      a *= 9;
    }
  }
  cout << dp[n] << endl;

  return 0;
}



//


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
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;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

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

   string s;
   cin >> s;
   bool ok = true;
   if (s[2] != s[3]) ok = false;
   if (s[4] != s[5]) ok = false;
   if (ok)
      cout << "Yes" << endl;
   else
      cout << "No" << endl;
   return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#define N 10000
int main(){
  
  int i,j,n,x[N];
  int count=0,flag=0;
  scanf("%d",&n);
  for(i=0;i<n;i++) scanf("%d",&x[i]);
  
  for(i=0;i<n;i++){
    if(x[i]==2) flag++;
    else if(x[i]<2 || x[i]%2==0) flag--;
    else{
      if(x[i]!=2){
	j=3;
	while(j<=sqrt(x[i])){
	  if(x[i]%j==0) {
	    flag--;
	    break;
	  }
	  else j=j+2;
	}
	if(flag==0) flag++;
      }
    }
    if(flag==1) {
      count++;
    }
    flag=0;
  }
  printf("%d\n",count);
  return 0;
}

Measured memory_bytes: 628
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using coord= pair<int, int>;


bool is_valid_move(vector<string> &board, vector<vector<int>> &checked, int x, int y) {
  int H= board.size();
  int W= board.at(0).size();
 
  // 移動先がマス目の外である場合
  if (x <= -1 || x >= H || y <= -1 || y >= W) {
    return false;
  }
  // 移動先が壁マス
  if (board.at(x).at(y) == '#') {
    return false;
  }
  // 既に調べているマスへの移動は調べないのでfalseを返す
  if (checked.at(x).at(y)!= -1) {
    return false;
  }
  // それ以外なら正しい移動
  return true;
}

int BFS(vector<string> &board){
  int H= board.size();
  int W= board.at(0).size();

  const vector<coord> diff= {make_pair(0,-1),
                             make_pair(-1,0), make_pair(1,0),
                             make_pair(0,1)};                   // 探索方向

  vector<vector<int>> checked(H, vector<int>(W, -1));
  queue<coord> bfs;
  for(int i=0; i<H; i++){
    for(int j=0; j<W; j++){
      if(board.at(i).at(j)=='#'){
        checked.at(i).at(j)= 0;
        bfs.push(make_pair(i,j));
      }
    }
  }

  int ans;
  while( !bfs.empty() ){
    coord p= bfs.front();
    int x= p.first;
    int y= p.second;
    for(auto ds:diff){
      int dx= ds.first;
      int dy= ds.second;
      if(is_valid_move(board, checked, x+dx, y+dy) ){
        ans= checked.at(x).at(y)+ 1;
        checked.at(x+dx).at(y+dy)= checked.at(x).at(y)+ 1;
        bfs.push(make_pair(x+dx, y+dy));
      }
    }
    bfs.pop();
  }

  return ans;
}

int main() {
  int H,W;
  cin >> H >> W;

  vector<string> Board(H);
  for(int i=0; i<H; i++){
    cin >> Board.at(i);
  }

  cout << BFS(Board) << endl;
}


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

int main()
{
	int n,k;
	cin>>n>>k;
	int frek[200010];
	memset(frek,0,sizeof(frek));
	for (int i=1;i<=n;i++)
	{
		int a;
		cin>>a;
		++frek[a];
	}
	vector<int> angka;
	for (int i=1;i<=n;i++)
	 if (frek[i])
	  angka.push_back(frek[i]);
	if (angka.size()<=k)
	 cout<<0<<"\n";
	else
	 {
	 	sort(angka.begin(),angka.end());
	 	int ans=0;
//	 	for (int i=0;i<)
	 	for (int i=0;i<angka.size()-k;i++)
	 	 ans+=angka[i];
	 	cout<<ans<<"\n";
	 }
}

Measured memory_bytes: 2168
#include<stdio.h>

#include<string.h>

int a[13],vis[13],flag;

void dfs(int x,int l,int r)

{

    int i;

    if(x==11)return; 

    if(flag)return ;

    if(a[x]>l)dfs(x+1,a[x],r);

    else  if(a[x]>r)dfs(x+1,l,a[x]);

    else  {flag=1;return;}

  

}

int main()

{

int T,i,j,k;

scanf("%d",&T);

while(T--)

{

flag=0;

for(i=1;i<=10;i++)

scanf("%d",&a[i]);

memset(vis,0,sizeof(vis));

dfs(1,0,0);

if(flag)printf("NO\n");

else printf("YES\n");

}

return 0;

}

Measured memory_bytes: 2600
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
using P = pair<int,int>;
const int MOD = 1000000007;
using Graph = vector<vector<int>>;

int main() {
    ll n,c,k;
    cin>>n>>c>>k;
    vector<ll> t(n);
    rep(i,n) cin>>t[i];
    sort(t.begin(),t.end());
    ll res=0;
    for (int i=0; i<n;) {
        ll now=t[i]+k;
        ll count=0;
        while(i<n&&now>=t[i]&&count<c) {
            i++;
            count++;
        }
        res++;
    }
    cout<<res<<endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define printYes() cout << "Yes" << endl;
#define printNo() cout << "No" << endl;
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;
typedef long long ll;
const int mod = 1000000007;
struct mint
{
    ll x; //
    mint(ll x = 0) : x((x % mod + mod) % mod) {}
    mint operator-() const { return mint(-x); }
    mint &operator+=(const mint a)
    {
        if ((x += a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator-=(const mint a)
    {
        if ((x += mod - a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint &operator*=(const mint a)
    {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const
    {
        if (!t)
            return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1)
            a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint &operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream &operator>>(istream &is, const mint &a) { return is >> a.x; }
ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }

struct combination
{
    vector<mint> fact, ifact;
    combination(int n) : fact(n + 1), ifact(n + 1)
    {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i)
            fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i)
            ifact[i - 1] = ifact[i] * i;
    }
    mint operator()(int n, int k)
    {
        if (k < 0 || k > n)
            return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
};

int main()
{
    long long N, K;
    cin >> N >> K;
    combination comb(2 * N);
    mint ans = 0;
    if (N - 1 <= K)
        ans = comb(2 * N - 1, N);
    else
    {
        rep(i, K + 1)
        {
            ans += comb(N, i) * comb(N - 1, i);
        }
        if (K == 1)
            ans -= 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
#define endl '\n';

typedef long long ll;

using namespace std;

const string YES = "";
const string NO  = "";

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

    char c;

    cin >> c;

    c++;

    cout << c << endl;

    return 0;
}



Measured memory_bytes: 256
/**
 * Author : RDP
 * There are no two words in the English language more harmful than "good job".
 * 1729 ;)
**/
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <numeric>
using namespace std;
using ll = long long;
#define endl '\n'
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) 
{
  cerr << " " << to_string(H);
  debug_out(T...);
}
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define FAST_IO ios::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);
#define bp(x) __builtin_popcount(x)
#define zf(x) __builtin_clz(x)
#define zl(x) __builtin_ctz(x)
#define par(x) __bultin_parity(x)
#define all(x) (x).begin(), (x).end()
/* **************************************************************************************** */
const ll MOD = 1e9 + 7;
map <ll, ll> memo;
ll n;
ll solve(ll cur)
{
    ll ans = 0;
    if(cur == n)
        return 1;

    if(memo.find(cur) != memo.end())
        return memo[cur];

    for(int i = 3; n - cur - i >= 0; i ++)
        ans = (ans + solve(cur + i) % MOD ) % MOD;
    return memo[cur] = ans;
}
void test_case()
{
    cin >> n;
    cout <<solve(0);
	return ;
}
int main()
{
	FAST_IO
    test_case();
	return 0;
}



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

int a[25],b[25],c[25],n,ans;

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%d",a+i);
	for(int i=1;i<=n;++i) scanf("%d",b+i);
	for(int i=2;i<=n;++i) scanf("%d",c+i);
	for(int i=1;i<=n;++i) {
		ans+=b[a[i]];
		if(a[i-1]==a[i]-1) ans+=c[a[i]];
	}
	printf("%d",ans);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
template<class T> inline void read(T &x){
	x=0;register char c=getchar();register bool f=0;
	while(!isdigit(c))f^=c=='-',c=getchar();
	while(isdigit(c))x=x*10+c-'0',c=getchar();
	if(f)x=-x;
}
template<class T> inline void print(T x){
	if(x<0)putchar('-'),x=-x;
	if(x>9)print(x/10);
	putchar(x%10+'0');
}
template<class T> inline void print(T x,char c){print(x),putchar(c);}
const int N=1<<18,mod=998244353;
int n,s,inv_s,lim,a[N],f[N],g[N];
inline int mid(int x){return x&1?(x+mod)>>1:x>>1;}
inline int dec(int a,int b){return (a-=b)<0?a+mod:a;}
inline int inc(int a,int b){return (a+=b)>=mod?a-mod:a;}
inline int fpow(int a,int b){int s=1;for(;b;b>>=1,a=(ll)a*a%mod)if(b&1)s=(ll)s*a%mod;return s;}
void fwt(int *a,void foo(int&,int&)){
	for(int len=1;len<lim;len<<=1)
		for(int i=0;i<lim;i+=len<<1){
			for(int j=0;j<len;j++)foo(a[i+j],a[i+j+len]);
		}
}
void trans(int &a,int &b){int x=a;a=inc(a,b),b=dec(x,b);}
void i_trans(int &a,int &b){int x=a;a=mid(inc(a,b)),b=mid(dec(x,b));}
int main(){
#ifdef memset0
	freopen("1.in","r",stdin);
#endif
	read(n),lim=1<<n;
	for(int i=0;i<lim;i++)read(a[i]),s=inc(s,a[i]);
	inv_s=fpow(s,mod-2);
	for(int i=0;i<lim;i++)a[i]=(ll)a[i]*inv_s%mod,f[i]=lim-1;
	f[0]=mod-1,a[0]=dec(a[0],1);
	fwt(f,trans),fwt(a,trans);
	for(int i=0;i<lim;i++)g[i]=(ll)f[i]*fpow(a[i],mod-2)%mod;
	fwt(g,i_trans);
	// for(int i=0;i<lim;i++)print(g[i]," \n"[i==lim-1]);
	for(int i=lim-1;i>=0;i--)g[i]=dec(g[0],g[i]);
	for(int i=0;i<lim;i++)print(g[i],'\n');
}

Measured memory_bytes: 5888
#include<iostream>
#include<cstdio>
#include<queue>
#include<string>
#include<stack>
#include<algorithm>
#include<cstring>
#include<map>
using namespace std;
int main()
{
	int a,b;
	cin>>a>>b;
	a*=3;
	a+=b;
	cout<<a/2;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void){
    int n=999999,a,b,c;
    int x[1000000];
    memset(x,0,sizeof(x));
    for(a=2,c=0;a<=n;a++){
        if(x[a]){x[a]=c;continue;}
        c++;
        x[a]=c;
        for(b=a*2;b<=n;b+=a)x[b]=-1;
    }
    while(~scanf("%d",&n)){
        printf("%d\n",x[n]);
    }
    return 0;
}

Measured memory_bytes: 4936
#include <iostream>
#include <algorithm>
using namespace std;
int N, M, a, b, rm[100009];
int main() {
	cin >> N >> M;
	fill(rm, rm + N, -1);
	for (int i = 0; i < M; ++i) {
		cin >> a >> b; --a, --b;
		if (rm[a] == -1) rm[a] = b;
		else rm[a] = min(rm[a], b);
	}
	int ans = 0, cm = -1;
	for (int i = 0; i < N; ++i) {
		if (cm == i) ++ans, cm = -1;
		if (rm[i] == -1) continue;
		if (cm == -1) cm = rm[i];
		else cm = min(cm, rm[i]);
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int cost[n];
  for(int i=0;i<n;i++)cin >> cost[i];
long dp[n];
  dp[0]=0;
  dp[1]=abs(cost[1]-cost[0]);
for(int i=2;i<n;i++){
dp[i]=min(dp[i-2]+abs(cost[i-2]-cost[i]),dp[i-1]+abs(cost[i-1]-cost[i]));}
cout << dp[n-1] <<endl;
}

Measured memory_bytes: 1408