akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

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

    vector<int> l(N);
    for (int i = 0; i < N; i++) {
        cin >> l[i];
    }
    sort(l.begin(), l.end(), greater<int>());
    cout << accumulate(l.begin(), l.begin() + K, 0) << endl;

    return 0;
}

Measured memory_bytes: 256
// Garg's Code
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
 
#define ll long long
#define vec vector < ll >
#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define F  first
#define S  second
#define f(i,x,n) for(ll i=x;i<n;i++)
#define rf(i,x,n) for(ll i = x; i >= x; i--) 
#define all(c) c.begin(),c.end()
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
const ll MAX = LLONG_MAX, mod = 1000000007, MODA = 1e9 - 1;
const ll MIN = LLONG_MIN;
const long double PI = 3.1415926535;
const ll N = 400009;

int main()
{
  fast();

  
  ll n, m;
  cin >> n >> m;
  ll arr[m];
  bool flag = 0;
  f(i,0,m)
  {
    cin >> arr[i];
    n -= arr[i];
    if(n <= 0)
    {
      flag = 1;
    }
  }
  if(flag)
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}

Measured memory_bytes: 1024
import Control.Monad
import Data.Maybe
import Control.Applicative

total :: [Int] -> [Int] -> Maybe Int
total [] _ = Nothing
total _ [] = Nothing
total pcbe hg = Just (mPCBE + mHG)
  where mPCBE = sum pcbe - minimum pcbe
        mHG   = maximum hg


main :: IO()
main = do
  pcbe <- map (read :: String -> Int) <$> replicateM 4 getLine
  hg <- map (read :: String -> Int) <$> replicateM 2 getLine
  print $ fromJust $ total pcbe hg

Measured memory_bytes: 3676
P,i,I[999],c[999],n,r;double h,H;main(p){for(;i=scanf("%d",&n)*n;printf("%d %d %d\n",p>>8,p>>4&15,p&15)){for(h=9e9;i;)scanf("%d",I+--i);for(P=4096;P--;memset(c,H=0,2e3)){for(r=P>>8,i=n;i;++c[I[--i]+r&255])r=P/16%16*r+P%16&255;for(i=256;i--;H-=c[i]*log(fmax(c[i],1)/n));h>H-1e-9?h=H,p=P:0;}}}

Measured memory_bytes: 652
# nをmで割った商および余りをdとする
# n=m*d+d
# n=(m+1)*d
# d<m
# 上記を満たす1以上のm

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

n=int(input())
ans=0
candi=make_divisors(n)
for d in candi:
  m=n//d-1
  if d<m and 0<m:
    ans+=m
print(ans)

Measured memory_bytes: 3272
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

string divide[4] = {"dream", "dreamer", "erase", "eraser"};

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

    // 後ろから解くかわりにすべての文字列を「左右反転」する
    reverse(S.begin(), S.end());
    for (int i = 0; i < 4; ++i) reverse(divide[i].begin(), divide[i].end());

    // 端から切っていく
    bool can = true;
    for (int i = 0; i < S.size();) {
        bool can2 = false; // 4 個の文字列たちどれかで divide できるか
        for (int j = 0; j < 4; ++j) {
            string d = divide[j];
            if (S.substr(i, d.size()) == d) { // d で divide できるか
                can2 = true;
                i += d.size(); // divide できたら i を進める
              break;
            }
        }
        if (!can2) { // divide できなかったら
            can = false;
            break;
        }
    }

    if (can) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

int main() {
    int N;
    ll MOD = 1e9 + 7;
    cin >> N;
    ll ans = 1;
    for(int i = 1; i <= N; i++) {
        ans = ans*i % MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int a = scan.nextInt();
		int b = scan.nextInt();
		scan.close();
		System.out.println((n*a<b)? n*a:b);

	}

}

Measured memory_bytes: 21716
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>

using namespace std;
typedef long long ll;

int gcd(int x, int y) {
  if (x < y) swap(x, y);
  while (y > 0) {
    int r = x % y;
    x = y;
    y = r;
  }
  return x;
}

int kaijo(int n){
    int fact = 1;
    if(n == 0) return 1;
    else{for(int i = 1; i <= n; i++){
        fact*=i;
    }
    }
    return fact;
}


/*迷路
const int INF = 50;

typedef pair<int,int> P;
char field[52][52];
int d[51][51];
int r,c;
int sx,sy;
int gx,gy;

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

int bfs(){
    queue<P> que;
    for(int i=0;i<r;i++){
        for(int j=0;j<c;j++){
            d[i+1][j+1] = INF;
        }
    }
    que.push(P(sy,sx));
    d[sy][sx]=0;
while(que.size()){
    P p=que.front();
    que.pop();
    if(p.second==gx&&p.first==gy) break;
    for(int i=0;i<4;i++){
        int nx=p.second+dx[i];
        int ny=p.first+dy[i];

        if(1<=nx&&nx<=c&&1<=ny&&ny<=r&&field[ny][nx]!='#'&&d[ny][nx]==INF){
            que.push(P(ny,nx));
            d[ny][nx] = d[p.first][p.second] + 1;
        }
    }
}
return d[gy][gx];
}
*/

//for(int i = ; i < ; i++){}

