akhauriyash/Code-Regression huggingface dataset:
/*
Though leaves are many , the root is one.
Through all the lying days of my youth
I swayed my leaves and flowers in the sun.
Now I may wither into the truth.
	  	  	- William Butler Yeats
*/
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
#pragma comment("-Wl,--stack=1024000000")
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=1000000007;
typedef long long ll;
#ifndef LOCAL
#define cerr if(0)cout
#define eprintf(...) 0
#else
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#endif
inline string getstr(string &s,int l,int r){string ret="";for(int i=l;i<=r;i++)ret.push_back(s[i]);return ret;}
int modpow(int x,int y,int md=mod){int ret=1;do{if(y&1)ret=(ll)ret*x%md;x=(ll)x*x%md;}while(y>>=1);return ret;}
inline int Rand(){return rand()*32768+rand();}
int n,m,dp[303][303][303],vis[303][303][303];
vector<pair<int,int> >g[303];
inline void add(int &x,int y){
	x+=y;if(x>=mod)x-=mod;
}
bool valid(int x,int y,int z){
	int cur=max(x,max(y,z));
	for(auto p:g[cur]){
		int tmp=(x>=p.first)+(y>=p.first)+(z>=p.first);
		if(tmp!=p.second)return false;
	}
	return true;
}
void update(int x,int y,int z){
	if(vis[x][y][z])return;
	vis[x][y][z]=1;
	if(!valid(x,y,z))return;
	int cur=max(x,max(y,z))+1;
	add(dp[cur][y][z],dp[x][y][z]);
	add(dp[x][cur][z],dp[x][y][z]);
	add(dp[x][y][cur],dp[x][y][z]);
}
int main(){
	cin>>n>>m;
	for(int i=1;i<=m;i++){
		int l,r,x;
		cin>>l>>r>>x;
		g[r].push_back(make_pair(l,x));
	}
	dp[1][0][0]=dp[0][1][0]=dp[0][0][1]=1;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=i;j++){
			for(int k=0;k<=j;k++){
				update(i,j,k);
				update(i,k,j);
				update(j,i,k);
				update(j,k,i);
				update(k,i,j);
				update(k,j,i);
			}
		}
	}
	int ans=0;
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			for(int k=0;k<=n;k++){
				if(max(i,max(j,k))==n&&valid(i,j,k)){
					add(ans,dp[i][j][k]);
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 219868
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <stdlib.h>
#include <algorithm>
#include <functional>
 
using namespace std;
 
int main(void) {
    unsigned long int N = 0, count = 0;
    cin >> N;
    if(N % 2 == 0){
        count = N / 2;
    }else{
        count = N / 2 + 1;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 256
k = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

n = int(input())

print(k[n-1])

Measured memory_bytes: 3060
#include <stdio.h>

int main(void) 

{

	int a,b;
	
	scanf("%d %d",&a,&b);
	
	if (a<b)
	
	{
		
		printf("a < b\n");
	}
	
	else if(a>b)
	
	{
		
		printf("a > b\n");
	}
	
	else if(a==b)
	
	{
		
		printf("a == b\n");
	}
	return 0;
}

Measured memory_bytes: 580
from collections import deque
import sys
sys.setrecursionlimit(10**7)

N = int(input())
P = list(map(int,input().split()))

Q = [-1]*N
for i,p in enumerate(P):
    Q[p-1] = i

S = ''
a = 1
def rec(l,r):
    global S,a
    if l==r:
        return
    while l < r:
        ai = Q[a-1]
        if ai >= r:
            print(':(')
            exit()
        a += 1
        S += '('
        rec(l,ai)
        S += ')'
        l = ai + 1
rec(0,N)

print(S)



Measured memory_bytes: 16572
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)

#define yes puts("Yes")
#define no puts("No")
#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

inline void io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?" ":"");return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

int k;
vi v(2);

signed main(){
    io();

    in(v,k);
    rep(i,k){
        if(v[i%2]&1){
            v[i%2]--;
        }
        v[i%2]/=2;
        v[(i+1)%2]+=v[i%2];
    }
    out(v);

    return 0;
}


Measured memory_bytes: 888
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

def solve(n: int):
    def is_valid(i, j, k, l):
        if ((j == 0 and k == 1 and l == 2) or
            (j == 0 and k == 2 and l == 1) or
            (j == 2 and k == 0 and l == 1) or
            (i == 0 and k == 2 and l == 1) or
            (i == 0 and j == 2 and l == 1)):
            return False
        return True
    dp = [[[1] * 4 for _ in range(4)] for _ in range(4)]
    dp[0][1][2] = 0
    dp[0][2][1] = 0
    dp[2][0][1] = 0
    for i in range(3, n):
        next_dp = [[[0] * 4 for _ in range(4)] for _ in range(4)]
        for i in range(4):
            for j in range(4):
                for k in range(4):
                    for l in range(4):
                        if is_valid(i, j, k, l):
                            next_dp[j][k][l] += dp[i][j][k]
        dp = next_dp
    ret = sum([sum([sum(e) for e in d ]) for d in dp]) % MOD

    print(ret)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
N, K = map(int, input().split())

mod = 998244353

dp = [0] * N
dp[0] = 1

LR = [list(map(int, input().split())) for i in range(K)]
X = [0] * K

for i in range(1, N):
  for j in range(K):
    if i - LR[j][0] >= 0:
      X[j] += dp[i - LR[j][0]]
    if i - LR[j][1] > 0:
      X[j] -= dp[i - LR[j][1] - 1]
    X[j] %= mod
  dp[i] = sum(X) % mod
print(dp[-1])
    

Measured memory_bytes: 75684
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};
use std::collections::BinaryHeap;

use std::cmp::Ordering;
#[derive(Debug, PartialEq, Eq)]
struct State(usize, usize);

impl Ord for State {
    fn cmp(&self, other: &Self) -> Ordering {
        self.1.cmp(&other.1)
    }
}

impl PartialOrd for State {
    fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
        Some(self.cmp(other))
    }
}

