akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm> 
#include <cmath>
//#include <bitset>
//#include <deque>
#include <iterator>
#include <map> 
//#include <queue>
//#include <stack>
#include <string>
#include <vector>
#include <array>
//#include <tuple>
#include <unordered_map>
//#include <unordered_set>

using namespace std;

typedef long long ll;
struct __{__(){ios_base::Init i;ios_base::sync_with_stdio(0);cin.tie(0);}}__; 

int n, m;
vector<vector<int>> v(8);
vector<bool> visited(8);

int dfs(int val, int count) {
	if (visited[val]) {
		return 0;
	}
	//cout << count << endl;
	if (count == n) {
		return 1;
	}
	visited[val] = 1;
	vector<bool> store = visited;
	int p = 0;
	for (auto x: v[val]) {
		p += dfs(x,count + 1);
		visited = store;
	}
	return p;
}


int main() {
	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		int x, y;
		cin >> x >> y;
		x--, y--;
		v[x].push_back(y);
		v[y].push_back(x);
	}
	cout << dfs(0,1);
} 











Measured memory_bytes: 3616
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define mpr make_pair
#define debug() puts("okkkkkkkk")
#define rep(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
 
using namespace std;
 
typedef long long LL;
#define int LL
 
const int inf = 1e9;
int a;
int s(int x){int r=0;while(x){r+=x%10;x/=10;}return r;}
int check(int x){for(int i=x+1;i<=x+10000;i++)if(x*s(i)>i*s(x))return 0;return 1;}
LL f[21];
signed main(){
	int n;scanf("%lld",&n);
	f[0]=1;for(int i=1;i<=18;i++)f[i]=f[i-1]*10ll;
	LL ans=1,cd=0;while(n--){
		printf("%lld\n",ans);
		if((ans+f[cd])*s(ans+f[cd]*2)>(ans+f[cd]*2)*s(ans+f[cd]))++cd;
		ans+=f[cd];
	}
 
	return 0;
}

Measured memory_bytes: 256
from math import gcd
n,k=map(int,input().split())
*a, =map(int,input().split())
a=sorted(a)
for i in range(len(a)):
  if i==0: tmp=a[0]
  else:
    tmp=gcd(tmp,a[i])
if k%tmp!=0 or max(a)<k:
  print("IMPOSSIBLE")
else: print("POSSIBLE")


Measured memory_bytes: 88476
#include <algorithm>
#include <deque>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;

int main() {
  ll A, B;
  cin >> A >> B;
  ll ans;
  if (A <= 5)
    ans = 0;
  else if (A < 13)
    ans = B / 2;
  else
    ans = B;
  cout << ans << endl;
  return 0;
}

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

int N, M, Q;
vector<long long> a, b, c, d;

long long dfs(vector<long long> & A) {

	if (A.size() == N){
		long long sum = 0;
		for (int i = 0; i < Q; i++) {
			if (A[b[i]] - A[a[i]] == c[i]) {
				sum += d[i];
			}
		}

		return sum;
	}

	long long res = 0;
	int prev_last = (A.empty() ? 0 : A.back());
	for (int i = prev_last; i < M; i++) {
		A.push_back(i);
		res = max(res, dfs(A));
		A.pop_back();
	}
	return res;
}

int main(void) {
	cin >> N >> M >> Q;
	a.resize(Q);
	b.resize(Q);
	c.resize(Q);
	d.resize(Q);

	for (int i = 0; i < Q; i++) {
		cin >> a[i] >> b[i] >> c[i] >> d[i];
		a[i]--; b[i]--;
	}

	vector<long long> T;
	cout << dfs(T) << endl;

	return 0;
}


Measured memory_bytes: 3600
fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim_right().to_owned()
}

fn evaluate(v: Vec<(String, u64)>) -> Vec<u64> {
    let mut dic = v.iter().enumerate().collect::<Vec<_>>();
    dic.sort_by(|&(_, a), &(_, b)| if a.0 == b.0 {
        b.1.cmp(&a.1)
    } else {
        a.0.cmp(&b.0)
    });
    dic.into_iter().map(|(i, _)| (i + 1) as u64).collect()
}

fn to_tuple(text: String) -> (String, u64) {
    let line: Vec<String> = text.split_whitespace().map(|s| s.to_owned()).collect();

    (
        line[0].to_owned(),
        line[1].to_owned().parse::<u64>().unwrap(),
    )
}

fn main() {
    let n: usize = read_line().parse().unwrap();
    let v: Vec<(String, u64)> = (0..n).map(|_| to_tuple(read_line())).collect();

    println!(
        "{}",
        evaluate(v)
            .iter()
            .map(|x| x.to_string())
            .collect::<Vec<_>>()
            .join("\n")
    );
}


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

