akhauriyash/Code-Regression huggingface dataset:
import os, sys, re, math

N = int(input())
s = [int(n) for n in input().split(' ')]

cnt = 0
for i in range(1,N-1):
    temp = s[i-1:i+2]
    temp.sort()
    if temp[1] == s[i]:
        cnt += 1
print(cnt)


Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef map<int,int> mii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<long long> vl;
typedef vector<vector<ll>> vll;
typedef vector<bool> vb;
typedef set<int> si; 
#define fori(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,b,a) for(int i = (b); i >= (a); --i)
#define all(a) (a).begin(), (a).end()
//#define __builtin_popcountll bitCountLL
//#define __builtin_popcount bitCount
//__builtin_ctz 末尾0的个数, __builtin_clz 前导0的个数
//__builtin_ffs 最后一个1的位置
#define maxn 100005
#define Mod 1000000007
const int INF = 2e9;
const ll ML = 4e18;
    
void solve() {
    int n;
    cin >> n;
    cout << 8 - (n - 400) / 200;
}

int main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
	//cout.precision(30); cout << fixed;
	//freopen("D:\\data_in.txt", "r", stdin);
   solve();
   
    /*
    clock_t start,finish;
    start = clock();
    
    finish = clock();
    cout << "\n" << (double)(finish - start) / (double)(CLOCKS_PER_SEC) * 1000 << "ms" << endl;
    */
    return 0;
}

/***************************************************************
 question:
 idea:
 tag:
 record:
 ***************************************************************/


Measured memory_bytes: 3648
#include <iostream>
using namespace std;
int main(){
  int N; cin >> N;
  int A[100];
  int sa; sa = 0;
  for (int i=0; i<N; i++){
    cin >> A[i];
  }
  
  for (int i=0; i<N; i++){
    for (int j=0; j<N; j++){
      if (abs(A[i]-A[j]) > sa){
        sa = abs(A[i]-A[j]);
      }
    }
  }
  cout << sa << endl;
}

Measured memory_bytes: 256
N,K = map(int,input().split())
A = list(map(int,input().split()))

for i in range(K):
    lis = [0]*(N+1)
    for j in range(N):
        lis[min(N,j+A[j]+1)] -= 1
        lis[max(0,j-A[j])] += 1
    cnt = 0
    for j in range(N):
        cnt += lis[j]
        A[j] = cnt
    cnt2 = 0
    for j in range(len(A)):
        if A[j] == N:
            cnt2 += 1
    if cnt2==N:
        break
print(' '.join(map(str,A)))

Measured memory_bytes: 156608
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

typedef struct Node {
  int key;
  struct Node *prev,*next;
} node;

node *nil;


node* listSearch(int key);
void init(void);
void Print(void);
void deleteNode(node *t);
void deleteFirst(void);
void deleteLast(void);
void deleteKey(int key);
void Insert(int key);

  

int main(void){
  int key;
  int i,n;
  char order[100];
  int np = 0,nd = 0;
  int size = 0;
    
  scanf("%d",&n);
    
  init();
    
  for(i = 0;i < n;i++){
    scanf("%s %d",order,&key);
    
    if(order[0] == 'i'){
      Insert(key);
      np++;
      size++;
      
    } else if(order[0] == 'd'){
      if(strlen(order) > 6){
	
	if(order[6] == 'F'){
	  deleteFirst();
	} else if(order[6] == 'L'){
	  deleteLast();
	}
	
      } else {
	deleteKey(key);
	nd++;
      }
      size--;
    }
  }
    
  Print();
    
  return 0;
}






node* listSearch(int key){
  node *cur = nil->next;
  
  while(cur != nil && cur->key != key){
    cur = cur->next;
  }
  
  return cur;
}



void init(void){ //リストの初期化
  nil = (node *)malloc(sizeof(node));
  
  nil->next = nil;
  nil->prev = nil;
}



void Print(void){
  node *cur = nil->next;
  int i = 0;
  
  while(1){
    if( cur == nil) break;
    if( i++>0 ) printf(" ");
    printf("%d",cur->key);
    cur = cur->next;
  }
  
  puts("");
}



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



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



void deleteKey(int key){
  deleteNode(listSearch(key));
}



void Insert(int key){
  node *x = (node *)malloc(sizeof(node));
  
  x->key = key; 
  x->next = nil->next;
  nil->next->prev = x;
  nil->next = x;
  x->prev = nil;
}



void deleteNode(node *t){
  if(t == nil){
    return;
  }
  
  t->prev->next = t->next;
  t->next->prev = t->prev;
    
  free(t);
}



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

int main() {
    int N, M, X;
    cin >> N >> M >> X;

    vector<vector<int>> A(N, vector<int>(M));
    vector<int> c(N);

    for (int i = 0; i < N; i++) {
        cin >> c.at(i);
        for (int j = 0; j < M; j++) {
            cin >> A.at(i).at(j);
        }
    }
    int ans = 12345678;
    for (int bit = 0; bit < (1 << N); bit++) {
        int cost = 0;
        vector<int> level(M);
        for (int i = 0; i < N; ++i) {
            if (bit & (1 << i)) {
                cost += c.at(i);
                for (int j = 0; j < M; j++) {
                    level.at(j) += A.at(i).at(j);   
                }
            }
        }
        bool ok = true;
        for (int j = 0; j < M; j++) {
            if (level.at(j) < X) ok = false;
        }
        if (ok) ans = min(ans, cost);
    }
    if (ans == 12345678) cout << -1 << endl;
    else cout << ans << endl;
    
}

