akhauriyash/Code-Regression huggingface dataset:
#!usr/bin/env python3

import sys


def main():
    text = str()
    alphabets = 'abcdefghijklmnopqrstuvwxyz'

    for line in sys.stdin:
        text += line.lower()

    for alphabet in alphabets:
        print('%s : %d' % (alphabet, text.count(alphabet)))


if __name__ == '__main__':
    main()

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


int main(){
  int a,b,c;
  cin >> a >> b >> c;
  if(max(max(a,b),c)==a){
    cout << b*c/2 << endl;
  }
  if(max(max(a,b),c)==b){
    cout << a*c/2 << endl;
  }
  if(max(max(a,b),c)==c){
    cout << b*a/2 << endl;
  }
}


Measured memory_bytes: 256
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>
#include<bits/stdc++.h>
using namespace std;

const int N=1e5+1 ; 
long long Dp[N],n,k;
int height[N];
long long calc(int idx){
        if (idx==n-1)return 0 ;
       
      
        if( Dp[idx]!=-1)return Dp[idx]  ; 
      long long take = 1e9 ; 
         for(int i =1;i<=k;i++){
                
              
              if(i+idx<n)take=min(take,abs(height[idx]-height[idx+i])+calc(idx+i)); 
              
         }return Dp[idx]=take;
}
int main()
{
    cin>>n>>k ; 
    for(int i =0;i<n;i++)cin>>height[i]; 
   // cout<<1; 
    memset(Dp,-1,sizeof Dp);
    cout<<calc(0); 
    
}


Measured memory_bytes: 12492
open System

let N =stdin.ReadLine()|>int
let H =stdin.ReadLine().Split()|>Array.map int
[<EntryPoint>]
let sf argv = 
    let rec fn i cur ans =
        if i = N - 1 then max ans cur elif H.[i+1]<=H.[i] then fn (i + 1) (cur + 1) ans else fn (i+1) 0 (max ans cur)
    printf "%d" (fn 0 0 0)
    0 



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

using namespace std;

int n,arr[100005],dp[100005];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=0;i<n;i++)cin>>arr[i];
    dp[1]=abs(arr[0]-arr[1]);
    for(int i=2;i<n;i++){
        dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
    }
    cout<<dp[n-1];
}

Measured memory_bytes: 1024
gets
arr = gets.split.map(&:to_i)
min = Float::INFINITY
dif = 0
cnt = 0
arr.each do |i|
  min = i if i < min
  if dif == i - min
    cnt += 1
  elsif dif < i - min
    dif = i - min
    cnt = 1
  end
end
puts cnt


Measured memory_bytes: 8452
#include <bits/stdc++.h>
#define ll long long
#define SZ(vvv) ((int)vvv.size())
#define fastIO cout << fixed << setprecision(12), ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr)
using namespace std;

const int N = 5e5 + 5, M = 5e4 + 9, INF = 1e9, MOD = 1e9 + 7;

void runtestcase() {
	int n;
	cin >> n;
	ll ans = 0;
	for (int i = 1; i < n; ++i) {
		int rem = n - i;
		for (int j = 1; 1ll * j * j <= rem; ++j) {
			if(rem % j == 0) {
				int k = rem / j;
				++ans;
				if(k != j) ++ans;
			}
		}
	}
	cout << ans;
}


int main() {
    fastIO;
#ifdef LOCAL
    freopen("input.in", "rt", stdin);
//    freopen("cache.out", "wt", stdout);
#endif
  int t = 1, tt = 1;
//	cin >> t;
  while(t) {
//		cout << "Case #" << tt << ':' << ' ';
    runtestcase();
    if(t)
    	cout << '\n';
    --t, ++tt;
  }
}


Measured memory_bytes: 3648
//競技プログラミング　テンプレ
//
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int main() {
  int n,a,b,c,d,i=0;
  vector <int> bou(10);
  
  string op("+++++-+-----+-+-+--++--+");
  string a1,a2,a3;
	cin >> n;
  a=n/1000;
  b=n/100-a*10;
  c=n/10-(n/100)*10;
  d=n-(n/10)*10;
  
  bou[0]=a+b+c+d;
  bou[1]=a+b+c-d;
  bou[2]=a+b-c-d;
  bou[3]=a-b-c-d;
  bou[4]=a+b-c+d;
  bou[5]=a-b+c-d;
  bou[6]=a-b+c+d;
  bou[7]=a-b-c+d;
  
  //op = +++++-+-----+-+++--++--+;
  
    for (i=0; i<=7; i++){
      if(bou[i]==7) {break;}
  }
  
  //if(i==8) i--;
  a1=op.at(i*3);
  a2=op.at(i*3+1);
  a3=op.at(i*3+2);
  cout << a << a1 << b << a2 << c << a3<< d <<"="<< 7<<endl; 
   
	return 0;
}


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

namespace contest_Csharp
{
    class Program
    {
        static void Main(string[] args)
        {

            var vals = Console.ReadLine().Split(' ')
                .Select(x => int.Parse(x)).ToList();
            var N = vals[0];
            var A = new List<string>();
            var D = new Dictionary<string, int>();
            for (int i = 0; i < N; i++)
            {
                A.Add(Console.ReadLine());
                D[A[i]] = 1;
            }
            Console.WriteLine(D.Count());
            


        }
       
       

    }
}


Measured memory_bytes: 42232
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
#include <cctype>

using namespace std;

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

string X, Y;