int main(){
    int x,a;
    cin>>x>>a;
    if(x<a) cout<<0<<endl;
    else cout<<10<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

#define maxn 50

char f[maxn * 2 + 1];
int main() {
    char x = fgetc(stdin);
    int i = 1;
    while (x != '\n') {
        f[i] = x;
        i += 2;
        x = fgetc(stdin);
    }
    int t = i;
    x = fgetc(stdin);
    i = 2;
    while (x != '\n') {
        f[i] = x;
        i += 2;
        x = fgetc(stdin);
    }
    if (t > i)
        i = t;
    for (int j = 1; j <= i - 2; j++)
        printf("%c", f[j]);
    return 0;
}


Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int q = Integer.parseInt(sa[1]);

		sa = br.readLine().split(" ");
		long[] a = new long[n];
		for (int i = 0; i < n; i++) {
			a[i] = Long.parseLong(sa[i]);
		}
		BIT bit = new BIT(n);
		for (int i = 0; i < n; i++) {
			bit.add(i + 1, a[i]);
		}

		PrintWriter pw = new PrintWriter(System.out);
		for (int i = 0; i < q; i++) {
			sa = br.readLine().split(" ");
			int t = Integer.parseInt(sa[0]);
			if (t == 0) {
				int p = Integer.parseInt(sa[1]) + 1;
				int x = Integer.parseInt(sa[2]);
				bit.add(p, x);
			} else {
				int l = Integer.parseInt(sa[1]);
				int r = Integer.parseInt(sa[2]);
				pw.println(bit.sum(r) - bit.sum(l));
			}
		}
		pw.flush();
		br.close();
	}

	static class BIT {
		int n;
		long[] arr;

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

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

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


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

const int maxN = 10;
const int limitS = 330;
const int gPNT = 1 << 10;
const int IO = limitS + 1;
const int IOO = gPNT * ( limitS + 1 );

int tb[ ( maxN+1 ) * ( gPNT ) * ( limitS+1 ) ];

int calc( int n, int pmt, int s ){
	int ans = 0;
	if ( s < 0 || s > limitS || n > maxN ) return 0;
	if ( tb[ n * IOO + pmt * IO + s ] >= 0 ){
		return tb[ n * IOO + pmt * IO + s ];
	}
	if ( n == 1 ){
		if ( s <= 9 && ( !( pmt & ( 1 << s ) ) ) ){
			ans = 1;
		}
	}else{
		for ( int i = 0; i < 10; ++i ){
			if ( !( ( 1 << i ) & pmt ) ){
				ans += calc( n-1, pmt+( 1 << i ), s - i*n );
			}
		}
	}
	tb[ n * IOO + pmt * IO + s ] = ans;
	return ans;
}

int main(){
	int n, s;

	for ( int i = 0; i < ( maxN+1 ) * ( gPNT ) * ( limitS+1 ); ++i ){
		tb[ i ] = -1;
	}

	while ( cin >> n >> s ){
		cout << calc( n, 0, s ) << endl;
	}

	return 0;
}

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

int main() {
  int n;
  cin >> n;
  
  int up = n / 100;
  int down = n % 100;
  
  if(up > 0 && up < 13) {
    if(down > 0 && down < 13)
      cout << "AMBIGUOUS" << endl;
    else
      cout << "MMYY" << endl;
  }
  else {
    if(down > 0 && down < 13)
      cout << "YYMM" << endl;
    else
      cout << "NA" << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#define int long long int
int function2(int memo[],int turn[],int n,map<int,int> &sticks)
{
	if(n<0)
	{
		return -1000000000;
	}
	if(n==0)
	{
		return 0;
	}
	if(memo[n]!=-1)
	{
		return memo[n];
	}
	else
	{
		map<int,set<int>> mp;
		int here=-1000000000;
		mp[here].insert(-1);
		for(auto &p:sticks)
		{
			int val=1+function2(memo,turn,n-p.second,sticks);
			mp[val].insert(p.first);
		}
		auto it=mp.end();
		it--;
		int answer=*it->second.rbegin();
		turn[n]=answer;
		memo[n]=it->first;
		return it->first;
	}
}
int32_t main()
{
	int n,m;
	cin>>n>>m;
	int count[m+1]={0};
	int j;
	for(j=0;j<n;j++)
	{
		int k;
		cin>>k;
		int i;
		for(i=0;i<k;i++)
		{
			int x;
			cin>>x;
			count[x]++;
		}
	}
	int answer=0;
	for(j=1;j<=m;j++)
	{
		if(count[j]==n)
		    answer++;
	}
	cout<<answer<<endl;
}


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

int main()
{
  int a; cin >> a;
  int b; cin >> b;
  if (a <= 5)
  {
    cout << 0 << endl;
  }
  else if (a <= 12)
  {
    cout << b / 2 << endl;
  }
  else
  {
    cout << b << endl;
  }
  
}

Measured memory_bytes: 3552
#include <iostream>
#include <vector>
#include <cstdlib>
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    int N; cin >> N;
    long long a[N][3];
    for (int i = 0; i < N; ++i){
        for(int j=0;j<3;++j){
      cin >> a[i][j];
        }
    } 

    // DP テーブル
    long long dp[N+1][3];
    
    for(int i=0;i<N+1;++i){
        for(int j=0;j<3;++j){
            dp[i][j]=0;
        }
    }

    // ループ
    for (int i = 0; i < N; ++i) {
        for(int j=0;j<3;++j){
            for(int k=0;k<3;++k){
                if(j==k)continue;
                chmax(dp[i+1][k],dp[i][j]+a[i][k]);
            }
        }
        }

// 解を得て出力
long long res=0;
for(int i=0;i<3;++i){
    chmax(res,dp[N][i]);
}
cout << res << endl;

	return 0;
}

Measured memory_bytes: 4864
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
#include <climits>
#include <iomanip>

using namespace std;

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> l(m), r(m);
	for (size_t i = 0; i < m; i++)
	{
		cin >> l[i] >> r[i];
	}
	// int minr = *min_element(r.begin(), r.end());
	// int maxl = *max_element(l.begin(), l.end());
	// int ans = minr - maxl >= 0 ? minr-maxl+1 : 0;
	// cout << ans << endl;
	int ll = l[0], rr = r[0];
	for (size_t i = 1; i < m; i++)
	{
		ll = max(ll, l[i]);
		rr = min(rr, r[i]);
	}
	int ans = rr-ll >= 0 ? rr - ll + 1:0;
	cout << ans << endl;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
static const int MAX = 100;
static const int INFTY = (1<<21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n, M[MAX][MAX];

int prim() {
  int u, minv;
  int d[MAX], p[MAX], color[MAX];

  for ( int i = 0; i < n; i++) {
    d[i] = INFTY;
    p[i] = -1;
    color[i] = WHITE;
  }

  d[0] = 0;

  while (1) {
    minv = INFTY;
    u = -1;
    for (int i = 0; i < n; i++) {
      if (minv > d[i] && color[i] != BLACK ) {
        u = i;
        minv = d[i];
      }
    }
    if (u == -1) break;
    color[u] = BLACK;
    for (int v = 0; v < n; v++ ){
      if (color[v] != BLACK && M[u][v] != INFTY) {
        if ( d[v] > M[u][v] ) {
          d[v] = M[u][v];
          p[v] = u;
          color[v] = GRAY;
        }
      }
    }
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    if (p[i] != -1) sum += M[i][p[i]];
  }

  return sum;
}

int main() {
  cin >> n;

  for (int i = 0; i < n; i++ ){
    for ( int j = 0; j < n; j++){
      int e;
      cin >> e;
      M[i][j] = (e == -1) ? INFTY : e;
    }
  }
  cout << prim() << endl;

  return 0;
}






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

int main() {
  int N;
  scanf("%d", &N);
  int T;
  scanf("%d", &T);
  int A;
  scanf("%d", &A);
  int a[N];
  for (int i = 0; i < N; ++i) {
    scanf("%d", &a[i]);
  }

  int res = 0;
  int res2 = 1000000000;

  for (int i = 0; i < N; ++i){
    int d = 1000*A - (1000*T - a[i] * 6);
    if(d<0) d = -d;
    if(res2>d) res2 = d,res=i+1;
  }

  cout << res << endl;

}


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

max_count = 0
for start_t in range(len(T)):
    for start_s in range(start_t, len(S)):
        if len(S) - start_s < len(T) - start_t:
            break
        if T[start_t] == S[start_s]:
            count = 0

            for i in range(len(T) - start_t):
                if T[start_t+i] == S[start_s+i]:
                    count += 1
            
            max_count = max(max_count, count)

answer = len(T) - max_count
print(answer)



Measured memory_bytes: 73764
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
// #include<deque>
// #include<multiset>
// #include<bitset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n;
  cin >> n;
  char b;
  cin >> b;
  for(int i = 1; i < n; i++) {
    char c;
    cin >> c;
    if(b == 'T' && c == 'F') b = 'F';
    else b = 'T';
  }
  cout << b << endl;
  return 0;
}



Measured memory_bytes: 3136
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;

constexpr ll mod=998244353;

ll mod_pow(ll a,ll b){
    a%=mod;
    if(b==0)return 1;
    if(b==1)return a;
    ll res=mod_pow(a,b/2)%mod;
    res*=res; res%=mod;
    if(b%2)res*=a;
    return res%mod;
}

struct perm{
private:
    int sz;
    vector<ll> p,invp;
public:
    perm(int n){
        sz=n+1;
        p.resize(sz),invp.resize(sz);
        p[0]=1;
        for(int i=1;i<=sz-1;i++){
            p[i]=p[i-1]*i%mod;
        }
        invp[sz-1]=mod_pow(p[sz-1],mod-2);
        for(int i=sz-2;i>=0;i--){
            invp[i]=invp[i+1]*(i+1)%mod;
        }
    }
    ll comb(ll x,ll y){
        if(x<y||y<0)return 0;
        return (p[x]*invp[x-y]%mod)*invp[y]%mod;
    }
};
perm p(1<<20);


int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n,m,k; cin >> n >> m >> k;
    ll res=0;
    for(int i=0;i<=k;i++){
        ll add=p.comb(n-1,i);
        (add*=mod_pow(m-1,n-1-i))%=mod;
        (res+=add)%=mod;
    }
    (res*=m)%=mod;
    printf("%lld\n",res);
}

Measured memory_bytes: 19380
import java.io.*;
import java.util.*;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int n = sc.nextInt();
		int k = sc.nextInt();
		long[] arr = new long[n];
		for(int i = 0; i < n; i++) {
			arr[i] = sc.nextLong();
		}
		Arrays.sort(arr);
		k = Math.min(k, n);
		long res = 0;
		for(int i = n-k-1; i >= 0; i--) {
			res += arr[i];
		}
		System.out.println(res);
	}
	
	static class FastScanner {
		public BufferedReader reader;
		public StringTokenizer tokenizer;
		public FastScanner() {
			reader = new BufferedReader(new InputStreamReader(System.in), 32768);
			tokenizer = null;
		}
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch(IOException e) {
				throw new RuntimeException(e);
			}
		}
	}

}


