akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll inf =1LL << 62;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b,const ll &mod) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b,const ll &mod) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b,const ll &mod) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b,const ll &mod) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
random_device rd;
mt19937 mt(rd());
uniform_int_distribution<int> dice(1,6);
uniform_real_distribution<double> score(0.0,10.0);

ll mod;
vi sum;

// [l, r)
inline ll calc(int l, int r){
    return SUB(sum[l], sum[r], mod);
}

int main(void){
    for(ll a, b; cin >> a >> b >> mod, a;){
        ll n = b - a;
        vi dp(n + 1);
        sum = vi(n + 2);

        dp[n] = sum[n] = 1 % mod;
        rrep(i, n){
            ll ca = a + i;
            ll upper = 1;
            while(upper <= ca) upper *= 10;

            dp[i] = 1;

            ll p = 1;
            rep(loop, 10){
                if(loop != 0) p *= 10;

                if(ca % (p * 10) / p == 9 or ca / p == 0) continue;
                ll na = (ca + p) / p * p;
                ll nb = (ca + 10 * p) / (10 * p) * (10 * p);

                if(na > b) continue;
                na -= a; nb -= a;
                chmin(nb, n + 1);

                dp[i] = ADD(dp[i], calc(na, nb), mod);
            }

            p = 10;
            rep(loop, 10){
                ll na = ca * p;
                ll nb = upper * p;

                if(na > b) continue;
                na -= a; nb -= a;
                chmin(nb, n + 1);

                dp[i] = ADD(dp[i], calc(na, nb), mod);

                p *= 10;
            }

            sum[i] = ADD(sum[i + 1], dp[i], mod);
        }

        cout << sum[0] << endl;
    }

    return 0;
}

Measured memory_bytes: 4400
from bisect import *
S = input()
T = input()
ds = {}
for i,s in enumerate(S) :
    if s not in ds :
        ds[s] = [i]
    else :
        ds[s].append(i)

ind = -1
cnt = 0

for t in T :
    if t not in ds :
        ans = -1
        break
else :
    for t in T :
        if ds[t][-1] <= ind :
            ind = ds[t][0]
            cnt += 1
        else :
            ind = ds[t][bisect_right(ds[t], ind)]
    ans = cnt * len(S) + ind + 1
print(ans)


Measured memory_bytes: 46472
#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define ll long long
#define ld long double
#define ft first
#define sd second
using namespace std;

const int N = 400 + 9;
ll a[N], pre[N];
ll f[N][N];

signed main() {

    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n; cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
        f[i][i] = 0;
        pre[i] = pre[i-1] + a[i];
    }
    const ll inf = 1e18;
    for(int l = 2; l <= n; l++) {
        for(int i = 1; i + l - 1 <= n; i++) {
            int j = i + l - 1;
            f[i][j] = inf;
            for(int k = i; k < j; k++) {
                f[i][j] = min(f[i][j], f[i][k] + f[k+1][j] + pre[j]-pre[i-1]);
            }
        }
    }
    cout << f[1][n] << endl;
    return 0;
}

Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
int dp[2510][2510];
int dp2[2510][2510];
const int inf=1000000;
int main(){
	int n;	cin>>n;
	vector<int> t(n);
	int sum=0;
	for(int i=0;i<n;i++){
		cin>>t[i];
		sum+=t[i];
	}
	for(int i=0;i<=n;i++){
		for(int j=0;j<=sum;j++){
			for(int k=0;k<=sum;k++)	dp[j][k]=dp2[j][k]=inf;
		}
	}
	dp[0][0]=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<=sum;j++){
			for(int k=0;k<=sum;k++){
				if(j>=t[i]){
					dp2[j][k]=min(dp2[j][k],dp[j-t[i]][k]);
				}
				if(k>=t[i]){
					dp2[j][k]=min(dp2[j][k],dp[j][k-t[i]]);
				}
				dp2[j][k]=min(dp2[j][k],dp[j][k]+t[i]);
			}
		}
		for(int j=0;j<=sum;j++){
			for(int k=0;k<=sum;k++){
				dp[j][k]=dp2[j][k];
				dp2[j][k]=inf;
			}
		}
	}
	int ans=inf;
	for(int i=0;i<=sum;i++){
		for(int j=0;j<=sum;j++){
			int large=max(dp[i][j],max(i,j));
			ans=min(ans,large);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 50340
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<sstream>
using namespace std;
typedef  long long int lint;
typedef pair<int, int> P;
typedef pair<lint, lint> LLP;
typedef pair<char, char>CP;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define sort(v) sort((v).begin(), (v).end())
#define reverse(v) reverse((v).begin(), (v).end())
#define upper(v,hoge) upper_bound(v.begin(),v.end(),hoge)
#define lower(v,hoge) lower_bound(v.begin(),v.end(),hoge)
#define llower(v,hoge) *lower_bound(v.begin(), v.end(), hoge)
#define lupper(v,hoge) *upper_bound(v.begin(), v.end(), hoge)
/*
vector<char>al(26);
al = {'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
vector<char>AL(26);
AL = {'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
vector<char>NUM(10);
	NUM = { '0','1','2' ,'3' ,'4' ,'5' ,'6' ,'7' ,'8' ,'9' };
*/



int main() {
	int A, B;
	cin >> A >> B;
	if (A <= 8 && B <= 8) {
		cout << "Yay!" << endl;
	}
	else {
		cout << ":(" << endl;
	}
}

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

using namespace std;
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)

typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1LL<<60;

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

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

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

  string s;
  cin >> s;
  if(s.length() == 3){
    reverse(s.begin(), s.end());
  }

  cout << s << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
main(void){
   string a, b;
   int check=0;
   cin>>a>>b;
   if(a.length()>b.length()){
        check=1;
   }else if(a.length()<b.length()){
        check=-1;
   }else{
        for(int i=0;i<a.length();i++){
            if(a[i]>b[i]){
                check=1; break;
            }else if(a[i]<b[i]){
                check=-1; break;
            }else continue;
        }
   }
   if(check>0) cout<<"GREATER";
    else if(check<0) cout<<"LESS";
   else cout<<"EQUAL";
}


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

#define ALL(v) (v).begin(),(v).end()

using namespace std ;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;




int main()
{
  string s ;
  cin >> s ;
  
  
  rep(i, 3){
    if (s.at(i)=='1'){
      s.at(i) = '9' ;
    }
    else {
      s.at(i) = '1' ;
    }
  }
  
  cout << s <<endl ;
    return 0 ;
}

/*　吾輩はやれば出来る子である。 
　　　　∩∩ 
　　　（´･ω･） 
　　 ＿|　⊃／(＿＿_ 
　／　└-(＿＿＿_／ 
　￣￣￣￣￣￣￣ 
　やる気はまだない 

　　 ⊂⌒／ヽ-、＿_ 
　／⊂_/＿＿＿＿ ／ 
　￣￣￣￣￣￣￣　　*/



Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <utility>
#include <vector>
#include <cmath>
#include <map>
#include <string>

using namespace std;

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

    int n, k;
    cin >> n >> k;
    int v[50];

    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
    }

    long long int maxval = 0;

    for (int l = 0; l <= min(k, n); l++)
    {
        for (int r = 0; r <= min(k, n) - l; r++)
        {
            int idx = 0;
            int get[50];
            for (int i = 0; i < l; i++)
            {
                get[idx++] = v[i];
            }
            for (int i = 0; i < r; i++)
            {
                get[idx++] = v[n - 1 - i];
            }
            
            sort(get, get + idx);
            for (int i = 0; i < min(k - l - r, idx); i++)
            {
                if (get[i] >= 0) break;
                get[i] = 0;
            }
            
            long long int val = 0;
            for (int i = 0; i < idx; i++)
            {
                val += get[i];
            }
            
            maxval = max(maxval, val);
        }
    }

    cout << maxval << "\n";

    return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;
