akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n,s) for (int i=a;s>0?i<n:i>n;i+=s)
#define rep(...) _overload3(__VA_ARGS__,per,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
const int inf = 1e9+10, mod = 1e9+7; const long long llinf = 1e18;
// head
bool AB[200000],BC[200000],CA[200000];

bool not_macth(char a,char b){
  if (a == '?' or b == '?' or a == b){
    return false;
  }
  else return true;
}

int main(){
  string a,b,c;
  cin >> a >> b >> c;
  int A = a.size();
  int B = b.size();
  int C = c.size();
  int ans = inf;
  rep(i,200000){
    AB[i] = true;
    BC[i] = true;
    CA[i] = true;
  }
  rep(i,A) rep(j,B){
    if (not_macth(a[i],b[j])) AB[i-j+100000] = false;
  }
  rep(i,B) rep(j,C){
    if (not_macth(b[i],c[j])) BC[i-j+100000] = false;
  }
  rep(i,C) rep(j,A){
    if (not_macth(c[i],a[j])) CA[i-j+100000] = false;
  }
  rep(i,-4000,4001) rep(j,-4000,4001){
    if (AB[i+100000] and BC[j-i+100000] and CA[-j+100000]) ans = min(ans,max({A,i+B,j+C})-min({0,i,j}));
  }
  cout << ans << endl;
}

Measured memory_bytes: 896
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstdio>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <queue>
#include <stack>
#include <tuple>
#include <list>
#include <set>
#include <map>
#include <functional>
#include <cmath>
#include <cstring>
#include <cstdlib>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;

#define xx first
#define yy second
#define $1 first
#define $2 second

typedef struct _schedule {
	int s, t;
	int idx;
	char c;
} schedule;

bool operator < (const schedule& a, const schedule& b) {
	return a.t < b.t;
}

bool cmp(schedule& a, schedule& b) {
	return a.idx < b.idx;
}

void solveCase() {
	ios::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
	ll s, w; cin >> s >> w;
	if (s > w) cout << "safe";
	else cout << "unsafe";

}

int main() {

#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
#endif
	solveCase();
}