int main() {
	int N, W;
	string s[55];
	string s_ans[55];

	cin >> N >> W;
	for (int i = 0; i < N; i++)cin >> s[i];

	for (int i = 0; i < N; i++) {
		for (int j = 0; j < W; j++) {
			if (s[i][j] == '#') {
				s_ans[i] += '#';
			}
			else {
				int counter = 0;
				int a[8] = { i,i + 1,i + 1,i + 1,i,i - 1,i - 1,i-1 };
				int b[8] = { j + 1,j + 1,j,j - 1,j - 1,j - 1,j,j + 1 };
				for (int l = 0; l < 8; l++) {
					if (a[l] >= 0 && a[l] < N && b[l] >= 0 &&b[l] < W) {
						if (s[a[l]][b[l]] == '#')counter++;
					}
				}
				s_ans[i] += to_string(counter);
			}
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < W; j++) {
			cout << s_ans[i][j];
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 256
N, K, C = map(int, input().split())
S = input()
L, R = [0]*N, [0]*N
i = 0
count = 1
while count <= K:
    if S[i] == 'x':
        i += 1
        continue
    L[i] = count
    count += 1
    i += C+1
i = N-1
count = K
while count > 0:
    if S[i] == 'x':
        i -= 1
        continue
    R[i] = count
    count -= 1
    i -= C+1
for i in range(N):
    if L[i] == 0:
        continue
    if L[i] == R[i]:
        print(i+1)

Measured memory_bytes: 20628
import java.util.Scanner;

public class Main {

    private static final Scanner SCANNER = new Scanner(System.in);

    public static void main(String[] args) {
        final String originalString = SCANNER.nextLine();
        int countOperations = SCANNER.nextInt();

        char[] characters = originalString.toCharArray();

        for (int indexLetter = 0; indexLetter < characters.length; ++indexLetter) {
            char letter = characters[indexLetter];
            if (indexLetter != characters.length - 1) {
                int requiredOperations = letter == 'a' ? 0 : 'z' - letter + 1;
                if (requiredOperations <= countOperations) {
                    characters[indexLetter] = push(letter, requiredOperations);
                    countOperations -= requiredOperations;
                }
            } else {
                characters[indexLetter] = push(letter, countOperations);
            }
        }
        System.out.println(String.valueOf(characters));
    }

    private static char push(char letter, int countOperations) {
        letter += countOperations % 26;
        return letter > 'z' ? (char) ('a' + letter - 'z' - 1) : letter;
    }
}


Measured memory_bytes: 14664
s = input()
n = len(s)

A = [""] * (n*2-1)
j = 0
for i in range(0, n*2-1, 2):
    A[i] = s[j]
    j += 1

ans = 0

for i in range(2**(n-1)):
    i_b = format(i, '0'+str(n-1)+'b')
    # print(i_b)
    B = A[:]
    j = 1
    for i in range(n-1):
        if i_b[i] == "1":
            B[j] = "+"
        j += 2
    # print("".join(B))
    ans += eval("".join(B))

print(ans)

Measured memory_bytes: 39280
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <vector>
#include <algorithm>

int main() {
        int ia, ib, ix;
        scanf("%d %d %d", &ia, &ib, &ix);

        double a = ia;
        double b = ib;
        double x = ix;

        double deg = atan(2.0 * (a * a * b - x) / (a * a * a));

        double div = atan(b / a);
        double deg2 = 0;
        if(deg > div) {
                deg2 = M_PI / 2.0 - atan(2.0 * x / (a * b * b));
                printf("%.10f", deg2 / M_PI * 180.0);
        } else {
                printf("%.10f", deg / M_PI * 180.0);
        }
}

Measured memory_bytes: 128
/*********************
    メモ化再帰で解いてみた
**********************/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
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;
}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define INF 999999999

    /*Solve*/

//dpテーブル
ll dp[100010];

//足場の高さ
int h[100010];

//再帰関数(recursion)
ll rec(int i){
    //戻り値
    ll res = INF;
    
    //dp[i]が更新されている場合はそのまま返す
    if(dp[i]<INF)return dp[i];
    
    //dp[0]=0
    if(i==0)return 0;
    
    //i-1,i-2からきた場合
    chmin(res,rec(i-1)+abs(h[i-1]-h[i]));
    if(i>1)chmin(res,rec(i-2)+abs(h[i-2]-h[i]));
    
    return dp[i] = res;
}

int main(){
    //入力
    int n;cin>>n;
    rep(i,n){cin >> h[i];dp[i] = INF;}
    
    //出力
    cout << rec(n-1) << endl;
}

Measured memory_bytes: 4480
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define IN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef long long ll;
//////////////////////////////////////////////////////
ll rupdiv(ll x,ll y){
	if (x % y == 0){
		return x/y;
	}else{
		return ((x/y) + 1);
	}
}

int main(){
	ll M,m;
	ll K; cin >> K;
	vector<ll> A;
	REP(i,K){
		ll x; cin >> x;
		A.PB(x);
	}
	

	m = 2; M = 2;
	
	for (ll i = K-1 ; i >= 0 ; i--){
		ll d,d1,d2;
		d = A[i];
		d1 = rupdiv(m,d) * d;
		d2 = (M/d) * d;
		
		if (d1 > M){
			PRINTD(-1); return 0;
		}
		
		m = d1;
		M = d2 + d - 1;
	}
	
	printf("%lld %lld\n",m,M);
	
	return 0;
}



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

using namespace std;

string S, T;

int sum1[100000 * 2 + 1000], sum2[100000 * 2 + 1000];

int main() {
	cin >> S >> T;
	int q;
	cin >> q;
	for (int i = 0; i < S.size(); i++) {
		sum1[i + 1] = sum1[i] + (S[i] == 'A' ? 1 : 2);
	}
	for (int i = 0; i < T.size(); i++) {
		sum2[i + 1] = sum2[i] + (T[i] == 'A' ? 1 : 2);
	}
	for (int i = 0; i < q; i++) {
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		a--, c--;
		if ((sum1[b] - sum1[a]) % 3 == (sum2[d] - sum2[c]) % 3) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1664
use proconio::input;

const MOD:isize = 998244353;
fn main() {
  input! {
    n: usize,
    k: usize,
    vals: [(usize, usize);k]
  }

  let mut dp: Vec<isize> = vec![0;n+1];
  let mut dp_sum: Vec<isize> = vec![0;n+1];
  dp[1] = 1;
  dp_sum[1] = 1;
  for i in 2..=n {
    for ii in 0..k {
      let (l, r) = vals[ii];
      let ri = if i <= l {
        continue
      } else {
        i - l
      };
      let li = if i <= r {
        0
      } else {
        i - r - 1
      };
      
      let mut v = (dp_sum[ri] - dp_sum[li]) % MOD;
      if v < 0 {
        v += MOD;
      }
      dp[i] += v;
      dp[i] %= MOD;
    }
    dp_sum[i] = (dp_sum[i-1] + dp[i]) % MOD;
  }
  println!("{}", dp[n]);
}

Measured memory_bytes: 5208
n,m = map(int,input().split())
a = [int(input()) for i in range(m)]
dp =[0,1] + [0] * n
m = 10**9+7
for i in a:
    dp[i+1] = -1
for i in range(2,n+2):
    if dp[i] == 0:
        dp[i] = max(0,dp[i-1]) + max(0,dp[i-2])
        dp[i] %= m
    if dp[i-1] == 0 and dp[i-2] == 0:
        print(0)
        exit()
print(dp[-1])

Measured memory_bytes: 50904
# include <bits/stdc++.h>
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++i)
# define rrep(i, n) for(int i=((int)(n)-1); i>=0; --i)
# define rreps(i, n) for(int i=((int)(n)); i>0; --i)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define optimize_cin() cin.tie(0); ios::sync_with_stdio(false)
using namespace std;
using ll = long long;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const long long INF = 1LL << 60;

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

uintmax_t combination(unsigned int n, unsigned int r) {
  if ( r * 2 > n ) r = n - r;
  uintmax_t dividend = 1;
  uintmax_t divisor  = 1;
  for ( unsigned int i = 1; i <= r; ++i ) {
    dividend *= (n-i+1);
    divisor  *= i;
  }
  return dividend / divisor;
}

int modPow(long long a, long long n, long long p) {
  if (n == 1) return a % p;
  if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
  long long t = modPow(a, n / 2, p);
  return (t * t) % p;
}

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

ll memo[1000010];

ll fib(ll x){
  if(x == 0) return 1;
  else if(x <= 2) return x;
  else if(memo[x] != 0) return memo[x];
  return memo[x] = fib(x-2) + fib(x-1);
}

ll five(ll x){
    return x*x*x*x*x;
}

int main()
{
  ll x;
  cin >> x;
  ll a,b;
  bool ans = false;

  for(int i = 0; i < 1000; i++){
      for(int j = -1000; j < 1000; j++){
          if(five(i) - five(j) == x){
              a = i;
              b = j;
              ans = true;
              break;
          }
      }
      if(ans) break;
  }

  cout << a << " " << b << endl;
  return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a.at(i);

	vector<int> s = a;
	sort(s.rbegin(), s.rend());

	rep(i, n){
		int ans = s.at(0);
		if(s.at(0) == a.at(i)) ans = s.at(1);
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 3200
#define _GLIBCXX_DEBUG
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
using namespace std;
typedef long long ll;
#define ALL(v) (v).begin(), (v).end()
const int mod = 1e9+7;

int main() {
    int H, W;
    cin >> H >> W;
    bool s[H][W];
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            s[i][j] = false;
        }
    }
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            char c;
            cin >> c;
            if (c == '#') s[i][j] = true;
        }
    }

    for (int i = 0; i < H; i++ ) {
        for (int j = 0; j < W; j++) {
            if (s[i][j] == true) {
                if (s[min(H, i+1)][j] == false && s[i][min(W, j+1)] == false &&
                    s[max(0, i-1)][j] == false && s[i][max(0, j-1)] == false) {

                    cout << "No" << endl;
                    return 0;
                }
            }
        }
    }

    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
using namespace std;

double xa, ya, xb, yb, xc, yc, xd, yd;

double n1(double x, double y){
    return ((xb-xd)*(y-yb)-(yb-yd)*(x-xb));
}

double n2(double x, double y){
    return ((xa-xc)*(y-ya)-(ya-yc)*(x-xa));
}

int main(){
    while( scanf("%lf,%lf,%lf,%lf,%lf,%lf,%lf,%lf",
                 &xa, &ya, &xb, &yb, &xc, &yc, &xd, &yd) != EOF ){
        double f1 = n1(xa, ya) * n1(xc, yc);
        double f2 = n2(xb, yb) * n2(xd, yd);
        if( f1 < 0 && f2 < 0 ){
            printf("YES\n");
        }else{
            printf("NO\n");
        }
    }
    return 0;
}

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

using namespace std;

int main(){
  	string a;
  	int ans = 0;
  	cin >> a;
  	if(a[0] == '1') ans++;
  	if(a[1] == '1') ans++;
  	if(a[2] == '1') ans++;
  	cout << ans << endl;
  	return 0;
}


Measured memory_bytes: 256
#include <queue>
#include<cstdio>
#include<algorithm>
#include<iostream>



using namespace std;

string S, T;
void input() {
	cin >> S >> T;
}

void solve() {
	T.pop_back();
	if (S == T)cout << "Yes" << endl;
	else cout << "No" << endl;
}

int main() {
	input();
	solve();
	return 0;
	
}






Measured memory_bytes: 3128
N, X, Y = map(int, input().split())
l = [0] * (N-1)
for i in range(1, N):
    for j in range(i+1, N+1):
        s = j -i
        if 0 < i < Y:
            ss = abs(j - Y) + abs(X - i) + 1 
            l[min(s, ss)-1] += 1
        elif i >= Y:
            l[s-1] += 1
for i in range(N-1):
    print(l[i])

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5,M=1e6+5,inf=0x3f3f3f3f,mod=1e9+7;
#define mst(a) memset(a,0,sizeof a)
#define lx x<<1
#define rx x<<1|1
#define reg register
#define PII pair<int,int>
#define fi first 
#define se second
string c[4]={"AC","WA","TLE","RE"};
int a[N];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	} 
	sort(a+1,a+n+1);
	ll ans=0;
	int cnt=0,f=0;
	for(int i=n;i>=1;i--){
		
		for(int j=(i==n)?1:0;j<2;j++){
			if(cnt==n-1) {
				f=1;
				break;
			}
			cnt++,ans+=a[i];
		}
		if(f) break;
	}
	printf("%lld\n",ans);
		return 0;
}

