akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ub              upper_bound
#define lb              lower_bound
#define isrt            insert
#define clr             clear
#define rsz             resize
#define ff              first
#define ss              second
#define lli             long long int
#define pb              push_back
#define pf              push_front
#define mkp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<lli,lli>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define INF             1e9
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define endl            "\n"


typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

lli maxm(lli a, lli b)
{
  return (a >= b ? a : b);
}


lli minm(lli a, lli b)
{
  return (a <= b ? a : b);
}

lli power(lli x, lli y, lli p)
{
  lli res = 1;

  x = x % p;
  if (x == 0)
    return 0;

  while (y > 0)
  {

    if (y & 1)
      res = (res * x) % p;


    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}

lli nCrmodp(lli n, lli r, lli p)
{
  if (r == 0)
    return 1;
  if (r == 1)
    return n;


  lli pro = 1, k = n;
  while (k > r)
  {
    pro *= k;
    pro %= p;
    --k;
  }

  k = 2;
  while (k <= (n - r))
  {
    pro *= power(k, (p - 2), p);
    pro %= p;
    ++k;
  }

  return pro;
}


string num_str(lli n, lli k)
{
  string str = "";
  lli x = n;
  while (x != 0)
  {
    string s = to_string(x % k);
    str = s + str;
    x /= k;
  }

  return str;
}

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

}

#define maxn 1010

char str[maxn][maxn];
lli dp[maxn][maxn];

lli calc(lli n, lli m)
{
  if (dp[n][m] == -1)
  {
    if (str[n][m] == '#' || n < 1 || m < 1)
      dp[n][m] = 0;

    else
      dp[n][m] = (calc(n - 1, m) + calc(n, m - 1)) % mod;
  }

  return dp[n][m];
}


int main()
{
  c_p_c();
  int n, m;
  memset(dp, -1, sizeof(dp));
  dp[1][1] = 1;

  cin >> n >> m;

  for (int i = 1; i <= n; ++i)
    for (int j = 1; j <= m; ++j)
      cin >> str[i][j];


  cout << calc(n, m) << endl;

  return 0;
}

Measured memory_bytes: 12744
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        abc160_c solver = new abc160_c();
        solver.solve(1, in, out);
        out.close();
    }

    static class abc160_c {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int K = in.nextInt();
            int N = in.nextInt();
            long A[] = new long[N];
            long seg[] = new long[N];
            long max_far = 0;
            long max_far_seg = -1;
            for (int i = 0; i < N; i++) {
                A[i] = in.nextInt();
            }
            max_far = (K - A[N - 1]) + A[0];
            max_far_seg = 0;
            seg[0] = max_far;
            for (int i = 1; i < N; i++) {
                long far = A[i] - A[i - 1];
                seg[i] = far;
                if (max_far < far) {
                    max_far = far;
                    max_far_seg = i;
                }
            }
            long ttldist = 0;
            for (int i = 0; i < N; i++) {
                if (max_far_seg != i) {
                    ttldist += seg[i];
                }
            }
            out.println(ttldist);
        }

    }
}



Measured memory_bytes: 91932
let id x = x
let n = Scanf.scanf "%d\n" id
let k = Scanf.scanf "%d\n" id

let slv k xs =
    List.map (fun x -> min x (abs (x-k))) xs
    |> (List.fold_left (+) 0)
    |> ( * ) 2

let rec inp n = match n with
    | 0 -> []
    | _ -> Scanf.scanf "%d " id :: (inp (n-1))

let () =
    slv k (inp n) |> Printf.printf "%d"

Measured memory_bytes: 384
n, a, b, c, d = map(int, input().split())
s = str(input())
a -= 1
b -= 1
c -= 1
d -= 1



if c < d:
    for i in range(b, d):
        if s[i:i+2] == "##":
            print("No")
            exit()
    for i in range(a, c):
        if s[i:i+2] == "##":
            print("No")
            exit()
    print("Yes")

elif c == d:
    print("No")

else:
    for i in range(b, d):
        if s[i:i + 2] == "##":
            print("No")
            exit()
    for i in range(a, c):
        if s[i:i + 2] == "##":
            print("No")
            exit()
    for i in range(b-1, d):
        if s[i:i+3] == "...":
            print("Yes")
            exit()
    print("No")

Measured memory_bytes: 3512
#include <iostream>
using namespace std;
long long N, K, A[1 << 18];
int main() {
cin >> N >> K;
for (int i = 1; i <= N; i++) cin >> A[i];
for (int i = K + 1; i <= N; i++) {
if (A[i - K] < A[i]) cout << "Yes" << endl;
else cout << "No" << endl;
}
return 0;
}

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

using namespace std;

#define REP(i,a,b) for(ll i = a; i < b; i++)
#define DB( x ) cout << #x << " = " << x << endl;
#define sz(s) ((int)((s).size()))
#define endl '\n'

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> pii;
typedef pair<int, pii> tri;
typedef vector <vector <ll>> matrix;
typedef pair<string, string> pss;

const ll mod = (ll)1e9 + 7;
const int MAX = (int)3e3 + 100;

const int oo = 0x3f3f3f3f;