Measured memory_bytes: 3640
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define veci vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))


using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x:vec) is >> x;
    return is;
}
const ll mod=1e9+7;

int main()
{
    ll h,w;
    cin >> h >> w;
    vector<vector<char>> a(h,vector<char>(w));
    vector<vector<ll>> dp(h,vector<ll>(w,0));
    rep(i,h){
        rep(j,w){
            cin >> a[i][j];
        }
    }
    rep(i,h){
        rep(j,w){
            if(i==0 && j==0) dp[i][j]=1;
            if(a[i][j]=='#') continue;
            if(i>=1) dp[i][j]+=dp[i-1][j];
            dp[i][j]%=mod;
            if(j>=1) dp[i][j]+=dp[i][j-1];
            dp[i][j]%=mod;
        }
    }
    cout << dp[h-1][w-1] << endl;
    return 0;
} 

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

int main() {
    int i, x;
    for (i = 1; i < 10001; i++) {
        cin >> x;
        if (x == 0) {
            break;
        }
        else {
            cout <<"Case " << i <<": " << x << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3000
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#include <cstring>
#include <algorithm>

int main(){
  std::string S;
  std::cin >> S;
  long long int n = S.length();
  
  int flag = 1;
  for(long long int i = 0; i < n; i++){
    // i is even (i is shifted by 1 because we use 0-indexed convention)
    if((i & 1) == 0){
      if(!(S[i]=='R' || S[i]=='U' || S[i]=='D')){
        flag = 0;
        break;
      }
    }
    else{ // if(i is even)
      if(!(S[i]=='L' || S[i]=='U' || S[i]=='D')){
        flag = 0;
        break;
      }
    }
  }
  
  if(flag == 1){
    std::cout << "Yes" << std::endl;
  }
  else{
    std::cout << "No" << std::endl;
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FLASH ios_base::sync_with_stdio(0);
#define ll long long
#define debt(x,y)cout<<"#x = "<<(x)<<" and "<<"#y = "<<(y)<<endl;
#define deb(x)cout<<"#x = "<<(x)<<endl;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define arr(a,n) for(ll i=1;i<=n;i++) cout<<a[i]<<" "; cout << "\n";
#define vecc(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout << "\n";


using namespace std;

ll n,k;
vector<ll>massiv;

int main(){
FLASH;
cin>>n>>k;
for(ll i=1;i<=n;i++)
{
  ll x;
  cin>>x;
  massiv.pb(x);	
}

sort(all(massiv));
ll sum=0;
for(ll i=0;i<k;i++)sum+=massiv[i];
cout<<sum<<endl;


return 0;
} 


Measured memory_bytes: 3624
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <list>
#include <limits>
#include <numeric>
#include <utility>
#include <deque>
#include <valarray>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#include <array>
#include <bitset>
#include <complex>
#include <string>
#include <tuple>

using namespace std;
using ll = long long;
const int INF = 1e9;
const ll MOD = 1e9 + 7;

int main()
{
  int a, p;
  cin >> a >> p;
  p += 3 * a;
  cout << p / 2 << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        for(int i=0;i<m;i++){
            n -= sc.nextInt();
        }

        if(n < 0){
            System.out.println(-1);
        }
        else{
            System.out.println(n);
        }
    }
}


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

int main() {
    int H, W;
    cin >> H >> W;
    vector<string> vec(H);
    
    for (int i = 0; i < W + 2; i++) {
        cout << '#';
    }
    cout << endl;
    
    
    for (int i = 0; i < H; i++) {
        cin >> vec.at(i);
    }
    
    for (int i = 0; i < H; i++) {
        cout << '#';
        cout <<  vec.at(i);
        cout << '#' << endl;
    }
    
    for (int i = 0; i < W + 2; i++) {
        cout << '#';
    }
    
    
    
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
#include <set>
using namespace std;
typedef long long ll;

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

  ll c = a + b;
  ll ans = a * (n / c);
  ans += min(a, n % c);

  cout << ans << endl;
}

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

int main(){
  int n;
  set<string> data;

  cin >> n;
  for(int i=0;i<n;i++){
    string order,inp;
    cin >> order >> inp;
    if(order=="insert")
      data.insert(inp);
    else
      cout << (data.find(inp) != data.end() ? "yes" : "no") << endl;
  }
}


Measured memory_bytes: 32176
#!/usr/bin/env python3
import sys
from itertools import accumulate
import functools
sys.setrecursionlimit(10**8)
INF = float("inf")


def solve(N: int, a: "List[int]"):

    dp = [[-1]*N for _ in range(N)]
    acc = [0]+list(accumulate(a))

    def rec(l, r):
        if dp[l][r] > 0:
            return dp[l][r]
        if l == r:
            return 0

        wa = acc[r+1]-acc[l]
        ans = INF
        for k in range(l, r):
            ans = min(rec(l, k) + rec(k+1, r), ans)
        dp[l][r] = ans + wa
        return dp[l][r]

    print(rec(0, N-1))
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, a)


if __name__ == '__main__':
    main()
	

Measured memory_bytes: 44700
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
typedef long long ll;
typedef pair<int, int> P;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
struct Edge {
  ll to;
  ll cost;
};
int main() {
  string s, t;
  cin >> s >> t;
  int ans = 0;
  REP(i,s.size()){
    if (s[i] != t[i]) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 3848
#include <stdio.h>

int main(void){

	int a,b;
	char op;

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

		if(op == '+'){
			printf("%d",a+b);
		} 
		if(op == '-'){
			printf("%d",a-b);
		}
		if(op == '*'){
			printf("%d",a*b);
		}
		if(op == '/'){
			printf("%d",a/b);
		}
		if(op == '?'){
			break;
		}
		printf("\n");
	}


	return 0;
}

Measured memory_bytes: 1032
void main()
{
    long n = rdElem;
    dchar[] s = rdDchar;

    Fenwick[] tree = new Fenwick[26];
    foreach (i; 0 .. 26) tree[i] = Fenwick(n);
    foreach (i, x; s)
    {
        tree[x-'a'].add(i+1, 1);
    }

    long q = rdElem;
    foreach (i; 0 .. q)
    {
        long num, pos;
        string c;
        rdVals(num, pos, c);

        if (num == 1)
        {
            dchar d = c.to!dchar;
            if (d == s[pos-1]) continue;
            tree[s[pos-1]-'a'].add(pos, -1);
            tree[d-'a'].add(pos, 1);
            s[pos-1] = d;
        }
        else
        {
            long end = c.to!long;
            long cnt;
            foreach (j; 0 .. 26)
            {
                if (tree[j].sum(end) - tree[j].sum(pos-1)) ++cnt;
            }
            cnt.writeln;
        }
    }
}

struct Fenwick
{
    long[] tree;

    this(long n)
    {
        tree.length = n + 1;
    }

    void add(long idx, long val)
    {
        for (long i = idx; i < tree.length; i += i & -i)
        {
            tree[i] += val;
        }
    }

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

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

Measured memory_bytes: 116496
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		long h = sc.nextLong(), n = sc.nextLong();
		long all =0;
		for(;n > 0; n--) {
			all += sc.nextLong();
		}
		System.out.println(all < h ? "No" : "Yes");
	}
	
	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

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

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

	        return tokenizer.nextToken("\n");
	    }

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

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

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

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}

Measured memory_bytes: 31572
n=list(input())
k=len(n)-1

for i in range(2**k):
    x=['-']*k
    for j in range(k):
        if (i >> j) & 1:
            x[j]='+'
    
    ans=""
    for a,b in zip(n,x+[""]):
        ans+=(a+b)
    if eval(ans)==7:
        print(ans+"=7")
        break

Measured memory_bytes: 3060
#include <iostream>

int main() {
    int s;
    std::cin >> s;

    const int MINUTE_FACTOR = 60;
    const int HOUR_FACTOR = 60 * MINUTE_FACTOR;
    int hours = s / HOUR_FACTOR;
    int remains = s - (hours * HOUR_FACTOR);
    if (remains < 0) {
        remains = 0;
    }
    int minutes = remains / MINUTE_FACTOR;
    remains = remains - (minutes * MINUTE_FACTOR);
    if (remains < 0) {
        remains = 0;
    }
    std::cout << hours << ':' << minutes << ':' << remains << std::endl;

    return 0;
}


Measured memory_bytes: 3084
use std::str::FromStr;

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

fn get_vec<T : FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    return s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect();
}

fn get_vec_by_lines<T : FromStr>(n : usize) -> Vec<T> {
    let mut v : Vec<T> = Vec::new();
    for _i in 0..n {
        let x : T = get_one();
        v.push(x);
    }
    return v;
}

fn main() {
    let n : usize = get_one();
    let mut v : Vec<i64> = get_vec();
    v.sort();
    let mut ans = 0;
    for i in 0..n {
        ans += v[(3*n-2) - 2*i];
    }
    println!("{}", ans)
}


Measured memory_bytes: 7680
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <algorithm>
#include <bitset>
#define range(i, r) for(int i=0;i<r;i++)
#define ranges(i, l, r) for(int i=l;i<r;i++)
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi std::vector<std::vector<int> >
#define vvl std::vector<std::vector<ll> >
#define MODs 1000000007;
#define MODn 1000000009;
typedef long long int ll;
using namespace std;

int main(int argc, char const *argv[]) {
  ll N, M, ans=0;
  std::cin >> N >> M;
  std::vector<ll> A(N);
  vvl BC = vv(M, 2, 0, ll);
  for(ll i=0;i<N;i++) std::cin >> A[i];
  for(ll i=0;i<M;i++) std::cin >> BC[i][1] >> BC[i][0];
  sort(A.begin(), A.end());
  sort(BC.begin(), BC.end());
  reverse(BC.begin(), BC.end());
  ll Aite = 0;
  ll BCite = 0;
  while(true){
    if(BCite==M) break;
    if(A[Aite] >= BC[BCite][0]) break;
    A[Aite] = BC[BCite][0];
    Aite++;
    BC[BCite][1]--;
    if(BC[BCite][1] == 0) BCite++;
  }
  for(ll i=0;i<N;i++) ans += A[i];
  std::cout << ans << '\n';
  return 0;
}


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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl

const ll MOD = 1000000007;
const int MN = 2010;

inline void add(ll &x, ll y) { x += y; if (x >= MOD) x -= MOD; }

ll dp[MN][MN][2];

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

	dp[N][0][0] = 1;

	for (int i = N; i >= 1; --i) {
		for (int j = N; j >= 0; --j) {
			add(dp[i-1][j][0], dp[i][j][0] + dp[i][j][1]);
			if (j > 0) {
				add(dp[i][j-1][0], dp[i][j][0]);
			}
			add(dp[i-1][j+1][1], dp[i][j][0] + dp[i][j][1]);
		}
	}

	ll ans = (dp[1][N-K][0] + dp[1][N-K][1]) % MOD;
	rep(i, N-K-1) ans = ans * 2 % MOD;
	cout << ans << endl;

	return 0;
}

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

