akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>

#define rep(i,n) for(int i=0;i<(n);i++)
#define INF (1<<29)
#define Cost first.first
#define Dir first.second
#define X second.first
#define Y second.second

using namespace std;

typedef pair<int,int> p2;
typedef pair<p2,p2> p4;

int w,h,g[4][31][31],s[31][31],c[4];
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int dijkstra(){

  priority_queue<p4,vector<p4>, greater<p4> >que;

  fill(*g[0],*g[4],INF);
  g[0][0][0]=0;
  
  p4 st = p4(p2(0,0),p2(0,0));
  que.push(st);

  bool fg=false;

  while(!que.empty()){
    p4 now = que.top();
    que.pop();

    if(now.Y==h-1 && now.X==w-1)return now.Cost;    
    if(g[now.Dir][now.Y][now.X]<=now.Cost && fg)continue;
    fg=true;
    g[now.Dir][now.Y][now.X]=now.Cost;
    
    rep(d,4){
      p4 next;
      next.Dir=(now.Dir+d)%4;
      next.X=now.X+dx[next.Dir],next.Y=now.Y+dy[next.Dir];
      if(0<=next.X && next.X<w && 0<=next.Y && next.Y<h){
	next.Cost=now.Cost+c[d]*(s[now.Y][now.X]!=d);
	que.push(next);
      }
    }
  }
  return -1;
}

int main(void){
  
  while(cin >> w >> h,w|h){
    rep(i,h)rep(j,w)cin >> s[i][j];
    rep(i,4)cin >> c[i];
    cout << dijkstra() << endl;
  }
  return 0;
}

Measured memory_bytes: 1348
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		int x, y, b, p; cin >> x >> y >> b >> p;
		cout << min(x*b + y*p, x*max(5, b) * 4 / 5 + y*max(p, 2) * 4 / 5) << endl;
	}
}

Measured memory_bytes: 3080
n, m = map(int, raw_input().split())
x0 = min(max(int(m / 4. - n / 2.), 0), m / 2)
print max(min(n + x, (m - 2 * x) / 2) for x in xrange(x0 - 5, x0 + 5) if 0 <= x <= m / 2)


Measured memory_bytes: 2568
#![allow(unused_mut)]
#![allow(non_snake_case)]
#![allow(unused_imports)]
use std::iter::Extend;
use std::collections::HashSet;
use std::collections::HashMap;
use std::collections::BTreeSet;
use std::cmp::{max, min};

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}
fn main() {
    input! {
        n: usize,
        txy: [(i64, i64, i64); n],
    }
    let mut v = vec![(0, 0, 0)];
    let mut d = vec![0;n];
    let mut t = vec![0;n];
    v.extend(&txy);
    for i in 0..n {
        let x = i64::abs(v[i].1 - v[i+1].1);
        let y = i64::abs(v[i].2 - v[i+1].2);
        d[i] = x + y;
        t[i] = i64::abs(v[i].0 - v[i+1].0);
    }
    for i in 0..n {
        if t[i] - d[i] >= 0 && (t[i] - d[i]) % 2 == 0 {
        } else {
            println!("No");
            return;
        }
    }
    println!("Yes");
}

Measured memory_bytes: 16636
#include<stdio.h>

int main(void)
{
  int a,b,c,t=0;

  scanf("%d %d %d",&a,&b,&c);

  if(a>b)
    {
      t=a;
      a=b;
      b=t;
    }
  if(b>c)
    {
      t=b;
      b=c;
      c=t;
    }
  if(a>b)
    {
      t=a;
      a=b;
      b=t;
    }
  printf("%d %d %d\n",a,b,c);
}




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

int main() {
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());

    int N, T;
    cin >> N >> T;
    vector<int> c(N), t(N);
    for (int i = 0; i < N; i++) {
        cin >> c[i] >> t[i];
    }

    int min_cost = 1001;
    for (int i = 0; i < N; i++) {
        if(t[i] <= T) {
            if(c[i] < min_cost) {
                min_cost = c[i];
            }
        }
    }

    if (min_cost > 1000) {
        cout << "TLE" << endl;
    } else {
        cout << min_cost << endl;
    }

}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int N;
  scanf("%d",&N);
  unsigned long sum=0;
  int i;
  for(i=1;i<N+1;i++){
    if((i%3!=0)&&(i%5!=0)){
      sum=sum+i;
    }
  }
  printf("%lu",sum);
  return 0;
}


Measured memory_bytes: 1728
import itertools,sys
def I(): return int(sys.stdin.readline().rstrip())
N = I()
dp = [float('INF')]*(N+1)
dp[0] = 0
for i in range(N+1):
    if i+1<=N:
        dp[i+1] = min(dp[i+1],dp[i]+1)
    num6,num9 = 6,9
    while i+num6<=N:
        dp[i+num6] = min(dp[i+num6],dp[i]+1)
        num6 *= 6
    while i+num9<=N:
        dp[i+num9] = min(dp[i+num9],dp[i]+1)
        num9 *=9
print(dp[-1])


Measured memory_bytes: 3828
#include <bits/stdc++.h>
#include <unistd.h>
#include <random>

using namespace std;
typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;