int dp[MAX][MAX];

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

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

    for(int i = 1;i <= sz(a);++i){
        for(int j = 1;j <= sz(b);++j){
            if(a[i - 1] == b[j - 1])
                dp[i][j] = dp[i - 1][j - 1] + 1;
            else{
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
            }
        }
    }

    string ans = "";

    int i = sz(a), j = sz(b);

    while(1) {
        if(i <= 0 || j <= 0)
            break;
        if (i == 1 && j == 1) {
            if(a[i - 1] == b[j - 1])
                ans += a[i - 1];
            break;
        }

        if (dp[i][j] == dp[i - 1][j - 1] + 1 && a[i - 1] == b[j - 1]) {
            ans += a[i - 1];
            i--;
            j--;
        }
        else {
            if (dp[i][j] == dp[i - 1][j]) {
                i--;
            }
            else if (dp[i][j] == dp[i][j - 1]) {
                j--;
            }
        }
    }
    //cout << dp[sz(a)][sz(b)] << endl;
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}


Measured memory_bytes: 37120
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, A, B, C = LI()
    ABC = (A, B, C)
    l = [I() for _ in range(N)]

    # A, B, Cに使う、捨てる、の4通り
    ans = INF
    for i in itertools.product(range(4), repeat=N):
        a_cnt = i.count(0)
        b_cnt = i.count(1)
        c_cnt = i.count(2)
        if a_cnt > 0 and b_cnt > 0 and c_cnt > 0:
            # 合成魔法
            mp = 10 * (a_cnt + b_cnt + c_cnt - 3)
            # 延長短縮魔法
            len = [0] * 3
            for j in range(N):
                if 0 <= i[j] < 3:
                    len[i[j]] += l[j]
            mp += sum([abs(j - k) for j, k in zip(ABC, len)])
            ans = min(mp, ans)

    print(ans)

if __name__ == '__main__':
    resolve()


Measured memory_bytes: 10076
//
//  main.cpp
//  merge_sort
//
//  Created by ???????????? on 2017/10/08.
//  Copyright ?? 2017 ????????????. All rights reserved.
//

#include <iostream>
#include <stdio.h>
#include <cmath>
#include <climits>

using namespace std;

int ct = 0;

void merge(int S[], int left, int mid, int right){
    int i, j, k, n1, n2;
    n1 = mid - left;
    n2 = right - mid;
    int L[n1+1], R[n2+1];
    for (i = 0; i < n1; i++){
        L[i] = S[left+i];
    }
    for (i = 0; i < n2; i++){
        R[i] = S[mid+i];
    }
    L[n1] = INT_MAX;
    R[n2] = INT_MAX;

    
    i = 0;
    j = 0;
    
    for( k = left; k < right; k++ ){
        ct++;
        if(L[i] <= R[j]){
            S[k] = L[i];
            i++;
        }
        else{
            S[k] = R[j];
            j++;
        }
    }
    
    
}


void merge_sort(int S[], int left, int right){
    if (left+1 < right){
        int mid = (left + right)/2;
        merge_sort(S, left, mid);
        merge_sort(S, mid, right);
        merge(S, left, mid, right);
    }
}


int main(int argc, const char * argv[]) {
    int n, i;
    scanf("%d", &n);
    int S[n];
    for (i = 0; i < n; i++){
        scanf("%d", &S[i]);
    }
    merge_sort(S, 0, n);
    for (i = 0; i < n; i++){
        if(i)cout << " ";
        cout<<S[i];
    }
    cout << endl;
    cout << ct << endl;
    

    return 0;
}

Measured memory_bytes: 6908
#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,x,n) for(int i=x;i<n;i++)
#define mod 1000000007 //10^9+7
#define INF 1000000000000 //10^12
#define F first
#define S second
#define P pair<int,int>
#define all(vec) vec.begin(),vec.end()
//library begin
int gcd(int a,int b){
    if(a%b==0)return b;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a*b/gcd(a,b);
}
int log(int a){
    int b=a;
    int cnt=0;
    while(b%2==0){
        b/=2;
        cnt++;
    }
    return cnt;
}
int mypow(int a,int b){
    if(b==0)return 1;
    if(b==1)return a;
    int t=mypow(a,b/2);
    if(b%2==0)return t*t;
    return t*t*a;
}
//library end
int h;
int bin=1;
signed main(){
    cin>>h;
    while(bin<=h){
        bin*=2;
    }
    cout<<bin-1<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  bool a  =false;
  for (int i=0;i<s.size();i++){
    if(s.at(i)!=t.at(i)){
       a=true;}
  }
  if(a){cout<<"No"<<endl;}
  else {cout<<"Yes"<<endl;}
}
      


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define fi first
#define se second
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	//modcalc();

	int n, a, b;
	cin >> n >> a >> b;
	int ans = 0;
	ans += n / (a + b)*a;
	ans += min(a, (n % (a + b)));
	cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define MAX 10000
#define NIL -1

struct Node{
  /*
  p is parent
  l is left
  r is right
  */
  int p, l, r;
};

struct Node T[MAX];
int n;