int64_t i,j,k,l;//preparation for
int main(){
    string b;
    cin>>b;
     if('A'<=b[0]&&b[0]<='Z'){
         cout<<"A";
     }
     else{
         cout<<"a";
     }

    return 0;
}

Measured memory_bytes: 3636
import java.math.BigDecimal;
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int x = sc.nextInt();
        BigDecimal rit = new BigDecimal("380000");
        BigDecimal ans = new BigDecimal("0");
        for (int i = 0; i < x; i++) {
            BigDecimal y = sc.nextBigDecimal();
            String z = sc.next();
            if (z.equals("JPY")) {
                ans = ans.add(y);
            } else {
                ans = ans.add(y.multiply(rit));
            }
        }
        System.out.println(ans.toString());
    }
}

Measured memory_bytes: 24272
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<queue>
#include<map>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define PI  3.141592;
typedef long long ll;
typedef pair<int,int> P;

int main(){
    double a,b,x;
    cin >> a >> b >> x;
    double ans;

    if(x>=0.5*a*a*b){
        double h = 2*(b-x/(a*a));
        ans = atan2(h,a);
        ans = ans*360/(2*acos(-1));
    }else{
        double h = 2*x/(a*b);
        ans = atan2(b,h);
        ans = ans*360/(2*acos(-1));
    }
    printf("%.7f\n",ans);

}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = LLONG_MAX;

vector<ll> divisors(ll n)
{
    vector<ll> res;
    for (ll i = 1; i * i <= n; ++i)
    {
        if (n % i == 0)
        {
            res.push_back(i);
            if (n / i != i)
                res.push_back(n / i);
        }
    }
    return res;
}

int main()
{
    ll N;
    cin >> N;
    vector<ll> res = divisors(N);
    ll ans = 0;
    int M = res.size();
    for (int i = 0; i < M; ++i)
    {
        if (N / res[i] < res[i] - 1)
            ans += res[i] - 1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
class Dice
  def initialize
    @top = 1
    @under = 6
    @north = 5
    @south = 2
    @east = 3
    @west = 4
  end

  def north
    tmp = @top
    @top = @south
    @south = @under
    @under = @north
    @north = tmp
    @top
  end

  def east
    tmp = @top
    @top = @west
    @west = @under
    @under = @east
    @east = tmp
    @top
  end

  def west
    tmp = @top
    @top = @east
    @east = @under
    @under = @west
    @west = tmp
    @top
  end

  def south
    tmp = @top
    @top = @north
    @north = @under
    @under = @south
    @south = tmp
    @top
  end

  def right
    tmp = @south
    @south = @east
    @east = @north
    @north = @west
    @west = tmp
    @top
  end

  def left
    tmp = @south
    @south = @west
    @west = @north
    @north = @east
    @east = tmp
    @top
  end
end

def operation op_num
  total = 1
  dice = Dice.new
  op_num.times do
    op_str = gets.chomp.downcase
    total += eval("dice.#{op_str}.to_i")
  end
  total
end

answers = []
loop do
  op_num = gets.chomp.to_i
  break if op_num == 0
  answers << operation(op_num)
end

answers.each {|str|puts str}

Measured memory_bytes: 6480
import java.lang.Math;
import java.util.Scanner;
import java.math.BigDecimal;
import java.lang.Double;

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

String r = sc.next();//r

//String strr = Integer.toString();

BigDecimal br= new BigDecimal(r);


BigDecimal rr= br.multiply(br);
BigDecimal s = rr.multiply(BigDecimal.valueOf(Math.PI));

BigDecimal r2 = br.add(br);
BigDecimal c = r2.multiply(BigDecimal.valueOf(Math.PI));
System.out.println(s+" "+c);
  }


}