void solve(int x_size, int y_size)
{
	vector< vector<int> > dp(x_size + 1, vector<int>(y_size + 1));

	for(int i = 0; i < x_size; ++i) {
		for(int j = 0; j < y_size; ++j) {
			if(X[i] == Y[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]);
			}
		}
	}

	cout << dp[X.size()][Y.size()] << endl;
}

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

	int n;
	cin >> n;
	REP(i, n) {
		cin >> X >> Y;
		solve(X.size(), Y.size());
	}
	return 0;
}

Measured memory_bytes: 5044
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string s;
  cin >> s;

  if ((s[0] == s[1] && s[1] == s[2]) || (s[1] == s[2] && s[2] == s[3]) ) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}

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

int main() {
  string a;
  int b = 0;
  cin >> a;
  if (a[0] == '1') b++;
  if (a[1] == '1') b++;
  if (a[2] == '1') b++;
  cout << b << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define M 1000
char X[M+1],Y[M+1];
int Z[M+1][M+1];
int max_value(int a,int b){
  if(a>=b) return a;
  else return b;
}
int longest(char x[M+1],char y[M+1]){
  int i,j,lenx=0,leny=0;
  lenx=strlen(x);
  leny=strlen(y);
  for(i=1;i<=lenx;i++){
    for(j=1;j<=leny;j++){
      if(x[i-1]==y[j-1]) Z[i][j]=Z[i-1][j-1]+1;
      else if(x[i-1]!=y[j-1]) Z[i][j]=max_value(Z[i-1][j],Z[i][j-1]);
    }
  }
  return Z[lenx][leny];
}
int main(){
  int i,n;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s",X);
    scanf("%s",Y);
    printf("%d\n",longest(X,Y));
  }
  return 0;
}

Measured memory_bytes: 4524
#include <cctype>
#include <cfloat>
#include <climits>
#include <cmath>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <ios>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <forward_list>
#include <random>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

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

using namespace std;

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

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

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

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

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

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

    LL x, y;
    cin >> x >> y;
    if( llabs( x - y ) <= 1 ) cout << "Brown";
    else cout << "Alice";
    cout << endl;

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F(a,b,c,d) for (register int a=b;a<=c;a+=d)
#define FD(a,b,c,d) for (register int a=b;a>=c;a-=d)
using namespace std;
int main(){
	int n,la=0,ans=0;
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		int k;
		cin>>k;
		if (k==la)
		{
			ans++;
			la=0;
		}
		else la=k;
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  
  int n,b;
  int a[10],i;
  while(cin >> n){
    fill_n(a,10,1024);
    b = 512;
    i=0;
    
    while(n != 0){
      if(n >= b){
	a[i] = b;
	i++;
	n -= b;
      }
      if(b == 1) b--;
      else b /= 2;
    }
    sort(a,a+10);
    for(int j = 0;j < i;j++){
      if(j == i-1) cout << a[j] << endl;
      else cout << a[j] << ' ';
    }
  }

  return (0);
}