Measured memory_bytes: 4564
// Author : Chi
// created : 2020-05-28 12:00
// Sawal : https://www.codechef.com/problems/ECJAN20E

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

//namespaces
using    namespace __gnu_pbds;
using    namespace std;
typedef tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > ordered_set;

//macros
#define ll 		    long long
#define ss          second
#define ff          first
#define vi          vector<int>
#define vll         vector<long long>
#define pb(x)       push_back(x)
#define TEST  	    int TesT;cin>>TesT;while(TesT--)solve();
#define TEST1       solve();
#define mod         1000000007
#define r0n(i,n)    for(ll i = 0; i < n; ++i)
#define r1n(i,n)    for(ll i = 1; i <= n; ++i)
#define pdp(d,i)    fixed<<setprecision(i)<<d
#define CHI         ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define db(...)     __f(#__VA_ARGS__, __VA_ARGS__)                      //for debugging
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
int *a;
int n;
int G[100001];
int mex(set<int>s){
    int m=0;
    while(s.find(m)!=s.end())m++;
    return m;
}
int grundy(int k){
    if(k==0)
        return 0;
    if(G[k]!=-1)
        return G[k];
    set<int>s;
    r0n(i,n){
        if(k<a[i]<0)
            break;
        s.insert(grundy(k-a[i]));
    }
    return G[k]=mex(s);
}

