akhauriyash/Code-Regression huggingface dataset:
using System;
using System.IO;
using System.Collections.Generic;
using System.Text.RegularExpressions;
class Program
{
    static int x;
    static string result;
    static void Main()
    {
        string tmp2 = Console.ReadLine();
        int x = tmp2.Length;
        int[] child = new int[x];
        int[] childs = new int[x];
        for (int i = 0; i < x; i++) { childs[i]=0; if (tmp2[i] == 'L') { child[i]=-1; } else { child[i]=1; } }
        int start = 0;
        int point = 0;
        int now = 1;
        int nowcount = 0;
        int childgather = 0;
        for (int i = 0; i < x; i++)
        {
            if (now == child[i]) { childgather++; }
            else
            {
                if (nowcount == 1) { nowcount = 0; now = 1; childs[point] = childgather / 2; childs[point + 1] = childgather / 2; if (childgather % 2 > 0) { if ((point - start) % 2 == 0) { childs[point]++; } else { childs[point + 1]++; } } childgather = 1; start = i; }
                else { childgather++; nowcount++; now = -1; point = i - 1; }
            }
        }
        nowcount = 0; now = 1; childs[point] = childgather / 2; childs[point + 1] = childgather / 2; if (childgather % 2 > 0) { if ((point - start) % 2 == 0) { childs[point]++; } else { childs[point + 1]++; } }

        System.Text.StringBuilder Sb = new System.Text.StringBuilder();//こいつに文字を追加する
        for (int i=0;i<x;i++) { Sb.Append(childs[i].ToString());if (i < x - 1) { Sb.Append(" "); } }
        Console.WriteLine(Sb);
        
    }

 


}

Measured memory_bytes: 15456
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <functional>
#include <numeric>
#include <array>
#include <cmath>
#include <limits>
#include <cstdio>
#include <iomanip>
	using namespace std;
	#define ll long long


int main() {
	int n, x[10], y[10];
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x[i] >> y[i];
	}
	vector<int> v(n);
	double ans = 0;
	ll count = 0;
	iota(v.begin(), v.end(), 0);
	do {
		for (int i = 1; i < n; i++) {
			double hoge = (x[v[i]] - x[v[i - 1]]) * (x[v[i]] - x[v[i - 1]]) + (y[v[i]] - y[v[i - 1]]) * (y[v[i]] - y[v[i - 1]]);
			hoge = pow(hoge, 0.5);
			ans += hoge;
		}
		count++;
	} while (next_permutation(v.begin(), v.end()));
	ans = ans / count;
	cout << fixed << setprecision(10) << ans << endl;
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <limits.h>
 
const int MAX = 5e5;
const int INF = INT_MAX;
 
void merge(int*, int, int, int);
void mergesort(int*, int, int);
 
int ans;
 
int main(){
  int n, i, a[MAX];
 
  scanf("%d" ,&n);
  for(i = 0 ; i < n ; i++){
    scanf("%d" ,a + i);
  }
 
  mergesort(a, 0, n);
 
  for(i = 0 ; i < n ; i++){
    printf("%d%c" ,a[i], i != n-1 ? ' ':'\n');
  }
  printf("%d\n" ,ans);
 
  return 0;
}
 
void merge(int a[], int left, int mid, int right){
  int n1 = mid - left, n2 = right - mid;
  int L[n1+1], R[n2+1], i, j, k;
 
  for(i = 0 ; i < n1 ; i++){
    L[i] = a[left + i];
  }
 
  for(i = 0 ; i < n2 ; i++){
    R[i] = a[mid + i];
  }
 
  L[n1] = R[n2] = INF;
 
  for(i = 0, j = 0, k = left ; k < right ; k++, ans++){
    if(L[i] <= R[j]){
      a[k] = L[i++];
    }else{
      a[k] = R[j++];
    }
  }
}
 
void mergesort(int a[], int left, int right){
  int mid;
 
  if(left + 1 < right){
    mid = (left + right) / 2;
    mergesort(a, left, mid);
    mergesort(a, mid, right);
    merge(a, left, mid, right);
  }
}


Measured memory_bytes: 5596
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
        String[] str = new String[2];
        int count = 0;
        while(in.hasNext()) {
            String buf = in.nextLine();
            str[count] = buf;
            count++;
        }
        Integer number = Integer.parseInt(str[0]);
        String[] split = str[1].split(" ");
        int[] facter; 
        facter = new int[split.length];
        
        for (int i = 0; i < split.length; i++) {
        	if (i != 0) {
        		System.out.print(" ");
        	}
        	facter[i] = Integer.parseInt(split[i]);
        	System.out.print(facter[i]);
        }
        System.out.println("");

        
        for (int i = 1; i <= (number -1); i++) {
        	int v = facter[i];
        	int j = i - 1;
        	
        	while ((j >= 0) && (facter[j] > v)) {
        		facter[j + 1] = facter[j];
        		j--;
        	}
        	facter[j + 1] = v;
        	
        	for ( int t = 0; t < split.length; t++) {
        		if (t != 0) {
        			System.out.print(" ");
        		}
        		System.out.print(facter[t]);
        	}
        	System.out.println("");

        	
        }
	}

}