Measured memory_bytes: 3000
#include <bits/stdc++.h>
#define N 100005
#define ll long long
using namespace std;
ifstream in("in.txt");
int v[10][10];
int main(){
    int n,a=1,b=0,c=1;
    cin>>n;
    while(a!=n+1){
        if(a>b*10+9){
            b=b*10+9;
            c*=10;
        }
        v[a/c][a%10]++;
        a++;
    }
    c=0;
    for(int i=1; i<10; ++i){
        for(int j=1; j<10; ++j){
            c+=v[i][j]*v[j][i];
        }
    }
    cout<<c;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;
 
#define endl '\n'
#define loop(i, m, n) for (lli i = m; i < n; i++)
#define loope(i, m, n) for (lli i = m; i <= n; i++)
#define epool(i, m, n) for (lli i = m; i >= n; i--)
#define pool(i,m,n) for(lli i=m; i>n; i++)
#define maxe *max_element
#define mine *min_element
#define plli pair<lli, lli>
#define mod 1000000007
#define mod2 998244353
#define vt vector<lli>
#define fi first
#define se second
#define pb push_back
#define umap unordered_map
#define mmap multimap
#define mp make_pair
#define inp1(a) cin >> a
#define inp2(a, b) cin >> a >> b
#define inp3(a, b, c) cin >> a >> b >> c
#define inp4(a, b, c, d) cin >> a >> b >> c >> d
#define inp5(a, b, c, d, e) cin >> a >> b >> c >> d >> e
#define inp6(a, b, c, d, e, f) cin >> a >> b >> c >> d >> e >> f
#define pr0() cout << " "
#define pr1(a) cout << a << " "
#define pr2(a, b) cout << a << " " << b << " "
#define pr3(a, b, c) cout << a << " " << b << " " << c << " "
#define pr4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << " "
#define emp emplace //used to push a pair etc..
#define empf emplace_front
#define empb emplace_back
#define ret(x) return cout << x, 0;
#define all(v) v.begin(),v.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
//especially for deque both sides dynamic
#define pf push_front
//list doubly linked lists can insert at mid. splice fn can be used
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
using namespace std;
 
lli gcd(lli a, lli b){
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
 
lli lcm(lli a, lli b){
    return (a * b) / gcd(a, b);
}
 
lli modi(lli n,lli m=mod){ 
    if(n==0) return 0;
    n%=m;
    n+=m;
    n%=m;
    return n;
}
 
lli mpow(lli base, lli exp){
    base %= mod;
    lli result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((lli)result * base) % mod;
        base = ((lli)base * base) % mod;
        exp >>= 1;
    }
    return result;
}
const lli INF=1e18;
const lli N=2e5+5;
lli a[N]={0},b[N]={0};

int32_t main(){
    fast_io
    lli i = 0,j=0;
//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
    
    lli k,n;
    cin >> k >> n;
    lli arr[n];
    loop(i,0,n) cin >> arr[i];

    lli cur=0;
    loop(i,1,n){
        cur+=(arr[i]-arr[i-1]);
    }
    lli ans=INF;
    cur+=(k-arr[n-1]+arr[0]);
    loop(i,0,n){
        ans=min(ans,cur-(arr[i]-arr[i-1]));
    }

    ans=min(ans,cur-(k-arr[n-1]+arr[0]));
    cout << ans << endl;

}

Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <iostream>
#include <cmath>

#define MAX_STUDENTS 100
using namespace std;
int main(void){
    int n;
    int i;
    int tmp;
    int sum, sq_sum;
    double mean, sq_mean;
    double std_dev;
    
    while(true){
        cin >> n;
        if(!n) break;
        sum = 0;
        sq_sum = 0;
        for(i = 0; i < n; i++){
            cin >> tmp;
            sum += tmp;
            sq_sum += tmp*tmp;
        }
        mean = static_cast<double>(sum) / n;
        sq_mean = static_cast<double>(sq_sum) / n;
        
        std_dev = sqrt(sq_mean - mean*mean);
        cout << fixed << std_dev << endl;
    }
    return 0;
}

Measured memory_bytes: 3208
#include<iostream>
#include<algorithm>
#include<cmath>
//#include<string>
//#include<set>
//#include<vector>
//#include<iomanip>
using namespace std;
int main(){

    int n;
    cin>>n;
    int arr[n],x;
    for(int i=1;i<=n;i++){
        cin>>x;
        arr[x-1]=i;
    }
    cout<<arr[0];
    for(int i=1;i<n;i++){
        cout<<" "<<arr[i];
    }
    return 0;
}


Measured memory_bytes: 3960
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
using ll = long long;
const int INF = 100000000;

int main(){
    int H,W;cin>>H>>W;
    int Ch, Cw;cin>>Ch>>Cw;Ch--;Cw--;
    int Dh, Dw;cin>>Dh>>Dw;Dh--;Dw--;
    vector<vector<int>> grid(H, vector<int>(W,0));
    vector<vector<int>> dist(H, vector<int>(W,INF));
    const int WALL = 0;
    const int ROAD = 1;
    for(int i = 0;i < H;i++){
        string s;cin>>s;
        for(int j = 0;j < W;j++){
            if(s[j] == '.'){
                grid[i][j] = ROAD;
            }else{
                grid[i][j] = WALL;
            }
        }
    }

    priority_queue<pair<int,pair<int,int>>, vector<pair<int,pair<int,int>>>, greater<pair<int,pair<int,int>>>> que;
    que.push(pair{0, pair{Ch, Cw}});
    dist[Ch][Cw] = 0;
    // cout<<"AA"<<endl;
    while(que.size() > 0){
        pair<int, pair<int,int>> p = que.top();que.pop();
        int dis = p.first;
        pair<int,int> poi = p.second;
        if(dist[poi.first][poi.second] < dis){
            continue;
        }
        for(int i = -2;i < 3;i++){
            for(int j = -2;j < 3;j++){
                if(poi.first + i >= H || poi.first + i < 0 || poi.second + j >= W || poi.second + j < 0)continue;
                int cost = 1;
                if(abs(i) + abs(j) <= 1)cost = 0;
                if(grid[poi.first + i][poi.second + j] == ROAD && dist[poi.first + i][poi.second + j] > dis + cost){
                    dist[poi.first + i][poi.second + j] = dis + cost;
                    que.push(pair{dist[poi.first + i][poi.second + j], pair{poi.first+i, poi.second + j}});
                }
            }
        }
    }
    cout<<(dist[Dh][Dw] == INF ? -1 : dist[Dh][Dw])<<endl;

}


Measured memory_bytes: 11592
import scala.io.StdIn._
import scala.math._
 
object Main extends App{
  val sc = new java.util.Scanner(System.in)
  val a = sc.nextInt
  val b = sc.nextInt
  val c = sc.nextInt
    if(a==b){
    println(c)
  }
  else if(a==c){
    println(b)
  }
  else{
    println(a)
  }
}

Measured memory_bytes: 25560
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cstdlib>
#include<cmath>
#include<numeric>
#include<iomanip>
#include<functional>
#include<cstdlib>
#include<queue>
#include<deque>
const double PI = acos(-1);
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
using ll =long long;
const int mod = 1000000007;
class mint {
	long long x;
public:
	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 {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint & a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint & a) const {
		mint res(*this);
		return res *= a;
	}
	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime mod
	mint inv() const {
		return pow(mod - 2);
	}
	mint& operator/=(const mint & a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint & a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream & os, const mint & m) {
		os << m.x;
		return os;
	}
};
int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

ll gcd(ll a, ll b) {
	if (a % b == 0) {
		return b;
	}
	else {
		return gcd(b, a % b);
	}
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
};
//fixed << setprecision(2)

int main() {

	int d;
	int g;
	cin >> d >> g;
		vector<int>p(d), c(d);
	rep(i, d) {
		cin >> p[i] >> c[i];
	}
	int ans;
	ll tmpsum;
	ll sum=0;
	ll tmp=0;
	ll min=1000000;
	int n = d;
	for (int bit = 0; bit < (1 << n); ++bit) {
		vector<int> S;
		for (int i = 0; i < n; ++i) {
			if (bit & (1 << i)) { // 列挙に i が含まれるか
				S.push_back(i);
			}
		}
		vector<int>a(d, 0);
		sum = 0;
		tmp = 0;
		for (int i = 0; i < (int)S.size(); ++i) {
			a[S[i]] = 1;
			sum += p[S[i]] * (S[i]+1) * 100 + c[S[i]];
			tmp += p[S[i]];
		}
		if (sum >= g) {
			if (min > tmp) {
				min = tmp;
			}
		}
		else {
			for (int i = 0; i < d; i++) {
			tmpsum = sum;
				int tmp2 = tmp;
				if (a[i] == 0) {
					if (tmpsum + p[i] * (i+1) * 100 + c[i] >= g) {
						int j = 0;
						while (tmpsum < g && j < p[i]) {
							tmpsum += 100*(i+1);
							j++;
							tmp2++;
						}
						if (tmp2 < min) {
							min = tmp2;
						}
					}
				}
			}
		}
		
	}
	cout << min;
}
	



Measured memory_bytes: 3608
import java.util.Scanner;

public class Main {

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

		if (A >= 1 && A <= 9 && B >= 1 && B <= 9) {
			System.out.println(A * B);
		} else {
			System.out.println(-1);
		}
		sc.close();
	}

}