Measured memory_bytes: 3656
#include <iostream>
using namespace std;
int main(void){
    
    int n;
    int count = 0;
    string str;
    
    cin >> n;
    cin >> str;
    
    if(n % 2 == 1){
        cout << "No" <<endl;
    }
    else{
        for(int i=0;i<n/2;i++){
        
            if(str[i] == str[i+n/2]){
                count++;
            }
        }
    
        if(count == n/2){
            cout << "Yes" << endl;
        }
        else{
            cout << "No" <<endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 760
#include <bits/stdc++.h>
#define ll long long int
#define N 100
#define f(i, a, b) for (ll i = (ll)a; i <= (ll)b; i++)
#define rf(i, a, b) for (ll i = (ll)a; i >= (ll)b; i--)
#define po pop_back
#define pb push_back
#define lb lower_bound
#define fi first
#define se second
#define debug(x) cout << #x << " = " << x << endl
#define ub upper_bound
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define all(x) x.begin(), x.end()
#define PI 3.141592653
#define cot cout.tie(0)
#define endl "\n"
using namespace std;
/**
  * @author :: Sawlani
  *
  */

const ll M = 1e9+7;
ll dp[1000000][2][2]; 
int main()
{
    ll n;
    cin >> n;
    memset(dp,0,sizeof(dp));

    dp[1][0][0] = 8;
    dp[1][0][1] = 1;
    dp[1][1][0] = 1;
    dp[1][1][1] = 0;
    

    for(int i=2;i<=n;i++)
    {
        dp[i][0][1] = (9*dp[i-1][0][1]+dp[i-1][0][0])%M;
        dp[i][1][0] = (9*dp[i-1][1][0]+dp[i-1][0][0])%M;
        dp[i][0][0] = (8*dp[i-1][0][0])%M;
        dp[i][1][1] = (10*dp[i-1][1][1]%M+dp[i-1][1][0]%M+dp[i-1][0][1]%M)%M; 
    }

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

Measured memory_bytes: 34860
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<vector<pair<int, int> > > vvp;
typedef vector<pair<int, int> > vp;
typedef vector<vector<int> > vvi;
typedef vector<int> vi;
typedef vector<vector<ll> > vvl;
typedef vector<ll> vl;
typedef vector<vector<bool> > vvb;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<string, int> psi;
typedef pair<int, int> pii;
#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define yn(f) (f?"yes":"no")
#define YN(f) (f?"YES":"NO")
#define Yn(f) (f?"Yes":"No")
#define mod (1e9+7)
#define inf (1e9+7)
#define nil -1
int main() {
	int n;
	cin >> n;
	vi A(n);
	for (int i = 0; i < n; i++)cin >> A[i];
	vi L(n);
	L[0] = A[0];
	int length = 1;
	for (int i = 0; i <A.size(); i++)
	{
		int val = A[i];
		if (L[length-1]<val) {
			L[length++] = val;
		}
		else {
			*lower_bound(L.begin(),L.begin()+length,val)=val;
		}
	}
	cout<<length<<endl;
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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; }



int n, a[101010];
void solve(){
	cin >> n;
	int cnt = 0;
	i64 sum = 0;
	int mi = INF;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		if(a[i] <= 0) cnt++;
		sum += abs(a[i]);
		chmin(mi, abs(a[i]));
	}
	
	if(cnt & 1){
		cout << sum-mi*2 << endl;
	}
	else cout << sum << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
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; }

//ミョ(-ω- ?)
int main() {
    ll n,k;
    cin >> n >> k;
    vector<ll> t(n,0);
    rep(i,n){
        cin >> t[i];
        --t[i];
    }
    vector<ll> path;
    ll cnt = 0;
    unordered_set<ll> us;
    ll now = 0;
    while (us.count(now) == 0) {  // 探索済みの町に到達するまで
        path.push_back(now);
        us.insert(now);
        now = t[now];
    }
    ll s = find(path.begin(),path.end(),now) - path.begin();
    ll r = (ll)path.size() - s;
    if (k < s) {  // ループ部分に到達しない時
        cout << path[k] + 1 << endl;
        return 0;
    } else {  // ループ部分に到達する時
        cout << path[(k - s) % r + s] + 1 << endl;
        return 0;
    }
    return 0;
}

Measured memory_bytes: 14248
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
	int a[4];
	for(int i = 0; i < 3; i++)
	 scanf("%d",&a[i]);
	 sort(a , a+3);
	 if(a[2] - a[1] ==  a[0])
	   printf("Yes\n");
	    else
	       printf("No\n");
	return 0;
}


Measured memory_bytes: 128
var input = require('fs').readFileSync('/dev/stdin', 'utf8');
var Arr=(input.trim()).split("\n");
var Q=Arr.shift()-0;
for(var i=0;i<Q;i++){
   var arr=(Arr.shift()).split(" ").map(Number);
   var cnt=0;
   while(arr[2]>=1){
      arr[2]--;
      if(arr[0]>=1 && arr[1]>=1){
         cnt++;
         arr[0]--;
         arr[1]--;
      }
   }
   while(arr[1]>=1){
      arr[1]--;
      if(arr[0]>=2){
         cnt++;
         arr[0]-=2;
      }
   }
   while(arr[0]>=3){
      cnt++;
      arr[0]-=3;
   }
   console.log(cnt);
}

Measured memory_bytes: 8944
/* Tuan Kkura */
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
#define base 31
#define MOD 1e9+7
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define FORs(i, a, b) for(int i = a; i >= b; i--)
#define REP(i, a, b) for(int i = a; i < b; i++)
#define __FOR(i, a, b, k) for(int i = a; i <= b; i+= k)
#define __REP(i, a, b, k) for(int i = a; i < b; i+= k)
#define pb push_back
#define _io ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;

typedef pair <int, int> ii;
typedef vector <ii> vii;
#define fi first
#define se second
#define mp make_pair
#define PROB "text"
#define MAXN 200005

int main()
{
    _io
    int n; cin >> n;
    cout << 1LL*(n-1)*n/2 << '\n';
}


Measured memory_bytes: 256
/*dismint|jjc*/
#include <bits/stdc++.h>
using namespace std;
#define forl(V, S, E) for(int V = S; V < E; V++)
#define ford(V, S, E) for(int V = S; V >= E; V--)
#define fore(E, X) for(auto &E:X)
#define println(X) cout << X << endl
#define printe(X) for(auto &E:X) cout << E << " "; cout << endl
typedef unordered_map<int, unordered_set<int>> graph;
typedef long long ll;

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	string s; cin >> s;
	for(int i = 0; i < s.length(); i++) {
		if(i%2) continue;
		if(i == s.length()-1 or s[i] != 'h' or s[i+1] != 'i') { println("No"); return 0; }
	}
	println("Yes");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  string s,t,u;
  cin >> N >> s;
  if(N%2==1){
    cout << "No" << endl;
    return 0;
  }
  else{
    for(int i=0;i<s.size()/2;i++){
      t += s.at(i);
      u += s.at(s.size()/2+i);
    }
    if(t==u){
      cout <<"Yes" << endl;
    }
    else{
       cout <<"No" << endl;
    }
  }
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int candy[3];
  int i;
  for(i=0;i<3;i++){
    scanf("%d",&candy[i]);
  }
  int j,k;
  for(i=0;i<3;i++){
    for(j=0;j<3;j++){
      for(k=0;k<3;k++){
      	if(i!=j&&i!=k&&j!=k){
        	if(candy[i]+candy[j]==candy[k]){
              printf("Yes");
              return 0;
            }
        }
      }
    }
  }
  printf("No");
  return 0;
}

Measured memory_bytes: 128
/**
 * author:  virenkathiriya96
 * created: 2020.08.31 14:51:54 
**/

#include<bits/stdc++.h>

using namespace std;

signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int h, w, k, ans = 0;
  cin >> h >> w >> k;
  vector<vector<int>> grid(h, vector<int>(w)), tmp(h, vector<int>(w));
  vector<int> H(h);
  vector<int> W(w);
  for (int i = 0; i < h; i++) H[i] = i;
  for (int j = 0; j < w; j++) W[j] = j;
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      char c;
      cin >> c;
      if (c == '.') grid[i][j] = 0;
      else grid[i][j] = 1;
      tmp[i][j] = grid[i][j];
    }
  }
  int h2 = 1 << h;
  int w2 = 1 << w;
  for (int i = 0; i < h2; i++) {
    vector<int> dp1;
    for (int j = 0; j < h; j++) {
      if ((i & (1 << j)) != 0) {
        dp1.push_back(j);
      }
    }

    for (int ii = 0; ii < w2; ii++) {
      vector<int> dp2;
      for (int jj = 0; jj < w; jj++) {
        if ((ii & (1 << jj)) != 0) {
          dp2.push_back(jj);
        }
      }

      for (int iii = 0; iii < h; iii++) for (int jjj = 0; jjj < w; jjj++) tmp[iii][jjj] = grid[iii][jjj];
      for (int &x: dp1) {
        for (int jjjj = 0; jjjj < w; jjjj++) tmp[x][jjjj] = 2;
      }
      for (int &x: dp2) {
        for (int jjjj = 0; jjjj < h; jjjj++) tmp[jjjj][x] = 2;
      }

      int cnt = 0;
      for (int l = 0; l < h; l++) {
        for (int ll = 0; ll < w; ll++) {
          cnt += (tmp[l][ll] == 1);
        }
      }
      if (cnt == k) ans++;
    }
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;


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

	ll N,sum=0,sunuke=0,ans=INF;
	cin >> N;
	vector<ll> a(N);
	FOR(i,0,N){
		cin >> a[i];
		sum += a[i];
	}
	FOR(i,0,N-1){
		sunuke += a[i];
		ans = min(ans,abs(sum-sunuke*2));
	}
	cout << ans << endl;
}