int main()
{
    int n,m;
    cin >> n >> m;
    vector<int> p(m), y(m);
    for (int i = 0; i < m; i++)
    {
        cin >> p[i] >> y[i];
    }
    
    vector<int> py[n + 1];
    for (int i = 0; i < m; i++)
    {
        py[p[i]].push_back(y[i]);
    }
    for (int i = 1; i <= n; i++)
    {
        sort(py[i].begin(), py[i].end());
    }
    
    for (int i = 0; i < m; i++)
    {
        printf("%06d", p[i]);
        printf("%06d\n", (long long)(lower_bound(py[p[i]].begin(), py[p[i]].end(), y[i]) - py[p[i]].begin()) + 1);
    }


}

Measured memory_bytes: 7808
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n * m) / gcd(n, m);//gl=xy
}
 
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;
}
 
using namespace std;

//ここから

using P=pair<ll,ll>;
void solve(){
  ll n,k;
  cin>>n>>k;
  vector<P>p(n);
  rep(i,n)cin>>p[i].first>>p[i].second;
  sort(p.begin(),p.end());
  ll sum=0;
  int pos=0;
  while(1){
    sum+=p[pos].second;
    if(sum>=k){
      cout<<p[pos].first;
      return;
    }
    pos++;
  }
  //cout<<p[pos-1].first;
}

