akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ALL(a) (a).begin(),(a).end()
#define SZ(a) ((int)(a).size())
#define F first
#define S second
typedef pair<int,int> PI;

int n;

int x[100],y[100],l[100];

pair<double,int> get(double cx,double cy){
  double maxh = 500;
  int idx=0;
  
  rep(i,n){
    double dx=x[i]-cx;
    double dy = y[i]-cy;
    double dd=sqrt(dx*dx+dy*dy);
    if(maxh > sqrt(max(0.,l[i]*l[i]-dd*dd))){
      maxh=sqrt(max(0.,l[i]*l[i]-dd*dd));
      idx=i;
    }
    
  }
  return mp(maxh,idx);
}

void solve(){
  rep(i,n) cin >> x[i] >> y[i] >> l[i];

  double cx=x[0];
  double cy=y[0];

  double len = 10;
  double ans=1;
  double tans=800;

  vector<double> app;
  
  rep(i,n)rep(j,i){
    /*
      dd=sqrt(dx*dx+dy*dy);
      sqrt(r1*r1-x*x)+sqrt(r2*r2-x*x)=dd
      sqrt(r1*r1-x*x)=dd-sqrt(r2*r2-x*x)
      r1*r1-x*x=dd^2-2*dd*sqrt(r2*r2-x*x)+r2*r2-x*x
      r1*r1=dd^2-2*dd*sqrt(r2*r2-x*x)+r2*r2
      r1*r1-r2*r2-dd^2=-2*dd*sqrt(r2*r2-x*x)
      (r1*r1-r2*r2-dd^2)^2=4*dd*dd*(r2*r2-x*x);
      (r1*r1-r2*r2-dd^2)^2/4/dd/dd=(r2*r2-x*x);
      x*x=(r2*r2-(r1*r1-r2*r2-dd^2)^2/4/dd/dd);      
     */
    
    double dx=x[j]-x[i];
    double dy=y[j]-y[i];
    double dd=sqrt(dx*dx+dy*dy);
    double xx=sqrt(l[j]*l[j]-pow(l[i]*l[i]-l[j]*l[j]-dd*dd,2)/4/dd/dd);
    //app.pb();
    double r1r = sqrt(l[i]*l[i]-xx*xx);
    /*
      r1c r1r xx    r2c
     */
    
    double cx = x[i]+dx/dd*r1r;
    double cy = y[i]+dy/dd*r1r;
    ans=max(ans,get(cx,cy).F);
    //if(dd >= l[i]+l[j]) continue;
  }
  
  //if(n>1) ans=tans;
  
  while(len > 5e-9){
    pair<double,int> a=get(cx,cy);
    ans=max(ans,a.F);
    double dx=cx-x[a.S];
    double dy=cy-y[a.S];
    double dd=sqrt(dx*dx+dy*dy);
    cx -= dx*len/dd;
    cy -= dy*len/dd;
    len *= 1-2e-4;
  }

  // sort(ALL(app));
  // if(!app.empty() && app[app.size()-1]>=ans){
  //   double p=*lower_bound(ALL(app),ans);
  //   if(ans+2e-4 > p) ans=p;
  // }
  
  printf("%.8f\n",ans);
}

int main(){
  while(cin >> n && n) solve();
}