Measured memory_bytes: 1792
# coding: utf-8
x, n = map(int, input().split())
if n == 0:
    print(x)
else:
    P = list(map(int, input().split()))
    ans = 10**9
    L = {P[i]:0 for i in range(n)}
    for i in range(-200, 201):
        if i not in L.keys():
            if abs(ans - x) > abs(i - x):
                ans = i
    print(ans)

Measured memory_bytes: 9184
import java.util.*;
import java.io.*;
public class Main
{
    
	public static void main(String[] args) throws Exception{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] s = br.readLine().trim().split(" ");
		int a = Integer.parseInt(s[0]);
		int b = Integer.parseInt(s[1]);
		int c = Integer.parseInt(s[2]);
		int k = Integer.parseInt(s[3]);
		int ans = 0;
	    if(k >= a){
	        ans += a;
	        k -= a;
	    }
	    else{
	        ans = k;
	        k = 0;
	    }

	    if(k >= b){
	        k -= b;
	    }
	    else{
	        k = 0;
	    }
	
	    if(k >= c){
	        ans -= c;
	        k -= c;
	    }
	    else{
	        ans = ans-k;
	    }
	    System.out.println(ans);
	}
}



Measured memory_bytes: 32432
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	vector<int> a(n);
	vector<int> b(n);
	vector<int> c(n);
	for(int i=0;i<n;i++) cin>>a[i];
	for(int i=0;i<n;i++) cin>>b[i];
	for(int i=0;i<n;i++) cin>>c[i];
	sort(a.begin(),a.end());
	sort(c.begin(),c.end());
	long long ans=0;
	for(int i=0;i<n;i++){
		long long j=lower_bound(a.begin(),a.end(),b[i])-a.begin();
		long long k=upper_bound(c.begin(),c.end(),b[i])-c.begin();
		ans+=j*(c.size()-k);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1536
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            //[summary]B - Between a and b ...
            var lines = ReadLines<long>(1).ToList();
            long a = lines[0][0];
            long b = lines[0][1];
            long x = lines[0][2];

            long count = GetDivisorsCount(a, b, x);

            Console.WriteLine(count);
        }

        static long GetDivisorsCount(long a, long b, long x)
        {
            long divisorsA = a / x;
            long divisorsB = b / x;
            long diff = divisorsB - divisorsA;

            if (a % x == 0)
            {
                diff++;
            }

            return diff;
        }
                               
        static IEnumerable<List<T>> ReadLines<T>(int count = 0, char separator = ' ')
        {
            //[summary]コンソールの値を読み込んで、List<T>のコレクションを返却

            //読み込む行数が未指定のときは、1行目の値を"count"とみなす
            if (count == 0)
            {
                string line = Console.ReadLine().TrimEnd();
                count = int.Parse(line);
            }

            for (int i = 0; i < count; i++)
            {
                //コンソールを1行読み込み
                string line = Console.ReadLine().TrimEnd();

                //char型のときは1文字ずつに分割
                if (typeof(T) == typeof(char))
                {
                    var list = line.ToCharArray().ToList();
                    yield return (List<T>)(object)list;
                }
                else
                {
                    //読み込んだ値を"separator"で区切る
                    var list = line.Split(separator).ToList();

                    //int型のときは数値に変換
                    if (typeof(T) == typeof(int))
                    {
                        var numbers = list.ConvertAll(int.Parse);
                        yield return (List<T>)(object)numbers;
                    }
                    else if (typeof(T) == typeof(long))
                    {
                        var numbers = list.ConvertAll(long.Parse);
                        yield return (List<T>)(object)numbers;
                    }
                    else
                    {
                        yield return (List<T>)(object)list;
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 13268
#include <cstdio>
#include <cmath>
#include <algorithm>
#define INF (1LL<<62)
#define rep(i, s, n) for (int i = s; i < n; i++)
using namespace std;

int N, K;
int H[100005];
long long dp[100005];

void solve() {
  for (int i = 0; i < N; i++) {
    dp[i] = INF;
  }
  dp[0] = 0;
  for (int i = 1; i < N; i++) {
    for (int j = max(i-K, 0); j < i; j++) {
      dp[i] = min(dp[i], dp[j] + abs(H[i] - H[j]));
    }
  }
  // for (int i = 0; i < N; i++) { printf("%d ", dp[i]); } printf("\n");
  printf("%lld\n", dp[N-1]);
}

int main() {
  scanf("%d%d", &N, &K);
  for (int i = 0; i < N; i++) {
    scanf("%d", H+i);
  }
  solve();
}


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

int main() {
	while (1) {
		int n, m;
		cin >> n >> m;
		if (m == 0) break;
		
		int t[n], h[m];
		for (int i = 0; i < n; i++)
			cin >> t[i];
		for (int i = 0; i < m; i++)
			cin >> h[i];
		int sumt = 0, sumh = 0;
		for (int i = 0; i < n; i++)
			sumt += t[i];
		for (int i = 0; i < m; i++)
			sumh += h[i];
		
		int x, y, min = 1000;
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				if (sumt - t[i] + h[j] == sumh + t[i] - h[j]) {
					if (t[i] + h[j] < min) {
						min = t[i] + h[j];
						x = t[i];
						y = h[j];
					}
				}
			}
		}
		
		if (min == 1000)
			cout << -1 << endl;
		else
			cout << x << ' ' << y << endl;
	}		
	return 0;
}

Measured memory_bytes: 3080
#include <iostream>

using namespace std;
using LL = long long;
const LL MOD = 1'000'000'007L;

LL pow(LL m, int n) {
    if (n == 0) return 1;
    LL ret = pow(m * m % MOD, n / 2);
    if (n % 2) ret *= m;
    return ret % MOD;
}

int main() {
    int m, n;
    cin >> m >> n;
    cout << pow(m, n) << endl;
}


Measured memory_bytes: 3088
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>

using namespace std;

#define DEBUG_ //!!提出時にコメントアウト!!
#ifdef DEBUG_
	#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
	#define dump(x)  ; //何もしない文
#endif

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size()) //unsignedのサイズをint型に変換
#define pb push_back

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;

template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

const int MOD = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;

//ここから書き始める
int main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);	
    int sx,sy,tx,ty; cin >> sx >> sy >> tx >> ty;
    if(ty - sy != 0 && tx - sx != 0)
    REP(i,ty - sy)
    {
        cout << "U";
    }
    REP(i,tx - sx)
    {
        cout << "R";
    }
    REP(i, ty - sy)
    {
        cout << "D";
    }
    REP(i, tx - sx)
    {
        cout << "L";
    }
    cout << "D";
    REP(i, tx - sx + 1)
    {
        cout << "R";
    }
    REP(i, ty - sy + 1)
    {
        cout << "U";
    }
    cout << "LU";
    REP(i, tx - sx + 1)
    {
        cout << "L";
    }
    REP(i,ty - sy + 1)
    {
        cout << "D";
    }
    cout << "R";

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int n  = Integer.parseInt(sc.next());
		int k  = Integer.parseInt(sc.next());
		double[] pi = new double[n]; 


		double sum = 0l;
		for(int i = 0 ; i < n ; i++) {
			double tmp = Double.parseDouble(sc.next());
			pi[i] = (tmp+1)/2;
			
			if(i < k) {
				sum +=  pi[i];
			}

		}

		double max = sum;
		for(int i = k ; i < n ; i++) {
			sum = sum - pi[i-k] + pi[i];
			
			if(max < sum) {
				max = sum;
			}
		}
		
		System.out.println(max);

	}



}

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

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vector<int> > vii;