fn main() {
    input!{
        n: usize,
        a: [usize; n],
        mut b: [usize; n]
    }
    let mut pq = BinaryHeap::new();
    for i in 0..n {
        if b[i] >= b[(i + n - 1) % n] + b[(i + 1) % n] + a[i] {
            pq.push(State(i, b[i]));
        }
    }
    let mut ans = 0;
    while let Some(st) = pq.pop() {
        let i = st.0;
        let k = (b[i] - a[i]) / (b[(i + n - 1) % n] + b[(i + 1) % n]);
        ans += k;
        b[i] -= k * (b[(i + n - 1) % n] + b[(i + 1) % n]);
        if b[(i + n - 1) % n] >= b[(i + n - 2) % n] + b[i] + a[(i + n - 1) % n] {
            pq.push(State((i + n - 1) % n, b[(i + n - 1) % n]));
        }
        if b[(i + 1) % n] >= b[i] + b[(i + 2) % n] + a[(i + 1) % n] {
            pq.push(State((i + 1) % n, b[(i + 1) % n]));
        }
    }
    if a.iter().zip(b.iter()).all(|(&x, &y)| x == y) {
        println!("{}", ans);
    } else {
        println!("-1");
    }
}


Measured memory_bytes: 10492
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,k;
  cin >> n >> k;
  int sum=0;
  vector<int>h(n);
  for(int i=0;i<n;i++) {
    cin >> h.at(i);
    if(h.at(i)>=k) {
      sum+=1;}
    }
  cout << sum << endl;
  return 0;
  }
    
      

Measured memory_bytes: 640
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int n = scan.nextInt();
		String re = "";

		re = String.valueOf(n);

		System.out.println(re.contains("7")?"Yes":"No");
		scan.close();
	}

}


Measured memory_bytes: 27060
import java.lang.Math;
import java.util.Scanner;
import java.util.Map;
import java.util.HashMap;
import java.util.Arrays;

class Pair {
    public final int x;
    public final int y;

    public Pair(int x, int y) {
        this.x = x;
        this.y = y;
    }
}

class Main {
    static Map<Integer, Pair> map;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int H = sc.nextInt();
        int W = sc.nextInt();
        int D = sc.nextInt();
        map = new HashMap<>();

        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                map.put(sc.nextInt(), new Pair(i, j));
            }
        }

        // 累積和
        long costs[][] = new long[D][H*W/D+1];
        for (int i = 0; i < D; i++) {
            costs[i][0] = 0;
            for (int j = 1; j < H*W/D+1; j++) {
                costs[i][j] = costs[i][j-1] + singleHopCost(i+(j-1)*D, i+j*D);
            }
            // System.out.println(Arrays.toString(costs[i]));
        }

        int Q = sc.nextInt();
        for (int q = 0; q < Q; q++) {
            int START = sc.nextInt();
            int GOAL = sc.nextInt();
            int lg = Math.max(START, GOAL);
            int sm = Math.min(START, GOAL);
            // System.out.println(Arrays.toString(costs[0]));

            long answer = costs[lg%D][lg/D] - costs[lg%D][sm/D];  // lg%D == sm%D
            System.out.println(answer);
        }
    }

    public static Integer singleHopCost(int l, int r) {
        if (l == 0) { return 0; }
        Pair lPoint = map.get(l);
        Pair rPoint = map.get(r);

        if (lPoint == null || rPoint == null) { return 0; }

        return Math.abs(lPoint.x - rPoint.x) + Math.abs(lPoint.y - rPoint.y);
    }
}


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

using namespace std;
int popcnt(int bits) {
  bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
  bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
  bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
  bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
  return (bits & 0x0000ffff) + (bits >> 16 & 0x0000ffff);
}

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

  int n;
  cin >> n;
  vector<int> opens(n);
  for (int i = 0; i < n; ++i) {
    int tmp = 0;
    for (int j = 0; j < 10; ++j) {
      tmp <<= 1;
      int t;
      cin >> t;
      tmp += t;
    }
    opens[i] = tmp;
  }
  vector<vector<int>> profits(n);
  for (int i = 0; i < n; ++i) {
    profits[i].resize(11);
    for (int j = 0; j < 11; ++j) {
      cin >> profits[i][j];
    }
  }

  int64_t max_profit = INT64_MIN;
  for (int i = 1; i < 1024; ++i) {
    vector<int> matches(n);
    for (int j = 0; j < n; ++j) {
      matches[j] = popcnt(opens[j] & i);
    }
    int64_t prof = 0;
    for (int j = 0; j < n; ++j) {
      prof += profits[j][matches[j]];
    }
    max_profit = max(max_profit, prof);
  }
  cout << max_profit << "\n";
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
    int i = 0;
    int n = 0;
    int maxv = -1000000010;
    int minv = 0;
    int R[200010];
    
    scanf("%d", &n);
    scanf("%d", &R[0]);
    
    minv = R[0];
    
    for(i = 1; i < n; i++){
        scanf("%d", &R[i]);
        if(maxv < R[i] - minv){
            maxv = R[i] - minv;
        }
        if(minv > R[i]){
            minv = R[i];
        }
    }
    
    printf("%d\n", maxv);
    
    return 0;
}