void solve(){
    int n, k;
    cin>>n>>k;
    a=new int[n];
    r0n(i,n)
        cin>>a[i];
    sort(a,a+n);
    memset(G,0,sizeof G);
    r1n(i,k){
        r0n(j,n){
            if(i<a[j])
                break;
            G[i]|=(!(G[i-a[j]]));
            if(G[i])
                break;
        }
    }
    if(G[k])
        cout<<"First\n";
    else
        cout<<"Second\n";
}
// Driver Code
int main(){
    CHI
    TEST1
    return 0;
}



Measured memory_bytes: 640
N = int(input())
sp = {}
for i in range(1,N+1):
    s, p = input().split()
    p = int(p)
    if s in sp:
        sp[s].append((p,i))
    else:
        sp[s] = [(p,i)]

sp = sorted(sp.items(), key=lambda x:x[0])

for x in sp:
    s, v = x
    v.sort(key=lambda x:x[0], reverse=True)
    for p,i in v:
        print(i)

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


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    ll a,b,c;
    cin>>a>>b>>c;
    if(max(a,b)>=c) cout<<"No"<<endl;
    else if((4*a*b)<((c-a-b)*(c-a-b))) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


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

using ll = long long;
const ll MIN = -1e12 - 5;

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    for(ll& x : a) {
        cin >> x;
    }

    vector<vector<ll>> dp(n, vector<ll>(n, MIN));
    for(int i = n-1; i >= 0; i--) {
        for(int j = i; j < n; j++) {
            if(i == j) {
                dp[i][j] = a[i];
                continue;
            }
            dp[i][j] = max(a[i]-dp[i+1][j], a[j]-dp[i][j-1]);
        }
    }
    cout << dp[0][n-1] << endl;
}


Measured memory_bytes: 70784
#include <bits/stdc++.h>
     
        using namespace std;
        #define sd(x) scanf("%d",&x);
        #define sdl(x) scanf("%lld",&x);
        #define pr(x) printf("%d\n",x);
        #define prl(x) printf("%lld\n",x);
long long dp[2001][2001];

    bool comp(pair<int,int>a,pair<int,int>b)
    {
        return a.first>b.first;   
    }
    void solve()
    {
        int n;cin >> n;
        vector<pair<int,int>>arr;
        for (int c=0;c<n;c++)
            {int a;cin >> a;arr.push_back(make_pair(a,c));}
        sort(arr.begin(),arr.end(),comp);

        dp[0][0]=1LL*arr[0].first*(n-1-arr[0].second);
        dp[0][1]=1LL*arr[0].first*arr[0].second;
        for (int c=1;c<n;c++)
            for (int c1=0;c1<=c+1;c1++)
                {
                    
                    if (c1<=c)
                        dp[c][c1]=dp[c-1][c1]+1LL*arr[c].first*abs(n-1-(c-c1)-arr[c].second);
                    if (c1!=0)
                        dp[c][c1]=max(dp[c][c1],dp[c-1][c1-1]+1LL*arr[c].first*abs(arr[c].second-(c1-1)));

                }
        long long maxi=-1;
        for (int c=0;c<n;c++)
            maxi=max(maxi,dp[n-1][c]);
        
      
        cout << maxi << endl;
            
        
            
        
    }

    int main ()
    {
      
     int t;
     //cin >> t;
     t=1;

     for (int tt=1;tt<=t;tt++)
     {
         solve();
     }

    return 0;
     
     
     
     
        }


Measured memory_bytes: 26228
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S; cin >> S;
    bool ans = false;
    for(int i = 0; i < 3; i++){
        if(S[i] == '7') {
            ans = true;
            break;
        }
    }
    if(ans) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define REP2(i,x,n) for (int i = x; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);
static const int INF = 1e9+7;
//debug 
#ifdef _DEBUG
#define debug(var)  do{cout << #var << " :";view(var);}while(0)
#else
#define debug(...)
#endif
template<typename T> void view(T e){cout << e << endl;}
template<typename T> void view(const vector<T>& v){for(const auto& e : v){ cout << e << " "; } cout << endl;}
template<typename T> void view(const vector<vector<T> >& vv){ for(const auto& v : vv){ view(v); } }

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 1000000007;
//const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

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


int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  REP(i,n) cin >> a[i];
  ll sum = 0;
  REP(i,n) sum += a[i];
  
  mint ans = 0;
  REP(i,n-1){
    sum -=a[i];
    ans += a[i] * (sum%mod);
  }

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

Measured memory_bytes: 4832
#include<bits/stdc++.h>
#define ll long long 
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
signed main(){
  ll a,b,c=1,d=1;
  cin>>a>>b;
  if(a==1 && b==1){
    cout<<"0\n";
  }else{
    for(ll i=1;i<a;i++){
     c += i;
    }
    for(ll i=1;i<b;i++){
     d += i;
    }
    cout<<c+d-2<<"\n";
  }
}


