akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i <(n); i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;

int main(){
  int a,b,c;
  string ans = "Yes";
  cin >> a >> b >> c;
  if( a==b && b==c) ans = "No";
  else if( a != b && b != c && c != a ) ans = "No";
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define PI acos(-1)
#define dans(d) cout << std::fixed << std::setprecision(20) << d << endl;


int main()
{
    int a, b, h, m;
    scanf("%d%d%d%d", &a, &b, &h, &m);

    long double rad = PI * 2 * ((long double)h / 12.0 + ((long double)m / 60.0) / 12.0 - (long
                                double)m / 60.0);

    long double rsq = (long double)(a * a + b * b) - (long double)(2 * a *
                      b) * cosl(rad);

     dans(sqrt(rsq));

    return 0;
}




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

namespace HABIT{
    #define f(a,b,c,d) for(register int a=b,c=d;a<=c;a++)
    #define g(a,b,c,d) for(register int a=b,c=d;a>=c;a--)
    #define LOCAL
    typedef int i32;
    typedef unsigned int u32;
    typedef long long int i64;
    typedef unsigned long long int u64;
    typedef pair<i32,i32> pii;
    const i32 MAXN=1024;
    typedef i32 ar[MAXN];
    
    template<typename T> inline T Max(T a) { return a; }
    template<typename T,typename... Args> inline T Max(T a,Args... args){
        T b=Max(args...);
        return (a>b)?a:b;
    }
    template<typename T> inline T Min(T a) { return a; }
    template<typename T,typename... Args> inline T Min(T a,Args... args){
        T b=Min(args...);
        return (a<b)?a:b;
    }

    #ifdef LOCAL
        inline char gc() { return getchar(); }
    #else
        inline char gc() {
            static char s[1<<20|1]={0},*p1=s,*p2=s;
            return (p1==p2)&&(p2=(p1=s)+fread(s,1,1<<20,stdin),p1==p2)?EOF:*(p1++);
        }
    #endif
    inline i64 read(){
        register i64 ans=0;register char c=gc();register bool neg=0;
        while(c<48||c>57) neg^=!(c^'-'),c=gc();
        while(c>=48&&c<=57) ans=(ans<<3)+(ans<<1)+(c^48),c=gc();
        return neg?-ans:ans;
    }

    char Output_Ans[1<<20|1],*Output_Cur=Output_Ans;
    inline void output() { Output_Cur-=fwrite(Output_Ans,1,Output_Cur-Output_Ans,stdout); }
    inline void print(char c){
        if(Output_Cur-Output_Ans+1>>20) output();
        *(Output_Cur++)=c;
    }
    inline void print(char *s) { while(*s) print( *(s++) ); }
    inline void print(u64 x){
        if(!x) { print('0'); return ; }
        char buf[30]={0},*p=buf+28;
        while(x) *(p--)=x%10+48,x/=10;
        print(p+1);
    }
    inline void print(u32 x) { print( (u64)x ); }
    inline void print(i64 x){
        if(x<0) print('-'),x=-x;
        print( (u64)x );
    }
    inline void print(i32 x){
        if(x<0) print('-'),x=-x;
        print( (u64)x );
    }
}
using namespace HABIT;

int main(){
    printf("%lf",acos(-1)*read()*2);
    output();
    return 0;
}

Measured memory_bytes: 3732
X,Y,Z,K=[int(s) for s in input().split()]
xls=sorted([int(s) for s in input().split()],reverse=True)
yls=sorted([int(s) for s in input().split()],reverse=True)
zls=sorted([int(s) for s in input().split()],reverse=True)
cake=[]
for a in range(X):
  for b in range(Y):
    ab=(a+1)*(b+1)
    for c in range(Z):
      if ab*(c+1)>K:
        break
      cake.append(xls[a]+yls[b]+zls[c])
    if ab>K:
      break
cake=sorted(cake,reverse=True)
for i in range(K):
  print(cake[i])

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

// int64_t kaijou(int64_t i){
//     if(i==0) return 1;
//     int64_t j=1;
//     for(int64_t k=1;k<=i;k++){
//         j*=k;
//     }
//     return j;
// }

// int64_t conbi(int64_t n,int64_t t){  

//     }
//     int64_t x,y,z;

// }

int main(){
    int64_t n;
    cin>>n;
    vector<int64_t>a(n);
    map<int64_t,int64_t> t;//aの要素とその個数
    for(auto &p:a) {
        cin>>p;
        if(t.count(p)) t.at(p)++;
        else t[p]=1;
    }
    int64_t sum=0;

    // //debug用
    // cout<<t.size()<<endl;
    // for(auto &p:t){
    //     cout<<p.first<<" "<<p.second<<endl;
    // }


    for(auto &p:t){
        // if(b.count(a.at(i))){
        //     cout<<b.at(a.at(i))<<endl;
        //     continue;
        // }
        // t.at(a.at(i))--;
        // int64_t sum=0;
        // for(auto &p:t){
        //     int64_t z=p.second;
        //     sum+=z*(z-1)/2;
        // }
        // b[a.at(i)]=sum;
        // cout<<sum<<endl;
        // t.at(a.at(i))++;
        int64_t x=p.second;
        sum+=x*(x-1)/2;
    }

    //cout<<sum<<endl;

    for(auto &p:t){
        int64_t s=sum;
        int64_t x=p.second;
        s=sum-(x*(x-1)/2)+((x-1)*(x-2)/2);
        p.second=s;
    }
    for(auto &p:a){
        cout<<t.at(p)<<endl;
    }
}


Measured memory_bytes: 11008
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

#define rep(i, N) for(int i = 0; i < N; ++i)

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int k, a, b;
    cin >> k >> a >> b;
    bool ans = a <= CEIL(a, k) * k && CEIL(a, k) * k <= b;

    cout << (ans ? "OK\n": "NG\n");
    return 0;
}