Measured memory_bytes: 3468
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

lint N, K;

int main()
{
    cin >> N >> K;
    if (K & 1)
    {
        cout << (N / K) * (N / K) * (N / K) << endl;
        return 0;
    }
    else
    {
        lint Khalf = K / 2;
        lint tmp = N / Khalf;
        lint t2 = tmp / 2;
        cout << t2 * t2 * t2 + (tmp - t2) * (tmp - t2) * (tmp - t2) << endl;
    }
}


Measured memory_bytes: 256
N = int(input())
t = list(map(int, input().split()))
v = list(map(int, input().split()))
def exe(x, y, z, t):
  ans = t * y
  if x < y:
    ans -= (y - x) * (y - x) / 2
  if y > z:
    ans -= (y - z) * (y - z) / 2
  return ans

def upd(x, y, z, t):
  a = y - x
  b = y - z
  if y > z:
    if t < a:
      y = x + t
    elif t < a + b:
      y = x + (t + (z - x)) / 2
  else:
    if t < a:
      y = x + t
  return y

v = [0] + v + [0]
L = [0] * len(v)
v[1] = upd(v[0], v[1], v[2], t[0])
v[-2] = upd(v[-1], v[-2], v[-3], t[-1])
for i in range(1, N):
  k = -1
  for j in range(1, N + 1):
    if L[j] == 0:
      if k == -1:
        k = j
      else:
        if v[j] < v[k]:
          k = j
  L[k] = 1
  if k != 1:
    v[k - 1] = upd(min(v[k], v[k - 2]), v[k - 1], max(v[k], v[k - 2]), t[k - 2])
  if k != N:
    v[k + 1] = upd(min(v[k], v[k + 2]), v[k + 1], max(v[k], v[k + 2]), t[k])

ans = 0
for i in range(N):
  ans += exe(v[i], v[i + 1], v[i + 2], t[i])

print(ans)

Measured memory_bytes: 3192
A,B,C,X,Y=map(int, input().split())

if A*X+B*Y<A*(X-1)+B*(Y-1)+C*2:
    price=A*X+B*Y
else:
    if 2*C<A and 2*C<B:
        price=max(X,Y)*2*C
    elif 2*C<A and 2*C>B and X>Y:
        price=X*2*C
    elif 2*C>A and 2*C<B and X<Y:
        price=Y*2*C
    else:
        if X>Y:
            price=2*C*Y+A*(X-Y)
        else:
            price=2*C*X+B*(Y-X)

print(price)


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

int main() {
  int n, k;
  cin >> n >> k;
  
  map<int, int> memo;
  
  rep(i, n) {
    int a;
    cin >> a;
    ++memo[a];
  }
  
  vector<int> num;
  
  multiset<int> st;
  for(auto x : memo) {
//    cout << x.first << ":" << x.second << endl;
    st.insert(x.second);
  }
  
  int ok = 0;
  auto itr = st.end();
  int memosize = memo.size();
  int kaisuu = min(k, memosize);
  rep(i, kaisuu) {
    --itr;
    ok += *itr;
//    cout << *itr << endl;
  }
  
  cout << n - ok << endl;
  
  
  
  return 0;
}


Measured memory_bytes: 18944
using System;

namespace B___Traveling_AtCoDeer_Problem
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var input = Console.ReadLine().Split();
            var a = new int[n];
            for(var i=0; i<n; i++)
            {
                a[i] = int.Parse(input[i]);
            }
            Array.Sort(a);
            Console.WriteLine(a[n - 1] - a[0]);
        }
    }
}

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

const int N = 1e5 + 10;

int n, a[N];
long long sum[N];

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
  }
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; i++) {
    sum[i] = (long long)a[i] + sum[i - 1];
  }
  int ans = 0;
  for (int i = n; i >= 1; i--) {
    if (sum[i] * 2 < (long long)a[i + 1]) break;
    ans++;
  }
  printf("%d\n", ans);
  return 0;
}



Measured memory_bytes: 1408
from collections import deque
x = deque()

for i in range(int(input())):
    com = input()
    if com == "deleteFirst":
        x.popleft()
    elif com == "deleteLast":
        x.pop()
    else:
        com,n = com.split()
        if com == "insert":
            x.appendleft(n)
        elif com == "delete":
            try:
                x.remove(n)
            except:
                pass
            
print(*x)


Measured memory_bytes: 69732
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cstdio>
#include <cstring>
using namespace std;

int main()
{
    cin.tie(0);

    int n, k;
    cin >> n >> k;

    vector<int64_t> as(n);
    for (auto &a: as)
        cin >> a;

    vector<int64_t> sum(n + 1);
    for (int i = 1; i <= n; i++) {
        sum[i] = (as[i - 1] > 0 ? as[i - 1] : 0) + sum[i - 1];
    }

    int64_t best = 0, cur = 0;
    for (int i = 0; i < n; i++) {
        cur += as[i];
        if (i - k + 1 < 0)
            continue;

        if (i - k >= 0)
            cur -= as[i - k];

        int l = i - k + 1;
        int r = i + 1;

        int64_t tmp1 = (sum[l] - sum[0]) + cur + (sum[n] - sum[r]);
        int64_t tmp2 = (sum[l] - sum[0]) + 0 + (sum[n] - sum[r]);
        best = max(best, tmp1);
        best = max(best, tmp2);

        // cout << i << ": " << l << ", " << r << ": " << (sum[l] - sum[0]) << " + " << cur << " + " << (sum[n] - sum[r]) << endl;
    }

    cout << best << endl;

    return 0;
}