Measured memory_bytes: 1204
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(ll I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //xi>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //xi>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;



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

	ll N,K;
	cin >> N >> K;
	cout << N-K+1 << endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef pair<int, int> P;
constexpr auto INF = INT_MAX/2;
constexpr auto LINF = 5000000000000000;
constexpr auto MOD = 1000000007;

int main() {

	string s;
	cin >> s;

	int ans1,ans2;
	ans1 = ans2 = -1;

	rep(i, s.size() - 1)if (s[i] == s[i + 1]) {
		ans1 = i + 1;ans2 = i + 2;break;
	}
	rep(i, s.size() - 2)if (s[i] == s[i + 2]) {
		ans1 = i + 1;ans2 = i + 3;break;
	}

	cout << ans1 << " " << ans2 << endl;

}

Measured memory_bytes: 512
#include <iostream>
#include <ccomplex>
#include <vector>
#include <cassert>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <numeric>
#include <list>
#include <assert.h>
#include <math.h>
#include <valarray>
#include <stdio.h>
#include <algorithm>
#include <set>
#include <complex>
#include <list>
#include <time.h>
#include <stack>
#include <locale>
#include <clocale>
#include <ctype.h>
#include <wchar.h>

using namespace std;
typedef long long int LL;
typedef pair<long long int, long long int> pii;
typedef pair<double, double> pdd;

#define SORT(c) sort((c).begin(),(c).end())
#define BACKSORT(c) sort((c).begin(),(c).end(),std::greater<LL>())
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

int xcomp(vector<LL>& a, vector<LL>& b) {
	return a[0] < b[0];
}

#define XSORT(c) sort((c).begin(),(c).end(),xcomp)

#define ALL(x) (x).begin(),(x).end()
LL mod = 1000000007;

int main() {
	LL N;
	cin >> N;
	LL sum = 0;
	LL waru = N*(N + 1) / 2;
	vector<LL> A(N, 0);
	LL kaisutasu = 0;
	REP(i, N) {
		cin >> A[i];
		sum += A[i];
		if (sum >= waru) {
			kaisutasu += sum / waru;
			sum -= sum / waru*waru;
		}
	}
	if (sum%waru == 0) {
		LL kaisu = sum / waru + kaisutasu;
		REP(i, N) {
			A[i] -= (i + 1)*kaisu;
		}
		LL checker = 1;
		while (true) {
			while (A[checker] == A[checker - 1]) {
				checker++;
				if (checker >= N) {
					break;
				}
			}
			if (checker >= N) {
				break;
			}
			if (A[checker] > A[checker - 1]) {
				break;
			}
			if (checker == 0) {
				break;
			}
			/*
			LL k = (-A[checker] - 1) / checker + 1;
			//LL add = min(kuso + k - 1, kaisu) - kuso + 1;
			//kuso = min(kuso + add - 1, kaisu);
			LL add = k;
			*/
			LL add = (A[checker - 1] - A[checker]) / N;
			if (add == 0) {
				break;
			}
			REP(i, checker) {
				A[i] -= (N - checker)*add;
			}
			FOR(i, checker, N) {
				A[i] += (checker)*add;

			}
			
		}
		LL flag = true;
		REP(i, N) {
			if (A[i] != 0) {
				flag = false;
				break;
			}
		}
		if (flag) {
			cout << "YES" << endl;
		}
		else {
			cout << "NO" << endl;
		}
	}
	else {
		cout << "NO" << endl;
	}

}


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

using namespace std;

const int INF=1e9+7;
string A;
int dp[200005];
int ix[30][200005];
int nx[30];

int main() {


cin>>A;
int n=A.size();

for(int j=0; j<26; j++){
    nx[j]=n;
}

for(int i=n-1; i>=0; --i){
  nx[A[i]-'a']=i;
  for(int j=0; j<26; j++){
    ix[j][i]=nx[j];
  }
  dp[i]=INF;
}

dp[n]=1;
for (int i = n-1; i > -1; --i)
  for (int j = 0; j < 26; ++j)
    dp[i] = min(dp[i],dp[ix[j][i]+1]+1);

  for (int i = 0; dp[0]; --dp[0])
  {
    for (int j = 0; j < 26; ++j)
    {
      if(dp[i]==dp[ix[j][i]+1]+1)
      {
        printf("%c",j+'a');
        i = ix[j][i]+1;
        break;
      }
    }
  }

  cout<<endl;

  return 0;
}


Measured memory_bytes: 21892
# -*- coding: utf-8 -*-

S,c = map(int, input().split())

# c→Sは変換できるので、合算して考える
if c >= S*2:
    print((S*2 + c) // 4)
# S→cには変換できないので、完全にCの数次第
else:
    print(c // 2)

Measured memory_bytes: 2940
#include<stdio.h>

int main(){
    int i, j;
    int count = 0;
    char s[100];
    scanf("%s", &s);
    for(i = 0; i < 4; i++){
        for(j = i+1; j < 4; j++){
            if(s[i] == s[j])count++;
        }
    }
    if(count == 2){
        if(s[0] != s[1] || s[0] != s[2] || s[0] != s[3]){
            printf("Yes\n");
        }
    }else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 128
x,y=map(int,input().split())
if (x in [1,3,5,7,8,10,12]) and (y in [1,3,5,7,8,10,12]):
        print('Yes')
elif (x in [4,6,9,11]) and (y in [4,6,9,11]):
        print('Yes')
elif (x==2) and (y==2):
        print('Yes')
else:
        print('No')

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

using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;

using f64 = double;
using f128 = long double;

template <typename T> using Vec = vector<T>;
template <typename K, typename V> using HashMap = unordered_map<K, V>;
template <typename T> using HashSet = unordered_set<T>;

using StrView = string_view;

auto solve(i64 const A, i64 const B, i64 const C, i64 const K) -> void {
  if (K <= A) {
    cout << K << "\n";
    return;
  }

  if (K <= A + B) {
    cout << A << "\n";
    return;
  }

  if (K <= A + B + C) {
    i64 result = A - (K - A - B);
    cout << result << "\n";
    return;
  }

  cout << A - C << "\n";
}

auto main() -> int {
  i64 A;
  scanf("%" SCNd64, &A);
  i64 B;
  scanf("%" SCNd64, &B);
  i64 C;
  scanf("%" SCNd64, &C);
  i64 K;
  scanf("%" SCNd64, &K);
  solve(A, B, C, K);
  return 0;
}


Measured memory_bytes: 3760
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e9;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;
ll solve(ll a, ll b) {
    if (a == b) return (a - 1) * 2;
    ll floor = 1, ceil = INF;
    ll lim = a * b - 1;
    while (floor + 1 < ceil) {
        ll mid = (floor + ceil) / 2;
        ll mul = (mid + 1) / 2 * (mid + 1 - (mid + 1) / 2);
        if (mul > lim) ceil = mid;
        else floor = mid;
    }
    return floor - 1;
}

int main() {
    ll q;
    cin >> q;

    rep(i, q) {
        ll a, b;
        cin >> a >> b;

        cout << solve(a, b) << endl;
    }

}


Measured memory_bytes: 3676
/** 
 * THIS IS MOOONI'S CODE !
 * HACK IT IF YOU CAN !
**/
#include <bits/stdc++.h>
#define int long long

using namespace std;

int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    --a[i];
  }
  vector<long long> cnt(n);
  for (int i = 0; i < n; i++) {
    ++cnt[a[i]];
  }
  vector<bool> mark(n, false);
  long long total = 0;
  for (int i = 0; i < n; i++) {
    if (!mark[a[i]]) {
      mark[a[i]] = true;
      total += (cnt[a[i]] * (cnt[a[i]] - 1)) / 2;
    }
  }
  for (int i = 0; i < n; i++) {
    cout << total - cnt[a[i]] + 1 << '\n';
  }
  return 0;
}

Measured memory_bytes: 5760
var
 i,x,k,j,n,s:longint;
 sum:int64;
 a,b:array[0..200000] of longint;
procedure kp(l,r:longint);
var i,j,m,t:longint;
begin
 i:=l; j:=r;
 m:=a[(l+r) div 2];
 repeat
  while a[i]<m do inc(i);
  while a[j]>m do dec(j);
  if i<=j then
   begin
    t:=a[i]; a[i]:=a[j]; a[j]:=t;
    inc(i); dec(j);
   end;
 until i>j;
 if l<j then kp(l,j);
 if i<r then kp(i,r);
end;
begin
 readln(n,k);
 for i:=1 to n do
  begin
   read(x);
   inc(b[x]);
   if b[x]=1 then inc(s);
  end;
 for i:=n downto 1 do
  begin
   if b[i]<>0 then
    begin
     inc(j);
     a[j]:=b[i];
    end;
  end;
 kp(1,j);
 for i:=1 to s-k do
  sum:=sum+a[i];
 writeln(sum);
end.

Measured memory_bytes: 1664
N, M = map(int, input().split())
A, B = [input() for _ in range(N)], [input() for _ in range(M)]

for i in range(N - M + 1):
    for j in range(N - M + 1):
        if [A[i + k][j:j + M] for k in range(M)] == B:
            print("Yes")
            exit()

print("No")


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
/*
         ########     ########   ########   #########   ##       #######   ##       #######
         #      #     #      #   #      #       #       # #      #     #   # #      #     #
         #      #     #      #   #      #       #       #  #     #     #   #  #     #     #
         ########     #      #   #      #       #       #   #    #     #   #   #    #     #
         ###          #      #   #      #       #       #    #   #######   #    #   #######
         #  #         #      #   #      #       #       #   #    #     #   #   #    #     #
         #   #        #      #   #      #       #       #  #     #     #   #  #     #     #
         #    #       #      #   #      #       #       # #      #     #   # #      #     #
         #     #      ########   ########       #       ##       #     #   ##       #     #
*/

#define rep(i, a, b) for (__typeof((b)) i = (a); i < (b); i++)
#define nrep(i, a, b) for (__typeof((b)) i = (a); i > (b); i--)
#define all(a) (a).begin(), (a).end()
#define ff first
#define ss second
#define ppi pair<int, int>
#define pppi pair<ppi, int>
#define vi vector<int>
#define vii vector<ppi>
#define viii vector<pppi>
#define vs vector<string>
#define pb push_back
#define bitcount __builtin_popcountll //count no's of ones in a set bit
#define prq priority_queue
#define mp make_pair
#define mem(x, val) memset((x), (val), sizeof(x));
#define sz(x) (int)x.size()
#define M_PI 3.14159265358979323846
#define rootdada                      \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define test  \
    int t;    \
    cin >> t; \
    while (t--)
#define debug(a)          \
    cerr << #a << ": ";   \
    for (auto i : a)      \
        cerr << i << " "; \
    cerr << '\n';
#define trace(a) cerr << #a << ": " << a << "\n"
#define print(ar, n)            \
    for (int u = 0; u < n; u++) \
    {                           \
        cout << ar[u] << " ";   \
    }                           \
    cout << endl;
#define int long long
#define M 1000000007
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
signed main()
{
	rootdada;

	string s;
	cin >> s;
	int n = s.length();
	if (s[n - 1] != 's')
		s.push_back('s');
	else
	{
		s.push_back('e');
		s.push_back('s');


	}
	cout << s << endl;
}

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

int main()
{
    int H, W;
    cin >> H >> W ;
    while(H!=0 || W!=0){
        for (int h = 0; h< H; h++){
            for ( int w = 0; w < W; w++){
                cout << '#';
            }
            cout << endl;
        }
        cout << endl;
        cin >> H >> W ;
    }

}


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

using namespace std;

#define fi first
#define se second
#define eb emplace_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end() 
#define MOD 1000000007

typedef long long ll;
typedef pair <int, int> ii;
typedef pair <ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef long double ld;

const ll INF=LLONG_MAX;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
	string s; cin >> s;
	int n=s.length();
	for(int i=0; i<n; i++){
		if(s[i]=='1')s[i]='9';
		else if(s[i]=='9')s[i]='1';
	}
	cout << s << endl;
}
	
// READ & UNDERSTAND
// ll, int overflow, array bounds, memset(0)
// special cases (n=1?), n+1 (1-index)
// do smth instead of nothing & stay organized
// WRITE STUFF DOWN


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define For(type, i, a, b) for (type i = (a); i <= (b); ++i)
#define Ford(type, i, a, b) for (type i = (a); i >= (b); --i)
#define Rep(type, i, a, b) for (type i = (a); i < (b); ++i)
#define Repd(type, i, a, b) for(type i = (a); i > (b); --i)
#define endl '\n'
using namespace std;

typedef long long ll;
typedef pair<ll, ll> ii;

const ll maxN = 1e18;
const ll minN = -1e18;
const ll MOD = 1e9 + 7;

const ll limit = 1e3 + 5;
const ll limit1 = 1e4 + 5;
const ll limit2 = 2e5 + 5;
const ll limit3 = 1e6 + 5;


ll test;
ll n, m, k, x, y, z, u, v;
ll res = 0, sum = 0, ans = 0, kd, hkd, answer;
bool ok = false;
ll a[limit3], b[limit3], c[limit3], dp[limit3];
string s;
void FastIn(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}

void ReadIn(){
    cin >> n;
    For(ll, i, 1, n)
        cin >> a[i];
    dp[1] = 0;
    dp[2] = abs(a[2] - a[1]);
  //  cout << dp[1] <<" " << dp[2] << endl;
    For(ll, i, 3, n){
        x = abs(a[i - 2] - a[i]) + dp[i - 2];
        y = abs(a[i - 1] - a[i]) + dp[i - 1];
       // cout << x << " " << y << endl;
        dp[i] = min(x, y);
    }
    cout << dp[n];
}

int main(){
    FastIn();
    ReadIn();
}



Measured memory_bytes: 5200
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
const lli mod=1e9+7;
const lli pINF=LLONG_MAX;
const lli nINF=-LLONG_MAX;
void fast() {std::ios::sync_with_stdio(false);cin.tie(NULL);}
lli power(lli a,lli b){lli ans=1;while(b!=0){ if(b%2==1){ans*=a;}b/=2;a*=a;} return ans;}
lli invmod(lli a) {return pow(a,mod-2);}
#define vi vector<int>
#define vlli vector<lli>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define sli(n) scanf("%lld",&n)
#define printi(n) printf("%d\n",n)
#define printli(n) printf("%lld\n",n)
#define all(vi) (vi.begin(),vi.end())
#define forn(i,n) for(int i=0;i<n;i++)
void print(int a[],int n){for(int i=0;i<n;i++) cout<<a[i]<<" ";}
lli x[100005];
lli y[100005];

int main() {
	int n,m;
	si(n);si(m);
	
	for(int i=1;i<=n;i++) sli(x[i]);
	
	for(int i=1;i<=m;i++) sli(y[i]);
	
	lli ans1=0,ans2=0;
	for(int i=1;i<=n;i++){
	    ans1+=(i-1)*x[i];
	    if(ans1<0) ans1+=mod;
	    ans1%=mod;
	    
	    lli temp=(n-i)*x[i];
	    if(temp<0) temp+=mod;
	    temp%=mod;
	    
	    ans1-=temp;
	    
	    if(ans1<0) ans1+=mod;
	    
	    ans1%=mod;
	}
	
	for(int i=1;i<=m;i++){
	    ans2+=(i-1)*y[i];
	    if(ans2<0) ans2+=mod;
	    ans2%=mod;
	    
	    lli temp=(m-i)*y[i];
	    if(temp<0) temp+=mod;
	    temp%=mod;
	    
	    ans2-=temp;
	    
	    if(ans2<0) ans2+=mod;
	    
	    ans2%=mod;
	}
	
	ans1=(ans1*ans2);
	
	if(ans1<0) ans1+=mod;
	
	ans1%=mod;
	
	cout<<ans1<<endl;
	return 0;
}

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

const double EPS = 1e-8;
const double INF = 1e12;
const double PI = acos(-1);

using Point = complex<double>;
using Polygon = vector<Point>;

inline int sgn(const double &a) { return (a < -EPS ? -1 : (a > EPS ? 1 : 0)); }

inline bool eq(const Point &a, const Point &b) { return abs(a - b) < EPS; }

namespace std{
    inline bool operator<(const Point &a, const Point &b) {
        if (sgn(a.real() - b.real()))
            return sgn(a.real() - b.real()) < 0;
        return sgn(a.imag() - b.imag()) < 0;
    }
}

double dot(const Point &a, const Point &b) { return real(conj(a) * b); }

double det(const Point &a, const Point &b) { return imag(conj(a) * b); }

struct Line {
    Point p1, p2;

    Line(Point p1 = Point(), Point p2 = Point()) : p1(p1), p2(p2) {}

    bool operator<(const Line &rhs) const {
        if (eq(p2, rhs.p2))
            return p1 < rhs.p1;
        return p2 < rhs.p2;
    }
    bool operator==(const Line &rhs) const {
        return (eq(p1, rhs.p1) && eq(p2, rhs.p2)) ||
               (eq(p1, rhs.p2) && eq(p2, rhs.p1));
    }
};

enum CCW {
    ONLINE_FRONT = -2,
    CLOCKWISE,
    ON_SEGMENT,
    COUNTER_CLOCKWISE,
    ONLINE_BACK
};

int ccw(Point p0, Point p1, Point p2) {
    Point a = p1 - p0;
    Point b = p2 - p0;
    if (sgn(det(a, b)) == 1)
        return COUNTER_CLOCKWISE;
    if (sgn(det(a, b)) == -1)
        return CLOCKWISE;
    if (sgn(dot(a, b)) == -1)
        return ONLINE_BACK;
    if (sgn(norm(b) - norm(a)) == 1)
        return ONLINE_FRONT;
    return ON_SEGMENT;
}

Polygon convex_hull(Polygon s){
    int n = s.size(), k = 0;
    if(n < 3) return s;
    sort(s.begin(), s.end());

    Polygon ch(2*n);

    // 下側凸包
    for(int i=0;i<n;i++){
        while(k>=2 && ccw(ch[k-2], ch[k-1], s[i]) == CLOCKWISE)k--;
        ch[k++] = s[i];
    }

    // 上側凸包
    for(int i=n-2,t=k+1;i>=0;i--){
        while(k>=t && ccw(ch[k-2], ch[k-1], s[i]) == CLOCKWISE)k--;
        ch[k++] = s[i];
    }

    ch.resize(k-1);
    return ch;
}

int main(){
    int n;
    cin >> n;
    Polygon s;
    for(int i=0;i<n;++i){
        double x, y;
        cin >> x >> y;
        s.push_back(Point(x,y));
    }
    Polygon ch = convex_hull(s);
    int min_i = 0, mini = 10000;
    for(int i=0;i<ch.size();++i){
        if((int)ch[i].imag() < mini){
            mini = (int)ch[i].imag();
            min_i = i;
        }
    }
    cout << ch.size() << endl;
    int idx = min_i;
    for(int i=0;i<ch.size();++i){
        printf("%.0f %.0f\n", ch[idx].real(), ch[idx].imag());
        idx = (idx+1) % ch.size();
    }

    return 0;
}



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

using namespace std;

long long int dp[3001][3001][2];
long long int helper(vector<int>&game,int l,int r,int chance){
	if(dp[l][r][chance] > -1){
		return dp[l][r][chance];
	}
	if(l > r){
		return 0;
	}
	else{
		dp[l][r][chance] = (max(game[l]-helper(game,l+1,r,1-chance),game[r]-helper(game,l,r-1,1-chance))); 
		return dp[l][r][chance];
	}
}
int main(){
	int n;cin>>n;
	vector<int>game(n);
	for(int i=0;i<n;i++){
		cin>>game[i];
	}
	for(int i=0;i<3001;i++){
		for(int j=0;j<3001;j++){
			for(int k=0;k<2;k++){
				dp[i][j][k] = -1;
			}
		}
	}
	cout<<helper(game,0,n-1,0);
}


Measured memory_bytes: 141184
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define FOR(i, n) for(int i = 0; i < (n); i ++)
#define CIN(type, val) type val; cin >> val;
#define COUT(val) cout << (val) << "\n";
#define Range(c) c.begin(), c.end()
using namespace std;

int main(void){
    CIN(int, n);
    CIN(int, m);

    vector<int> x(m);
    FOR(i, m) cin >> x[i];
    sort(Range(x));
    
    vector<int> dx(m-1);
    FOR(i, m-1) dx[i] = x[i+1] - x[i];
    sort(Range(dx));
    
    int ans = 0;
    int nn = m - n;
    FOR(i, nn) ans += dx[i];
    COUT(ans);
}


Measured memory_bytes: 1024
n = int(input())
As = list(map(int, input().split()))

result = As[0]
if 0 in As:
    print(0)
else:
    for i in range(n-1):
        result = result*As[i+1]
        if result > 10**18 :
            print(-1)
            break
        else:
            continue
    if result <= 10**18 :
        print(result)

Measured memory_bytes: 21788
#include <stdio.h>

int	 main(void)
{
  int a,b;
  int d,r;
  double aa,bb,f;
  double ba = 1;

  scanf("%d%d",&a,&b);

  d = a / b;
  r = a % b;

  aa = a / ba;
  bb = b / ba;

  f = aa / bb;

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

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

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] tmp = Console.ReadLine().Split(' ');
            int A = int.Parse(tmp[0]);
            int B = int.Parse(tmp[1]);

            Console.WriteLine((A + B) % 24);
            Console.ReadLine();
        }
    }
}