Measured memory_bytes: 22996
A,B,C,X,Y=map(int,input().split())
if X>=Y:
    if 2*C>=A+B:
        print(A*X+B*Y)
    else:
        if 2*C>=A:
            print(2*C*Y+A*(X-Y))
        else:
            print(2*C*Y+2*C*(X-Y))
else:
    if 2*C>=A+B:
        print(A*X+B*Y)
    else:
        if 2*C>=B:
            print(2*C*X+B*(Y-X))
        else:
            print(2*C*X+2*C*(Y-X))


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

int main(){
  string str;
  int q;
  cin >> str;
  cin >> q;
  while(q--){
    string s;
    cin >> s;
    if(s == "print"){
      int a, b;
      cin >> a >> b;
      cout << str.substr( a, b - a + 1) << endl;
    } else if(s == "reverse"){
      int a, b;
      cin >> a >> b;
      reverse( str.begin() + a, str.begin() + b + 1);
    } else {
      int a, b;
      string p;
      cin >> a >> b >> p;
      str.replace( a, b - a + 1, p);
    }
  }
}



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

using namespace std;

int main() {

    int A, B;
    cin >> A >> B;

    if (A >= 13)
        cout << B << '\n';
    else if (A >= 6 and A <= 12)
        cout << B/2 << '\n';
    else
        cout << 0 << '\n';
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int, input().split()))
d = []
for i in range(n - 1):
  d.append(abs(a[i + 1] - a[i]))
s = sum(d)
print(s - d[0] + abs(a[1]) + abs(a[-1]))
for i in range(n - 2):
  print(s - d[i] - d[i + 1] + abs(a[i + 2] - a[i]) + abs(a[0]) + abs(a[-1]))
print(s - d[-1] + abs(a[0]) + abs(a[-2]))


Measured memory_bytes: 14044
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#define repd(i,a,b) for (int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p) {
    if(p) cout << fixed << setprecision(p)  << a << "\n";
    else cout << a << "\n";
}
// end of template
struct query{
    int q, l, r;
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    // source code
    int N, a, d, M, K;
    cin >> N >> a >> d >> M;
    vector<query> Q(M);
    rep(i, M){
        int x, y, z;
        cin >> x >> y >> z;
        Q[i] = query{x, y, z};
    }
    cin >> K;
    for(int i = M - 1; i >= 0; i--){
        if (Q[i].q == 0 && Q[i].l <= K && Q[i].r >= K) {
            K = Q[i].l + Q[i].r - K;
        }
    }
    int ret = a + (K - 1) * d;
    
    rep(i, M){
        if (!(Q[i].l <= K && Q[i].r >= K)) continue;
        if (Q[i].q == 0) {
            K = Q[i].l + Q[i].r - K;
        }
        if (Q[i].q == 1) {
            ret++;
        }
        if (Q[i].q == 2) {
            ret /= 2;
        }
    }
    
    output(ret, 0);
    return 0;
}

Measured memory_bytes: 4872
#include<stdio.h>
int main(){
  int n;
  int s[100];
  int size;
  int i;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&s[i]);
    size++;
  }
  for(i=n-1;i>=0;--i){
    printf("%d",s[i]);
    if(i != 0) printf(" ");
  }
  printf("\n");
  return 0;
}



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

    divisors.sort()
    return divisors
                
N,M = map(int, input().split())
ans = 1
DIV = make_divisors(M)
#print(DIV)

for i in DIV:
    if M - i*N >= 0:
        ans = i
print(ans)

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

void change(int *array, int i){
	int tmp = array[i];
	array[i] = array[i - 1];
	array[i - 1] = tmp;
}

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


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
	    int N = sc.nextInt();
	    
	    if (N==3 || N==5 || N==7)
	    	System.out.println("YES");
	    else
	    	System.out.println("NO");
	    sc.close();

	}

}

Measured memory_bytes: 21844
import sys
import math
input = sys.stdin.readline
sys.setrecursionlimit(2 * 10**6)


def inpl():
    return list(map(int, input().split()))


def main():
    A, B, H, M = inpl()
    deg = abs(30 * H - 5.5 * M)

    ans = A**2 + B**2 - 2 * A * B * math.cos(math.radians(deg))

    print('{:.10f}'.format(ans**0.5))

    return


if __name__ == '__main__':
    main()