int main(){
	ios::sync_with_stdio(false);
  cin.tie(0);
	cout<<fixed<<setprecision(15);
  solve();
	return 0;
}


Measured memory_bytes: 1792
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>
#include <algorithm>
#include <functional>
#include <string>
#include <iostream>
#include <sstream>
#include <cmath>
#include <cstring>
using namespace std;
#define U(v) \
cerr << #v << ": " << (v) << endl

int main() {
    int N;
    cin >> N;
    vector<int> a(N * 2);
    for (int& l : a)
        cin >> l;
    sort(a.begin(), a.end());
    int sm = 0;
    for (int i = 0; i < N * 2; i += 2)
        sm += min(a[i], a[i + 1]);
    cout << sm << endl;
    return 0;
}


Measured memory_bytes: 256
using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        var s = Console.ReadLine().Trim();
        var ns = false;
        if ((s.Contains('N') && s.Contains('S')) | (!s.Contains('N') && !s.Contains('S'))) ns = true;
        var ew = false;
        if ((s.Contains('E') && s.Contains('W')) | (!s.Contains('E') && !s.Contains('W'))) ew = true;
        Console.WriteLine(ns && ew ? "Yes" : "No");
    }
}


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

int main() {
    int N; cin >> N;
    int a[N],b[N];
    for (int i = 0; i < N; i++)
    {
        cin >> a[i];
        b[i] = a[i];
    }
    sort(a,a+N);
    if(a[N-2] == a[N-1]){
        for (int i = 0; i < N; i++)
        {
            cout << a[N-1] << endl;
        }
    }
    else{
        for (int i = 0; i < N; i++)
        {
            if(b[i] == a[N-1]){
                for (int j = 0; j < N; j++)
                {
                    if(j!=i) cout << a[N-1] << endl;
                    else cout << a[N-2] << endl;
                }
                break;
            }
        }
        
    }
}

Measured memory_bytes: 3200
using System;
using System.Threading;

namespace ConsoleApp26
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = ulong.Parse(Console.ReadLine());
            ulong m = 100;
            int cnt = 0;
            while (m < n)
            {
                m = m+(m/100) ;
                cnt++;              
            }
            Console.WriteLine(cnt);
        }
    }
}


Measured memory_bytes: 27428
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_A

#include <iostream>
using namespace std;

static const int N = 100;

int bubbleSort(int a[], int n) {
  int numOfSwap = 0, flag = 1, i = 0;

  while (flag) {
    flag = 0;
    for (int j = n - 1; j > i; j--) {
      if (a[j] < a[j-1]) {
        swap(a[j], a[j-1]);
        flag = 1;
        numOfSwap++;
      }
    }
  }

  return numOfSwap;
}