Measured memory_bytes: 11092
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

S = input()
T = input()

dic = defaultdict(int)
dic2 = defaultdict(int)

for i in S:
	dic[i] += 1

for j in T:
	dic2[j] += 1

for i, j in zip(sorted(dic.values()), sorted(dic2.values())):
	if i != j:
		print("No")
		break
else:
	print("Yes")


Measured memory_bytes: 4284
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<utility>//pair
#include<cmath>//abs,sqrt
#include<cstring>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) cout<<arg<<"\n"
#define prin2(arg1,arg2) cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) memset(arg,n,sizeof(arg))
using namespace std;
typedef long long ll;
typedef pair<int,int> pi;
const int INF=1e+9;
const ll INFLL=1e+17;
int n,k;
char s[100010];
int main(){
  cin>>n>>k;
  rep(i,n) cin>>s[i];
  s[n]='2';
  bool f;
  if(s[0]=='0') f=true;
  else f=false;
  int cnt=1;
  vector<int> v0,v1;
  rep(i,n){
    if(s[i]!=s[i+1]){
      if(f){
	v0.push_back(cnt);
	f=false;
      }
      else{
	v1.push_back(cnt);
	f=true;
      }
      cnt=1;
    }
    else{
      cnt++;
    }
  }
  if(s[0]=='0') f=true;
  else f=false;
  int sv0=v0.size(),sv1=v1.size();
  if(sv0<=k){
    prin(n);
    return 0;
  }
  int cum0[100010],cum1[100010];
  cum0[0]=0;cum1[0]=0;
  rep1(i,sv0){
    cum0[i]=cum0[i-1]+v0[i-1];
  }
  rep1(i,sv1){
    cum1[i]=cum1[i-1]+v1[i-1];
  }
  int res=0;
  if(f){
    res=cum0[k]+cum1[k];
    rep(i,sv1-k){
      int temp=cum1[k+1+i]-cum1[i]+cum0[k+i+1]-cum0[i+1];
      res=max(temp,res);
    }      
    if(sv1!=sv0){
      int temp=cum0[sv0]-cum0[sv0-k]+cum1[sv1]-cum1[sv1-k];
      res=max(res,temp);
    }	    
  }
  else{
    rep(i,sv1-k){
      int temp=cum1[k+1+i]-cum1[i]+cum0[k+i]-cum0[i];
      res=max(temp,res);
    }      
    if(sv1==sv0){
      int temp=cum0[sv0]-cum0[sv0-k]+cum1[sv1]-cum1[sv1-k];
      res=max(res,temp);
    }	
  }
  prin(res);

  
  return 0;
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;


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

    int n, l;
    cin >> n >> l;
    vector<string> s(n);
    rep(i, n){
        cin >> s[i];
    }
    sort(all(s));

    rep(i, n){
        cout << s[i];
    }
    cout << endl;


    return 0;
}