bool is_uruu(int y) {return (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0));}
template <class X> void print(X Target){ cout << Target << '\n'; }

ll Day_cnt(int y, int m, int d)
{
  int mon[] = {0, 31, is_uruu(y) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  ll res = d;

  REP(i, m - 1){
    res += mon[i + 1];
  }
  REP(i, y - 1){
    is_uruu(i + 1) ? res += 366 : res += 365;
  }

  return (res);
}

signed main()
{
  ios::sync_with_stdio(false);
  int y1, m1, d1, y2, m2, d2;

  while (cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2, y1 != -1 && m1 != -1 && d1 != -1 && y2 != -1 && m2 != -1 && d2 != -1){
    print(Day_cnt(y2, m2, d2) - Day_cnt(y1, m1, d1));
  }
  
  return (0);
}

Measured memory_bytes: 1188
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  map<int, int> cnt;
  cnt[0] = 1;
  int sum = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    sum = (sum + x) % m;
    cnt[sum]++;
  }
  int64 ret = 0;
  for (auto& it : cnt) {
    ret += (int64)it.second * (it.second - 1) / 2;
  }
  printf("%lld\n", ret);
  return 0;
}


Measured memory_bytes: 3200
#include <bits/stdc++.h>
 
using namespace std;
 
#define xx         first
#define yy         second
#define pb         push_back
#define mp         make_pair
#define LL         long long
#define inf        INT_MAX/3
#define mod        1000000007ll
#define PI         acos(-1.0)
#define linf       (1ll<<60)-1
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define REP(I,N)   FOR(I,0,N)
#define For(I,N)   for(int I=1;I<=(N);I++)
#define ALL(A)     ((A).begin(), (A).end())
#define set0(ar)   memset(ar,0,sizeof ar)
#define vsort(v)   sort(v.begin(),v.end())
#define setinf(ar) memset(ar,126,sizeof ar)
#define SZ(X) ((int)(X.size()))
#define LG(X) ((int)(X.length()))
#define CL(X) (X).clear()
#define MAXEL(A,B) (*max_element(A,B))
#define MINEL(A,B) (*min_element(A,B))
#define ROPEN(X) freopen(X,"r",stdin)
#define WOPEN(X) freopen(X,"w",stdout)
#define BG(X) (X.begin())
#define EN(X) (X.end())
#define VI vector<int>
#define PII pair<int,int>
 
//cout << fixed << setprecision(20) << p << endl;
 