Measured memory_bytes: 26548
import java.util.*;

public class Main {
    static final int MAXV = 1000000000;
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Robot[] robots = new Robot[n];
        for(int i = 0; i < n; ++i) {
            int x = sc.nextInt();
            int l = sc.nextInt();
            int left = x - l;
            int right = x + l;
            robots[i] = new Robot(left, right);
        }

        Arrays.sort(robots);

        int ans = 0;
        int cur = -MAXV;
        for(int i = 0; i < n; ++i) {
            if(cur <= robots[i].left) {
                ++ans;
                cur = robots[i].right;
            }
        }
        System.out.println(ans);
    }
}

class Robot implements Comparable<Robot> {
    int left;
    int right;

    public Robot(int left, int right) {
        this.left = left;
        this.right = right;
    }

    @Override
    public int compareTo(Robot other) {
        return this.right - other.right;
    }
}

Measured memory_bytes: 87496
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(void)
{
  int a[32] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << a[k-1] << endl;
  return 0;
}



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

int main() {
	string s;
	cin >> s;
	puts((s[0] == s[1] && s[1] == s[2]) || (s[1] == s[2] && s[2] == s[3]) ? "Yes" : "No");
        return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
n=int(input())
A=list(map(int,input().split()))

ans=0
l=0;r=0
s=0#ここでf(a,a)を計算
xsum=0
for l in range(0,n):
    while(r < n and s == xsum):
        #sum += A[r+1] #ここでf(l,r+1)を計算
        s+=A[r]
        xsum^=A[r]
        r+=1
    if s == xsum: #このl以上のLに対して，f(L,r)=trueとなるrは存在しない
        r=n+1
    #f(l,r)=trueとなる最小のrがとれた！
    
    ans += r-l-1
    #ここで問題に必要な値を計算（例：区間の長さを計算する）
    s -= A[l] #ここでf(l+1,r)を計算
    xsum ^= A[l] #ここでf(l+1,r)を計算

print(ans)


Measured memory_bytes: 25684
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using TP = tuple<ll,ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(18);
}
#define MAX_N 52
#define INF 1e18
ll d[MAX_N][MAX_N*MAX_N];
struct edge{ll to,cost,coin;};
vector<edge> G[MAX_N];
vector<ll> c(MAX_N),di(MAX_N);
void dij(ll s){
  priority_queue<TP,vector<TP>,greater<TP>> que;
  fill(d[0],d[MAX_N],INF);
  s = min(s,MAX_N*MAX_N-1ll);
  d[0][s] = 0;
  que.push(TP(0,s,0));
  while(!que.empty()){
    auto [dis,coin,v]=que.top();
    que.pop();
    coin = min(coin,MAX_N*(MAX_N-1ll));
    if(d[v][coin]<dis) continue;
    ll n_d = dis + di[v];
    ll n_coin = min(coin+c[v],MAX_N*(MAX_N-1ll));
    if(d[v][n_coin]>n_d){
      que.push(TP(n_d,n_coin,v));
      d[v][n_coin] = n_d;
    }
    for(ll i=0;i<(ll)G[v].size();i++){
      edge e=G[v][i];
      n_coin = coin - e.coin;
      if(n_coin>=0 && d[e.to][n_coin]>dis+e.cost){
        d[e.to][n_coin] = dis+e.cost;
        que.push(TP(d[e.to][n_coin],n_coin,e.to));
      }
    }
  }
}
ll min_d[MAX_N][MAX_N];
signed main(){
  init_io();
  ll n,m,s;
  cin >> n >> m >> s;
  vector<ll> u(m),v(m),a(m),b(m);
  for(int i=0;i<m;i++){
    cin >> u[i] >> v[i] >> a[i] >> b[i];
    u[i]--;
    v[i]--;
    G[u[i]].push_back({v[i],b[i],a[i]});
    G[v[i]].push_back({u[i],b[i],a[i]});
  }
  for(int i=0;i<n;i++){
    cin >>c[i] >> di[i];
  }
  for(int i=0;i<n;i++){
    dij(s);
  }
  for(int i=1;i<n;i++){
    ll ans = INF;
    for(int j=0;j<MAX_N*MAX_N;j++){
      ans = min(d[i][j],ans);
    }
    cout << ans << endl;
  }
}

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

int main() {
  int N;
  cin >> N;
  vector<int> x(N);
  for(int i=1; i<=N; i++) {
    cin >> x[i];
  }
  int b=1, ans=1, v;
  while(x[b] != 2){
    if(x[b] == 1) {
      ans=-1;
      break;
    }
    else{
      v=b;
      ans++;
      b=x[b];
      x[v]=1;
    }
  }
  cout << ans;
  return 0;
}
      

Measured memory_bytes: 640
import java.util.Scanner;

public class Main{
    static Scanner scan = new  Scanner(System.in);
    public static void main(String [] args){
         
            int n = scan.nextInt(); int m = scan.nextInt();
            int [][] mtx = new int [n][m];
            int [] mtx2 = new int [m];
            int [] ans = new int [n];
            for (int i = 0; i < n; i++) {
                for (int j = 0; j < m; j++) {
                    mtx[i][j] = scan.nextInt();
                }
            }
            for (int i = 0; i < m; i++) {
                mtx2[i] = scan.nextInt();
            }
            
            for (int i = 0; i < n; i++) {   
                for (int j = 0; j < m; j++) {
                     ans[i] += mtx[i][j] * mtx2[j] ;
                }
                System.out.println(ans[i]);
             }
    }
}


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