Measured memory_bytes: 1920
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

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;
}
constexpr int mod = 998244353;
constexpr int inf = 3e18;

signed main(){
	int a;cin>>a;
	cout<<a+a*a+a*a*a<<endl;
}


Measured memory_bytes: 3632
n = int(input())
h = [int (i) for i in input().split()]
ans=0

l=[]

if n==1:
	l.append(ans)

else:
	for i in range(1,n):
		if h[i-1] >= h[i]:

			ans+=1

			if i==n-1:
				l.append(ans)

		else:

			l.append(ans)

			ans=0

print(max(l))


Measured memory_bytes: 14252
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
vector<int>to[200005];
int main() {
	int n, m;
	cin >> n >> m;
	int a, b;
	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		a--; b--;
		to[a].push_back(b);
		to[b].push_back(a);
	}
	queue<int>que;
	vector<int>dist(n, inf);
	dist[0] = 0;
	que.push(0);
	while (!que.empty()) {
		int v = que.front();
		que.pop();
		for (int id : to[v]) {
			if (dist[id] != inf)continue;
			dist[id] = dist[v] + 1;
			que.push(id);
		}
	}
	if (dist[n - 1] == 2) {
		cout << "POSSIBLE" << endl;
	}
	else {
		cout << "IMPOSSIBLE" << endl;
	}
	return 0;
}

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

int main(){

    string a,b,c;
    cin>>a>>b>>c;

    ll ind=0;
    stack<char> s,d,e,f;
    for(ll i=a.length()-1;i>=0;i--){
        s.push(a[i]);
        d.push(a[i]);
    }
    for(ll i=b.length()-1;i>=0;i--){
        e.push(b[i]);
    }
    for(ll i=c.length()-1;i>=0;i--){
        f.push(c[i]);
    }
    bool flag=false;
    while(s.empty()==0){
        ll ind1=s.top()-'a'+1;
        flag=true;
        s.pop();
        if(ind==0){
            d=s;
        }
        else if(ind==1){
            e=s;
        }
        else{
            f=s;
        }
        if(ind1==1){
            s=d;
            ind=0;
        }
        else if(ind1==2){
            s=e;
            ind=1;
        }
        else{
            ind=2;
            s=f;
        }
    }
    
    if(ind==0){
        cout<<'A'<<endl;
    }
    else if(ind==1){
        cout<<'B'<<endl;
    }
    else{
        cout<<'C'<<endl;
    }

}

Measured memory_bytes: 384
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_s(): return list(input().split())

N,K = inpl()
if K == 0:
	print(N**2)
else:
	ans = 0
	for b in range(K+1,N+1):
		n = N//b #ループ回数
		x = N%b  #末尾
		ans += (b-K)*n + max(0,x-K+1)
	print(ans)


Measured memory_bytes: 4212
#include<bits/stdc++.h>
#define ll long long
#define N 200
#define M 1000000007
#define pii pair<ll,ll>
#define fast ios_base::sync_with_stdio(0);cin.tie(0);
using namespace std;
string s[N];
int dp[N][N][2];
int H,W;
int run(int i,int j,int cnt)
{
    if(dp[i][j][cnt]!=-1)
        return dp[i][j][cnt];

    if(s[i][j]=='#')
    {
        if(cnt)
        {
            int ans=1e8;
            if(i==H-1&&j==W-1)
                return 0;
            if(j+1<W)
                ans=min(ans,run(i,j+1,1));
            if(i+1<H)
                ans=min(ans,run(i+1,j,1));
            return dp[i][j][cnt]=ans;
        }
        else
        {
            int ans=1e8;
            if(i==H-1&&j==W-1)
                return 1;
            if(j+1<W)
                ans=min(ans,1+run(i,j+1,1));
            if(i+1<H)
                ans=min(ans,1+run(i+1,j,1));
            return dp[i][j][cnt]=ans;
        }
    }
    else
    {
        if(i==H-1&&j==W-1)
            return 0;
        int ans=1e8;
        if(j+1<W)
            ans=min(ans,run(i,j+1,0));
        if(i+1<H)
            ans=min(ans,run(i+1,j,0));

        return dp[i][j][cnt]=ans;
    }

}

main()
{
    memset(dp,-1,sizeof dp);
    cin>>H>>W;
    for(int i=0; i<H; i++)
        cin>>s[i];
    cout<<run(0,0,0);
}



Measured memory_bytes: 640
n = int(raw_input())
t = map(int, raw_input().split())
a = map(int, raw_input().split())
M = 10**9 + 7
ans = 1
m = [0] * n
if t[n-1] == a[0]:
    for i in xrange(n):
        if n == 1:
            break
        m = min([t[i], a[i]])
        flag1 = False
        flag2 = False
        if i > 0:
            if t[i-1] < t[i]:
                if a[i] < t[i]:
                    ans = 0
                    break
                flag1 = True
        else:
            flag1 = True
        if i < n-1:
            if a[i+1] < a[i]:
                if a[i] > t[i]:
                    ans  = 0
                    break
                flag2 = True
        else:
            flag2  = True
        #print m
        
        if not(flag1 or flag2):
            ans *= m
            ans %= M