Measured memory_bytes: 256
n = 0
a = []

def format_input(filename = None):
	global n
	global a
	if filename == None:
		n = map(int, input().split())
		a = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		n = rng(1, 10**2)
		a = [rng(1, 10**3) for i in range(n)]

def get_answer():
	check = 'APPROVED'
	for i in a:
		if i % 2 == 0 and (i % 3 != 0 and i % 5 != 0):
			check = 'DENIED'
	return check

if __name__ == '__main__':
	format_input()

	ans = get_answer()
	print(ans)

Measured memory_bytes: 3064
#include <stdio.h>

int main(void) {

  int h,w;
  scanf("%d %d", &h, &w);
  char s[h][w+1];
  for (int i = 0; i < h; i++) {
    scanf("%s", s[i]);
  }
  int left[h][w],right[h][w],up[h][w],down[h][w];
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      left[i][j] = 0;
      right[i][j] = 0;
      up[i][j] = 0;
      down[i][j] = 0;
    }
  }
  for (int i = 0; i < h; i++) {
    for (int j = 1; j < w; j++) {
      if (s[i][j-1] == '.' && s[i][j] == '.') {
        left[i][j] = left[i][j-1]+1;
      }
    }
    for (int j = w-2; j >= 0; j--) {
      if (s[i][j+1] == '.' && s[i][j] == '.') {
        right[i][j] = right[i][j+1]+1;
      }
    }
  }
  for (int j = 0; j < w; j++) {
    for (int i = 1; i < h; i++) {
      if (s[i-1][j] == '.' && s[i][j] == '.') {
        up[i][j] = up[i-1][j]+1;
      }
    }
    for (int i = h-2; i >= 0; i--) {
      if (s[i+1][j] == '.' && s[i][j] == '.') {
        down[i][j] = down[i+1][j]+1;
      }
    }
  }
  int max = 0;
  int light;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      light = left[i][j]+right[i][j]+up[i][j]+down[i][j]+1;
      if (light > max) {
        max = light;
      }
    }
  }
  printf("%d\n", max);

  return 0;
}

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

int main(){
  string s;
  
  cin>>s;
  
  int k, l, m, n;
  
  int N = s.length();
  k = 0;
  l = 0;
  m = 0;
  
  while(k < N){
    if(s[k] == 'A' || s[k] == 'T' || s[k] == 'G' || s[k] == 'C'){
      l += 1;
      k += 1;
      if(l > m){
        m = l;
      }
    }
    else{
      l = 0;
      k += 1;
    }
  }
  
  cout << m << endl;
  return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<pair<int,int>> a(n+1);
  vector<int> ans(n);
  int b;
  for (int i = 1;i <= n;i++){
    cin >> b;
    a[i] = make_pair(b,i); 
  }
  sort(a.begin(),a.end());
  for (int i = 1;i <= n;i++) cout << a[i].second << " ";
  cout << endl;
}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

const int N = 2e5+23;
const int mod = 1e9+7;

int a[N];

long long binpow(long long b, long long e) {
  if (!e) return 1;
  if (e&1) return b*binpow(b, e-1)%mod;
  return binpow(b*b%mod, e/2);
}

void solve() {
  int n, k; scanf("%d%d", &n, &k);
  int z = 0;
  long long ans = 1;
  for (int i = 0; i < n; ++i) {
    scanf("%d", a+i);
    if (!a[i]) ++z;
  }
  if (n-z < k) {
    puts("0");
    return;
  }
  if (k == n) {
    for (int i = 0; i < n; ++i) {
      ans = (ans * a[i]) % mod;
    }
    printf("%lld", (ans+mod)%mod);
    return;
  }
  sort(a, a+n);
  if (a[n-1] <= 0 && k%2) {
    if (z) {
      puts("0");
    } else {
      for (int i = n-1; i >= 0 && k; --i) {
	if (a[i] == 0) continue;
	ans = (ans * a[i]) % mod;
	--k;
      }
      printf("%lld", (ans+mod)%mod);
    }
    return;
  }
  if (a[0] >= 0) {
    for (int i = n-1; i >= 0 && k; --i) {
      ans = (ans * a[i]) % mod;
      --k;
    }
    printf("%lld", (ans+mod)%mod);
    return;
  }
  vector<long long> negs, poss;
  for (int i = 0; i < n; ++i) {
    if (a[i] < 0) {
      negs.push_back(a[i]);
    } else if (a[i] > 0) {
      poss.push_back(a[i]);
    }
  }
  sort(negs.begin(), negs.end());
  sort(poss.begin(), poss.end(), greater<long long>());
  int i = 0, j = 0;
  while (k > 0) {
    debug(i);
    debug(j);
    debug(negs.size());
    debug(poss.size());
    if (i < negs.size() && j < poss.size()) {
      if (k > 1) {
	if (i < negs.size()-1) {
	  if (j < poss.size()-1) {
	    if (negs[i]*negs[i+1] > poss[j]*poss[j+1]) {
	      ans = ans * negs[i] % mod * negs[i+1] % mod;
	      i += 2;
	    } else {
	      ans = ans * poss[j] % mod * poss[j+1] % mod;
	      j += 2;
	    }
	    k -= 2;
	  } else {
	    if (negs[i]*negs[i+1] > poss[j]) {
	      ans = ans * negs[i] % mod * negs[i+1] % mod;
	      i += 2;
	      k -= 2;
	    } else {
	      ans = ans * poss[j++] % mod;
	      --k;
	    }
	  }
	} else {
	  ans = ans * poss[j++] % mod;
	  --k;
	}
      } else {
	if (i < negs.size()-1 && j > 0 && negs[i]*negs[i+1] > poss[j]*poss[j-1]) {
	  ans = ans * negs[i] % mod * negs[i+1] % mod;
	  ans = ans * binpow(poss[--j], mod-2) % mod;
	  i += 2;
	} else {
	  ans = ans * poss[j++] % mod;
	}
	--k;
      }
    } else if (i < negs.size()-1) {
      if (k != 1) {
	ans = ans * negs[i] % mod * negs[i+1] % mod;
	i += 2;
	k -= 2;
      } else {
	ans = ans * negs[i] % mod * negs[i+1] % mod;
	ans = ans * binpow(poss[--j], mod-2) % mod;
	i += 2;
	--k;
      }
    } else {
      ans = ans * poss[j++] % mod;
      --k;
    }
  }
  printf("%lld", ans);
}