int main() {
  int a[N], n;
  
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];

  int numOfSwap = bubbleSort(a, n);

  for (int i = 0; i < n; i++) {
    if (i > 0) cout << ' ';
    cout << a[i];
  }
  cout << endl << numOfSwap << endl;

  return 0;
}



Measured memory_bytes: 3120
#include <bits/stdc++.h>
using namespace std;
#define M 1000000000
#define f(i,a,b) for(long long i=a;i<b;i++)
#define tc long long t;cin>>t;while(t--)
#define pb push_back
#define mp make_pair
#define gcd __gcd
#define F first
#define S second
#define input(a,n) for(ll i=0;i<n;i++) cin>>a[i];
#define output(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" ";
#define up upper_bound
#define lo lower_bound
#define endl "\n"
#define mem(a) memset(a,-1,sizeof(a))
#define ll long long
#define umap unordered_map

int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif

    ll n;
    cin>>n;
    if(n>=30) cout<<"Yes"<<endl;
    else cout<<"No";

    
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
using pi=pair<int,int>;
signed main(){
  int x,a,b;
  cin>>x>>a>>b;
  if(b-a>x)cout<<"dangerous";
  else if(b-a<=0)cout<<"delicious";
  else cout<<"safe";
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Contest
{
	class Program
	{
		static void Main(string[] args)
		{
			int n = int.Parse(Console.ReadLine());
			var count = new int[n, 26];
			for (int i = 0; i < n; i++)
			{
				var S = Console.ReadLine();
				for (int j = 0; j < S.Length; j++)
				{
					count[i, S[j] - 'a']++;
				}
			}
			for (int i = 0; i < 26; i++)
			{
				int temp = int.MaxValue;
				for (int j = 0; j < n; j++)
				{
					temp = Math.Min(temp, count[j, i]);
				}
				for (int j = 0; j < temp; j++)
				{
					Console.Write((char)('a' + i));
				}
			}
		}
	}
}


Measured memory_bytes: 13140
import scala.io.StdIn.readLine
import scala.collection.immutable.Queue
import scala.annotation.tailrec

object Main {
  @tailrec
  def loop(n:Int,q:Queue[(String,Int)]):Queue[(String,Int)] = {
    if(n==0) q
    else {
      val m = readLine.split(" ")
      loop(n-1,q.enqueue((m(0),m(1).toInt)))
    }
  }

  @tailrec
  def rrobin(q:Queue[(String,Int)],total:Int,qt:Int):Unit = {
    if(q.isEmpty) return
    else {
      val ((p,t),r) = q.dequeue
      val (newQ,newT) =
          if(t>qt) (r.enqueue((p,t-qt)),qt)
          else {
            println(p + " " + (t+total))
            (r,t)
          }
      rrobin(newQ,total+newT,qt)
    }
  }

  def main(args:Array[String]) = {
    val l = readLine.split(" ").map(_.toInt)
    val q = loop(l(0),Queue[(String,Int)]())

    rrobin(q,0,l(1))
  }
}

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

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

    set<string> S;

    while(n--){
        cin >> s;
        S.insert(s);
    }

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

    return 0;
    

}

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

public class Main
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int k=sc.nextInt();
    int a[]=new int[n];
    for(int i=0;i<n;i++)
    {
      a[i]=sc.nextInt();
    }
   Arrays.sort(a);
    int sum=0;
   for(int i=0;i<k;i++)
     sum+=a[i];
    
       System.out.println(sum);
  }
}

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

int main(){
    ll a, b;
    cin >> a >> b;
    for(ll i = 1; i < 4; i++){
        if(i != a && i != b){
            cout << i << endl;
        }
    }
    return 0;
}

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

    for(int i=x-k+1 ; i<x+k ; i++){
      System.out.print(i+" ");
    }
    System.out.println();
  }
}


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

#define MAX 10005

//素数判定
bool isprime(int x){
    if (x == 2) return true;

    if (x < 2 || x % 2 == 0) return false;

    for (int i = 3; i*i <= x; i += 2)
    {
        if (x % i == 0) return false;
    }
    return true;
}

int main(){
    int cnt = 0;
    int n,x;
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &x);
        if(isprime(x)) cnt++;
    }

    printf("%d\n", cnt);
    return 0;
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int N;
    cin >> N;
    ll a[N];
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    int b[31]{};
    for (int i = 0; i < N; i++) {
        for (ll j = 0; j < 31; j++) {
            if (((1<<j) & a[i]) != 0) {
                b[j]++;
            }
        }
    }
    for (int i = 0; i < N; i++) {
        ll t = 0;
        for (ll j = 0; j < 31; j++) {
            if (a[i] & (1<<j)) {
                if (b[j] % 2 == 0) {
                    t += (1<<j);
                }
            } else {
                if (b[j] % 2 == 1) {
                    t += (1<<j);
                }
            }
        }
        if (i == N - 1) {
            cout << t << "\n";
        } else {
            cout << t << " ";
        }
    }
    return 0;
}