int main(){
//    random_device rnd;
//    mt19937 mt(rnd());
      cin.tie(0);
      ios::sync_with_stdio(false);
      int H, W;
      cin >> H >> W;
      vector<vector<int>> coins (H,vector<int>(W));
      for(int i = 0;i < H;i++){
          for(int j = 0;j < W;j++){
              cin >> coins[i][j];
          }
      }

      vector<pair<pair<int,int>,pair<int,int>>> move (H*W);
      int move_count = 0;
      for(int i = 0;i < H;i++){
          for(int j = 0;j < W;j++){
              if(i < H-1){
                  if(coins[i][j] % 2 != 0){
                      coins[i][j]--;
                      coins[i+1][j]++;
                      move[move_count].first = make_pair(i+1,j+1);
                      move[move_count].second = make_pair(i+2,j+1);
                      move_count++;
                  }
              }
              else{
                  if(coins[i][j] % 2 != 0 && j < W-1){
                      coins[i][j]--;
                      coins[i][j+1]++;
                      move[move_count].first = make_pair(i+1,j+1);
                      move[move_count].second = make_pair(i+1,j+2);
                      move_count++;
                  }
              }
          }
      }

      cout << move_count << endl;
      for(int i = 0;i < move_count;i++){
          cout << move[i].first.first << " " << move[i].first.second << " " << move[i].second.first << " " << move[i].second.second << endl;
      }
}


Measured memory_bytes: 7040
N, x = map(int, input().split())
As = list(map(int, input().split()))

ans = float('inf')
costs = list(As)
for i in range(N):
    ans = min(ans, sum(costs) + x * i)
    costs = list(map(min, zip(costs, As[-i-1:] + As[:-i-1])))

print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define INF 1000000000000000001
#define ll long long
#define pll pair<ll, ll>
using namespace std;


int main()
{
  ll N;
  cin >> N;
  vector<tuple<ll, ll, ll>> slp(N);
  for (ll i = 0; i < N; ++i)
  {
    ll s, l, p;
    cin >> s >> l >> p;
    slp.at(i) = make_tuple(s, l, p);
  }
  vector<ll> dp(394, -1);
  dp.at(0) = 0;
  for (ll i = 0; i < 394; ++i)
  {
    for (ll j = 0; j < N; ++j)
    {
      if (dp.at(i) == -1)
      {
        continue;
      }
      ll s = get<0>(slp.at(j)), l = get<1>(slp.at(j)), p = get<2>(slp.at(j));
      for (ll k = s; k < l + 1; ++k)
      {
        if (i + k > 393)
        {
          break;
        }
        dp.at(i + k) = max(dp.at(i + k), dp.at(i) + p);
      }
    }
  }
  ll m;
  cin >> m;
  bool wrong = false;
  vector<ll> ws(m);
  for (ll i = 0; i < m; ++i)
  {
    ll w;
    cin >> w;
    ws.at(i) = w;
    if (dp.at(w) == -1)
    {
      wrong = true;
    }
  }
  if (wrong)
  {
    cout << -1 << endl;
  }
  else
  {
    for (ll i = 0; i < m; ++i)
    {
      cout << dp.at(ws.at(i)) << endl;
    }
  }
}



Measured memory_bytes: 3124
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <string>
#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>

using namespace std;

// ---------------------
// repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

// debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

// ---------------------
#define INF 922337203685477580
#define IINF (1<<21)
typedef long long ll;

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

  int dp[N + 10][W + 10];
  int vi[N + 1];
  int wi[N + 1];

  REP(i, N) {
    cin >> vi[i + 1] >> wi[i + 1];
  }

  REP (w, W + 1) {
    REP (i, N + 1) {
      dp[i][w] = 0;
    }
  }
  for (int i = 1; i <= N; i++) {
    for (int w = 0; w <= W; w++) {
      if (w - wi[i] < 0) {
        dp[i][w] = dp[i - 1][w];
        continue;
      }
      dp[i][w] = max(dp[i - 1][w], dp[i - 1][w - wi[i]] + vi[i]);
    }
  }

  // REP (i, N + 1) {
  //   REP (w, W + 1) {
  //     if (w) cout << " ";
  //     cerr << dp[i][w];
  //   }
  //   cerr << endl;
  // }

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

Measured memory_bytes: 7040
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
signed main(void){
    int n,x; cin>>n>>x;
    int ma = 2*n-1;
    int mid = ma/2 +1;
    //cout<<mid<<endl;
    if(x==1|| x==ma) {cout<<"No"<<endl; return 0;}
    vector <int> a(2*n-1, 114514); 
    a[mid-1] = x;
    a[mid-2] = 1, a[mid] = ma;
    priority_queue <int> pq;
    for(int i=2;i<ma;i++){
        if(i==x) continue;
        pq.push(i);
        //cout<<i<<endl;
    }
    int l=0;
    while(a[l]==114514){
        int tmp = pq.top(); pq.pop();
        a[l++] = tmp;
    }
    int r = ma-1;
    while(a[++mid] == 114514){
        if(mid>=ma) break;
        a[mid] = pq.top(); pq.pop();
    }
    cout<<"Yes"<<endl;
    rep(i,ma) cout<<a[i]<<endl;
}


Measured memory_bytes: 4720
#include <stdio.h>
#include <iostream>
#include <string>
using namespace std;


int main () {

const int num_class = 9;

string classname[num_class];
int am[num_class];
int pm[num_class];
int sum_mem[num_class];
int sum_syu[num_class];

for (int i = 0 ; i < num_class;i++) {
    cin >> classname[i] >> am[i] >> pm[i];
    // cout << classname[i] << " " << am[i] << " " << pm[i] << "\n";

    sum_mem[i] = am[i] + pm[i];
}



for (int i = 0;i < num_class;i++) {

    sum_syu[i] = 0;

    if (am[i] <= 400) {
    sum_syu[i] +=  am[i] * 200;
    }
    else {
    sum_syu[i] +=  400 * 200;
    }


    if (pm[i] <= 400) {
    sum_syu[i] +=  pm[i] * 300;
    }
    else {
     sum_syu[i] +=  400 * 300;
    }

    cout << classname[i] << " " << sum_mem[i] << " " << sum_syu[i] << "\n";

}


  return 0;
}

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