Measured memory_bytes: 3648
#include <cstdio>

using namespace std;

int main() {
  int i, j;
  int N, Y;
  scanf("%d %d", &N, &Y);
  Y -= 1000*N;
  int ans5 = -1;
  int ans10 = -1;
  if (Y >= 0) {
    for (i = 0; i <= N; i++) {
      for (j = 0; j <= N-i; j++) {
	if (Y == 4000*i+9000*j) {
	  ans5 = i;
	  ans10 = j;
	  break;
	}
      }
    }
  }
  if (ans5 == -1) {
    printf("-1 -1 -1");
  } else {
    printf("%d %d %d", ans10, ans5, N-ans10-ans5);
  }
  return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cfenv>
#include <cmath>
#include <vector>
#include <string>

using namespace std;
using ll = long long;

int main(){
  double a, b;
  cin >> a >> b;

  int min_b = 10*b;
  int max_b = 10*(b+1) - 1;
  int min_a = ceil(12.5*a);
  int max_a = ceil(12.5*(a+1)) - 1;
  int ans;

  if(max_a < min_b || max_b < min_a){
    ans = -1;
  }else{
    if(min_a <= min_b){
      ans = min_b;
    }else if(min_b < min_a){
      ans = min_a;
    }
  }

  cout << ans << endl;


  return 0;
}


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

vector<int> sieveOfEratosthenes(int n) {
  vector<int> primes(n);
  for (int i = 2; i < n; ++i) primes[i] = i;
  for (int i = 2; i * i < n; ++i) {
    if (primes[i]) {
      for (int j = i * i; j < n; j += i) primes[j] = 0;
    }
  }
  return primes;
}

int main() {
  int N; cin >> N;
  vector<int> se = sieveOfEratosthenes(55555+1);
  vector<int> ans;
  for (int i = 3; i <= 55555 && N; ++i) {
    if (!se[i]) continue;
    if (i % 10 == 3) {
      ans.push_back(i);
      --N;
    }
  }
  for (int i = 0; i < ans.size(); ++i) cout << ( (i) ? " " : "" ) << ans[i];
  cout << endl;
  return 0;
}


Measured memory_bytes: 512
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define all(a) (a).begin(), (a).end()


int main(){
    string s;
    cin >> s;
    if(s == "AAA" or s == "BBB") puts("No");
    else puts("Yes");
}


Measured memory_bytes: 3600
while True:
    s = input()
    if s == '.':break
    while True:
        if s.find('+') == -1 and s.find('-') == -1:
            index = s.rfind('[')
            if index == -1:break
            e = s.find(']', index)
            s = s[:index] + s[index + 1:e][::-1] + s[e + 1:]
        else:
            index = s.find('+')
            if index == -1:
                index = s.find('-')
            if s.find('-') != -1:
                index = min(index, s.find('-'))
            e = index
            f = 0
            while s[e] == '+' or s[e] == '-':
                f += [-1, 1][s[e] == '+']
                e += 1
            r = s[e]
            if r != '?':
                r = chr((ord(r) - ord('A') + f) % 26 + ord('A'))
            s = s[:index] + r + s[e + 1:]
    print(s.replace('?', 'A'))


Measured memory_bytes: 5576
N,M = map(int, input().split())
s = [0] * M
c = [0] * M

for i in range(M):
    s[i], c[i]= map(int, input().split())
    
n=[-1]*N
w=True
for i in range(M):
    if n[s[i]-1]==-1:
        n[s[i]-1]=c[i]
    if n[s[i]-1]!=-1 and n[s[i]-1]==c[i]:
        n[s[i]-1]=c[i]
    if n[s[i]-1]!=-1 and n[s[i]-1]!=c[i]:
        w=False
if  n[0]==0 and N!=1:
    w=False
if  n[0]==-1 and N!=1:
    n[0]=1
if n[0]==-1 and N==1:
    n[0]=0
if N==3:
    if n[1]==-1:
        n[1]=0
    if n[2]==-1:
        n[2]=0
if N==2:
    if n[1]==-1:
        n[1]=0
num=''
for i in n:
    num+=str(i)
if w:
    print(num)
else:
    print('-1')

Measured memory_bytes: 3064
import java.io.*;

class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        char[] str = br.readLine().toCharArray();
        char[] target = br.readLine().toCharArray();
        boolean answer = false;
        int i, j;
        loop: for (i = 0; i < str.length; i++) {
            if (str[i] == target[0]) {
                for (j = 1; j < target.length; j++) {
                    if (str[(i+j)%str.length] != target[j]) continue loop;
                }
                answer = true;
            }
        }
        System.out.println((answer) ? "Yes" : "No");
    }
}

Measured memory_bytes: 24416
#include <iostream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <iterator>
#include <numeric>
#include <cstdint>
#include <cmath>
#include <bitset>
#include <string>
#include <list>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>

using namespace std;