void preOrder(int );
void inOrder(int );
void postOrder(int );

void preOrder(int u){
  if( u == NIL ) return;
  printf(" %d", u);
  preOrder(T[u].l);
  preOrder(T[u].r);
}

void inOrder(int u){
  if( u == NIL) return;
  inOrder(T[u].l);
  printf(" %d", u);
  inOrder(T[u].r);
}

void postOrder(int u){
  if( u == NIL ) return;
  postOrder(T[u].l);
  postOrder(T[u].r);
  printf(" %d", u);
}

int main(){
  int i, d, v, l, r;
  scanf("%d", &n);
  for(i = 0 ; i < n ; i++) T[i].p = NIL;

  for( i = 0 ; i < n ; i++){
    scanf("%d", &v);
    scanf("%d", &l);
    scanf("%d", &r);
    T[v].l = l;
    T[v].r = r;
    //親の設定
    if(l != NIL ) T[l].p = v;
    if(r != NIL ) T[r].p = v;
  }
for( i = 0 ; i < n ; i++){
    if( T[i].p == NIL ) d = i;
  }

  printf("Preorder\n");
  preOrder(d);
  printf("\n");
  printf("Inorder\n");
  inOrder(d);
  printf("\n");
  printf("Postorder\n");
  postOrder(d);
  printf("\n");

  return 0;
}



Measured memory_bytes: 2112
fn calc(s: &Vec<char>, t: &Vec<char>, base: usize) -> Option<String> {
    let mut ns = s.clone();
    for i in 0..t.len() {
        if s[i + base] != '?' && s[i + base] != t[i] {
            return None;
        }
    }
    for i in 0..t.len() {
        if ns[i + base] == '?' {
            ns[i + base] = t[i];
        }
    }
    for i in 0..ns.len() {
        if ns[i] == '?' {
            ns[i] = 'a';
        }
    }
    Some(ns.into_iter().collect::<String>())
}
fn main() {
    let s: Vec<char> = readln();
    let t: Vec<char> = readln();
    let n = (s.len() - t.len() + 1);
    let ans = (0..n)
        .filter_map(|i| calc(&s, &t, i))
        .min()
        .unwrap_or("UNRESTORABLE".to_string());
    println!("{}", ans);
}

// --- template ---
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};

pub trait FromLn {
    fn fromln(s: &str) -> Self;
}
pub fn readln<T: FromLn>() -> T {
    let mut buf = String::new();
    let _ = ::std::io::stdin().read_line(&mut buf).unwrap();
    T::fromln(buf.trim())
}
pub fn readlns<T: FromLn>(n: usize) -> Vec<T> {
    let mut vs = vec![];
    for _ in 0..n {
        vs.push(readln());
    }
    vs
}
macro_rules! fromln_primitives {
    ($($t:ty),*) => { $(
        impl FromLn for $t {
            fn fromln(s: &str) -> $t {
                s.parse().unwrap()
            }
        }
    )* }
}
fromln_primitives!(
    String,
    bool,
    f32,
    f64,
    isize,
    i8,
    i16,
    i32,
    i64,
    usize,
    u8,
    u16,
    u32,
    u64
);
impl<T> FromLn for Vec<T>
where
    T: FromLn,
{
    fn fromln(s: &str) -> Vec<T> {
        s.split_whitespace().map(T::fromln).collect()
    }
}
impl FromLn for Vec<char> {
    fn fromln(s: &str) -> Vec<char> {
        s.chars().collect()
    }
}
macro_rules! fromln_tuple {
    ($($t:ident),*) => {
        impl<$($t),*> FromLn for ($($t),*) where $($t: FromLn),* {
            fn fromln(s: &str) -> ($($t),*) {
                let mut it = s.split_whitespace();
                let t = ($($t::fromln(it.next().unwrap())),*);
                assert_eq!(it.next(), None);
                t
            }
        }
    }
}
fromln_tuple!(A, B);
fromln_tuple!(A, B, C);
fromln_tuple!(A, B, C, D);
fromln_tuple!(A, B, C, D, E);
fromln_tuple!(A, B, C, D, E, F);


Measured memory_bytes: 4352
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
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;}

const ll MOD = 1000000007;
const ll HIGHINF = (ll)1e18;


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n; cin >> n;
  vll x(n); REP(i, n) cin >> x[i];
  ll l, q; cin >> l >> q;
  vvll doubling(n, vll(31, 0));
  ll j;
  REP(i, n) {
    ll left=i, right=n;
    while (left<right) {
      ll mid = (left+right) / 2;
      if (x[mid]-x[i] <= l) left=mid+1;
      else right=mid;
    }
    doubling[i][0] = left-1;
  }

  REP(j, 30) {
    REP(i, n) {
      doubling[i][j+1] = doubling[doubling[i][j]][j];
    }
  }

  REP(_, q) {
    ll a, b; cin >> a >> b; a--; b--;
    if (a > b) swap(a, b);
    ll ans = 0;
    for (ll i=30; i>=0; i--) {
      if (doubling[a][i] < b) {
        ans += 1<<i;
        a = doubling[a][i];
      }
    }
    cout << ans+1 << '\n';
  }

  return 0;
}