Measured memory_bytes: 256
/*
 * 0285.cc: Tennis
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int N = 5;
const int NBITS = 1 << (2 * N);

/* typedef */

/* global variables */

bool dp[N + 1][N + 1][NBITS];

/* subroutines */

string bits_str(int n, int bits, char add = 0) {
  string s;
  for (int i = 0; i < n; i++)
    s += ((bits >> i) & 1) ? 'B' : 'A';
  if (add) s += add;
  return s;
}

/* main */

int main() {
  dp[0][0][0] = true;

  for (int ai = 0; ai < N; ai++)
    for (int bi = 0; bi < N; bi++) {
      int k = ai + bi;
      for (int bits = 0; bits < NBITS; bits++)
	if (dp[ai][bi][bits]) {
	  dp[ai + 1][bi][bits] = true;
	  dp[ai][bi + 1][bits | (1 << k)] = true;
	}
    }

  for (int bits = 0; bits < NBITS; bits++) {
    if (dp[N - 1][N][bits]) 
      dp[N][N][bits] = true;
    if (dp[N][N - 1][bits]) 
      dp[N][N][bits | (1 << (2 * N - 1))] = true;
  }

  int an, bn;
  cin >> an >> bn;

  vector<string> ans;

  if (an == 6) {
    for (int bits = 0; bits < NBITS; bits++)
      if (dp[5][4][bits]) ans.push_back(bits_str(9, bits, 'A'));
  }
  else if (bn == 6) {
    for (int bits = 0; bits < NBITS; bits++)
      if (dp[4][5][bits]) ans.push_back(bits_str(9, bits, 'B'));
  }
  else
    for (int bits = 0; bits < NBITS; bits++)
      if (dp[an][bn][bits]) ans.push_back(bits_str(an + bn, bits));
  sort(ans.begin(), ans.end());

  for (int i = 0; i < ans.size(); i++)
    cout << ans[i] << endl;
  
  return 0;
}