template <class T> inline T bigmod(T p,T e,T M){
    LL ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	string s;
	cin>>s;
	sort(s.begin(),s.end());
	string d;
	cin>>d;
	sort(d.begin(),d.end());
	reverse(d.begin(),d.end());
	if(s<d)cout<<"Yes";
	else cout<<"No";
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main (String[] args) {

//	パターン1（Aから順番に使って足していく）
//	変数を読み込む
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int K = sc.nextInt();

		int total = 0;  //合計を入れる変数

//	Aから順に、合計K枚になるまで足していく
		if(A >= K) {  //A>KならKの枚数を表示で終了
			System.out.println(total=K);
			return;
		}
		else {  //A＜Kの場合は続く
			total = A;
		}

//	BがK-Aより多いか少ないかで判断
		if(B < K-A) {  //B<=K-AならK-A-B枚分-1をする
			System.out.println(total-= K-A-B);
		}
		else {  //B>K-Aならそのまま表示
			System.out.println(total);
		}
	}
}

Measured memory_bytes: 26972
def main():
    # 引数を受け取る
    args = input().split(' ')
    args = [int(i) for i in args]

    W = args[0]
    H = args[1]
    x = args[2]
    y = args[3]
    r = args[4]
    flag = True

    # 水平方向の判定
    if x-r<0 or x+r>W:
        flag = False

    # 垂直方向の判定
    if y-r<0 or y+r>H:
        flag = False

    if flag:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()


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