Measured memory_bytes: 9508
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
	int n;
	cin >> n;
	int activities[n][3];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> activities[i][j];
		}
	}

	int escolhaA = 0, escolhaB = 0, escolhaC = 0;
	for (int i = 0; i < n; i++) {
		int auxA = escolhaA, auxB = escolhaB, auxC = escolhaC;
		escolhaA = max(auxB,auxC) + activities[i][0];
		escolhaB = max(auxA,auxC) + activities[i][1];
		escolhaC = max(auxA,auxB) + activities[i][2];
	}

	cout << max(escolhaA,max(escolhaB,escolhaC)) << endl;
}

Measured memory_bytes: 1408
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include <functional>
#include<time.h>
#include <stack>
#include<iomanip>
using namespace std;
#define rep(i,a,n) for(int i=(a);i<(n);i++)
#define ll long long
#define llint long long int
#define reverse(v)  reverse(v.begin(), v.end());
#define Yes(ans) if(ans)cout<<"Yes"<<endl; else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl; else cout<<"NO"<<endl;
#define hei(a) vector<a>
#define whei(a) vector<vector<a>>
#define UF  UnionFind 
#define Pint pair<int,int>
#define keta(a)  fixed << setprecision(a)
constexpr auto INF = 100000000000;
constexpr auto mod = 1000000007;
//辞書順はnext_permutation( begin( v ), end( v ) );やで！
struct edge { int to, cost; };



int main() {
	ll a, b, n;
	cin >> a >> b >> n;
	if (b > n) {
		ll ans = a * n / b;
		cout << ans << endl;
	}
	else {
		ll ans = a * (b - 1) / b;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3624
#include <iostream>

using namespace std;

int main(){

	int book , sum;

	while(1){
		cin >> sum;
		if(sum == 0) break;

	for(int i = 0; i < 9; i++){
		cin >> book;
		sum -= book;
	}
	cout << sum << endl;
	}

	return 0;
}

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back

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

  cout << min(a, b) + min(c, d) << endl;

  return 0;
}


Measured memory_bytes: 256
// problem: "https://atcoder.jp/contests/abc148/tasks/abc148_a"

#include<bits/stdc++.h>

using namespace std;

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

    if(a == 1 && b == 2 || a == 2 && b == 1)
        cout<<3;

    if(a == 3 && b == 2 || a == 2 && b == 3)
        cout<<1;

    if(a == 1 && b == 3 || a == 3 && b == 1)
        cout<<2;

    return 0;
}


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