Measured memory_bytes: 1256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
    ll n,k;cin>>n>>k;
    if(n%k==0)cout<<0<<endl;
    else if(k<n)
    {
        ll v=n/k;
        cout<<min(abs(n-v*k),abs(n-k-v*k))<<endl;
    }
    else
    {
        cout<<min(abs(n-k),abs(abs(n-k)-k))<<endl;
    }
return 0;    
}

Measured memory_bytes: 256
N=int(input())
*A,=map(int,input().split())

A.sort()
count=[0]*(A[-1]+1)
i=0
while i<N:
    j=A[i]
    if 2<=count[j]:
        i+=1
        continue
    k=1
    while j*k<=A[-1]:
        count[j*k]+=1
        k+=1
    i+=1

print(sum(count[a]==1 for a in A))

Measured memory_bytes: 33228
package main

import (
	"fmt"
	"os"
)

func main() {
	var s string
	fmt.Scan(&s)

	for i := 0; i < len(s)-1; i++ {
		if s[i] == s[i+1] {
			fmt.Println("Bad")
			os.Exit(0)
		}
	}

	fmt.Println("Good")
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define override_rep(i, l, r, mes, ...) mes
#define rep1(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = l; i < r; i++)
#define rep(...) override_rep(__VA_ARGS__, rep2, rep1)(__VA_ARGS__)
using P = pair<int, int>;
template<typename T, typename U>
istream& operator>>(istream& in, pair<T, U>& p) {
    in >> p.first >> p.second;
    return in;
}
int gcd(int a,int b){
    if(a%b==0)return b;
    return gcd(b,a%b);
}
signed main(signed argc, char* argv[]) {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    const int MOD = 1e9+7;
    int s;
    cin>>s;
    if(s==(int)1e18){
        cout<<0<<' '<<0<<' '<<(int)(1e9)<<' '<<1<<' '<<s%1000000000<<' '<<s/1000000000<<endl;
    }
    else cout<<0<<' '<<0<<' '<<(int)(1e9)<<' '<<1<<' '<<1000000000-s%1000000000<<' '<<s/1000000000+1<<endl;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h,w;
    while(cin>>h>>w, h!=0){
        rep(i,h){
            rep(j,w) cout<<'#';
            cout<<"\n";
        }
        cout<<"\n";
    }
    return 0;
}



Measured memory_bytes: 3212
#include<stdio.h>
#include<math.h>

int main(void)
{
	double x1, x2, x3, x4, y1, y2, y3, y4;
	int i = 0;
	int n;
	double s;
	double eps = 0.00000000001;
	
	scanf("%d", &n);
	
	for(i = 0; i < n; i++) {
		scanf("%lf %lf %lf %lf %lf %lf %lf %lf", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
		
		x2 -= x1;
		y2 -= y1;
		x4 -= x3;
		y4 -= y3;
		
		s = (x2 * y4) - (y2 * x4);
		
		s = fabs(s);
		
		if (s < eps) {
			s = 0;
		}
		
		if (s == 0) {
			printf("YES\n");
		}
		
		else {
			printf("NO\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 620
S = list(input())
s1 = [S[0],S[1]]
s2 = [S[2],S[3]]
s1 = int("".join(s1))
s2 = int("".join(s2))

if s1 >0 and s1 <13 and s2>0 and s2 <13:
    print("AMBIGUOUS")

elif s2 > 0 and s2 < 13:
    print("YYMM")

elif s1 < 13 and s1 > 0:
    print("MMYY")

else:
    print("NA")



Measured memory_bytes: 3060
import java.util.*;

class Main {
    public static void main(String[] args) {
        final long MOD = 1_000_000_007L;
        final Scanner sc = new Scanner(System.in);
        final int N = Integer.parseInt(sc.next());
        int B[][] = new int[N][61];
        for (int i=0; i<N; i++) {
            long A =  Long.parseLong(sc.next());
            for (int j=0; j<61; j++) {
                B[i][j] = (int)(A % 2);
                A /= 2;
                if (A==0)
                    break;
            }
        }
        sc.close();

        long sum = 0L;
        for (int j=0; j<61; j++) {
            long cnt = 0;
            for (int i=0; i<N; i++) {
                cnt += B[i][j];
            }
            sum += cnt * (N - cnt) * Math.pow((double)2, (double)j) % MOD;
            sum %= MOD;
        }
        System.out.println(sum);
    }
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

void solve(){
    string S;
    cin >> S;
    if(S.substr(0,4)=="YAKI") cout << "Yes" << endl;
    else cout << "No" << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 256
X,Y = map(int,input().split())
answer = 0
for turu in range(0,X+1):
    kame = X-turu
    if kame >= 0 and kame*4+turu*2 == Y:
        answer = 1
        break
if answer == 1:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 61596
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string  name,a,b,c,d,e;
    cin>>name;
    a=name;
    c=name;
    d=name;
    e=name;
    int n=name.size();
    reverse(name.begin(),name.end());
    if(name!=a)
    {
        cout<<"No"<<endl;
    }
    else
    {
        //cout<<"Hello"<<endl;
        int t=(n-1)/2;
        int t1=(n+3)/2;
        b=a.substr(0,t);
         //cout<<b<<endl;
        c=a.substr(t1-1,n);
        //cout<<c<<endl;
        reverse(a.begin()+0,a.begin()+t);
        //cout<<a<<endl;
        reverse(d.begin()+(t1-1),d.begin()+n);
        //cout<<d<<endl;
        if((a==e && d==e))
            cout<<"Yes"<<endl;
            else
                cout<<"No"<<endl;



    }
}


Measured memory_bytes: 256
#!python3

# input
N, M = list(map(int, input().split()))


def main():
    ans = 0
    if N >= 2:
        ans += N * (N - 1) // 2
    if M >= 2:
        ans += M * (M - 1) // 2
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
#168
#a
n = input()
if int( n[-1] ) == 3:
    print('bon')
elif int(n[-1]) == 0 or  int(n[-1]) == 1 or  int(n[-1]) ==6 or  int(n[-1]) == 8 :
    print('pon')
else :
    print('hon')

Measured memory_bytes: 9160
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR1(i,n) for(int (i)=1;(i)<(n);(i)++)
#define eFOR(i,n) for(int (i)=0;(i)<=(n);(i)++)
#define eFOR1(i,n) for(int (i)=1;(i)<=(n);(i)++)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
const int INF = 1000000000;
const ll LLINF = 1LL << 62;
const int mod = 1000000007;
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 main(){
    cin.tie(0);
    ios::sync_with_stdio(0);

    ll a, b, x;
    cin >> a >> b >> x;
    cout << (a ? b / x - (a - 1) / x : b / x + 1) << "\n";
}


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

int r[100009];
set<int> st;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	for (int i = 1; i <= n; i++) {
		int a; cin >> a;
		r[a] = i;
	}
	st.insert(0); st.insert(n + 1);
	long long ans = 0;
	for (int i = n; i >= 1; i--) {
		auto ri = st.lower_bound(r[i]);
		auto li = ri; li--;
		long long p = 0;
		if (ri != --st.end()) {
			int t = 0;
			t -= (*ri); ri++;
			t += (*ri); ri--;
			p += 1LL * (r[i] - (*li)) * t;
		}
		if (li != st.begin()) {
			int t = 0;
			t += (*li); li--;
			t -= (*li); li++;
			p += 1LL * ((*ri) - r[i]) * t;
		}
		ans += 1LL * p * i;
		st.insert(r[i]);
	}
	cout << ans << '\n';
	return 0;
}	

Measured memory_bytes: 5376
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;

typedef long long ll;

const int N=1e6+1e3+7;

int n,a[N];

ll s[N],x[N];

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]);
	ll ans=0;
	for(int i=1;i<=n;i++)
	{
		s[i]=s[i-1]+a[i];
		x[i]=x[i-1]^a[i];
		int l=0,r=i;
		while(r-l>1)
		{
			int mid=(l+r)>>1;
			if(s[i]-s[mid-1]!=(x[i]^x[mid-1]))
				l=mid;
			else
				r=mid;
		}
		ans+=i-r+1;
	}
	printf("%lld",ans);
}

Measured memory_bytes: 9984
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, a, b) for(ll i = ll(a); i <= ll(b); i++)
int main()
{
	ll a,b,x;
	cin>>a>>b;
	string s;
	cin>>s;
	if(count(s.begin(),s.end(),'-')==1 && s[a]=='-')
		cout<<"Yes";
	else
		cout<<"No";
}

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

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<int>t(N+1), x(N+1), y(N+1);
	for (int i = 1; i <= N; i++)
	{
		cin >> t[i] >> x[i] >> y[i];
	}

	for (int i = 1; i <= N; i++)
	{
		int tmp = abs(x[i] - x[i - 1] + abs(y[i] - y[i - 1]));
		tmp = t[i] - t[i - 1] - tmp;
		if (tmp < 0 || tmp % 2) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 1408
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4") 
#include <bits/stdc++.h> 
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define PI 3.1415926535897932384626 
typedef pair<int, int> pi;
typedef pair<ll,ll> pl;
typedef pair<ld,ld> pd; 
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
 
#define Rep(i, a, b) for (int i=a; i<(b); i++)
#define rep(i, a) for (int i=0; i<(a); i++)
#define Dep(i,a,b) for (int i = (b)-1; i >= a; i--)
#define dep(i,a) for (int i = (a)-1; i >= 0; i--)
#define trav(a,x) for(auto& a : x)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound
#define ub upper_bound
#define all(x) x.begin(), x.end()
#define ins insert
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); // Random No.
 
const int MOD = 1000000007;
const char nl = '\n';

void sol() {

    int n ; cin >> n;
    int ans = 0;
    if(n>=400 && n<600){
        ans = 8 ;
    }

    else if(n>=600 && n<800){
        ans = 7 ;
    }

    else if(n>=800 && n<1000){
        ans = 6 ;
    }

    else if(n>=1000 && n<1200){
        ans = 5 ;
    }

    else if(n>=1200 && n<1400){
        ans = 4 ;
    }
    else if(n>=1400 && n<1600){
        ans = 3 ;
    }
    else if(n>=1600 && n<1800){
        ans = 2 ;
    }
    else if(n>=1800 && n<2000){
        ans = 1 ;
    }
    cout << ans <<endl;
}               

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

    #ifndef ONLINE_JUDGE
    	freopen("inputA.txt", "r", stdin);
	  #endif    
	
    int T=1;
    while(T--) {            
        sol();                
    }
	
	return 0;
}

Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
using namespace std;
const ll N=500010;

ll n,s;
ll ar[N];

ll dp[3010][3010];

ll func(ll idx,ll s)
{
    if(idx<0){
        if(s==0){return 1;}
        else{return 0;}
    }

    if(dp[idx][s]==-1){
        ll ways=0;
        if(s==0){ways=1;}
        ways=(ways+func(idx-1,s))%mod;
        if(s-ar[idx]>=0)
        {ways=(ways+func(idx-1,s-ar[idx]))%mod;}
        dp[idx][s]=ways;
    }
    return dp[idx][s];
}

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

	cin>>n>>s;
	for(ll i=0;i<n;++i){cin>>ar[i];}

	ll ans=0;
	memset(dp,-1,sizeof(dp));
	for(ll i=0;i<n;++i)
    {
        ans=(ans+func(i,s))%mod;
    }
    cout<<ans<<endl;

	return(0);
}


