akhauriyash/Code-Regression huggingface dataset:
"use strict"
const create = () => {
    const input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
    const res = {
        "list": input, "index": 0, "max": input.length,
        "hasNext": function() {return this.index < this.max},
        "next": function() { if (!this.hasNext()) {throw "ArrayIndexOutOfBoundsException";}else{return this.list[this.index++];}}
    };
    return res;
}
const o = create();
const next = () => o.next()
const nextInt = () => parseInt(o.next())
const nextStrArray = () => o.next().split(" ")
const nextIntArray = () => o.next().split(" ").map(el => parseInt(el))
const nextCharArray = () => o.next().split("")
const hasNext = () => o.hasNext()
const myout = (...x) => console.log(...x)
const Main = () => {
    const [n,m] = nextIntArray()
    let leftMax = Number.NEGATIVE_INFINITY
    let rightMin = Number.POSITIVE_INFINITY
    while(hasNext()){
        let [l,r] = nextIntArray()
        leftMax = Math.max(leftMax, l)
        rightMin = Math.min(rightMin, r)
    }
    let ans = rightMin-leftMax+1
    if(ans < 0) ans = 0
    console.log(ans)
}
Main()


Measured memory_bytes: 45792
from collections import deque
H, W, M = map(int, input().split())
bomb = []
counth = [0 for k in range(H)]
countw = [0 for k in range(W)]
for k in range(M):
  h, w = map(int, input().split())
  h -= 1
  w -= 1
  bomb.append(h+ w*H)
  counth[h] += 1 
  countw[w] += 1

counth = deque(counth)
countw = deque(countw)

maxh = max(counth)
maxw = max(countw)
index_h = deque([])
index_w = []
for k in range(H):
  h = counth.popleft()
  if h == maxh:
    index_h.append(k)
for k in range(W):
  w = countw.popleft()
  if w == maxw:
    index_w.append(k)

ans = maxh + maxw - 1
lenh = len(index_h)
lenw = len(index_w)

if lenh*lenw > M:
  ans += 1
else:
  bomb.sort()
  bomb = deque(bomb)
  kouho = []
  for i in range(lenh):
    h = index_h.pop()
    for j in range(lenw):
      w = index_w[j]
      kouho.append(h+ H*w)
  kouho.sort()
  kouho = deque(kouho)
  B = bomb.popleft()
  K = kouho.popleft()
  while True:
    if B > K:
      ans += 1
      break
    elif B == K:
      if len(kouho) == 0:
        break
      else:
        K = kouho.popleft()
    else:
      if len(bomb) == 0:
        ans += 1
        break
      else:
        B = bomb.popleft()
print(ans)



Measured memory_bytes: 154772
#include <bits/stdc++.h>
using namespace std;
int n;
int x[200010],y[200010];
int a[200010],b[200010];
int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>x[i]>>y[i];
		a[i]=x[i]-y[i];
		b[i]=x[i]+y[i];
	}
	sort(a,a+n);
	sort(b,b+n);
	cout<<max(a[n-1]-a[0],b[n-1]-b[0])<<endl;
	return 0;
}

Measured memory_bytes: 6772
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

time = [[a, a%10], [b, b%10], [c, c%10], [d, d%10], [e, e%10]]
ans = 0

for i in range(5):
	if time[i][1] == 0:
		time[i][1] = 10
		
time = sorted(time, key = lambda x:x[1], reverse = True)

for i in range(4):
	ans += time[i][0] + (10 - time[i][1])
	
print(ans + time[4][0])

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

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

using namespace std;