Measured memory_bytes: 55404
n = gets.chomp

delim = n.size
count = 0
1.upto(delim) do |i|
#  puts "i:#{i} delim:#{delim} i.odd?:#{i.odd?}"
  if i.odd?
#    puts "10**i-1:#{(10**i)-1} n:#{n.to_i}"
    if (10**i) - 1 > n.to_i
      count += n.to_i - (10**(i-1)) +1
      next
    end
    count += (10**i) - (10**(i-1))
  end
end

puts count


Measured memory_bytes: 1788
import fractions
#import math
from functools import reduce

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

n = int(input())
a = [int(i) for i in input().split()]
mod = 10 ** 9 + 7
ans = 0
b = lcm(*a)

for i in range(n):
    ans += b // a[i]
print(ans%mod)

Measured memory_bytes: 6108
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

class Monoid {
public:
    ll unit;  // 単位元

    Monoid() {
        // 単位元(maxのときは各項が正なので0)
        unit = 0;
    }
    
    // 演算関数(いまはmax)
    ll calc(ll a, ll b) {
        return max(a, b);
    }
};

class SegmentTree {
public:
    ll n;  // セグメント木の葉の要素数
    vector<ll> tree;  // セグメント木
    Monoid mono;  // モノイド
    
    SegmentTree(vector<ll> &v) {
        n = 1 << (ll)ceil(log2(v.size()));
        tree = vector<ll>(n << 1);
        for(ll i = 0; i < v.size(); i++) {
            update(i, v[i]);
        }
        for(ll i = v.size(); i < n; i++) {
            update(i, mono.unit);
        }
    }
    