int main(){
  int n,r;
  cin >> n >> r;
  if(n < 10){
    r += 100*(10-n);
  }
  cout << r << endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;
ll a[100006], b[100006];
int main(){
	ll i, j;
	ll n, h;
	ll res=0;
	
	scanf("%lld %lld", &n, &h);
	for(i=1; i<=n; i++)
		scanf("%lld %lld", &a[i], &b[i]);
	
	sort(a+1, a+1+n);
	sort(b+1, b+1+n);
	for(i=n; b[i]>a[n] and h>0; i--){
		h-=b[i];
		res++;
	}
	if(h>0)
		printf("%lld", res+h/a[n]+!!(h%a[n]));
	else
		printf("%lld", res);
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
#define MAX_N 9

int g[MAX_N][MAX_N];

bool used[MAX_N]; int perm[MAX_N];
// {0,1,2,3,4, ... , n - 1}の並び替えn!通りを生成する
void permutation1(int pos, int n) {
	if (pos == n) {
		return ;
	}
	// permのpos番目を0~n-1のどれにするかのループ
	for (int i = 0; i < n; i++) {
		if (!used[i]) {
			perm[pos] = i;
			// iを使ったのでフラグをtrueにしておく
			used[i] = true;
			permutation1(pos + 1, n);
			// 戻ってきたらフラグを戻しておく
			used[i] = false;
		}
	}
	return ;
}

int perm2[MAX_N];
int res = 0;
void permutation2(int n) {
	for (int i = 0; i < n; i++) {
		perm2[i] = i;
	}
	do {
		bool flg = true;
		if (perm2[0] != 0) flg = false;
		for (int i = 0; i < n-1; i++) {
			if (g[perm2[i]][perm2[i+1]] == 0) flg = false;
		}
		if (flg) res++;
	} while (next_permutation(perm2, perm2 + n));
	return ;
}

int main(){
	long long N;
	long long M;
	scanf("%lld",&N);
	scanf("%lld",&M);
	vector<long long> b(M-1+1);
	vector<long long> a(M-1+1);
	for(int i = 0 ; i <= M-1 ; i++){
		scanf("%lld",&a[i]);
		scanf("%lld",&b[i]);
		g[a[i]-1][b[i]-1] = 1;
		g[b[i]-1][a[i]-1] = 1;
	}
	permutation2(N);
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws IOException {
//		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
//		String W	 = in.readLine();
//		int num = Integer.parseInt(W.split(" ")[0]);

		Scanner sc = new Scanner(System.in);
		int S = sc.nextInt();
		int W = sc.nextInt();

		if(S <=W) {
			System.out.println("unsafe");
		}else {
			System.out.println("safe");
		}


	}

	//	//二分探索
	//k <= num となる最小の配列要素kのインデックスを返す
	static private int binarySearch(long num, long[] orderedArray){
		int lowerBorder = -1;
		int upperBorder = orderedArray.length;
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedArray[mid]<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//二分探索
	//k <= num となる最小のList要素kのインデックスを返す
	static private int binarySearch(long num, ArrayList<Long> orderedList){
		int lowerBorder = -1;
		int upperBorder = orderedList.size();
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedList.get(mid)<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//aとbの最小公倍数を求める
	public static int gcd(int a, int b) {
        return b == 0 ? a: gcd(b, a % b);
	}

}


Measured memory_bytes: 35736
#include <bits/stdc++.h>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'
#define debugArray(x, n)                                      \
  cerr << __LINE__ << ": " << #x << " = {";                   \
  for (long long hoge = 0; (hoge) < (long long)(n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];                   \
  cerr << "}" << '\n'
#define debugMatrix(x, h, w)                                         \
  cerr << __LINE__ << ": " << #x << " =\n";                          \
  for (long long hoge = 0; (hoge) < (long long)(h); ++(hoge)) {      \
    cerr << ((hoge ? " {" : "{{"));                                  \
    for (long long fuga = 0; (fuga) < (long long)(w); ++(fuga))      \
      cerr << ((fuga ? ", " : "")) << x[hoge][fuga];                 \
    cerr << "}" << (hoge + 1 == (long long)(h) ? "}" : ",") << '\n'; \
  }
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#define debugMatrix(x, h, w) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  int N;
  cin >> N;
  int A[N];
  for (int i = 0; i < N; i++) cin >> A[i];
  bool inc = true;
  for (int i = 0; i + 1 < N; i++) inc &= A[i] < A[i + 1];
  if (inc) {
    cout << 1 << '\n';
  } else {
    int ok = N, ng = 1;
    while (abs(ok - ng) > 1) {
      int K = (ok + ng) / 2;
      stack<pair<int, int>> S;
      auto check = [&]() {
        for (int i = 1; i < N; i++) {
          if (A[i - 1] >= A[i]) {
            while (!S.empty() && S.top().first > A[i]) S.pop();
            if (S.empty() || S.top().first < A[i]) S.push({A[i], 0});
            int back = A[i];
            while (back > 0 && S.top().second == K - 1) {
              S.pop();
              back--;
              if (back == 0) return false;
              if (S.empty() || S.top().first < back) S.push({back, 0});
            }
            auto p = S.top();
            S.pop();
            S.push({p.first, p.second + 1});
          }
        }
        return true;
      };
      if (check()) {
        ok = K;
      } else {
        ng = K;
      }
    }
    cout << ok << '\n';
  }
  return 0;
}


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

bool f() {
  string s; cin >> s;
  string a = "keyence";
  int l = s.size();
  if (l < 7) return false;
  for (int i = 0; i < 8; i++) {
    if (s.substr(0, i) != a.substr(0, i)) continue;
    int j = 7-i;
    if (s.substr(l-j, j) == a.substr(7-j, j)) return true;
  }
  return false;
}

int main() {
  if (f()) cout << "YES" << endl;
  else cout << "NO" << endl;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std; 
#define LIM 1000003

#define M 1000000007
#define inf 99999999999999999LL	//long long inf
typedef long long ll;

#define sc(x) scanf("%d",&x);
#define sc2(x,y) scanf("%d%d",&x,&y);
#define sc3(x,y,z) scanf("%d%d%d",&x,&y,&z);
#define scl(x) scanf("%lld",&x);
#define scl2(x,y) scanf("%lld%lld",&x,&y);
#define scl3(x,y,z) scanf("%lld%lld%lld",&x,&y,&z);

#define pb push_back
#define mp make_pair
#define fi first
#define se second 
ll power(ll x,ll y,ll z) {	ll ret = 1;	while(y > 0) {	if(y & 1) ret = (ret*x)%z;x = (x*x)%z;y >>= 1;}return ret;}


#define debug(x) cerr<<#x<<" :: "<<x<<"\n";
#define debug2(x,y) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define debug3(x,y,z) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\n";
#define debug4(x,y,z,a) cerr<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#a<<" :: "<<a<<"\n";



int n, m, vis[LIM];
vector< int >graph[LIM] ;
void dfs(int start) {
	vis[start] = 1 ;
	for(int ele : graph[start]) {
		if(vis[ele] == 0)
			dfs(ele) ;
	}
}
int main() {
	int i, j, t;
	sc2(n, m) ;
	while(m--) {
		int st, en, wt;
		sc3(st, en, wt);
		graph[st].pb(en) ;
		graph[en].pb(st) ; 	
	}	
	int ans = 0 ;	
	for(i=1; i<=n; i++) {
		if(vis[i] == 0) {
			ans++;
			dfs(i) ;
		}
	}
	cout << ans << endl ;
	return 0;
}




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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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

//INT_MAX	2,147,483,647 = 2*1.0e9

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n, a; cin >> n >> a;
    cout << n * n - a << endl;

    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(10000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(K, A):
    L = H = 2
    for a in A[::-1]:
        if math.ceil(L/a)*a > H:
            return -1
        L = math.ceil(L/a)*a
        H = math.floor(H/a)*a + a-1

    return ' '.join(map(str, [L, H]))


def main():
    K = read_int()
    A = read_int_n()
    print(slv(K, A))


if __name__ == '__main__':
    main()


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

using namespace std;

int main()
{
  int n;
  cin>>n;
  int ar[n];
  int dp[n];
  for(int i=0;i<n;i++)
    cin>>ar[i];
  if(n==2)
  {
    cout<< abs(ar[0]-ar[1])<<endl;
    return 0;
  }
  dp[0]=0;
  dp[1]=abs(ar[0]-ar[1]);
  //dp[2]=abs(ar[2]-ar[1]);
  for(int i=2;i<n;i++)
  {
    dp[i]=min(abs(ar[i]-ar[i-1])+dp[i-1],abs(ar[i]-ar[i-2])+dp[i-2]);
  }
  cout<<dp[n-1]<<endl;
  
  return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#include <array>
#include <vector>
#include <queue>
#include <set>
#include <cmath>
#include <map>
#include <unordered_map>
//#include <unordered_set>
//#include <boost/container/static_vector.hpp>
//#include <boost/unordered_set.hpp>
//#include <boost/unordered_map.hpp>
//#include <unistd.h>

//#include <cv.h>
//#include <highgui.h>
#include <stdlib.h>
#include <time.h>

#include <string>

const int MAX_N = 200050;
int N;
long long A[MAX_N];

bool condition(const int num) {
    if (N == 1) {
        return true;
    }

    if (num == 1) {
        for (int i = 2; i <= N; i++) {
            if (A[i] <= A[i-1]) {
                return false;
            } 
        }
        return true;
    }

    std::map<long long, int> mp;
    for (int i = 2; i <= N; i++) {
        if (A[i-1] < A[i]) {
            continue;
        } else {
            mp.erase(mp.upper_bound(A[i]), mp.end());
            long long j = A[i];
            while (mp.find(j) != mp.end() && mp[j] == num - 1) {
                mp.erase(mp.find(j));
                j--;
            }
            if (j == 0) {
                return false;
            } else {
                if (mp.find(j) == mp.end()) {
                    mp[j] = 1;
                } else {
                    mp[j]++;
                }
            }
        }
    }
    return true;
}

int main(int argc, char **argv) {
    std::cin >> N;

    for (int i = 1; i <= N; i++) {
        std::cin >> A[i];
    }

    if (N == 1 || condition(1)) {
        std::cout << 1 << std::endl;
        return 0;
    }

    int lb = 1;
    int ub = N;

    while (lb + 1 < ub) {
        int mid = (lb + ub) / 2;
        if (condition(mid)) {
            ub = mid;
        } else {
            lb = mid;
        }
    }
    std::cout << ub << std::endl;
    
    return 0;
}

Measured memory_bytes: 1792
a,b,h,m = gets.chomp.split.map(&:to_i)
ans = 0

h = 0 if h == 12
kakudo = 30*h + (m.to_f/2) - 6*m
kakudo = kakudo.abs
if kakudo == 180
  ans = a + b
else
  if kakudo > 180
  	kakudo = 360 - kakudo
  end
end
#puts kakudo

c = (a**2) + (b**2) - 2*a*b * Math.cos( kakudo * Math::PI / 180 )
ans = Math.sqrt(c)

puts ans

Measured memory_bytes: 14540
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
class Main{
	public static void main(String[] args) {
		SC sc=new SC(System.in);
		/*
		 * 方針、できるだけ面積を小さくしたい
		 * 点の集合をXとY座標それぞれでソートしていく
		 * そこからスライド式に見ていくとよさそう
		 *
		 */
		long MAX_S=6_000_000_000_000_000_000L;
		int N=sc.nextInt();
		int K=sc.nextInt();
		long MIN_S=6_000_000_000_000_000_000L;
		long[][] coordx=new long[N][2];
		long[][] coordy=new long[N][2];
		for(int i=0; i<N; i++) {
			long xx=sc.nextLong();
			long yy=sc.nextLong();
			coordx[i][0]=xx;
			coordx[i][1]=yy;
			coordy[i][0]=yy;
			coordy[i][1]=xx;
		}
		quick_sort(coordx,0,N-1);
		quick_sort(coordy,0,N-1);
		for(int i=0; i<N; i++) {
			for(int j=0; j<N; j++) {
				if(i>=j) {
					for(int k=0; k<N; k++) {
						for(int l=0; l<N; l++) {
							if(k>=l) {
								long minx=coordx[j][0];
								long maxx=coordx[i][0];
								long miny=coordy[l][0];
								long maxy=coordy[k][0];
								int num=0;
								for(int m=0; m<N; m++) {
									if(minx<=coordx[m][0] && coordx[m][0]<=maxx) {
										if(miny<=coordx[m][1] && coordx[m][1]<=maxy) {
											num++;
										}
									}
								}
								if(num>=K) {
									MIN_S=Math.min(MIN_S, (maxx-minx)*(maxy-miny));
								}
							}
						}
					}
				}
			}
		}
		pl(MIN_S);
	}
	static class SC {
		private BufferedReader reader = null;
		private StringTokenizer tokenizer = null;
		public SC(InputStream in) {
			reader = new BufferedReader(new InputStreamReader(in));
		}
		public String next() {
			if (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
			return tokenizer.nextToken();
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
	public static void pl(Object o) {
		System.out.println(o);
	}
	public static void pl() {
		System.out.println();
	}
	public static void p(Object o) {
		System.out.print(o);
	}
	static void quick_sort(long[][] d, int left, int right) {
		if (left>=right) {
			return;
		}
		long p = d[(left+right)/2][0];
		int l = left, r = right;
		long tmp,tmp1,tmp2;
		while(l<=r) {
			while(d[l][0] < p) { l++; }
			while(d[r][0] > p) { r--; }
			if (l<=r) {
				tmp = d[l][0]; d[l][0] = d[r][0]; d[r][0] = tmp;
				tmp1=d[l][1]; tmp2=d[r][1]; d[l][1]=tmp2; d[r][1]=tmp1;
				l++; r--;
			}
		}
		quick_sort(d, left, r);
		quick_sort(d, l, right);
	}
}

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

#define fast ios::sync_with_stdio(false);cin.tie(0); cout.tie(0)

typedef long long ll;
typedef long double ld;
const ll inf = (ll)1e14;
const ll N = (ll)1e6;


int main() {
    fast;
    int n, m, k;
    cin >> n >> m >> k;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= m; j++) {
            if (i * m + j * n - 2 * i * j == k) return cout << "Yes\n", 0;
        }
    }
    cout << "No\n";
    return 0;
}

Measured memory_bytes: 256
from math import *

n,a,b,c,d=map(int,input().split(" "))

s=input()


flg=0


for i in range(b,d):
	if(s[i]=='#' and s[i-1]==s[i]):
		flg=1

for i in range(a,c):
	if(s[i]=='#' and s[i-1]==s[i]):
		flg=1

if(c>d):
	ff=1
	for i in range(b,d+1):
		if(s[i]=='.' and s[i-1]=='.' and s[i-2]=='.'):
			ff=0

	if(ff):
		flg=1

if(flg):
	print("No")
else:
	print("Yes")







Measured memory_bytes: 3572
N = gets.to_i
As = gets.split.map(&:to_i)

m, mi = As.map.with_index.max_by{|a, i| a.abs}
ans = (1 .. N).map{|i| [mi + 1, i]}
case m <=> 0
when 1
  ans += (1 .. N).each_cons(2).to_a
when 0
  ans = []
when -1
  ans += N.downto(1).each_cons(2).to_a
end
puts ans.size
ans.each{|i, j| printf "%d %d\n", i, j}

Measured memory_bytes: 3836
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);	
		String text;
		text = scan.next();
		char[] s = text.toCharArray();
		text = scan.next();
		char[] p = text.toCharArray();
		func(s , p ,0);

	}

	static void func(char[] s , char[] p , int n ) {
		for(int i = 0 ; i < s.length ; i++) {
			if(n == s.length) {
				System.out.println("No");
				break;
			}else if(s[i+n >= s.length ? i+n-s.length : i+n] != p[i]) {
				n++;
				func(s , p , n );
				break;
			}else if(i == p.length - 1) {
				System.out.println("Yes");
				break;
			}
		}
	}
}

Measured memory_bytes: 17288
#include <iostream>
#include<cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
 
int main() {
    ios::sync_with_stdio(false);
	int a, b, c;
    cin >> a >> b >> c;
    if (a == b && a != c) cout << c;
    else if (a == c && a != b) cout << b;
    else if (b == a && b != c) cout << c;
    else if (b == c && b != a) cout << a;
    else if (c == a && c != b) cout << b;
    else if (c == b && c != a) cout << a;
    else cout << a;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int dp[100009],h[100009];
  int i,j,n,k,mi=INT_MAX;
  cin>>n>>k;
  for(i=0;i<n;i++)
    cin>>h[i];
  dp[0]=0;
  if(n>=2)
  	dp[1]=abs(h[1]-h[0]);
  for(i=2;i<n;i++)
  {
    mi=INT_MAX;
    for(j=1;j<=k;j++)
    {
      	if(i-j>=0)
    		mi=min(dp[i-j]+abs(h[i]-h[i-j]),mi);
    }
    dp[i]=mi;
  }
  cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double pi=3.14159265358979323846;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}
int main(){
    ll n,m;cin>>n>>m;
    vector<bool> b(n,false);
    vi p(n);
    rep(i,m){
        ll a;string s;cin>>a>>s;
        a--;
        if(s=="AC")b[a]=true;
        else if(!b[a])p[a]++;
    }
    ll a=0,c=0;
    rep(i,n){
        if(b[i]){
            a++;
            c+=p[i];
        }
    }
    cout<<a<<' '<<c<<endl;
}

Measured memory_bytes: 1152
#include "bits/stdc++.h"
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((int)(x).size())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define repf(i, x, n) for (int i = (int)(x); i < (int)(n); i++)
#define repfr(i, x, n) for (int i = (int)(x)-1; i >= (int)(n); i--)
#define INF 1e9
using ll = int64_t;
template <class T> bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T> bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return true;
  }
  return false;
}
#define waru 1000000007

std::int64_t gcd(std::int64_t a, std::int64_t b) {
  // a >= b && b != 0
  std::int64_t c;
  do {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}
std::int64_t gcd_s(std::int64_t aa, std::int64_t bb) {
  std::int64_t a = max(aa, bb);
  std::int64_t b = min(aa, bb);
  std::int64_t c;
  if (b == 0) {
    return -1;
  }
  do {
    c = a % b;
    a = b;
    b = c;
  } while (c);

  return a;
}
void rle(std::vector<std::pair<char, std::int64_t>> &data, std::string str) {
  char now = str[0];
  std::int64_t count = 0;
  for (std::int64_t i = 0; i < str.size() + 1; i++) {
    if (i == str.size()) {
      data.push_back(make_pair(str[i - 1], count));
      break;
    } else if (now != str[i]) {
      data.push_back(make_pair(now, count));
      now = str[i];
      count = 0;
    }
    count++;
  }

  return;
}

#define MAX_NUM 200
int n;
int b[MAX_NUM];

void Main() {
  //自動整形防止用コメント
  cin >> n;
  rep(i, n - 1){
    cin >> b[i];
  }

  int sum = 0;
  sum += b[0] + b[n-2];

  rep(i, n - 2){
    sum += min(b[i], b[i + 1]);
  }

  cout << sum << endl;

  return;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
n, y = map(int, input().split())

for i in range(n + 1):
        for j in range(n - i + 1):
                if i * 10000 + j * 5000 + (n - i - j) * 1000 == y:
                        print(i, j, n-i-j)
                        exit()


print("-1 -1 -1")



Measured memory_bytes: 2940