akhauriyash/Code-Regression huggingface dataset:
/**
 * Created at 17:39 on 2019/03/07
 */

import java.io.*;
import java.util.*;

public class Main {

  static FastScanner sc = new FastScanner();

  public static void main(String[] args) {

    String S = sc.next();
    String T = sc.next();

    HashMap<Character, Character> map = new HashMap<>();

    int len = S.length();
    for (int i=0; i<len; i++) {
      char s = S.charAt(i);
      char t = T.charAt(i);
      if (map.containsKey(s)) {
        if (!map.get(s).equals(t)) {
          System.out.println("No");
          return;
        }
      } else {
        if (map.containsValue(t)) {
          System.out.println("No");
          return;
        } else {
          map.put(s, t);
        }
      }
    }

    System.out.println("Yes");

  }

  static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
      if (ptr < buflen) {
        return true;
      } else {
        ptr = 0;
        try {
          buflen = in.read(buffer);
        } catch (IOException e) {
          e.printStackTrace();
        }
        if (buflen <= 0) {
          return false;
        }
      }
      return true;
    }

    private int readByte() {
      if (hasNextByte()) return buffer[ptr++];
      else return -1;
    }

    private static boolean isPrintableChar(int c) {
      return 33 <= c && c <= 126;
    }

    private void skipUnprintable() {
      while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
    }

    public boolean hasNext() {
      skipUnprintable();
      return hasNextByte();
    }

    public String next() {
      if (!hasNext()) throw new NoSuchElementException();
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while (isPrintableChar(b)) {
        sb.appendCodePoint(b);
        b = readByte();
      }
      return sb.toString();
    }

    public long nextLong() {
      if (!hasNext()) throw new NoSuchElementException();
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
        minus = true;
        b = readByte();
      }
      if (b < '0' || '9' < b) {
        throw new NumberFormatException();
      }
      while (true) {
        if ('0' <= b && b <= '9') {
          n *= 10;
          n += b - '0';
        } else if (b == -1 || !isPrintableChar(b)) {
          return minus ? -n : n;
        } else {
          throw new NumberFormatException();
        }
        b = readByte();
      }
    }

    public int nextInt() {
      return (int) nextLong();
    }
  }

}


Measured memory_bytes: 24148
#include<iostream>
#include<cstdlib>
#include<cctype>
#include<cstdio>
#include<string>
using namespace std;

#define STACK_SIZE 200

class stack
{
        int top;
        int st[STACK_SIZE];
public:
        void init();
        void push(int n);
        int pop();
};

void stack::init()
{
        top = 0;
}

void stack::push(int n)
{
        if(top==STACK_SIZE){
                cout << "Error:Stack is full.\n";
                return;
        }
        st[top] = n;
        top++;
}

int stack::pop()
{
        if(top==0){
                cout << "Error:Stack is empty.\n";
                exit(1);
        }
        top--;
        return st[top]; 
}

int main()
{
        int a, b;
        string str;
        stack stk;
        stk.init();
        while( cin >> str ){
                if( !(str.compare("+") && str.compare("-") && str.compare("*")) ){
                        b = stk.pop();
                        a = stk.pop();
                        switch(str[0]){
                        case '+' : stk.push(a+b); break; 
                        case '-' : stk.push(a-b); break;
                        case '*' : stk.push(a*b); break;
                        }
                }else{
                        stk.push(stoi(str));
                }
        }
        cout << stk.pop() << endl;
                        
        return 0;
}

Measured memory_bytes: 1200
#include <iostream>
#include <vector>
#include <algorithm>
#include <chrono>

using namespace std;
using namespace std::chrono;

int main() {
  auto start = high_resolution_clock::now();

  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  long long n, m;
  cin >> n >> m;
  long long ans = min(n, m / 2);
  n -= ans;
  m -= 2 * ans;

  if (n == 0)
    ans += m / 4;

  cout << ans << endl;

  cerr << "Total execution time : " << duration_cast<milliseconds>(high_resolution_clock::now() - start).count() << " ms" << endl;

  return 0;
}


Measured memory_bytes: 256
def SsSl(): return list(map(lambda x: x, input()))

n = int(input())
#List = [s for s in input().split()]
List = SsSl()

if n%2==1:
    print("No")