else:
    ans = 0
print ans,

Measured memory_bytes: 14500
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#include <bits/stdc++.h>
 
#if DEBUG
    #include "debug.h"
#else
    #define debug(args...)
#endif    

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long ll;


#define M 1000000 
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define fill(a,x) memset(a,x,sizeof(a))
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i<=b; ++i)
#define NFOR(i,a,b) for(int i = a; i>=b; --i)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const int INF = INT_MAX;
const int mod = 1e9+7;

const int N = 2e5 + 10;
inline int add(int x,int y){
  x += y;
  if(x >= mod) x -= mod;
  return x;
}
inline int mul(int x,int y){
  x = (1LL * x * y) % mod;
  return x;
}
clock_t time_p=clock();

vector<string> sub[N];

int32_t main(){
  fast;

  //freopen("in.txt","r",stdin);
  //freopen("out.txt","w",stdout);

  int n,m;
  cin >> n >> m;
  FOR(i,1,m) {
    int p;
    string s;
    cin >> p >> s;
    sub[p].pb(s);
  }
  int a1 = 0, a2 = 0;
  FOR(i,1,n) {
    for(int j = 0; j < sz(sub[i]); j++) {
      if(sub[i][j] == "AC") {
        a1++;
        a2+= j;
        break;
      }
    }
  }
  cout << a1 << " " << a2 << "\n";

  time_p=clock()-time_p;
  cerr<<"\nTime Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";

  return 0;
}

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

// 2. mod.p (数値誤差なし)