Measured memory_bytes: 72064
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<int,int> P;
int ans,w,h;
int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};
P fromto[20][20][4]={};
int board[20][20];			//h,w
void dfs(int x,int y,int cnt,vector<P>& broken){
	if(cnt>ans || cnt>10) return;
	for(int i=0;i<4;i++){
		int nx=x,ny=y;
		while(true){
			P p=fromto[nx][ny][i];
			nx=p.first;
			ny=p.second;
			if(nx==-1 || board[nx][ny]==3) break;
			if( find(broken.begin(),broken.end(),p)==broken.end() ) break;
		}
		if(nx==-1) continue;
		if(board[nx][ny]==3){
			ans=min(ans,cnt);
			continue;
		}
		if(x==nx-dx[i] && y==ny-dy[i]) continue;
		vector<P> nbroken=broken;
		nbroken.insert( lower_bound(nbroken.begin(),nbroken.end(),P(nx,ny)) , P(nx,ny) );
		dfs(nx-dx[i],ny-dy[i],cnt+1,nbroken);
	}
}
int main(){
	while(true){
		int sx,sy;
		scanf("%d%d",&w,&h);
		if(!w) break;
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				scanf("%d",&board[j][i]);
				if(board[j][i]==2){
					sx=j;
					sy=i;
				}
			}
		}
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				for(int k=0;k<4;k++){
					int nx=j+dx[k],ny=i+dy[k];
					while(!(nx<0 || w<=nx || ny<0 || h<=ny)){
						if(board[nx][ny]%2==1) break;
						nx+=dx[k];
						ny+=dy[k];
					}
					if(nx<0 || w<=nx || ny<0 || h<=ny) nx=-1;
					fromto[j][i][k]=P(nx,ny);
				}
			}
		}
		/*
		for(int i=0;i<h;i++){
			for(int j=0;j<w;j++){
				cout << fromto[j][i][0].first << fromto[j][i][0].second << " ";
			}
			cout << endl;
		}
		*/
		ans=20;
		vector<P> emp;
		dfs(sx,sy,1,emp);
		if(ans==20) ans=-1;
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1224
#include<bits/stdc++.h>
using namespace std;
int n,m,a[10];
int dp[100001];