else:
    if List[0:(n//2)]==List[(n//2):]:
        print("Yes")
    else:
        #print(List[0:(n/2)])
        #print(List[(n/2):])
        print("No")

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

long long sum = 0;
//long long cnt = 0;
void dfsS(int i, string S){
  if(i >= S.length()-1){
    //cout << S << endl;
    int start = 0;
    int j = start;
    //cout <<"--------------------"<<endl;
    //cout << "#" << S <<" "<< S.length()<< endl;
    while(j < S.length()){
      if(S[j] == '+'){
        string subS = S.substr(start, j-start);
        //cout << stoll(subS)<< endl;
        sum += stoll(subS);
        start = j+1;
        j = start;
      }else{
        j++;
      }
    }
    string subS = S.substr(start, j-start);
    //cout << stoll(subS) << endl;
    sum += stoll(subS);
    return;
  }
  dfsS(i+1, S);
  S = S.insert(i+1,"+");
  dfsS(i+2, S);
}

int main(){
  string S;
  cin >> S;
  dfsS(0, S);
  //cout <<"--------------------"<<endl;
  //cout << cnt << endl;
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n); i >= 0; i--)
#define revrepr(i, a, b) for (int i = (a); i >= b; i--)
#define debug(x) cerr << #x << ": " << x << "\n"

using ll = long long;
using P = pair<int, int>;

const long long MOD = 1e9+7;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T>
void print(const vector<T> &v, const string &delimiter) { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    cin >> a;
    rep(i, n) a.at(i) -= i + 1;
    sort(a.begin(), a.end());
    
    int b = a.at(n / 2);
    ll sum = 0;
    rep(i, n) sum += ll(abs(a.at(i) - b));
    cout << sum << endl;
}

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

 
int main() {
	int n;
	cin>>n;
	int ans=0;
	char arr[n];
	for(int i=0;i<n;i++)
	{
		cin>>arr[i];
	}
	int i=0,j=n-1;
	while(i<j && i<n && j>=0)
	{
		while(i<j && i<n && arr[i]=='R')
		{
			i++;
		}
		while(i<j && j>=0 && arr[j]=='W')
		{
			j--;
		}
		if(i<j && i<n && j>=0)
		{
			swap(arr[i],arr[j]);
		
			ans++;
		}
	}
	cout<<ans<<endl;
	
}


Measured memory_bytes: 3844
import collections
n = int(input())
a = list(map(int,input().split()))
q = int(input())
b = []
c = []
for i in range(q):
    x,y = map(int,input().split())
    b.append(x)
    c.append(y)
    
d = collections.Counter(a)
s = 0
for k,v in d.items():
    s += k*v

for i in range(q):
    s += (c[i]-b[i])*d[b[i]]
    d[c[i]] += d[b[i]]
    d[b[i]] = 0
    print(s)

Measured memory_bytes: 30396
use std::io;


fn main() {
    let (n, m) = {
        let i = read::<usize>();
        (i[0], i[1])
    };
    let mut pm = Vec::new();
    let mut ym = Vec::new();
    let mut order = vec![Vec::new(); n];
    for _ in 0..m {
        let i = read::<usize>();
        pm.push(i[0]);
        ym.push(i[1]);
        order[i[0] - 1].push(i[1]);
    }

    for i in 0..n {
        order[i].sort();
    }

    for i in 0..m {
        print!("{:06}", pm[i]);
        let idx = order[pm[i] - 1].binary_search(&ym[i]).unwrap();
        println!("{:06}", idx + 1);
    }
}


#[allow(dead_code)]
fn read<T>() -> Vec<T>
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.split_whitespace()
        .map(|s| s.trim().parse().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_one<T>() -> T
where T:
    std::str::FromStr,
    T::Err: std::fmt::Debug {

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();
    buf.trim().parse().unwrap()
}

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

	int n,q,a[100000+25],l,r,x;
int main() {
	long long sum=0;
	cin >> n;
	for(int i=0; i<n; i++) 
	{
		cin>>x;
		sum+=x;
		a[x]++;
	}
	cin >> q;
	for(int i=0; i<q; i++)
	{
		cin >> l>>r;
		int v = a[l];
		sum = sum - (1ll*v*l) + (1ll*v*r);
		a[l]=0;
		a[r]+=v;
		cout<<sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 3976
#include<iostream>
using namespace std;
int main(){
  
 long long int a,b,c,d;
  cin>>a>>b>>c>>d;
  long long int first=a*c;
  long long int second=a*d;
  long long int third=b*c;
  long long int fourth=b*d;
  cout<<max(first,max(second,max(third,fourth)))<<endl;
  
  
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e18;
constexpr long long MOD = 1e9 + 7;

signed main() {
    string n;
    cin >> n;
    rep(i, 3) {
        if(n[i]=='7'){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <cmath>
using namespace std;
typedef long long i64;
typedef long double ld;
typedef pair<i64,i64> P;
#define rep(i,s,e) for(int i = (s);i <= (e);i++)


#include <iostream>
#include <queue>
#include <vector>
using namespace std;

using i64 = long long;

struct Graph {
  struct edge {
    int to;
    i64 cap;
    i64 rev;
  };

  int n;
  vector<vector<edge>> edges;

  Graph(int N) {
    n = N;
    edges.resize(n, vector<edge>());
  }

  int size() const { return n; }

  vector<edge> &operator[](int v) { return edges[v]; }
};

struct Dinic {
  int N;
  vector<int> level;
  vector<int> itr;
  Graph G;

  Dinic(int n) : G(n) { N = n; }

  void add_edge(int from, int to, i64 cap, i64 rev_cap) {
    G[from].push_back({to, cap, (int)G[to].size()});
    G[to].push_back({from, rev_cap, (int)G[from].size() - 1});
  }

  bool g_level(int s, int t) {
    level.assign(N, -1);
    queue<int> que;
    que.push(s);
    level[s] = 0;
    while (!que.empty()) {
      int v = que.front();
      que.pop();
      for (auto &e : G[v]) {
        if (e.cap > 0 && level[e.to] == -1) {
          level[e.to] = level[v] + 1;
          que.push(e.to);
        }
      }
    }
    return level[t] >= 0;
  }

  i64 dfs(int v, int t, i64 f) {
    if (v == t)
      return f;

    for (int &i = itr[v]; i < G[v].size(); i++) {
      auto &e = G[v][i];
      if (e.cap > 0 && level[e.to] > level[v]) {
        i64 mi_f = dfs(e.to, t, min(f, e.cap));
        if (mi_f > 0) {
          e.cap -= mi_f;
          G[e.to][e.rev].cap += mi_f;
          return mi_f;
        }
      }
    }
    return 0;
  }

  i64 max_flow(int s, int t) {
    i64 result = 0;
    i64 flow;
    while (g_level(s, t)) {
      itr.assign(N, 0);
      while ((flow = dfs(s, t, 1e9)) > 0)
        result += flow;
    }
    return result;
  }
};

/*

checked
    http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=2723921#1
*/

int n;

i64 a[101];

int main(){
	cin >> n;
	int s = 0;
	int t = n + 1;
	for(int i = 1;i <= n;i++) cin >> a[i];
	Dinic dinic(n + 2);
	i64 sum = 0;
	for(int i = 1;i <= n;i++){
		if(a[i] <= 0){
			dinic.add_edge(s, i, -a[i], 0);
		}
		else{
			dinic.add_edge(i,t,a[i],0);
			sum += a[i];
		}
	}
	for(int i = 1;i <= n;i++){
		for(int j = 2;i * j <= n;j++){
			dinic.add_edge(i, i * j, 1e9, 0);
		}
	}
	cout << sum - dinic.max_flow(s, t) << endl;
}


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

#define pb push_back
#define mp make_pair
#define eb emplace_back
#define all(a) begin(a), end(a)
#define has(a, b) (a.find(b) != a.end())
#define fora(i, n) for(int i = 0; i < n; i++)
#define forb(i, n) for(int i = 1; i <= n; i++)
#define forc(a, b) for(const auto &a : b)
#define ford(i, n) for(int i = n; i >= 0; i--)
#define maxval(t) numeric_limits<t>::max()
#define minval(t) numeric_limits<t>::min()
#define imin(a, b) a = min(a, b)
#define imax(a, b) a = max(a, b)
#define sz(x) (int)(x).size()

#define dbgs(x) #x << " = " << x
#define dbgs2(x, y) dbgs(x) << ", " << dbgs(y)
#define dbgs3(x, y, z) dbgs2(x, y) << ", " << dbgs(z)
#define dbgs4(w, x, y, z) dbgs3(w, x, y) << ", " << dbgs(z)

using ll = long long;
using ld = long double;

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

	ll K, A, B;
	cin >> K >> A >> B;

	if (K < A - 1) {
		cout << K+1 << endl;
		return 0;
	}

	if (B - A > 2) {
		K -= (A - 1);
		ll have = A;
		ll steps = K / 2;
		have += steps * (B - A);
		K -= 2 * steps;
		have += K;
		cout << have << endl;
	} else {
		cout << K + 1 << endl;
	}
}


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


int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 1;
    for(int i=1; i<n; i++){
        if(s[i]!=s[i-1]) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3716
#input
s = input()
t = input()

#output
m = len(s)
n = len(t)
dp = [[0]*(m+1) for _ in range(n+1)]

for i in range(n):
    for j in range(m):
        if t[i] == s[j]:
            dp[i+1][j+1] = dp[i][j]+1
        else:
            dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j])

ans = ""
while m > 0 and n > 0:
    if dp[n][m] == dp[n-1][m]:
        n -= 1
    elif dp[n][m] == dp[n][m-1]:
        m -= 1
    elif dp[n][m] == dp[n-1][m-1] + 1:
        ans += t[n-1]
        n -= 1
        m -= 1

print(ans[::-1])

Measured memory_bytes: 112220
#include<iostream>
#include<algorithm>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)

std::string s;

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

  int cp = 0, pts = 0;
  rep( i, s.size() )
  {
    if( s[i] == 'p' )
    {
      if( cp+1 <= i-cp )
	++cp;
      else
	--pts;
    }
    else
      if( cp+1 <= i-cp )
	++cp, ++pts;
  }

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


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;

    // 整数スキャン（複数）
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s;
    cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s;
        cin >> s;
        slist.push_back(s);
    }
    */

int main() {
    string s;
    cin >> s;
    int a[3]={};
    rep(i,s.size()){
        if(s[i]=='a'){
            a[0]++;
        }
        if(s[i]=='b'){
            a[1]++;
        }
        if(s[i]=='c'){
            a[2]++;
        } 
    }
    int ma=0;
    int mi=99999999;
    rep(i,3){
        maxs(ma,a[i]);
        mins(mi,a[i]);
    }
    if(ma-mi<=1)yn;



    return 0;
}
 
 


Measured memory_bytes: 512
#include <stdio.h>
 
int main(void)
{
    int S, h, m, s;
    scanf("%d", &S);
    
    if (S >= 0 && S <= 86400) {
        s = S % 60;
        S /= 60;
        m = S % 60;
        h = S / 60;
        
        printf("%d:%d:%d\n", h, m, s);
    }

    return 0;
}

Measured memory_bytes: 592
import java.util.*;
public class Main {
	//定義関数から参照できる変数定義はこの辺
	//static Var_form Var_name

	public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
		//long Var_form = sc.nextLong();
		String S = sc.next();
		int min=Integer.MAX_VALUE;
		int ans=0;
		for(int i=1;i<=S.length()-2;i++){
			String subst="";
			subst = S.substring(i-1, i+2);//これでfromからtoの部分文字列をget
			int wk =0;
			wk = Integer.parseInt(subst);
			min=Math.min(Math.abs(753-wk),min);
		}
		ans=min;
		System.out.println(ans);
		//System.out.print(ans);
    }
}

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


const ll INF = 1e16;
const ll mod = 1e9 + 7;
//const ll MOD = 998244353;

ll DPFibonacci(int x){
  int dp[100000] = {0};
  dp[0] = 1;
  dp[1] = 1;
  for(int i = 2; i < x+1; i++){
    dp[i] = (dp[i-1] + dp[i-2]);
    dp[i] %= mod;
  }
  return dp[x];
}

int main() {
  ll n, m;
  cin >> n >> m;
  if(m==0){
   cout << DPFibonacci(n) << endl;
   return 0;
  }
  vector<ll> a(m);
  rep(i,m) cin >> a[i];
  ll ans = DPFibonacci(a[0]-1);ans%=mod;

//  cout << a[0] << endl;
  int pos=a[0]+2;
  for (ll i = 1; i < m; i++) {
//    cout << a[i] << ' ' <<pos << endl;
    if(a[i]-a[i-1] ==1) {
      cout << 0 << endl;
      return 0;
    }
    else{
//      cout << dif_a << endl;
//      cout << DPFibonacci(dif_a) << endl;
      ans = ans* DPFibonacci(a[i]-pos);
      ans %=mod;
//      cout << ans << endl;
    }
    pos=a[i]+2;
//    cout << ans << endl;
  }
  ans = ans* DPFibonacci(n-a[m-1]-1);
  ans %= mod;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1408
import java.util.Scanner;

class Main {

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

            int num = -1;
            while (sc.hasNextInt() && (num = sc.nextInt()) != 0) {

                int count = 0;
                while (num >= 5) {
                    num /= 5;
                    count += num;
                }
                System.out.println(count);
            }
        } finally {
            sc.close();
        }
    }
}

Measured memory_bytes: 26204
let line = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('');
  // 初めの上昇と平坦を除去
  while (line.length > 0 && line[0] !== '\\') line.shift();
  // 終わりの下降と平坦を除去
  while (line.length > 0 && line[line.length - 1] !== '/') line.pop();

  let height_list = [0];
  let current_height = 0;
  line.forEach(function(e, i){
      if (e === '\\') current_height -= 1
      else if (e === '/') current_height += 1
      height_list.push(current_height);
  });

  let h, sum = 0;
  let holes = [];
  while (height_list.length > 1) {
    if (h = makeHole(height_list)) {
      sum += h;
      holes.push(h);
    }
  }

  console.log(sum);
  console.log(holes.length && holes.length + ' ' + holes.join(' '));


function makeHole(list) {
    begin = list.shift();
    let area = 0;
    if (list[0] < begin && begin <= list.reduce((a, b) => Math.max(a, b), -200000)) {
      while (!(list.length === 0 || begin <= list[0])) area += begin - list.shift();
    }
    return area;
}



Measured memory_bytes: 21060
#include <bits/stdc++.h>
const double PI = acos(-1);
#define rep(i, n) for (int i = 0; i < (int)(n); i++ )
using namespace std;
int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
  int i = 1;
  int x;
  while(true){
    cin >> x;
    if(x == 0) break;
    cout << "Case" << " " << i << ":" << " " << x << endl;
    ++i; 
    if(x == 0) break;
  }

}


Measured memory_bytes: 3072
import sys
x = sys.stdin.readline()

[d,n] = x.split(' ')
if int(d) == 0:
    if int(n) == 100:
        print(101)
    else:
        print(n)
elif int(d)==1 or int(d)==2:
    if int(n) == 100:
        print((100**int(d))*(int(n)+1))
    else:
        print((100**int(d))*int(n))

Measured memory_bytes: 3060
# セグメント木
# segment tree
import sys
input = sys.stdin.readline

class segmented_tree:
    X_unit = 0
    X_f = lambda self, a, b: max(a,b)
    def __init__(self, N):
        self.N = N
        self.X = [self.X_unit] * (2*N)
        
    def build(self, seq):
        for i, x in enumerate(seq, self.N):
            self.X[i] = x 
        # 後ろから入れていく
        for i in range(self.N-1, 0, -1):
            self.X[i] = self.X_f(self.X[i<<1], self.X[i<<1|1])

    # 1点更新
    def set_val(self, i, x):
        i += self.N
        self.X[i] = x
        while i > 1:
            i >>= 1
            self.X[i] = self.X_f(self.X[i<<1],self.X[i<<1|1])
    
    # 区間取得
    def fold(self, l, r):
        l += self.N
        r += self.N
        vl = self.X_unit
        vr = self.X_unit
        # 外から決めていく
        while l < r:
            # print(l,r)
            if l & 1:
                vl = self.X_f(vl, self.X[l])
                l += 1
            if r & 1:
                r -= 1
                vr = self.X_f(vr, self.X[r])
            l >>= 1
            r >>= 1
        return self.X_f(vl,vr)

n,k = map(int, input().split())
As = [int(input()) for i in range(n)]
mx = 300001
ans = 0
sg = segmented_tree(330000)

for a in As:
    l = max(0,a-k)
    r = min(mx,a+k)

    upd = sg.fold(l,r+1)
    ans = max(ans, upd+1)

    sg.set_val(a, upd+1)
print(ans)



Measured memory_bytes: 90604
N, K, Q = map(int, input().split())
corrects = [0]*(N+1)
for i in range(Q):
    ai = int(input())
    corrects[ai] += 1

for i in range(1, N+1):
    score = corrects[i] + K - Q
    if score > 0:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 4680
N = int(input())
h = list(map(int,input().split()))
dp = [float('inf')]*N
dp[0] = 0
dp[1] = abs(h[0]-h[1])
for i in range(N-2):
    for j in range(1,3):
        dp[i+j] = min(dp[i]+abs(h[i]-h[i+j]),dp[i+1] + abs(h[i+1]-h[i+j]))
print(dp[-1])

Measured memory_bytes: 13980
fun main(args: Array<String>) {
    val mod = 1000000007L
    val n = readLine()!!.toInt()

    val dp = Array(n + 1) { Array(4) { Array(4) { LongArray(4) { 0 } } } }
    dp[0][3][3][3] = 1

    for (i in (0 until n)) {
        for (c1 in (0 until 4)) {
            for (c2 in (0 until 4)) {
                for (c3 in (0 until 4)) {
                    for (c4 in (0 until 4)) {
                        // .AGC
                        if (c2 == 0 && c3 == 1 && c4 == 2) {
                            continue
                        }

                        // .GAC
                        if (c2 == 1 && c3 == 0 && c4 == 2) {
                            continue
                        }

                        // .ACG
                        if (c2 == 0 && c3 == 2 && c4 == 1) {
                            continue
                        }

                        // A.GC
                        if (c1 == 0 && c3 == 1 && c4 == 2) {
                            continue
                        }

                        // AG.C
                        if (c1 == 0 && c2 == 1 && c4 == 2) {
                            continue
                        }

                        dp[i + 1][c2][c3][c4] += dp[i][c1][c2][c3] % mod
                    }
                }
            }
        }
    }

    var ans = 0L

    for (i in (0 until 4))
        for (j in (0 until 4))
            for (k in (0 until 4)) {
                ans += dp[n][i][j][k] % mod
            }

    println(ans % mod)
}


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

int main() {
  
  vector<int> vec(5);
for (int i = 0; i < 5; i++) {
  cin >> vec.at(i);
}
  
  int k;
  cin>>k;
  
  
  for (int i = 0; i < 5; i++) {
    
    for (int j = i+1; j < 5; j++) {
  if(vec.at(j)-vec.at(i)>k){
    cout<<":("<<endl;
    return 0;
  }
}
  //cin >> vec.at(i);
}
  cout<<"Yay!"<<endl;
  
}
  
  

Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
//#include <random>
//#include <unordered_set>
#include <complex>
using namespace std;
int main()
{
    long long n,y,i,j,k;
    cin>>n>>y;
    for(i=0;i<=n;i++) 
    {
        if((i*10000)>y) break;
   //     if((i*10000+(n-i)*5000)<y) continue;
        for(j=0;j<=n-i;j++) 
        {
                k=n-i-j;

                if(((i*10000)+(j*5000)+(k*1000))==y)
                {
                    cout<<i<<" "<<j<<" "<<k;
                    system ("pause");
                    return 0;
                }

                if(((i*10000)+(j*5000)+(k*1000))>y) break;
            
        }
    }
    cout<<"-1 -1 -1";
    system ("pause"); 
    return 0;
}


Measured memory_bytes: 504
# include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,k;
    cin>>a>>b>>c>>k;
    if(k<=a)
        cout<<k<<endl;
    else if(k<=a+b)
        cout<<a<<endl;
    else
        cout<<a-(k-a-b)<<endl;
    return 0;
}


Measured memory_bytes: 3632
#include<cstdio>
using namespace std;
int num[3];
int min(int n){
  if(n == 2){
    if(num[0] <= num[1])
      return num[0];
    return num[1];
  }
  if(num[0] <= num[1]){
    if(num[0] <= num[2])
      return num[0];
    return num[2];
  }
  if(num[1] <= num[2])
    return num[1];
  return num[2];
}
void solve(int n){
  int lim = min(n);
  for(int i = 1 ; i <= lim ; i++){
    for(int j = 0 ; j < n ; j++){
      if(num[j] % i != 0)
        break;
      if(j == n-1)
        printf("%d\n",i);
    }
  }
}
int main(){
  int n;
  scanf("%d",&n);
  for(int i = 0 ; i < n ; i++)
    scanf("%d",num+i);
  solve(n);
}



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

int main() {
  int a, b, c, num;
  cin >> a >> b >> c;

  if(a > b) {
    num = a;
    a = b;
    b = num;
  }

  if(b > c) {
    num = b;
    b = c;
    c = num;
  }

  if(a > b) {
    num = a;
    a = b;
    b = num;
  }

  cout << a << " " << b << " " << c << endl;
}

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

int digit(long long n) {
	int res = 0;
	while (n)
	{
		n /= 10;
		res++;
	}
	return res;
}

int main() {
	long long N; cin >> N;
	int res = 1001001;
	for (long long i = 1; i * i <= N; i++)
	{
		if(N % i == 0) {
			res = min(res, max(digit(i),digit(N/i)));
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
 
int main(){
    int N, K;
    cin >> N >> K;
    int x[100000];
    for(int i=0;i<N;i++)
        cin >> x[i];
    
    // 累積和
    int sum[100000];
    for(int i=0;i<N;i++){
        if(i == 0)
            sum[i] = 0;
        else
            sum[i] = sum[i-1] + abs(x[i] - x[i-1]);
    }

    int t, ans = 1000000000;
    for(int i=0;i+K-1<N;i++){
        t = sum[i+K-1] - sum[i];
        t += min(abs(x[i]), abs(x[i+K-1]));
        ans = min(t, ans);
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <algorithm>
using namespace std;

int n, m;
int a[101];

int main(){
	scanf("%d %d", &n, &m);
	for(int i=0; i<n; i++)
		scanf("%d", &a[i+1]);

	for(int k=1; k<m+1; k++){
		int i = 1;
		while(i != n){
			if(a[i] % k > a[i+1] % k) swap(a[i], a[i+1]);
			i++;
		}
	}

	for(int i=0; i<n; i++) printf("%d\n", a[i+1]);
	return 0;
}

Measured memory_bytes: 2620
n, k = map(int, input().split())
MOD = 1000000007


def pow(x, t):
    if t == 0:
        return 1
    a = pow(x, t >> 1)
    return a * a * (x ** (t & 1)) % MOD


fact = [0] * (n + 1)
fact[0] = 1
for i in range(1, n + 1):
    fact[i] = fact[i - 1] * i
    fact[i] %= MOD
ifact = [0] * (n + 1)
ifact[n] = pow(fact[n], MOD - 2)
for i in range(n, 0, -1):
    ifact[i - 1] = ifact[i] * i
    ifact[i - 1] %= MOD


def nCr(x, y):
    if y < 0 or y > x:
        return 0
    return fact[x] * ifact[y] * ifact[x - y] % MOD


ans = 0
for i in range(min(n - 1, k) + 1):
    ans += nCr(n, i) * nCr(n - 1, i)
    ans %= MOD
print(ans)


Measured memory_bytes: 18804
N=int(input())
X=input()
popcount=X.count('1')
mod = [popcount+1, popcount-1]
bi = [[0] * N for _ in range(2)]
Xnum = [0] * 2
add_diff = [1, -1]
for j in range(2):
    if mod[j] != 0:
        for i in range(N):
            if i==0: bi[j][0]=1%mod[j]
            else: bi[j][i]=bi[j][i-1]*2%mod[j]
            Xnum[j] = (Xnum[j] + int(X[N-i-1])*bi[j][i])%mod[j]
for i in range(N):
    if popcount==1 and X[i]=='1':
        print(0)
        continue
    Xi = ( Xnum[int(X[i])] + add_diff[int(X[i])] * bi[int(X[i])][N-i-1] ) % mod[int(X[i])]
    ans = 1
    while Xi!=0:
        Xi = Xi % bin(Xi).count('1')
        ans += 1
    print(ans)

Measured memory_bytes: 85660
N = int(input())
S = input()
count = 0
for i in range(1000):
    t = str(i).zfill(3)
    a = S.find(t[0])
    b = S.find(t[1], a+1)
    c = S.find(t[2], b+1)
    if a != -1 and b != -1 and c != -1:
        count += 1
print(count)

Measured memory_bytes: 3064
def Base_10_to_n(X, n):
    if (int(X/n)):
        return Base_10_to_n(int(X/n), n)+str(X%n)
    return str(X%n)


n,k = map(int, input().split())

c = Base_10_to_n(n , k)

print(len(str(c)))

Measured memory_bytes: 3060
N, D = map(int, input().split())
table = []
for _ in range(N):
    row = list(map(int, input().split()))
    table.append(row)
cnt = 0
for i in range(N):
    for k in range(i+1, N):
        diff = 0
        for d in range(D):
            diff += (table[i][d] - table[k][d]) ** 2
        result = diff ** 0.5
        if float(int(result)) == result:
            cnt += 1
print(cnt)


Measured memory_bytes: 38512
#include <iostream>
#include <cstdio>
#include <math.h>
#include <vector>
#include <set>
#include <algorithm>
#include <queue>
#include <map>
#include <stack>
#include <string.h>
#include <array>
#include <bitset>

using namespace std;

const int maxn=2e5+5;

string s;
int pref[maxn];
int suff[maxn];

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n, k, c;
	cin >> n >> k >> c;
	cin >> s;
	int ne=-1;
	for(int i=0; i<n; i++){
		pref[i+1]=pref[i];
		if(i>ne && s[i]=='o'){
			pref[i+1]++;
			ne=i+c;
		}
	}
	ne=n;
	for(int i=n-1; i>-1; i--){
		suff[n-i]=suff[n-i-1];
		if(i<ne && s[i]=='o'){
			suff[n-i]++;
			ne=i-c;
		}
	}
	if(pref[n]>k){
		return 0;
	}
	int l, d;
	for(int i=0; i<n; i++){
		if(s[i]=='o'){
			l=max(0, i-c);
			d=min(n, i+c+1);
			if(pref[l]+suff[n-d]+1<k){
				s[i]='x';
			}
		}
	}
	for(int i=0; i<n; i++){
		pref[i+1]=pref[i];
		if(s[i]=='o'){
			pref[i+1]++;
		}
	}
	for(int i=0; i<n; i++){
		if(s[i]=='o'){
			l=max(0, i-c);
			d=min(n, i+c+1);
			if(pref[i]-pref[l]==0 && pref[d]-pref[i+1]==0){
				cout << i+1 << '\n';
			}
		}
	}
	return 0;
}

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

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int N,Q; cin >> N >> Q;
	atcoder::fenwick_tree<long long> bit(N);
	for(int i=0;i<N;++i) {
		int a; cin >> a; bit.add(i,a);
	}
    while(Q--){
        int t,l,r; cin >> t >> l >> r;
        if(t) cout << bit.sum(l,r) << "\n";
        else bit.add(l,r);
    }
    return 0;
}


Measured memory_bytes: 8224
import java.util.Scanner;

public class Main{
 public static void main(String[] args){
 Scanner sc = new Scanner(System.in);
 int[] chars = new int[256];
 while(sc.hasNextLine()){
 String line= sc.nextLine();
 for(int i=0;i<line.length();i++){
 char ch =Character.toLowerCase(line.charAt(i));
 for(char search ='a';search<='z';search++){
  if(search == ch){
   chars[search]++;
   }
  }
 }
}
 for(char ch ='a';ch<='z';ch++){
 System.out.println(ch +" : "+ chars[ch]);
  }
 }
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF INT_MAX/3

ll n,k;
ll a[111111];

int main(){
	cin.sync_with_stdio(false);
  cin>>n>>k;
  rep(i,n)cin>>a[i];
  ll g=a[0];
  ll m=*max_element(a,a+n);
  repl(i,1,n){
    g=__gcd(g,a[i]);
  }
  if(k%g!=0||k>m)cout<<"IMPOSSIBLE"<<endl;
  else cout<<"POSSIBLE"<<endl;
	return 0;
}


Measured memory_bytes: 1024
// #include <bits/stdc++.h>
#include <iostream>
#include <vector>

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()

using namespace std;
using ll = long long;

const double PI = 3.14159265358979;

void solve()
{
  ll n;
  cin >> n;
  vector<ll> a(n);
  for(int i = 0; i < n; ++i)
  {
    cin >> a[i];
  }
  for(int i = 1; i < n; ++i)
  {
    a[i] += a[i - 1];
  }
  ll ans = (1LL << 60);
  for(int i = 0; i < n - 1; ++i)
  {
    ans = min(ans, abs(a.back() - 2 * a[i]));
  }
  cout << ans;
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 4776
package main

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

var sc = bufio.NewScanner(os.Stdin)

func scanInt() int {
	num, _ := strconv.Atoi(scanString())
	return num
}

func scanString() string {
	sc.Scan()
	return sc.Text()
}

func init() {
	sc.Split(bufio.ScanWords)
}

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

func main() {
	n := scanInt()
	total := 0
	for i := 1; i <= n; i++ {
		for j := 1; j <= n; j++ {
			for k := 1; k <= n; k++ {
				ij := gcd(i, j)
				total += gcd(ij, k)
			}
		}
	}
	fmt.Println(total)
}


Measured memory_bytes: 1772
#include<cstdio>
#include<algorithm>
using namespace std;

main(){
  int n,m,v;
  while(scanf("%d%d",&n,&m),n+m){
    int a[110]={0},h=0,w=0;
    while(n--){
      scanf("%d",&v);
      h = max(h,++a[v/m]);
      w = max(w,v/m);
    }
    double res = 0.01;n=w;
    while(w--)res += (double)a[w]/h * (double)(n-w)/n;
    printf("%.9lf\n",res);
  }
}

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

int main() {
  int A, B, C, D, L, R;
  cin >> A >> B >> C >> D;
   L = A + B;
   R = C + D;
  if (L > R) {
   cout << "Left" << endl;
  }
  else if (L == R) {
   cout << "Balanced" << endl;
  }
  else {
   cout << "Right" << endl;
  }
}

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

int main(){
    int n;
    vector<int> edges;
    cin >> n;

    for(int i = 0; i < n; i++){
        int edge;
        cin >> edge;
        edges.push_back(edge);
    }

    sort(edges.begin(), edges.end());

    int m_edge = edges[n-1];
    int edge_sum = accumulate(edges.begin(), edges.end()-1, 0);

    //cout << m_edge << " " << edge_sum;
    if(m_edge < edge_sum){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main(void){
    int x, y, z;
    cin >> x >> y >> z;
    int n = x + y + z;
    VL a(n), b(n), c(n);
    REP(i,n) scanf("%lld %lld %lld", &a[i], &b[i], &c[i]);

    ll suma = 0;
    vector<PL> dif(n), ba(n), ca(n);
    REP(i,n){
        suma += a[i];
        dif[i] = PL(b[i] - a[i], c[i] - a[i]);
        // ba[i] = PL(b[i] - a[i], i);
        // ca[i] = PL(c[i] - a[i], i);
    }
    sort(ALL(dif));
    reverse(ALL(dif));
    REP(i,n){
        ca[i] = PL(dif[i].second, i);
    }
    // sort(ALL(ba));
    // reverse(ALL(ba));
    sort(ALL(ca));
    reverse(ALL(ca));

    ll sumb = 0, sumc = 0;
    priority_queue<ll> pq;
    REP(i,y){
        sumb += dif[i].first;
        pq.push(dif[i].second - dif[i].first);
    }
    VI usec(n);
    int p = 0, last;
    REP(i,n){
        if (ca[i].second < y) continue;
        sumc += ca[i].first;
        usec[ca[i].second] = 1;
        p++;
        last = i;
        if (p == z) break;
    }

    // cout << "hi" << endl;

    // REP(i,n) cout << dif[i].first << " " << dif[i].second << endl;
    // REP(i,n) cout<< usec[i] << endl;

    ll ma = sumb + sumc;
    FOR(i,y,y+z-1){
        // cout << i << endl;
        if (usec[i]){
            sumc -= dif[i].second;
            usec[i] = 0;
        }else{
            while (usec[ca[last].second] == 0) last--;
            sumc -= ca[last].first;
            usec[ca[last].second] = 0;
        }
        sumb += dif[i].first;
        pq.push(dif[i].second - dif[i].first);
        sumb += pq.top();
        pq.pop();
        ma = max(ma, sumb + sumc);
    }

    cout << suma + ma << endl;

}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define eee(a) (cerr << (#a) << ": " << (a) << endl);


using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using mint = map<int, int>;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1e9+7;
const int INF = 1e9;
const ll LINF = 1e18;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

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; }
template<typename T>
void ppp(T n){cout << n << endl;}
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {return s << "(" << p.first << ", " << p.second << ")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
    int len = v.size();
    s << '[';
    for (int i = 0; i < len; ++i) {
        s << v[i]; if (i < len-1) s << ", ";
    }
    s << ']';
    return s;
}

struct aaa{
    aaa(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(15);
    };
}fastio;

int main(){

    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    --a; --b; --c; --d;

    string s;
    cin >> s;

    if(c < d){
        for(int i = b+1; i < d-1; ++i){
            if(s[i] == '#' and s[i+1] == '#'){
                No();
                return 0;
            }
        }
        for(int i = a+1; i < c-1; ++i){
            if(s[i] == '#' and s[i+1] == '#'){
                No();
                return 0;
            }
        }
    }

    else{
        int idx = -1;
        for(int i = b-1; i < d; ++i){
            if(s.substr(i, 3) == "...") idx = i+1;
        }
        if(idx >= 0){
            s[idx] = '#';
            for(int i = a+1; i < c-1; ++i){
                if(s[i] == '#' and s[i+1] == '#'){
                    No();
                    return 0;
                }
            }
            for(int i = b+1; i < d-1; ++i){
                if(s[i] == '#' and s[i+1] == '#'){
                    No();
                    return 0;
                }
            }
        }
        else{
            s[b] = '#';
            for(int i = a+1; i < c-1; ++i){
                if(s[i] == '#' and s[i+1] == '#'){
                    No();
                    return 0;
                }
            }
            s[b] = '.';
            for(int i = b+1; i < d-1; ++i){
                if(s[i] == '#' and s[i+1] == '#'){
                    No();
                    return 0;
                }
            }
        }
    }
    Yes();
    return 0;
}


Measured memory_bytes: 592
# from math import pi
# a = int(input())
# # a = [int(i) for i in input().split()]

# print(2*pi*a)

n, k = [int(i) for i in input().split()]
res = 0
for i in range(k, n + 2):
    res += (2 * n - 2 * i + 2) * i // 2 + 1


print(res%(10**9+7))

Measured memory_bytes: 63188
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0;i < (n);i++)
#define all(v) v.begin(),v.end()
#define dec(n) cout << fixed << setprecision(n);
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using vl = vector<ll>;
using vvl = vector<vl>;

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

ll mod(ll a){
  return (a % 1000000007);
}

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


int main(){
  ll w,h,x,y; cin >> w >> h >> x >> y;
  
  dec(10);
  
  cout << (w/2.0)*h;
  
  if(w/2.0 == x && h/2.0 == y) cout << ' ' << 1 << endl;
  else cout << ' ' << 0 << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    void solve() throws IOException {
        String s = ns();
        int n = s.length();

        if (s.charAt(0) == s.charAt(n - 1)) n++;

        out.println(n % 2 == 1 ? "First" : "Second");
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}

Measured memory_bytes: 10964
#include <iostream>
#include <string>
#include <cstring>
#include <set>
#include <queue>
#include <stack>

using namespace std;

#define maxN 200000
#define maxQ 200000

int main(){
  double c;
  int N;
  double sum = 0;

  cin >> N;
  for(int i=0; i<N; i++){
    cin >> c;
    sum += 1/c;
  }

  cout << 1/sum << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
using namespace  std;
vector<long long int> vc;
vector<pair<long long ,long long>>vc2;
int main() {
long long sum=0;
    long long n,p;
    cin>>n>>p;
    long long maxix=0;
    for(int i=0;i<n;i++)
    {
       long long int x,y;
        cin>>x>>y;
        maxix= max(maxix,x);
        vc.push_back(y);
 
    }
    int counter=0;
sort(vc.begin(),vc.end());
    for(int i=vc.size()-1;i>=0;i--){
 
        if(vc[i]>maxix) {
            p -= vc[i];
            counter++;
        }
        if(p<=0)break;}
 
 
while(p>0){
    p-=maxix;
    counter++;
}
 
 
cout<<counter;
 
 
}
 

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
  int a, b, c, d;
  while(cin>>a>>b>>c>>d){
      cout<<max(0, min(b, d)-max(a, c))<<endl;
  }
  return 0;
}




Measured memory_bytes: 256
a = input().split()
if -1000 > int(a[0]):
    print('')
elif 1000 < int(a[0]):
    print('')    
elif -1000 > int(a[1]):
    print('')
elif 1000 < int(a[1]):
    print('')    
elif int(a[0]) < int(a[1]):
    print('a < b')
elif int(a[0]) > int(a[1]):
    print('a > b')
elif int(a[0]) == int(a[1]):
    print('a == b')


Measured memory_bytes: 5596
/*
 * Created by Dipta Das on 08-05-2019
 * Title: 
 * Problem Link: 
 * Editorial: 
 * Source Code: 
 * Comments: 
*/

#include <bits/stdc++.h>
#include <stdio.h>
#define fin freopen("input", "r", stdin)
#define whatis(x) cerr << #x << ": " << x << endl;

using namespace std;
using ll = long long;

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

    int n;
    cin >> n;
    vector<int> ar(n);
    for (auto &i : ar) cin >> i;

    int cnt = 1;
    for (int i = 1; i < n; ++i) {
        bool take = true;
        for (int j = 0; j <= i-1; ++j) {
            if (ar[i] < ar[j]) {
                take = false;
            }
        }
        if (take) ++cnt;
    }

    cout << cnt << endl;
    


    return 0;
}



Measured memory_bytes: 256