using ll = long long;
// 逆元計算
ll modinv(ll a, ll mod) {
    ll b = mod, u = 1, v = 0;
    while (b) {
        ll t = a/b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    return (u % mod + mod) % mod;
}
// matrix
template<int MOD> struct Matrix {
    vector<vector<long long> > val;
    Matrix(int n, int m, long long x = 0) : val(n, vector<long long>(m, x)) {}
    void init(int n, int m, long long x = 0) {val.assign(n, vector<long long>(m, x));}
    int size() const { return (int)val.size(); }
    inline vector<long long>& operator [] (int i) { return val[i]; }
};
// rankを求める
template<int MOD> int GaussJordan(Matrix<MOD> &A, bool is_extended = false) {
    int m = (int)A.size(), n = (int)A[0].size();
    for (int row = 0; row < m; row++) {
        for (int col = 0; col < n; col++) {
            A[row][col] = (A[row][col] % MOD + MOD) % MOD;
        }
    }
    
    int rank = 0;
    for (int col = 0; col < n; col++) {
        if (is_extended && col == n-1) break;
        int pivot = -1;
        for (int row = rank; row < m; row++) {
            if (A[row][col] != 0) {
                pivot = row;
                break;
            }
        }
        if (pivot == -1) continue;
        if (rank != pivot) swap(A[pivot], A[rank]);
        auto inv = modinv(A[rank][col], MOD); // 逆元
        for (int col2 = 0; col2 < n; ++col2) {
            A[rank][col2] = A[rank][col2] * inv % MOD;
        }
        for (int row = 0; row < m; row++) {
            if (row != rank && A[row][col] != 0) {
                auto fac = A[row][col];
                for (int col2 = 0; col2 < n; col2++) {
                    A[row][col2] -= A[rank][col2] * fac % MOD;
                    if (A[row][col2] < 0) A[row][col2] += MOD;
                }
            }
        }
        rank++;
    }
    return rank;
}
// 連立一次方程式を解く（解が一つだけ存在するor存在しない）（resに参照渡しする）
template<int MOD> int linear_equation(Matrix<MOD> A, vector<ll> b, vector<ll> &res) {
    int m = (int)A.size(), n = (int)A[0].size();
    Matrix<MOD> M(m, n+1);
    for (int i = 0; i < m; i++) {
        for (int j = 0; j < n; j++) M[i][j] = A[i][j];
        M[i][n] = b[i];
    }
    int rank = GaussJordan(M, true);

    // check if it has no solution
    for (int row = rank; row < m; row++) if (M[row][n] != 0) return -1;

    // answer (only 1)
    res.assign(n, 0);
    for (int i = 0; i < rank; i++) res[i] = M[i][n];
    return rank;
}

int main(){
    int n, m; cin >> n >> m;
    Matrix<2> A(m, n, 0);
    vector<ll> b(m);
    for (int i = 0; i < m; i++) {
        int k; cin >> k;
        for (int j = 0; j < k; j++) {
            int s; cin >> s; s--;
            A[i][s] = 1;
        }
    }
    for (int i = 0; i < m; i++) cin >> b[i];

    vector<ll> res;
    int rank = linear_equation<2>(A, b, res);
    if (rank == -1) cout << 0 << endl;
    else cout << (1<<(n-rank)) << endl;
}

Measured memory_bytes: 3568
class Trie01
  class Node
    attr_accessor :childs, :parent

    def initialize()
      @childs = {}
    end

    def insert(c)
      n = @childs[c] || self.class.new
      @childs[c] = n
      n.parent = self
      n
    end
  end
  
  def initialize()
    @root = Node.new
  end

  def insert(s)
    n = @root
    s.chars.each{ |c| n = n.insert(c) }
    n
  end
end

N,L = gets.split.map &:to_i
T = Trie01.new
S = (0...N).map{ gets.chomp }
Leaves = S.map{ |s| T.insert(s) }

marked = {}
ns = {}

(0...N).each{ |i|
  d = L - S[i].size + 1
  n = Leaves[i]
  while n.parent do
    n = n.parent
    break if marked[n]
    if !n.childs["0"]
      marked[n] = 1
      ns[d] = (ns[d] || 0) + 1
    end
    if !n.childs["1"]
      marked[n] = 1
      ns[d] = (ns[d] || 0) + 1
    end
    d += 1
  end
}

#p ns

def lsb(n)
  return 0 if n == 0
  n & -n
end

g = 0
ns.each{ |k,n|
  next if n % 2 == 0
  g ^= lsb(k)
}
puts g == 0 ? "Bob" : "Alice"


Measured memory_bytes: 54140
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>

using namespace std;

typedef pair<long long, long long> pl;

long long N, M, k, a, b, c, d, e, H, W,X;
long long A[200][200];
long long B[200002] = {};
long long tt[20000] = {};
bool f;
bool ff;
string S, SS;
set <long long>sll;
pl buf;
vector <long long>vpl;
vector <long long>vl;


int main() {
	cin >> N;

	if (N % 2 == 0) {
		
		for (int i = 1; i <= N; i++) {
			for (int j = i + 1; j <= N; j++) {
				if (j != N + 1 - i) {
					vl.push_back(i);
					vpl.push_back(j);
				}
			}
		}

	}
	else {

		for (int i = 1; i <= N; i++) {
			for (int j = i + 1; j <= N; j++) {
				if (j != N - i) {
					vl.push_back(i);
					vpl.push_back(j);
				}
			}
		}

	}

	cout << vl.size() << endl;

	for (int i = 0; i < vl.size(); i++) {
		cout << vl[i] <<' '<< vpl[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 384
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] nmx = scanner.nextLine().split(" ", 3);
        int n = Integer.parseInt(nmx[0]);
        int m = Integer.parseInt(nmx[1]);
        int x = Integer.parseInt(nmx[2]);

        String[] line = scanner.nextLine().split(" ", m);
        int[] gates = new int[m];
        for (int i = 0; i < m; i++) {
            gates[i] = Integer.parseInt(line[i]);
        }

        int nCost = 0;
        int zCost = 0;
        for (int i = 0; i < m; i++) {
            if (gates[i] > x) {
                nCost++;
            }
            if (gates[i] < x) {
                zCost++;
            }
        }
        System.out.println(Math.min(nCost, zCost));
    }
}


Measured memory_bytes: 21844
//Dragon_warrior7(IITK)
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define nl cout << '\n'
#define sor(x) sort(x.begin(), x.end())
#define rev(v) reverse(v.begin(), v.end())
#define maxin(v) *max_element(v.begin(), v.end())
#define minin(v) *min_element(v.begin(), v.end())
#define sumall(vect) accumulate(vect.begin(), vect.end(), 0)
#define count(x, vect) count(vect.begin(), vect.end(), x)
#define lb(v, temp) lower_bound(v.begin(), v.end(), temp)
#define ub(v, temp) upper_bound(v.begin(), v.end(), temp)
#define fi first
#define se second
#define llmax 100000000000000000
#define deb(x) cout << #x << " " << x << "\n"
#define pll pair<ll, ll> 
#define vll vector<ll> 
#define rub cout << "------------------------------------\n"
//#define min(a, b, c) min(a, min(b, c))
//#define max(a, b, c) max(a, max(b, c))
void read(vector<ll> &v)
{
	for (int i = 0; i < v.size(); i++)
		cin >> v[i];
}

void print(vector<ll> v)
{
	for (int i = 0; i < v.size(); i++)
		cout << v[i] << " ";
}
string str;
ll n,m,a,b,temp;
vector<pair<char,char>> q;
bool f(int mid)
{
    int pos=mid;
    char c=str[mid];
    for(int i=0;i<q.size();i++)
    {
    if(q[i].fi!=c)
    continue;
    if(pos==0 && q[i].se=='L')
    return 1;
    if(q[i].se=='L')
    {c=str[pos-1];
    pos--;}
    else
    {
        if(pos!=n-1)
        {
        c=str[pos+1];
        pos++;
        }
    }
    }
    return 0;
}
bool fr(int mid)
{
    int pos=mid;
    char c=str[mid];
    for(int i=0;i<q.size();i++)
    {
    if(q[i].fi!=c)
    continue;
    if(pos==n-1 && q[i].se=='R')
    return 1;
    if(q[i].se=='L' && pos!=0)
    {c=str[pos-1];
    pos--;}
    else
    {
        c=str[pos+1];
        pos++;
    }
    }
    return 0;
}
//set<ll> s;
vll v;
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n;
	cin>>m;
	cin>>str;
	while(m--)
	{
	    char a,b;
	    cin>>a>>b;
	    q.pb({a,b});
	}
	int l=0;
	int r=n-1;
	int mid;
	while(l<=r)
	{
	   mid=(l+r)/2;
	   if(f(mid))
	   l=mid+1;
	   else
	   r=mid-1;
	}
   if(!f(l))
   l--;
   //deb(l);
//	nl;
   vector<int> ans(n,0);
	for(int i=0;i<=l;i++)
	{
	    ans[i]=1;
	}
	l=0;
	r=n-1;
	while(l<=r)
	{
	    int mid=(l+r)/2;
	    if(fr(mid))
	    r=mid-1;
	    else
	    l=mid+1;
	}
	if(!fr(r))
	r++;
	for(int i=n-1;i>=r;i--)
	{
	    ans[i]=1;
	}
	cout<<count(0,ans);
}