#define N_TIMES(i, n)     for ( uint64_t i = 0;     i <  n; ++i )
#define N_TIMES_REV(i, n) for (  int64_t i = n - 1; i >= 0; --i )

int main(int argc, char **argv)
{
  uint64_t N;
  cin >> N;
  
  vector<int64_t> A(N);
  N_TIMES(n, N) { cin >> A[n]; }
  
  vector<int64_t> B(N);
  uint64_t C = 0;
  N_TIMES(n, N) {
    B[n] = ::abs(A[n]);
    if (A[n] < 0) { ++C; }
  }
  
  uint64_t S = accumulate(B.begin(), B.end(), static_cast<int64_t>(0), plus<int64_t>());
  uint64_t x = *min_element(B.begin(), B.end());
  
  if (C % 2 == 1) {
    S -= x << 1;
  }
  
  cout << S << endl;
  
  return 0;
}

Measured memory_bytes: 1792
using System;
using System.Numerics;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace debug
{
    class main 
    {
        static void Main(string[] args)
        {
            ProgramB a = new ProgramB();
            a.main();
            
        }

    }

    class ProgramA
    {
        public void main()
        {
            //入力
            string s = Console.ReadLine();

            if (s == "Sunny")
                Console.WriteLine("Cloudy");
            else if (s == "Cloudy")
                Console.WriteLine("Rainy");
            else
                Console.WriteLine("Sunny");

        }


    }

    class ProgramB
    {
        public void main()
        {
            //入力
            string s = Console.ReadLine();

            for(int i = 0;i < s.Length;i++)
            {
                if( i % 2 == 0)
                {
                    if(s[i] == 'L')
                    {
                        Console.WriteLine("No");
                        return;
                    }
                    continue;
                }

                if (s[i] == 'R')
                {
                    Console.WriteLine("No");
                    return;
                }
            }

            Console.WriteLine("Yes");
        }


    }


}


Measured memory_bytes: 13140
from collections import defaultdict
INF = 10**13
N, M = map(int, input().split())
A = []
C = []
for m in range(M):
    a, b = map(int, input().split())
    A += [a]
    c = list(map(int, input().split()))
    C += [sum(map(lambda x: 2**(x-1), c))]
dp = [INF for i in range(2**N)]
dp[0] = 0
for i in range(2**N):
    for j in range(M):
        dp[i | C[j]] = min(dp[i] + A[j], dp[i | C[j]])

if dp[2**N-1] == INF:
    print(-1)
else:
    print(dp[2**N-1])

Measured memory_bytes: 75632
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
	string s;
	cin >> s;


	if (s[0] != s[1] && s[1] != s[2] && s[2] != s[3]) {
		cout << "Good" << endl;
	}
	else {
		cout << "Bad" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define dl double
#define mp make_pair
#define pb push_back
#define S second
#define F first
using namespace std;

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



void solve()
{
    
    ll n,d;
    cin >> n >> d;
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        ll x,y;
        cin >> x >> y;
        if(d*d>=x*x+y*y)
        cnt++;
    }
    cout << cnt << endl;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t;
    //cin >> t;
    t=1;
    while (t--)
    {
        solve();
    }

    return 0;
}

Measured memory_bytes: 3636
<?php
fscanf(STDIN, "%d", $i);
if ($i == 10 || $i == 100 || $i == 1000 || $i == 10000 || $i == 100000) {
    $ans = 10;
} else {
    $i2 = str_split($i);
    $ans = array_sum($i2);
}
echo (int)$ans . "\n";
?>

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

using namespace std;
int main()
{
	vector<int> a;
	for (int i = 0; i < 3;i++)
	{
		int t;
		cin >> t;
		a.push_back(t);
	}
	vector<int>b;
	b = a;
	sort(a.begin(),a.end());
	if (b == a && (a[0] != a[1] && a[1] != a[2]))
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define int long long
using namespace std;
typedef vector<int>   vint;
typedef pair<int,int> pint;

signed main()
{
    string s; cin>>s;
    stack<int> st;
    REP(i,s.size()){
        if(st.empty() or st.top()==s[i]) st.push(s[i]);
        else st.pop();
    }
    cout<<s.size()-st.size()<<endl;
}


Measured memory_bytes: 1152
N, M = map(int, input().split())
H = list(map(int, input().split()))
res_count = [0] * N
appear_count = [0] * N

for i in range(M):
  a, b = map(int, input().split())
  appear_count[a-1] += 1
  appear_count[b-1] += 1
  if H[a-1] > H[b-1]:
    res_count[b-1] -= 1
  elif H[a-1] < H[b-1]:
    res_count[a-1] -= 1
  else:
    res_count[a-1] -= 1
    res_count[b-1] -= 1

print(res_count.count(0)) 

Measured memory_bytes: 20120
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CS
{


    public class Class1
    {





        static void Main()
        {

            long[] l = Console.ReadLine().Split(' ').Select((s) => long.Parse(s)).ToArray();

            long X = l[0];
            long K = l[1];
            long D = l[2];

            long x = Math.Abs(X);
            long ret = 0;

            long straight = K < x / D ? K : x / D;
            //真ん中を超えられない場合
            K -= straight;
            x -= straight * D;


            if (K % 2 == 0)
            {
                ret = x;
            }
            else
            {
                ret = D - x;
            }

            Console.WriteLine(ret.ToString());

        }




    }
}

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

typedef long long ll;
#define PI 3.1415926535897932384626433
#define mod 1000000007

int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

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

int main(){
    string t = "CODEFESTIVAL2016";
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 0; i < 16; i++){
        if(s[i] != t[i]){
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n-1); }

#ifdef LOCAL
#define show(x) cerr << "LINE" << __LINE__ << " : " << #x << " = " << (x) << endl
#else
#define show(x) true
#endif

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);		//DON'T USE scanf/printf/puts !!
	cout << fixed << setprecision(20);
	
	int N;
	cin>>N;
	string s;
	cin>>s;
	int a=0,b=0;
	rep(i,N){
		if(s[i]=='R') a++;
		else b++;
	}
	if(a>b) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//cervello|Phoenix