int main() {
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 6328
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) REP(i, 0, n)
#define REP(i, s, e) for(int i = (s); i < (int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i = (int)(s - 1); i >= (int)(e); i--)
#define pb push_back
#define all(r) r.begin(), r.end()
#define rall(r) r.rbegin(), r.rend()
#define fi first
#define se second

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double EPS = 1e-8;

template <typename T> T chmax(T &a, const T &b) { return a = (a > b ? a : b); }
template <typename T> T chmin(T &a, const T &b) { return a = (a < b ? a : b); }

template <typename T, typename U> T pow_fast(T x, U n) {
    T ret = (T)1;
    while(n) {
        if(n & (U)1) ret *= x;
        x *= x;
        n >>= 1;
    }
    return ret;
}

template <typename ModType, ModType MOD> struct ModInt {
    ModType val;
    ModInt() : val(0) {}
    ModInt(ModType x) : val(x % MOD) {
        if(val < 0) val += MOD;
    };
    operator ModType() const { return val; }
    ModInt &operator+=(const ModInt &m) {
        val += m.val;
        if(val >= MOD) val -= MOD;
        return *this;
    }
    ModInt &operator-=(const ModInt &m) {
        val -= m.val;
        if(val < 0) val += MOD;
        return *this;
    }
    ModInt &operator*=(const ModInt &m) {
        (val *= m.val) %= MOD;
        return *this;
    }
    ModInt &operator/=(const ModInt &m) {
        *this *= m.inverse();
        return *this;
    }
    ModInt operator+(const ModInt &m) const { return ModInt(*this) += m; }
    ModInt operator-(const ModInt &m) const { return ModInt(*this) -= m; }
    ModInt operator*(const ModInt &m) const { return ModInt(*this) *= m; }
    ModInt operator/(const ModInt &m) const { return ModInt(*this) /= m; }
    ModInt inverse() const { return pow_fast(*this, MOD - 2); }

    friend std::ostream &operator<<(std::ostream &os, const ModInt &rhs) {
        os << rhs.val;
        return os;
    }
    friend std::istream &operator>>(std::istream &is, ModInt &rhs) {
        ModType value;
        is >> value;
        rhs = ModInt(value);
        return is;
    }
};

int main() {
    string s;
    cin >> s;
    int n = s.size();
    using mint = ModInt<ll, MOD>;
    vector<vector<mint>> dp(n + 1, vector<mint>(2, 0));
    // reverse(all(s));
    // assert(s[0] == '1');
    dp[0][1] = 2; // [0, 1], [1, 0]
    dp[0][0] = 1; // [0, 0]
    // dumpVL(s);
    REP(i, 1, n) {
        if(s[i] == '0') {
            // x[i] = 0 -> (a, b) = (0, 0)
            dp[i][1] = dp[i - 1][1];
            dp[i][0] = dp[i - 1][0] * (mint)3;
            // LINE;
        } else {
            // x[i] = 1 -> (a, b) = (0, 1), (1, 0)
            dp[i][1] = dp[i - 1][1] * (mint)2;
            dp[i][0] = dp[i - 1][1];
            dp[i][0] += dp[i - 1][0] * (mint)3;
        }
    }
    cout << dp[n - 1][0] + dp[n - 1][1]<< endl;

    // rep(i, n) {
    //     cout << dp[i][0] << " " << dp[i][1] << endl;
    // }
    return 0;
}

Measured memory_bytes: 5760
ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()
alis = []
for _ in range(n):
    ima = ii()
    ima *= -1
    alis.append(ima)

from bisect import bisect_left as bl
'''index  =  bl(list,num)'''

imaa = [1]*n
for i in range(n):
    index = bl(imaa,alis[i]+1)
    imaa[index] = alis[i]
index = bl(imaa,1)
print(index)



Measured memory_bytes: 7844
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n;cin>>n;
  V<int> r(n+1,0),g=r,b=r;
  string s;cin>>s;
  rep(i,0,n){
    if(s[i]=='R')r[i+1]++;
    else if(s[i]=='G')g[i+1]++;
    else b[i+1]++;
  }

  rep(i,1,n+1){
    r[i]+=r[i-1];
    b[i]+=b[i-1];
    g[i]+=g[i-1];

  }

  ll ans=0;
  rep(i,1,n-1){
    rep(j,i+1,n){
      if(s[i]==s[j])continue;

      if(s[i]!='R' && s[j]!='R' ){
        ans+=r[i];
        if(2*i-j>=0 && s[i-(j-i)]=='R')ans--;
      }
      else if(s[i]!='G' && s[j]!='G' ){
        ans+=g[i];
        if(2*i-j>=0 && s[i-(j-i)]=='G')ans--;
      }
      else if(s[i]!='B' && s[j]!='B' ){
        ans+=b[i];
        if(2*i-j>=0 && s[i-(j-i)]=='B')ans--;
      }
    }
  }
  cout<<ans<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