Measured memory_bytes: 28928
#include <stdio.h>
#include <algorithm>
#define inf 10e8
typedef long long ll;

int main(void) {
  ll i, j, k, n, ans;
  scanf("%lld%lld", &n, &k);
  ans = n;
  ll d[n - 1], be, t;
  scanf("%lld", &be);
  for(i = 0; i < n - 1; ++i) {
    scanf("%lld", &t);
    d[i] = t - be - 1;
    be = t;
  }
  std::sort(d, d + n - 1);
  for(i = 0; i < n - k; ++i) ans += d[i];
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 3468
#include <iostream>
#include <tuple>
#include <vector>
using namespace std;
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); ++i)
const int INF = 1 << 30;

int main() {
  int N, ma, mb;
  cin >> N >> ma >> mb;
  int mincost = INF;
  vector<tuple<int, int>> x_minus, x_plus;
  int xmax = 0;
  REP(i, N) {
    int a, b, c;
    cin >> a >> b >> c;
    int x = a * mb - ma * b;
    if (x == 0) {
      mincost = min(mincost, c);
    } else if (x < 0) {
      x_minus.emplace_back(c, -x);
    } else {
      x_plus.emplace_back(c, x);
    }
    xmax = max(xmax, abs(x));
  }
  vector<int> dp_plus(xmax + 1, INF), dp_minus(xmax + 1, INF);
  dp_plus[0] = dp_minus[0] = 0;
  for (auto& cx : x_plus) {
    int ci = get<0>(cx), xi = get<1>(cx);
    for (int w = xmax - xi; w >= 0; --w) {
      dp_plus[w + xi] = min(dp_plus[w + xi], dp_plus[w] + ci);
    }
  }
  for (auto& cx : x_minus) {
    int ci = get<0>(cx), xi = get<1>(cx);
    for (int w = xmax - xi; w >= 0; --w) {
      dp_minus[w + xi] = min(dp_minus[w + xi], dp_minus[w] + ci);
    }
  }
  for (int w = 1; w <= xmax; ++w) {
    int wp = dp_plus[w], wm = dp_minus[w];
    if (wp != INF && wm != INF && mincost > wp + wm) {
      mincost = wp + wm;
    }
  }
  cout << (mincost == INF ? -1 : mincost) << endl;
}

Measured memory_bytes: 632
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <numeric>
using namespace std;
typedef long long int ll;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define rep(i, init, n) for(int i = init; i <(int)(n); i++)

int main() {

    int a, b, c, x;
    cin >> a >> b >> c >> x;
    int ans = 0;
    REP(i, a+1) REP(j, b+1) REP(k, c+1){
        int tmp = 500 * i + 100 * j + 50 * k;
        if (x == tmp) ans++;
    }

    cout << ans << endl;


    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
    int a, b, ans;
    char op;
    while(1) {
    scanf("%d %c %d", &a, &op, &b);
    switch (op) {
    case '+':
        ans = a + b;
        break;
    case '-':
        ans = a - b;
        break;
    case '*':
        ans = a * b;
        break;
    case '/':
        ans = a / b;
        break;
    case '\?':
        exit(0);
        break;
    }
    printf("%d\n",  ans);
    }
}



Measured memory_bytes: 2076
import java.util.Scanner;

public class Main {

	public static void main(String[] args){

		Scanner sc = new Scanner(System.in);

		String str = sc.nextLine();
		
		char first = str.charAt(0);
		char end = str.charAt(str.length()-1);

		
		System.out.print(first);
		System.out.print(str.length() - 2);
		System.out.println(end);
	}
}

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

using namespace std;

#define REP(i, N) for (int i = 0; i < (int)N; i++)
#define LOOP(i, N) for (int i = 1; i <= (int)N; i++)
#define RREP(i, N) for (int i =(int)N-1; i >= 0; i--)
#define RLOOP(i, N) for (int i =(int)N; i > 0; i--)
#define FOR(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

typedef long long ll;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;
int t[12][12];
int c[12];
int n,m,x;
vector<int> v;
bool judge(int z[]){
  REP(i,m){
    if(z[i]<x){
      return false;
    }
  }
  return true;
}
void dfs(int i,int ans,int sum[]){
  //cout<<i<<" "<<ans<<tmp<<endl;
  if(i==n){
    if(judge(sum)){
      v.push_back(ans);
    }
  }else{
    dfs(i+1,ans,sum);
    int z[12];
    memset(z,0,sizeof(z));
    REP(j,m){
      z[j]+=sum[j];
      z[j]+=t[i][j];
    }
    dfs(i+1,ans+c[i],z);
  }
}
  /*
  REP(i,n){
    cout<<sum[i]<<endl;
  }

  if(dfs(i+1,ans,sum)){

    REP(i,n){
      cout<<sum[i]<<endl;
    }

    return true;
  }
  int z[12];
  memset(z,0,sizeof(z));
  REP(j,m){
    z[j]+=sum[j];
    z[j]+=t[i][j];
  }
  if(dfs(i+1,ans+c[i],z)){

    REP(i,n){
      cout<<z[i]<<endl;
    }

    return true;
  }
  return false;
}
*/
int main(){
  cin>>n>>m>>x;
  int sum[12];
  memset(sum,0,sizeof(sum));
  REP(i,n){
    cin>>c[i];
    REP(j,m){
      cin>>t[i][j];
    }
  }
  dfs(0,0,sum);
    if(!v.empty()){
    sort(ALL(v));
    cout<<v[0]<<endl;
    }else{
    cout<<-1<<endl;
  }

}