Measured memory_bytes: 5176
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define INF LLONG_MAX - 100
#define MOD 1000000007
#define fcout cout << fixed << setprecision(15)
#define int long long
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
#define lower_bound lowb
#define upper_bound upb
typedef long long ll;
typedef pair<int, int> P;
typedef priority_queue<int> pque;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a*b/gcd(a,b);};
int mod(int a,int b){return (a+b-1)/b;};
int month[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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;};



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

    int n;
    cin >> n;
    string s, t;
    cin >> s >> t;
    rep(i, n) {
        cout << s[i] << t[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include<cstdio>
#define el "\n"
#define sp " "
typedef long long ll;

main()
{
	ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n,m;
cin>>n>>m;
cout<<(3*n+m)/2;
}


Measured memory_bytes: 256
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE UnboxedTuples #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE ViewPatterns #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE MultiWayIf #-}

import Control.Monad
import Control.Monad.ST
import Control.Monad.State
import Control.Applicative
import Data.List
import Data.Array
import Data.Array.IO
import Data.Maybe
import Data.Bits
import Data.Ord
import Data.Ratio
import Data.Int
import Data.Char
import qualified Data.ByteString.Char8 as BS
import qualified Data.Set as Set
import Data.Tuple
import Data.Function
import Text.Printf
import Debug.Trace
import Numeric

modifyArray arr i f = readArray arr i >>= \x -> writeArray arr i (f x)

listToTuple2 [a,b] = (a,b)
listToTuple3 [a,b,c] = (a,b,c)
listToTuple4 [a,b,c,d] = (a,b,c,d)
listToTuple5 [a,b,c,d,e] = (a,b,c,d,e)

getWords = getLine >>= return . words

readIntBS = fst . fromJust . BS.readInt

for = flip map

main :: IO ()
main = do
  (n,k) <- listToTuple2 . map read . words <$> getLine :: IO (Int,Int)
  xs <- map readIntBS . BS.words <$> BS.getLine :: IO [Int]

  let
    (a,b) = span (<0) xs
    a_ = listArray (0,length a) $ 0 : (reverse $ map negate a)
    b_ = listArray (0,length b) $ 0 : b



  print $ minimum [min (a_!l*2+b_!r) (a_!l+b_!r*2) | l<-[0..length a], let r=if k-l<0 then 0 else k-l, r<=length b]



Measured memory_bytes: 16764
n=int(input())

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

	# divisors.sort()
	return divisors
	
print(sum(make_divisors(n)[-1])-2)

Measured memory_bytes: 3572
#include<bits/stdc++.h>
using namespace std;
int main()
{
int X,Y,x,y;
cin>>X>>Y;
x=(4*X-Y)/2;
y=(Y-2*X)/2;
if(x<0&&y>0)
x=0;
if(x>0&&y<0)
y=0;
if(x<0&&y<0)
{
x=0;
y=0;
}
if(x+y==X)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
return 0;
}

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
    
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<4;i++){
        if(s[i]=='+')ans++;
        else ans--;
    }
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
///mAAria...
#include<bits/stdc++.h>
 
using namespace std;
 
#define int long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(v) v.begin(),v.end()
#define ld long double
#define ff first
#define ss second
#define pii pair<int,int>
#define pi 3.1415926535897932384626433832
#define mod 1000000007
#define inf 1000000000
#define pr1(a) cout << a << endl
#define pr2(a,b)cout << a <<  " " <<b<< endl
#define pr3(a,b,c) cout << a <<" " << b << " " << c << endl

const long double PI = acos(-1);

int powm(int a, int b) {
    int res=1;
    while(b) {
        if(b&1)
            res=(res*a)%mod;
        a=(a*a)%mod;
        b>>=1;
    }
    return res;
}
int gcd(int a, int b){
    if(b==0)return a;
    gcd(b,a%b);
}
void solve(){
    int n,k,a[100005];
    cin >> n >> k;

    int lcm = 0;

    for(int i = 1;i<=n;i++){
        cin >> a[i];
        a[i]/=2;
        if(!lcm)lcm = a[i];
        if((a[i]*lcm)%gcd(max(lcm,a[i]),min(lcm,a[i]))==0)lcm = (a[i]*lcm)/gcd(max(lcm,a[i]),min(lcm,a[i]));
        //cout << lcm << endl;
    }
    if(lcm>k)cout << 0 << endl;
    else{
        for(int i = 1;i<=n;i++){
            if((lcm/a[i])%2==0){
                cout << 0 << endl;
                return;
            }
        }
    int ans = k/lcm;
    cout << (ans+1)/2LL << endl;
    }

} 

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

    for(int i = 1;i<=t;i++){
        solve();
    }
    return 0;
} 

 


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

int main(){
  ll X;
  cin >> X;
  bool flag = false;
  for(ll A=-119; A<120; A++){
    for(ll B=-120; B<120; B++){
      if(X == A*A*A*A*A-B*B*B*B*B){
        cout << A << " " << B << endl;
        flag = true;
        break;
      }
    }
    if(flag)break;
  }
}