Measured memory_bytes: 3672
void main(){
	int[] hen = _scanln();
	(hen[0]*hen[1]/2).writeln();
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


Measured memory_bytes: 2728
# -*- coding: utf-8 -*-
n = int(input())
hl = list(map(int, input().split()))

res = 0

for i in range(n):
    if hl[i]==0:
        continue

    while hl[i]>0:
        res += 1
        for j in range(i,n):
            if hl[j]==0:
                break
            hl[j] -= 1

print(res)


Measured memory_bytes: 2940
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

#define int long long
#define MOD7 1000000007
#define MOD9 1000000009

#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(a) (a).begin(), (a).end()

using namespace std;

int nextInt() {int a; cin >> a; return a;}
char nextChar() {char a; cin >> a; return a;}
double nextDouble() {double a; cin >> a; return a;}
string nextString() {string a; cin >> a; return a;}

void inputVector(vector<int> &v, int &n) {rep(i,n){v.push_back(nextInt());}}
void inputVector(vector<double> &v, int &n) {rep(i,n){v.push_back(nextDouble());}}
void inputVector(vector<string> &v, int &n) {rep(i,n){v.push_back(nextString());}}

int dp[52][52][2560];

signed main() {
	int N, A;
	cin >> N >> A;

	vector<int> x;
	inputVector(x, N);

	dp[0][0][0] = 1;
	for (int i = 1; i <= N; i++) {
		for (int j = 0; j <= 50; j++) {
			for (int k = 0; k <= 2500; k++) {
				int tmp = dp[i - 1][j][k];
				dp[i][j][k] += tmp;
				dp[i][j + 1][k + x[i - 1]] += tmp;
			}
		}
	}

	int ret = 0;
	for (int j = 0; j <= 50; j++) {
		for (int k = 0; k <= 2500; k++) {
			if (k == A * j) {
				ret += dp[N][j][k];
			}
		}
	}

	cout << ret - 1 << endl;

    return 0;
}


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


auto exec() {
	int s;
	std::cin >> s;

	
	while (
		!(s % 10 == (s / 10) % 10
			&& s % 10 == (s / 100))
		) {
		s++;
	}

	std::cout << s << "\n";
	
}

int main() {
//	while (true) {
		exec();
	//}
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <float.h>
#include <stdlib.h>
#include <functional>
using namespace std;
int main(){
    long long n,k,a,ans;
    cin >> n >> k;
    a=n/k;
    ans=n-a*k;
    long long ansd=abs(ans-k);
    ans=min(ans,ansd);
    cout << ans;
    }




Measured memory_bytes: 256
s = input()
t = input()

def f(s, t):
  l = "?"*len(t)
  found = False
  # if l in s:
  #   print('done')
  for i in range(len(s)-len(t)+1):
    temp = s[len(s)-len(t)-i:len(s)-i]
    count = 0
    for j in range(len(temp)):
      if t[j] == temp[j] or temp[j] == "?":
        count += 1
    if count == len(t):
      s = list(s)
      s[len(s)-len(t)-i:len(s)-i] = t
      for k in range(len(s)):
        if s[k] == "?":
          s[k] = "a"
      return "".join(s)
  return "UNRESTORABLE"
print(f(s, t))

Measured memory_bytes: 3188
#include<stdio.h>

int main(void){

	int x,y;

	while(1){

		scanf("%d %d",&x,&y);
		if( x==0 && y==0 )
			break;

		if( x<y )
			printf("%d %d\n",x,y);
		else 
			printf("%d %d\n",y,x);

	}

	return 0;

}

Measured memory_bytes: 600
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char a1,a2,a3,b1,b2,b3;
    cin>>a1>>a2>>a3>>b1>>b2>>b3;
    if(a1==b3&&a2==b2&&a3==b1)
    cout<<"YES"<<endl;
    else
    cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))

x = a[-1]
i = -1

for j in range(len(a)-1):
    if a[j] <= x:
        i += 1
        a[i], a[j] = a[j], a[i]

a[i + 1], a[n - 1] = "[" + str(a[n - 1]) + "]", a[i + 1]

print(*a)

Measured memory_bytes: 18152
n = int(input())
la = list(map(int, input().split()))

bb = 0
left = 0

for i in range(n):
    j = 0
    for j in range(left, n):
        # print(j)
        if la[j] == i+1:
            left = j + 1
            break
        else:
            bb += 1
    if j == n-1:
        break

if bb > n-1:
    print(-1)
else:
    print(bb)


Measured memory_bytes: 24744
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back
#define eb emplace_back
#define mod   998244353
#define PI 2*acos(0.0)
#define dbg(a) cout<<#a<<" ->->->-> "<<a<<"\n"
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};

ll bigmod(ll x, ll p)
{
    ll res = 1;
    while(p)
    {
        if(p&1)
            res = (res*x)%mod;
        x = (x*x)%mod;
        p >>= 1;
    }
    return res;
}

//=============================================ASIFAZAD==============================================//


int32_t main()
{
    io;
    int n, x, y;
    cin>>n>>x>>y;
    vi cnt(n);

    for(int i = 1; i<= n; i++)
        for(int j = i+1; j <= n; j++)
            cnt[min(j-i, abs(i-x) + 1+ abs(y-j))]++;
    for(int i =1; i<= n-1; i++)
        cout<<cnt[i] <<"\n";
    return 0;
}


Measured memory_bytes: 3616
import java.util.Scanner;
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int ans = a * b / 2;
        System.out.println(ans);
    }
}


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

/* */