Measured memory_bytes: 3636
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<endl
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), n)
#define ub(v,n) upper_bound(v.begin(), v.end(), n)
//#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")

template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
//typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-12;
const ll INF = 1e16;

void solve() {
	int N; cin >> N;
	print(N*N);
}

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

	solve();

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define tc(t) int t;cin >> t; while(t--)
#define pb push_back
#define fi first
#define se second
#define debug1(x) cerr << #x << " = " << x << '\n';
#define debug2(x, y) cerr << #x << " = " << x << "   " << #y << " = " << y << "\n";
#define _ ios_base::sync_with_stdio(0);cin.tie(NULL);
 
int main() {_
    ll n;
    cin >> n;
    ll dp[n][3] = {};
    for(int i = 0; i<n; i++) {
        ll a, b, c;
        cin >> a >> b >> c;
        if(i == 0) {
            dp[i][0] = a;
            dp[i][1] = b;
            dp[i][2] = c;
        }
        else {
            dp[i][0] = a + max(dp[i-1][1], dp[i-1][2]);
            dp[i][1] = b + max(dp[i-1][0], dp[i-1][2]);
            dp[i][2] = c + max(dp[i-1][0], dp[i-1][1]);
        }
    }
    cout << max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]));
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,x;
    cin >> N >> x;
    int a[N];
    for(int i = 0; i <  N; i++){
        cin >> a[i];
    }
    sort(a,a+N);
    int ans = 0;
    for(int i = 0; i < N-1; i++){
        if(x >= a[i]){
            x -= a[i];
            ans ++;
        }else{
            break;
        }
    }
    if(x == a[N-1]) ans++;
    cout << ans << endl;
}

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

#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

int main() {
  ll a, b, k;
  cin >> a >> b >> k;

  set<ll> ans;
  for (long i = 1; i <= k && a + i - 1 <= b; i++) {
    ans.insert(a + i - 1);
  }

  for (long i = 1; i <= k && b - i + 1 >= a; i++) {
    ans.insert(b - i + 1);
  }
  for (auto x : ans) {
    cout << x << endl;
  }
}


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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

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

ll dp[2100][2100];

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

  int n;
  cin >> n;
  vector<pair<ll, int>> a(n);


  rep(i, n){
    ll tmp;
    cin >> tmp;
    a[i] = make_pair(tmp, i);
  }
  sort(a.rbegin(), a.rend());

  rep(i, n+1){
    rep(j, n+1){
      dp[i][j] = 0;
    }
  }

  rep(i, n){
    rep(j, i+1){

      chmax(dp[i+1][j+1], dp[i][j] + a[i].first * abs(a[i].second - j));
      chmax(dp[i+1][j],   dp[i][j] + a[i].first  * abs(n-1-(i-j) - a[i].second));

    }
  }

  ll ans = 0;
  rep(i, n+1){
    chmax(ans, dp[n][i]);
  }

  cout << ans << endl;



  return 0;
}


Measured memory_bytes: 36516
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main(){
  int n,k;
  cin >> n >> k;
  int a;
  int ans=0;
  rep(i,n){
    cin >> a;
    if((k+(k-1)*i)>=n){
      ans=1+i;
      cout << ans <<endl;
      return 0;
    }
  }
  return -1;
}

Measured memory_bytes: 256
def main():
    n,k = map(int,input().split(" "))
    l =[True]*n
    for i in range(k):
        d = int(input())
        As = list(map(int,input().split(" ")))
        for A in As:
            l[A-1] = False
    
    print(l.count(True))
main()

Measured memory_bytes: 9116
#include <string>
#include <iostream>
#include <vector>
#include <stack>
#include <math.h>
#include <iomanip>
#include <queue>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define WHITE 0
#define GRAY 1
#define BLACK 2
#define MAX 100000
#define LARGENUM 1000000007
#define INF 9223372036854775807
#define ull unsigned long long 
typedef pair <ull, int> P;

int main(){
    ull A, B, ans;
    string b, tmp;
    cin >> A >> b;
    for (int i = 1; i <= 2; i++) b[i] = b[i + 1];
    b[3] = 0;
    B = stoi(b);
    ans = A * B;
    tmp = to_string(ans);
    if (tmp.size() > 2){
        rep(i, tmp.size() - 2) {
            cout << tmp[i];
        }
    }
    else cout << 0;
    cout << endl;
    return 0;
}