using namespace std;
#define ll long long int
#define eb emplace_back
#define mk make_pair
#define pr pair<int,int>
#define all(x) x.begin(),x.end()
#define mod 1000000007

int main(){
  ios_base::sync_with_stdio(false);
    // #ifndef ONLINE_JUDGE
    //   freopen("input.txt", "r", stdin);
    //   freopen("output.txt", "w", stdout);
    // #endif
  double r; cin>>r;
  double v1=22,v2=7;
  double pi=(v1/v2);
  r=2*(pi)*r;
  cout<<fixed<<setprecision(12)<<r<<"\n";
  return 0;
}

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

using namespace std;
#define MOD 1000000007
#define pi 3.1415926535897932384626433832795028841971693993751058209749445923078164062
#define ll long long
#define pb push_back
#define pf push_front
#define mp make_pair
#define mt make_tuple
#define popb pop_back()
#define popf pop_front()
#define ff first
#define ss second
#define vl vector<ll>
#define vi vector<int>
#define vs vector<string>
#define vll vector< pair<ll,ll> >
#define vii vector< pair<int,int> >
#define viii vector< tuple <int,int,int> >
#define vlll vector< tuple <ll,ll,ll> >
#define vvl vector<vector<ll>>
#define vv vector<vector<int>>
#define all(v) v.begin(),v.end()
#define sqrt sqrtl
#define cbrt cbrtl
#define pll pair<ll,ll>
#define pii pair<int,int>
#define mapcl map<char,ll>
#define mapci map<char,int>
#define mapll map<ll,ll>
#define mapii map<int,int>
#define seti set<int>
ifstream fin("input.txt");
ofstream fout("output.txt");

int gcd(int a,int b){while (a&&b)a>b?a%=b:b%=a;return a+b;}
ll pows(int a , int b){ll res=1;for(int i=0; i<b; ++i){res*=a;}return res;}
ll logx(ll base, ll num){int cnt=0;while(num!=1){num/=base; ++cnt;}return cnt;}

vi vis(100001,0);
vi adj[100001];

int main()
{	
    std::ios::sync_with_stdio(false);
    //cin.tie(NULL);
    //cout.tie(NULL);
    ll l,r;
    cin>>l>>r;
    ll a,b;
    a=l/2019;
    b=r/2019;
    if(a!=b)
    	cout<<0<<"\n";
    else
    {
    	ll mod= INT_MAX;
    	for(ll i=l; i<r; ++i)
    	{
    		for(ll k = l+1; k<=r; ++k)
    		{
    			mod=min((k*i)%2019,mod);
    		}
    	}
    	cout<<mod<<"\n";
    }


}

Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vi  = vector<int>;
#define _GLIBCXX_DEBUG
#define IO_STREAM cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(int i=sta;i<end;++i)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
const ll INF = 1000000000000000;
const ll MOD = 1000000007;
const double PI = acos(-1);
//||
#define DBG(a,b,c,d) //cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl
//DBG("","","","");

int main(){
	IO_STREAM;
	ll N;	cin>>N;
	ll s=0;
	ll n=N;
	while(n>0){
		s+=n%10;
		n/=10;
	}
	if(N%s==0)	cout<<"Yes"<<endl;
	else	cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 3616
#include<bits/stdc++.h>
#define fast ios::sync_with_stdio(NULL);cin.tie(0);cout.tie(0);
#define make_pair mp
#define pb push_back
#define ALL(s) s.begin(), s.end()
using namespace std;
typedef long long ll;
const int maxn = 1<<21;
const int mod = 1e9+7;
const int INF = 1e9+5;
int h[100005];
int main()
{
	int n;
	cin >> n;
	for(int i=0;i<n;i++)cin >> h[i];
	vector<int> dp(n,INF);
	dp[0] = 0;
	for(int i=0;i<n;i++)
	{
		if(i+1<n)dp[i+1] = min(dp[i+1],dp[i]+abs(h[i]-h[i+1]));
		if(i+2<n)dp[i+2] = min(dp[i+2],dp[i]+abs(h[i]-h[i+2])); 
	}
	cout << dp[n-1] << endl;
	return 0;
}

Measured memory_bytes: 1024
import sys
#input = sys.stdin.readline
L,R=map(int,input().split())
min_=2018
for i in range(L,R+1):
    for j in range(i+1,R+1):
        min_=min(min_,((i % 2019)*(j % 2019) % 2019))
        if min_==0:
            print(0)
            sys.exit()
print(min_)

Measured memory_bytes: 3060
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <iomanip>


using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;

typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define shandom_ruffle random_shuffle

const int MOD = 1000000007;
const ll INF = 1e18;
const int MX = 100001; //check the limits, dummy


int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cout << std::setprecision(9);
    cout << std::fixed;

    ll a,b;
    cin >>a >>b;
    if(a%2 == 0 || b % 2 == 0) cout <<"No"<<endl;
    else cout << "Yes" << endl;

    return 0;
}

