akhauriyash/Code-Regression huggingface dataset:
package main

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

var (
	readString func() string
	readBytes  func() []byte
)

func init() {
	readString, readBytes = newReadString(os.Stdin)
}

func newReadString(ior io.Reader) (func() string, func() []byte) {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	f1 := func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
	f2 := func() []byte {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Bytes()
	}
	return f1, f2
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 10, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readFloat64() float64 {
	f, err := strconv.ParseFloat(readString(), 64)
	if err != nil {
		panic(err.Error())
	}
	return f
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

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

func minInt64(a, b int64) int64 {
	if a < b {
		return a
	}
	return b
}

func maxInt64(a, b int64) int64 {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func absInt64(a int64) int64 {
	if a < 0 {
		return -a
	}
	return a
}

func sum(a []int) int {
	var ret int
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumInt64(a []int64) int64 {
	var ret int64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func sumFloat64(a []float64) float64 {
	var ret float64
	for i := range a {
		ret += a[i]
	}
	return ret
}

func gcdInt64(m, n int64) int64 {
	for m%n != 0 {
		m, n = n, m%n
	}
	return n
}

func lcmInt64(m, n int64) int64 {
	return m / gcdInt64(m, n) * n
}

// sort ------------------------------------------------------------

type int64Array []int64

func (s int64Array) Len() int           { return len(s) }
func (s int64Array) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s int64Array) Less(i, j int) bool { return s[i] < s[j] }

type xxx struct {
	x int
}

type sortArray []xxx

func (s sortArray) Len() int           { return len(s) }
func (s sortArray) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }
func (s sortArray) Less(i, j int) bool { return s[i].x < s[j].x }

// -----------------------------------------------------------------
var n, m int
var d [][]int
var dp []int

func dfs(i int) int {
	if dp[i] != -1 {
		return dp[i]
	}
	if len(d[i]) == 0 {
		return 0
	}

	for j := range d[i] {
		dp[i] = max(dp[i], dfs(d[i][j])+1)
	}
	return dp[i]
}

func main() {
	n = readInt()
	m = readInt()
	d = make([][]int, n+1)
	for i := range d {
		d[i] = make([]int, 0)
	}
	for i := 0; i < m; i++ {
		x := readInt()
		y := readInt()
		d[x] = append(d[x], y)
	}

	dp = make([]int, n+1)
	for i := range dp {
		dp[i] = -1
	}

	var ans int
	for i := 1; i <= n; i++ {
		ans = max(ans, dfs(i))
	}

	fmt.Println(ans)
}


Measured memory_bytes: 13056
n = int(input())
x = [int(input()) for i in range(n)]
x.sort()
if n%2:
	a = 2*sum(x[n-n//2:])-sum(x[n-n//2-2:n-n//2])-2*sum(x[:n-n//2-2])
	a2 = -2*sum(x[:n//2])+sum(x[n//2:n//2+2])+2*sum(x[n//2+2:])
	print(max(a,a2))
else: print(-2*sum(x[:(n-2)//2])-x[(n-2)//2]+x[(n-2)//2+1]+2*sum(x[(n-2)//2+2:]))

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

class Main {
	public static void main(String args[]) throws IOException {
		@SuppressWarnings("resource")
		Scanner cin = new Scanner(System.in);
		ArrayList<String> inLines = new ArrayList<String>();
		for (; cin.hasNext();) {
			inLines.add(cin.nextLine());
		}
		Solver solver = new Solver();
		solver.solve(inLines);
	}
}

class Solver {

	public void solve(ArrayList<String> inLines) {
		String[] strArr = inLines.get(0).split(" ");
		long N = Long.parseLong(strArr[0]);
		long M = Long.parseLong(strArr[1]);

		long ans = 0;
		if (N * 2 <= M) {
			ans = N;
			ans += (M - 2 * N) / 4;
		} else {
			ans = M / 2;
			ans += (M - 2 * ans) / 4;
		}
		System.out.println(ans);
	}
}


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e2 + 5);

int h, w;

char a[MAX_N][MAX_N];

unordered_map<int, int> count() {
  unordered_map<char, int> cnt;

  for (int i = 0; i < h; ++i) {
    for (int j = 0; j < w; ++j) {
      cnt[a[i][j]] += 1;
    }
  }

  unordered_map<int, int> ret;

  for (auto &e : cnt) {
    ret[e.second % 4] += 1;
  }

  return ret;
}

int main(void) {
  // Here your code !
  scanf("%d %d", &h, &w);

  for (int i = 0; i < h; ++i) {
    scanf("%s", &(a[i]));
  }

  auto cnt = count();

  string ans = "No";

  if (h % 2 == 0 && w % 2 == 0) {
    if (cnt[3] == 0 && cnt[2] == 0 && cnt[1] == 0) ans = "Yes";
  } else if (h % 2 == 1 && w % 2 == 1) {
    if (cnt[1] == 1 && cnt[3] == 0) {
      if (cnt[3] == 0 && (cnt[2] * 2 <= (h + w - 2)) && cnt[1] == 1)
        ans = "Yes";
    } else if (cnt[1] == 0 && cnt[3] == 1) {
      if (cnt[3] == 0 && (cnt[2] * 2 <= (h + w - 4)) && cnt[1] == 1)
        ans = "Yes";
    }
  } else {  // (1, 0) or (0, 1)
    int even = (h % 2 == 0) ? h : w;
    if (cnt[3] == 0 && cnt[2] * 2 <= even && cnt[1] == 0) ans = "Yes";
  }

  cout << ans << endl;

  return 0;
}


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

int main(void){
    int N; cin >> N;
    vector<int> A;
    int sum=0;

    for(int i=0; i<N; i++){
        int a; cin >> a;
        sum+=a;
        A.push_back(a);
    }

    if(sum%10!=0){
        cout << sum << endl;
        return 0;
    }
    else{
        sort(A.begin(), A.end());
        for(int i=0; i<A.size(); i++){
            if(A[i]%10!=0){
                cout << sum-A[i] << endl;
                return 0;
            }
        }
    }

    cout << 0 << endl;
    return 0;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin>>N;
  int count=0;
  for(int i=1;i<10;i++){
    for(int j=1;j<10;j++){
      if(i*j==N) {
        cout<<"Yes"<<endl;
        count++;
        break;
      }
    }
    if(count==1) break;
  }
  if(count==0) cout<<"No"<<endl;
}

Measured memory_bytes: 3644
//by (111110101)2
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>
using namespace std;
map<int,int>mp;
int n;
bool ok=true;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	{
		int a;
		cin>>a;
		if(mp[a]!=0)
		{
			ok=false;
		}
		mp[a]++;
	}
	if(ok)
	{
		cout<<"YES"<<endl;
	}
	else
	{
		cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 9600
t = list(map(int, input().split()))
if (t[1] - 2*t[0]) % 2 == 0 and (4*t[0] - t[1]) % 2 == 0 and (t[1] - 2*t[0])>= 0 and (4*t[0] - t[1]) >= 0:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 9164
#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<vector>
using namespace std;
typedef long long ll;
const int maxn=1e5+8;
ll arr[maxn],brr[maxn],crr[maxn];
vector<ll> v;
int cmp(ll a,ll b)
{
	return a>b;
}
int main()
{
	ll x,y,a,b,c;
	scanf("%lld%lld%lld%lld%lld",&x,&y,&a,&b,&c);
	for (int i=1;i<=a;i++)
		scanf("%lld",&arr[i]);
	for (int i=1;i<=b;i++)
		scanf("%lld",&brr[i]);
	for (int i=1;i<=c;i++)
		scanf("%lld",&crr[i]);
	sort(arr+1,arr+1+a,cmp);
	sort(brr+1,brr+1+b,cmp);
	sort(crr+1,crr+1+c,cmp);
	int k=1;
	int pt=1;
	for (int i=1;i<=min(x,a);i++)
		v.push_back(arr[i]);
	if (x>a)
	{
		for (int i=1;i<=x-a;i++)
			v.push_back(crr[pt++]);
	}
	for (int i=1;i<=min(y,b);i++)
		v.push_back(brr[i]);
	if (y>b)
	{
		for (int i=1;i<=y-b;i++)
			v.push_back(crr[pt++]);
	}
	ll ans=0;
	for (int i=pt;i<=c;i++)
	{
		v.push_back(crr[i]);
	}
	sort(v.begin(),v.end(),cmp);
	for (int i=0;i<x+y;i++)
		ans+=v[i];
	cout<<ans<<endl;
} 

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

int last(vector<int> &ts, int d, int i) {
  for (int idx = d; idx >= 0; idx--) {
    if (ts[idx] == i) {
      return idx + 1;
    }
  }
  return 0;
}

vector<int> generate_ts(
  int d,
  const vector<int> &cs,
  const vector<vector<int>> &sss
) {
  vector<int> ts(d);
  for (int i = 0; i < d; i++) ts[i] = (i % 26) + 1;
  random_shuffle(ts.begin(), ts.end());

  // vector<int> satis(d);

  // for (int i = 0; i < d; i++) {
  //   satis[i] = i == 0 ? 0 : satis[i - 1];
  //   satis[i] += sss[i][ts[i] - 1];
  //   for (int j = 0; j < 26; j++) {
  //     satis[i] -= cs[j] * ((i + 1) - last(ts, i, j + 1));
  //   }
  // }

  return ts;
}

int main(void) {
  int d;
  cin >> d;
  vector<int> cs(26);
  for (int &c : cs) cin >> c;
  vector<vector<int>> sss(d, vector<int>(26));
  for (vector<int> &ss : sss) {
    for (int &s : ss) cin >> s;
  }

  vector<int> result = generate_ts(d, cs, sss);
  for (const int &t : result) cout << t << endl;

  return 0;
}

Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF = 1e18+18;
const ll MAX = 200000;
const ll MOD = 1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;

int Par[MAX];
int Rank[MAX];
int Mem[MAX];
void init(int n){
    rep(i, n){
        Par[i]=i;
        Rank[i]=0;
        Mem[i]=1;
    }
}

int find(int x){
    if(Par[x]==x){
        return x;
    }
    else{
        return Par[x]=find(Par[x]);
    }
}
void unite(int x, int y){
    x=find(x);
    y=find(y);
    if(x==y)return;
    if(Rank[x]<Rank[y]){
        Par[x]=y;
        Mem[y]+=Mem[x];
    }
    else{
        Par[y]=x;
        if(Rank[x]==Rank[y])Rank[x]++;
        Mem[x]+=Mem[y];
    }
}

bool same(int x, int y){
    return find(x)==find(y);
}

int main(){
    int N, M, K;
    cin>>N>>M>>K;
    init(N);
    vector<int> A(M), B(M), C(K), D(K);
  	vector<int> G(N, 0);
    rep(i, M){
        cin>>A[i]>>B[i];
        A[i]--;
        B[i]--;
        unite(A[i], B[i]);
      	G[A[i]]++;
        G[B[i]]++;
    }
    rep(i, K){
        cin>>C[i]>>D[i];
        C[i]--;
        D[i]--;
        if(same(C[i], D[i])){
            G[C[i]]++;
            G[D[i]]++;
        }
    }
    rep(i, N){
        ll P=Mem[find(i)];
        if(i>0)cout<<" ";
        cout<<P-1-G[i];
      	//cout<<" "<<P<<" "<<G[i];
    }
    
}

Measured memory_bytes: 3968
#include<stdio.h>

int main(void){
	int n,s[4]={0,0,0,0};
	char bt[3]="";
	while(scanf("%d,%s\n",&n,bt)!=EOF){
	if(bt[1]=='B'){s[2]++;}
	else {
		switch(bt[0]){
		case 'A':s[0]++;break;
		case 'B':s[1]++;break;
		case 'O':s[3]++;break;
		}
	}
	}
	printf("%d\n",s[0]);
	printf("%d\n",s[1]);
	printf("%d\n",s[2]);
	printf("%d\n",s[3]);
	return 0;
}

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

int main() {
	int a, b, k;

	cin >> a >> b;
	for (k = 0; (a - k) >= 0 || (b - k) >= 0; ++k)
		if ((a - k) + (b - k) == 0) {
			cout << k << endl; k = -1; break;
		}
	if(k != -1)
	cout << "IMPOSSIBLE" << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(i, name)in(i)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(i,v) for(auto &i:(v))
#define all(v) (v).begin(),(v).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, N);
  set<int> st;
  rep(i, 0, N) {
    VAR(int, d);
    st.insert(d);
  }
  print(st.size());
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T> void operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) cin >> e; }

typedef long long ll;
int const inf = 1<<29;

int main() {

  int N; cin >> N;
  vector<int> vs;
  rep(i, 3 * N) {
    int a; cin >> a;
    vs.push_back(a);
  }

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

  ll ans = 0;
  for (int i = 0; i < 2 * N; i++) {
    if (i % 2 == 1) {
      ans += vs[3 * N - 1 - i];
    }
  }

  cout << ans << "\n";
  
  return 0;
}

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

int main(){
	int n, start, count = 0;
	cin >> n;
	vector<int> a(n);
	for(int i=0; i < n; i++) {
		cin >> a.at(i);
	}
	start = 0;
	for(int i=0; i < n; i++) {
		if(a.at(start) != 2) {
			start = a.at(start)-1;
			count++;
		}else{
			cout << ++count << endl;;
			return 0;
		}
	}
	cout << -1 << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007

int main() {
  
  int N,M,X;
  cin >> N >> M >> X;

  vector<long long> C(N);
  vector<vector<long long>> A(N,vector<long long>(M));
  for(int i = 0;i < N;i++) {
    cin >> C[i];
    for(int j = 0;j < M;j++) {
      cin >> A[i][j];
    }
  }

  long long ans = 1e7;
  for(int bit = 0;bit < (1<<N);bit++) {
    vector<long long> p(M,0);
    long long sum = 0;
    for(int i = 0;i < N;i++) {
      if((bit>>i)&1) {
        sum += C[i];
        for(int j = 0;j < M;j++) p[j] += A[i][j];
      }
    }

    bool can = true;
    for(int i = 0;i < M;i++) if(p[i] < X) can = false;
    if(can) ans = min(ans,sum);
  }

  if(ans == 1e7) cout << -1 << endl;
  else cout << ans << endl;

}


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

const int MOD = 1000000007;
const int INF = 1e9;

//long long
using ll = long long;

//出力系
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
 
// begin() end()
#define all(x) (x).begin(),(x).end()

//for
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n, i##_len=(n); i>=0; i--)
#define FOR(i,a,b) for(int i=(a), i##_len=(b); i<i##_len; ++i)

//最大公約数 
 ll gcd(ll a,ll b){
 if(b == 0) return a;
 return gcd(b,a%b);
 }

//最小公倍数
 ll lcm(ll a,ll b){
 ll g = gcd(a,b);
 return a / g * b; // Be careful not to overflow  if(a < b) return gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
} 

#define INF 1LL<<60

int main(){
int X;
cin >> X;
vector<bool>dp(100000, false);
dp[0] = true;
dp[100000] = true;
for(int i = 100; i <= X; i++){
    REP(j, 6){
      if(i < 100 + j) break;
      if(dp[i - (100 + j)] == true) dp[i] = true;
    }
  }

if(dp[X]) print(1);
else print(0);

}

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

int main()
{
    int n, m;
    cin >> n >> m;
    vector<int> k(n);
    vector<vector<int>> s(m, vector<int>(n));
    rep(i,m) {
        cin >> k[i];
        s[i].resize(k[i]);
        rep(j,k[i]) {
            cin >> s[i][j];
            --s[i][j];
        }
    }
    vector<int> p(m);
    rep(i,m) {
        cin >> p[i];
    }

    int ans = 0;
    for (int i = 0; i < (1 << n); ++i) {
        bool ok = true;
        for (int j = 0; j < m; ++j) {
            int c = 0;
            for (int id : s[j]) {
                if ((i >> id) & 1) {
                    ++c;
                }
            }
            c %= 2;
            if (c != p[j]) {
                ok = false;
            }
        }
        if (ok) {
            ++ans;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
using namespace std;
 
typedef long long int ll;
typedef pair<int,int> pii;

#define ff first
#define ss second
#define vi vector<int>
#define fo(n) for(int i = 0;i < int(n);i++)
#define foo(a,b) for(int i = int(a);i <= int(b);i++)
#define mk make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define fastio ios_base:: sync_with_stdio(false)


const int MAXN = 1e6;
const int mod = 1e9 + 7;
const int inf = 1e9;

bool isSquare(int n){
	int square_root = sqrt(n);

	return square_root*square_root == n;
}

int main(){

	
	fastio;
	int n,d;
	cin >> n >> d;

	vector<vector<int> >  arr(n, vector<int>(d));

	fo(n){
		for(int j = 0;j < d;j++){
			cin >> arr[i][j];
		}
	}

	int cnt = 0;

	fo(n){
		for(int j = i+1;j< n;j++){
			int dist = 0;

			for(int k = 0;k < d;k++){
				dist += (arr[i][k]-arr[j][k])*(arr[i][k]-arr[j][k]);
			}

			if(isSquare(dist)) cnt++;
		}
	}

	cout << cnt << endl;
	return 0;
 }	

Measured memory_bytes: 256
n,k = map(int, input().split())
A = list(map(int, input().split()))
counter = 0

for i in range(0,n,k-1):
  min_n = min(A[i:i+k])
  max_n = max(A[i:i+k])
  if min_n != max_n:
    counter += 1
  if i+k-1 < n:
    A[i+k-1] = min_n
  
print(counter)

Measured memory_bytes: 13880
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#define N 200005
using namespace std;
typedef long double ld;
struct P{
	int x,y;
}S,T,a[N];
int X,Y,n,wx[N],wy[N];
pair<int,int> b[N];
void get(int op){
	for(int i=1;i<=n;i++) b[i]=make_pair(!op?a[i].x:a[i].y,i);
	b[n+1]=make_pair(!op?S.x:S.y,-1);
	b[n+2]=make_pair(!op?T.x:T.y,0);
	sort(b+1,b+n+3);
	int cnt=0;
	for(int i=1;i<=n+2;i++){
		if(i==1||b[i].first!=b[i-1].first){
			if(!op) wx[++cnt]=b[i].first;
			else wy[++cnt]=b[i].first;
		}
		if(b[i].second<=0){
			if(b[i].second==0){
				if(!op) T.x=cnt;
				else T.y=cnt;
			}
			else{
				if(!op) S.x=cnt;
				else S.y=cnt;
			}
			continue;
		}
		if(!op) a[b[i].second].x=cnt;
		else a[b[i].second].y=cnt;
	}
	X=cnt;
}
bool cmpx(P a,P b){
	if(a.x!=b.x) return a.x<b.x;
	return a.y<b.y;
}
int mx[N],f[N];
void upd(int k,int val){
	for(;k<=n;k+=k&-k) mx[k]=max(mx[k],val);
}
int find(int k){
	int ans=0;
	for(;k;k-=k&-k) ans=max(ans,mx[k]);
	return ans;
}
int main(){
	scanf("%d%d%d%d%d",&S.x,&S.y,&T.x,&T.y,&n);
	if(S.x>T.x) swap(S,T);
	for(int i=1;i<=n;i++) scanf("%d%d",&a[i].x,&a[i].y);
	if(S.y>T.y){
		S.y=-S.y;T.y=-T.y;
		for(int i=1;i<=n;i++) a[i].y=-a[i].y;
	}
	get(0);
	get(1);
	a[++n]=S;a[++n]=T;
	sort(a+1,a+n+1,cmpx);
	int lst=0;
	for(int i=1;i<=n;i++){
		if(a[i].x<S.x||a[i].y<S.y) continue;
		f[i]=find(a[i].y)+1;
		if(a[i].x==S.x&&a[i].y==S.y) f[i]=0;
		if(a[i].x==T.x&&a[i].y==T.y) lst=f[i];
		upd(a[i].y,f[i]);
	}
	const ld pi=acosl(ld(-1));
	long double ans=ld(wx[T.x]-wx[S.x]+wy[T.y]-wy[S.y])*100;
	ans+=ld(pi*5-20)*(lst-1);
	if(lst-1==min(wx[T.x]-wx[S.x]+1,wy[T.y]-wy[S.y]+1)&&lst) ans+=pi*5;
	printf("%.20Lf",ans);
	return 0;
}


Measured memory_bytes: 6528
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeSet;

import javax.print.attribute.standard.MediaSize.Other;
import javax.xml.bind.ParseConversionEvent;

public class Main {
	
	public static final int MAX_MUSIC = 50;
	public static final int MAX = 8;
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
	
		final int n = sc.nextInt();
		final int m = sc.nextInt();
		
		int[][][] DP = new int[n + 1][m + 1][MAX + 1];
		
		for(int i = 0; i <= n; i++){
			for(int j = 0; j <= m; j++){
				Arrays.fill(DP[i][j], Integer.MIN_VALUE);
			}
		}
		
		int[][] sat = new int[n][3];
		for(int i = 0; i < n; i++){
			for(int j = 0; j < 3; j++){
				sat[i][j] = sc.nextInt();
			}
		}
		
		DP[0][m][0] = 0;
		for(int music = 0; music < n; music++){
			for(int level2 = 0; level2 <= m; level2++){
				for(int level1 = 0; level1 <= MAX; level1++){
					if(DP[music][level2][level1] == Integer.MIN_VALUE){
						continue;
					}
					
					final int limit = Math.min(MAX, level2);
					for(int burn = 0; burn <= limit; burn++){
						DP[music + 1][level2 - burn][burn] = Math.max(DP[music + 1][level2 - burn][burn], DP[music][level2][level1] + sat[music][2]);
					}
					
					final int limit_2 = Math.min(level2, MAX);
					final int limit_1 = Math.min(level1, MAX);
					
					for(int use_2 = 0; use_2 <= limit_2; use_2++){
						for(int use_1 = 0; use_1 <= limit_1; use_1++){
							if(use_2 == 0 && use_1 == 0){
								continue;
							}else if(use_1 + use_2 > MAX){
								break;
							}
							
							final int benefit = sat[music][0] * use_2 + sat[music][1] * use_1;
							
							final int limit_burn = Math.min(level2 - use_2, MAX - use_2);
							for(int burn = 0; burn <= limit_burn; burn++){
								DP[music + 1][level2 - use_2 - burn][use_2 + burn] = Math.max(DP[music + 1][level2 - use_2 - burn][use_2 + burn], DP[music][level2][level1] + benefit);
							}
						}
					}
				}
			}
		}
		
		int max = Integer.MIN_VALUE;
		for(int level2 = 0; level2 <= m; level2++){
			for(int level1 = 0; level1 <= MAX; level1++){
				//System.out.println(DP[n][level2][level1]);
				max = Math.max(max, DP[n][level2][level1]);
			}
		}
		
		System.out.println(max);
	}

}

Measured memory_bytes: 24452
//Himanshu Shukla
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
//#define file_input
//#define multitest
//#define measure_time
#define ll long long
#define v32 vector<int>
#define v64 vector<ll>
#define s32 set<int>
#define s64 set<ll>
#define graph vector<v32>
#define p32 pair<int, int>
#define p64 pair<ll, ll>
#define sz(v) (ll)(v).size()
#define fi first
#define se second
#define ln '\n'
#define debug(x) cerr << (#x) << ": " << (x) << ln
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline ll add(ll a, ll b, ll m) { return (((a % m + b % m) % m + m) % m); }
inline ll mul(ll a, ll b, ll m) { return (((a % m * b % m) % m + m) % m); }
const double EPS = 1e-6;
const ll MOD = 1e9 + 7;
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
	out << '[' << p.fi << ", " << p.se << ']';
	return out;
}
template <template <typename, typename...> class ContainerType, typename ValueType, typename... Args>
void print_container(const ContainerType<ValueType, Args...> &c)
{
	cout << "{ ";
	for (const auto &v : c)
		cout << v << ' ';
	cout << '}' << ln;
}

void solve()
{
	int n, k;
	cin >> n >> k;
	v32 arr(n, 0);
	for (int i = 0; i < n; i++)
		cin >> arr[i];
	sort(arr.begin(), arr.end());
	for (int i = n - 1; i >= 0 && k--; i--)
		arr[i] = 0;
	ll sum = 0;
	for (int i = 0; i < n; i++)
		sum += 1ll * arr[i];
	cout << sum << ln;
	return;
}

int main()
{
	FASTIO;
#ifdef file_input
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	clock_t start, stop;
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
#ifdef measure_time
	start = clock();
#endif
	for (int tc = 1; tc < t + 1; tc++)
		solve();
#ifdef measure_time
	stop = clock();
	cerr << "Time :" << fixed << setprecision(5) << double(stop - start) / double(CLOCKS_PER_SEC) << "s" << ln;
#endif
	return 0;
}


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

int main(){
  int n,m;
  cin>>n>>m;
  vector<int>ac(n),pena(n);
  rep(i,m){
      int p;
      string s;
      cin>>p>>s;
      p--;
      if(ac[p]) continue;
      if(s=="AC") ac[p]=1;
      else pena[p]++;
  }
  int AC=0,WA=0;
  rep(i,n){
      AC+=ac[i];
      if(ac[i]) WA+=pena[i];
  }
  cout<<AC<<" "<<WA<<endl;
}
  


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;
    bool f = false;
    for (int i = 0; i <= n/7; i++) {
        for (int j = 0; j <= n/4; j++) {
            if (7*i + 4*j == n)
                f = true;
        }
    }

    if (f == true)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 888
import fractions
 
N, M = list(map(int, input().split()))
S = input()
T = input()
 
def lcm(a, b):
	return a * b // fractions.gcd (a, b)
 
ans = lcm(N, M)
 
width = fractions.gcd(N, M)
 
for i in range(width):
    if S[int(N/width) * i] != T[int(M/width) * i]:
        ans = -1
        break
 
print(ans)


Measured memory_bytes: 5948
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

// -------------------------------------------------------

int N, M;
int X[101010], Y[101010], Z[101010];
vector<int> Graph[101010];
bool visited[101010];

void dfs(int cur) {
  visited[cur] = true;
  for (auto nv : Graph[cur]) {
    if (!visited[nv]) {
      dfs(nv);
    }
  }
}

int main() {
  cin >> N >> M;
  rep(i, 0, M) {
    int x, y, z;
    cin >> x >> y >> z;
    Graph[x].push_back(y);
    Graph[y].push_back(x);
  }

  int ans = 0;
  repe(i, 1, N) {
    if (!visited[i]) {
      ++ans;
      dfs(i);
    }
  }
  cout << ans;
}


Measured memory_bytes: 12220
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main()
{
  string s, t;
  cin >> s >> t;
  int ans = 1001001001;
  for (int i = 0; i < s.size(); i++)
  {
    if (i + t.size() > s.size())
      break;
    int cnt = 0;
    for (int j = 0; j < t.size(); j++)
    {
      if (s[i + j] != t[j])
        cnt++;
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;
  return 0;
}


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



class Main{
    //読み込みのテンプレ(stringオブジェクトまで)
    
    static int N;
    static int[] sequence;
    static int count;
    
    public static void main(String[] args) throws IOException{
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        
        int[] sequence = new int[N];
        
        //配列にsequenceを打ち込む
        for(int i=0;i<N;i++){
            sequence[i]=scanner.nextInt();
        }
        
        sequence =  doSelectsort(sequence);
        showResult(sequence);
        System.out.println(count);
    }
    
    
    public static int[] doSelectsort(int[] sequence){
        for(int i=0;i<sequence.length;i++){
            int minimum = i;
            for(int j= i+1;j<sequence.length;j++){
                if(sequence[minimum] > sequence[j]){
                    minimum = j;
                }
            }
            int x = sequence[i];
            int y = sequence[minimum];
            sequence[i]=y;
            sequence[minimum]=x;
            
            if(i!=minimum)count++;
        }
        return sequence;
    }
    
    
    //出力
    public static void showResult(int[] sequence){
        for(int i =0;i<sequence.length-1;i++){
            int number = sequence[i];
            System.out.print(number + " ");
        }
        
        System.out.println(sequence[sequence.length-1]);
    }
    
}

Measured memory_bytes: 19004
// In the name of God

#include <bits/stdc++.h>

using namespace std;

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

	int x, y, z, k;

	cin >> x >> y >> z >> k;

	vector<long long> a(x), b(y), c(z);

	for(int i = 0; i < x; i++) cin >> a[i];

	for(int i = 0; i < y; i++) cin >> b[i];

	for(int i = 0; i < z; i++) cin >> c[i];

	sort(a.begin(), a.end());
	sort(b.begin(), b.end());
	sort(c.begin(), c.end());
	
	vector<long long> s;

	for(int i = 0; i < x; i++) {
		for(int j = 0; j < y; j++) {
			s.push_back(a[i] + b[j]);
		}
	}

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

	vector<long long> s2;

	for(int i = 0; i < z; i++) {
		for(int j = (int)s.size() - 1; j >= max(0, (int)s.size() - k); j--) {
			s2.push_back(c[i] + s[j]);
		}
	}

	sort(s2.begin(), s2.end());
	
	for(int i = 0; i < k ; i++) {
		cout << s2[(int)s2.size() - i - 1] << "\n";
	}


	return 0;
}


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

int main(){
    int a, b, c, d, e, f;
    cin >> a;
    b=a%10;
    c=a-b;
    c=c/10;
    d=c%10;
    e=c-d;
    e=e/10;
    f=b+d+e;
    cout << f << endl;
    
}

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

int main(){
    int H, W;  cin >> H >> W;
    vector<string> A(H);
    for(int i=0; i<H; i++) cin >> A[i];

    vector<vector<int>> dest(H, vector<int>(W,1e9));
    queue<pair<int,int>> que;
    for(int h=0; h<H; h++)for(int w=0; w<W; w++){
        if(A[h][w]=='#'){
            que.push({h,w});
            dest[h][w] = 0;
        }
    }
    int dh[4] = {-1, 1, 0, 0}, dw[4] = {0, 0, 1, -1};    
    while(!que.empty()){
        int h = que.front().first,  w = que.front().second;
        que.pop();
        for(int i=0; i<4; i++){
            int nh = h + dh[i];
            int nw = w + dw[i];
            if(0 <= nh && nh < H && 0 <= nw && nw < W && A[nh][nw]=='.' && dest[nh][nw] > dest[h][w]+1){
                dest[nh][nw] = dest[h][w] + 1;
                que.push({nh,nw});
            }
        }
    }

    int ans = 0;
    for(int h=0; h<H; h++)for(int w=0; w<W; w++){
        ans = max(ans, dest[h][w]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 13456
#include <bits/stdc++.h>
using namespace std;
/*
#define pair<int,int> pii
#define tuple<int,int,int> tiii
#define vector<pair<int,int>> vpii
#define vector<tuple<int,int,int>> vtiii
#define debug(args...) fprintf(stderr, args)
*/

int main() {
    string s;
    cin >> s;
    int ini, fim;



    for (int i = 0; i < s.size(); i++) {
        if(s[i] == 'A') {
            ini = i;
            break;
        }
    }
    for (int i = s.size()-1; i >= 0; i--) {
        if(s[i] == 'Z') {
            fim = i;
            break;
        }
    }
    
    cout << fim+1 - ini << endl;
    
    
    


    return 0;
}

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

const int MAXN=3e3+10;

int dp[MAXN][MAXN];
string a,b,c;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>a>>b;
    a="#"+a;
    b="#"+b;
    for(int i=1;i<a.size();i++)
        for(int j=1;j<b.size();j++)
            if(a[i]==b[j])
                dp[i][j]=dp[i-1][j-1]+1;
            else
                dp[i][j]=max(dp[i-1][j-1],max(dp[i-1][j],dp[i][j-1]));
    int v,x=a.size()-1,y=b.size()-1;
    while(x!=0&&y!=0)
    {
        if(a[x]==b[y])
            c.push_back(a[x]),x--,y--;
        else
        {
            v=max(dp[x-1][y-1],max(dp[x-1][y],dp[x][y-1]));
            if(dp[x-1][y-1]==v)
                x--,y--;
            else
            if(dp[x-1][y]==v)
                x--;
            else
            if(dp[x][y-1]==v)
                y--;
        }
    }
    reverse(c.begin(),c.end());
    cout<<c;
}


Measured memory_bytes: 35584
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main()
{
    int n;
    scanf("%d", &n);
    int ans = 1;
    for (int i=1; i*i<=n; i++) ans = i*i;
    printf("%d\n", ans);
    return 0;
}


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

int main() {
  int N, R;
  cin >> N >> R;
  
  int r;
  if (N >= 10) {
    r = R;
  }
  else {
    r = R + 100 * (10 - N); 
  }
  
  cout << r << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string s;
int num=0;
string a="CODEFESTIVAL2016";
int main(){
	cin>>s;
	for(int i=1;i<=16;i++)
		if(a[i-1]!=s[i-1])num++;
	cout<<num<<endl;
	
}

Measured memory_bytes: 256
#import<atcoder/all>
using std::cin;int N,Q,i,a;main(){cin>>N>>Q;atcoder::fenwick_tree<long>b(N);for(;i++<N;b.add(i-1,a))cin>>a;for(;cin>>i>>a>>N;Q--){i&&std::cout<<b.sum(a,N)<<'\n';if(!i)b.add(a,N);}}

Measured memory_bytes: 8216
// inputに入力データ全体が入る
function Main(input) {
	var line = input.split("\n");
	var N = Number(line[0]);
	var ary_march = ["M", "A", "R", "C", "H"];
	var obj =
		{"M" : 0
		,"A" : 0
		,"R" : 0
		,"C" : 0
		,"H" : 0};

	var ans = 0;

	for(var i = 1; i < N+1; i++){
		var initial = line[i][0];
		if(initial === "M") obj.M++;
		else if(initial === "A") obj.A++;
		else if(initial === "R") obj.R++;
		else if(initial === "C") obj.C++;
		else if(initial === "H") obj.H++;
	}
	var ia = [];
	for(var key in obj){
		if(obj[key] !== 0) ia.push(obj[key]);
	}
	if(ia.length === 3){
		ans = ia[0]*ia[1]*ia[2];
	} else if(ia.length === 4){
		ans = ia[0]*ia[1]*ia[2] + ia[3]*ia[0]*ia[1] + ia[2]*ia[3]*ia[0] + ia[1]*ia[2]*ia[3];
	} else if(ia.length === 5){
		ans = ia[0]*ia[1]*ia[2] + ia[0]*ia[1]*ia[3] + ia[0]*ia[1]*ia[4] + ia[0]*ia[2]*ia[3] + ia[0]*ia[2]*ia[4]
			+ ia[0]*ia[3]*ia[4] + ia[1]*ia[2]*ia[3] + ia[1]*ia[2]*ia[4] + ia[1]*ia[3]*ia[4] + ia[2]*ia[3]*ia[4];
	}
	console.log(ans);
}

//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 17100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1000000007;
#define pll pair<ll,ll>
#define pii pair<int32_t,int32_t>
#define loop(i,n) for(int64_t i=0; i<n; i++)
#define loop1(i,a,b) for(int64_t i=a; i<=b; i++)
#define rloop(i,n) for(int64_t i=n-1; i>=0; i--) 
#define rloop1(i,a,b) for(int64_t i=a; i>=b; i--) 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define print(val) cout << #val << ": " << val << "\n";
#define print_c(a) cout<<#a<<": ";for(auto it=begin(a);it!=end(a);it++)cout<<*it<<" ";cout<<"\n";
#define fill(c,v) fill(begin(c),end(c),v);
template <typename T> T flip(T val) {reverse(begin(val),end(val)); return val;}

int main() {
  fast_io
  ll t=1; 
  while(t--) {
    int x; cin >> x; int n; cin >> n;
    map<int,int> mp;
    loop(i,n) {
      int temp; cin >> temp;
      mp[temp]++;
    }
    int prev = INT_MAX;
    int ans;
    loop1(i,0,101) {
      if(mp[i]==0) {
        int diff = abs(x-i);
        ans = (diff < prev) ? i : ans;
        prev = diff;
      }
    }
    cout << ans << "\n";
  }
}

Measured memory_bytes: 3568
A = int(input())
B = int(input())
C = int(input())
X = int(input())

cnt = 0
for i in range(A + 1):
    for j in range(B + 1):
        for k in range(C + 1):
            if i * 500 + j * 100 + k * 50 == X:
                cnt += 1
print(cnt)


Measured memory_bytes: 3060
from collections import defaultdict
n=int(input())
d=defaultdict(int)
for _ in range(n):
    d[input()]+=1
d=sorted(d.items(),key=lambda x:x[1],reverse=True)
m=d[0][1]
ans=[]
for k,v in d:
    if v==m:
        ans.append(k)
ans=sorted(ans)
for i in ans:
    print(i)

Measured memory_bytes: 43476
#include<bits/stdc++.h>				//Written by ThiDaiLoc
using namespace std;				//Team Three Wolves
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<ll> vi;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> triple;

#define fu(i,a,b)   for(ll i=a;i<=b;i++)
#define fd(i,b,a)   for(ll i=b;i>=a;i--)
#define fuv(i,a)    for(ll i=0;i<a.size();i++)
#define fdv(i,a)    for(ll i=(ll)a.size()-1;i>=0;i--)
#define ms(a,x)     memset(a, x, sizeof a)
#define prec(n)     fixed<<setprecision(n)
#define uni(a)      (a).erase(unique(all(a)), (a).end())
#define pb(i)       push_back(i)
#define popb()      pop_back()
#define sc(a)       cin>>a
#define sc2(a,b)    cin>>a>>b
#define pr(a)       cout<<a<<endl
#define pr2(a)      cout<<a<<" "
#define bit(n,i)    (((n)>>(i))&1)
#define lowb(a,n,x) lower_bound(a,a+n,x) -a
#define lowb2(a,x)  lower_bound(all(a),x) -a.begin()
#define all(x)      (x).begin(), (x).end()
#define sz(a)       (ll)a.size()
#define le(s)       (ll)s.length()		
#define ast(x,a,b)  assert(x>=a and x<=b)				
#define re          return 	
#define	mp(a,b)     make_pair(a,b)
#define se          second
#define fi          first 
#define debug(x)    cerr << #x << " = " << x << endl
#define INPUT       freopen("locin.txt", "r", stdin)
#define OUTPUT      freopen("locout.txt", "w", stdout)
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline ll minize(ll& a,ll b){return a=(a>b?b:a);}
inline ll maxize(ll& a,ll b){return a=(a<b?b:a);}
inline string toString(ll n) {stringstream ss; ss << n;return ss.str();}
double const eps = 1e-6;
ll const Base=1e9+7,oo=1e17,MAXN=1e6;


string A[MAXN+5];
ll B[MAXN+5];
ll cmp(ll a,ll b){
	re B[a]<B[b];
}
ll Solves(){
	
	ll n,m,k,cnt=0,ans=0,x,y,q,c,sum=0,v,t;
	// PROCESS IN HERE
	vi vec;
	sc(n);
	fu(i,1,n){
		sc(A[i]);
		vec.pb(i);
		if(A[i][le(A[i])-1]=='A' and A[i][0]!='B')B[1]++;
		else if(A[i][le(A[i])-1]=='A' and A[i][0]=='B')B[2]++;
		else if(A[i][0]=='B')B[3]++;
	//	else B[i]=4;	
		fu(j,1,le(A[i])-1)if(A[i][j]=='B' and A[i][j-1]=='A')ans++;
	}
	
	
	c=min(B[1],B[3]);
	if(c>=1)ans+=c+B[2];
	else ans+=max(0LL,B[2]+(B[1]>0 or B[3]>0?0:-1));
	
	
	
	pr(ans);
	re 0;
	// Hack it if you can :)
}

int main(){
	//INPUT;
	ll JUDGE_ONLINE = 1;
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll test=1;
//	sc(test);
	fu(T,1,test){
//		cout<<"Case #"<<T<<": ";
		Solves();
	}
	if (!JUDGE_ONLINE) cout << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";  
		
}

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

using namespace std;


using int64 = long long;
const int mod = 1e9 + 7;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N, K;
  cin >> N >> K;
  vector< int > H(N + 2);
  for(int i = 1; i <= N; i++) cin >> H[i];
  N += 2;

  vector< int > xs(H);
  xs.emplace_back(0);
  sort(begin(xs), end(xs));
  xs.erase(unique(begin(xs), end(xs)), end(xs));
  for(int i = 0; i < N; i++) {
    H[i] = lower_bound(begin(xs), end(xs), H[i]) - begin(xs);
  }


  auto dp2 = make_v< int64 >(K + 2, xs.size());
  fill_v(dp2, infll);
  for(int i = 0; i <= K; i++) dp2[i][0] = 0;

  for(int i = 1; i < N; i++) {
    auto dp3 = make_v< int64 >(K + 2, xs.size());
    fill_v(dp3, infll);
    for(int k = 0; k <= K; k++) {
      int64 pref = infll;
      for(int l = 0; l < xs.size(); l++) {
        chmin(pref, dp2[k][l] - xs[l]);
        chmin(dp3[k + (H[i] != l)][l], pref + xs[l]);
      }
      int64 suf = infll;
      for(int l = (int) xs.size() - 1; l >= 0; l--) {
        chmin(suf, dp2[k][l] + xs[l]);
        chmin(dp3[k + (H[i] != l)][l], suf - xs[l]);
      }
    }
    dp2.swap(dp3);
  }


  cout << dp2[K][0] / 2 << endl;
}





Measured memory_bytes: 1760
mod = 10**9+7
n, m = map(int, input().split())
stairs = [0]*(n+1)
broken = []
stairs[0] = 1

def binSearch(broken, e):
    l, r = 0, m-1

    while l <= r:
        mid = (l+r)//2

        if broken[mid] > e:
            r = mid - 1
        elif broken[mid] < e:
            l = mid + 1
        else:
            return True
    return False


for i in range(m):
    b = int(input())
    if broken and b-1 == broken[-1]:
        print(0)
        exit(0)
    broken.append(b)

for i in range(n+1):
    if binSearch(broken, i):
        continue
    if i >= 2:
        stairs[i] = stairs[i-1] + stairs[i-2]
    elif i == 1:
        stairs[i] = stairs[i-1]

print(stairs[-1]%mod)


Measured memory_bytes: 460020
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.linalg import spsolve

N = int(input())
b = np.array(input().split())

rows = np.concatenate([np.arange(N), np.arange(N)])
cols = np.concatenate([np.arange(N), np.arange(1,N+1) % N])

A = csr_matrix(([1] * (2*N), (rows, cols)), (N,N))

x = (spsolve(A, b) * 2 + .5).astype(int)

print(*x)

Measured memory_bytes: 66048
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define mp make_pair
using namespace std;
const int inf = 1e18 + 7;
const int N = 1e6 + 7;
const int md = 1e9 + 7;
void sol() {
  int a, b;
  cin >> a >> b;
  cout << 6 - (a + b);
  
}

int32_t main() 
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  //cin >> T; while(T--) 
  sol();
  return 0;
}


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

int main() {
  string S;
  cin >> S;
  cout << (S.at(0) == S.at(1) ? "Bad" : (S.at(1) == S.at(2) ? "Bad" : (S.at(2) == S.at(3) ? "Bad" : "Good"))) << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
#include<math.h>
#include <stdlib.h>
#include<ctype.h>
typedef long long LL;
#define rep(i,n) for(LL i=0; i<(LL)(n); i++)

//qsort
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}

//比較
int max(int a, int b){
	if (a>b) return a;
	else return b;
}

int min(int a,int b) {
	if(a>b) return b;
	else return a;
}


//main関数
int main() {
	LL N;
	scanf("%lld",&N);
	LL AA[N];
	LL ans = 0;
	rep(i,N){
		scanf("%lld",&AA[i]);
		if(AA[i] < AA[i-1] && i != 0){
			ans += AA[i-1] - AA[i];
			AA[i] = AA[i-1];
		}	
	}
	printf("%lld",ans);
}








Measured memory_bytes: 3288
/***********************************
*******AUTHOR SHASHI KANT **********         
****GMAIL Shshiksnt140895@gmail.com*
************************************                                  
***********************************/
#include <bits/stdc++.h>
#define ll long long int
using namespace std;
/*class graph
{
	map<int,list<int>>adj;
	public :
	       void addedge(int a, int b)
	       {
	           adj[a].push_back(b);
	           adj[b].push_back(a);
	       }

}*/
//vector<vector<int>>dp(1000000);
int dp[3005][3005];
string lcsString( string &str1, string &str2, int len)
{
      
	string LCS;
	int i=0; int j =0;
	while(len > 0)
	{
		if(str1[i] == str2[j])
		{
			LCS.push_back(str1[i]);
			i++;
			j++;
			len--;
		}
		else
		{
            if(dp[i+1][j] > dp[i][j+1])
            	i++;
            else
            	j++;
		}
	}
	return LCS;
}

int lcs( string &str1, string &str2, int i, int j)
{

	if(i>=str1.size() || j>=str2.size())
		return 0;

	if(dp[i][j] != -1)
		return dp[i][j];

	if(str1[i] == str2[j])
	{
		dp[i][j] = 1+lcs( str1, str2, i+1, j+1);
		return dp[i][j];
	}
	else
	{
         int l1 = lcs( str1, str2, i+1, j);
         int l2 = lcs( str1, str2, i, j+1);
         dp[i][j] =  max(l1, l2);
         return dp[i][j];
	}


}
int main(){
      
       	string str1, str2;
       	cin>>str1>>str2;
       	  int n = str1.size();
	      int m = str2.size();

     memset(dp, -1, sizeof(dp));

     int len = lcs( str1, str2, 0, 0) ;
           cout<< lcsString( str1, str2, len) ;
     
	return 0;
}

Measured memory_bytes: 35968
module Main
  ( main
  )
where

import           Control.Applicative
import           Control.Monad
import           Data.List
import           Data.Array
import           Data.Char
import           Data.Bits
import qualified Data.ByteString.Char8 as BS
import Data.Maybe

parseInt = fst . fromJust . BS.readInt
readInt = parseInt <$> BS.getLine
readIntList = map parseInt . BS.words <$> BS.getLine

main = do
  n <- readInt
  [s, t] <- words <$> getLine
  putStrLn $ merge s t

merge (x:xs) (y:ys) = x:y:merge xs ys
merge [] [] = []


Measured memory_bytes: 508
//84104971101048411497 - Can you guess what does this mean?
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef complex<double> point;
#define mapii map<int, int>
#define debug(a) cout << #a << ": " << a << endl
#define debuga1(a, l, r) fto(i, l, r) cout << a[i] << " "; cout << endl
#define fdto(i, r, l) for(int i = (r); i >= (l); --i)
#define fto(i, l, r) for(int i = (l); i <= (r); ++i)
#define forit(it, var) for(__typeof(var.begin()) it = var.begin(); it != var.end(); it++)
#define forrit(rit, var) for(__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); rit++)
#define ii pair<int, int>
#define iii pair<int, ii>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define maxN 100005
#define maxH 205
#define oo 2000000007
#define sz(a) (int)a.size()

const double PI = acos(-1.0);

double fRand(double fMin, double fMax)
{
    double f = (double)rand() / RAND_MAX;
    return fMin + f * (fMax - fMin);
}

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int n, H, degIn[2][maxH], degOut[2][maxH], cnt, edgeCnt;
vector<ii> g[2][maxH];
bool visited[2][maxN];

bool DFS(int i, int h) {
//    printf("%d %d\n", i, h);
    if (degIn[i][h] != degOut[i][h]) ++cnt;
    visited[i][h] = true;
    for(ii p: g[i][h]) {
        ++edgeCnt;
        if (!visited[p.ff][p.ss]) DFS(p.ff, p.ss);
    }
}

bool Solve() {
    fto(h, 1, H) {
        if (degIn[0][h] > degOut[0][h]) return false;
        if (degIn[1][h] < degOut[1][h]) return false;
    }
    fto(i, 0, 1) {
        fto(h, 1, H) {
            if (!visited[i][h]) {
                edgeCnt = cnt = 0;
                DFS(i, h);
                if (edgeCnt > 0 && cnt == 0) return false;
            }
        }
    }
    return true;
}

int main () {
    scanf("%d%d", &n, &H);
    fto(i, 1, n) {
        int A, B, C, D;
        scanf("%d%d%d%d", &A, &B, &C, &D);

        ii u, v;
        if (C == 0) u = mp(0, A);
        else u = mp(1, C);
        if (D == 0) v = mp(1, B);
        else v = mp(0, D);

        ++degOut[u.ff][u.ss]; ++degIn[v.ff][v.ss];
        g[u.ff][u.ss].pb(mp(v.ff, v.ss));
        g[v.ff][v.ss].pb(mp(u.ff, u.ss));
    }

    puts((Solve()) ? "YES" : "NO");

    return 0;
}


Measured memory_bytes: 3200