Measured memory_bytes: 3696
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest
{
    class Abc75B
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int h = int.Parse(input[0]);
            int w = int.Parse(input[1]);
            int[,] array = new int[h, w];

            for (int i = 0; i < h; i++)
            {
                string input2 = Console.ReadLine();
                for (int j = 0; j < w; j++)
                {
                    if (input2[j] == '.')
                    {
                        array[i, j] = 0;
                    }
                    else
                    {
                        array[i, j] = -1;
                    }
                }
            }

            for (int y = 0; y < h; y++)
            {
                string s = "";
                for (int x = 0; x < w; x++)
                {
                    if (array[y, x] == 0)
                    {
                        array[y, x] = CheckBomb(x, y, w, h, array);
                    }
                    if (array[y, x] == -1)
                    {
                        s += "#";
                    }
                    else
                    {
                        s += array[y, x].ToString();
                    }
                }
                Console.WriteLine(s);
            }
        }

        static int CheckBomb(int x, int y, int w, int h, int[,] array)
        {
            int cnt = 0;
            for (int nY = y - 1; nY <= y + 1; nY++)
            {
                for (int nX = x - 1; nX <= x + 1; nX++)
                {
                    if (nY < 0 || h <= nY
                        || nX < 0 || w <= nX
                        || (nX == x && nY == y)) continue;
                    if (array[nY, nX] == -1) cnt++;
                }
            }
            return cnt;
        }
    }
}

Measured memory_bytes: 11092
# coding: utf-8
# Your code here!
N=int(input())
A=list(map(int,input().split()))

ans=1000
champ=10**9
for i in range(-100,101):
    temp=0
    for item in A:
        temp+=(i-item)**2
    if temp<champ:
        champ=temp

print(champ)


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

int main(){
  int N;
  cin>>N;
  vector<int> X(N);
  int ave=0;
  for(int i=0;i<N;i++){
    cin>>X.at(i);
    ave+=X.at(i);
  }
  ave/=N;
  int ans1=0;
  for(int i=0;i<N;i++){
    ans1+=(X.at(i)-ave)*(X.at(i)-ave);
  }

  ave++;
  int ans2=0;
  for(int i=0;i<N;i++){
    ans2+=(X.at(i)-ave)*(X.at(i)-ave);
  }
  int ans=min(ans1,ans2);
  cout<<ans<<endl;
}


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

int main(void)
{
  int at[5];
  int k;
  for(int i=0;i<5;i++){
    cin>>at[i];
  }
  cin>>k;
  if(at[4]-at[0]<=k)
    cout<<"Yay!"<<endl;
  else
    cout<<":("<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long N; 
  cin >> N;
  for(int i=0;i<50001;i++){
    if((i+1)*27/25 == N){
      cout << i+1 << endl;
      return 0;
    }
  }
  cout << ":(" << endl;
}


Measured memory_bytes: 3648
#include <stdio.h>
#include <stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
  unsigned short *A, *B;
  int C[VMAX+1];
  int n, i, j;

  scanf("%d", &n);

  A = malloc(sizeof(short)*n+1);
  B = malloc(sizeof(short)*n+1);

  /* your code */

for(i = 0; i <= VMAX; i++) C[i] = 0;

  for(i = 0; i < n; i++){
    scanf("%hu",&A[i + 1]);
    C[A[i + 1]]++;
  }
  for(i = 1; i <= VMAX; i++) C[i] = C[i] + C[i - 1];

  for(j = 1; j <= n; j++){
    B[C[A[j]]] = A[j];
    C[A[j]]--;
  }

  for(i = 1; i <= n; i++){
    if(i > 1) printf(" ");
    printf("%d",B[i]);
  }
  printf("\n");

  return 0;
}




Measured memory_bytes: 9700
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.A
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var (a, b) = Read2Longs();
            return a * b;
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


Measured memory_bytes: 28196
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define MV 200001
#define LMV 21
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define emp emplace
#define mp make_pair
#define ins insert
#define sz(x) (int)x.size()
#define whoami(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); whi(_it, args); }

void whi(istream_iterator<string> it) { cerr<<"\n"; }

template<typename T, typename... Args>
void whi(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<" "<<a<<" "; whi(++it, args...); }