int main(){
  int N , K ;
  long long ans=0;
  cin >> N >> K ;
  vector<long long> A(300000);
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  sort(A.begin(),A.end());
  reverse(A.begin(),A.end());
  
  for(int i=K;i<N;i++){
    ans += A[i];
             }
             
   cout << ans << endl;
             }
             



Measured memory_bytes: 2560
from functools import lru_cache

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

cost = [None] * N
cost[0] = 0
cost[1] = abs(h[1]-h[0])
for i in range(2, N):
  cost[i] = min(cost[i-1]+abs(h[i]-h[i-1]), cost[i-2]+abs(h[i]-h[i-2]))
print(cost[N-1])
# print(cost)

"""
@lru_cache(maxsize=None)
def rec(n):
  # print(n)
  if n == 1:
    return 0
  elif n == 2:
    return abs(h[1]-h[0])
  else:
    return min(rec(n-1)+abs(h[n-1]-h[n-2]), rec(n-2)+abs(h[n-1]-h[n-3]))

print(rec(N))
"""

Measured memory_bytes: 14476
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
using namespace std;

/*----------macros----------*/

//output================
#define endl '\n'
#define fcout cout << fixed << setprecision(15)

//typedef===============
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<ll, ll> Pll;

//const number==========
constexpr ll INF9   = (ll)1e9 + 1;
constexpr ll INF18  = (ll)1e18 + 1;
constexpr ll MOD    = 1000000007;
constexpr ld PI     = 3.141592653589793L;

//member================
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

//others================
#define all(x)          (x).begin(), (x).end()
#define rall(x)         (x).rbegin(), (x).rend()
#define rep(i, n)       for(int i = 0; (i) < (int)(n); (i)++)
#define rrep(i, n)      for(int i = n - 1; (i) >= 0 ; (i)--)
#define For(i, a, b)    for(int i = (a); (i) < (int)(b) ; (i)++)
#define CtoI(c)         int((c)) - int('0')

//functions=============
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

//vector<int> dx = {1, 0, -1, 0}, dy = {0, 1, 0, -1};
//vector<int> dx2 = { 1,1,0,-1,-1,-1,0,1 }, dy2 = { 0,1,1,1,0,-1,-1,-1 };



/*--------additional--------*/



/*----------main------------*/

int main() {
/*----------fastio----------*/
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);
/*----------solve-----------*/

    int a, b, c; cin >> a >> b >> c;
    if((a == b && b == c && c == a) || (a != b && b != c && c != a)) cout << "No" << endl;
    else cout << "Yes" << endl;

return 0;
}

Measured memory_bytes: 3584
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String str = "Case ";
		String delimeter = ": ";

		for (int i = 1; sc.hasNextInt(); i++) {
			int testCase = sc.nextInt(); 
			if (testCase == 0) {
				break;
			} 
			System.out.println(str + i + delimeter + testCase);
		}
	}
}

Measured memory_bytes: 43660
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main() {
    int n;
    bool flag=false;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    cout << a[n-1]-a[0] <<endl;
}


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

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

ll N, K, res;
std::map< ll, ll > mp;

int main() {
    std::cin >> N >> K;
    for (int i=0; i<N; ++i) {
        ll a, b;
        std::cin >> a >> b;
        if (mp.find(a) == mp.end()) {
            mp[a] = b;
        } else {
            mp[a] += b;
        }
    }
    std::map< ll, ll >::iterator itr = mp.begin();
    while (K > 0) {
        if (itr->second >= K) {
            res = itr->first;
            break;
        }
        K -= itr->second;
        ++itr;
    }
    std::cout << res << std::endl;
    return 0;
}

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

using namespace std;

 
int main() {
    int n,h;

    cin >> h >> n;

    vector<int>a(n);

    for(int i = 0;i < n;i++){
        cin >> a.at(i);
    }

    int aa = accumulate(a.begin(),a.end(),0);
    
    if(aa >= h){
        cout << "Yes";
    }else{
        cout << "No";
    }

    }

Measured memory_bytes: 640
#include "bits/stdc++.h"
// Custom Header {{{
#define all(x)      x.begin(), x.end()
#define rep(i,n)    for (i64 i = 0; i < (n); ++i)
#define reps(i,s,t) for (i64 i = (s); i <= (t); ++i)
#define repr(i,s,t) for (i64 i = (s); i >= (t); --i)
#define LF          '\n'

#ifdef DBG
#define trace(...) _trace(#__VA_ARGS__, __VA_ARGS__);
#else
#define trace(...)
#endif