int main(){
  while(1){
    cin>>n>>m;
    if(n==0&&m==0)break;
    for(int i=0;i<n;i++)cin>>a[i];
    
    int L=1,R=m,M;
    while(L<R){
      M=(L+R)/2;
      memset(dp,-1,sizeof(dp));
      dp[0]=0;
      for(int i=0;i<n;i++){
        for(int j=1;j<=m;j++){          
          if(dp[j]==-1){
            if(j-a[i]>=0&&dp[j-a[i]]!=-1&&dp[j-a[i]]<M)
              dp[j]=dp[j-a[i]]+1;
          }else{
            dp[j]=0;
          }
        }
      }
      if(dp[m]==-1)L=M+1;
      else R=M;
    }
    cout<<L<<endl;    
  }
  return 0;
}

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

int main()
{
  char S[3];
  int res=700;
  cin >> S;

  rep(i,3) {
    if(S[i]=='o') res+=100;
  }

  cout << res << endl;
}

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

#define FOR(i, a, b) for(int i = a; i<b; ++i)
#define FR(a, b) for(int i = a; i>=b;--i)
#define _upgrade cin.tie(0); ios_base::sync_with_stdio(0)
#define pb push_back
#define mp make_pair
#define INF 1e9
#define all(x) (x).begin(), (x).end()