using namespace std ;

const int MAX = 2e5+5 ;
const long long mod = 998244353 ;

long long arr[MAX] , freq[MAX] ;

int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	int n ;
	cin>>n ;
	for(int i = 0 ; i < n ; ++i)
	{
		cin>>arr[i] ;
		freq[arr[i]]++ ;
	}
	int Max = *max_element(arr , arr+n) ;
	long long ans = 1ll ;
	if(freq[0] != 1ll || arr[0] != 0ll)
		return cout<<0<<"\n" , 0 ;
	for(int i = 1 ; i <= Max ; ++i)
	{
		if(freq[i-1] == 0 || freq[i] == 0)
			return cout<<0<<"\n" , 0 ;
		for(int j = 0 ; j < freq[i] ; ++j)
		{
			ans = (ans * freq[i-1]) % mod ;
			ans %= mod ;
		}	
	}
	return cout<<ans<<"\n" , 0 ;
}

Measured memory_bytes: 1792
import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;

void main(){
	int n, k;
	{
		int[] tmp = readln.chomp.split.map!(to!int).array;
		n = tmp[0], k = tmp[1];
		}
	long[] as = readln.chomp.split.map!(to!long).array;
	
	long[] bs = as.map!(x => (x > 0)? 0: x).array;
	long[] cs = as.map!(x => (x > 0)? x: 0).array;
	
	BigInt x = bs[0 .. k].reduce!("a + b");
	BigInt y = cs[0 .. k].reduce!("a + b");
	BigInt xmax = x;
	BigInt ymin = y;
	int ixmax = 0;
	int iymin = 0;
	for(int i = 1; i + k <= n; i ++){
		x -= bs[i - 1];
		x += bs[i + k - 1];
		y -= cs[i - 1];
		y += cs[i + k - 1];
		if(x > xmax){
			xmax = x;
			ixmax = i;
			}
		if(y < ymin){
			ymin = y;
			iymin = i;
			}
		debug writeln(x, " ", xmax, "; ", y, " ", ymin);
		}
	
	BigInt ans1;
	for(int i = 0; i < n; i ++){
		if(i < ixmax || ixmax + k <= i){
			if(as[i] > 0) ans1 += as[i];
			debug writeln(as[i], as[i] > 0);
			}
		else{
			ans1 += as[i];
			debug writeln(as[i], " *");
			}
		}
	debug writeln(ans1);
	
	BigInt ans2;
	for(int i = 0; i < n; i ++){
		if(i < iymin || iymin + k <= i){
			if(as[i] > 0) ans2 += as[i];
			debug writeln(as[i], as[i] > 0);
			}
		else{
			ans2 += 0;
			debug writeln(as[i], " -");
			}
		}
	debug writeln(ans2);
	
	BigInt ans = max(ans1, ans2);
	ans.writeln;
	}

Measured memory_bytes: 6504
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CLowElements solver = new CLowElements();
        solver.solve(1, in, out);
        out.close();
    }

    static class CLowElements {
        public void solve(int testNumber, Scanner sc, PrintWriter pw) {
            int n = sc.nextInt();
            int[] arr = new int[n];
            for (int i = 0; i < n; i++)
                arr[i] = sc.nextInt();
            int min = Integer.MAX_VALUE;
            int c = 0;
            for (int i = 0; i < n; i++) {
                if (arr[i] < min)
                    c++;
                min = Math.min(min, arr[i]);
            }
            pw.println(c);
        }

    }

    static class Scanner {
        StringTokenizer st;
        BufferedReader br;

        public Scanner(FileReader r) {
            br = new BufferedReader(r);
        }

        public Scanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

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

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

    }
}



Measured memory_bytes: 45908
package main

import (
	"fmt"
	"sort"
	"strconv"
)

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	sort.Ints(a)
	var ans int
	ans_list := make([][]int, n-1)
	for i := 0; i < n-1; i++ {
		alen := len(a)
		if a[alen-1] > 0 && a[0] < 0 {
			if alen == 2 {
				ans_list[i] = []int{a[1], a[0]}
				ans = -a[0] + a[1]
			} else if a[alen-2] >= 0 {
				ans_list[i] = []int{a[0], a[alen-1]}
				a[0] = a[0] - a[alen-1]
				a = a[:alen-1]
			} else if a[1] <= 0 {
				ans_list[i] = []int{a[alen-1], a[0]}
				a[alen-1] = a[alen-1] - a[0]
				a = a[1:]
			}
		} else if a[0] >= 0 {
			if alen == 2 {
				ans_list[i] = []int{a[1], a[0]}
				ans = a[1] - a[0]
			} else {
				ans_list[i] = []int{a[0], a[alen-1]}
				a[0] = a[0] - a[alen-1]
				a = a[:alen-1]
			}
		} else if a[alen-1] <= 0 {
			if len(a) == 2 {
				ans_list[i] = []int{a[1], a[0]}
				ans = a[1] - a[0]
			} else {
				ans_list[i] = []int{a[alen-1], a[0]}
				a[alen-1] = a[alen-1] - a[0]
				a = a[1:]
			}
		}
	}
	fmt.Println(ans)
	for i := 0; i < n-1; i++ {
		fmt.Println(strconv.Itoa(ans_list[i][0]) + " " + strconv.Itoa(ans_list[i][1]))
	}

}

