akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

const string YES = "Yes";
const string NO = "No";
const ll mod = 1e9+7;



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

    ll n; cin >> n;
    vll p(n);
    REP(i,n) cin >> p[i];

    ll mn = p[0];
    int count = 0;
    REP(i,n){
        if (mn >= p[i]){
            mn = p[i];
            count++;
        }
    }
    cout << count << endl;
    return 0;
}



Measured memory_bytes: 1792
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;
 
public class Main {
	private static FastScanner sc = new FastScanner();
	
	public static void main(String[] args) {
		String s = sc.next();
		if(s.startsWith("YAKI")) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
	
	static class FastScanner {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if(ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch(IOException e) {
                    e.printStackTrace();
                }
                if(buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
        private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
        private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
        private void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public long nextLong() {
            return Long.parseLong(next());
        }
        public int nextInt(){
            return Integer.parseInt(next());
        }
        public double nextDouble(){
            return Double.parseDouble(next());
        }
    }
}


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

#define ft first
#define sd second
#define pb push_back
#define all(x) x.begin(),x.end()

#define ll long long int
#define vi vector<int>
#define vii vector<pair<int,int> >
#define pii pair<int,int>
#define plii pair<pair<ll, int>, int>
#define piii pair<pii, int>
#define viii vector<pair<pii, int> >
#define vl vector<ll>
#define vll vector<pair<ll,ll> >
#define pll pair<ll,ll>
#define pli pair<ll,int>
#define mp make_pair
#define ms(x, v) memset(x, v, sizeof x)
#define pr_vec(v) for(int i=0;i<v.size();i++) cout << v[i] << " " ;

#define f_in(st) freopen(st,"r",stdin)
#define f_out(st) freopen(st,"w",stdout)

#define fr(i, a, b) for(i=a; i<=b; i++)
#define fb(i, a, b) for(i=a; i>=b; i--)
#define ASST(x, l, r) assert( x <= r && x >= l )
const int  p=31,po=1,N=1e5+10, M=(ll)1e9+1 ;
const int mod = 1e9+7 ;
vl compute(string s){
        vl has(s.length());
        ll i;

        for(i=0;i<s.length();i++){
            if(i==0){
                has[i]=((s[i]-'a'+1))%mod;
            }
            else
                has[i]=(has[i-1]*p + (s[i]-'a'+1))%mod;
        }
        return has;
}
// vl ed[N],g[N],in(N),vis(N,0),cost(N,0);
vl g[N],vis(N,0);
vll b,d;
priority_queue<ll,vl,greater<ll>> pq;
ll root[N],si[N];
void initial(ll n){
    int i;
    for(i=1;i<=n;i++){
        root[i]=i;
        si[i]=1;
    }
    return ;
}

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

ll merge(ll x,ll y){

  ll r1=rt(x),r2=rt(y);
      // cout << x << " r " << y << " " << r1 << "  " << r2 << endl;

  if(r1==r2){
      // cout << x << " " << y << endl;
      d.pb(mp(x,y));
      return 1;
  }
  if(si[r1]<si[r2])
    swap(r1,r2);
  // cout << x << " l " << y << endl;
  si[r1]+=si[r2];
  si[r2]=0;
  root[r1]=root[r2];
  return 0;
}
int main(){
 ios_base::sync_with_stdio(0);
   ll n,m,i;
   cin >> n >> m;
   if(n>=m){
      cout << 0;
      return 0;
   }
   
   
   vl a(m),dif;
   for(i=0;i<m;i++)
    cin >> a[i];
    sort(a.begin(),a.end());
   for(i=1;i<m;i++)
    dif.pb(a[i]-a[i-1]);
   sort(dif.rbegin(),dif.rend());
   ll ans=a[m-1]-a[0];
   for(i=0;i<n-1;i++)
    ans-=dif[i];
   cout << ans;
  return 0;
}

Measured memory_bytes: 5368
#include "bits/stdc++.h"

#define rep(i,n) for(int i = 0;i<n;i++)
#define vv(Type,Name, n,m,d)vector<vector<Type>> Name(n, vector<Type>(m, d))
#define P pair
using namespace std;
using ll = long long;


int main(void) {

	ios::sync_with_stdio(false);
	cin.tie(0);

	ll n, d;
	cin >> n >> d;
	d *= d;
	ll ans = 0;
	while (n--) {
		ll x, y;
		cin >> x >> y;
		x *= x;
		y *=y;
		if (x + y <= d)ans++;


	}

	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3648
def main():
    t = list(map(int, input().split()))
    ans = ''
    if t[1] >= t[2]:
        ans = 'delicious'
    elif t[0] >= t[2] - t[1]:
        ans = 'safe'
    if t[0] < t[2] - t[1]:
        ans = 'dangerous'
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#define int long long
#define boost() ios_base :: sync_with_stdio(0); cin.tie(); cout.tie(); cout << fixed; cout << setprecision(15); srand(time(NULL))
#define all(x) x.begin(), x.end()
using namespace __gnu_pbds;
using namespace std;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

int n, h[100010];
int dp[100010][5];

int sol (int idx, int jump) {
  if (idx >= n) return INT_MAX;
  if (idx == n - 1) return 0;
  int &ret = dp[idx][jump];
  if (ret != -1) return ret;
  ret = INT_MAX;
  ret = min (ret, sol (idx + jump, 1) + abs (h[idx] - h[idx + jump]));
  ret = min (ret, sol (idx + jump, 2) + abs (h[idx] - h[idx + jump]));
  return ret;
}

signed main () {
  cin >> n; memset (dp, -1, sizeof dp);
  for (int i = 0; i < n; i++) cin >> h[i];
  cout << min (sol (0, 1), sol (0, 2)) << endl;
  return 0;
}


Measured memory_bytes: 8064
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n, t = na()
ans = 10000
for i in range(n):
    ci, ti = na()
    if ti <= t:
        ans = min(ci, ans)
if ans == 10000:
    print("TLE")
else:
    print(ans)

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

int main() {
    string s;
    cin >> s;
    bool a=1;
    for(int i =0;i<s.size();i++){
        if(s[i]==s[i+1]){
            a=0;
            break;
        }
    }
    
    if(a){
        cout << "Good";
    }else{
        cout << "Bad";
    }
    
    
}


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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;


signed main(){
    int n, k, q;
    cin >> n >> k >> q;
    vector<int> a(n);
    for(auto& x : a)
        cin >> x;
    auto b = a;
    sort(b.begin(), b.end());
    b.erase(unique(b.begin(), b.end()), b.end());

    // [t, INF)の中でq個選ぶ
    auto f = [&](int t){
        vector<vector<int>> v(1, vector<int>(0));
        for(auto& x : a){
            if(x >= t)
                v.back().emplace_back(x);
            else if(!v.back().empty())
                v.emplace_back(0);
        }
        if(v.back().empty())
            v.pop_back();

        for(auto& w : v){
            w.emplace_back(0);
            sort(w.begin(), w.end());
            w.resize(max(0, (int)w.size() - k + 1));
            if(w.empty())
                w.emplace_back(0);
        }
        vector<int> dp(1, 0);
        int ns = 0;
        for(auto& w : v){
            int ne = ns + w.size() - 1;
            vector<int> nex(ne + 1, 2 * MOD);
            for(int i = 0; i <= ns; ++i)
                for(int j = 0; j < w.size(); ++j)
                    nex[i + j] = min(nex[i + j], max(dp[i], w[j]));
            ns = ne;
            dp = move(nex);
        }
        int ret = ns < q ? 2 * MOD : dp[q];
        return ret;
    };

    int ans = MOD;
    for(auto& x : b)
        ans = min(ans, f(x) - x);
    cout << ans << endl;
}


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

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var l = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int D = l[0], X = l[1];

            var sum = 0;
            for (var i = 0; i < N; i++)
            {
                var a = int.Parse(Console.ReadLine());
                var count = 1;

                while (count <= D)
                {
                    sum++;
                    count += a;
                }
            }
            Console.WriteLine(X + sum);
        }
    }
}


Measured memory_bytes: 13268
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;


int main(){
  int n;
  while(scanf("%d",&n),n){
    typedef set<pair<int,int> > S;
    S s;
    REP(i,n){
      int x,y; scanf("%d%d",&x,&y);
      s.insert(mp(x,y));
    }

    int ans = 0;
    for(S::iterator it1 = s.begin(); it1 != s.end(); it1++){
      for(S::iterator it2 = s.begin(); it2 != s.end(); it2++){
        if(it1 == it2) continue;
        int x1 = it1->f;
        int y1 = it1->s;
        int x2 = it2->f;
        int y2 = it2->s;
        int dx = x2 - x1;
        int dy = y2 - y1;
        int x3 = x1 - dy;
        int y3 = y1 + dx;
        int x4 = x2 - dy;
        int y4 = y2 + dx;


        if(s.find(mp(x3,y3)) != s.end() && s.find(mp(x4,y4)) != s.end()){
#define DBL(x) ((x)*(x))
          ans = max(ans, DBL(x1-x2)+DBL(y1-y2));
        }
      }
    }
    printf("%d\n",ans);
  }

  return 0;
}

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

int main() {
	int a, b, c;
	cin >> a >> b >> c;
  	if(a+b+c >= 22) cout << "bust" << endl;
  	else cout << "win" << endl;
}


Measured memory_bytes: 3612
import math
buff = list(map(int, input().split()))










# buff = [A, B, C]

buff.sort()
med = buff[2]-buff[1]

buff[0] = buff[0]+med
tyuk = buff[2]-buff[0]

if tyuk % 2 == 0:
    print(tyuk//2+med)
else:
    print(tyuk//2+med+2)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

ll A,B,C;

int main(){
	cin>>A>>B>>C;
	if(A+B+1>=C) cout<<B+C<<endl;
	else cout<<B+C-(C-A-B)+1<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h> 
#include<algorithm> 
#include<vector> 
using namespace std; 
#define PI acos(-1)
//const double PI =  3.1415926;
int main() 
{ 
	int k,n;
	cin>>k>>n;
	int s=0;
	for(int i=0;i<n;i++){
	    int x;
	    cin>>x;
	    s+=x;
	}
	if(k>=s){
	    cout<<k-s<<"\n";
	}
	else puts("-1");
} 


Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int n,l,Min=1e9,ans;
int main() {
	scanf("%d%d",&n,&l);
	for(int i=1;i<=n;i++)if(abs(i+l-1)<abs(Min))Min=i+l-1;
	for(int i=1;i<=n;i++)ans+=i+l-1;
	printf("%d\n",ans-Min);
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#define MAX 2000
using namespace std;
int main(){
	int n,m;
	int f[MAX],s[MAX];
	while(cin>>n>>m,n||m){
		for(int i=1;i<=n;i++)
			cin>>f[i];
		for(int i=0;i<m;i++){
			cin>>s[i];
		}
		int now=1;
		for(int i=0;;i++){
			now+=s[i];
			if(now>=n){
				cout<<i+1<<endl;
				break;
			}else{
				now+=f[now];
				if(now>=n){
				cout<<i+1<<endl;
				break;
				}
			}
			
//			cout<<"   "<<now<<endl;

		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using ll = long long;
using P = std::pair<ll, ll>;

template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << "[" << pa.first << ", " << pa.second << "]";
}

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

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << i << std::endl

// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;

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

  ll n;

  std::cin>>n;

  std::vector<std::vector<ll>> graph(n,std::vector<ll>(n,MOD));

  rep(i,0,n)graph[i][i]=0;

  std::vector<ll> color(n,-1);

  rep(i,0,n){
    rep(j,0,n){
      char temp;
      std::cin>>temp;
      if(temp=='1'){
        graph[i][j]=1;
      }
    }
  }

  if(n==2){
    std::cout<<2;
    return 0;
  }

  std::stack<P> que;

  que.push({0,0});
  color[0]=0;

  while(!que.empty()){
    P e=que.top();que.pop();
    rep(next,0,n){
      if(graph[e.first][next]==1){
      if(color[next]!=-1){
        if(color[next]!=e.second^1){
          std::cout<<-1;
          return 0;
        }
      }else{
        color[next]=e.second^1;
        que.push({next,color[next]});
      }
      }
    }
  }

  rep(k,0,n){
    rep(i,0,n){
      rep(j,0,n){
        graph[i][j]=std::min(graph[i][j],graph[i][k]+graph[k][j]);
      }
    }
  }

  ll ans=0;

  rep(k,0,n){
  rep(i,0,n){
    rep(j,0,n){
      if(graph[k][i]+graph[k][j]==graph[i][j]){
        ans=std::max(ans,graph[k][i]+graph[k][j]+1);
      }
    }
  }
  }

  std::cout<<ans;

  return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,n) for (int i=(n-1);i >= 0;i--)
#define all(v) v.begin(),v.end()
#define sz(v) (int)((v).size())
#define MAX(v) *max_element(all(v))
#define MIN(v) *min_element(all(v))
using namespace std; using ll = long long; using P = pair<int,int>;
using vl = vector<ll>; using vvl = vector<vl>;
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << H << " ";
    debug_out(T...);
}
#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
    for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
    return os;
}
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
template<class T>bool chmax(T &a, const T &b) {if(a<b){a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) {if(b<a){a=b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll mod = 1000000007;
const int dx[8] = {1,0,-1,0,1,1,-1,-1}; const int dy[8] = {0,1,0,-1,1,1,-1,-1};

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    int n,m;
    cin >> n >> m;
    vl h(n);
    rep(i,n) cin >> h[i];
    vector<vector<int>> G(n,vector<int>());
    set<P> st;
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--; b--;
        if(st.count(P(a,b))==0 && st.count(P(b,a))==0){
            G[a].push_back(b);
            G[b].push_back(a);
        }
        st.insert(make_pair(a,b));
        st.insert(make_pair(b,a));
    }
    vector<int> cnt(n,1);
    rep(i,n){
        for(auto v : G[i]){
            if(h[i] <= h[v]) cnt[i]=0;
        }
    }
    int ans = 0;
    rep(i,n) ans += cnt[i];
    cout << ans << endl;
}

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

using namespace std;

string s;
int fcv[100], N, M, D, Q, l, r;
long long sol;
vector <pair<int, int>> a[300 * 300 + 5];

int main() {
    ios_base::sync_with_stdio(false);
    cin >> N;
    
    cout << (N / 3) << '\n';
    return 0;
}


Measured memory_bytes: 2432
#include <stdio.h>

int main(){
    
    int a = 0;
    int b = 0;
    char op = 0;
    int i = 0;
    
    for(i;i<500;i++){
        scanf("%d %c %d",&a,&op,&b);
        
        switch(op){
         case '+':
             printf("%d\n",(a+b));
             break;
         
         case '-':
             printf("%d\n",(a-b));
             break;
         
         case '/':
             printf("%d\n",(a/b));
             break;
         
         case '*':
             printf("%d\n",(a*b));
             break;
         
         case '?':
             return 0;
         
         default :
             break;
        }
    }
    
    return 0;
}


Measured memory_bytes: 2048
# -*- coding: utf-8 -*-
import sys
N=int(sys.stdin.readline().strip())
S=sys.stdin.readline().strip()

ans=0
for d in range(1,N):
    cnt=0
    for s,t in zip(S[d:N],S[:N-d]):
        if s==t:
            cnt+=1
        else:
            ans=max(ans,min(d,cnt)) #最大の文字列一致はd以下
            cnt=0
    else:
        if 0<cnt:   #最後の文字が一致していた場合
            ans=max(ans,min(d,cnt))    #残ったcntも答えの候補になる
print ans

Measured memory_bytes: 108316
#include<iostream>
#include<math.h>
#include<bits/stdc++.h>
#define ll long long int
#define hell 1000000007LL
using namespace std;
ll power(ll x, ll y){ 
    if(y==0)
     return 1;
    else
    {
        ll p=power(x,y/2);
        if(y%2==0)
         return (p*p)%hell;
        else
        return (x*((p*p)%hell))%hell;
    }}
ll gcd(ll x,ll y)
{
    if(y==0)
     return x;
    else
    return gcd(y,x%y);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(20);
   string s,t;
   cin>>s>>t;
   ll c=0;
   if(s.length()==t.length())
   {
       for(int i=0;i<s.length();i++)
       {
           if(s[i]!=t[i])
           c++;
       }
   }
   cout<<c;}
    
    
    
    
    
    
    
    
    
   
      

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

int main(){
    int x[5]={0};
    for(int i=0;i<5;i++){
        scanf("%d",&x[i]);
        if(x[i]==0){
            printf("%d",i+1);
        }
    }

    return 0;
}

Measured memory_bytes: 1724
// #pragma GCC optimize ("O3")
// #pragma GCC target ("sse4")

#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 29;
const int NINF = -1*INF;
const long long LLINF = 1ll << 60;
const long long LLNINF = -1*LLINF;

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
 
typedef pair<int, int> pi;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pd;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<pi> vpi;
typedef vector<vector<int>> vvi;
typedef vector<vll> vvll;
typedef vector<vd> vvd;
typedef vector<vld> vvld;
 
#define mp make_pair
#define pb push_back
#define pf push_front
#define all(x) x.begin(), x.end()
#define revAll(x) x.rbegin(), x.rend()
#define gcd(a, b) __gcd(a, b)
#define isize(x) (int)(x.size())
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define umap unordered_map


int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);
	int n; cin >> n;
	vi A = vi();
	rep(i, n){
		int x; cin >> x;
		A.pb(x);
	}
	vvll dp = vvll(n, vll(n, 0));
	// dp[i][j] = max X - Y for Ai,...,Aj
	// dp[i][j] = max(A[i] - dp[i+1][j], A[j] - dp[i][j-1])
	rep(i, n){
		dp[i][i] = A[i];
	}
	for(int c = 1; c < n; c++){
		for(int r = c-1; r >= 0; r--){
			dp[r][c] = max(A[r] - dp[r+1][c], A[c] - dp[r][c-1]);
		}
	}
	cout << dp[0][n-1];
}

Measured memory_bytes: 73684
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

class Program
{
    static void Main(string[] args)
    {
        long x = ConsoleUtil.LongReadLine();

        //6と5のハメで取れるとこまで取る
        long ans = (x / 11) * 2;
        long mod = x % 11;

        if (mod == 0)
        {

        }
        else if (mod <= 6)
        {
            ans += 1;
        }
        else
        {
            ans += 2;
        }

        Console.WriteLine(ans);
    }
}

static class MathUtil
{
    static IEnumerable<int> EnumeratePrimeNumbers()
    {
        List<int> primes = new List<int>() { 2 };
        yield return 2;

        for (int i = 3; i < int.MaxValue; i++)
        {
            bool isPrime = true;
            int Sqrt = (int)Math.Sqrt(i) + 1;

            foreach (var prime in primes)
            {
                if (prime > Sqrt)
                {
                    break;
                }
                if (i % prime == 0)
                {
                    isPrime = false;
                    break;
                }
            }

            if (isPrime)
            {
                primes.Add(i);
                yield return i;
            }
        }
    }
}

static class ConsoleUtil
{
    public static string[] StrArrayReadLine(char sepalator)
    {
        string str = Console.ReadLine();
        return str.Split(sepalator).ToArray();
    }
    public static string[] StrArrayReadLine()
    {
        string str = Console.ReadLine();
        if (str.Contains(','))
        {
            return str.Split(',').ToArray();
        }
        {
            return str.Split(' ').ToArray();
        }
    }
    public static int[] IntArrayReadLine()
    {
        return StrArrayReadLine().Select(s => int.Parse(s)).ToArray();
    }
    public static int[] IntArrayReadLine(char sepalator)
    {
        return StrArrayReadLine(sepalator).Select(s => int.Parse(s)).ToArray();
    }
    public static int IntReadLine() => int.Parse(Console.ReadLine());
    public static long LongReadLine() => long.Parse(Console.ReadLine());
}

Measured memory_bytes: 11092
#include <stdio.h>
#define ll long long

int main(void) {
	ll a, b, n;
	scanf("%ld%ld%ld", &a, &b, &n);

	// (A * x - (A * x % B)) / B - A * (x - x % B) / B
	ll x = (n >= b ? n / b * b - 1 : n);
	printf("%ld\n", (a * x) / b - a * (x / b));
	return 0;
}


Measured memory_bytes: 1736
#include <iostream>
    #include <stack>
    #include <vector>
     
    int main() {
    int n;
    std::stack<int> stc;
    std::vector<int> ans;
     
    while (std::cin >> n) {
    if (n == 0) {
    ans.push_back(stc.top());
    stc.pop();
    } else {
    stc.push(n);
    }
    }
     
    for (auto n : ans) {
    std::cout << n << std::endl;
    }
    }

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

int main() {
  int n;
  cin >> n;
  vector<int>a(n);
  vector<int>b(n);
  for(int i=0;i<n;i++){
  cin >> a.at(i);
  }
  for(int i=0;i<n;i++){
  b.at(a.at(i)-1)=i+1;
  }
  for(int i=0;i<n;i++){
  cout << b.at(i) << " "; 
  }  
}

Measured memory_bytes: 1536
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

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

int main()
{
    int N;
    cin>>N;
    int p[N];
    rep(i,N)
    {
        cin>>p[i];
    }

    int sum = 0;

    for(int i= 1;i<N-1;i++)
    {
                
        if( (p[i-1]<p[i] && p[i]<p[i+1]) || (p[i+1]<p[i] &&p[i]<p[i-1]) )
        {
            sum++;
        }

    }
    cout<<sum<<endl;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
def main():
    from math import factorial

    def calc(x):
        ret = 1
        for i in range(x):
            ret = ret * (n - i) % mod
        return ret * pow(factorial(x), mod - 2, mod) % mod

    n, a, b = map(int, input().split())
    mod = 10 ** 9 + 7

    print(max(0, (pow(2, n, mod) - ((calc(a) + calc(b)) % mod) - 1) % mod))


if __name__ == '__main__':
    main()


Measured memory_bytes: 11356
#include<bits/stdc++.h>
using namespace std;
#define fio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define inf 1000000009
#define N 100009

ll a[N],b[N],c[N];
ll dp[N][3];
ll n;
ll vac(ll i,ll p)
{
    if(i==n)
    return 0;
    
    
    
    if(p==-1)
    dp[i][p]= max( c[i]+vac(i+1,2),max(a[i]+vac(i+1,0),b[i]+vac(i+1,1)) );
    if(dp[i][p]!=-1)
    return dp[i][p];
    
    if(p==0)
    dp[i][p]= max(b[i]+vac(i+1,1),c[i]+vac(i+1,2));
    if(p==1)
    dp[i][p]= max(a[i]+vac(i+1,0),c[i]+vac(i+1,2));
    if(p==2)
    dp[i][p]= max(a[i]+vac(i+1,0),b[i]+vac(i+1,1));
    
    return dp[i][p];
}
int main()
{
    cin>>n;
    for(ll i=0;i<n;i++)
    cin>>a[i]>>b[i]>>c[i];
    
    memset(dp,-1,sizeof(dp));
    ll res=vac(0,-1);
    cout<<res;
}

Measured memory_bytes: 11136
#include <iostream>
#include <vector>

using namespace std;

int main(){
    int h, w;
    cin >> h >> w;
    vector<vector<int>> as(h, vector<int>(w));
    vector<vector<int>> log;
    for(int hi=0; hi<h; ++hi){
        for(int wi=0; wi<w; ++wi){
            int a;
            cin >> a;
            as[hi][wi]=a;
        }
    }
    for(int hi=0; hi<h; ++hi){
        if(hi%2==0){
            for(int wi=0; wi<w; ++wi){
                if(as[hi][wi]%2){
                    --as[hi][wi];
                    if(wi<w-1){
                        ++as[hi][wi+1];
                        log.push_back({hi, wi, hi, wi+1});
                    } else{
                        if(hi+1<h){
                            ++as[hi+1][wi];
                            log.push_back({hi, wi, hi+1, wi});
                        }
                    }
                }
            }
        } else{
            for(int wi=w-1; wi>=0; --wi){
                if(as[hi][wi]%2){
                    --as[hi][wi];
                    if(wi>0){
                        ++as[hi][wi-1];
                        log.push_back({hi, wi, hi, wi-1});
                    } else{
                        if(hi+1<h){
                            ++as[hi+1][wi];
                            log.push_back({hi, wi, hi+1, wi});
                        }
                    }
                }
            }
        }
    }
    cout << log.size() << endl;
    for(int i=0; i<log.size(); ++i){
        for(int j=0; j<4; ++j){
            if(j) cout << " ";
            cout << log[i][j]+1;
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 10032
A, B, C, D, E, F = map(int, input().split())

w = set()
for i in range(F // (100 * A) + 1):
    t = F - 100 * i
    for j in range(t // (100 * B) + 1):
        a = (A * i + B * j) * 100
        w.add(a)
w.remove(0)

s = set()
t = E * F // 100
for i in range(t // C + 1):
    for j in range(t // D + 1):
        b = C * i + D * j
        if b < t:
            s.add(b)

best_concentration = -1
best_a = -1
best_b = -1
for a in w:
    for b in sorted(s):
        if a + b > F:
            break
        if b > E * a // 100:
            break
        concentration = 100 * b / (a + b)
        if concentration > best_concentration:
            best_concentration = concentration
            best_a = a
            best_b = b
print(best_a + best_b, best_b)


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

int main()
{
    int n=0, cnt=0;
    string str;
    cin >> n >> str;
    
    for(int i=0; i<n-2; i++){
        if(str[i]=='A' && str[i+1]=='B' && str[i+2]=='C'){cnt++;}
    }
    
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a[1000],n;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int p;
  cin>>p;
  for(int i=0;i<p;i++){
    int x,y,z;
    cin>>x>>y>>z;
    swap_ranges(a+x,a+y,a+z);
  }
  for (int i=0;i<n;i++){
    if(i!=0) cout<<" ";
    cout<<a[i];
  }
  cout<<endl;
  
  return 0;
}


Measured memory_bytes: 3096
package main

import (
  "fmt"
)

func main() {

  var s string

  fmt.Scan(&s)

  var result string
  
  result = "Yes"
  for pos, char := range s {
    if pos % 2 != 0 {
      if char == 'R' {
        result = "No"
        break
      }
    } else {
      if char == 'L' {
        result = "No"
        break
      }
    }
  }
  
  fmt.Println(result)
}

Measured memory_bytes: 512
using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static void Main()
    {
        var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
        if (input[1] - input[0] == input[2] - input[1])
        {
            Console.WriteLine("YES");
        }
        else
        {
            Console.WriteLine("NO");
        }
    }
}

Measured memory_bytes: 11220
#include<iostream>
#include <stdio.h>

using namespace std;

int main(){
	double a,b,c,d,e,f;
	double x,y;
	while(cin>>a>>b>>c>>d>>e>>f){

		x=(e*c-f*b)/(e*a-b*d);
		y=(d*c-f*a)/(b*d-a*e);
		if(x<=0&&x>=(-0.0005))x=0;
		if(y<=0&&y>=(-0.0005))y=0;
		printf("%.3f %.3f\n",x,y);
		
	}
}

Measured memory_bytes: 1236
function myout(text){console.log(text);}//standard output
function Main(input) {
	//input = parseInt(input);
	//input = input.trim().split(" ");
	input = input.trim().split("\n");
	//input = input.trim().split(" ").map((a)=>Number(a));
	//input = input.trim().split("\n").map((a)=>Number(a));
  var N = parseInt(input[0].split(" ")[0]);
  var M = parseInt(input[0].split(" ")[1]);
  var C = parseInt(input[0].split(" ")[2]);
  var bList = input[1].split(" ").map((a)=>Number(a));
  var output = 0;
  for(var i = 2; i <= N + 1; i++){
    var code = 0;
    var aList = input[i].split(" ").map((a)=>Number(a));
    for(var j = 0; j < aList.length; j++){
      code += aList[j] * bList[j];
    }
    code += C;
    if(code > 0){
       output++;
       }
  }
  myout(output);
  
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


Measured memory_bytes: 11596
#include<stdio.h>

int main(void){
  int n,cha,count=0;

  while(1){

    count=0;

    scanf("%d",&n);
    if(n == 0) break;

    cha=1000-n;

    if(cha >= 500){
      cha -= 500;
      count++;
    }

    while(cha >= 100){
      cha -= 100;
      count++;
    }

    if(cha >= 50){
      cha -= 50;
      count++;
    }

    while(cha >= 10){
      cha -= 10;
      count++;
    }

    if(cha >= 5){
      cha -= 5;
      count++;
    }

    while(cha >= 1){
      cha -= 1;
      count++;
    }

    printf("%d\n",count);

  }
  return 0;
}

Measured memory_bytes: 600
// Maximum_Profit.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
#pragma once
#include <iostream>
using namespace std;

void	InputSortData(int* p_sort_data, int sort_data_num);
void	InsecsionSortData(int* p_sort_data, int sort_data_num);
void	OutputSortData(int* p_sort_data, int sort_data_num);
int		BubbleSortData(int* p_sort_data, int sort_data_num);

int main()
{
    int     sort_data_num   = 0;
    int*    p_sort_data     = NULL;
    int     swap_num        = 0;

    // 取引回数を入力する
    //cout << "入力データ数を入力してください" << endl;
    cin >> sort_data_num;

    // 取引データを入力する配列を用意する
    p_sort_data = new int[sort_data_num];

    // 取引データを入力する
    InputSortData(p_sort_data, sort_data_num);

    // 挿入ソートする
    //InsecsionSortData(p_sort_data, sort_data_num);

    // バブルソートする
    swap_num = BubbleSortData(p_sort_data, sort_data_num);

    // ソート後のデータを出力する
    OutputSortData(p_sort_data, sort_data_num);

    // スワップ回数を出力する
    cout << swap_num << endl;

}

void InputSortData(int* p_sort_data, int sort_data_num) {

    // 取引データを入力する
    //cout << "ソートするデータを入力してください" << endl;

    for (int i = 0; i < sort_data_num; i++) {

        cin >> p_sort_data[i];
    }
}

void InsecsionSortData(int* p_sort_data, int sort_data_num) {

    int false_sort = 0;
    int sort_search_pos = 0;

    // 未ソート部分をソートする
    for (int i = 1; i < sort_data_num; i++) {

        // ソートしたデータを出力する
        OutputSortData(p_sort_data, sort_data_num);

        // 未ソート部分の先頭部分を保持する
        false_sort = p_sort_data[i];

        // ソート部分の最後部分を保持する
        sort_search_pos = i - 1;

        while (sort_search_pos >= 0 && p_sort_data[sort_search_pos] > false_sort) {

            p_sort_data[sort_search_pos + 1] = p_sort_data[sort_search_pos];
            sort_search_pos--;
        }

        // 未ソート部分を挿入する
        p_sort_data[sort_search_pos + 1] = false_sort;

    }
}

void OutputSortData(int* p_sort_data, int sort_data_num) {

    //cout << "ソートしたデータを出力する" << endl;

    for (int i = 0; i < sort_data_num; i++) {

        if (i < sort_data_num - 1) {
            cout << p_sort_data[i] << " ";
        }
        else {
            cout << p_sort_data[i] << endl;
        }
    }
}

int BubbleSortData(int* p_sort_data, int sort_data_num) {

    int sort_pos = 0;
    int swap_num = 0;

    for (int i = 0; i < sort_data_num; i++) {

        // 配列の一番最後の要素
        sort_pos = sort_data_num - 1;

        for (int j = sort_pos; j > 0; j--) {

            if (p_sort_data[j] < p_sort_data[j - 1]) {

                // 隣の要素と交換する
                swap(p_sort_data[j], p_sort_data[j - 1]);

                // スワップした回数を記録する
                swap_num++;
            }
        }
    }

    return swap_num;
};


Measured memory_bytes: 3120
#include<bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>


#define ll long long
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define line cout << "\n" ;
using namespace std ;

int helper(int n){

      return 1000-n%1000==1000?0:1000-n%1000;
}

int main(){
      int n;
      cin>>n;
      cout<<helper(n)<<endl;
      return 0;
}


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

int main() {
    int A, B, i, ans;

    ans = 0;

    cin >> A >> B;

    for (i = A; i <= B; i++) {

        int a = i / 10000;
        int b = (i / 1000) % 10;

        int c = (i % 100) / 10;
        int d = i % 10;

        if(a == d && b == c) ans++;
    }

    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
A = gets.chomp.to_i
B = gets.chomp.to_i
C = gets.chomp.to_i
X = gets.chomp.to_i

count = 0
(A+1).times do |a|
  (B+1).times do |b|
    (C+1).times do |c|
      if (500 * a) + (100 * b) + (50 * c) == X
        count += 1
      end
    end
  end
end

p count

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

class Queue
{
    private:

        unsigned long long head, tail;
        unsigned long long arr[100010];

    public:

        void enqueue(unsigned long long val)
        {
            arr[tail] = val;
            tail = (tail+1)%100010;
        }

        unsigned long long dequeue()
        {
            unsigned long long out = arr[head];
            head = (head+1)%100010;
            return out;
        }
        
        unsigned long long GetTail()
        {
            return tail;
        }

        unsigned long long GetHead()
        {
            return head;
        }

        
        unsigned long long GetValByIndex(unsigned long long index)
        {
            return arr[index];
        }
        Queue()
        {
            head = tail = 0;
        }
};

int main(void)
{
    unsigned long long K, k, x;
    cin >> K;
    Queue Q;
    for(k = 1; k < 10; k++)
    {
        Q.enqueue(k);
    }
    k = 0;
    while(1)
    {
        x = Q.dequeue();
        k += 1;
        if(k == K)
        {
            cout<<x<<endl;
            break;
        }
        else if(Q.GetTail() >= K)
        {
            cout<<Q.GetValByIndex(K-1)<<endl;
            break;
        }
        if(x%10 != 0)
        {
            Q.enqueue(10*x + (x%10) - 1);
        }
        Q.enqueue(10*x + (x%10));
        if(x%10 != 9)
        {
            Q.enqueue(10*x + (x%10) + 1);
        }
    }
    return 0; 
}


Measured memory_bytes: 1024
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		int t = saori.saori_hayami();
		int a = saori.saori_hayami();
		int ans = 0;
		double ansmin = MAX;
		double num = 0;
		for(int i = 0;i < n;i++){
			num = saori.saori_hayami();
			num = t - num*0.006;
			if(ansmin > Math.abs(num-a)){
				ansmin = Math.abs(num-a);
				ans = i+1;
			}
		}
		System.out.println(ans);
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 21204
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <cstdio>
#include <climits>
#include <cmath>
#include <array>
#include <functional>
#include <sstream>
#include <list>
#include <iomanip>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const double eps=1e-10;
const int inf=1e9;
typedef pair<int,int> P;

class Point
{
public:
  double x,y;
  Point(double x=0,double y=0): x(x),y(y){}
  Point operator + (Point &p)
  {
    return Point(x+p.x,y+p.y);
  }
  Point operator - (Point &p)
  {
    return Point(x-p.x,y-p.y);
  }
  Point operator * (double k)
  {
    return Point(x*k,y*k);
  }

  double norm(){ return x*x+y*y;}
  double abs(){ return sqrt(norm());}
  bool operator < (const Point &p) const
  {
    return x!=p.x ? x<p.x : y<p.y;
  }
  bool operator == (const Point &p) const
  {
    return fabs(x-p.x)<eps && fabs(y-p.y) < eps;
  }
};
typedef Point Vector;
double dot(Vector a,Vector b)
{
  return a.x*b.x+a.y*b.y;
}
double cross(Vector a,Vector b)
{
  return a.x*b.y - a.y*b.x;
}
struct Segment
{
public:
  Point p1,p2;
  Segment(){};
  Segment(Point p1,Point p2):p1(p1),p2(p2){};
};
typedef Segment Line;

class Circle
{
public:
  Point c;
  double r;
  Circle(Point c=Point(),double r=0.0):  c(c),r(r){}
};

typedef vector<Point> Polygon;


bool isorthogonal(Vector a,Vector b)
{
  return fabs(dot(a,b)-0.0)<eps;
}

bool isparallel(Vector a,Vector b)
{
  return fabs(cross(a,b)-0.0)<eps;
}
int main(int argc,char const* argv[])
{
  int n;
  cin >> n;
  for(int i=0;i<n;i++)
    {
      double p0x,p0y,p1x,p1y,p2x,p2y,p3x,p3y;
      cin >> p0x >> p0y >> p1x >> p1y >> p2x >> p2y >> p3x >> p3y;
      Vector a=Point(p1x-p0x,p1y-p0y);
      Vector b=Point(p3x-p2x,p3y-p2y);
      if(isorthogonal(a,b)) cout << '1' << endl;
      else if(isparallel(a,b)) cout << '2' << endl;
      else cout << '0' << endl;
    }
  return 0;
}



Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, x, a, b, L = 0;
  cin >> N >> K;
  
  for (int i = 0; i < N; i++) {
    cin >> x;
    a = x;
    b = K - x;
    if (b < 0) {
      b *= -1;
    }
    if (a < b) {
      L += a;
    }
    else {
      L += b;
    }
  }
  cout << L * 2 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); 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;
}
int ctoi(char c) {
  if (c >= '0' && c <= '9') {
    return c - '0';
  }
  return 0;
}
ll factorial(ll n) {
  if (n == 1) {
    return 1;
  }
  ll ans = factorial(n-1);
  return ans*n;
}
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
  return (a/gcd(a, b))*b;
}
bool is_prime(ll n) {
  for (ll i = 2; i*i <= n; i++) {
    if (n%i == 0) return false;
  }
  return n != 1;
}
ll mod_pow(ll x, ll n, ll mod) {
  if (n == 0) return 1;
  ll res = mod_pow(x*x%mod, n/2, mod);
  if (n & 1) res = res * x % mod;
  return res;
}

int main() {
  ll n;
  cin >> n;
  vector <ll> v(n);
  rep(i, n) cin >> v.at(i);
  vector <ll> l(n);
  ll length = 1;
  l.at(0) = v.at(0);
  for (ll i = 1; i < n; i++) {
    if (l.at(length-1) < v.at(i)) {
      length++;
      l.at(length-1) = v.at(i);
    } else {
      *lower_bound(l.begin(), l.begin()+length, v.at(i)) = v.at(i);
    }
  }
  cout << length << endl;
}


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

int x,y,dx,dy,n,t,tl,i;

bool b;

int main(){
 	cin>>n;
 	x=0;y=0;b=1;tl=0;
 	for (i=1;i<=n;i++){
 		cin>>t>>dx>>dy;
 		if(b){
 			if (t-tl<abs(x-dx)+abs(y-dy)||((t-tl-abs(x-dx)-abs(y-dy))%2==1))
 				b=0;
 			tl=t;x=dx;y=dy;
		}
	}
	if (b) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}



Measured memory_bytes: 256
import sys
n = int(input())
for i in range(n):
    ns = [x * x for x in map(int, input().split())]
    if ns[0] + ns[1] == ns[2] or ns[0] + ns[2] == ns[1] or ns[1] + ns[2] == ns[0]:
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 7652
A, B = map(int,input().split())

import math
A_under = math.ceil(A / 0.08)
A_over = math.ceil(((A+1) / 0.08) - 1)


for i in range(A_under, A_over+1):
  if math.floor(i * 0.1) == B:
    print(i)
    break
  elif i == A_over:
    print("-1")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD (int)(1e9+7)
#define ceil(x, y) (x%y==0? (x/y) : (x/y+1))
#define FOR(i, N) for(int i = 0; i < N; ++i)
#define FOR1(i, N) for(int i = 1; i <= N; ++i)
#define vi vector <int>
#define pii pair <int, int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mset(a, v) memset(a, v, sizeof(a))
#define all(v) (v).begin(), (v).end()
#define INF 2e9
#define EPS 1e-9
//#define int long long
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
	int T=1;
	//cin >> T;
	FOR1(tp, T)  
	{
		//cout << "Case #" << i << ": ";
		int a, b, c, k; cin >> a >> b >> c >> k;
		int sum = 0;
		sum = 1*min(a, k);
		k -= min(a, k);
		sum += 0*min(b, k);
		k -= min(b, k);
		sum += -1*min(c, k);
		cout << sum;
		cout<<'\n';
	}
	return 0;
}


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

using namespace std;
void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
} 
string str,s1,s2;
long long x,y,z;
int main()
{ init();
 cin>>x >>y >>z;
 swap(x,y);
 swap(x,z);
 cout<<x<<" "<<y <<" " <<z<<endl;
 }

  
   
   
   
  
  

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int A,j,i,B;
    scanf("%d%d1",&A,&B);
    i=B/2 ;
    j=0 ;
    if(A>=0 && A<=100 && B>=2 && B<=1000 && B%2==0)
 {
    if(A>=13) {
        printf("%d\n",B);
      }
    else if(A>=6 && A<=12) {
        printf("%d\n",i);
      }
    else if(A<=5) {
            printf("%d\n",j);
     }
 }
    else { printf(" error\n"); }
    return 0;
}


Measured memory_bytes: 128
import heapq

n = int(input())
G = [[] for i in range(n)]
for ni in range(n):
    u, k, *tmp = [int(i) for i in input().split()]
    for ki in range(k):
        G[ni].append(tmp[:2])
        del tmp[:2]

INF = 100*100000
D = [INF for i in range(n)]
D[0] = 0
C = [0 for i in range(n)]
U = []
u = 0
while 0 in C:
    i = 0
    while U != []:
        u = heapq.heappop(U)[1]
        if C[u] == 0:
            break

    for i in range(len(G[u])):
        v = G[u][i][0]
        if D[u] + G[u][i][1] < D[v]:
            D[v] = D[u] + G[u][i][1]
            heapq.heappush(U, [D[v], v])
    C[u] = 1

for ni in range(n):
    print(ni, D[ni])


Measured memory_bytes: 76400
#include <iostream>
#include <string>
using namespace std;
int main(){
    int n,m,d,cnt=0;
    cin>>n>>m>>d;
    char s[n][m];
    for(int i=0;i<n;++i){
        for(int j=0;j<m;++j){
            cin>>s[i][j];
        }
    }
    for(int i=0;i<n;++i){
        int a=0;
        for(int j=0;j<m;++j){
            if(s[i][j]=='.'){
                ++a;
            }
            else{
                if(a>=d){
                    cnt+=a-d+1;
                }
                a=0;
            }
        }
        if(a>=d){
            cnt+=a-d+1;
            }
        a=0;
    }
    for(int i=0;i<m;++i){
        int a=0;
        for(int j=0;j<n;++j){
            if(s[j][i]=='.'){
                ++a;
            }
            else{
                if(a>=d){
                    cnt+=a-d+1;
                }
                a=0;
            }
        }
        if(a>=d){
            cnt+=a-d+1;
        }
        a=0;
    }
    cout<<cnt<<endl;
}



Measured memory_bytes: 3116