// read the question correctly (ll vs int)
// template by super1 derived from bqi343


Measured memory_bytes: 256
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#pragma GCC optimize ("O3")
	#define NDEBUG
#endif
// #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

const array<int, 4> dx = {0, 1, 0, -1};
const array<int, 4> dy = {1, 0, -1, 0};


typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);
}

int main()
{
	ios_init();
	 int h, w, k;
	while(cin >> h >> w >> k) {
		vector<string> s(h);
		REP(i, h) cin >> s[i];
		vector<vector<int>> ans(h, vector<int>(w, -1));
		int cnt = 0;
		REP(i, h) {
			int l = 0;
			bool ex = false;
			REP(j, w) {
				if(s[i][j] == '#') {
					ex = true;
					FOR(k, l, j + 1) ans[i][k] = cnt;
					l = j + 1;
					cnt++;
				}
			}

			if(ex) {
				FOR(k, l, w) {
					ans[i][k] = cnt - 1;
				}
			}
		}
		REP(j, w) REP(i, h - 1) {
			if(ans[i + 1][j] == -1) ans[i + 1][j] = ans[i][j];
		}
		REP(j, w) RFOR(i, 1, h) {
			if(ans[i - 1][j] == -1) ans[i - 1][j] = ans[i][j];
		}
		REP(i, h) REP(j, w) ans[i][j]++;

		REP(i, h) pite(ALL(ans[i]));
	}
	return 0;
}


Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <numeric>
#include <set>
#include <list>
#include <valarray>
#include <functional>
#include <array>

int main() {
	int n;
	std::cin >> n;
	std::valarray<int> s(n);
	for (int i = 0; i < n; i++) std::cin >> s[i];
	int sum = s.sum();
	std::sort(std::begin(s), std::end(s));
	if (sum % 10 != 0) {
		std::cout << sum << std::endl;
		return 0;
	}
	for (int i = 0; i < n; i++) {
		if ((sum - s[i]) % 10 != 0) {
			std::cout << sum - s[i] << std::endl;
			return 0;
		}
	}
	std::cout << '0' << std::endl;
}



Measured memory_bytes: 256
#include <stdio.h>
int main(void){
  int A,B,Q,i,j;
  long s[100000],t[100000],x[100000];
  long a1,a2,b1,b2,ans,ans2,p;
  scanf("%d %d %d",&A,&B,&Q);
  for(i=0;i<A;i++)scanf("%ld",&s[i]);
  for(i=0;i<B;i++)scanf("%ld",&t[i]);
  for(i=0;i<Q;i++)scanf("%ld",&x[i]);

  for(i=0;i<Q;i++){
    a1=20000000000;
    a2=20000000000;
    b1=20000000000;
    b2=20000000000;
    ans=20000000000;

    for(j=0;j<A;j++){
      if(x[i]<s[j]){
        if(j!=0)a1=x[i]-s[j-1];
        a2=s[j]-x[i];
        break;
      }
      else
      {
        if(j+3000<A)
        {
          if(x[i]>s[j+3000])
          {
            j+=2999;
          }
        }
      }
    }
    if(a2==20000000000)a1=x[i]-s[A-1];

    for(j=0;j<B;j++)
    {
      if(x[i]<t[j]){
        if(j!=0)b1=x[i]-t[j-1];
        b2=t[j]-x[i];
        break;
      }
      else
      {
        if(j+3000<B)
        {
          if(x[i]>t[j+3000])
          {
            j+=2999;
          }
        }
      }
    }
    if(b2==20000000000)b1=x[i]-t[B-1];

//    printf("%ld %ld %ld %ld\n",a1,a2,b1,b2);

    if(a1<b1)ans=b1;
    else{ans=a1;}

    if(a1<b2)ans2=2*a1+b2;
    else{ans2=a1+2*b2;}
    if(ans>ans2)ans=ans2;

    if(a2<b1)ans2=2*a2+b1;
    else{ans2=a2+2*b1;}
    if(ans>ans2)ans=ans2;

    if(a2>b2)ans2=a2;
    else{ans2=b2;}
    if(ans>ans2)ans=ans2;

    printf("%ld\n",ans);
  }

  return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X)
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto x:v)cerr<<x<<' ';cerr<<endl;
#define INF 1000000007
#define LINF 1000000000000000007
#define EPS 1e-9
typedef long long ll;

long long DPTwelvefoldWay10[1010][1010];
long long TwelvefoldWay10(long long n,long long k,long long MOD){
  DPTwelvefoldWay10[0][0] = 1;
  for(long long i = 0;i < n+1;i++){
    for(long long j = 1;j < k+1;j++){
      DPTwelvefoldWay10[i][j] = DPTwelvefoldWay10[i][j-1];
      if(i >= j){
        DPTwelvefoldWay10[i][j] += DPTwelvefoldWay10[i-j][j];
        DPTwelvefoldWay10[i][j] %= MOD;
      }
    }
  }
  return DPTwelvefoldWay10[n][k];
}

signed main(){
  ll n,k;
  cin >> n >> k;
  cout << TwelvefoldWay10(n,k,INF) << endl;
}