using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template<class T, class U>inline bool chmax(T &a, const U &b){return b>a ? (a=b,1) : 0;}
template<class T, class U>inline bool chmin(T &a, const U &b){return b<a ? (a=b,1) : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template<class T>
ostream& operator<< (ostream &os, const vector<T> &vec) {
    rep(i, vec.size()) os << vec[i] << (i+1 == vec.size() ? "" : " ");
    return os;
}

template<class T, class U>
ostream& operator<< (ostream &os, const pair<T, U> &p) {
    return os << p.first << ' ' << p.second;
}

template <class T>
void _trace(const char *s, T&& x)
{
    clog << '{';
    while(*s != '\0' && *s != ',') clog << *(s++);
    clog << ":" << setw(3) << x << '}' << endl;
}

template <class Head, class... Tail>
void _trace(const char *s, Head&& head, Tail&&... tail)
{
    clog << '{';
    while(*s != ',') clog << *(s++);
    clog << ":" << setw(3) << head << "}, ";
    for (++s; !isgraph(*s); ++s);
    _trace(s, std::forward<Tail>(tail)...);
}
// }}}

signed main()
{
    // ios::sync_with_stdio(false); cin.tie(nullptr);
    string s; cin >> s;
    cout << count(all(s), '1') << endl;

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main () {
    int H, W;
    cin >> H >> W;
    vector<string> v(H+2);
    v[0] = v[H+1] = string(W+2, '.');
    for (int i = 1; i <= H; i++) {
        string s;
        cin >> s;
        s = '.'+s+'.';
        v[i] = s;
    }
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            if (v[i][j] == '#') {
                int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
                bool f = 0;
                for (int k = 0; k < 4; k++) {
                    if (v[i+dx[k]][j+dy[k]] == '#') {
                        f = 1;
                    }
                }
                if (!f) {
                    puts("No");
                    return 0;
                }
            }
        }
    }
    puts("Yes");
}

Measured memory_bytes: 256
from collections import defaultdict


def resolve():
    n, k, q = map(int, input().split())
    scores = defaultdict(int)
    a = list(int(input()) for _ in range(q))
    for ai in a:
        scores[ai - 1] += 1
    for i in range(n):
        if scores[i] + k - q > 0:
            print("Yes")
        else:
            print("No")


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 68056
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
long long fac(ll a){
    long long ans=1;
    while(a>1){
        ans*=a;
        a--;
    }
    return ans;
}
int main(){
    ll n;cin >> n;
    vector<ll> v(n);
    if(n%2==0){
        ll a;cin >> a;
        v[n/2]=a;
        rep(i,(n-2)/2){
            cin >> v[n/2-i-1] >> v[n/2+i+1];
        }
        cin >> v[0];
    }
    else{
        cin >> v[n/2];
        rep(i,(n-1)/2){
            cin >> v[n/2+i+1] >> v[n/2-1-i];
        }
    }
    for(auto x:v){
        cout << x << " ";
    }
}


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

using namespace std;

int main(){
    string S;
    cin>>S;
    if(S=="SUN"){
       cout<<7;
    }
    if(S=="MON"){
        cout<<6;
    }
    if(S=="TUE"){
        cout<<5;
    }
    if(S=="WED"){
        cout<<4;
    }
    if(S=="THU"){
        cout<<3;
    }
    if(S=="FRI"){
        cout<<2;
    }
    if(S=="SAT"){
        cout<<1;
    }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define loop(n) for(ll i = 0; i<n; i++)
#define sort(a) sort(a.begin(), a.end())
using namespace std;

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    string s, t; cin>>s>>t;
    int n = s.size(), m = t.size();
    int lcs[n+1][m+1];

    for(int i = 0; i<=n; i++){
        for(int j = 0; j<=m; j++){
            if(i==0 || j==0) lcs[i][j] = 0;
            else if(s[i-1]==t[j-1]) lcs[i][j] = lcs[i-1][j-1] + 1;
            else lcs[i][j] = max(lcs[i-1][j], lcs[i][j-1]);
        }
    }
    if(lcs[n][m]==0) return cout<<"\n", 0;

    string res = "";
    for(int i = n, j = m; i>0 && j>0;){
        if(lcs[i][j]!=lcs[i-1][j] && lcs[i][j]!=lcs[i][j-1]){
            res.push_back(s[i-1]);
            i--; 
            j--;
        }
        else if(lcs[i-1][j]>lcs[i][j-1]) i--;
        else j--;
    }

    reverse(res.begin(),res.end());
    cout<<res<<"\n";
    return 0;
}

Measured memory_bytes: 35584
#include<iostream>
#include<vector>

using namespace std;
using ll = long long;

vector<ll> dp(100001,-1);
ll fab(ll n){
    if(n==ll(-1)) return 0;
    if(dp[n]>=0) return dp[n];
    else{
        dp[n] = (fab(n-1)%ll(1000000007)+ fab(n-2)%ll(1000000007))%ll(1000000007);
        return dp[n];
    }
}