Measured memory_bytes: 3616
import java.util.Scanner;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int a;
		int b;
		int[] t = new int[100011];
		for(int i=0; i<N; i++) {
			a = sc.nextInt();
			b = sc.nextInt();
			for(int j=a-1; j<=b-1; j++) {
				t[j]++;
			}
		}
		int ans = 0;
		for(int i=0; i<=100001; i++) {
			if(i<=t[i]) ans = i;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 69408
n, c = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
MOD = 10 ** 9 + 7

dp = [[0] * (c + 1) for i in range(n + 1)]
dp[0][0] = 1

ru = [[0] * 410 for i in range(410)]
for cnt in range(410):
    for x in range(409):
        ru[cnt][x + 1] += ru[cnt][x] + pow(x, cnt, MOD)
        ru[cnt][x + 1] %= MOD
      
for ni in range(n):
    for cnt in range(c + 1):
        for ci in range(cnt, c + 1):
            dp[ni + 1][ci] += (ru[cnt][b[ni] + 1] - ru[cnt][a[ni]]) * dp[ni][ci - cnt] 
            dp[ni + 1][ci] %= MOD
print(dp[-1][-1])

Measured memory_bytes: 44524
def resolve():
    N, D = list(map(int, input().split()))
    XY = [list(map(int, input().split())) for _ in range(N)]
    cnt = 0
    import math
    for x, y in XY:
        if math.sqrt(x**2+y**2) <= D:
            cnt += 1
    print(cnt)
    
if '__main__' == __name__:
    resolve()

Measured memory_bytes: 45376
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

const ll INF=1e18;

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

  int N;
  cin>>N;
  vector<ll> A(N);
  rep(i,N) cin>>A[i];

  vector<pair<ll,int>> v(N);
  rep(i,N) v[i]=mkp(A[i],i);

  sort(v.rbegin(),v.rend());

  vector<vector<ll>> dp(N+1,vector<ll> (N+1,-INF));
  dp[0][0]=0;
  for(int i=0;i<N;i++){
    ll val=v[i].first;
    int now=v[i].second;
    for(int j=0;j<=i;j++){
      if(dp[i][j]==-INF) continue;
      chmax(dp[i+1][j+1],dp[i][j]+val*abs(now-j));
      chmax(dp[i+1][j],dp[i][j]+val*abs(now-(N-(i-j)-1)));
    }
  }

  ll ans=dp[N][0];
  rep(i,N+1) chmax(ans,dp[N][i]);
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 34616
#include <bits/stdc++.h>
#define rep(i,a,b) for(auto i=(a);i<(b);i++)
#define per(i,a,b) for(auto i=(a);i>=(b);i--)
#define Min(a,b) ((a) < (b) ? (a) : (b))
#define Max(a,b) ((a) > (b) ? (a) : (b))
#define int_inf 0x3f3f3f3f
#define int_max 2147483647
#define ll_max 9223372036854775807
#define ull_max 18446744073709551615
#define ll_inf 0x7f7f7f7f7f7f7f7f
#define lowbit(x) (x)&(-x)
#define mp make_pair
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
const ll mod=1e9+7;
template<class T>
inline T read()
{
	T x=0,f=1;char s=getchar();
	while(s<'0'||s>'9') {if(s=='-')f=-1;s=getchar();};
	while(s>='0'&&s<='9'){x=(x<<3)+(x<<1)+s-48;s=getchar();};
	return x*f;
}
template<typename T>
inline void wri(T x)
{
	if(x<0){x=-x;putchar('-');};
	if(x/10) wri(x/10);
	putchar(x%10+48);
}
template<typename T>
inline void print(T x,char s)
{
	wri(x);
	putchar(s);
}
template<typename T>
T gcd(T a,T b)
{
	return b==0?a:gcd(b,a%b);
}
//关闭流同步就不能手写读入优化啦
int n;
int a[200010],b[200010]; 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
    cin>>n;
    rep(i,1,n+1){
    	cin>>a[i]>>b[i];
	}
	sort(a+1,a+1+n);
	sort(b+1,b+1+n);
	if(n%2){
		cout<<b[(n+1)/2]-a[(n+1)/2]+1<<endl;
	}
	else{
		int l,r,cnt=0;
		if((a[n/2]+a[n/2+1])%2){
			cnt++;
			l=(a[n/2]+a[n/2+1])/2+1;
		}
		else l=(a[n/2]+a[n/2+1])/2;
		if((b[n/2]+b[n/2+1])%2){
			cnt++;
			r=(b[n/2]+b[n/2+1])/2;
		}
		else r=(b[n/2]+b[n/2+1])/2;
		cnt+=(r-l)*2+1;
		cout<<cnt<<endl;
	}
    return 0;
}


Measured memory_bytes: 5216
#include<iostream>
    #include<stdio.h>
    using namespace std;
     
    int main(void){
    	char a[6],b[8],c[6],d[2],e[2];
    	scanf("%5s",a);
    	scanf("%1s",d);
    	scanf("%7s",b);
    	scanf("%1s",e);
    	scanf("%5s",c);
    	printf("%s %s %s\n",a,b,c);
    	return 0;
    }

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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_h(const vector<T>& c)
{ for (int i = 0; i < c.size(); i++) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
#define D1(a) cout<<#a<<":"<<a<<"\n"
#define D2(a,b) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<endl 
#define D3(a,b,c) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c <<endl
#define D4(a,b,c,d) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c<<","<<#d<<":"<<d<<endl 
#define MOD 1000000007
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};