int main(){
    // 入力スタンダード
    int s, w;
    cin >> s >> w;

    if(s>w){
        cout << "safe" << endl;
    } else {
        cout << "unsafe" <<endl;
    }

return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdio>
#include <functional>
using namespace std; 
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
const int INF = (((1<<30)-1)<<1)+1;
const int nINF = 1<<31;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<char, int> pci;

/////////////////////////////////////////////////////////////////////
const int N  = 2e5+1;
ll n, a[N], p[N];

ll choose2(ll k) {
	return (k*(k-1))/2;
}

int main() {
    ios::sync_with_stdio(false);
    //cout << fixed << setprecision(7);
    cin >> n;
    FOR(i, 1, n) cin >> a[i];
    p[0] = 0;
    FOR(i, 1, n) p[i] = p[i-1]+a[i];
    map<ll, ll> m;
    FOR(i, 0, n) m[p[i]]++;
    ll ans = 0;
    for(auto& pr : m) ans += choose2(pr.second);
    // FOR(i, 0, n) cout << p[i] << ' ';
    // cout << endl;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 15872
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef pair<int,int> P;
//int const INF=1001001001;
ll const INF=1001001001001001001;
ll const MOD=1000000007;

ll N;

int main(){
    cin>>N;

    ll num=0;
    repn(i,N){
        if(N<=i*(i+1)/2){
            num=i;
            break;
        }
    }
    
    repn(i,num){
        if(i==num*(num+1)/2-N) continue;
        cout<<i<<endl;
    }
}

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

int prime[100005];
bool is_prime[100005];

int sieve(int n) {
    int p = 0;
    for (int i = 0; i <= n; i++) is_prime[i] = true;
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= n; i++) {
        if (is_prime[i]) for (int j = 2 * i; j <= n; j += i) is_prime[j] = false;
        if (is_prime[i] && is_prime[(i+1)/2]) prime[p++] = i;
    }
    return p;
}

int main() {
    int Q, r, l;
    scanf("%d", &Q);
    int n = sieve(100000);
    for (int i = 0; i < Q; i++) {
        scanf("%d %d", &l, &r);
        int ans = upper_bound(prime, prime + n, r) - lower_bound(prime, prime + n, l);
        printf("%d\n", ans);
    }
    return 0;
}

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

int main(void){
    int a, b, c, d, ans=0;
    cin >> a >> b >> c >> d;
    if(a>=b) ans+=b;
    else ans+=a;
    if(c>=d) ans+=d;
    else ans+=c;
    cout << ans << endl;
}

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

const int MAX_D = 210;
const int MAX_N = 210;
const int MAX_Ci = 110;
int t[MAX_D];
int a[MAX_N], b[MAX_N], c[MAX_N];
int dp[MAX_D][MAX_Ci];	// ??\??????????????????????´???????

int d, n;

int func(int day, int before){
	if(day >= d) return 0;
	if(dp[day][before] >= 0) return dp[day][before];
	int res = 0;
	for(int i = 0; i < n; ++i){
		if(a[i] <= t[day] && t[day] <= b[i]){
			int score = before - c[i];
			if(score < 0) score = -score;
			res = max(res, score + func(day + 1, c[i]));
		}
	}
	return dp[day][before] = res;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> d >> n;	
	
	for(int i = 0; i <= d; ++i){
		for(int j = 0; j <= MAX_Ci; ++j){
			dp[i][j] = -1;
		}
	}

	
	for(int i = 0; i < d; ++i){
		cin >> t[i];
	}
	
	for(int i = 0; i < n; ++i){
		cin >> a[i] >> b[i] >> c[i];
	}
	
	int ans = 0;
	for(int i = 0; i < n; ++i){
		if(a[i] <= t[0] && t[0] <= b[i])
			ans = max(ans, func(1, c[i]));
	}
	
	cout << ans << endl;
	//cout << func(0, 0) << endl;
	
	return 0;
}

Measured memory_bytes: 1296
#include <stdio.h>
#include <stdlib.h>//random,NULL
#include <string.h>
#include <time.h>
#include <unistd.h>//sleep()
#include <math.h>
#include <stdbool.h>

#define rep(i,n) for(int i=0; i<((int)n); i++)
#define REP(i,n) for(int i=0; i<=((int)n); i++)
#define srep(i,a,n) for(int i=a; i<((int)n); i++)
#define SREP(i,a,n) for(int i=a; i<=((int)n); i++)
#define rrep(i,n) for(int i=n-1; i>=0; i--)
#define RREP(i,n) for(int i=n; i>=0; i--)
#define INF 1000000000
const int mod = INF+7;

int main(){
  char buf[1024];
  int K,X;

  fgets(buf,sizeof(buf),stdin);
  sscanf(buf, "%d %d", &K, &X);

  srep(i, -1000000, 1000001){
    if(abs(i-X)<K){
      printf("%d ", i);
    }
  }
  printf("\n");

  return 0;

}


Measured memory_bytes: 128
#include <stdio.h>
int main() {
    int a,b;
    scanf("%d %d",&a,&b);
    if(a==1)
        a=14;
    if(b==1)
        b=14;
    if(a>b)
        printf("Alice\n");
    else if(b>a)
        printf("Bob\n");        
    else
        printf("Draw\n");
    return 0;
}

Measured memory_bytes: 128
#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 N;
  cin >> N;
  vector<int> a(N);
  rep(i,N) cin >> a[i];

  int S = 0;
  rep(i,N) S ^= a[i];
  vector<int> b(N);
  rep(i,N) b[i] = S ^ a[i];
  rep(i,N-1) cout << b[i] << " ";
  cout << b[N-1] << endl;;
  return 0;
}

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

int main(){
	int n, m, ac = 0, pn = 0;
	int p;
	string s;
	cin >> n >> m;
	vector<int> vp(n, 0);
	vector<bool> vb(n, false);
	for(int i = 0; i < m; i++){
		cin >> p >> s;
		p--;
		if(s == "AC" && vb.at(p) == false){
			ac++;
			pn += vp.at(p);
			vb.at(p) = true;
		}else if(s == "WA"){
			vp.at(p)++;
		}
	}
	cout << ac << " " << pn << endl;
	
	return 0;
	
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
 
int main()
{
  int n,l;
  cin >> n >> l;
  int taste_abs[n];
  int total = 0;
  REP(i,n){
    total += l+i;
    taste_abs[i] = abs(l+i);
  }
  sort(taste_abs,taste_abs+n);
  if(l>=0) cout << total-taste_abs[0] << endl;
  else cout << total+taste_abs[0] << endl;
}

Measured memory_bytes: 256