    // k番目の値(0-index)をxに変更
    void update(ll k, ll x) {
        k += n;
        tree[k] = x;
        for(k = k >> 1; k > 0; k >>= 1){
            tree[k] = mono.calc(tree[k << 1 | 0], tree[k << 1 | 1]);
        }
    }
    
    // [l, r)(0-index)で演算をする
    ll query(ll l, ll r) {
        ll res = mono.unit;
        l += n;
        r += n;
        while(l < r) {
            if(l & 1) {
                res = mono.calc(res, tree[l++]);
            }
            if(r & 1) {
                res = mono.calc(res, tree[--r]);
            }
            l >>= 1;
            r >>= 1;
        }
        return res;
    }

    ll operator[](ll k) {
        // seg[i]で添字iの要素の値を返す
        if(k - n >= 0 || k < 0) {
            return -INF;
        }
        return tree[tree.size()-n+k];
    }
    
    void show() {
        ll ret = 2;
        for(ll i = 1; i < 2*n; i++) {
            cout << tree[i] << " ";
            if(i == ret - 1) {
                cout << endl;
                ret <<= 1;
            }
        }
        cout << endl;
    }
};
 
int main() {
    ll n;
    cin >> n;

    vl h(n);
    rep(i, n) {
        cin >> h[i];
    }

    vl a(n);
    rep(i, n) {
        cin >> a[i];
    }

    vl dp(n+1);  // dp[j] : i番目の花までで最後の花の高さがjのときの美しさの総和の最大値
    SegmentTree seg(dp);
    rep(i, n) {
        ll x = seg.query(0, h[i]);
        seg.update(h[i], x + a[i]);
    }
    
    out(seg.query(0, n+1));
    re0;
}

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

//template
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define ALL(v) (v).begin(),(v).end()
typedef long long int ll;
const int inf = 0x3fffffff; const ll INF = 0x1fffffffffffffff; const double eps=1e-12;
template<typename T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
//end

vector<int> g[101010]; bool used[101010]={};
void fail(){puts("No"); exit(0);}

int main(){
   int n,m; cin>>n>>m;
   rep(i,0,m){
      int x,y; cin>>x>>y; x--; y--;
      g[x].push_back(y); g[y].push_back(x);
   }
   rep(i,0,n)if(g[i].size()&1)fail();
   rep(i,0,n)if(g[i].size()>=6){
      puts("Yes"); return 0;
   }
   int u=-1,v=-1; int cnt=0;
   rep(i,0,n)if(g[i].size()>=4){
      cnt++;
      (u==-1?u:v)=i;
   }
   if(cnt>=3){puts("Yes"); return 0;}
   if(cnt<2)fail();
   cnt=0;
   function<void(int,int)> dfs=[&](int x,int p){
      if(x==v){cnt++; return;}
      for(int t:g[x])if(t!=p and !used[t]){
         if(t!=v)used[t]=1;
         dfs(t,x);
      }
   };
   dfs(u,-1); puts(cnt==2?"Yes":"No");
   return 0;
}

Measured memory_bytes: 8960
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue = BinaryHeap!(Array!long, "a<b");
// dfmt on

void main()
{
    long M, D;
    scan(M, D);
    long ans;
    foreach (m; 1 .. M + 1)
        foreach (d; 1 .. D + 1)
        {
            long d1 = d % 10;
            long d10 = d / 10;
            bool a = d1 >= 2;
            bool b = d10 >= 2;
            bool c = d1 * d10 == m;
            if (a && b && c)
                ans++;
        }
    writeln(ans);
}