Measured memory_bytes: 1808
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <unordered_map>
#include <unordered_set>

using std::cin;
using std::cout;
using std::cerr;
using std::endl;

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

using std::min;
using std::max;

//#define int long long

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

namespace MySpace{

};

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

inline int nextInt()
{
    int x = 0;
    char c = getchar();
    int mi = (c == '-');
    if (c == '-') c = getchar();
    while ('0' <= c && c <= '9')
    {
        x = 10 * x + c - '0';
        c = getchar();
    }
    if (mi) return x * -1;
    return x;
}

S s;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n;
    cin >> n;
    cin >> s;
    vector<int> z(s.size());
    int ans = 0;
    for (int l = 0; l < s.size(); l++)
    {
        fill(all(z), 0);
        int L = l, R = l;
        z[l] = s.size() - l;
        for (int i = l + 1; i < s.size(); i++)
        {
            z[i] = max(0, min(z[i - L + l], R - i));
            while (i + z[i] < s.size() && s[z[i] + l] == s[i + z[i]]) z[i]++;
            if (i + z[i] > R)
            {
                R = i + z[i];
                L = i;
            }
        }
        for (int i = l; i < s.size(); i++)
        {
            if (l + z[i] <= i) ans = max(ans, z[i]);
        }
    }
    cout << ans;
}


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

int main(){
  int a,b;cin>>a>>b;
  if(a >= 13){
    cout << b << endl;
  }else if (a < 6){
    cout << 0 <<endl;
  }else{
    cout << b / 2 << endl;
  }
  return 0;
}


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

using namespace std ;
#define int long long int

const int maxn = 100;
const int maxw = 1e5 + 5;
const int inf = -1e9 ;
vector< vector<int> > dp(maxn, vector<int>(maxw,0));
vector<int> w(maxn);
vector<int> v(maxn);


int32_t main(){
    // #ifndef ONLINE_JUDGE
    //   freopen("input.txt", "r", stdin);
    //   freopen("output.txt", "w", stdout);
    // #endif
    int n , W ;
    cin >> n >> W ;
    for(int i = 0 ; i < n ; i++ ){
        cin >> w[i] >> v[i];
    }
    for(int i = w[0] ; i <= W; i++){
        dp[0][i] = v[0];
    }
    for(int i = 1 ; i < n ; i++){
        for(int j = 0 ; j <= W; j++){
            if(w[i] <= j){
                dp[i][j] = max(dp[i-1][j - w[i]] + v[i], dp[i][j]);
            }
            dp[i][j] = max(dp[i][j], dp[i-1][j]);
        }
    }
    cout<<dp[n-1][W]<<endl;
    return 0;
}

Measured memory_bytes: 79360
#include <bits/stdc++.h>
 
using namespace std;
 
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl;
#define DEBUG_MAT(v) cerr<<#v<<endl;for(int i=0;i<v.size();i++){for(int j=0;j<v[i].size();j++) {cerr<<v[i][j]<<" ";}cerr<<endl;}
typedef long long ll;
#define int ll
 
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
template<class S, class T> pair<S, T> operator+(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first + t.first, s.second + t.second); }
template<class S, class T> pair<S, T> operator-(const pair<S, T> &s, const pair<S, T> &t) { return pair<S, T>(s.first - t.first, s.second - t.second); }
template<class S, class T> ostream& operator<<(ostream& os, pair<S, T> p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
#define X first
#define Y second
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define rrep1(i,n) for(int i=(int)(n);i>0;i--)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define in(x, a, b) (a <= x && x < b)
#define all(c) c.begin(),c.end()
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 (a>b) { a = b; return 1; } return 0; }
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
const ll inf = 1000000001;
const ll INF = (ll)1e18 + 1;
const long double pi = 3.1415926535897932384626433832795028841971L;
#define Sp(p) cout<<setprecision(25)<< fixed<<p<<endl;
//int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
//int dx2[8] = { 1,1,0,-1,-1,-1,0,1 }, dy2[8] = { 0,1,1,1,0,-1,-1,-1 };
vi dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
vi dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };
#define fio() cin.tie(0); ios::sync_with_stdio(false);
const ll MOD = 1000000007;
// const ll MOD = 998244353;
// #define mp make_pair
//#define endl '\n'

signed main() {
    fio();
    int n;
    cin >> n;
    vl a(n);
    rep (i, n) cin >> a[i];

    ll now = 1;
    rep (i, n) {
        if (a[i] == 0) {
            now *= a[i];
        }
        else {
            if (now == INF) continue;
            if (3 * INF / a[i] >= now) {
                now *= a[i];
                chmin(now, INF);
            }
            else {
                now = INF;
            }
        }
    }
    if (now == INF) {
        cout << -1 << endl;
    }
    else {
        cout << now << endl;
    }
    // int a, b;
    // cin >> a >> b;
    // cout << a * b << endl;
    // ll a;
    // string b;
    // cin >> a >> b;
    // rep (i, b.size()) {
    //     if (b[i] == '.') {
    //         b.erase(b.begin() + i);
    //         break;
    //     }
    // }
    // ll bb = stol(b);
    // cout << a * bb / 100 << endl;

}

Measured memory_bytes: 3992
# -*- coding: utf-8 -*-

def readInts():
  return [int(s) for s in input().split(" ")]

def main():
  A, B, C = readInts()
  if A <= C <= B or B <= C <= A:
    print('Yes')
  else:
    print('No')