int main(){
	int m1,m2; scanf("%d%*d%d%*d",&m1,&m2);
	printf("%d\n",m1==m2?0:1);
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
int N,z,c,i;
int main(){
for(scanf("%d",&N);scanf("%d",&z),[](int n){if(n==1)return 0;if(n==2)return 1;for(int i=2;i<=sqrt((double)n);++i)if(n%i==0)return 0;return 1;}(z)?++c:0,--N;);printf("%d\n",c);
}

Measured memory_bytes: 1024
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

typedef ll T;
int sgn(T x){return (x>0)-(x<0);}
struct P{
    T x,y;
    P(){} P(T x,T y):x(x),y(y){}
    void read(){scanf("%lld%lld",&x,&y);}
    P operator - (const P&b) const {return P(x-b.x,y-b.y);}
    T operator * (const P&b) const {return x*b.x+y*b.y;}
    T operator ^ (const P&b) const {return x*b.y-y*b.x;}
};

struct L{
    P s,t;
    L(){} L(P s,P t):s(s),t(t){}
    void read(){s.read();t.read();}
};

bool isSS(L a,L b){
    T c1=(a.t-a.s)^(b.s-a.s),c2=(a.t-a.s)^(b.t-a.s);
    T c3=(b.t-b.s)^(a.s-b.s),c4=(b.t-b.s)^(a.t-b.s);
    return sgn(c1) * sgn(c2) <= 0 && sgn(c3) * sgn(c4) <= 0 &&
        sgn(max(a.s.x,a.t.x) - min(b.s.x,b.t.x)) >= 0 &&
        sgn(max(b.s.x,b.t.x) - min(a.s.x,a.t.x)) >= 0 &&
        sgn(max(a.s.y,a.t.y) - min(b.s.y,b.t.y)) >= 0 &&
        sgn(max(b.s.y,b.t.y) - min(a.s.y,a.t.y)) >= 0;
}

int main(){
    int Q;scanf("%d",&Q);
    rep(i,0,Q){
        L a,b;a.read();b.read();
        printf("%d\n",isSS(a,b));
    }
    return 0;
}

Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
 int s[7]={46656,7776,1296,216,36,6,1};
  int k[6]={59049,6561,729,81,9,1};
int dfs(int n,int sum){
  if(n==0)return sum;
  int x=-1,y=-1;
  int m=100000;
    for(int i=0;i<7;i++){
      if(s[i]<=n) x=i;
      if(x>=0) break;
    }
    for(int i=0;i<6;i++){
      if(k[i]<=n)y=i;
      if(y>=0) break;
    }
   int a=n/s[x];
     int b=n/k[y];
    int sx,ky;
    sx=a*s[x];
    ky=b*k[y];
    m=min(m,dfs(n-sx,sum+a));
  m=min(m,dfs(n-ky,sum+b));
  return m;
}
int main(){
  int n;cin>>n;
  int ans=1000000;
  for(int i=1;i<36;i++){
    int q=n%i;
    ans=min(ans,dfs(q,0)+dfs(n-q,0));
  }
  cout<<ans<<endl;
}
            



Measured memory_bytes: 380
// Aizu Vol-1 0137: Middle-Square Method
// 2017.8.1

#include <stdio.h>
#include <stdlib.h>

char *gets(char *);
char buf[50];

int main()
{
	int i, n, s, k;

	gets(buf); n = atoi(buf);
	for (i = 1; i <= n; i++) {
		gets(buf); s = atoi(buf);
		printf("Case %d:\n", i);
		for (k = 0; k < 10; k++) {
			s = (s * s / 100) % 10000;
			printf("%d\n", s);
		}
	}
	return 0;
}

Measured memory_bytes: 524
import java.util.Scanner;

public class Main {
    public static void main (String[] args) {

        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int A = sc.nextInt();
        int B = sc.nextInt();

        long ans;
        if (A > B) {
            ans = 0;

        } else if (N == 1) {
            ans = (A == B)? 1 : 0;

        } else {
            ans = (long)(B - A) * (N - 2) + 1;
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 23892
import java.util.*;
 
public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] c = sc.next().toCharArray();
      
      	if((c[0] == c[1] && c[1] == c[2])
           || (c[1] == c[2] && c[2] == c[3])) {
        	System.out.println("Yes");  
        } else {
        	System.out.println("No");  
        }
    }
}

Measured memory_bytes: 23892
#include<bits/stdc++.h>
using namespace std;
const long long Maxn=2e5,Inf=1e16+77;
long long n,ans,a[Maxn],t,k;
int main(){
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a[i];
		if(a[i]>=0 && i>0 && a[i-1]<0)
			t=i;
	}
	if(n-1>=0 && a[n-1]<=0){
		t=n;
	}
	ans=Inf;
	if(n-t>=k && t+k-1>=0)
		ans=a[t+k-1];
	if(t>=k)
		ans=min(ans,abs(a[t-k]));
//	cout<<ans<<endl;
	for(int i=0;i<t;i++){
		if(k+i-1>=t && k+i-1<n){
			ans=min(ans,abs(a[i])+2*(a[k+i-1]));
			ans=min(ans,2*(abs(a[i]))+(a[k+i-1]));
		}
	}
	cout<<ans;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main(){
int counter1,counter2;
int N;
cin>>N;
counter1=0;
counter2=0;
int answer=0;
int counter=0;
int i=0;
string S,T; cin>>S>>T;
while(counter1<N){
if(T.at(i)==S.at(counter1)){
answer++;
counter1++;
i++;}
else {
answer=0;
i=0;
counter2++;
counter1=counter2;
continue;}}
cout<<2*N-answer<<endl;}


Measured memory_bytes: 256
s = list(input())

if len(s) == 1:
  print(0)
  exit()

ans = 0

for i in range(1, len(s)):
  if s[i-1] == s[i]:
    ans += 1
    if s[i] == '0':
      s[i] = '1'
    else:
      s[i] = '0'
  else:
    prev = s[i]

print(ans)

Measured memory_bytes: 3956
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define ll long long
#define ALL(v) (v).begin(),(v).end()
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;



int main() {
  ll n, x; cin >> n >> x;
  Vl l(n);
  rep(i, 0, n) cin >> l[i];
  ll ans = 0;
  ll d = 0;
  ans++;
  rep(i, 0, n){
    d = d + l[i];
    if(d <= x) ans ++;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
    #define loop(i,a,b) for(int i=a;i<b;i++)
    #define loopb(i,a,b) for(int i=a;i>=b;i--)
    #define loopm(i,a,b,step) for(int i=a;i<b;i+=step)
    #define loopbm(i,a,b,step) for(int i=a;i>=b;i-=step)
    #define pb(a) push_back(a)
    #define mp(a,b) make_pair(a,b)
    #define init(arr,val) memset(arr,val,sizeof(arr))
    #define INF 1000000007
    #define MOD 1000000007
    #define BINF 1000000000000000001
    #define int long long int
    #define double long double
     
    using namespace std;
 

  
    
     
    #undef int
    int main()
    {
    #define int long long int
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
      //  freopen("input.txt","r",stdin);
        
        int t=1;
        //cin>>t;
        while(t--)
        {
        	vector<int>height(1000);
        	loop(i,1,1000)
        	{
        		height[i]=0;
        		loop(j,1,i+1) height[i]+=j;
        	}
        	
        	int a,b;
        	cin>>a>>b;
        	int ans=0;
        	loop(i,0,999)
        	{
        		if(height[i]>=a and height[i+1]>=b)
        		{
        			if(height[i]-a==height[i+1]-b)
        			{
        				ans=height[i]-a;
        				break;
        			}
        		}
        	}
        	
        	cout<<ans;
        }
             
            
        
        return 0;
    } 

Measured memory_bytes: 256
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from heapq import heapify, heappop, heappush
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()

if N % 2 == 0:
    print(1/2)
else:
    even = N // 2
    odd = N - even
    print(odd / N)

Measured memory_bytes: 3896
# D

import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import breadth_first_order

N, M = list(map(int, input().split()))
ABs = np.array([list(map(int, input().split())) for i in range(M)])

row = ABs.T[0]-1
col = ABs.T[1]-1
data = [1] * (M)

csr = csr_matrix((data, (row, col)), shape=(N, N))
_, proc = breadth_first_order(csr, 0, directed=False)

if -9999 in proc[1:]:
  print('No')
else:
  print('Yes')
  print('\n'.join((proc[1:]+1).astype('str')))

Measured memory_bytes: 76616
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long sum = 0, n;
	scanf("%lld", &n);
	for(long long i = 1; i <= n; i++){
		if (i % 3 == 0 || i % 5 == 0){
			
		}else{
			sum += i;
		}
	}
	printf("%lld", sum);
	return 0;
}


Measured memory_bytes: 3832
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define rep1(n) for(ll i=0;i<n;++i)
#define rep2(i,n) for(ll i=0;i<n;++i)
#define rep3(i,a,b) for(ll i=a;i<b;++i)
#define rep4(i,a,b,c) for(ll i=a;i<b;i+=c)
#define rep(...) overload4(__VA_ARGS__,rep4,rep3,rep2,rep1)(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define INT(...) int __VA_ARGS__;in(__VA_ARGS__)
#define LL(...) ll __VA_ARGS__;in(__VA_ARGS__)
#define ULL(...) ull __VA_ARGS__;in(__VA_ARGS__)
#define STR(...) string __VA_ARGS__;in(__VA_ARGS__)
#define CHR(...) char __VA_ARGS__;in(__VA_ARGS__)
#define DBL(...) double __VA_ARGS__;in(__VA_ARGS__)
#define LD(...) ld __VA_ARGS__;in(__VA_ARGS__)
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, nod, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R;
ll MOD = 1000000007; ll INF = 1LL << 62; ll ans = 0; ll z = 0, o = 1;
vl flag, color, D; vll path;
int main() {
	string S;
	cin >> S;
	N = S.length();
	for (i = 0; i < N; i++) {
		if (S[i] != S[i + 1]) ans++;
	}
	cout << ans - 1;
}

Measured memory_bytes: 512
d,g=map(int,input().split())
pc=[list(map(int,input().split())) for i in range(d)]
dp=[[-1]*(1001) for i in range(d)]
for i in range(d):
    dp[i][0]=0
lst=[]
for i in range(d):
    p,c=pc[i]
    h=[0]
    for j in range(1,p):
        h.append(100*(i+1)*j)
    h.append(100*(i+1)*p+c)
    lst.append(h)
for i in range(d):
    p,c=pc[i]
    h=lst[i]
    if i==0:
        for j in range(1,p+1):
            dp[0][j]=h[j]
    else:
        for j in range(1,p+1):
            for k in range(j,1001):
                if dp[i-1][k-j]!=-1:
                    dp[i][k]=max(dp[i-1][k-j]+h[j],dp[i-1][k])
                else:
                    break
for i in range(1,1001):
    if dp[d-1][i]>=g:
        print(i)
        break  

Measured memory_bytes: 40048
#include<iostream>
#include<string>
using namespace std;
int main(){
	string S,T;
	bool flg=true;
	cin>>S>>T;
	if(T.size()-S.size()!=1)cout<<"No"<<endl;
	else {
		for(int i=0;i<S.size();i++){
		if(S[i]!=T[i])flg=false;
	}
		if(flg)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
}

Measured memory_bytes: 3132
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String target = sc.next();
        target = target.toUpperCase();
        int count = 0;
        while(true){
            String word = sc.next();
            if(word.equals("END_OF_TEXT")){break;}
            word = word.toUpperCase();
            if(word.equals(target)){count++;}
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 26232
#include <stdio.h>

int main(void){
    int N, K;
    scanf("%d%d", &N, &K);
    int cnt[N];
    for (int i = 0; i < N;i++){
        cnt[i] = 0;
    }


    for (int i = 0; i < K; i++){
        int d;
        scanf("%d", &d);
        int A[d];
        for (int k = 0; k < d;k++){
            scanf("%d", &A[k]);
        }
        for (int j = 0; j < d; j++){
            int a = A[j]-1;
            cnt[a]++;
        }
    }

        int count = 0;
    for (int i = 0; i < N;i++){
        if (cnt[i] == 0){
            count++;
        }
    }

    printf("%d", count);
    return 0;
}

Measured memory_bytes: 1704
#include <iostream>
#include <cmath>
#include <string.h>
#include <iomanip>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <tuple>
#include <queue>
using namespace std;

typedef long long ll;

#define INF 100000000;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repl(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define eps 1.0e-14;
#define mod 1e9 + 7;

int main(){
	int a,b,c,x,y; cin >> a >> b >> c >> x >> y;
	ll ans[3] = {0,0,0};
	ll tans = 0;
	ans[0] = a * x + b * y;
	int min = (x >= y) ? y : x;
	int big = (x >= y) ? x : y;
	int bigab = (x >= y) ? a : b;
	int minab = (x >= y) ? b : a;
	ans[1] = c * (min * 2) + (big - min) * bigab;
	ans[2] = c * (big * 2);
	tans = (ans[0] >= ans[1]) ? ans[1] : ans[0];
	tans = (tans >= ans[2]) ? ans[2] : tans;
	cout << tans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
#define pb push_back
#define mp make_pair
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for(ll i = 0; i < n; ++i)
#define repr(i,n) for(int i = n - 1; i >= 0; --i)
#define Rep(i, a, n) for(int i = (a); i <=(n); ++i)
#define repst(i, n) for(auto it = n.begin(); it != n.end(); ++it)
#define Repr(i, a, n) for(int i = (n); i >= (a); --i)
typedef long long ll;

const int inf = int(1e9);
const int mod = inf + 7;
const int N = 5e5 + 555;
void solve()
{
	int n;
	cin >> n;
	int a[n];
	rep(i, n) cin >> a[i];
	sort(a, a + n);
	cout << a[n / 2] - a[n / 2 - 1];
}
int main()
{
	Red;
	solve();
	return 0;
}


Measured memory_bytes: 640
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];
    vector<ll> sum(N + 1);
    rep(i, N) sum[i + 1] = sum[i] + A[i];
    map<ll, ll> mp;
    rep(i, N + 1) { mp[sum[i]]++; }
    ll res = 0;
    for(pair<ll, ll> p : mp) {
        res += (p.second * (p.second - 1)) / 2;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 15872
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import collections

def main():
    S = input()

    c = collections.Counter(S)
    if (c["N"] > 0 and c["S"] == 0) or (c["N"] == 0 and c["S"] > 0):
        ok = False
    elif (c["W"] > 0 and c["E"] == 0)  or (c["W"] == 0 and c["E"] > 0):
        ok = False
    else:
        ok = True

    print("Yes" if ok else "No")

if __name__ == "__main__": main()


Measured memory_bytes: 3316
#include <math.h>
#include <assert.h>

#include <vector>
#include <numeric>
#include <iostream>
#include <algorithm>
#include <functional>

template <typename T>
void in(T& x) {
    std::cin >> x;
}

template <typename T>
void out(const T H) {
    std::cout << (H);
}

template <typename T1, typename... T2>
void out(const T1 H, const T2... T) {
    std::cout << (H) << " "; out(T...);
}

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

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

template <typename T>
void eout(const char *s, const T H) {
    std::cerr << s << "=" << H << "\n";
}

template <typename T1, typename... T2>
void eout(const char *s, const T1 H, const T2... T) {
    while (*s != ',') std::cerr << *s++;
    std::cerr << "=" << H << " | "; eout(++s, T...);
}

#define nl                std::cout << "\n"
#define err(args...)      eout(#args, args)

#define inn(x)            int x; in(x)
#define rep(i, n)         for (int i =  0 ; i < (n); ++i)
#define per(i, n)         for (int i = (n) - 1; i > -1; --i)
#define repr(i, l, r)     for (int i = (l); i < (r); ++i)

#define sz(v)             ((int) v.size())
#define all(v)            (v).begin(), (v).end()
#define lla(v)            (v).rbegin(), (v).rend()

#define no                std::cout << "NO\n"
#define yes               std::cout << "YES\n"

const int INF           = 2147483647;
const long long int LNF = 9223372036854775807LL;

using ll  = long long int;
using vi  = std::vector<int>;
using vb  = std::vector<bool>;
using ii  = std::pair<int, int>;
using iii = std::pair< ii, int>;
using vii = std::vector<ii>;

const int N  = 505050;
const int MD = 1000*1000*1000 + 7;

int solve();
int main() {
    std::ios_base::sync_with_stdio(0); std::cin.tie(0);
    //std::cout.tie(0);

    //inn(t); repr(tc, 1, t + 1)
    solve();

    return 0;
}

int solve() {
    inn(a); inn(b);
    out(std::max(a*b, std::max(a - b, a+b)));
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x) // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    ll ans = 0;
    vector<ll> v(3 * n);
    for (ll i = 0; i < 3 * n; i++)
    {
        cin >> v[i];
    }
    sort(ALL(v), greater<>());
    for (ll i = 0; i < 2 * n; i += 2)
    {
        ans += v[i + 1];
    }
    cout << ans << endl;
}

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

typedef long long int ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ar array
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
const ll mod = 1e9 + 7;
const ll inf = 2e9 + 5;
double PI = 3.14159265358979323846;

ll dp[3005][3005][4];
ll grid[3005][3005];
ll r, c, k;


void solve() {

	cin >> r >> c >> k;
	memset(dp, 0, sizeof(dp));
	for (int i = 0; i < k; i++) {
		ll x, y, v;
		cin >> x >> y >> v;
		grid[x][y] = v;
	}

	for (int i = 1; i <= r; i++) {
		for (int j = 1; j <= c; j++) {
			ll above = max({dp[i - 1][j][0], dp[i - 1][j][1], dp[i - 1][j][2], dp[i - 1][j][3]});
			dp[i][j][0] = max({dp[i][j][0], dp[i][j - 1][0], dp[i][j - 1][1] + grid[i][j], above});
			dp[i][j][1] = max({dp[i][j][1], dp[i][j - 1][1], dp[i][j - 1][2] + grid[i][j], above});
			dp[i][j][2] = max({dp[i][j][2], dp[i][j - 1][2], dp[i][j - 1][3] + grid[i][j], above+grid[i][j]});
			dp[i][j][3] = max({dp[i][j][3], dp[i][j - 1][3], above});
		}
	}
	cout << max({dp[r][c][0], dp[r][c][1], dp[r][c][2], dp[r][c][3]}) << endl;

	// for(int i = 0;i <= r;i++){
	// 	for(int j = 0;j <= c;j++){
	// 		for(int k = 0;k <=3;k++){
	// 			cout << dp[i][j][k] << ".";
	// 		}cout << "  ";
	// 	}cout << endl;
	// }



}

int32_t main()
{
	IOS
	// int T; cin >> T; while (T--)
	solve();
	return 0;
}


Measured memory_bytes: 356100
#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
#define REP(i, n) for(int i = 1; i < (int)(n); ++i)
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> R(n);
    rep(i, n) cin >> R[i];
    
    vector<int> M(n);
    M[n - 1] = R[n - 1];
    for (int i = n - 2; i >= 0; --i) {
        M[i] = max(M[i + 1], R[i]);
    }
    
    int ans = -2100000000;
    rep(i, n - 1) {
        ans = max(ans, M[i + 1] - R[i]);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 4428
import numpy as np
import math

n = int(input())
a = list(map(int, input().split(" ")))

min = 2
max = 2

for i in reversed(a):
    min = math.ceil(min / i) * i
    max = math.floor(max / i) * i + i - 1
    if(min > max):
        print(-1)
        exit()

print("%d %d" %(min, max))

Measured memory_bytes: 23384
# 人数, 初期ライフ, 問題数
n, k, q = gets.chomp.split(' ').map{|s| s.to_i}

score = Array.new(n,0)

for i in 0..q-1 do
  x = gets.chomp.to_i
  score[x-1] += 1
end

for i in 0..n-1 do
  if k - (q - score[i]) <= 0 then
    print "No\n"
  else
    print "Yes\n"
  end
end


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
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;
}

using ll = long long;
using ull = unsigned long long;
const ll INF = 1e18;
// const int MOD = 1e9 + 7;

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

    ll max_xpy = -INF;
    ll min_xpy = INF;

    ll max_xmy = -INF;
    ll min_xmy = INF;

    ll max_ymx = -INF;
    ll min_ymx = INF;

    ll max_mxmy = -INF;
    ll min_mxmy = INF;

    for (int i = 0; i < N; i++) {
        chmax(max_xpy, x[i] + y[i]);
        chmin(min_xpy, x[i] + y[i]);

        chmax(max_xmy, x[i] - y[i]);
        chmin(min_xmy, x[i] - y[i]);

        chmax(max_ymx, y[i] - x[i]);
        chmin(min_ymx, y[i] - x[i]);
        
        chmax(max_mxmy, -x[i] - y[i]);
        chmin(min_mxmy, -x[i] - y[i]);
    }

    cout << max(max_xpy - min_xpy, max(max_xmy - min_xmy, max(max_ymx - min_ymx, max_mxmy - min_mxmy))) << endl;
}


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

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=n; i--)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod = 1e9 + 7;
const ll inf = 1e18;

ll K, A, B;
ll ans;
int main() {
	cin>>K>>A>>B;
	ans=1;
	if(B-A<3 || A > K){
		ans+=K;
	}else{
		ans+=A-1;
		K-=A-1;
		ans+=(B-A)*(K/2);
		if(K%2==1){
			ans+=1;
		}
	}
	p(ans);
	return 0;
}


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

int previ[100000 + 2];
int dist[100000 + 2];
int size[100000 + 2];

int root(int x) {
  if (previ[x] == -1) return x;
  int px = previ[x];
  int xx = root(previ[x]);
  dist[x] = dist[px] + dist[x];
  previ[x] = xx;
  return previ[x];
}

int main() {
  memset(previ, 0, sizeof(previ));
  memset(dist, 0, sizeof(dist));
  memset(size, 0, sizeof(size));

  int N, M, L, R, D;
  cin >> N >> M;

  for (int i = 0; i < N; ++i) {
    previ[i] = -1;
    size[i] = 1;
  }

  bool ok = true;
  for (int i = 0; i < M; ++i) {
    cin >> L >> R >> D;
    L--, R--;
    if (root(L) == root(R)) {
      // check
      if (dist[R] + D != dist[L])
        ok = false;
    } else {
      int x = root(L), y = root(R);
      int x_to_y = -dist[L] + D + dist[R];
      if (size[x] >= size[y]) {
        previ[y] = x;
        size[x] += size[y];
        dist[y] = -x_to_y;
      } else {
        previ[x] = y;
        size[y] += size[x];
        dist[x] = x_to_y;
      }
      root(L), root(R);
    }
  }

  if (ok)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}


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

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

#define rep(i,cc,n) for(int i=cc;i<n;++i)
#define lrep(i,cc,n) for(long long i=cc;i<n;++i)
#define sqrep(i,cc,n) for(long long i=cc;i*i<=n;++i)
#define rrep(i,cc,n) for(long i=cc;i>n;--i)
#define pii pair<int, int>
#define pll pair<long long, long long>
 
using ll = long long;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};
const ll inf = 1001001001;
const ll e9  = 1000000000;
const ll mod = 1000000007;

int main() {
  int a;
  cin >> a;
  rep(i, 1, 12){
    int p = 1000*i;
    if(p >= a){
      cout<< p-a << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3624
#include <stdio.h>

int main (){
    int a,b,c,t;
    scanf("%d%d%d",&a,&b,&c);
    if (a > b){
        t = a;
        a = b;
        b = t;
    }
    if (b > c){
        t = b;
        b = c;
        c = t;
    }
    if (a > b){
        t = a;
        a = b;
        b = t;
    }
    printf("%d %d %d\n",a,b,c);
    return 0;
}



Measured memory_bytes: 2692
#include <iostream>
using namespace std;
int main()
{
 int n,s=0;
 cin>>n;
 int m=n;
 while(m!=0)
 {
  s+=m%10;
  m=m/10;
 }
 if(n%s==0)
 cout<<"Yes";
 else
 cout<<"No";
 return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T>
using vec = vector<T>;

#define FOR(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define all(x) (x).begin(),(x).end()

int main(){
  int n;
  cin >>n;
  vec<int> a(3*n);
  REP(i,3*n) cin >>a[i];

  lint ans=0;
  sort(all(a));
  reverse(all(a));
  REP(i,n){
    ans += a[i*2+1];
  }

  cout <<ans <<endl;
}


Measured memory_bytes: 1408
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;

public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
        Map<String,String> map=new HashMap<String,String>();
        byte[] asciiCodes1 = new byte[26];
        byte[] asciiCodes2 = new byte[26];
        int j=0;
        for(byte i=0;i<26;i++){
        	asciiCodes1[j]=(byte) ((byte)65+i);
        	asciiCodes2[j]=(byte) ((byte)68+i);
        	j++;
        }
        asciiCodes2[23]=(byte) ((byte)65);
        asciiCodes2[24]=(byte) ((byte)66);
        asciiCodes2[25]=(byte) ((byte)67);
        String resultString2 = new String(asciiCodes1, "US-ASCII");
        String resultString = new String(asciiCodes2, "US-ASCII");
        
        for(int i=0;i<26;i++){
        	map.put(resultString.substring(i, i+1), resultString2.substring(i, i+1));
        }
        
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line,str="";
            while ((line = br.readLine()) != null) {
            	for(int k=0;k<line.length();k++){
            		str+=map.get(line.substring(k, k+1));
            	}
            	System.out.println(str);
            	break;
            }
            
        }
    }

}

Measured memory_bytes: 28192
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back

vector<ll> z_function(string s)
{
    vector<ll> z(s.size(),0);
    ll l=0,r=0;
    z[0]=0;
    for(int i=1;i<s.size();i++)
    {
        if(i<=r)
            z[i]=min(r-i+1,z[i-l]);
        while(i+z[i]<s.size() && s[z[i]]==s[i+z[i]]) z[i]++;
        if(i+z[i]-1>r)
        {
            l=i; r=i+z[i]-1;
        }
    }
    return z;
}

vector<ll> prefix_function(string s)
{
    vector<ll> pi(s.size());
    pi[0]=0;
    for(int i=1;i<s.size();i++)
    {
        ll j=pi[i-1];
        while(j>0 && s[j]!=s[i]) j=pi[j-1];
        if(s[j]==s[i]) j++;
        pi[i]=j;
    }
    return pi;
}

int main()
{
    ll n;cin>>n;
    cout<<(n^1);
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
#define ll long long
int MOD = 1e9+7;
using namespace std;


int inf = 1e9 + 5;
 
int main()
{
	int n;cin>>n;
	vector<int> acts(3);
	vector<int>dp(3,0);
	vector<int> temp(3);
	for(int i=0; i<n; i++)
	{
		cin>>acts[0]>>acts[1]>>acts[2];
		for(int j=0; j<3; j++)
			temp[j] = dp[j];

		for(int j=0; j<3; j++)
		{
			if(i==0)
				dp[j] = acts[j];

			else
			{

				dp[j] = max(temp[(j+1) % 3],temp[(j+2) % 3]) + acts[j];
			}
		}
	}
	cout<<max(max(dp[0],dp[1]),dp[2]);



    
    return 0;
    
}    


	





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

using namespace std;

int main(void)
{
    int N;
    cin >> N;
    vector<uint64_t> A(N);

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

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

    cout << A.back() - A.front() << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define endl '\n'
#define FOR(i, a, n) for (int i = (a); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;

// coordinate compression
template <typename T> struct Compress {
    map<T, int> zip;
    vector<int> unzip;

    Compress(vector<T> v) {
        sort(v.begin(), v.end());
        v.erase(unique(v.begin(), v.end()), v.end());
        for (int i = 0; i < v.size(); ++i) {
            zip[v[i]] = i;
            unzip.push_back(v[i]);
        }
    }

    int size() { return unzip.size(); }
};

// Binary Indexed Tree 1D (SumAddQuery)
template <class Abel> struct BIT1D_SumAdd {
    size_t n;
    vector<Abel> d;

    BIT1D_SumAdd(size_t n) : n(n), d(n + 1, 0) {}

    // d[1] + ... + d[i] (i : 1-indexed)
    Abel sum(size_t i) {
        Abel res = 0;
        while (i > 0) {
            res += d[i];
            i -= i & -i;
        }
        return res;
    }
    // d[i] + ... + d[j] (i,j : 1-indexed)
    Abel sum(size_t i, size_t j) { sum(j) - sum(i - 1); }

    // d[i] += x
    void add(size_t i, Abel x) {
        while (i <= n) {
            d[i] += x;
            i += i & -i;
        }
    }
};

// count the number of pair (i, j) s.t. i < j and a[i] > a[j] (or a[i] >= a[j])
int inversion_number(const vector<int>& a, bool equal = false) {
    Compress<int> comp(a);
    const size_t n = a.size();
    BIT1D_SumAdd<int> bit(comp.size());
    int res = 0;
    for (int i = 0; i < n; ++i) {
        res += i - bit.sum(comp.zip[a[i]] + 1 - equal);
        bit.add(comp.zip[a[i]] + 1, 1);
    }
    return res;
}

bool check(const vector<int>& a, int x) {
    const int N = a.size();
    vector<int> b(N + 1, 0);
    REP (i, N) {
        if (a[i] < x) b[i + 1] = -1;
        else b[i + 1] = 1;
        b[i + 1] += b[i];
    }
    int inv = inversion_number(b);
    return 4 * inv <= N * (N + 1);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int N;
    cin >> N;
    vector<int> a(N);
    REP (i, N) cin >> a[i];
    int ok = *min_element(a.begin(), a.end()), ng = *max_element(a.begin(), a.end()) + 1;
    while (ng - ok > 1) {
        int m = (ok + ng) / 2;
        if (check(a, m)) ok = m;
        else ng = m;
    }
    cout << ok << endl;
}

Measured memory_bytes: 7888
while 1:
    s = str(input())
    if s == "#":
        break
    cnt = 0
    left = ["q","w","e","r","t","a","s","d","f","g","z","x","c","v","b"]
    right = ["y","u","i","o","p","h","j","k","l","n","m"]
    if s[0] in left:
        now = "left"
    elif s[0] in right:
        now = "right"
    for i in range(len(s)):
        if  s[i] in left:
            if now != "left":
                cnt += 1
                now = "left"
        elif s[i] in right:
            if now != "right":
                cnt += 1
                now = "right"
    print(cnt)


Measured memory_bytes: 5568
#include<stdio.h>
#include<stack>
#include<queue>
#include<string.h>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
using namespace std;
int main()
{
	int a,b,c,d;
	scanf("%d %d %d %d",&a,&b,&c,&d);
	int r,u;
	r=c-a;
	u=d-b;
	for(int i=0;i<u;i++)
    printf("U");
    for(int i=0;i<r;i++)
    printf("R");
	for(int i=0;i<u;i++)
    printf("D");
    for(int i=0;i<r;i++)
    printf("L");
	printf("L");
    for(int i=0;i<(u+1);i++)
    {
    	printf("U");
	}
	for(int i=0;i<(r+1);i++)
	{
		printf("R");
	}
	printf("D");
	printf("R");
	for(int i=0;i<(u+1);i++)
	{
	    printf("D");
    }
    for(int i=0;i<(r+1);i++)
    {
    	printf("L");
	}
	printf("U");
	return 0;
}

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

using namespace std;
using ll=long long;
using ull=unsigned long long;

typedef pair<int,int>Pi;
typedef pair<long long,long long>P;
typedef pair<long long,P>PP;
typedef pair<P,P>PPP;

const long long MOD=1e9+7;
const long long INF=5e18;
const int di[4]={1,0,-1,0};
const int dj[4]={0,1,0,-1};

#define fr first
#define sc second
#define pb push_back
#define eb emplace_back
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()

int n;
ll cnt[30],ans;
string s;

void input(){
	cin>>n>>s;
	return;
}

void solve(){
	for(int i=0;i<26;i++){
		cnt[i]=0;
	}
	for(int i=0;i<n;i++){
		cnt[s[i]-'a']++;
	}
	for(int i=0;i<26;i++){
		cnt[i]++;
	}
	ans=1;
	for(int i=0;i<26;i++){
		ans*=cnt[i];
		ans%=MOD;
	}
	cout<<((ans+MOD)-1)%MOD<<endl;
	return;
}

int main(){
	input();
	solve();
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)

ll k, a = 100;

int main() {
	fastio; cin >> k;
	FOR(i, 1, 4000) {
		a *= (1.01);
		if (a >= k) {
			cout << i; 
			return 0;
		}
	}
}


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

#define ll long long
#define ld long double
#define inf 100000000000000000
#define rep(i,a) for(ll i=0; i<a; ++i)
#define pb push_back

ld p[6], q[6], x[6], f[6];
ll n=6;

int main() {
  ios::sync_with_stdio(false);
  rep(i,n) {
    cin>>p[i];
  }
  rep(i,n) {
    cin>>q[i];
  }
  rep(i,n) {
    if (p[i]+q[i]!=0) {
      x[i] = q[i]/(p[i]+q[i]);
    }
  }

  rep(i,n) {
    if (p[i]+q[i]!=0) {
      rep(j,n) {
        f[i] += max(p[j]*x[i], q[j]*(1-x[i]));
      }
    }
  }
  ld minf = inf;
  rep(i,n) {
    if (p[i]+q[i]!=0 && f[i]<minf) {
      minf = f[i];
    }
  }
  minf = minf/100;
  cout<<fixed<<setprecision(10)<<minf<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_map>
#define ull unsigned long long
#define int long long
#define ll long long
#define fr(i, n) for (int i = 0; i < n; i++)
#define frf(i, j, n) for (int i = j; i <= n; i++)
#define frd(i, n) for (int i = n; i >= 0; i--)
#define mp(i, j) make_pair(i, j)
#define pb(x) push_back(x)
using namespace std;
// typedef vector<vector<ll>> matrix;
// const ll PRIME = 1e9 + 7;
// typedef pair<int,pair<int,int> >  ppi;
void solve()
{
   int n;
   cin>>n;
   if(n<600)
   {cout<<8;return;}
   else if(n<800)
   {
       cout<<7;
       return;
   }
   else if(n<1000)
   {
       cout<<6;
       return;
   }
   else if(n<1200)
   {
       cout<<5;
       return;
   }
   else if(n<1400)
    {
        cout<<4;
        return;
    }
    else if(n<1600)
    {
        cout<<3;
        return;
    }
    else if(n<1800)
    {
        cout<<2;
        return;
    }
    else
    {
        cout<<1;
    }
    
    
}
int32_t main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int t;
    // cin >> t;
    t = 1;
    while (t--)
    {

        solve();
    }
}

Measured memory_bytes: 3684
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <numeric>
#include <cstdint>
#include <iomanip>
#include <set>
using ll = long long;
#define fast_io(); std::ios_base::sync_with_stdio(0); std::cin.tie(0); std::cout.tie(0);

int main(){
    ll n,a,b; std::cin >> n >> a >> b;

    if(a>b){
        std::cout << 0 << "\n";
        return 0;
    }
    if(n==1 && a==b){
        std::cout << 1 << "\n";
        return 0;
    }
    if(n==1 && a!=b){
        std::cout << 0 << "\n";
        return 0;
    }

    std::cout << ( a + b*(n-1) ) - ( a*(n-1) + b ) + 1 << "\n";
    return 0;
}


Measured memory_bytes: 3628
/******************************************
* NICK : nikhilsinghh59 *
******************************************/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"

#define PB push_back
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
const int M = 1e9+7;

int main()
{   
    

    ll n,m;
    cin >> n >> m;

    ll sum=0;

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

    sort(ar , ar+n);
    reverse(ar , ar+n);

    if(sum%(4*m) == 0) {
        if(ar[m-1] < sum/(4*m)) {
            cout << "No";
        }
        else {
            cout << "Yes";
        }
    }
    else {
        if(ar[m-1] <= sum/(4*m)) {
            cout << "No";
        }
        else {
            cout << "Yes";
        }
    }
    
    return 0;
}

Measured memory_bytes: 256
num = gets.to_i
t,a = gets.split.map(&:to_f)
talls = gets.split.map(&:to_f)
ave_temp = talls.map{|n| t - n * 0.006}
diff = ave_temp.map{|i| (a - i).abs}

puts diff.index(diff.min) + 1

Measured memory_bytes: 1788
import java.util.Scanner;
//import java.util.Arrays;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		//String s = sc.next();
		//String t = sc.next();
		System.out.println(sc.nextInt() <= sc.nextInt() ? "unsafe" : "safe");
	}
}


Measured memory_bytes: 35448
import java.util.Arrays;
import java.util.Scanner;

public class Main{

	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int N;
		N = sc.nextInt();
		long D;
		D = sc.nextInt();
		long[] A=new long[N];
//		long sum=0;
		long ans=D%N;


/*		for (int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
			sum=sum+A[i];
			if(max<A[i]) {
				max2=max;
				maxno2=maxno;
				max=A[i];
				maxno=i;
			}
		}
		*/

			
				if(ans>0) {
					System.out.print(D-N); 	
				}else {
					System.out.print(D+N); 	
						
				}
	}
}




Measured memory_bytes: 22740
# 2020/05/17
# AtCoder Beginner Contest 145 - C

# Input
n = int(input())
xy = list()
for i in range(n):
    xy.append(list(map(int,input().split())))

dsum = 0
dist_l = [[0] * n for k in range(n)]
for i in range(n-1):
    for j in range(i+1, n):
        dist = ((xy[i][0] - xy[j][0]) ** 2 + (xy[i][1] - xy[j][1]) ** 2) ** (1/2)
        dist_l[i][j] = dist
        dist_l[j][i] = dist
        dsum = dsum + dist

ans = dsum * (n-1) / (n * (n-1) / 2)

# Output
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef pair <int,int> P;
int main(){
    int n;
    cin >> n;
    string s,t;
    cin >> s>>t;
    for(int i=n;i>=1;i--){
        if(t.substr(0,i)==s.substr(n-i,i)){
            cout<<2*n-i<<endl;
            return 0;
            
        }
    }
    cout<<2*n<<endl;
  return 0;
}

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

int main() {
    int N, M; cin >> N >> M;
    vector<vector<int> > s(M);
    for (int i = 0; i < M; ++i) {
        int k; cin >> k;
        for (int j = 0; j < k; ++j) {
            int a; cin >> a; --a;
            s[i].push_back(a);
        }
    }
    vector<int> p(M);
    for (int i = 0; i < M; ++i) cin >> p[i];
    
    long long res = 0;
    for (int bit = 0; bit < (1<<N); ++bit) {
        bool ok = true;
        for (int i = 0; i < M; ++i) {
            int con = 0;
            for (auto v : s[i]) {
                if (bit & (1<<v)) ++con;
            }
            if (con % 2 != p[i]) ok = false;
        }
        if (ok) ++res;
    }
    cout << res << endl;
}

Measured memory_bytes: 3556
fun main (args:Array<String>){
    val n = readLine()!!.toInt()
    val numList = readLine()!!.split(" ").map(String::toInt)
    var even = mutableListOf<Int>()
    numList.forEach{
        if(it % 2 == 0){
            even.add(it)
        }
    }
    var count = 0
    even.forEach{
        if(it % 3 == 0 || it % 5 == 0){
            count++
        }
    }
    if(count == even.size) print("APPROVED")
    else print("DENIED")
}

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

vector<int> to[100005];
int n;

vector<int> dist;
void dfs(int v, int d=0, int p=-1) {
  dist[v] = d;
  for (int u : to[v]) {
    if (u == p) continue;
    dfs(u,d+1,v);
  }
}
vector<int> calcDist(int s) {
  dist = vector<int>(n);
  dfs(s);
  return dist;
}

int main() {
  cin >> n;
  int s, t;
  cin >> s >> t;
  --s; --t;
  rep(i,n-1) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    to[a].push_back(b);
    to[b].push_back(a);
  }

  vector<int> distS = calcDist(s);
  vector<int> distT = calcDist(t);

  int mx = 0;
  rep(i,n) {
    if (distS[i] < distT[i]) {
      mx = max(mx, distT[i]);
    }
  }
  int ans = mx-1;
  cout << ans << endl;
  return 0;
}


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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef struct data{
	int place;
	int cost;

	bool operator<(const data &ri) const{
		return cost < ri.cost;
	}
	bool operator>(const data &ri) const{
		return cost > ri.cost;
	}
}data;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};



int main(){
	string s;
	cin >> s;
	if((int)s.size() == 2) cout << s << endl;
	else cout << s[2] << s[1] << s[0] << endl;

	return 0;
}

Measured memory_bytes: 256
use io::*;
use proconio::{fastout, input};
use std::*;

#[fastout]
fn main() {
    input! {
        mut n : i64
    }
    let mut res = String::new();

    while n > 0 {
        n -= 1;
        res.push(('a' as u8 + (n % 26) as u8) as char);
        n /= 26;
    }
    print!("{}", res.chars().rev().collect::<String>());
}


Measured memory_bytes: 2104