Measured memory_bytes: 11264
A = int(input())
B = int(input())
C = int(input())
D = int(input())
ans = 0
for i in range(0,A+1):
  for j in range(0,B+1):
    for k in range(0,C+1):
      if i*500+j*100+k*50 == D:
        ans += 1
print(ans)

Measured memory_bytes: 39536
#include <cstdio>
#include <set>
#include <queue>
#include <map>
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef set<int> si;
typedef set<int>::iterator sit;
const int N=100005;
int n;
int bl[N];
si s[N];
queue<pii> q;
map<ll,int> g;
inline void swap(int &x,int &y){
    x^=y^=x^=y;
}   
int find(int u){
    return bl[u]==u?u:(bl[u]=find(bl[u]));
}
inline ll getID(int x,int y){
    if(x>y) swap(x,y);
    return 1ll*n*y+x;
}
void addEdge(int u,int v){
    s[u].insert(v);
    s[v].insert(u);
    ll eid=getID(u,v);
    int t=g[eid]+1;
    g[eid]++;
    if(t==2)
        q.push(mp(u,v));
}
void removeEdge(int u,int v){
    s[u].erase(v);
    s[v].erase(u);
    g.erase(getID(u,v));
}
void readData(){
    scanf("%d",&n);
    int u,v;
    for(int i=1;i<=(n-1)<<1;i++){
        scanf("%d%d",&u,&v);
        addEdge(u,v);
    }
}
bool solve(){
    for(int i=1;i<=n;i++) bl[i]=i;
    for(int i=1;i<n;i++){
        int u,v;
        if(q.empty())
            return false;
        u=q.front().first;
        v=q.front().second;
        q.pop();
        u=find(u); 
        v=find(v);
        if(s[u].size()>s[v].size())
            swap(u,v);
        bl[u]=v;
        removeEdge(u,v);
        for(sit i=s[u].begin(),j;i!=s[u].end();i=j){
            j=i;
            j++;
            int x=*i;
            x=find(x);
            removeEdge(u,x);
            addEdge(v,x);
        }
    }
    return true;
}
int main(){
    readData();
    puts(solve()?"YES":"NO");
    return 0;
}