Measured memory_bytes: 34412
import std.stdio, std.conv, std.string;
import std.algorithm, std.array, std.container, std.typecons;
import std.numeric, std.math;
import core.bitop;

T RD(T = string)() { static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T)(in string str) { return str.split.to!(T[]); }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool INSIDE(T)(T x, T b, T e) { return x >= b && x < e; }

long mod = pow(10, 9) + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

struct UnionFind
{
	void init(long n) { par = new long[](n); foreach (i; 0..n) par[i] = i; }
	long root(long i) { return par[i] == i ? i : (par[i] = root(par[i])); }
	bool same(long i, long j) { return root(i) == root(j); }
	void unite(long i, long j) { i = root(i); j = root(j); if (i == j) return; par[i] = j; }
	long[] par;
}

void main()
{
	auto N = RD!long;
	auto M = RD!long;
	auto cnt = new long[](M+1);
	foreach (i; 0..N)
	{
		auto K = RD!long;
		foreach (j; 0..K)
		{
			auto A = RD!long;
			++cnt[A];
		}
	}
	long ans;
	foreach (e; cnt)
	{
		if (e == N) ++ans;
	}

	writeln(ans);
	stdout.flush();
}

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

using namespace std;

typedef long long ll;

ll cal(ll n, ll x, ll y)
{
    ll a = n / x, b = n / y, t = x / __gcd(x, y) * y, c = n / t;
    return n - (a + b - c);
}

int main()
{
    long long a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << cal(b, c, d) - cal(a - 1, c, d) << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (ll i = (ll)(a); i < (ll)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#define ALL(x) x.begin(), x.end()
using namespace std;

int main(int argc, char const *argv[])
{
    int k, t;
    cin >> k >> t;
    vector<int> a(t);
    rep(i, t)
    {
        cin >> a[i];
    }
    sort(ALL(a), greater<int>());
    if (t == 1)
    {
        cout << k - 1 << endl;
        return 0;
    }

    int rest = 0;

    rep(i, 1, t)
    {
        rest += a[i];
    }
    cout << max(0, a[0] - 1 - rest) << endl;
    return 0;
}


Measured memory_bytes: 256
fn cand_755(N: u64, value: u64) -> Vec<u64> {
    let mut result = Vec::new();
    if value + 3 <= N {
        result.push(value + 3);
        result.append(&mut cand_755(N, (value + 3) * 10));
    }
    if value + 5 <= N {
        result.push(value + 5);
        result.append(&mut cand_755(N, (value + 5) * 10));
    }
    if value + 7 <= N {
        result.push(value + 7);
        result.append(&mut cand_755(N, (value + 7) * 10));
    }
    return result;
}

fn c_755() {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).expect("input error");
    let N = input.trim_right().parse::<u64>().expect("parse error");

    let mut candidate = cand_755(N, 0);

    let count = candidate.iter()
        .filter_map(|n| {
            let snv: Vec<char> = n.to_string()
                .chars()
                .collect();
            if snv.iter().any(|&x| x == '3') &&
                snv.iter().any(|&x| x == '5') &&
                snv.iter().any(|&x| x == '7') {
                return Some(n);
            }
            else {
                return None;
            }
        }).count();
    println!("{}", count);
}

fn main() {
    c_755();
}

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

#define Int long long int
#define REP(i,n) for(int i=0;i<(n);i++)
#define REAP(i,a,n) for(int i=(a);i<(n);i++)
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr first
#define sc second
#define pb push_back
#define All(v) v.begin(),v.end()

int main(){
    string n;
    cin >> n;
    int sum=0;
    for(int i=n.size()-1;i>0;i--){
        if(n[i]=='9')sum+=9;
        else{
            n[i-1]--;
            sum+=9;
        }
    }
    if(n[0]>'0')sum+=n[0]-'0';
    cout << sum << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <climits>
#include <map>
#include <unordered_map>
#include <string.h>
#include<iomanip>
#include <iterator>
#include <locale>

#define all(a) a.begin(),a.end()
#define VV(T) vector<vector< T > >
#define rep(i,N) for(int i = 0; i <N; i++)
#define repsg(i,s,g) for(int i = s; i <g; i++)
#define name(x) #x
using namespace std;

const int INF = INT_MAX;
const long long INFL = 1LL<<40;
const double PI = atan(1)*4;
const long long MOD = pow(10,9)+7;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

typedef long long ll,LL;
typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pLL;


// vector入力
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x: vec) is >> x;
    return is;
}
// vector出力
template<typename T>
ostream& operator << (ostream& os, vector<T>& vec){
    for(int i=0; i<vec.size(); i++){
        os << vec[i] << ( i+1 == vec.size() ? "" : " " );
    }
    return os;
}


int main() {
    int n,k;cin>>n>>k;
    vector<pii> td(n);
    rep(i,n){
        cin>>td[i].second>>td[i].first;
    }
    
    sort(all(td));
    reverse(all(td));
    
    vector<int> t(n);
    vector<int> d(n);
    
    rep(i,n)tie(d[i],t[i]) = td[i];
    
    
    ll ans = 0;
    
    set<int> set;
    stack<int> st;
    rep(i,k){
        if(set.count(t[i])){
            st.push(d[i]);
        }
        set.insert(t[i]);
        ans+=d[i];
    }
    
    ll sum = ans;
    ans = sum + set.size()*set.size();
    
    repsg(i,k,n){
        if(st.empty())break;
        if(set.count(t[i]))continue;
        set.insert(t[i]);
        sum-=st.top();st.pop();
        sum+=d[i];
        ll temp = sum + set.size() * set.size();
        
        ans = max(ans,temp);
    }
    
    cout<<ans<<endl;
    
    return 0;
}





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