if __name__ == "__main__":
  main()


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define Phuong_ ios_base::sync_with_stdio(0); cin.tie(0);

/// easy access -------------
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<int,int> pi;
typedef tuple<int, int, int, int> tp;
///-------------------------

int main()
{
    Phuong_; /// <3333
    int n,m,lim;
    cin >> n >> m >> lim;
    vector<int> c(n);
    vector<int> lv[n];
    for(int i=0; i<n; ++i)
    {
        cin >> c[i];
        lv[i].resize(m);
        for(int j=0; j<m; ++j) cin >> lv[i][j];
    }
    int num = (1<<n);
    bitset<15> f;
    int minn=INT_MAX;
    for(int tc = 1; tc<num; ++tc){
        int k = tc;
        f.reset();
        vector<int> skill(m);
        int ans=0;
        int dem=0;
        for(int i=0; i<n; ++i) {
            if (k&1) {
                ans+=c[i];
                for(int v=0; v<m; ++v) {
                    skill[v]+=lv[i][v];
                    if (skill[v]>=lim && !f[v]){
                        dem++;
                        f[v]=1;
                    }
                }
            }
            k>>=1;
        }
        if (dem==m) minn=min(minn,ans);
    }
    if(minn==INT_MAX) cout << -1; else
    cout << minn;
    return 0;
}


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

typedef struct {
	int posx, posy;
}poi;

poi A, B, C, D;

int main() {
	cin >> A.posx >> A.posy >> B.posx >> B.posy;
	int LA = B.posx - A.posx, LB = B.posy - A.posy;
	cout << B.posx - LB << ' ' << B.posy + LA << ' ';
	cout << A.posx - LB << ' ' << A.posy + LA << endl;
}

Measured memory_bytes: 256
macro_rules! get {
    (Vec<$t:ty>) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn main() {
    let N = get!(usize);
    let a = get!(Vec<usize>);

    // 必ず構築可能
    // 末尾から定めればよい
    let mut dp = vec!(0; N);
    for i in (1..(N + 1)).rev() {
        dp[i - 1] = (
            (1..(N / i))
                .map(|j| dp[(j + 1) * i - 1])
                .sum::<usize>()
            + a[i - 1]
        ) % 2;
    }
    let M = dp.iter().sum::<usize>();
    let b = (0..N)
        .filter(|&i| dp[i] == 1)
        .map(|i| (i + 1).to_string())
        .collect::<Vec<_>>()
        .join(" ");
    let ans = if M == 0 {
        format!("{}", M)
    } else {
        format!("{}\n{}", M, b)
    };

    println!("{}", ans);
}


Measured memory_bytes: 13740
#include <bits/stdc++.h>
using namespace std;
const int maxn=100005;
const int mod=1000*1000*1000+7;
int n,a[maxn];
int g[maxn],G[maxn];
int fac[maxn],inv[maxn];
int C(int x,int y){
  if(x<y)return 0;
  return 1LL*fac[x]*inv[y]%mod*inv[x-y]%mod;
}
int main(){
 // freopen("aa.in","r",stdin);
  scanf("%d",&n);
  for(int i=1;i<=n;i++){
    scanf("%d",a+i);
  }
  fac[0]=1;
  for(int i=1;i<maxn;i++)fac[i]=1LL*fac[i-1]*i%mod;
  inv[0]=inv[1]=1;
  for(int i=2;i<maxn;i++)inv[i]=mod-1LL*mod/i*inv[mod%i]%mod;
  for(int i=1;i<maxn;i++)inv[i]=1LL*inv[i]*inv[i-1]%mod;
  for(int i=1;i<=n;i++){
    g[i]=1LL*C(n,i)*fac[i-1]%mod*fac[n-i]%mod;
    // printf("g %d %d\n",i,g[i]);
    g[i]=(g[i]+g[i-1])%mod;
  }
  int ans=0;
  for(int i=1;i<=n;i++){
    ans=(ans+1LL*a[i]*(1LL*g[n-i+1]+g[i]-fac[n]+mod))%mod;
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
const double EPS = 1e-10;
const double pi = acos(-1);//3.1415926535897932384626433832795028...
const ll SIZE = 2000005;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[SIZE], finv[SIZE], inv[SIZE];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

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

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

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T & t, const V & v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T & t, const V & v) {
	for (auto& e : t) fill_v(e, v);
}

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) { return 0; }
	return a + b;
}

double len(int a, int b, int c, int d) {
	return (double)sqrt((a - c) * (a - c) + (b - d) * (b - d));
}

ll n, k[100005], dp[100005];
int main() {
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> k[i];
	}

	memset(dp, 9999, sizeof(dp));
	dp[0] = 0;

	for (int i = 1; i < n; ++i) {
		dp[i] = min(dp[i], dp[i - 1] + abs(k[i] - k[i - 1]));
		if (i != 1) { dp[i] = min(dp[i], dp[i - 2] + abs(k[i] - k[i - 2])); }
	}

	cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long; 
using P=pair<int,int>;
using lP=pair<ll,ll>;
using fP=pair<double,double>;


int main(){
    int n,m;
    cin>>n>>m;
    int ans=0;
    vector<int>a;
    for(int i=n;i*i<=m;i++){
        if(m%i==0){
            ans=m/i;
            break;
        }
    }
    if(ans==0){
        for(int i=n-1;i>=1;i--){
            if(m%i==0&&m/i>=n){
                ans=i;
                break;
            }
        }
    }
    
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256