int main(int argc, const char *argv[]){
    dp[0] = 1;
    dp[1] = 1;
    dp[2] = 2; 
    ll n,m;
    cin >> n >> m;
    vector<ll> a(m);
    for(int i=0;i<m;i++) cin >> a[i];
    ll ans = 1;
    if(m>0){
        ans *= fab(a[0]-ll(1))%ll(1000000007);
        ans = ans%ll(1000000007);
        for(int i=1;i<m;i++){
            ans*=fab(a[i]-a[i-1]-ll(2))%ll(1000000007);
            ans = ans%ll(1000000007);
        }
        ans *= fab(n-a[m-1]-ll(1))%ll(1000000007);
        ans = ans%ll(1000000007);
    }else{
        ans = fab(n)%ll(1000000007);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4096
/* AOJ 0002 Digit Number */

#include <stdio.h>

int
main(void)
{
    int a, b, sum;
    int n_digits;

    while (scanf("%d %d", &a, &b) == 2) {
        sum = a + b;
        n_digits = 0;

        while (sum > 0) {
            n_digits++;
            sum /= 10;
        }

        printf("%d\n", n_digits);
    }

    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
 
int main(){
    long long A, B, N;
    std::cin >> A >> B >> N;
    
    if(N < B){
        long long ans = A * N / B;
        std::cout << ans << std::endl;
    }else{
        long long x = B - 1;
        long long ans = A * x / B - A * (long long)(x / B);
        std::cout << ans << std::endl;
    }
    
    return 0;
}
 

Measured memory_bytes: 3592
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>
#include <set>
#include <map>
#include <list>

using ll = long long;
using ld = long double;
using namespace std;
const int INF = 1e9+100;
const ll INF64 = 7e18l;
const int mod = 1000000007;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(), (a).end()
#define FIN ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);


int main(){
    FIN;
    ll n; cin >> n;
    vector<ll> a(n);
    for(ll i=0;i<n;i++) cin >> a[i];

    map<ll,ll> mp;
    for(ll i=0;i<n;i++) mp[a[i]]++;

    map<ll,ll>::iterator it;
    ll sum = 0;
    for(it=mp.begin();it!=mp.end();it++){
        sum += it->second * (it->second - 1) / 2;
    }


    for(ll i=0;i<n;i++){
        ll cur;
        cur = mp[a[i]] - 1;
        cout << sum - cur << endl;
    }



    return 0;
}



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

int int_len(int n) {
  int s=0;
  while(n!=0) s++, n/=10;
  return s;
}

int int_sum(int n) {
  int m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(int i=s-1;i>=0;i--) m+=n/((int)pow(10,i))-(n/((int)pow(10,i+1)))*10;
  return m;
}






int gcd(int a,int b)
{
 
  int r, tmp;
 
  
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
 
 
  return b;
}







int fac(int n){
  int m=1;
  while(n>=1) m*=n,n--;
  return m;
}

int vec_sum(vector<int> v){
  int n=0;
  for(int i=0;i<v.size();i++) n+=v[i];
  return n;
}
///////////////////////////
int main() {
  int n,count=0,k=0;
  cin>>n;
  vector<int> v(n);
  rep(i,n) cin>>v[i];
  for(int i=0;i<n;i++){
    count+=abs(v[i]-k);
    k=v[i];
  }
  count+=abs(k);
  rep(i,n){
    int ans=count;
    cout<<ans+abs(v[i+1]-v[i-1])-(abs(v[i+1]-v[i])+abs(v[i]-v[i-1]))<<endl;
  }
  
  
  
}
///////////////////////////

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

#define MAX 10000
#define INFTY (1<<29)

class DisjointSet{
public:
  vector<int> rank,p; //rankが木の高さ
                      //pは親(根)
  DisjointSet(){}
  DisjointSet(int size){
    rank.resize(size,0);
    p.resize(size,0);
    for(int i=0;i<size;i++)makeSet(i);
  }

  void makeSet(int x){
    p[x]=x;
    rank[x]=0;
  }

  bool same(int x,int y){
    return findSet(x)==findSet(y);
  }

  void unite(int x,int y){
    link(findSet(x),findSet(y));
  }

  void link(int x, int y){
    //木が低い方を高い方に合併
    if(rank[x]>rank[y]){
      p[y]=x;
    }else{
      p[x]=y;

      if(rank[x]==rank[y]){
	rank[y]++;
      }
    }
  }

  int findSet(int x){
    //再帰を使って根を返す
    if(x!=p[x]){p[x] = findSet(p[x]);}
    return p[x];
  }
};

class Edge{
public:
  int source,target,cost;
  Edge(int source=0,int target = 0,int cost =0):
    source(source),target(target),cost(cost){}
  bool operator < (const Edge &e ) const{
    return cost < e.cost;
  }
};

int kruskal(int N,vector<Edge> edges){
  int totalCost=0;
  sort(edges.begin(),edges.end());

  DisjointSet dset = DisjointSet(N+1);

  for(int i=0;i<N;i++)dset.makeSet(i);

  int source,target;
  for(int i=0;i<edges.size();i++){
    Edge e = edges[i];
    if(!dset.same(e.source,e.target)){
      totalCost +=e.cost;
      dset.unite(e.source,e.target);
    }
  }
  return totalCost;
}

int main(){
  int N,M,cost,source,target;
  cin>>N>>M;

  vector<Edge>edges;
  for(int i=0;i<M;i++){
    cin >> source >> target>> cost;
    edges.push_back(Edge(source,target,cost));
  }
  cout <<kruskal(N,edges)<<endl;
  return 0;
}


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

int main() {

    int D, T, S;

    cin >> D >> T >> S;

    int meters;

    meters = S*T;

    if (meters >= D) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

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

int main() {
    int N, K;
    cin >> N >> K;
    ll ans = 0;
    for (int b = 1; b <= N; b++) {
        if (b <= K) continue;
        ans += N/b * (b-K);
        if(N%b != 0 && K!=0){
          ans += max((N % b) - (K - 1), 0);
        } else if(N%b != 0 && K ==0){
          ans += N%b;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main() {
  char *line = NULL;
  size_t buffer_size = 0;
  int frequencies[101] = {};
  int max_frequency = 0;
  while (getline(&line, &buffer_size, stdin) > 0) {
    int n;
    sscanf(line, "%d", &n);
    max_frequency = max(max_frequency, ++frequencies[n]);
  }
  free(line);

  for (int i = 1; i < 101; ++i) {
    if (frequencies[i] == max_frequency) {
      printf("%d\n", i);
    }
  }

  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define inf LLONG_MAX
#define pll pair <ll,ll>
#define min_pq priority_queue <pll> ,vector <pll>, greater <pll> > > 
#define f first
#define s second

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


	ll n,W;
	cin>>n>>W;
	ll w[n+1],v[n+1];
	for(ll i=1;i<=n;i++)
		cin>>w[i]>>v[i];
	ll dp[n+1][W+1];
	memset(dp,0,sizeof dp);
	for(ll i=1;i<=n;i++)
	{
		for(ll j=1;j<=W;j++)
		{
			dp[i][j]=dp[i-1][j];
			if(j-w[i]>=0)
			{
				dp[i][j]=max(dp[i][j],v[i]+dp[i-1][j-w[i]]);
			}
		}
	}
	cout<<dp[n][W]<<'\n';
}	


Measured memory_bytes: 79232
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e15;
const int MOD = 1e9 + 7;
int fact(int num) {
	int ans = 1;
	for (int i = 1; i <= num; i++) {
		ans *= i % MOD;
		ans %= MOD;
	}
	return ans % MOD;
}

signed main() {
	int N, M;
	cin >> N >> M;
	if (abs(N - M) >= 2)cout << 0;
	else if (N == M) {
		int a = fact(N) % MOD;
		int b = fact(M) % MOD;
		cout << (2 * a * b) % MOD;
	}
	else {
		int big = max(N, M);
		int small = min(N, M);
		cout << ((fact(big) % MOD) * (fact(small) % MOD)) % MOD;
	}
}

Measured memory_bytes: 256
class Graph
  include Comparable
  attr_reader :id, :depth
  @@nodes = Array.new
  def initialize(id, left = nil, right = nil)
    @id = id
    @left = left == -1? nil: left
    @right = right == -1? nil: right
    @degree = 0
    @degree += 1 if @left
    @degree += 1 if @right
    @depth = -1
    @parent = -1
    @sibling = -1
    @@nodes[id] = self
  end
  
  def set_parent(other)
    @parent = other
  end
  
  def set_child
    @@nodes[@left].set_parent(self) if @left
    @@nodes[@right].set_parent(self) if @right
    if @left and @right
      @@nodes[@left].set_sib(@@nodes[@right])
      @@nodes[@right].set_sib(@@nodes[@left])
    end
  end
  
  def set_children
    set_child
    @@nodes[@left].set_children if @left
    @@nodes[@right].set_children if @right
  end
  
  def set_sib(other)
    @sibling = other
  end
  
  def depth
    if @parent != -1
      @parent.depth + 1
    else
      0
    end
  end
  
  def height
    left = @left? @@nodes[@left].height: -1
    right = @right? @@nodes[@right].height: -1
    if left < right
      right + 1
    else
      left + 1
    end
  end
  
  def <=>(other)
    if Graph === other
      @id <=> other.id
    else
      @id <=> other
    end
  end
  
  def type
    if @parent == -1
      return "root"
    elsif @degree == 0
      return "leaf"
    else
      return "internal node"
    end
  end
  
  def inspect
    @id
  end
  
  def to_s
    "node #{@id}: parent = #{@parent.inspect}, sibling = #{@sibling.inspect}, degree = #{@degree}, depth = #{depth}, height = #{height}, #{type}"
  end
end
def main
  arr = []
  gets.to_i.times do
    arr << Graph.new(*gets.split(" ").map(&:to_i))
  end
  arr.each{|item|
    if item.type == "root"
      item.set_children
    end
  }
  arr.sort.each{|item|
    puts item
  }
end
main

Measured memory_bytes: 6124
n = int(input())
table = [[0 for _ in range(9)] for _ in range(9)]

for i in range(1, n+1):
    s = str(i)
    f, l = s[0], s[-1]
    if "0" in [f, l]: continue
    table[int(f)-1][int(l)-1] += 1

ans = 0
for i in range(9):
    for j in range(9):
        ans += table[i][j] * table[j][i]

print(ans)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1e9;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

void solve() {
	int n;
	cin >> n;
	int ans = 0;
	int t = 0;
	for (int i = 0; pow(2, i) <= n; i++) {
		ans = pow(2, i);
	}
	cout << ans << endl;
}

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

Measured memory_bytes: 4004
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    string s, t;
    cin >> s >> t;
    cout << t + s;
    return 0;
}

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

using namespace std;
#define inf 1000000000
#define unvisited -1
#define visited 1
#define eps 1e-9
#define mp make_pair
#define pb push_back
#define pi acos(-1.0)
#define uint64 unsigned long long
#define FastSlowInput ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define debug if(true)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> ii;
typedef vector<ii> vii;

int main(){
	int k,n,i,j;
	scanf("%d %d",&k,&n);
	int a[200001];
	for(i=0;i<n;i++){scanf("%d",&a[i]);}
	int maxDiff = 0;
	for(i=0;i<n-1;i++){
		maxDiff = max(maxDiff, a[i+1] - a[i]);
	}
	int jarak = k - a[n-1];
	maxDiff = max(maxDiff, jarak + a[0]);
	printf("%d\n",k-maxDiff);
	return 0;
};

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
const int MOD = 1000000007;

int main() {
  int n,k;
  double ans = 0;
  cin >> n >> k;
  for(int i = 1; i <= n; ++i) {
    double p = 1.0/n;
    int point = i;
    while(point < k){
      point *= 2;
      p /= 2;
    }
    ans += p;
  }
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <math.h>
#include <map>
#include <unordered_map>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define lper(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define pb(s) push_back(s)
#define ci(x) cin >>x
#define co(x) cout<<x<<endl
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9;
const ll INF=4e18;
const ll dy[4]={1,0,-1,0};
const ll dx[4]={0,-1,0,1};
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}

long long fac(ll a) {
 long long ans=1;
 while(a>1){
 ans*=a;
 ans%=1000000007;
     a--;
    }
    return ans;
     }
int main() {
ll N;
  ll A;
   ll B;
     cin >>N>>A>>B;
  ll x=B-A;
  if(x%2==0) {
    cout<<"Alice"<<endl;
  }
  else {
    cout<<"Borys"<<endl;
  }
  
  
}
  

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

using namespace std;

int main(){
  char A[10],B[10],C[10];
  cin >> A >> B >> C;

  char D[3];
  D[0] = A[0];
  D[1] = B[0];
  D[2] = C[0];

  for(int i=0 ; i<3 ; i++){
    cout << static_cast<char>(toupper(D[i]));
  }

  cout <<"\n";
}


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


int main()
{
	string a;
	getline(cin, a);
	for (int i = 0; a[i] != '\0'; i++)
	{
		if (a[i] == '9')
			a[i] = '1';
		else if (a[i] == '1')
			a[i] = '9';
	}
	cout << a;
	//system("pause");
	return 0;
}

Measured memory_bytes: 256
// きさま！ 見ているなッ！

#include<iostream>
#include<queue>
#include<memory>
#include<map>
#include<set>
#include<unordered_map>
#include<array>
#include<vector>
#include<algorithm>
#include<list>
#include<limits>
#include<stdio.h>
#include<math.h>
#include<string>
#include<thread>

using namespace std;
using ll = long long;
using vec = vector<int>;
using mat = vector<vec>;
using lst = list<ll>;

const ll MOD = 1000000007;


int main()
{
	string S; cin >> S;
	int N = S.length();

	for (int i = 0; i < N; ++i)
	{
		if (S[i] != S[N - i - 1])
		{
			cout << "No" << endl; return 0;
		}
	}

	for (int i = 0; i < (N-1)/2; ++i)
	{
		if (S[i] != S[(N - 1) / 2 - i - 1])
		{
			cout << "No" << endl; return 0;
		}
	}

	for (int i = (N+3)/2; i < N; ++i)
	{
		if (S[i] != S[N - i - 1])
		{
			cout << "No" << endl; return 0;
		}
	}

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

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String w = sc.nextLine();
		String s = "Sunny";
		String c = "Cloudy";
		String r = "Rainy";

		if(w.equals(s)) {
			System.out.println(c);
		}else if(w.equals(c)) {
			System.out.println(r);
		}else if(w.equals(r)) {
			System.out.println(s);
		}


	}

}

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

int main(){

  string O, N;
  getline(cin, O);
  getline(cin, N);

  for(int i=0; i<O.size(); i++){
    cout << O[i];
    if(i<N.size()) cout << N[i];
  }

  return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

bool f(string n) {
    int a = 0;
    int b = n.size() - 1;
    while (a <= b) {
        if (n[a] != n[b]) {
            return false;
        }
        a++;
        b--;
    }
    return true;
}

int main() {

    string n;
    cin >> n;

    if (f(n)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
dp = [0 for i in range(N)]
dp[0] = 0
dp[1] = abs(A[1] - A[0])
for i in range(2,N):
  dp[i] = min( dp[i-1] + abs(A[i] - A[i-1]),dp[i-2] + abs(A[i] - A[i-2]))
  
print(dp[N-1])


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

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

  vector<int> vec(n);
  for(int i = 0; i < n; i++){
    cin >> vec.at(i);
  }

  int maxv = -2000000000;
  int minv = vec.at(0);

    for(int i = 1; i < n; i++){
      maxv = max(maxv,vec.at(i) - minv);
      minv = min(minv,vec.at(i));
    }

    cout << maxv << endl;
    
 }


Measured memory_bytes: 3604
#!/usr/bin/env python3
#ABC141 C

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(1000000000)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n,k,q = LI()
cnt = [0]*n
for _ in range(q):
    a = I()
    cnt[a-1] += 1

for i in range(n):
    if k - (q - cnt[i]) > 0:
        print('Yes')
    else:
        print('No') 


Measured memory_bytes: 47196
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

S = input().rstrip()

bl = True
for x in S[::2]:
    if x == 'L':
        bl = False
for x in S[1::2]:
    if x == 'R':
        bl = False

answer = 'Yes' if bl else 'No'
print(answer)

Measured memory_bytes: 3060
n,m=map(int,input().split())
A = [int(input()) for i in range(m)]
ls =[-1]*(n+1)
ls[0]=ls[1]=1
mod = 10**9+7
for a in A:
	ls[a]= 0

for i in range(2,n+1):
	if ls[i]==-1:
		ls[i]= ls[i-1]+ls[i-2]
print(ls[-1]%mod)

Measured memory_bytes: 470520
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

//struct Monoid{
//	using T = _underlying_set_; //モノイドの台集合の型
//	T operator()(const T &a, const T &b) { return _a_op_b_; } //二項演算
//	static constexpr T identity() { return _identity_element_; } //単位元
//};


struct RMQ{
	using T = int; //モノイドの台集合の型
	T operator()(const T &a, const T &b) { return min(a,b); } //二項演算
	static constexpr T identity() { return INT_MAX; } //単位元
};

template<class Monoid>
class SegTree{ //SegTree<Monoid> seg(n);
	private:
		using T = typename Monoid::T; //台集合の型をエイリアス
		Monoid op; //演算の関数オブジェクト
		const int n; //列の長さ
		vector<T> t; //内部二分木

		void prop_to(int i) { //ノードiに伝搬
			t[i] = op(t[2 * i], t[2 * i + 1]);
		}

	public:
		SegTree(int n) : n(n), t(4 * n, op.identity()) {} //単位元で埋める初期化
		SegTree(const vector<T> &v) : n(v.size()), t(2 * n){ //配列を用いて初期化
			copy(begin(v), end(v), begin(t) + n);
			for(int i = n - 1; i > -0; i--) prop_to(i);
		}

		void set(int i, const T &x){
			t[i += n] = x; 
			while(i >>= 1) prop_to(i);
		}

		void add(int i, const T &x){
			set(i, get(i) * x);
		}

		T get(int i) { return t[i + n]; } //列のi番目を返す

		T query(int l, int r){
			T accl = op.identity(), accr = op.identity();
			for(l += n, r += n; l < r; l >>= 1, r >>= 1){
				if(l & 1) accl = op(accl, t[l++]);
				if(r & 1) accr = op(t[r-1], accr);
			}
			return op(accl, accr);
		}
};

int main(){
	int n, q;
	cin >> n >> q;

	SegTree<RMQ> seg(n);
	rep(i,q){
		int com;
		cin >> com;
		if(com){
			int l, r;
			cin >> l >> r;
			cout << seg.query(l + 1,r + 2) << endl;
		}else{
			int p, x;
			cin >> p >> x;
			seg.set(p + 1,x);
		}
	}
}



Measured memory_bytes: 4412
from math import ceil,log10
import sys
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N,M = read_int()

A = read_int()
# for index arrangement
A.sort(reverse=True)
A.insert(0,-1)

W = [0,2,5,5,4,5,6,3,7,6]

dp = [-1 for j in range(N+1)]
def solve():
    dp[0] = 0
    for i in range(M):
        digit = [0 for _ in range(N+1)]
        for j in range(N+1):
            if j - W[A[i + 1]] >= 0 and dp[j - W[A[i + 1]]] >= 0:
                dp[j] = max(dp[j], dp[j - W[A[i + 1]]]*10 + A[i + 1])
                
if __name__ == "__main__":
    solve()
    print(dp[N])

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

int main()
{
  map<string, int> card;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    card[s]++;
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    string t;
    cin >> t;
    card[t]--;
  }
  int ans(0);
  for (auto&& c : card) {
    ans = max(ans, c.second);
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;

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

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

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define all(obj) (obj).begin(),(obj).end() 
#define dump(x)  cout << #x << " = " << (x) << endl;
typedef long long lint;
using namespace std;
int main(){
	string s;
	stack<char>st;
	cin>>s;
	each(it,s){
		if(st.empty())st.push(*it);
		else if(*it=='S')st.push('S');
		else if(*it=='T'){
			if(st.top()=='T')st.push('T');
			else st.pop();
		}
	}
	cout<<st.size()<<"\n";
}


Measured memory_bytes: 644
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;
ll search(ll l, ll r) {
  ll ret = INF;
  for (ll i = l; i <= r; i++) {
    for (ll j = i + 1; j <= r; j++) {
      ret = min((i * j) % 2019, ret);
    }
  }
  return ret;
}
int main() {
  ll l, r;
  cin >> l >> r;
  if (l <= 2019 && 2019 <= r) {
    cout << 0 << endl;
  } else if (l < 2019 && r < 2019) {
    cout << search(l, r) << endl;
  } else if (r - l < 2019) {
    cout << search(l, r) << endl;
  } else {
    cout << 0 << endl;
  }
  return 0;
}

Measured memory_bytes: 3604
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int a,b;
  scanf("%d%d",&a,&b);
  for(int i=0;i<1100;i++){
    int ta=i*8/100;
    int tb=i*10/100;
    if(ta==a&&tb==b){
      printf("%d",i);
      return 0;
    }
  }
  printf("-1");
  return 0;

}

Measured memory_bytes: 256
//import java.util.Scanner;
//
//public class Main {
//	public static void main(String[] args) {
//
//		Scanner sc = new Scanner(System.in);
//
//		String s = sc.next();
//
//		System.out.println(s.equals("Sunny") ? "Cloudy" : s.equals("Cloudy") ? "Rainy" : "Sunny");
//
//	}
//}

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int k = sc.nextInt();
		int q = sc.nextInt();

		int[] point = new int[n];

		Arrays.fill(point, k - q);

		for (int i = 0; i < q; i++) {
			point[sc.nextInt() - 1]++;
		}

		for (int ans : point) {
			if (ans <= 0) {
				System.out.println("No");
			} else {
				System.out.println("Yes");
			}
		}

	}
}

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

int a, s;
bool v[105];
int main()
{
    int i;
    for (i = 0; i < 3; i++) {
        scanf("%d", &a);
        v[a] = 1;
    }
    for (i = 0; i <= 100; i++) {
        s += v[i];
    }
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
N=io.read("n")
K=io.read("n")
if K%2==1 then
  s=0
  for i=K,N,K do
    s=s+1
  end
  s=s*s*s
end
if K%2==0 then
  s=0
  for i=K//2,N,K//2 do
    s=s+1
  end
  if s%2==0 then
    s=s*s*s//4
  else
    s=math.ceil((s//2)^3+(s//2+1)^3)
  end
end
print(s)

Measured memory_bytes: 376