Measured memory_bytes: 36608
#include<stdio.h>
int main(void){
    int a[3],s,i,j,k,x;
    scanf("%d",&s);
    for(i=0;i<s;i++){
        for(j=0;j<3;j++){
            scanf("%d",&a[j]);
            for(k=0;k<j;k++){
                if(a[j]>a[k]){
                    x=a[k];
                    a[k]=a[j];
                    a[j]=x;
                }
            }
        }
        if(a[0]*a[0]==(a[1]*a[1])+(a[2]*a[2])){
            printf("YES\n");
        }
        else printf("NO\n");
    }
    return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <utility>
#include <set>
#include <vector>
#include <functional>
#include <map>
#include <queue>
using namespace std;
int main()
{
  long long N,K;
  cin>>N>>K;
  long long ans=0;
  if (K)
  {
    for (long long b=K+1;b<=N;b++)
    {
      long long s=(N+1)/b,h=(N+1)%b;
      if (h>K) ans+=s*(b-K)+h-K;
      else ans+=s*(b-K);
    }
  }
  else ans=N*N;
  cout<<ans<<endl;
  //system("pause");
  return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>

using Graph = std::vector<std::vector<int>>;
using WGraph = std::vector<std::vector<std::pair<int, long long>>>;
using ll = long long;
using namespace std;

void inc(char &h, char &t, char &o) {
    if (o == '9') {
        o = '0';
        if (t == '9') {
            t = '0';
            if (h == '9') {
                h = '0';
            } else {
                h++;
            }
        } else {
            t++;
        }
    } else {
        o++;
    }
}

int main() {
    int n = 0;
    cin >> n;
    string s = "";
    cin >> s;
    char h = '0', t = '0', o = '0';
    int cnt = 0;
    for (int i=0; i<1000; i++) {
        int cur = 0;
        char now = h;
        for (int i=0; i<n; i++) {
            if (s.at(i) == now) {
                cur++;
                if (cur == 1) {
                    now = t;
                } else if (cur == 2) {
                    now = o;
                } else {
                    cnt++;
                    break;
                }
            }
        }
        inc(h, t, o);
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bitset>
#include<math.h>
#include<limits.h>
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<sstream>
#include<list>
#include<queue>
#include<algorithm>
#include<functional>
#include<map>
#include<set>
#include<utility>
#include<initializer_list>
#include<tuple>
#include<regex>
using namespace std;
#define ull unsigned long long
#define ll long long
#define rep(i, a, n) for(int i=(a);i<(int)(n);i++)
#define repc(i, a, n) for(int i=(a);i<=(int)(n);i++)
#define all(t) t.begin(), t.end()
#define rall(t) t.rbegin(), t.rend()
#define mat(type, row, col, init) vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout<<(cond? "Yes":"No")<<endl;
#define YES(cond) cout<<(cond? "YES":"NO")<<endl;
int main() {
	char c;
	cin >> c;
	cout << (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' ? "vowel" : "consonant");
	return 0;
}





Measured memory_bytes: 256
package main

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

func main() {
	fsc := NewFastScanner()
	S := fsc.Next()
	if S[0] == S[2] {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

//template
type FastScanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewFastScanner() *FastScanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1024)
	return &FastScanner{r: rdr}
}
func (s *FastScanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *FastScanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *FastScanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *FastScanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *FastScanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *FastScanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}

//Max,Min
func IntMax(a, b int) int {
	if a < b {
		return b
	}
	return a
}

func Int64Max(a, b int64) int64 {
	if a < b {
		return b
	}
	return a
}
func Float64Max(a, b float64) float64 {
	if a < b {
		return b
	}
	return a
}

func IntMin(a, b int) int {
	if a > b {
		return b
	}
	return a
}

func Int64Min(a, b int64) int64 {
	if a > b {
		return b
	}
	return a
}
func Float64Min(a, b float64) float64 {
	if a > b {
		return b
	}
	return a
}

//Gcd
func IntGcd(a, b int) int {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return IntGcd(b, a%b)
}
func Int64Gcd(a, b int64) int64 {
	if a < b {
		b, a = a, b
	}
	if b == 0 {
		return a
	}
	return Int64Gcd(b, a%b)
}

func IntAbs(a int) int {
	if a < 0 {
		a *= -1
	}
	return a
}

func Int64Abs(a int64) int64 {
	if a < 0 {
		a *= -1
	}
	return a
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
int main(void){
    // Your code here!
    int a,b,c;
    std::cin >> a >> b >> c;
    if(a+b+c <= 21)std::cout << "win" << std::endl;
    else {std::cout << "bust" << std::endl;}
}


Measured memory_bytes: 256
#include <stdio.h>
#define MAX 60000
int main(void){
 	int i,j;
	int a[MAX+1];
	int n;
	int bn;
	while(scanf("%d",&n) != EOF){
		  for(i = 1; i <= MAX; i++){
			  a[i] = 0;
		  }
		  for(i = 2; i <= MAX; i++){
			  if(a[i]){continue;}
			  for(j = i; j <= MAX; j += i){
				  if(j == i){a[i] = 0;}
				  else{a[j] = 1;}
			  }
		  }
		  for(i = 2; i <= n; i++){
			if(n == i){
				printf("%d ",bn);
			} 
			  if(!a[i]){
				bn = i;	 
			  }
		  }
		  for(; a[i];i++){}
		  printf("%d\n",i);
	}
 	return 0;
}

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

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int h, w;
    cin >> h >> w;
    string b[52];
    b[0] = b[h+1] = "";
    for(int i=0;i<=w+1;++i){ b[0].push_back('.'); b[h+1].push_back('.'); }
    for(int i=1;i<=h;++i){
        string s;
        cin >> s;
        b[i] = "." + s + ".";
    }

    for(int i=1;i<=h;++i){
        for(int j=1;j<=w;++j){
            if(b[i][j] == '.') continue;
            if(b[i-1][j] == '.' && b[i+1][j] == '.' && b[i][j+1] == '.' && b[i][j-1] == '.'){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

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

int main()
{
  while (true)
  {
    int ohajiki = 32;
    int length;
    cin >> length;
    if ( length == 0 ) break;
    int* num_sequence = new int[length];
    for (int i=0; i<length; i++)
    {
      cin >> num_sequence[i];
    }

    for (int i=0,j=0; ohajiki != 0; i++)
    {
      if ( i % 2 == 0 )     //  兄
      {
        ohajiki -= ( ohajiki - 1 ) % 5;
      }
      else                  //  弟
      {
        int minus_num = num_sequence[j%length];
        ohajiki -= ( ohajiki <= minus_num ? ohajiki : minus_num );
        j++;
      }
      cout << ohajiki << endl;
    }

    delete[] num_sequence;
  }
}

Measured memory_bytes: 1192
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define speedX ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
	cout<< name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
	const char* comma = strchr(names + 1, ',');cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int begtime = clock();
#define end_time() cout << "\n\nTime of execution: " << (clock() - begtime)*1000/CLOCKS_PER_SEC << " ms\n\n";
#else
#define trace(...)
#define end_time()
#endif


#define int long long 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef vector<int> vi;
typedef vector<pii> vii;
inline bool equals(ld a, ld b) {return fabs(a - b) < 1e-9;}
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define ff first
#define ss second
#define uset unordered_set
#define umap unordered_map
#define all(x) x.begin(), x.end()
#define mod 1000000007

ld calc(ld n){
	return (n*(n+1))/2;
}
void solve(){
	ld n,k;
	cin>>n>>k;
	vector<ld> v;
	v.pb(0);
	int s = 0;
	for(int i = 0; i<n; i++){
		ld a;
		cin>>a;
		s+=a;
		v.pb(s);
	}
	ld ans = 0;
	for(int i = k; i<=n; i++){
		ld e = v[i]-v[i-k];
		e = (e+k)/2;
		trace(e);
		ans = max(ans,e);
	}
	cout<<setprecision(12)<<fixed<<ans<<"\n";
}
signed main(){
	speedX;
	#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	end_time();
	return 0;
}

Measured memory_bytes: 6384
bingo = []
for i in range(3):
    bingo.append(list(map(int, input().split())))

n = int(input())
b_s = []
for i in range(n):
    b_s.append(int(input()))
ans = "No"


for i in range(n):
    for j in range(3):
        for k in range(3):
            if b_s[i] == bingo[j][k]:
                bingo[j][k] = "o"

if bingo[1][1] == "o":
    if bingo[0][0] == "o" and bingo[2][2] == "o":
        ans = "Yes"
    elif bingo[0][2] == "o" and bingo[2][0] == "o":
        ans = "Yes"
    elif bingo[1][0] == "o" and bingo[1][2] == "o":
        ans = "Yes"
    elif bingo[0][1] == "o" and bingo[2][1] == "o":
        ans = "Yes"

elif bingo[1][1] != "o":
    if bingo[0][0] == "o" and bingo[0][1] == "o" and bingo[0][2] == "o":
        ans = "Yes"
    elif bingo[0][0] == "o" and bingo[1][0] == "o" and bingo[2][0] == "o":
        ans = "Yes"
    elif bingo[0][2] == "o" and bingo[1][2] == "o" and bingo[2][2] == "o":
        ans = "Yes"
    elif bingo[2][0] == "o" and bingo[2][1] == "o" and bingo[2][2] == "o":
        ans = "Yes"

print(ans)


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

int main() {
  long K, N;
  cin >> K >> N;
  vector<long> A(N);
  for (long i = 0; i < N; i++) cin >> A.at(i);

  vector<long> V(N);
  for (long i = 0; i + 1 < N; i++) {
    V.at(i) = A.at(i + 1) - A.at(i);
  }
  V.at(N - 1) = A.at(0) + (K - A.at(N - 1));

  long X = *max_element(V.begin(), V.end());

  cout << K - X << "\n";
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
#define inf 1000000000 //1E+9
using namespace std;

int main(){
	int a,b,c;cin>>a>>b>>c;
	set<int> s;
	s.insert(a);s.insert(b);s.insert(c);
	cout<<s.size()<<endl;

	return 0;
}



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

using namespace std;


int main()
{
	int a,b,c;
	cin >> a >> b >> c;
	/*a = a/c;
	b = b/c;
	cout << b-a+(c==1);*/
	int ans = 0;
	for(int i = a; i <= b; i++) ans += i%c == 0;
	cout << ans;
}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
#define pb push_back
#define l first
#define r second
#define int long long
#define pi pair<int, int>

using namespace std;

const int maxn = 200001, mod = 998244353;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int a, b; cin >> a >> b;
    int x = 1, i;
    for (i = 0; x < b; i++)
        x += a - 1;
    cout << i;
    return 0;
}


Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define FOR(i, a, b) for(ll i = a; i < b; i++)
#define rep(i, n) FOR(i, 0, n)
#define rFOR(i, a, b) for(ll i = a - 1; i >= b; i--)
#define rrep(i, a) rFOR(i, a, 0)
#define pb push_back
using namespace std;
using ll = long long;
using ld = long double;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<char> vc;
typedef vector<vc> vvc;
const ll MOD = 1000000007;
const ll MOD2 = 998244353;
const ld PI = acos(-1);
const ll INF = 1e18;
struct edge{ll to, cost;};

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

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll H,W;
    cin >> H >> W;
    map<P,int> mp;
    ll N;
    cin >> N;
    rep(i,N){
        int a,b;
        cin >> a >> b;
        a--;b--;
        FOR(dx,-1,2){
            FOR(dy,-1,2){
                if(1<=a+dx&&a+dx<H-1&&1<=b+dy&&b+dy<W-1) mp[{a+dx,b+dy}]++;
            }
        }
    }
    vl cnt(10,0);
    ll res=0;
    for(auto key:mp){
        cnt[key.second]++;
    }
    rep(i,9){
        res+=cnt[i+1];
    }
    cnt[0]=(H-2)*(W-2)-res;
    rep(i,10){
        cout << cnt[i] << '\n';
    }
}
/*
overflow checked?
corner case checked?
boundary checked?
not TLE in worst case checked?
*/

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

#define int long long

int mod = 1e9 + 7 ;

int giveans(int** dp , int* s1 , int* s2 , int& n , int& m , int i , int j){
    if(i == n || j == m) return 1 ;
    if(dp[i][j] != -1) return dp[i][j] ;
    if(s1[i] == s2[j]){
        dp[i][j] =  (giveans(dp,s1,s2,n,m,i+1,j) + giveans(dp,s1,s2,n,m,i,j+1))%mod ;
    }else{
        dp[i][j] =  ((giveans(dp,s1,s2,n,m,i+1,j) + giveans(dp,s1,s2,n,m,i,j+1))%mod
        			 - giveans(dp,s1,s2,n,m,i+1,j+1) + mod )%mod ;
    }
    return dp[i][j] ;
}

int lcs(int* s1, int* s2 , int n , int m){
    int** dp = new int*[n] ;
    for(int i = 0 ; i < n ; i++){
        dp[i] = new int[m] ;
        for(int j = 0 ; j < m ; j++) dp[i][j] = -1 ;
    }
    giveans(dp,s1,s2,n,m,0,0) ;
	return dp[0][0] ;
}


int32_t main() {
    ios :: sync_with_stdio(0) ;
 	cin.tie(0) ;
	int n , m ;
	cin >> n >> m ;
	int a[n] , b[m] ;
	for(int i = 0 ; i < n ; i++) cin >> a[i] ;
	for(int i = 0 ; i < m ; i++) cin >> b[i] ;
	cout << lcs(a,b,n,m) ;
	return 0;
}

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

#ifdef ENABLE_DEBUG
template <typename T>
void debug(T value) {
  cerr << value;
}
template <typename T, typename... Ts>
void debug(T value, Ts... args) {
  cerr << value << ", ";
  debug(args...);
}
#define DEBUG(...)                              \
  do {                                          \
    cerr << " \033[33m (L" << __LINE__ << ") "; \
    cerr << #__VA_ARGS__ << ":\033[0m ";        \
    debug(__VA_ARGS__);                         \
    cerr << endl;                               \
  } while (0)
#else
#define debug(...)
#define DEBUG(...)
#endif

const i64 MOD = 1'000'000'007;

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

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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  string K;
  int D;
  cin >> K >> D;

  vector<vector<mint>> dp(2, vector<mint>(D, 0));
  dp[0][0] = 1;
  for (int i = 1; i <= int(K.size()); ++i) {
    vector<vector<mint>> t(2, vector<mint>(D));
    swap(t, dp);
    int digit = K[i - 1] - '0';
    REP(dsum, D) {
      REP(d, 10) { dp[1][(dsum + d) % D] += t[1][dsum]; }
      for (int d = 0; d < digit; ++d) {
        dp[1][(dsum + d) % D] += t[0][dsum];
      }
      {
        int d = digit;
        dp[0][(dsum + d) % D] += t[0][dsum];
      }
    }
  }
  mint ans = dp[0][0] + dp[1][0] - 1;
  cout << ans << endl;
}


Measured memory_bytes: 3692
'''
Created on 2020/09/14

@author: harurun
'''
def main():
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  a,b,c,d=map(int,pin().split())
  print(max(a*c,a*d,b*c,b*d))
  return
main()

Measured memory_bytes: 9084
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(void){
    long long d,n;cin>>d>>n;
    if(d==0){
        if(n%100==0){
            cout<<n+(n/100)<<endl;
        }else cout<<n<<endl;
    }
    else if(d==1){
        if(n*100%10000==0)cout<<(n+(n*100)/10000)*100<<endl;
        else cout<<100*n<<endl;
    }
    else{
        if(n*10000%1000000==0)cout<<(n+(n*10000)/1000000)*10000<<endl;
        else cout<<10000*n<<endl;
    }
    
    return 0;
}


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

int main()
{
	int S, h, m, s;
	cin >> S;

	h = S / 3600, S -= h * 3600;
	m = S / 60, s = S % 60;

	cout << h << ":" << m << ":" << s << endl;

	return 0;
}


Measured memory_bytes: 3076
#include <bits/stdc++.h>
#include <atcoder/mincostflow>
using namespace std;
using namespace atcoder;
typedef pair<int, int> pii;
typedef long long ll;
string S[55];
bool vis[55][55];
const int dr[] = {0, 1};
const int dc[] = {1, 0};
int main()
{
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> vp;
    for (int i = 0; i < n; ++i) {
        cin >> S[i];
        for (int j = 0; j < m; ++j)
            if (S[i][j] == 'o') {
                vp.emplace_back(i, j);
                S[i][j] = '.';
            }
    }
    mcf_graph<int, int> g(n * m + vp.size() + 2);
    int s = n * m + vp.size(), t = s + 1;
    for (int i = 0; i < vp.size(); ++i) {
        int vi = n * m + i;
        g.add_edge(s, vi, 1, 0);
        memset(vis, 0, sizeof vis);
        queue<pii> q;
        q.push(vp[i]);
        vis[vp[i].first][vp[i].second] = 1;
        while (q.size()) {
            pii p = q.front();
            q.pop();
            g.add_edge(vi, p.first * m + p.second, 1, n + m - (p.first + p.second - vp[i].first - vp[i].second));
            for (int k = 0; k < 2; ++k) {
                pii np = pii(p.first + dr[k], p.second + dc[k]);
                if (np.first < n && np.second < m && !vis[np.first][np.second] && S[np.first][np.second] == '.') {
                    vis[np.first][np.second] = 1;
                    q.push(np);
                }
            }
        }
    }
    for (int i = 0; i < n; ++i)
        for (int j = 0; j < m; ++j)
            if (S[i][j] == '.')
                g.add_edge(i * m + j, t, 1, 0);
    auto ans = g.flow(s, t);
    assert(ans.first == vp.size());
    cout << vp.size() * (n + m) - ans.second << '\n';
}


Measured memory_bytes: 7292
n,A,B = map(int, input().split())
s = input()

for i in s:
    if (i == "a" and A + B > 0):
        print("Yes")
        A -= 1
    elif (i == "b" and A + B > 0 and B > 0):
        print("Yes")
        B -= 1
    else:
        print("No")


Measured memory_bytes: 4144
#include <stdio.h>
int main()
{
	long long int n,i,num,min;
	
	scanf("%lld",&n);
	
	long long int a[n];
	
	for(i = 0;i < n;i++)
	scanf("%lld",&a[i]);
	
	min = a[0];
	
	num = 0;
	
	for(i = 0;i < n;i++)
	{
		if(a[i] <= min)
		{
			min = a[i];
			num++;
		}
	}
	
	printf("%lld\n",num);
	
	return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n,m) for(int i=(n);i<(int)(m);i++)
#define reps(i,n,m) for(int i=(n);i<=(int)(m);i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define printfdouble(x) printf("%.12f\n",(x))
#define chartoint(c) (int)((c) - '0')
#define chartoll(c) (long long)((c) - '0')
#define MOD 1000000007
#define itn int
#define enld endl
#define ednl endl
#define icn cin
#define Endl endl
#define stirng string
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
using Graph = vector<vector<int>>;
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 A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// USB未同期

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define mod 1000000007
typedef long long ll;
using namespace std;

class UnionFind {
public:
    vector <ll> par;
    vector <ll> siz;


    UnionFind(ll N): par(N), siz(N, 1LL) {
        for (ll i = 0; i < N; ++i) par[i] = i;
    }

    void init(ll N) {
        par.resize(N);
        siz.assign(N, 1LL);
        for (ll i = 0; i < N; ++i) par[i] = i;
    }


    ll root(ll x) {
        while (par[x] != x) {
            x = par[x] = par[par[x]];
        }
        return x;
    }


    bool unite(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool same(ll x, ll y) {
        return root(x) == root(y);
    }

    ll size(ll x) {
        return siz[root(x)];
    }
};

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll N,M; cin >> N >> M;
    UnionFind tree(N);
    rep(i,0,M){
        int a,b; cin >> a >> b;
        a--; b--;
        tree.unite(a,b);
    }

    ll ans = 0;
    rep(i,0,N) chmax(ans, tree.size(i));

    cout << ans << ednl;
}


Measured memory_bytes: 6360