Measured memory_bytes: 10984
#include <bits/stdc++.h>
#define long long long int
using namespace std;

// @author: pashka

int main() {
    ios::sync_with_stdio(false);
    
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    
    int k = 1;
    for (int i = 0; i < n; i++) {
        if (a[i] == k) {
            k++;
        }        
    }
    
    // 1..k - 1
    if (k == 1) {
        cout << -1;
    } else {
        cout << n - (k - 1);
    }

    return 0;
}

Measured memory_bytes: 1024
from bisect import bisect_left, bisect_right
from collections import deque

N = int(input())
A = list(map(int, input().split(" ")))
A.sort()
A = deque(A)
ans = 0
t_max = len(bin(A[-1])) - 2
for t in range(t_max, 0, -1):
    if len(A) < 2: break
    while len(bin(A[-1])) - 2 > t:
        A.pop()
        if len(A) < 2: break
    if len(A) < 2: break
    pow2 = 1 << t
    A_tmp = deque()
    while t == len(bin(A[-1])) - 2:
        r = A.pop()
        idx = bisect_left(A, pow2 - r)
        for _ in range(idx):
            A_tmp.appendleft(A.popleft())
        if len(A) == 0: break
        if A[0] + r == pow2:
            A.popleft()
            ans += 1
        if len(A) < 2: break
    A.extendleft(A_tmp)
                    
print(ans)

Measured memory_bytes: 26000
const main = stdin => {
  const [S, T] = stdin.trim().split('\n')
  if (S === T.substr(0, S.length)) {
    console.log('Yes')
  } else {
    console.log('No')
  }
}

// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))


Measured memory_bytes: 29536
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
using namespace std;

int main()
{
    int n;
    cin >> n;
    int r = 0;
    int m = 7;
    for (int i = 1; i <= n; i++)
    {
        r = (r + m) % n;
        if (r % n == 0)
        {
            cout << i << '\n';
            return 0;
        }
        m = (m * 10) % n;
    }
    cout << -1 << '\n';
    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
#define eb emplace_back
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
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() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    int co = 0;
    while (n > 0) {
        n /= k;
        co++;
    }
    cout << co << endl;
}


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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

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

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

    vector<ll> ans(N);

    ans[0] = 0;
    for(int i = 1; i < N; i++){
        ans[i] = A[i-1] - ans[i-1];
    }

    ans[0] = (A[N-1] - ans[N-1]) / 2;

    for(int i = 1; i < N; i++){
        if(i%2 == 0){
            ans[i] += ans[0];
        }else{
            ans[i] -= ans[0];
        }
    }

    for(int i = 0; i < N; i++){
        ans[i] *= 2;
    }

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


    return 0;
}



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