Measured memory_bytes: 256
n = int(input())
h = list(map(int,input().split()))
dp = [0,abs(h[1]-h[0])]
for i in range(2,n):
    if dp[i-1] + abs(h[i]-h[i-1]) >= dp[i-2] + abs(h[i]-h[i-2]):
        dp.append(dp[i-2] + abs(h[i]-h[i-2]))
    else:
        dp.append(dp[i-1] + abs(h[i]-h[i-1]))
print(dp[n-1])

Measured memory_bytes: 13928
import java.util.*;
import java.lang.*;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();
		int[] s = new int[N+1];
		int total = 0;
		for( int i=1; i<=N; i++ ){
			s[i] = sc.nextInt();
			total += s[i];
		}
		Arrays.sort(s);
		int ans = 0;
		int dis = 0;
		int a = 1;
		int b = 0;
		for( int i=1; i<=N; i++ ){
			if( s[i]%10!=0 ){
				break;
			}
			if( i==N ){
				ans = 0;
				b = 1;
			}
		}
		if( total%10!=0 ){
			ans = total;
		}else if(b==0){
			for( int i=1; i<=N; i++ ){
				if( s[i]%10!=0 ){
					ans = total - s[i];
					break;
				}
			}			
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 23124
#include<iostream>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<iomanip>

#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

using namespace std;

#define debug(x) cout<<(#x)<<"="<<(x)<<", ";
#define debug1(x) debug(x) cout<<'\n';
#define debug2(x1, x2) debug(x1) debug(x2) cout<<'\n';
#define debug3(x1, x2, x3) debug(x1) debug(x2) debug(x3) cout<<'\n';
#define debug4(x1, x2, x3, x4) debug(x1) debug(x2) debug(x3) debug(x4) cout<<'\n';
#define debug5(x1, x2, x3, x4, x5) debug(x1) debug(x2) debug(x3) debug(x4) debug(x5) cout<<'\n';

#define fcout cout<<fixed<<setprecision(15)
#define repp(i,j,k) for(int i=j; i<k; ++i)
#define rep(i,j) repp(i,0,j)
#define rrep(i,j,k) for(int i=j; i>=k; --i)
#define all(x) (x).begin(), (x).end()
#define sort(x) sort(x.begin(), x.end())
#define lb(x,val) lower_bound(x.begin(), x.end(), val)
#define ub(x,val) upper_bound(x.begin(), x.end(), val)
#define pb(x) emplace_back(x);

typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vi;
typedef vector<lli> vl;
typedef tuple<int, int, lli> tiil;

//const lli M=998244353ll;
const lli M=1000000007ll;
const double D=1.0;

int main(){
fast_io
int x,a,b; cin>>x>>a>>b;
if(b<=a) cout<<"delicious";
else if((b-a)<=x) cout<<"safe";
else cout<<"dangerous";
 return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define arrdump(n,a) for(int i=0;i<n;i++) {cout<<((i>0)? " ":"")<<a[i];}cout<<"\n";


typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_C&lang=jp

struct Node {
    int key;
    Node *prev;
    Node *next;
};

Node *nil;

static void init() {
    nil = (Node*)malloc(sizeof(Node));
    nil->next = nil;
    nil->prev = nil;
}

static void insert(int key) {
    Node *x = (Node*)malloc(sizeof(Node));
    x->key = key;
    x->next = nil->next;
    x->prev = nil;

    nil->next->prev = x;
    nil->next = x;
}

static void deleteNode(Node *n) {
    if (n == nil) return;
    n->prev->next = n->next;
    n->next->prev = n->prev;
    free(n);
}

static Node* searchNode(int key) {
    Node *cur = nil->next;
    while(cur != nil && key != cur->key) {
        cur = cur->next;
    }
    return cur;
}

static void del(int key) {
    deleteNode(searchNode(key));
}

static void deleteFirst() {
    deleteNode(nil->next);
}

static void deleteLast() {
    deleteNode(nil->prev);
}

static void print() {
    Node *cur = nil->next;
    int i = 0;
    while(cur != nil) {
        if (i) cout << " ";
        cout << cur->key;
        cur = cur->next;
        i++;
    }
    cout << "\n";
}

int main() {
    init();
    int n; cin >> n;
    char c[50];
    int key;
    REP(i, n) {
        scanf("%s%d", c, &key);
        string com = string(c);
        if (com == "insert") insert(key);
        if (com == "delete") del(key);
        if (com == "deleteFirst") deleteFirst();
        if (com == "deleteLast") deleteLast();
    }
    print();

    return 0;
}


Measured memory_bytes: 34368
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define fin(ans) cout<<(ans)<<endl
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p,q)
#define pb(n) push_back(n)
#define Sort(a) sort(a.begin(),a.end())
#define Rort(a) sort(a.rbegin(),a.rend())
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
const int P = 1000000007;
const int INF = INT_MAX;
const long long LLINF = 1LL<<60;
//g++ -std=c++1z temp.cpp
//./a.out






int main(void){ios::sync_with_stdio(false);cin.tie(0);
///////////////////////////////////////////////////////
int n,m,X,Y,Z;
cin >> n >> m >> X >> Y;
int x[n],y[m];
rep(i,n){
    cin >> x[i];
}
rep(i,m){
    cin >> y[i];
}

sort(x,x+n);
sort(y,y+m);

for(Z=-100;Z<101;Z++){
    if(x[n-1]<Z && y[0]>=Z && X<Z && Z<=Y){
        cout << "No War" << endl;
        return 0;
    
    }
}

    cout << "War" << endl;

///////////////////////////////////////////////////////
return 0;}

Measured memory_bytes: 256
def func
  n = gets.to_i
  result = []
  1.upto n do |i|
    if i % 3 == 0
      result.push(i)
      next
    end
    if i.to_s.match /.*3.*/
      result.push(i)
      next
    end
  end

  puts ' ' + result.join(' ')
end

func


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

using namespace std;

int main(void){
	int n;
	scanf("%d\n", &n);
	int flag = 0;
	for(int i = 0;i < n;++i){
		char c;
		scanf("%c", &c);
		if(c == 'Y') flag = 1;
	}
	puts(flag == 1 ? "Four" : "Three");
	return 0;
}

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

using ll = long long;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    cout << (a * b / 2) << endl;
    return 0;
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    int n, d;
    cin >> n >> d;
    vector<vi> x(n, vi(d));
    rep(i, n) rep(j, d) cin >> x[i][j];
    int ans = 0;
    rep(i, n) rep(j, i) {
        int sq = 0;
        rep(k, d) {
            int s1 = x[i][k] - x[j][k];
            sq += s1 * s1;
        }
        int s = sqrt(sq) + 0.5;
        if (sq == s * s) ++ans;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
def kakko(S):
    cum = 0
    mi = 0
    for s in S:
        cum += 1 if s == '(' else -1
        mi = min(mi, cum)
    return (-mi, cum - mi)

N = int(input())
S = [kakko(input()) for _ in range(N)]

plus = []
minus = []

for l, r in S:
    if l <= r:
        plus.append((l, r))
    else:
        minus.append((l, r))

plus.sort(key=lambda a: a[0])
minus.sort(key=lambda a: a[1], reverse=True)
M = 0
for l, r in (plus + minus):
    M -= l
    if M < 0:
        print('No')
        exit()
    M += r

print('Yes' if M == 0 else 'No')


Measured memory_bytes: 163304
// C - Together
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	int N; cin>>N;
	vi C(100000+1);
	rp(i, 0, N){ int a; cin>>a; C[a]++; }
	int ans = 0;
	rp(x, 1, C.size()-1) ans = max(ans, C[x-1] + C[x] + C[x+1]);
	cout<< ans <<endl;
}

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

int main() {
    int N, Q; cin >> N >> Q;
    string S; cin >> S;
    vector<int> ac(N);
    for (int i = 1; i < N; i++){
        ac[i] = ac[i-1];
        if(S[i] == 'C' && S[i-1] == 'A'){
            ac[i]++;
        }
        //cout << i << " " << ac[i] << endl;
    }
    rep(i, Q){
        int l, r; cin >> l >> r;
        l--; r--;
        int ans = ac[r] - ac[l];
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 3836
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;

const long long N = 3e6 + 17;
ll a[N], b[N], cnt, ans, lnt, n, m, r1, r0, l1, l0, sum, mx, h, c[N], t[N], mn = N, x, y, k;
pair<ll,ll>pr[N];
vector<ll>v,v2;
map<ll,ll>mp;
bool used[N];
char ch[N];
ll prime[N] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53};

int main()
{
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    string s;
    cin >> s;
    for(ll i = 0; i < s.size(); i ++)
    {
        if(s[i] == 'o')
        {
            cnt ++;
        }
    }
    cout << 700 + (cnt * 100);
}


Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<map>
using namespace std;
int N, Q;
map<int, int>S;
int main()
{
	int i;
	int S_i;
	int ans = 0;
	int T_i;
	scanf("%d", &N);
	for (i = 0; i < N; i++){
		scanf("%d", &S_i);
		S[S_i] ++;
	}
	scanf("%d", &Q);
	for (i = 0; i < Q; i++){
		scanf("%d", &T_i);
		if (S[T_i] >= 1)ans++;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 1256
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long int
 
int main()
{
 	std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  	//ll tt;	cin>>tt;	while(tt--)
  	{
  		ll n,i,count,m;
  		cin>>n;

  		ll arr[n+1];

  		for(i=0;i<n;i++)	cin>>arr[i];
  			count=0;

  		m=INT_MAX;
  		for(i=0;i<n;i++)
  		{
  			m=min(m,arr[i]);
  			if(m==arr[i])	count++;
  		}



  		cout<<count;
  	}
 	cerr<<" Execution : "<<(1.0*clock())/CLOCKS_PER_SEC<<"s \n";
    return 0;
  		
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll,  ll>;

const ll INF = 1LL << 60;
const int INF32 = 1 << 29;
const ll MOD = 1000000007;

vector<pll> calc_divisor(long long n) {
    vector<pll> res;
    for (long long i = 1LL; i*i <= n; ++i) {
        if (n % i == 0) {
            res.push_back({i, n/i});
        }
    }
    sort(res.begin(), res.end());
    return res;
}

int main(){
	ll n;
	cin >> n;
  auto a=calc_divisor(n);
  ll ans = INF;
  for(int i = 0; i < a.size(); ++i){
    ll k1 = to_string(a[i].first).size();
    ll k2 = to_string(a[i].second).size();
    ll tmp = max(k1, k2);
    ans = min(ans, tmp);
  }
  cout << ans << endl;
}



Measured memory_bytes: 256
n=int(input())
AC=0
WA=0
TLE=0
RE=0
for i in range(n):
  x=str(input())
  if x=="AC":
    AC+=1
  elif x=="WA":
    WA+=1
  elif x=="TLE":
    TLE+=1
  elif x=="RE":
    RE+=1
print("AC x "+str(AC))
print("WA x "+str(WA))
print("TLE x "+str(TLE))
print("RE x "+str(RE))

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

namespace _0078
{
    public class Program

    {
        public static void Main(string[] args)
        {
            while (true)
            {
                int n = RInt();
                if (n == 0) break;

                int[,] map = new int[n, n];

                int x = n / 2;
                int y = n / 2 + 1;

                for (int i = 1 ; i <= Math.Pow(n, 2) ; i++)
                {
                    map[y, x] = i;
                    x = (x + 1) % n;
                    y = (y + 1) % n;
                    if (map[y, x] != 0)
                    {
                        x = (x + (n - 1)) % n;
                        y = (y + 1) % n;
                    }
                }

                for (int i = 0 ; i < n ; i++)
                {
                    for (int j = 0 ; j < n ; j++)
                    {
                        Console.Write(map[i, j].ToString().PadLeft(4));
                    }
                    Console.Write(Environment.NewLine);
                }
            }
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 15900
#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 998244353
#define INF 98765431219876543
#define bitcnt(a) (ll) __builtin_popcount((a))
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
using namespace std;

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

int main() {
  ll n;
  cin >> n;
  string mae = "-1";
  map<string, bool> m;
  REP(i, n) {
    string s;
    cin >> s;
    if (i) {
      if (s[0] != mae.back()) {

        return !printf("No\n");
      }
    }
    if (m[s]) {
      return !printf("No\n");
    }
    m[s] = 1;
    mae = s;
  }
  cout << "Yes" << endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<double> v(n);
    rep(i,n) cin>>v[i];
    sort(v.begin(),v.end());
    double ans = (v[0]+v[1])/2.0;
    for(int i = 2;i < n;i++){
        ans = (ans+v[i])/2.0;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#include <vector>
#include <queue>
#include <iomanip>
#include <string>
#include <algorithm>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep_1 (i,j,n) for(int i=j;i<n;i++)
typedef long long ll;
typedef long l;
const ll l_INF = 101010101000;
const int INF = 1010101010;
const int dx[4] = {-1,0,1,0};
const int dy[4] = {0,-1,0,1};
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;

int main(){
  string s,t;
  cin>>s>>t;
  int count=0;
  int l=s.size();
  rep(i,l){
    if(s[i]!=t[i]) count++;
  }
  cout << count;
}


Measured memory_bytes: 3916
#include <string.h>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <iterator>
#include <functional>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstdio>
using namespace std;
#define sz(a)  int((a).size())
#define all(a) a.begin(), a.end()
#define pb push_back
#define mp make_pair
#define CLR(a) memset((a), 0, sizeof(a))
#define INF (1 << 31) - 1
const int dh[8] = {-1, 1, 0, 0,1,1,-1,-1};
const int dw[8] = {0, 0, 1, -1,1,-1,1,-1};
typedef long long ll;
typedef pair<double, double> p;
typedef vector <int> VI;
typedef vector <string> VS;

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

  if((a <= c) && (c <= b)){
    cout << "Yes" << endl;  
  }else{
    cout << "No" << endl;
  }

	return 0;	
}


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

int main() {
  int K, N;
  cin >> K >> N;
  
  if(500*K >= N) cout << "Yes" << endl;
  else cout << "No" << endl;  

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int n, k; cin >> n >> k;
	long long num = 1;
	for (int i = 0; i < n; i++){
		if (i == 0)num *= k;
		else num *= k - 1;
	}
	cout << num << '\n';
	return 0;
}

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

using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vp vector<pair<int, int>>
#define vll vector<long long>
#define inf 1000000100
#define infll 1LL << 50

int main()
{
    int n;
    cin >> n;
    vi data(n+1);
    for(int i = 1; i <= n; ++i)
    {
        cin >> data[i];
    }

    for(int i = n; i >= 1; i -= 2)
    {
        cout << data[i] << " ";
    }

    int j = (n%2 == 0) ? 1 : 2;

    for(; j <= n; j += 2)
    {
        cout << data[j] << " ";
    }
    cout << endl;

}


Measured memory_bytes: 2944
fn main() {
    let n = read::<i64>();
    println!("{}",  q3(n, 100));
}

fn q3(mut n:i64, max: i32) -> String {
    let mut done = false;
    let mut i: i64 = 1;
    let mut vec: Vec<&str> = Vec::with_capacity(max as usize);
    while !done {
        match (n % (i*2).abs() == 0){
            true => vec.push("0"),
            false => {
                vec.push("1");
                n -= i;
            }
        }
        i = i * -2;
        if(n == 0){
            done = true;
        }
    }
    vec.reverse();
    return vec.join("");
}

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

Measured memory_bytes: 4352
n, x, m = map(int, input().split())
mn = min(n, m)
P = [] # value of pre & cycle
sum_p = 0 # sum of pre + cycle
X = [-1] * m # for cycle check
for i in range(mn):
    if X[x] > -1:
        cyc_len = len(P) - X[x]
        nxt_len = (n - X[x]) % cyc_len
        pre = sum(P[:X[x]])
        cyc = (sum_p - pre) * ((n - X[x]) // cyc_len)
        nxt = sum(P[X[x]: X[x] + nxt_len])
        print(pre + cyc + nxt)
        exit()
    X[x] = i
    P.append(x)
    sum_p += x
    x = x*x % m
print(sum_p)


Measured memory_bytes: 13476
h,w=map(int,input().split())
masu=[]
up=1
down=1
left=1
right=1
for i in range(h):
    masu.append([i for i in input()])
for i in range(h):
    for j in range(w):
        bakudan=0
        if masu[i][j]==".":
            if i==0:up=0
            if i==h-1:down=0
            if j==0:left=0
            if j==w-1:right=0
            if up:
                if masu[i-1][j]=="#":bakudan+=1
            if up and left:
                if masu[i-1][j-1]=="#":bakudan+=1
            if up and right:
                if masu[i-1][j+1]=="#":bakudan+=1
            if left:
                if masu[i][j-1]=="#":bakudan+=1
            if left and down:
                if masu[i+1][j-1]=="#":bakudan+=1
            if down:
                if masu[i+1][j]=="#":bakudan+=1
            if down and right:
                if masu[i+1][j+1]=="#":bakudan+=1
            if right:
                if masu[i][j+1]=="#":bakudan+=1
            masu[i][j]=str(bakudan)
        up=1
        down=1
        left=1
        right=1

for i in masu:
    s=''.join(i)
    print(s)

Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <string>
#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;

typedef long long  ll;
const int MAXN = 3333;
ll dp[MAXN][MAXN];
string s,t;
int n,m;
int main(){
    faster
    cin >> s >> t;
    n = (int)s.length(); m = (int)t.length();
    for(int i = 0;i < n;i++){
        for(int j = 0;j < m;j++){
            if(s[i] == t[j]) dp[i + 1][j + 1] = dp[i][j] + 1;
            else dp[i + 1][j + 1] = max(dp[i][j + 1], dp[i + 1][j]);
        }
    }
    int i = n - 1,j = m - 1;
    string ans = "";
    while(i >= 0 && j >= 0){
        if(s[i] == t[j]){
            ans = s[i] + ans;
            i--;j--;
        }
        else if(dp[i + 1][j + 1] == dp[i][j + 1]) i--;
        else j--;
    }
    cout << ans << endl;
}

    



Measured memory_bytes: 80256
#include <iostream>
using namespace std;
int main(void){
    string a;
    cin >> a;
    int n = 0;
    for(int i=0; i<4; i++){
        if(a[i] == '+'){
            n++;
        }
        else{
            n--;
        }
    }
    cout << n << endl;
}


Measured memory_bytes: 256
sx,sy,tx,ty=map(int,input().split())
dx,dy=tx-sx,ty-sy
print("U"*dy+"R"*dx+"D"*dy+"L"*dx,end="")
print("L"+"U"*(dy+1)+"R"*(dx+1)+"DR"+"D"*(dy+1)+"L"*(dx+1)+"U")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep1(i,s,e,c) for(int i=s;i<e;i=i+c)
#define rep2(i,s,e,c) for(int i=s;i<=e;i=i+c)
#define rep3(i,e,s,c) for(int i=e;i>=s;i=i-c)
using namespace std;
typedef long long ll;
const int MAX=1e5+1;
const int MOD=1e9+7;
int arr[MAX]={0};
int main()
{    
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;i++){
    	int l,r;
    	scanf("%d%d",&l,&r);
    	arr[l]+=1;
    	arr[r+1]-=1;
	}
	int sum=0,ans=0;
	for(int i=1;i<=n;i++){
		sum+=arr[i];
		if(sum==m)
			ans++;
	}
	cout<<ans<<"\n";
    return 0;
}

Measured memory_bytes: 640
nn = gets.to_i
aa = gets.split.map(&:to_i)
bb = gets.split.map(&:to_i)
cc = gets.split.map(&:to_i)

sum = 0
prev = 100

nn.times do |n|
  num = aa[n]
  sat = bb[num-1]
  sat += cc[prev-1] if prev+1==num
  sum += sat
  prev = num
end

puts sum

Measured memory_bytes: 1788
import java.io.*;
import java.util.*;

public class Main {
	static PrintWriter out;
	static StringBuilder sb;
	static long mod = 998244353;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		out = new PrintWriter(System.out);
		String s = sc.nextLine();
		Stack<Character> st = new Stack<>();
		Stack<Character> en = new Stack<>();
		boolean rev = false;
		int q = sc.nextInt();
		while (q-- > 0) {
			int x = sc.nextInt();
			if (x == 1)
				rev = !rev;
			else {
				int f = sc.nextInt();
				char c = sc.nextChar();
				if (f == 1) {
					if (rev) {
						en.push(c);
					} else {
						st.push(c);
					}
				} else {
					if (rev) {
						st.push(c);
					} else {
						en.push(c);
					}
				}
			}
		//	System.out.println(rev+" "+st+" "+en);
		}
		if (rev) {
			sb=new StringBuilder();
			while (!en.isEmpty())
				out.print(en.pop());
			out.print(sb.append(s).reverse());
			for(char k: st)
				out.print(k);
		} else {
			while (!st.isEmpty())
				out.print(st.pop());
			out.print(s);
			for(char k: en)
				out.print(k);
		}
		out.flush();
	}

	static long modPow(long a, long e)

	{
		long res = 1;
		while (e > 0) {
			if ((e & 1) == 1)
				res = (res * a) % mod;
			a = (a * a) % mod;
			e >>= 1;
		}
		return res;
	}

	static class Scanner {
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}

		public Scanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

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

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

		public char nextChar() throws IOException {
			return next().charAt(0);
		}

		public Long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public boolean ready() throws IOException {
			return br.ready();
		}

		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
}

Measured memory_bytes: 52432