int main()
{
    int n; cin >> n;
    string num; cin >> num;
    vector<int> a(n);
    vector<int> f(10,0),s(10,0),t(10,0);
    int ans = 0;
    for(int i=0;i<n;i++){
        a[i] = int(num[i])-int('0') ;
    }
    
    for(int i=0;i<n-2;i++){
        int left = a[i];
        f[a[i]]++;
        if(f[a[i]] >= 2) continue;
        for(int j=i+1;j<n-1;j++){
            int center = a[j];
            s[a[j]]++;
            if(s[a[j]] >= 2) continue;
            for(int l=j+1;l<n;l++){
                int right = a[l];
                t[a[l]]++;
                if(t[a[l]] >= 2) continue;
                ans++;
            }
            t.clear();
            for(int l=0;l<10;l++) t.push_back(0);
        }
        s.clear();
        for(int j=0;j<10;j++) s.push_back(0);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
n = int(input())
a = []
x = []
ans = 0
for i in range(n):
    a.append(int(input()))
    x.append([[0, 0] for _ in range(a[i])])
    for j in range(a[i]):
        e1, e2 = map(int,input().split())
        x[i][j][0] = e1
        x[i][j][1] = e2
for i in range(2**n):
    h = [0]*n
    for j in range(n):
        if (i >> j) & 1:
            h[j] = 1
    flag = 1
    for j in range(n):
        if h[j] == 1:
            for k in x[j]:
                if h[k[0]-1] != k[1]:
                    flag = 0
                    break
    if flag == 1:
        ans = max(ans, sum(h))
print(ans)

Measured memory_bytes: 3064
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <limits.h>
#include <cmath>
#include <queue>
#include <map>
#include <iomanip>
#include <random>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b)
{
  ll r;
  while ((r = a % b))
  {
    a = b;
    b = r;
  }
  return b;
}

int main()
{

  int a, b;
  cin >> a >> b;
  if (a <= 9 && b <= 9)
  {
    cout << a * b << endl;
  }
  else
  {
    cout << "-1" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define SZ(x) ((int)(x).size())
#define rep(i,m,n) for(int i=(m);i<(n);++i)
#define fore(i,a) for(auto &i:a)
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;
#define answer cout << ans << endl;
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; }
template<class T> using v = vector<T>;
template<class T> using vv = vector<v<T>>;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
signed _main(); signed main() { _main(); }

int rec(int l,int r,vv<int> &dp,v<int> &s){
  if(dp[l][r]!=-1) return dp[l][r];
  if(abs(l-r)<=1) return 0;
  int res=INF;
  for(int mid=l+1;mid<=r-1;mid++){
    chmin(res,rec(l,mid,dp,s)+rec(mid,r,dp,s)+s[r]-s[l]);
  }
  return dp[l][r]=res;
}

signed _main(){
  int N; cin >> N;
  v<int> w(N);
  rep(i,0,N) cin >> w[i];

  // 累積和
  vector<int> s(N+1, 0); // s[0] = 0 になる
  for (int i = 0; i < N; ++i) s[i+1] = s[i] + w[i];

  vv<int> dp(410,v<int>(410,-1));
  cout << rec(0,N,dp,s) << endl;
  return 0;
}


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

using namespace std;
typedef long long ll;

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

    ll sum = 0;
    vector<ll> a(n);
    for (int i = 0; i < n; i++)cin >> a[i], sum += a[i];
    vector<ll> b(m);
    for (int i = 0; i < m; i++)cin >> b[i];

    int ret = 0;
    int nextB = 0;
    for (int i = n; i >= 0; i--) {
        while (nextB < m && sum + b[nextB] <= k) sum += b[nextB++];
        if (sum <= k) ret = max(ret, i + nextB);
        if (i > 0)sum -= a[i - 1];
    }

    cout << ret << endl;
    return 0;
}

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

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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> tiii;
typedef pair<ll, ll> pll;

const int INF = 100000000;
const ll LINF = 1e18+5;

const ll M = 1000000007; // modの値

vector<ll> fac(1000000); // n! mod M
vector<ll> ifac(1000000); // k^{M-2} mod M

ll mpow(ll x, ll n){ // x^n(modM)
    ll ans = 1;
    while (n!=0) {
        if(n&1) ans = ans*x % M;
        x = x*x % M;
        n= n>>1;
    }
    return ans;
}

ll comb(ll a, ll b) { // aCb mod M
    if (a==0 && b==0) return 1;
    if (a<b || a<0) return 0;
    ll tmp = ifac[a-b] * ifac[b] % M;
    return tmp * fac[a] % M;
}

void init_comb() {
    fac[0] = 1;
    ifac[0] = 1;
    for (ll i=0;i<1000000;i++) {
        fac[i+1] = fac[i]*(i+1) % M; // n!(mod M)
        ifac[i+1] = ifac[i] * mpow(i+1, M-2) % M; // k^{M-2} mod M
    }
}
ll gcd(ll a, ll b) {
    if (b==0) return a;
    return gcd(b, a%b);
}

ll dp[200000];

vector<ll> G[200000];

ll search_xe(ll v, ll s) {
    ll num = 0;
    for(auto v1 : G[v]) {
        if(v1==s) continue;
        num += (search_xe(v1, v) + 1);
    }
    dp[v] = num;
    return num;
}

int main() {
    ll N;
    cin >> N;
    vector<pll> edge;
    rep(i,N-1) {
        ll a,b;
        cin >> a >> b;
        G[a-1].push_back(b-1);
        G[b-1].push_back(a-1);
        edge.push_back(make_pair(a-1,b-1));
    }
    // dfs
    search_xe(0,-1);

    ll A = 0;
    ll B = 0;
    B = mpow(2,N);
    A += mpow(2,N-1) * N % M;
    A += (N - 2);
    A %= M;
    for(auto e : edge) {
        ll xe = min(dp[e.first], dp[e.second]) + 1;
        A -= mpow(2, N-xe);
        A = (A+2*M)%M;
        A -= mpow(2, xe);
        A = (A+2*M)%M;
    }
    ll p = gcd(A,B);
    A /= p;
    B /= p;
    ll tmp = mpow(B, M-2);
    cout << (A * tmp) % M << endl;
    return 0;
}

Measured memory_bytes: 38508
/*
 * Author       : YangDavid
 * Created Time : 2019年11月23日 星期六 20时08分42秒
 */

#include<bits/stdc++.h>
#define rep(i, n) for(int i = 1; i <= n; ++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

const int maxn = 202222;
ll a[maxn], n, sum, pref, ans = 0x3f3f3f3f3f3f3f3f;
int main() {
	scanf("%lld", &n);
	rep(i, n) scanf("%lld", &a[i]), sum += a[i];
	rep(i, n - 1) {
		pref += a[i];
		ans = min(ans, abs(sum - pref - pref));
	}
	printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 1792
import sys
l, r = map(int, input().split())
lmod673 = l % 673
dif = r - l

if lmod673 + dif >= 673:
  print(0)
  sys.exit()

min_val = 2018
for bigger in range(l, r+1):
  for smaller in range(l, bigger):
    min_val = min(min_val, bigger*smaller % 2019)
print(min_val)

Measured memory_bytes: 38896
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<math.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
const long long INF = 1LL << 60;

int main() {
	ll n;
	cin >> n;
	vector<ll> h(n);
	REP(i, n) {
		cin >> h[i];
	}

	ll ans = 0;
	ll temp = 0;
	for (ll i = n - 2; i >= 0; i--) {
		if (h[i] >= h[i + 1]) {
			temp++;
		}
		else {
			ans = max(ans, temp);
			temp = 0;
		}
	}
	ans = max(ans, temp);

	cout << ans << endl;

	return 0;
}

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

#define showoff     ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb          push_back
#define pii         pair<long long,long long>
#define FOR(i,a,b)  for(long long i=a;i<b;++i)
#define RFOR(i,a,b) for(long long i=a;i>b;--i)
#define f           first
#define se          second
#define maxn        400005
#define all(v)      v.begin(),v.end()
#define sz(x)       (long long)x.size()
#define mod         998244353
#define pqueue      priority_queue<long long>
#define pdqueue     priority_queue< long long,vector<long long> ,greater< long long >>
 
typedef long long ll;
 
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
//const long long md = 998244353;
 
/*const long long mod = 998244353;
long long power(long long a,long long n)
{
	if(n == 1)return a%mod;
	if(n == 0)return 1;
	if(n&1)return ((a%mod)*(power((a*a)%mod,n/2))%mod)%mod;
	return power((a*a)%mod,n/2)%mod;
}
*/


int main()
{
	ll n, ans = 0;
	string s;
	cin >> s;

	n = s.length()*2;

	ll dpA[4001];
	ll dpB[4001];
	ll *dp1;
	ll *dp2;

	FOR (i,0,n+1) {
		dpA[0] = 0;
	}
	if (s[0] != '2') dpA[1] = 1;
	if (s[0] != '0') dpA[0] = 1;
	dp2 = dpA;
	// cerr << dp2[0] << " " << dp2[1] << " " << dp2[2] << endl;

	ll r = s[0] == '0' ? 2 : (s[0] == '1' ? 1 : 0);
	ll w = 2;
	FOR (i,1,n) {
		if (i % 2 > 0) {
			dp1 = dpA;
			dp2 = dpB;
		} else {
			dp1 = dpB;
			dp2 = dpA;
		}
		if (i < s.length()) {
			w += 2;
			r += s[i] == '0' ? 2 : (s[i] == '1' ? 1 : 0);
		}

		if ((w - r) > i) dp2[0] = dp1[0];
		else dp2[0] = 0;

		// cerr << dp2[0] << " ";
		FOR (j,1,n+1) {
			if (r >= j)
				dp2[j] = dp1[j-1];
			else
				dp2[j] = 0;
			if ((w - r) > (i - j)) {
				dp2[j] += dp1[j];
				if (dp2[j] > mod)
					dp2[j] -= mod;
			}
			// cerr << dp2[j] << " ";
		}
		// cerr << endl;
	}

	cout << dp2[r] << endl;
	return 0;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const double eps = 1e-11;
const int inf = 1ll << 62;

int x[55],y[55];

signed main(){
	int n,K;cin>>n>>K;
	rep(i,n)cin>>x[i]>>y[i];
	vector<int>xa,ya;
	rep(i,n){
		xa.push_back(x[i]);
		ya.push_back(y[i]);
		}
	sort(xa.begin(),xa.end());
	sort(ya.begin(),ya.end());
	int res=inf;
	rep(i,n){
		for(int j=i+1;j<n;j++){
			rep(k,n){
				for(int l=k+1;l<n;l++){
					int cnt=0;
					rep(m,n){
						if(xa[i]<=x[m]&&x[m]<=xa[j]&&ya[k]<=y[m]&&y[m]<=ya[l]){
							cnt++;
							}
						}
					if(cnt>=K){
						res=min(res,(ya[l]-ya[k])*(xa[j]-xa[i]));
						}	
					}
				}
			}
		}
		cout<<res<<endl;
	}


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

def main():
    N,M = map(int,input().split())

    vol = [1 for i in range(N)]
    prob = [False for _ in range(N)]
    prob[0] = True
    
    for _ in range(M):
        a,b = map(int,input().split())
        if prob[a-1]:
            prob[b-1] = True
        vol[a-1] -= 1
        vol[b-1] += 1
        if vol[a-1] == 0:
            prob[a-1] = False

    print(prob.count(True))

if __name__ == "__main__":
    main()


Measured memory_bytes: 4760
import sys
import decimal
import numpy as np
input = sys.stdin.readline

N = int(input())
A = []
C2 = np.array([[0 for j in range(30)] for i in range(14)])  # 10countは9タス
C5 = np.array([[0 for j in range(30)] for i in range(14)])
C10 = np.zeros(14)
for _ in range(N):
    i = decimal.Decimal(input())
    c10, c2, c5 = 0, 0, 0
    while i % 1 != 0:
        c10 -= 1
        i *= 10
    while i % 10 == 0:
        c10 += 1
        i /= 10
    while i % 2 == 0:
        c2 += 1
        i /= 2
    while i % 5 == 0:
        c5 += 1
        i /= 5
    c2 = min(c2, 30)
    c5 = min(c5, 30)
    A.append((c10, c2, c5))
    C2[c10+9][c2] += 1
    C5[c10+9][c5] += 1
    C10[c10+9] += 1

ans = 0
for i in range(14):
    ans += C10[i]*np.sum(C10[18-i:])
    if i >= 9:
        ans -= C10[i]
    for j in range(18-i):
        if j >= 14:
            continue
        for k in range(1, 30):
            shouldhave = 18 - i - j
            if k >= shouldhave:
                ans += C2[i][k] * np.sum(C5[j][shouldhave:])
                ans += C5[i][k] * np.sum(C2[j][shouldhave:])

print(int(ans//2))


Measured memory_bytes: 43936
import std.stdio,std.conv, std.algorithm, std.container,std.array,std.range,std.string,std.typecons;
const dx = [1,0,-1,0];
const dy = [0,1,0,-1];
void read(T...)(auto ref T args){ 
	auto line = readln().split(); 
	foreach(i,ref arg; args) arg = line[i].to!(typeof(arg));
}
int sum(int n){return n * (n + 1)/ 2;}

void main(){
	int x,y,s;
	while(read(x,y,s),x|y|s){
		int ans ;
		auto taxed= iota(s).map!(i => tax(x,i)).array.assumeSorted;
		foreach(i;1..s){			
			foreach(j;i..s){
				if (taxed[i] + taxed[j] == s ){
					ans = max(ans,tax(y,i) + tax(y,j));break;
				}
			}
		}
		ans.writeln;
	}
}
int tax(int per,int yen) {return yen * (100 +per) / 100;}

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

int main()
{
  string s; cin >> s;
  string ans="";
  rep(i,s.size()) {
    if(i % 2 == 0) ans += s[i];
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
    int n;
    std::cin >> n;
    std::vector<int> a(n);
    for(int i = 0; i < n; i++) std::cin >> a[i];
    std::sort(a.begin(), a.end(), std::greater<int>());

    int alice = 0, bob = 0;
    for(int i = 0; i < n; i++){
        if(i % 2 == 0) alice += a[i];
        else bob += a[i];
    }
    std::cout << alice - bob << std::endl;
    return 0;
}

Measured memory_bytes: 256
X,N = [int(v) for v in input().split()]
P = [int(v) for v in input().split()]
p_f = [False for _ in range(201)]

for p in P:
    p_f[p] = True

ans = 0
for i in range(100):
    if not p_f[X-i]:
        ans = X-i
        break
    elif not p_f[X+i]:
        ans = X+i
        break
print(ans)


Measured memory_bytes: 9188
#include<bits/stdc++.h>
using namespace std;
#define inf 1000000000
#define INF 1000000000000000
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
void init(){
  cin.tie(0);
  ios::sync_with_stdio(false);
}


void f(int w,int h){

  char s[100][100];
  rep(i,h){
    cin>>s[i];
  }

  bool sw[100][100]={},sb[100][100]={};

  queue<P> q;
  rep(i,h){
    rep(j,w){
      if(s[i][j]=='W') q.push(P(i,j));
    }
  }

  while(!q.empty()){
    P p=q.front(); q.pop();
    rep(k,4){
      int x=p.S+vx[k];
      int y=p.F+vy[k];
      if(!(0<=x&&x<w&&0<=y&&y<h)) continue;
      if(s[y][x]!='.') continue;
      if(!sw[y][x]){
        sw[y][x]=true;
        q.push(P(y,x));
      }
    }
  }


  rep(i,h){
    rep(j,w){
      if(s[i][j]=='B') q.push(P(i,j));
    }
  }

  while(!q.empty()){
    P p=q.front(); q.pop();
    rep(k,4){
      int x=p.S+vx[k];
      int y=p.F+vy[k];
      if(!(0<=x&&x<w&&0<=y&&y<h)) continue;
      if(s[y][x]!='.') continue;
      if(!sb[y][x]){
        sb[y][x]=true;
        q.push(P(y,x));
      }
    }
  }


  int nb=0,nw=0;
  rep(i,h){
    rep(j,w){
      if(s[i][j]!='.') continue;
      if(!(sb[i][j]^sw[i][j])) continue;
      if(sb[i][j]) nb++;
      else nw++;
    }
  }

  cout<<nb<<' '<<nw<<endl;


}



      
main(){
  int h,w;
  while(true){
    cin>>w>>h;
    if(w==0) break;
    f(w,h);
  }
}



Measured memory_bytes: 3120
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    int n,x;
    cin>>n>>x;
    int mi=10000000;
    int sum=0;
    for(int i=0;i<n;i++){
        int y;
        cin>>y;
        mi=min(y,mi);
        sum+=y;
    }
    int ans=n;
    x-=sum;
    ans+=x/mi;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using P = pair<ll, ll>;
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

ll gcd(ll x, ll y) {
  return y ? gcd(y, x % y) : x;
}

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

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

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;
}

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

signed main() {
  ll N;
  cin >> N;
  vll H(N);
  rep(i, N) {
    cin >> H[i];
  }

  ll ans = 0;
  ll h = 0;
  rep(i, N) {
    if (i == 0) {
      h = H[i];
      ans++;
      continue;
    }

    if (h <= H[i]) {
      h = H[i];
      ans++;
    }
  }
  COUT(ans);
  return 0;
}

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

int n, t;
vector<int> v;
int ans;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n >> t;
	for(int i=0; i<n; ++i){
		int tmp;
		cin >> tmp;
		v.push_back(tmp);
	}
	for(int i=0; i<n-1; ++i){
		if(v[i] + t < v[i+1]) ans += t;
		else ans += v[i+1] - v[i];
	}
	cout << ans + t << endl;
}

Measured memory_bytes: 1400
#include<iostream>
#include<sstream>
#include<vector>
#include<iterator>
#include<algorithm>
using namespace std;

int main(void)
{
	vector<int> abc(3);
	for(int i=0; i<3; i++)
		cin >> abc[i];

	int ret = 0;
	while(1){
		sort(abc.begin(), abc.end());
		if(abc[0] == abc[2])
			break;

		if(abc[0]+2 <= abc[2])
			abc[0] += 2;
		else{
			abc[0]++;
			abc[1]++;
		}
		ret++;
	}

	cout << ret << endl;

	return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

#define endl '\n'
#define PB push_back
#define F first
#define S second
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define sz(x) (int) x.size()

const double PI = acos(-1);
const double eps = 1e-9;
const int inf = 2000000000;
const ll infLL = 9000000000000000000;
#define MOD 1000000007

#define mem(a, b) memset(a, b, sizeof(a))
#define sqr(a) ((a) * (a))

#define optimize() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed, ios::floatfield);
#define file() freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);

int main() {
    optimize();
    int n;
    cin >> n;
    ll a[n];
    for (int i = 0; i < n; ++i) cin >> a[i];
    ll maxSoFar = -1;
    ll ans = 0LL;
    for (int i = 0; i < n; ++i) {
        maxSoFar = max(maxSoFar, a[i]);
        ans += (maxSoFar - a[i]);
    }
    cout << ans << endl;
    return 0;
}



























Measured memory_bytes: 5172
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define all(v)              ((v).begin()), ((v).end())
#define allr(v)             ((v).rbegin()), ((v).rend())
#define MP                  make_pair
#define PI                  3.14159265359
#define SZ(v)				(int)v.size()
#define ull                 unsigned long long
#define ll                  long long
#define LD					long double
#define vi                  vector<int>
#define vl                  vector<ll>
#define vs                  vector<string>
#define vp                  vector<pair<int,int>>
#define OO                  (int)2e9
using namespace std;
const ll MOD = (int)1e9 + 7;
int dx[] = { 1,-1,0,0,1,-1,1,-1 };
int dy[] = { 0,0,-1,1,1,-1,-1,1 };
const int MAX = (int)1e5 + 10;
using namespace std;

/*void Ka8eeM()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
}*/
int main()
{
	//Ka8eeM();
	int n;
	cin >> n;
	set<int>st;
	while (n--)
	{
		int a;
		cin >> a;
		st.insert(a);
	}
	cout << SZ(st) << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Collections;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		ArrayList<Integer> list=new ArrayList<Integer>();
		for (int i = 0; i < 10; i++) {
			list.add(Integer.parseInt(br.readLine()));
		}
		
		Collections.sort(list);
		for (int i = 9; i > 6; i--) {
			System.out.println(list.get(i));
		}

	}

}

Measured memory_bytes: 16872
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;

const ll MOD = 1e9 + 7; 

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF_INT (1<<30)
#define INF_LL (1ll<<62)

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; }

int N,R;

int main(){
    cin>>N>>R;
    if(N<10)out(R + 100 * (10-N));
    else out(R);
    
    
}

Measured memory_bytes: 256