int main()
{
    string S; cin >> S;
    int N = S.size();
    int ans = 0;
    rep(i, N/2) {
        if (S[i] != S[N-1-i]) ans++;
    }
    
    cout << ans << endl;
}


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

int main() {
    string s;
    cin>>s;
    if (s[1]=='B') {
        cout<<"ARC"<<endl;
    } else {
        cout<<"ABC"<<endl;
    }
}   


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

int main() {
	int N, K, x,sum = 0;
	cin >> N >> K;
	
	for (int i = 0; i < N; i++)
	{
		cin >> x;
		if (x*2 <= (K - x)*2) sum += x * 2;
		else sum += (K - x)*2;
	}
	cout << sum << endl;

}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <algorithm>

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

const int N = 500;

using namespace std;

int main() {
	int k, x;
	
	cin >> k >> x;
	
	cout << ((k * N >= x) ? "Yes" : "No") << endl;
	
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int k,i,l;
    string s;
    cin>>k>>s;
    l=s.length();
    if(l<=k)
        cout<<s<<endl;
    else
    {
        for(i=0;i<k;i++)
        {
            cout<<s[i];
        }
        cout<<"..."<<endl;
    }
}



Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define f(i,j,n) for(int i=j;i<=n;i++)
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a,b;
  cin>>a>>b;
  cout<<(a*b)-(a+b)+1;
} 

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>
#include <climits>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

#define INF 1145141919

int D, N;
int dp[210][210];
int T[210];
int A[210], B[210], C[210];

int main() {
  cin >> D >> N;
  for (int i=0; i<D; i++) cin >> T[i];
  for (int i=0; i<N; i++) cin >> A[i] >> B[i] >> C[i];

  for (int i=0; i<D; i++) {
    for (int j=0; j<N; j++) {
      dp[i][j] = -INF;
    }
  }
  for (int i=0; i<N; i++) {
    if (T[0] >= A[i] && T[0] <= B[i]) dp[0][i] = 0;
  }
  for (int i=0; i<D; i++) {
    for (int j=0; j<N; j++) {
      for (int k=0; k<N; k++) {
        if (T[i+1] >= A[k] && T[i+1] <= B[k]) {
          dp[i+1][k] = max(dp[i+1][k], dp[i][j] + abs(C[j] - C[k]));
        }
      }
    }
  }
  int ans = 0;
  for (int i=0; i<N; i++) {
    ans = max(ans, dp[D-1][i]);
  }
  cout << ans << "\n";
  return 0;
}

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

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

LL fac[SIZE], finv[SIZE], inv[SIZE];
void combInit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for( int i = 2; i < SIZE; ++i ) {
        fac[i] = (fac[i - 1] * i) % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = (finv[i - 1] * inv[i]) % MOD;

    }
}

LL comb(int n, int k) {
    if( n < k ) return 0;
    if( n < 0 || k < 0 ) return 0;
    return (fac[n] * (finv[k] * finv[n - k] % MOD)) % MOD;

}

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

void dfs(int pos, int cnt);

vector< int > graph[SIZE];
bool flg = false;
int n;

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

    int m;
    cin >> n >> m;
    for( int i = 0; i < m; ++i ) {
        int a, b;
        cin >> a >> b;
        graph[a].pb(b);
        graph[b].pb(a);

    }
    dfs(1, 0);
    if( flg ) cout << "POSSIBLE";
    else cout << "IMPOSSIBLE";
    cout << endl;

    return 0;
}

void dfs(int pos, int cnt) {
    if( flg ) return;
    if( cnt == 2 && pos == n ) {
        flg = true;

    }
    if( cnt >= 2 ) return;

    for( int i = 0; i < graph[pos].size(); ++i ) {
        dfs(graph[pos][i], cnt + 1);

    }

    return;
}



Measured memory_bytes: 13424
import sys
import math
import collections
import bisect
import itertools

# import numpy as np

sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline().rstrip())
ns = lambda: map(int, sys.stdin.readline().rstrip().split())
na = lambda: list(map(int, sys.stdin.readline().rstrip().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().rstrip().split()))


# ===CODE===

def main():
    s = input()
    ans = 0
    if s[0]==s[1]==s[2]=="R":
        ans = 3
    elif s[0]==s[1]=="R" or s[1]==s[2]=="R":
        ans = 2
    elif "R" in s:
        ans = 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string alp = "abcdefghijklmnopqrstuvwxyz";
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
void neg() {cout << -1 << endl;}

int main() {
  int x1, y1, x2, y2, x3, y3, x4, y4;
  cin >> x1 >> y1 >> x2 >> y2;
  int dx = x2 - x1, dy = y2 - y1;
  x3 = x2 - dy;
  y3 = y2 + dx;
  dx = x3 - x2;
  dy = y3 - y2;
  x4 = x3 - dy;
  y4 = y3 + dx;
  cout << x3 << " " << y3 << " " << x4 << " " << y4 << endl;
}

Measured memory_bytes: 256