int main() {
  int N;
  cin >> N;
  vector<int> s(N);
 for(int i = 0; i < N; i++){
   cin >> s.at(i);
 }
  sort(s.begin(), s.end());
  reverse(s.begin(), s.end());
  int moti = 1;
  for(int i = 0; i < N-1; i++){
    if(s.at(i) > s.at(i+1)){
      moti++;
    }
    if(s.at(i) == s.at(i+1)){
      continue;
    }
  }
  cout << moti << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define INF (1LL<<50)

signed main(){

	lli l;
	cin>>l;

	double t = l/3.0;

	cout <<setprecision(15);
	cout<<t*t*t<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define double long double
#define int long long
#define mii map<int,int>
#define pii pair<int,int>
#define low lower_bound
#define upp upper_bound
#define mod 1000000007 //10^9+7
#define inf 10000000000000000 //10^16
#define rep(i,n) for(int i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define vsort(vec) sort(all(vec))
#define vrever(vec) reverse(all(vec));
#define vunsort(vec) vsort(vec); vrever(vec);
#define bisea binary_search
#define cend cout<<endl;
#define F first
#define S second
#define P pair<int,int>
using namespace std;
int twi(int n) {
	int cnt=0;
	while(n%2==0) {
		n/=2;
		cnt++;
	}
	return cnt;
}
signed main() {
	int a,b,c;
	cin>>a>>b>>c;
	int d=abs(a-b);
	int e=abs(a-c);
	int f=abs(a-c);
	if(a==b&&b==c) {
		if(a%2==1) {
			cout<<0<<endl;
		}
		else {
		  cout<<-1<<endl;
	  }
		return 0;
	}
	cout<<min({twi(d),twi(e),twi(f)})<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;


int v[1010]={0};
int w[1010]={0};
int dp[1010][10010]={{0}};
int n,W;
int main(){
	cin>>n>>W;
	 for(int i =0;i <n;i++){
		cin>>v[i]>>w[i];
	}
	
	for (int i = 0; i < n; i++){
		for (int j = 0; j <= W; j++){
			if (j-w[i] >= 0){
				dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
			}
			else{
				dp[i + 1][j] = dp[i][j];
			}

		}

	}

	cout << dp[n][W]<<endl;
	return 0;
}

Measured memory_bytes: 5220
n = int(input())
a = list(map(int, input().split()))
result = 'APPROVED'

for i in range(n):
    if a[i]%2 == 0:
        if a[i]%3 == 0 or a[i]%5 == 0:
            pass
        else:
            result = 'DENIED'
print(result)

Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
//#include<bits/stdc++.h>
#include "iostream"
#include "vector"

using namespace std;
typedef long long ll;

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=b;i--)
#define ALL(x) x.begin(),x.end()
#define SIZE(x) ll(x.size())

#define INF 1000000000000 //10^12
#define MOD 1000000007 //10^9+7:合同式の法


int main(){
    ll n;
    cin >> n;

    ll count4=0;
    ll count2=0;
    ll countodd=0;
    vector<ll> a;
    REP(i,n){
        ll tmp;
        cin >> tmp;
        a.push_back(tmp);
        if(tmp%4 == 0){
            count4++;
        }
        else if(tmp%4 == 2){
            count2++;
        }
        else{
            countodd++;
        }
    }
    if(count4 >= countodd){
        cout << "Yes" << endl;
    }
    else if(count4 == countodd-1){
        if(count2==0){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" << endl;
        }
    }
    else{
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 4232
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace ABC140
{
    public class Program
    {

        #region templete

        private static void WL(string s) { WriteLine(s); }

        /// <summary>
        /// 最小公倍数
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        static long Gcd(long a, long b)
        {
            var v = new[] { a, b };
            while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
            return v[0];
        }
        /// <summary>
        /// 最小公約数
        /// </summary>
        /// <param name="a"></param>
        /// <param name="b"></param>
        /// <returns></returns>
        static long Lcm(long a, long b)
        {
            return a / Gcd(a, b) * b;
        }

        public static void Main(string[] args)
        {
            new Program().Solve();
            ReadLine();
        }

        #endregion

        public void Solve()
        {
            var cin = new Scanner();
            var n = cin.nextInt();
            var b = cin.ArrayInt(n - 1);
            var a = new int[n];
            a[0] = b[0];

            for (int i = 1; i < n - 1; i++)
            {
                a[i] = Min(b[i - 1], b[i]);
            }
            a[n - 1] = b[n - 2];
            int ans = a.Sum();

            WL($"{ans}");
        }

    }
}


#region console in

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

#endregion

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;

int main(){
	int n; cin >> n;
	string s; cin >> s;
	int cnt[26];
    for(int i=0;i<26;i++){
      cnt[i]=0;
    }
	int ans=0;
	for(int i=0;i<n;i++){
		cnt[s[i]-'a'] ++;
	}
	for(int i=0;i<n-1;i++){
		int cnt2[26];
		for(int j=0;j<26;j++){
			cnt2[j]=0;
		}
		int che=0;
		for(int j=0;j<=i;j++){
			cnt2[s[j]-'a']++;
		}
		for(int j=0;j<26;j++){
			if(cnt[j]-cnt2[j]>0 && cnt2[j]>0)
				che++;
		}
		ans=max(ans,che);

	}
	cout << ans << endl;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

class Data{
public:
	int a,b,c,d;
	Data()=default;
	Data(int i,int j,int k,int l):a(i),b(j),c(k),d(l){}
};
vector<Data> D;
int N,M,Q;

int dfs(int depth,string str){
	if(depth==N){
		int sum=0;
		REP(i,Q){
			if(str[D[i].b-1]-str[D[i].a-1]==D[i].c){
				sum += D[i].d;
			}
		}
		return sum;
	}

	int value=0;
	char bch=str.back();
	for(char ch=bch;ch<=min('9',(char)(M+'0'-1));ch++){
		value = max(value,dfs(depth+1,str+ch));
	}
	return value;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);

	N=in(),M=in();
	Q=in();
	REP(i,Q){
		Data v;
		v.a=in();
		v.b=in();
		v.c=in();
		v.d=in();
		D.push_back(v);
	}
	
	out(dfs(1,"0"));
	return 0;
}


Measured memory_bytes: 3648
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

typedef struct node{
 int num;
 struct node *left;
 struct node *right;
}node;


node * makenode(int x){

 node *new=malloc(sizeof(node));
 new->right=NULL;
 new->left=NULL;
 new->num=x;

return new;
}


int main(){
 int n,i,x;
 char com[13];
 node *front=NULL;
 node *rear=NULL;
 node *new;
 node **p;
 node *q;

 scanf("%d",&n);

 for(i=0;i<n;i++){
  scanf("%s",com);

  if(com[0]=='i'){
    scanf("%d",&x);
    new=makenode(x);
    new->right=front;
    if(front!=NULL)front->left=new;
    else rear=new;
    front=new;
  }

  else if(strcmp(com,"deleteFirst")==0){
    front=front->right;
    if(front!=NULL){
       free(front->left);
       front->left=NULL;
    }
    else rear=NULL;
  }

  else if(strcmp(com,"deleteLast")==0){
    rear=rear->left;
    if(rear==NULL)front=NULL;
    else {
     free(rear->right);
     rear->right=NULL;
    }
  }

  else if(strcmp(com,"delete")==0){
    scanf("%d",&x);
    p=&front;
    while((*p)!=NULL && (*p)->num != x)p=&((*p)->right);
    if((*p)!=NULL){
     if((*p)->right == NULL){
        rear=rear->left;
        free((*p));
        (*p)=NULL;
     }
     else {
        (*p)->right->left=(*p)->left;
        (*p)=(*p)->right;
     }
    }
  }

 }

 q=front;
 while(q!=NULL){
  if(q==rear)printf("%d\n",q->num);
  else printf("%d ",q->num);
  q=q->right;
 }

return 0;
}


Measured memory_bytes: 33052
#include <bits/stdc++.h>
#define rep3(i, s, n, a) for (int i = (s); i < (int)(n); i += a)
#define rep2(i, s, n) rep3(i, s, n, 1)
#define rep(i, n) rep2(i, 0, n)

using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int, int>;

vector<int> eratos(int n);

int main()
{
    ll n;
    cin >> n;
    vector<int> prime = eratos((int)sqrt((double)n+9));
    ll cnt = 0;
    // rep(i, (int)sqrt((double)n))
    // {
    //     if(prime[i]==true){
    //         cout << i << endl;
    //     }
    // }
    ll left = n;
    int ind = 0, p_size = prime.size();
    ll z = prime[0], nowz = prime[0];
    while(left!=1&&ind<p_size){
        while(true){
            if (left % nowz != 0)
            {
                break;
            }
            left /= nowz;
            //cout << left << endl;
            nowz *= z;
            cnt++;
        }
        ind++;
        z = prime[ind];
        nowz = prime[ind];
    }
    if(left<prime[p_size-1]){
        cout << cnt << endl;
    }else{
        cout << cnt + 1 << endl;
    }
    
    return 0;
}

vector<int> eratos(int n){
    vector<bool> prime(n + 1, true);
    vector<int> primebox;
    prime[0] = false;
    prime[1] = false;
    rep2(i, 2, n){
        if(prime[i]==true){
            primebox.push_back(i);
            int out = i*2;
            while(out<=n){
                prime[out] = false;
                out += i;
            }
        }
    }
    return primebox;
}


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

int a(int x) {
  if (x >= 100) {
    x -= x / 100 * 100;
  }
  if (x >= 10) {
    x -= x / 10 * 10;
  }
  return x;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
  
  int N;
  cin >> N;
  int ans = a(N);
  if (ans == 3) {
    cout << "bon" << endl;
  }
  else if (ans == 0 || ans == 1 || ans == 6 || ans == 8) {
    cout << "pon" << endl;
  }
  else {
    cout << "hon" << endl;
  }
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
using P = pair<ll, ll>;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
using Graph = VV;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int Inf = (1 << 30);
ll inf = (1LL << 60);
const int MOD = 1e9 + 7;
char rsp(char s) {
	if (s == 'r') return 'p';
	if (s == 's') return 'r';
	if (s == 'p') return 's';
}
int main() {
	int n, k;
	cin >> n >> k;
	int r, s, p;
	cin >> r >> s >> p;
	string S;
	cin >> S;
	int ans = 0;
	rep(i, k) {
		if (S[i] == 'r') ans += p;
		if (S[i] == 's') ans += r;
		if (S[i] == 'p') ans += s;
	}
	int now = 0;
	string K = "";
	rep(i, k) K += rsp(S[i]);
	for (int i = k; i < n; i++) {
		if (K[now] != rsp(S[i])) {
			if (S[i] == 'r') ans += p;
			if (S[i] == 's') ans += r;
			if (S[i] == 'p') ans += s;
			K += rsp(S[i]);
			now++;
		}
		else {
			K += 'x';
			now++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
// https://atcoder.jp/contests/abc144/tasks/abc144_a
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (int i = n - 1; i >= 0; i--)
#define FOR(i, s, n) for (int i = (s), i##_len = (n); i < i##_len; ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()
#define DIV(a, b) ((a - 1) / b + 1)

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    FOR(i, 1, 10) FOR(j, i, 10) {
        if (i * j == n) {
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";

    return 0;
}


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


class Solver {
public:
    void solve();
};


void Solver::solve() {
    // 入力
    int a, b, c, d, e, k;

    std::cin >> a >> b >> c >> d >> e >> k;

    std::string ans = (e - a > k) ? ":(" : "Yay!";
    
    
    std::cout << ans << std::endl;    
}

int main() {
    Solver solver = Solver();
    solver.solve();
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

	public class Main {
		public static void main(String[] args) {
			BufferedReader input = new BufferedReader(new InputStreamReader(System.in));


			  try{


				  String ab;
				  String[] strAry;
				  int a;
				  int b;
				  int c;
				  int yaku;
				  int count=0;

			
				  ab = input.readLine();
			      strAry = ab.split(" ");
			      a=Integer.parseInt(strAry[0]);
		          b=Integer.parseInt(strAry[1]);
		          c=Integer.parseInt(strAry[2]);

				  for(int i=a; i<=b; i++){
					     yaku=c%i;
					     
					     if(yaku==0){
					    	count++;
					    	
					     }


				   }
				  System.out.println(count);


			    }catch(IOException e) {   System.out.println("Exception : " + e);
			    }

		}
	}

Measured memory_bytes: 24376
from collections import deque
a = list(input())
a = deque(a)
re = 0
for i in range(int(input())):
  b = input().split()
  if b[0] == "1":
    re = (re+1)%2
  else:
    if (re and b[1] == "2") or (not(re) and b[1] == "1"):
      a.appendleft(b[2])
    else:
      a.append(b[2])
a = list(a)
if re:
  a = a[::-1]
print("".join(a))



Measured memory_bytes: 10212
N, K = map(int,input().split())
p = [(int(x)+1)/2 for x in input().split()]

t = [0]*(N+1)
t[0]
for i in range(1,N+1):
    t[i] = t[i-1]+p[i-1]

ans = 0
for i in range(N-K+1):
    ans = max(ans, t[i+K]-t[i])
print(ans)


Measured memory_bytes: 23524