using namespace std;

typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef pair<int, int> iPair;

const int MAX = 1e5+1;
const int M = 1e9+7;

int n, tab[MAX][3], dp[MAX][3];
int main()
{
    _upgrade;
    cin>>n;
    FOR(i, 0, n)
        cin>>tab[i][0]>>tab[i][1]>>tab[i][2];
    dp[0][0] = tab[0][0];
    dp[0][1] = tab[0][1];
    dp[0][2] = tab[0][2];
    FOR(i, 1, n)
    {
        dp[i][0] = tab[i][0] + max(dp[i-1][1], dp[i-1][2]);
        dp[i][1] = tab[i][1] + max(dp[i-1][0], dp[i-1][2]);
        dp[i][2] = tab[i][2] + max(dp[i-1][1], dp[i-1][0]);
    }
    cout<<max(dp[n-1][0], max(dp[n-1][1], dp[n-1][2]));
}


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

unordered_map<ll, int> count_values(const vector<ll> &xs) {
    unordered_map<ll, int> ans;
    for (const auto &x : xs) ++ans[x];
    return ans;
}

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

    int sz;
    cin >> sz;
    vector<ll> xs(sz, 0LL);
    for (auto &x : xs) cin >> x;
    ll s = accumulate(xs.cbegin(), xs.cend(), 0LL);

    auto cnt = count_values(xs);

    int q;
    cin >> q;

    while (q--) {
        int b, c;
        cin >> b >> c;
        const int d = b - c;
        s -= cnt[b] * d;
        cnt[c] += cnt[b];
        cnt[b] = 0;

        cout << s << '\n';
    }

    return 0;
}


Measured memory_bytes: 7796
N = int(input())
W = [int(i) for i in input().split()]
S = 0
for i in range(N):
    S += W[i]
ans = 99999

for i in range(1,N+1):
    S1 = 0
    for j in range(i):
        S1 += W[j]
    S2 = S - S1
    ans = min(ans,abs(S1-S2))

print(ans)

Measured memory_bytes: 9132
#include<cstdio>
#include<cstring>
#include<sys/time.h>

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

using namespace std;

typedef long long ll;

ll gettime(){
	struct timeval tv;
	gettimeofday(&tv,NULL);
	return 1000000LL*tv.tv_sec+tv.tv_usec;
}

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

int h,w,B[9][9];

int x2,y2,x3,y3; // 2, 3 それぞれの出発点

int bfs(int x,int y,int tar){
	int d[9][9];
	memset(d,-1,sizeof d);
	d[y][x]=0;
	int Q[81],head=0,tail=0; Q[tail++]=y*w+x;
	while(head<tail){
		int i=Q[head]/w,j=Q[head]%w; head++;
		rep(k,4){
			int yy=i+dy[k],xx=j+dx[k];
			if(0<=yy && yy<h && 0<=xx && xx<w && d[yy][xx]==-1){
				if(B[yy][xx]==tar) return d[i][j]+1;
				if(B[yy][xx]== 0 ) Q[tail++]=yy*w+xx, d[yy][xx]=d[i][j]+1;
			}
		}
	}
	return 777;
}

ll t0;

int ans;
void dfs(int x,int y,int now){
	int hstar=bfs(x,y,2)+bfs(x3,y3,3);
	if(ans<now+1+hstar) return;

	if(ans==777){ // 3 秒の間に一つも解が見つからなければ解なし
		ll t1=gettime();
		if(t1-t0>3000000){ ans=0; return; }
	}

	// これまでのパスと接したら最適解でないので探索打ち切り
	int cnt=0;
	rep(k,4){
		int xx=x+dx[k],yy=y+dy[k];
		if(0<=xx && xx<w && 0<=yy && yy<h && B[yy][xx]==7) cnt++;
	}
	if(cnt>=2) return;

	rep(k,4){
		int xx=x+dx[k],yy=y+dy[k];
		if(0<=xx && xx<w && 0<=yy && yy<h){
			if(B[yy][xx]==2){
				ans=now+1+bfs(x3,y3,3);
				return;
			}
			else if(B[yy][xx]==0){
				B[yy][xx]=7;
				dfs(xx,yy,now+1);
				B[yy][xx]=0;
			}
		}
	}
}

int main(){
	while(scanf("%d%d",&h,&w),h){
		rep(i,h) rep(j,w) scanf("%d",B[i]+j);

		rep(i,h) rep(j,w) {
			if(B[i][j]==2) x2=j, y2=i;
			if(B[i][j]==3) x3=j, y3=i;
		}
		B[y2][x2]=7; // 訪問済みのマーク

		t0=gettime();
		ans=777;
		dfs(x2,y2,0);
		printf("%d\n",ans<777?ans:0);
	}

	return 0;
}

Measured memory_bytes: 1028