int main(){
  long A,B;
  int K;
  int counter;
  cin>>A>>B;
  cin>>K;
  long a,b;
  int temp;
  a=A;
  b=B;
  for (int k=0;k<K;k++){
    if (k%2==0){
      if (a%2==1){
        a=a-1;
      }
      b=b+a/2;
      a=a/2;
    }
    else {
      if (b%2==1){
        b=b-1;
      }
      a=a+b/2;
      b=b/2;
    }
  }
  cout<<a<<' '<<b;
  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

def main():
    n, k = map(int, input().split())

    li = []

    for i in range(k):
        d = int(input())
        a_li = list(map(int, input().split()))

        li += a_li

    print(n - len(set(li)))

if __name__ == '__main__':
    main()


Measured memory_bytes: 9096
n = gets.to_i
s = gets.chomp
ans = 0
l, r = 0, 0
while r < n
  subst = s[l..r]
  rest = s[r + 1..-1]
  if rest[subst]
    ans = subst.size if subst.size > ans
    r += 1
  else
    l += 1
    r += 1
  end
end
p ans


Measured memory_bytes: 4732
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <stack>
#include <limits>
#include <array>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <memory>
#include <numeric>
#include <tuple>

constexpr long long mod = static_cast<long long>(1e9 + 7);

int main() {
  int A, B, C;
  std::cin >> A >> B >> C;
  std::array<int, 3> arr = {A, B, C};
  std::sort(begin(arr), end(arr));
  A = arr[0];
  B = arr[1];
  C = arr[2];
  int ans = 0;
  if (A % 2 == B % 2)
    ans = (B-A)/2 + C-B;
  else
  {
    if (B%2==C%2)
      ans = (C-B)/2 + 1 + (C-A)/2 + 1;
    else
      ans = (C-A)/2 + 1 +(C-B)/2 + 1;
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 256
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn main() {
    let n = read::<usize>();
    let ps = read_vec2::<i64>(n as u32);
    let mut sample = 0;
    for (i, p) in ps.iter().enumerate() {
        if p[2] != 0 {
            sample = i;
            break;
        }
    }

    for x in 0..101 {
        for y in 0..101 {
            let h = ps[sample][2] + (ps[sample][0] - x).abs() + (ps[sample][1] - y).abs();
            let mut f = true;

            for p in &ps {
                let px = p[0];
                let py = p[1];
                let ph = p[2];

                if std::cmp::max(h - (px-x).abs() - (py-y).abs(), 0) != ph {
                        f = false;
                        break;
                }
            }
            if f {
                println!("{} {} {}", x, y, h);
                return;
            }
        }
    }
}


Measured memory_bytes: 4352
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
  int n;
  cin >> n;
  vector<pair<int, int>> d(n);

  for (int i = 0; i < n; i++)
  {
    cin >> d[i].first >> d[i].second;
  }

  int cnt = 0;
  bool result = false;
  for (int i = 0; i < n; i++)
  {
    if (d[i].first == d[i].second)
    {
      cnt++;
    }
    else
    {
      cnt = 0;
    }

    if (cnt == 3)
    {
      result = true;
      break;
    }
  }

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

  return 0;
}

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

int main(){
 int N;
  cin >> N;
  vector<long long> H(N);
  for(int i = 0; i < N; i++){
   	cin >> H[i]; 
  }
  int ans = 0;
  int max = 0;
  for(int i = 0; i < N-1; i++){
    if(H[i]>=H[i+1])ans++;
    if(H[i] < H[i+1])ans = 0;
    if(max < ans){
      max = ans;
  
    }
  
  }
  cout << max << endl;
}


Measured memory_bytes: 1024
// RAM RAM

#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define ppb pop_back
#define vi vector<int>
#define mp make_pair
#define arrayin(a,n) for(int i=0;i<n;i++){cin>>a[i];}
#define N 55

using namespace std;


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

    int n,k;cin>>n>>k;
    int res=k;
    for(int i=1;i<n;i++){
    	res=res*(k-1);
    }
    cout<<res<<endl;
	return 0;
}

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

vector<pair<double,double>> pr;


double dist(pair<double,double> p, pair<double,double> q){
    double x = p.first - q.first;
    double y = p.second - q.second;
    return sqrt(x*x + y*y);
}

double f(double x,double y){
    double res = 0;
    for(int i = 0; i < (int)pr.size(); i++){
        res = max(res, dist({x,y},pr[i]));
    }
    return res;
}

double g(double x){
    double l = 0,r = 1000;
    for(int i = 0; i < 80; i++){
        double y1 = (l*2+r)/3;
        double y2 = (l+r*2)/3;
        if(f(x,y1)>f(x,y2)) l = y1; else r = y2;
    }
    return f(x,l);
}


int main(){
    int n;cin>>n;
    for(int i = 0; i < n; i++){
        double x,y;cin>>x>>y;
        pr.push_back({x,y});
    }
    double l = 0, r = 1000;
    for(int i = 0; i < 80; i++){
        double x1 = (l*2+r)/3;
        double x2 = (l+r*2)/3;
    if(g(x1)>g(x2)) l = x1; else r = x2;
    }

    double res = g(l);
    cout<<fixed<<setprecision(12)<<res;
    
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;

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

    int n1 = (n+1)/2;
    if(n1>=k)cout << "YES" << endl;
    else cout << "NO" <<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#define M 100
int main(){
  int i, j, N, v;
  int *A;

  scanf("%d",&N);
  A = (int *)malloc(sizeof(int) * N);
 
  for( i = 0 ; i < N ; i++ ){
    scanf("%d",&A[i]);
  }
    printf("%d",A[0]);
    for( j = 1 ; j < N ; j++ ){
      printf(" %d",A[j]);
    }
    printf("\n");

  /*   sort   */
  for( i = 1 ; i < N ; i++ ){
    v = A[i];
    j = i - 1;
    while( ( j >= 0 ) && (A[j] > v) ){
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;

    printf("%d",A[0]);
    for( j = 1 ; j < N ; j++ ){
      printf(" %d",A[j]);
    }
    printf("\n");
  }

  
  return 0;
}



Measured memory_bytes: 2084
#include<stdio.h>
int main(void){
    char str[21];
    int i,j;
    scanf("%s",str);
    for(j=0; j<21; j++){
        if(str[j]=='\0'){
            break;
        }
    }
    j--;
    for(i=j; i>=0; i--){
        printf("%c",str[i]);
    }
    printf("\n");
    return 0;
}

Measured memory_bytes: 524
#include <stdio.h>

#define MAX 10000
#define NIL -1

struct Node {int p,l,r;};
struct Node A[MAX];
int n;

void preparse(int);
void inparse(int);
void postparse(int);

int main(){
  int i,v,l,r,root;

  scanf("%d",&n);
  for(i=0;i<n;i++)
    A[i].p=NIL;
  for(i=0;i<n;i++){
    scanf("%d %d %d",&v,&l,&r);
    A[v].l=l;
    A[v].r=r;
    if(l!=NIL)
      A[l].p=v;
    if(r!=NIL)
      A[r].p=v;
	}
  for(i=0;i<n;i++)
    if(A[i].p==NIL)root=i;

  printf("Preorder\n");
  preparse(root);
  printf("\n");

  printf("Inorder\n");
  inparse(root);
  printf("\n");

  printf("Postorder\n");
  postparse(root);
  printf("\n");

  return 0;
}
void preparse(int a){
  if(a==NIL)return;
  printf(" %d",a);
  preparse(A[a].l);
  preparse(A[a].r);
}
void inparse(int a){
  if(a==NIL)return;
  inparse(A[a].l);
  printf(" %d",a);
  inparse(A[a].r);
}
void postparse(int a){
   if(a==NIL)return;
   postparse(A[a].l);
   postparse(A[a].r);
   printf(" %d",a);

}



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

const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

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

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

    int n,k;
    cin >> n >> k;
    vector<int> l(k),r(k);
    rep (i, k) cin >> l[i] >> r[i];
    vector<mint> dp(n+1);
    vector<mint> dpsum(n+1);
    dp[1]=1;
    dpsum[1]=1;
    for (int i=2; i <= n; ++i) {
        rep (j, k) {
            int li = i - r[j];
            int ri = i - l[j];
            if (ri < 0) continue;
            li = max(li, 1);
            dp[i] += dpsum[ri] - dpsum[li-1];
        }
        dpsum[i] = dpsum[i-1]+dp[i];
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 6360
#include <iostream>

int main() {
    int n, m, cnt=0;
    std::cin >> n;
    for (int i=0; i<n; i++) {
        std::cin >> m;
        if ( m%2 == 1 ) {
            cnt++;
        }
    }
    if ( cnt%2 == 0 ) {
        std::cout << "YES" << std::endl;
    } else {
        std::cout << "NO" << std::endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int N;
	scanf("%d",&N);
	int dp[2] = {0};
	int a[2] = {0};
	scanf("%d%d",&a[1],&a[0]);
	dp[0] = abs(a[1]-a[0]);
	for(int i=3; i<=N; i++)
	{
		int x;
		scanf("%d",&x);
		dp[i%2] = min(dp[i%2] + abs(x-a[i%2]), dp[(i+1)%2] + abs(x-a[(i+1)%2]));
		a[i%2] = x;
	}
	printf("%d\n",dp[N%2]);
	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	r := bufio.NewReader(os.Stdin)
	var a, b, n int
	fmt.Fscan(r, &a)
	fmt.Fscan(r, &b)
	fmt.Fscan(r, &n)

	x := n
	if n >= b-1 {
		x = b - 1
	}
	ans := a*x/b - a*(x/b)
	fmt.Println(ans)
}

Measured memory_bytes: 1824
using System;
using System.Collections.Generic;
using System.Linq;

public class Hello
{
    private const int MOD_N = 1000000000 + 7;

    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());

        Console.WriteLine((n + 1) / 2);
    }

    private static int GCD(int a, int b) => a > b ? GCD_impl(a, b) : GCD_impl(b, a);
    private static int GCD_impl(int a, int b) => b == 0 ? a : GCD_impl(b, a % b);
    private static long LCM(int a, int b) => (long)a * b / GCD(a, b);

    private static int Comb(int m, int n)
    {
        var t = m - n;
        if (n > t)
            n = t;

        long numerator = 1;
        for (int i = 0; i < n; ++i)
        {
            numerator *= m - i;
            numerator %= MOD_N;
        }
        long denominator = 1;
        for (; n != 0; --n)
        {
            denominator *= n;
            denominator %= MOD_N;
        }

        var inv_denominator = ModInv((int)denominator, MOD_N);
        var ret = (int)(numerator * inv_denominator % MOD_N);

        return ret >= 0 ? ret : ret + MOD_N;
    }

    private static int ModInv(int a, int m)
    {
        int b = m, x = 1, y = 0;
        while (b != 0)
        {
            var t = a / b;
            a -= t * b;
            Swap(ref a, ref b);
            x -= t * y;
            Swap(ref x, ref y);
        }
        x %= m;
        return x >= 0 ? x : x + m;
    }

    private static void Swap<T>(ref T a, ref T b)
    {
        var t = a;
        a = b;
        b = t;
    }
}


Measured memory_bytes: 13140
// ALSD_1_3_C.cpp
// Doubly Linked List
#include <iostream>
#include <deque>

using namespace std;

int main()
{
    int n;
    string cmd;
    int num;
    deque<int> nums;
    cin >> n;
    while (n--) {
        cin >> cmd;
        if (cmd == "insert") {
            cin >> num;
            nums.push_front(num);
        }
        else if (cmd == "delete") {
            cin >> num;
            for (int i = 0; i < nums.size(); i++) {
                if (nums[i] == num) {
                    nums.erase(nums.begin() + i);
                    break;
                }
            }

        }
        else if (cmd == "deleteFirst") {
            nums.pop_front();
        }
        else if (cmd == "deleteLast") {
            nums.pop_back();
        }

    }

    for (int i = 0; i < nums.size(); i++) {
        if (i > 0) {
            cout << " ";
        }
        cout << nums[i];
    }
    cout << endl;
    return 0;
}

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

int main() {
	// your code goes here
	int k;
	string s;
	cin>>k>>s;
	int l=s.length();
	if(l<=k) cout<<s;
	else{
		//for(int i=0; s[i]; i++) cout<<s[i];
		for(int i=0; i<k; i++) cout<<s[i]; cout<<"...";
	}
	return 0;
}

Measured memory_bytes: 3600
#[allow(unused_imports)]
use std::io;
#[allow(unused_imports)]
use std::cmp;
use std::collections::LinkedList;

#[allow(dead_code)]
fn getline() -> LinkedList<String> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok().unwrap();
    s.split(' ').map(|x| x.trim().to_string()).collect::<LinkedList<String>>()
}

#[allow(dead_code)]
fn get<T: std::str::FromStr>(l: &mut LinkedList<String>) -> T {
    l.pop_front().and_then(|s| s.parse().ok()).unwrap()
}

fn main() {
    let mut l = getline();
    let n: i64 = get(&mut l);
    let a: i64 = get(&mut l);
    let b: i64 = get(&mut l);
    let xs: Vec<i64> = getline().iter().map(|s| s.parse().unwrap()).collect();
    let mut tired = 0i64;
    for i in 1..n as usize {
        let diff = xs[i] - xs[i-1];
        tired += cmp::min(diff * a, b);
    }
    println!("{}", tired);
}


Measured memory_bytes: 10492
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(void){
  int n,i;
  double s[1000],sum1,m,sum2,a;
  while(1){
      cin >> n;
      if(n==0)break;
      sum1=0;
      for(i=0;i<n;i++){
          cin >> s[i];
          sum1+=s[i];
      }
      m=sum1/(double)n;
      sum2=0;
      for(i=0;i<n;i++){
       sum2+= (pow(s[i]-m,2));
      }
      a = sqrt(sum2/n);
   cout << fixed << setprecision(8) << a << endl;
  }
}


Measured memory_bytes: 3272
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <vector>
#include <string>
#include <bitset>
#include <stack>
#include <queue>
#include <tuple>
#include <regex>
#include <cmath>
#include <map>
#include <set>
#include <functional>
#include <cstring>

using namespace std;

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

using ll = long long;
using Pint = pair<int, int>;
using Pll  = pair<ll, ll>;

#define eb emplace_back
#define pb push_back
#define mp make_pair

#define F first
#define S second

#define popcnt __builtin_popcountll

#define rep( i, n ) for ( ll i = 0; i < (ll)( n ); ++i )
#define reps( i, n ) for ( ll i = 1; i <= (ll)( n ); ++i )
#define rrep( i, n ) for ( ll i = (ll)( ( n ) - 1 ); i >= 0; --i )
#define rreps( i, n ) for ( ll i = (ll)( ( n ) ); i > 0; --i )
#define arep( i, v ) for ( auto &&i : ( v ) )

#define ALL( c ) ( c ).begin(), ( c ).end()
#define RALL( c ) ( c ).rbegin(), ( c ).rend()
#define UNIQUE( c ) ( c ).erase( unique( ( c ).begin(), ( c ).end() ), ( c ).end() )

template<typename T = ll> constexpr T MAX = numeric_limits<T>::max();
template<typename T> T gcd( const T a, const T b ) { return ( b ? gcd( b, a % b ) : a ); }
template<typename T> T lcm( const T a, const T b ) { return ( a / gcd( a, b ) * b ); }


int main()
{
	string s; cin >> s;
	if ( s.back() == 's' )
		cout << s + "es" << endl;
	else
		cout << s + "s" << endl;

	return ( 0 );
}


Measured memory_bytes: 3056
#include<stdio.h>
#include<string.h>
#include<math.h>
int main(){
  int a[101],top=0,i;
  char s[101];
  while(scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){
      top--;
      a[top]=a[top]+a[top+1];
    }
    else if ( s[0] == '-' ){
      top--;
      a[top]=a[top]-a[top+1];
    }
    else if ( s[0] == '*' ){
      top--;
      a[top]=a[top]*a[top+1];
    }
    else {
      top++;
      a[top] = atoi(s);
    }
  }
  printf("%d\n",a[1]);
  return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
#define pb(a) push_back(a)
#define INF 1000000000
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

typedef vector<unsigned int>vec;
typedef vector<vec> mat;

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; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const double PI = acos(-1.0);
const double EPS = 1e-10;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll L,R;
    cin>>L>>R;
    if(R-L>2019){
        cout<<0<<endl;
        return 0;
    }
    int l = L%2019;
    int r = R%2019;
    int mi = 2018;

    for(int i=l;i<r;i++){
        for(int j=i+1;j<=r;j++){
            chmin(mi,(i*j)%2019);
        }
    }
    cout<<mi<<endl;
}


Measured memory_bytes: 256
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

ll nCm(ll n, ll m){
    if(m == 0 || m == n){
        return 1;
    } else if(m == 1){
        return n;
    }
    return (nCm(n - 1, m) + nCm(n - 1, m - 1));
}

//-----------------------ここから-----------

int main(void){
    char c[2][3];
    for(int i = 0; i < 2; i++){
        for(int j = 0; j < 3; j++){
            cin >> c[i][j];
        }
    }

    if(c[0][0] == c[1][2] && c[0][1] == c[1][1] && c[0][2] == c[1][0]){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 256
/*  Name: Abu Hurayra
    Handle: HurayraIIT
    Institute: IIT_JU   */
    
#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef string S;
typedef double D;
typedef vector<int> vi;
typedef stack<int> si;
typedef queue<int> qi;
typedef priority_queue<int> pqi;
typedef pair<int,int> pi;

#define pi acos(-1.0)
#define PSB push_back
#define PPB pop_back
#define REP(i,a,b) for(i=a;i<=b;i++)

int main()
{
    
    int n,i,j,x=0,y=0;
    cin >> n;
    int a[n] , b[n];
    for(i=0;i<n;i++)
    {
        cin >> a[i];
        
    }
    for(i=0;i<n;i++)
    {
        cin >> b[i];
        if(a[i]>b[i]) x+=a[i]-b[i];
    }
	
	cout << x << endl ;
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define hell1 1e9+7
#define hell2 1e9+9
#define pi 3.1415926535
#define ms(s, n) memset(s, n, sizeof(s))
#define prec(n) fixed<<setprecision(n)
#define eps 0.000001
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define ll long long
#define ld long double 
#define no_of_digits(n) floor(log10(n)) + 1
#define see(x) cout << (#x) << " is " << (x) << endl
#define INF 1e9
 
using namespace std;
 
ll mult(ll a,ll b, ll p=hell1){   return ((a%p)*(b%p))%p; }
ll multbig(ll a,ll b,ll mod=hell1){   if(a==0 or b==0) return 0;if(a==1 or b==1) return (a*b)%mod;ll cur=multbig(a,b/2,mod);cur=(2*cur)%mod;if(b%2) cur=(cur+a)%mod;return cur;
}
ll add(ll a, ll b, ll p=hell1){ if(a>=p) a%=p; if(b>=p) b%=p; if(a+b>p) return (a + b)%p; else return a+b;}
ll sub(ll a, ll b, ll p=hell1){return (a%p - b%p + p)%p;}
ll fpow(ll n, ll k, ll p = hell1) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = mult(r,n,p); n = mult(n,n,p);} return r;}
ll inv(ll a, ll p = hell1) {return fpow(a, p - 2, p);}
ll inv_euclid(ll a, ll m = hell1){ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0;while (a > 1){ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}
int isPowerof2(ll x) { return (x && !(x & x-1)); } 
ll log2(ll x) { ll res = 0; while (x >>= 1) res++; return res; } 
 
// max({a, b, c, d})
 
vector<ll>adj[200005];
ll update[200005];
ll ans[200005];
 
int binaryToDecimal(string n) 
{ 
    string num = n; 
    int dec_value = 0; 
  
    // Initializing base value to 1, i.e 2^0 
    int base = 1; 
  
    int len = num.length(); 
    for (int i = len - 1; i >= 0; i--) { 
        if (num[i] == '1') 
            dec_value += base; 
        base = base * 2; 
    } 
  
    return dec_value; 
} 
 
bool isPerfectSquare(long double x) 
{   
  // Find floating point value of  
  // square root of x. 
  long double sr = sqrt(x); 
  
  // If square root is an integer 
  return ((sr - floor(sr)) == 0); 
} 
 
int main()
{
    int w, h, x, y;
    cin >> w >> h >> x >> y;
 
    double area = double(w)*double(h)/2;
    // area /= 2;
 
    cout << prec(10);
    cout << area << " ";
    cout << (x+x == w && y+y == h) << "\n";
 
}

Measured memory_bytes: 6016
#include <cstdio>

int main(void) {
    int N, Y;
    (void*)std::scanf("%d %d", &N, &Y);

    int D = Y / 1000 - N;
    for(int a = 0; a <= N; ++a) {
        if(10000 * a > Y)   break;

        int tmp = D - 9*a;
        if(tmp % 4 == 0) {
            int b = tmp / 4;
            int c = N - a - b;
            
            if(b < 0)   continue;
            if(c < 0)   continue;
            
            std::printf("%d %d %d\n", a, b, c);
            return 0;
        }
    }

    std::printf("-1 -1 -1\n");
}


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

int main(){
	int N,K,C; string S;
	cin>>N>>K>>C>>S;

	vector<int> L,R;
	int c;

	c = 0;
	rep(i, N){
		if(c-- > 0) continue;
		c = 0;
		if(S[i] == 'o'){ L.push_back(i); c = C; }
	}

	c = 0;
	for(int i=N-1; i>=0; --i){
		if(c-- > 0) continue;
		c = 0;
		if(S[i] == 'o'){ R.push_back(i); c = C; }
	}

	reverse(R.begin(), R.end());

	if(L.size() > K) return 0;

	rep(i, L.size()) if(L[i] == R[i]) cout<<L[i]+1<<endl;
}

Measured memory_bytes: 3448
#include <bits/stdc++.h>
using namespace std;
int N, M, X;
int main() {
    cin >> N >> M >> X;
    vector<int> A(M, 0);
    vector<int> gate(N+1, 0);
    for(int i = 0; i < M; ++i) {
        cin >> A.at(i);
        gate.at(A.at(i)) = 1;
    }

    int left = 0;
    int right = 0;
    for(int i = X; i < N+1; ++i) {
        left += gate.at(i);
    }

    for(int i = 0; i < X; ++i) {
        right += gate.at(i);
    }

    if(left > right) {
        cout << right << endl;
    }else {
        cout << left << endl;
    }
}

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

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            SolveA();
            //SolveB();
            //SolveC();
            //SolveD();
        }
        private const long MOD = 1000000007;
        static void SolveA()
        {
            int n = ReadAndParseInt();
            int ans = 0;
            for(int i=1;i*i<=n;++i)
            {
                ans = i;
            }
            Console.WriteLine(ans*ans);
        }
        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if( x == 2) { return true; }
            if( x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while( i * i <= x)
            {
                if( x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }
        private static long pow(long x, long n)
        {
            if( n == 0) { return 1; }
            long res = pow(x * x % MOD, n / 2);
            if( n % 2 == 1)
            {
                res = res * x % MOD;
            }
            return res;
        }
        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

Measured memory_bytes: 13140
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define LL long long

int n;
LL a[100005];
LL dp[2][100005];

int main()
{
    while(~scanf("%d",&n))
    {
        for(int i=1;i<=n;++i)
            scanf("%lld",&a[i]);
        memset(dp,0,sizeof(dp));
        dp[0][1]=dp[1][1]=1;
        for(int i=2;i<=n;++i)
        {
            if(a[i]>a[i-1])
            {
                dp[0][i]=dp[0][i-1]+1;
                dp[1][i]=min(dp[1][i-1],dp[0][i-1]+1);
            }
            else if(a[i]<a[i-1])
            {
                dp[1][i]=dp[1][i-1]+1;
                dp[0][i]=min(dp[0][i-1],dp[1][i-1]+1);
            }
            else
            {
                dp[1][i]=dp[1][i-1];
                dp[0][i]=dp[0][i-1];
            }
        }
        printf("%lld\n",min(dp[1][n],dp[0][n]));
    }
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long int x,ans=-1;
	cin>>x;
	int y=x;
	
	for(int i=x;;i++)
	{
		int k=0;
		for(int j=2;j<=sqrt(x);j++)
		{
			if(i%j==0)
			{
				k=1;
				break;
			}
		}
		if(k==0)
		{
			cout<<i;
			break;
		}
	}
//	cout<<ans;
}


Measured memory_bytes: 256
import itertools
N, M, R = map(int, input().split())
r = list(map(int, input().split()))
r = list(map(lambda x: x - 1, r))
d = [[10 ** 10] * N for _ in range(N)]

for _ in range(M):
    a, b, c = map(int, input().split())
    d[a - 1][b - 1] = c
    d[b - 1][a - 1] = c

for i in range(N):
    d[i][i] = 0

for k in range(N):
    for i in range(N):
        for j in range(N):
            d[i][j] = min(d[i][j], d[i][k] + d[k][j])

ans = 10 ** 10

for i in itertools.permutations(r):
    dist = 0
    for j in range(R - 1):
        dist += d[i[j]][i[j + 1]]
    ans = min(ans, dist)

print(ans)


Measured memory_bytes: 46808
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

  string s;
  cin>>s;
  if(s[2]==s[3] and s[4]==s[5]) drop("Yes");
  drop("No");
  return 0;
}


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

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

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

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

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

int main()
{
  string s;
  cin >> s;
  int n = s.size();

  deque<int> ans;

  rep(i,n){
      if(s[i] == '0'){
          ans.push_back(0);
      }
      else if(s[i] == '1'){
          ans.push_back(1);
      }
      else{
          if(!ans.empty()){
              ans.pop_back();
          }
      }
  }

  int q = ans.size();

  rep(i,q) cout << ans[i];
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)


void solve(long long N, long long i){
    cout << N+1-i<< endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long i;
    scanf("%lld",&i);
    solve(N, i);
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)
#define debug(x) std::cerr<<#x<<": "<<x<<"\n"
#define debug2(x,y) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<"\n"
#define debug3(x,y,z) std::cerr<<#x<<": "<<x<<", "<<#y<<": "<<y<<", "<<#z<<": "<<z<<"\n"

using ll=long long;
using vi=std::vector<int>;
using vvi=std::vector<vi>;
using vll=std::vector<ll>;
using vvll=std::vector<vll>;
template<typename T> using vvec=std::vector<std::vector<T>>;
template<typename T>
auto make_v(size_t sz){return std::vector<T>(sz);}
template<typename T,typename... Ts>
auto make_v(size_t sz,Ts...ts){return std::vector<decltype(make_v<T>(ts...))>(sz,make_v<T>(ts...));}
template<typename T>
void fill_v(T&var,const T&x){var=x;}
template<typename V,typename T>
void fill_v(V&v,const T&x){for(auto&& w:v){fill_v(w,x);}}

template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::vector<std::vector<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<T>&v){
  int sz=v.size();s<<"\n";rep(i,sz){s<<v[i];if(i<sz-1){s<<"\t";}}s<<"\n";return s;}
template<typename T> std::ostream& operator<<(std::ostream&s,const std::deque<std::deque<T>>&v){
  for(auto&& w:v){s<<w;}return s;}
template<typename T> std::ostream& operator<<(std::ostream&s, const std::set<T>&v){
  s<<"\n";for(auto&& elm:v){s<<elm<<"\t";}s<<"\n";return s;}

inline void scan(int&a){scanf("%d",&a);}
inline void scan(ll&a){scanf("%lld",&a);}
inline void scan(char&a){scanf(" %c",&a);}
inline void scan(double&a){scanf("%lf",&a);}
template<typename T>
inline void scan(std::vector<T>&v){for(auto&& sv:v){scan(sv);}}
template<typename First,typename...Args>
inline void scan(First&f,Args&...args){scan(f);scan(args...);}
inline void scan(std::string&s){char BUF[3000000];scanf(" %s",BUF);s=std::string(BUF);}
inline void print(int a){printf("%d\n",a);}
inline void print(ll a){printf("%lld\n",a);}
inline void print(double a){printf("%.12f\n",a);}
inline void print(std::string s){std::cout<<s<<"\n";}

using namespace std;

void yesno(bool b) {
  if (b) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  exit(0);
}

void solve() {
  int n, m;
  scan(n, m);
  vi a(n);
  scan(a);
  sort(all(a));
  reverse(all(a));
  int count_total = 0;
  rep (i, n) {
    count_total += a[i];
  }
  rep (i, m) {
    if (a[i] * 4 * m < count_total) {
      yesno(false);
    }
  }
  yesno(true);
}

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


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

public class Main {
  public static void main(String... args) {
    BufferedReader br = new BufferedReader(
      new InputStreamReader(System.in));

    try {
      int n = Integer.parseInt(br.readLine());
      String[] arrayB = br.readLine().split(" ");
      int nowB = 0;
      int postB = 0;
      int result = 0;
      
      for(int i = 0; i < n - 1; i++) {
        nowB = Integer.parseInt(arrayB[i]);
        if (i == 0) {
          result += nowB;
        } else {
          result += Math.min(postB, nowB);
        }
        if (i < n - 2) {
          postB = nowB;
        } else {
          result += nowB;
        }
      }

      System.out.println(result);
      br.close();
    } catch(IOException e) {
      e.printStackTrace();
    }
  }
}

Measured memory_bytes: 21332
L = [(512,768,512)] + [(256>>i,896>>i,256>>i) for i in xrange(9)]

def put(f,x,y):
    for yy,b in zip(xrange(y-1,y+2),L[x]):
        f[yy] = f[yy] ^ b

def solve(F):
    for i in xrange(1<<10):
        f = [0] + F + [0]
        ret = []
        for x in (x for x in xrange(10) if 1<<x & i != 0):
            put(f,x,1)
            ret.append((x,0))
        f.pop(0)
        for y in xrange(9):
            for x in (x for x in xrange(10) if 1<<(9-x) & f[y] != 0):
                put(f,x,y+1)
                ret.append((x,y+1))

        if f[9] == 0:
            return ret
    
for _ in xrange(input()):
    F = [int(raw_input().replace(" ",""),2) for _ in xrange(10)]
    pos = solve(F)    
    print "\n".join([" ".join("1" if (x,y) in pos else "0" for x in xrange(10))\
                         for y in xrange(10)])

Measured memory_bytes: 4296