void FLASH() {ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
void SETF() {cout.ios_base::setf(ios_base::fixed); cerr.ios_base::setf(ios_base::fixed);}
void UNSETF() {cout.ios_base::unsetf(ios_base::fixed); cerr.ios_base::unsetf(ios_base::fixed);}

typedef long long ll;
typedef long double ld;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef pair<PII, int> PPII;
typedef pair<PLL, ll> PPLL;
typedef map<int, int> MII;

const int MOD = 1000000007;
const ll INF = 4e18;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T>
using ordered_multiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

struct h_llint {
  static uint64_t splitmix64(uint64_t x) {    // http://xorshift.di.unimi.it/splitmix64.c
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};

struct h_pair{
  size_t operator()(const PLL&x)const{
    return hash<ll>()(((ll)x.ff)^(((ll)x.ss)<<32));
  }
};

typedef map<ll, ll> MLL;
typedef map<PII, int> MPII;
typedef map<PLL, ll> MPLL;
typedef set<int> SI;
typedef set<ll> SL;
//ordered_set = order_of_key(.)
//ordered_set = find_by_order(.)
typedef ordered_set<int> OSI;
typedef ordered_set<ll> OSL;
typedef ordered_multiset<int> MOSI;
typedef ordered_multiset<ll> MOSL;
typedef unordered_map<ll, int, h_llint> UMLI;
typedef unordered_map<ll, ll, h_llint> UMLL;
typedef unordered_map<PLL, int, h_pair> UMPI;
typedef unordered_map<PLL, ll, h_pair> UMPL;

int ar[MV];
ll arr[MV];

void solve(int T)
{
	int x;
	cin>>x;
	if(x >= 30)
	cout<<"Yes\n";
	else cout<<"No\n";
	return;	
}

int main(void)
{
	FLASH();
	//freopen("cowjog.in", "r", stdin);
	//freopen("cowjog.out", "w", stdout);
	int T;
	T = 1;

#ifndef ONLINE_JUDGE
	time_t time_t1, time_t2;
	time_t1 = clock();
#endif

	//cin>>T;
	while(T--)
	solve(T);

#ifndef ONLINE_JUDGE
	time_t2 = clock();
	SETF();
	cerr<<"Time taken: "<<setprecision(7)<<(time_t2 - time_t1)/(double)CLOCKS_PER_SEC<<"\n";
	UNSETF();
#endif

	return 0;
}

Measured memory_bytes: 3608
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author Jaynil
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        DDigitsParade solver = new DDigitsParade();
        solver.solve(1, in, out);
        out.close();
    }

    static class DDigitsParade {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            String x = in.next();
            int dp[][] = new int[x.length() + 1][13];
            dp[0][0] = 1;
            long mod = 1000000007;
            for (int i = 0; i < x.length(); i++) {
                if (x.charAt(i) != '?') {
                    int k = Integer.parseInt(Character.toString(x.charAt(i)));
                    for (int j = 0; j < 13; j++) {
                        dp[i + 1][((10 * j + k) % 13)] += dp[i][j];
                        dp[i + 1][((10 * j + k) % 13)] %= mod;
                    }
                } else {
                    for (int k = 0; k < 10; k++) {
                        for (int j = 0; j < 13; j++) {
                            dp[i + 1][((10 * j + k) % 13)] += dp[i][j];
                            dp[i + 1][((10 * j + k) % 13)] %= mod;
                        }

                    }
                }
            }
            out.println(dp[x.length()][5]);
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



Measured memory_bytes: 33620
import itertools

n, m = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(lambda x: int(x) - 1, input().split())
    edges[a].append(b)
    edges[b].append(a)

count = 0
for perm in itertools.permutations(range(1, n)):
    if not perm[0] in edges[0]:
        continue
    can_visit_all = True
    for i in range(n - 2):
        if not perm[i + 1] in edges[perm[i]]:
            can_visit_all = False
            break
    if can_visit_all:
        count += 1
print(count)


Measured memory_bytes: 9140
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <cstring>

using namespace std;

#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)

typedef long long ll;

int c[10];

int main(){
	int n;
	
	while (cin >> n, n){
		REP(i,10) c[i] = 0;
		
		REP(i,n){
			int a;
			
			scanf("%d", &a);
			
			c[a]++;
		}
		
		REP(i,10){
			if (c[i] == 0) printf("-\n");
			else {
				REP(j,c[i]) printf("*");
				puts("");
			}
		}
	}
	
	return 0;
}

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

class Main {
    public static void main( String args[] ) throws IOException {
    	int x = 0;
		int n = 0;
		String s = "";

    	int max = x;

		Scanner scan = new Scanner( System.in );

		n = scan.nextInt();
		s = scan.next();

		String c;
		for( int i = 0 ; i < n ; i++ ){
			c = s.substring( i , i + 1 );
			if( c.equals( "I" ) ){
				x++;
			}
			else{
				x--;
			}

			if( x > max ){
				max = x;
			}
		}

        System.out.println( max );
    }
}


Measured memory_bytes: 8916
#include<bits/stdc++.h>
using namespace std;
const int N=200010,mo=1000000007;
int A[N],Sum[N],dp[N];
int main(){
	int n,i,h=0;
	scanf("%d",&n);
	for (i=1;i<=n;i++){
		scanf("%d",&A[i]);
		if (A[i]!=A[h]){
			A[++h]=A[i];
		}
	}
	dp[0]=1;
	for (i=1;i<=h;i++){
		dp[i]=(dp[i-1]+Sum[A[i]])%mo;
		Sum[A[i]]=(Sum[A[i]]+dp[i-1])%mo;
	}
	printf("%d\n",dp[h]);
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 10000
#define MAP 100
#define Pair pair<int,int>

int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, -1, 0, 1};
int main(){
    ll n; cin >> n;
    ll a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a,a+n);
    ll gcd;
    ll s = a[0], t = a[1];
    ll u = s%t;
    while(u!=0){
        s = t;
        t = u;
        u = s%t;
    }
    gcd = t;
    for(ll i = 1; i < n-1; i++){
        ll x,y,tmp;
        x = a[i+1];
        y = gcd;
        ll r = x%y;
        while(r != 0){
            x = y;
            y = r;
            r = x%y;
        }
        gcd = y;
    }
    cout << gcd << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
using namespace std;

int main()
{
	int N;
	cin >> N;
	int A[2][100];
	for (auto i = 0; i < 2; ++i)
	{
		for (auto j = 0; j < N; ++j)
		{
			cin >> A[i][j];
		}
	}

	int sum[2][100];
	memset(sum, 0, sizeof(sum));
	sum[0][0] = A[0][0];
	sum[1][N - 1] = A[1][N - 1];
	for (auto j = 1; j < N; ++j)
	{
		sum[0][j] = sum[0][j - 1] + A[0][j];
		sum[1][N - j - 1] = sum[1][N - j] + A[1][N - j - 1];
	}

	auto result = 0;
	for (auto i = 0; i < N; ++i)
	{
		auto temp = sum[0][i] + sum[1][i];
		result = max(result, temp);
	}

	cout << result << endl;

	return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func main() {
	var n int
	fmt.Scan(&n)

	A := [2][]int{}
	for i := range A {
		A[i] = make([]int, n)
		for j := range A[i] {
			fmt.Scan(&A[i][j])
		}
	}
	ans := 0
	for i := range make([]struct{}, n) {
		cnt := 0
		for j := 0; j <= i; j++ {
			cnt += A[0][j]
		}
		for j := i; j < n; j++ {
			cnt += A[1][j]
		}
		ans = max(ans, cnt)
	}
	fmt.Println(ans)
}


Measured memory_bytes: 512
#include <iostream>
#include <cstdio>
#include <algorithm>
#define N 100005
using namespace std;

int n, c, k, cnt, ans, mx, a[N];
int main()
{
	int i;
	cin >> n >> c >> k;
	for (i = 0; i < n; i++) scanf("%d", &a[i]);
	sort(a, a + n);
	for (i = 0, cnt = c; i < n; i++) {
		if (cnt == c || mx < a[i]) ans++, cnt = 0, mx = a[i] + k;
		cnt++;
	}
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    long long n;
    std::cin >> n;
    std::vector<long long> a(n), b(n), c(n), bc(n);
    for (auto i = 0ll; i < n; i++) std::cin >> a[i];
    for (auto i = 0ll; i < n; i++) std::cin >> b[i];
    for (auto i = 0ll; i < n; i++) std::cin >> c[i];
    std::sort(a.begin(), a.end());
    std::sort(b.begin(), b.end());
    std::sort(c.begin(), c.end());

    auto ret = 0ll;

    bc[0] = (std::lower_bound(a.begin(), a.end(), b[0]) - a.begin());
    for (auto i = 1ll; i < n; i++) {
        bc[i] = (std::lower_bound(a.begin(), a.end(), b[i]) - a.begin()) + bc[i - 1];
    }

    for (auto el : c) {
        auto diffb = std::lower_bound(b.begin(), b.end(), el) - b.begin();
        if (diffb > 0) ret += bc[diffb - 1];
    }
    std::cout << ret << std::endl;

    return 0;
}

Measured memory_bytes: 3328
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

template<class T>
inline bool chmax(T& x, T y){
    if(x < y){
        x = y;
        return true;
    }
    return false;
}
template<class T>
inline bool chmin(T& x, T y){
    if(x > y){
        x = y;
        return true;
    }
    return false;
}

ll dp[305][305][305];

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

    int N, K;
    cin >> N >> K;
    vector<int> H(N + 1, 0);
    for(int i = 1; i <= N; ++i) cin >> H[i];

    constexpr ll inf = 1e+17;
    for(int i = 0; i <= N; ++i){
        for(int j = 0; j <= N; ++j){
            for(int k = 0; k <= K + 1; ++k){
                dp[i][j][k] = inf;
            }
        }
    }
    dp[0][0][0] = 0;
    for(int i = 1; i <= N; ++i){
        for(int j = 0; j < i; ++j){
            for(int k = 0; k <= min(i - 1, K); ++k){
                if(dp[i - 1][j][k] == inf)  continue;
                chmin(dp[i][j][k + 1], dp[i - 1][j][k]);
                chmin(dp[i][i][k], dp[i - 1][j][k] + max(0, H[i] - H[j]));
            }
        }
    }

    ll ans = inf;
    for(int i = 0; i <= N; ++i){
        for(int j = 0; j <= K; ++j){
            chmin(ans, dp[N][i][j]);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 220528
#include<iostream>

using namespace std;

int main (void) {
  int in, out, target;

  cin >> in >> out >> target;

  int count = 0;

  for(int i = in; i <= out; ++i) {
    if (target % i == 0) {
      count++;
    }
  } 

  cout << count << endl;
}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n, k, c; vector<int> a, b;
    cin>>n>>k>>c;
    string s;
    cin>>s;
    for(int i = 0; i < n; i++) if(s[i] == 'o') {a.push_back(i); i+=c;};
    for(int i = n-1; i >= 0; i--) if(s[i] == 'o') {b.push_back(i); i-=c;};
    for(int i = 0; i < k; i++) if(a[i] == b[k-i-1]) {cout<<a[i] + 1<<'\n';};
    return 0;
}

Measured memory_bytes: 5740