akhauriyash/Code-Regression huggingface dataset:
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
#include <cassert>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#define ALL(v) begin(v),end(v)
#else
#define ALL(v) (v).begin(),(v).end()
#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
	v.assign(a, vector<T>(b, t));
}
template <class T> inline T &chmin(T &x, const T &y){ return x = min(x, y); }
template <class T> inline T &chmax(T &x, const T &y){ return x = max(x, y); }
template <class F, class T>
void convert(const F &f, T &t){
	stringstream ss;
	ss << f;
	ss >> t;
}


#define REP(i,n) for(int i=0;i<int(n);++i)
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8


void mainmain(){
	string s;
	char c;
	while(cin >> c){ s += c; }
	sort(ALL(s));
	cout << (s == "1479" ? "YES\n" : "NO\n");
}



}
int main() try{
//	ios::sync_with_stdio(false); cin.tie(0);
	cout << fixed << setprecision(10);
	cerr << fixed << setprecision(4);
	mainmain();
}
catch(...){}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        char[] s = sc.next().toCharArray();
        int[] abcd = new int[4];
        for(int i = 0; i < 4; i++){
            abcd[i] = Character.getNumericValue(s[i]);
        }
        for(int i = 0; i < 2; i++){
            String opi = (i == 0) ? "+" : "-";
            int tmp = (i == 0) ? abcd[0] + abcd[1] : abcd[0] - abcd[1];
            
            for(int j = 0; j < 2; j++){
                
                String opj = (j == 0) ? "+" : "-";
                tmp += (j == 0) ? abcd[2] : -abcd[2];
                
                for(int k = 0; k < 2; k++){
                    String opk = (k == 0) ? "+" : "-";
                    tmp += (k == 0) ? abcd[3] : -abcd[3];
                    
                    if(tmp == 7){
                        System.out.println(abcd[0] + opi + abcd[1] + opj + abcd[2] + opk + abcd[3] + "=7");
                        return;
                    }
                    tmp -= (k == 0) ? abcd[3] : -abcd[3];
                }
                
                tmp -= (j == 0) ? abcd[2] : -abcd[2];
            }
        }
    }
}


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
#define PER(i,n) for(int i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



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

  string s;
  cin >> s;
  YesorNo(s.find("AC") != string::npos);
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;int*t,n,m,d,i,s[99999];main(){for(;cin>>d>>n>>m;cout<<i<<'\n'){for(s[i=n]=d;--i;)cin>>s[i];for(sort(s,s+n);m--;t=upper_bound(s,s+n,d),i+=min(d-*--t,*t-d))cin>>d;}}

Measured memory_bytes: 1248
#include<bits/stdc++.h>
using namespace std;
int main(){
  long long a,b,c;
  cin >> a >> b >> c;
  if(a%2==0||b%2==0||c%2==0){
    cout << 0 << endl;
  }
  else{
    cout << min(min(a*b,b*c),c*a) << endl;
  }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>

#include <memory>
#include <string>
#include <vector>
#include <queue>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <deque>
#include <algorithm>
#include <random>
#include <iomanip>
using namespace std;

int main(int argc, char *argv[]) {
	unordered_set<int> us;
	us.insert(0);
	int n;
	cin >> n;
	for (int i = 0; i <= n; i++) {
		if (us.find(i) != us.end()) {
			for (int j = 100; j <= 105; j++) {
				us.insert(j + i);
			}
		}
	}
	if (us.find(n) != us.end())
		cout << 1 << endl;
	else
		cout << 0 << endl;
}


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

import sys
import os


N = int(input())
s = list(input())

def judge(X):
    for i in range(1, N - 1):
        left = X[i - 1]

        if X[i] == 0:
            if s[i] == 'o':
                right = left
            else:
                right = 1 - left
        else:
            if s[i] == 'o':
                right = 1 - left
            else:
                right = left
        X.append(right)

    # 全体で確認
    is_consistent = True
    for i in range(N):
        left = X[i-1]
        if i+1 <= N-1:
            right = X[i + 1]
        else:
            right = X[i + 1 - N]

        if X[i] == 0:
            if s[i] == 'o':
                if left != right:
                    is_consistent = False
            else:
                if left == right:
                    is_consistent = False
        else:
            if s[i] == 'o':
                if left == right:
                    is_consistent = False
            else:
                if left != right:
                    is_consistent = False
    return is_consistent, X

# 0: sheep
# 1: wolf
X_list = [[0, 0], [0, 1], [1, 0], [1, 1]]

results = []
for X in X_list:
    results.append(judge(X))

trues = [result for result in results if result[0] is True]
if trues:
    result = trues[0]
    X = result[1]
    for x in X:
        if x == 0:
            print('S', end='')
        else:
            print('W', end='')
    print()
else:
    print(-1)

Measured memory_bytes: 8488
#include<iostream>
using namespace std;
int main(){
	int ma=0,mi=1000000001;
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		int x;
		cin>>x;
		ma=max(ma,x);
		mi=min(mi,x);
	}
	cout<<ma-mi<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
#define Max(a) (*max_element(ALL(a)))
#define Min(a) (*min_element(ALL(a)))
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c,d;
  cin>>a>>b>>c>>d;
  cout<<max({a*c,b*d,a*d,b*c})<<endl;
  return 0;
}


Measured memory_bytes: 3664
import java.util.*;
public class Main {
    static Scanner sc = new Scanner(System.in);
    static Stack<Integer> stack = new Stack<Integer>();
    static int train_number;
    public static void main(String[] args) {
        solve();
    }

    static void solve(){
        train_number = sc.nextInt();
        stack.push(train_number);
        while(sc.hasNextInt()){
            train_number = sc.nextInt();
            if(train_number == 0){
                System.out.println(stack.pop());
            }else{
                stack.push(train_number);
            }
        }
    }

}

Measured memory_bytes: 26284
var
    a,b,c,x,x0,x1,cnt,i,j: Integer;
begin
    readln(a,b,c,x);
    x:=x div 50;
    for i := 0 to a do
    begin
        x0:=x-i*10;
        if x0<0 then
        begin
            break;
        end;
        for j := 0 to b do
        begin
            x1:=x0-j*2;
            if x1<0 then
            begin
                break;
            end;
            if x1<=c then
            begin
                inc(cnt);
            end;
        end;
    end;
    writeln(cnt);
end.

Measured memory_bytes: 128
#include <stdio.h>

int main(){
    
    int i, x, y;
    
    for(i=1; ; i++){
        scanf("%d %d", &x, &y);
        if (x==0 && y==0) break;
        
        if(x<=y){
            printf("%d %d\n", x, y);
        }
        else{
            printf("%d %d\n", y, x);
        }
    }
    return 0;

}

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

int main(void){
    int a,b;cin>>a>>b;
    if(a<10&&b<10)cout<<a*b<<endl;
    else cout<<"-1"<<endl;
}

Measured memory_bytes: 256
n = int(input())
s = list(input())
 
c = 0
for i in range(1,n):
  if s[i] == "E":
    c+=1
 
min = c
 
 
for i in range(n-1):
  if s[i] == s[i+1]:
    if s[i] == "W":
      c+=1
    else:
      c-=1
  if c < min:
    min = c
 
print(min)

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

int main(){
  int H,W;

  while(1){
    cin >> H >> W;
    if(H==0 && W==0) break;
    for(int i=0; i<H; i++){
      for(int j=0; j<W; j++){
        if(i==0 || i==H-1) cout << "#";
        else if(j==0 || j==W-1) cout << "#";
        else cout << ".";
      }
      cout << endl;
    }
    cout << endl;
  }

  return 0;
}

Measured memory_bytes: 1156
using System;
using System.Text;

public class hello
{
    public static void Main()
    {
        while (true)
        {
            var c = int.Parse(Console.ReadLine().Trim());
            if (c == 0) break;
            var oct = Convert.ToString(c, 8);
            var sb = new StringBuilder(oct);
            sb.Replace("7", "9");
            sb.Replace("6", "8");
            sb.Replace("5", "7");
            sb.Replace("4", "5");
            var ans = sb.ToString();
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 8904
process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (chunk){
  var x = chunk.split(" ");
  x[0] = Number(x[0])
  x[1] = Number(x[1])
  var op = "=="
  if (x[0] < x[1]) {
    op = "<"
  }else if (x[0] > x[1]) {
    op = ">"
  }
  console.log("a " + op + " b");
});



Measured memory_bytes: 15240
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
	int N, L, i;
	cin >> N >> L;
	vector<string> S(N);
	for (i = 0; i < N; i++) cin >> S[i];
	sort(S.begin(), S.end());
	for (i = 0; i < N; i++) cout << S[i];
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#define ll long long
using namespace std;
int read()
{
	char ch=getchar();int f=0,x=1;
	while(ch<'0'||ch>'9'){if(ch=='-') x=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){f=(f<<1)+(f<<3)+ch-'0';ch=getchar();}
	return f*x;
}
char s[100005];
int main()
{
	scanf("%s",s+1);
	int n=strlen(s+1),ans=1000000,ans1=1000000;
	int ac=0,ac1=0;
	for(int i=1;i<=n;i++)
	{
		if(s[i]=='1') ac=1;
		else ac1=1;
	}
	if(ac+ac1!=2)
	{
		cout<<n;
		return 0;
	}
	for(int i=1;i<=n;i++)
	{
		if(s[i]=='1')
		ans=min(ans,max(i-1,n-i));
	}
	for(int i=1;i<=n;i++)
	{
		if(s[i]=='1') s[i]='0';
		else s[i]='1';
	}
	for(int i=1;i<=n;i++)
	{
		if(s[i]=='1')
		ans1=min(ans1,max(i-1,n-i));
	}
	cout<<max(ans,ans1);
}


Measured memory_bytes: 384
def main():
  N, C = list(map(int, input().split()))
  D = []
  for i in range(C):
    D.append(list(map(int, input().split())))
  c = []
  for i in range(N):
    c.append(list(map(int, input().split())))
  
  X = {}
  Y = {}
  Z = {}
  for i in range(N):
    for j in range(N):
      col = c[i][j] - 1
      if (i + j + 2) % 3 == 0:
        if col in X:
          X[col] += 1
        else:
          X[col] = 1
      elif (i + j + 2) % 3 == 1:
        if col in Y:
          Y[col] += 1
        else:
          Y[col] = 1
      else:
        if col in Z:
          Z[col] += 1
        else:
          Z[col] = 1
  Ans = 10e10      
  for i in range(C):
    cntX = 0
    for p, q in X.items():
      cntX += D[p][i] * q
    for j in range(C):
      if i == j:
        continue
      cntY = 0
      for p, q in Y.items():
        cntY += D[p][j] * q
      for k in range(C):
        if i == k or j == k:
          continue
        cntZ = 0
        for p, q in Z.items():
          cntZ += D[p][k] * q
        t = cntX + cntY + cntZ
        if t < Ans:
          Ans = t    
  print(Ans)

main()

Measured memory_bytes: 46556
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> VI;

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 _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()


int main() {
    int n;
    cin >> n;
    vector<int> a(n-1), b(n-1);
    rep (i, n-1) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
    }
    vector<vector<int>> G(n);
    rep (i, n-1) {
        G[a[i]].push_back(b[i]);
        G[b[i]].push_back(a[i]);
    }
    queue<int> Q;
    vector<int> prev(n, -1);
    map<P, int> M;
    prev[0] = 0;
    int k = 1;
    rep (i, G[0].size()) {
        Q.push(G[0][i]);
        M[make_pair(0, G[0][i])] = M[make_pair(G[0][i], 0)] = i + 1;
        prev[G[0][i]] = i + 1;
        k = i + 1;
    }

    while (Q.size()) {
        int f = Q.front();
        Q.pop();
        int ctr = 1;
        for (auto e: G[f]) {
            if (prev[e] != -1) {
                continue;
            }
            if (ctr == prev[f]) {
                ctr++;
            }
            prev[e] = ctr;
            M[make_pair(e, f)] = M[make_pair(f, e)] = ctr;
            Q.push(e);
            chmax(k, ctr);
            ctr++;
        }
    }
    cout << k << endl;
    rep (i, n-1) {
        cout << M[make_pair(a[i], b[i])] << endl;
    }
}

Measured memory_bytes: 19712
#include<vector>
#include<iostream>
#include<queue>
#include<functional>
using namespace std;
struct edge {
	int from, to, cost;
	bool operator>(const edge& other)const {
		return cost > other.cost;
	}
};

using edges = vector<edge>;
using graph = vector<edges>;

void add_edge(graph& g, int from, int to, int cost) {
	g[from].push_back(edge{ from,to,cost });
	g[to].push_back(edge{ to,from,cost });
}

edges prim( graph& g) {
	const int N = g.size();
	
	vector<bool>used(N, false);
	used[0] = true;
	priority_queue<edge, vector<edge>, greater<edge>>p_que;
	for (auto e : g[0]) {
		p_que.push(e);
	}
	edges mst;
	while (!p_que.empty()) {
		auto e = p_que.top();
		p_que.pop();
		if (used[e.to]) {
			continue;
		}
		mst.push_back(e);
		used[e.to] = true;
		for (auto new_e : g[e.to]) {
			p_que.push(new_e);
		}


	}
	return mst;

}

int main() {
	int V, E;
	cin >> V >> E;
	graph g(V);
	for (int i = 0; i < E; i++){
		int from, to, cost;
		cin >> from >> to >> cost;
		add_edge(g, from, to, cost);
	}
	const edges mst = prim(g);
	int ans = 0;
	for (auto e : mst) {
		ans += e.cost;
	}
	cout << ans << endl;
	return 0;
}









Measured memory_bytes: 10136
#include <iostream>
#include <unordered_map>
#include <utility>

using namespace std;

pair<int, int> get_max_element(unordered_map<int,int>& umap, int key_except=-1)
{
  int max_key = 0;
  int max_count = 0;
  for (auto& kv : umap) {
    const int& key = kv.first;
    const int& count = kv.second;

    if (count > max_count && key != key_except) {
      max_key = key;
      max_count = count;
    }
  }

  return make_pair(max_key, max_count);
}

int main()
{
  int N;
  cin >> N;

  int count_even = (N+1)/2, count_odd = N/2;

  unordered_map<int,int> umap_even, umap_odd;

  for (int n=0; n<N; ++n) {
    auto& umap = n%2 ? umap_odd : umap_even;
    int v;
    cin >> v;
    if (umap.count(v)==0)
      umap.emplace(v,1);
    else
      umap.at(v)++;
  }

  auto kv_even = get_max_element(umap_even);
  auto kv_odd = get_max_element(umap_odd);
  int max_key_even, max_count_even;
  int max_key_odd, max_count_odd;
  max_key_even = kv_even.first;
  max_count_even = kv_even.second;
  max_key_odd = kv_odd.first;
  max_count_odd = kv_odd.second;

  int ops;
  if (max_key_even != max_key_odd) {
    ops = (count_even - max_count_even) + (count_odd - max_count_odd);
  } else {    
    auto kv_even2 = get_max_element(umap_even,max_key_even);
    int second_max_count_even = kv_even2.second;

    auto kv_odd2 = get_max_element(umap_odd,max_key_odd);
    int second_max_count_odd = kv_odd2.second;

    ops = min((count_even - second_max_count_even) + (count_odd - max_count_odd),
	      (count_even - max_count_even) + (count_odd - second_max_count_odd));
  }

  cout << ops << endl;
  
  return 0;
}


Measured memory_bytes: 4376
#include<stdio.h>
int main()
{
	long long int N;
	long long int k;
	long long int r = 0;
	
	scanf("%ld", &N);
	
	for(k=0; k<N; k++)
	{
		r = r + k;
	}
	
	printf("%ld", r);
}


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

int main()
{
  int N, K;
  std::cin >> N >> K;
  std::vector<std::vector<int>> A;
  A.resize(K);
  int d;
  for (int i = 0; i < K; i++)
  {
    std::cin >> d;

    int tmp;
    for (int j = 0; j < d; j++)
    {
      std::cin >> tmp;
      A[i].emplace_back(tmp - 1);
    }
  }

  std::vector<int> B;
  B.resize(N, 0);
  for (const auto &i : A)
  {
    for (const auto &j : i)
    {
      B[j]++;
    }
  }
  std::cout << std::count_if(B.cbegin(), B.cend(), [](const int &x) {
    return x == 0;
  }) << std::endl;

  return 0;
}

Measured memory_bytes: 3208
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

int parent(int i) { return i / 2; }
int left(int i) { return 2 * i; }
int right(int i) { return 2 * i + 1; }

int main() {
	int A[251];
	int H; cin >> H;
	for (int i = 1; i <= H; i++) {
		cin >> A[i];
	}
	for (int i = 1; i <= H; i++) {
		cout << "node " << i << ": key = " << A[i] << ", ";
		if (parent(i) >= 1)cout << "parent key = " << A[parent(i)] << ", ";
		if (left(i) <= H)cout << "left key = " << A[left(i)] << ", ";
		if (right(i) <= H)cout << "right key = " << A[right(i)] << ", ";
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
N,M=map(int,input().split())
X=sorted(list(map(int,input().split())))
Y=sorted([abs(X[i+1]-X[i]) for i in range(M-1)])

ans=0

if N>=M:
    print(ans)
else:
    Y=Y[::-1]
    ans=sum(Y[N-1:])
    print(ans)

Measured memory_bytes: 13960
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int[][] g = new int[n+1][n+1];
        
        for (int i = 0; i < n; i++) {
            int u = sc.nextInt();
            int k = sc.nextInt();
            for (int j = 0; j < k; j++) {
                int v = sc.nextInt();
                g[u][v] = 1;
            }
        }
        
        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                System.out.print(g[i][j] + ((j == n) ? "" : " "));
            }
            System.out.println();
            
        }
    }
}


Measured memory_bytes: 31196
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
int a[100010], x[33][33], y[33][33];
int main(){
    int n;
    while(cin>>n){
        ll ans=0;
        for(int i=0; i<n; ++i){
            scanf("%d",a+i);
            for(int j=0; j<a[i]; ++j){
                scanf("%d%d",&x[i][j], &y[i][j]);
                --x[i][j];
            }
        }
        for(int i=0; i<(1<<n); ++i){
            bool l=1;
            for(int j=0; j<n; ++j){
                if((1<<j)&i){
                    for(int k=0; k<a[j]; ++k){
                        if((y[j][k]==1 && (!((1<<x[j][k])&i))) || (y[j][k]==0 && ((1<<x[j][k])&i)) ){
                            l=0;
                        }
                    }
                }
            }
            if(l){
                ll tmp=0;
                for(int j=0; j<n; ++j){
                    if((1<<j)&i){
                        ++tmp;
                    }
                }
                ans=max(ans, tmp);
            }
        }
        cout<<ans<<endl;
    }
  return 0;
}




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

using namespace std;

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

const char sp = ' ';
const char cmm = ',';
const int MOD = 1000000007;

using ll = long long;

ll mod(ll a, ll b){return (a%b+b)%b;}
ll gcd(ll a, ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
void Judge(bool b){b?Yes():No();}
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void JUDGE(bool b){b?YES():NO();}
ll powMod(ll b, ll e, ll m){ll r=1;while(e>0){if(e&1)r=(r%m)*(b%m)%m;b=(b%m)*(b%m)%m;e>>=1;}return r;}
double distance(ll x1, ll y1, ll x2, ll y2){return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));}

template<typename T>
void ppp(T n){cout << n << endl;}

int main(){

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

    string s;
    cin >> s;

    int ans = MOD;
    int n = s.size();
    for(int i = 1; i < n; ++i){
        if(s[i-1] != s[i]) ans = min(ans, max(i, n-i));
    }

    ppp(min(ans, n));



    return 0;
}


Measured memory_bytes: 512
import java.util.*;
//mport java.io.*;


public class Main{

    static int INFTY = Integer.MAX_VALUE;
    static int global =10;
    public static void main (String args[]){
        //初期処理
        Scanner sc=new Scanner(System.in);
        // BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        // try{
            // int n = Integer.parseInt(br.readLine());
        long W = sc.nextInt();
        long H = sc.nextInt();
        long x = sc.nextInt();
        long y = sc.nextInt();
        
        String ans;
        if(x==W/2.0 && y==H/2.0){
            ans = W*H/2.0 + " " + 1 ;
        } else {
            ans = W*H/2.0 + " " + 0 ;
        }
        System.out.println(ans);
    }
        

}

Measured memory_bytes: 21716
#include<iostream>

using namespace std;

int main(){

	int a1, a2, a3, t;

	cin >> a1 >> a2 >> a3;

	if ( a1 > a2 ){

		t = a1; a1 = a2; a2 = t;

	}

	if( a2 > a3 ){

		t = a2; a2 = a3; a3 = t;

	}

	if( a1 > a2 ){

		t = a1; a1 = a2; a2 = t;

	}

	cout << a1 << " " << a2 << " " << a3 << endl;

	return 0;

}

Measured memory_bytes: 1164
#include <algorithm>
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <vector>
#include <queue>
#include <math.h>
#include <string> 
#include <bits/stdc++.h>
using namespace std;

int main(){
    int N;
    cin >> N;
    int A[N];
    bool flag;
    flag=true;
    for(int i=0;i<N;i++){
        cin>>A[i];
    }
    sort(A,A+N);
    for(int i=0;i<N-1;i++){
        if(A[i]==A[i+1]){
            flag=false;
            break;
        }
    }
    if(flag==true){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;



int main(){
	int N,K;
	cin >> N >> K;
	vector<P> a(N);
	for(int i = 0; i < N; i++) {
		ll t,d;cin>>t>>d;
		a[i] = mp(d,t);
	}
	sort(RALL(a));//昇順でソート
	priority_queue<ll,vector<ll>,greater<ll>> que;
	vector<bool> used(N + 1,false);//使ってるか
	ll sum = 0;
	ll kind = 0;
	ll res = 0;
	for(int i = 0; i < N; i++) {
		if (i < K){
			if (!used[a[i].sc]){
				sum += a[i].fs;
				kind ++;
				used[a[i].sc] = true;
			}
			else{//被ったお寿司
				sum += a[i].fs;
				que.push(a[i].fs);
			}
			res = max(res,sum + kind * kind);
		}
		else{
			if (!used[a[i].sc] && !que.empty()){
				sum += (a[i].fs - que.top());
				kind++;
				used[a[i].sc] = true;
				que.pop();
				res = max(res,sum + kind * kind);
			} 
		}
	}
	cout << res << endl;
	return 0;
}


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

int minCost(int *arr,int n){
    
    int dp[n];
    dp[0] = 0;

    for(int i=1;i<n;i++){

        int option1 = abs(arr[i]-arr[i-1]) + dp[i-1];
        int option2 = (i==1) ? INT_MAX : abs(arr[i]-arr[i-2]) + dp[i-2];
        dp[i] = min(option2,option1);
    }
    return dp[n-1];
}

int main() {
    
    int n;
    cin>>n;
    int arr[n];

    for(int i=0;i<n;i++) cin>>arr[i];

    cout<<minCost(arr,n);
}


Measured memory_bytes: 4336
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
typedef long long int ll;
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

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

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <stdio.h>
#include <sys/time.h>
#include <time.h>


using namespace std;



int main(){
  char a,b;
  std::cin >> a>>b;
  if(a>b)std::cout << ">" << '\n';
  if(a==b)std::cout << "=" << '\n';
  if(a<b)std::cout << "<" << '\n';
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cstdio>
#include<string>
#include<algorithm>
#include <sstream>
#include<map>

#include<queue>

using namespace std;

int main() {

	int P, Q, R;
	vector<int> air(3, 0);

	cin >> air[0] >> air[1] >> air[2];
	sort(air.begin(), air.end());
	//reverse(air.begin(), air.end());

	cout << air[0]+air[1] << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll x,y;cin>>x>>y;
    if(x*2<=y&&y<=x*4&&y%2==0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)



int main() {
	string S;
	std::cin >> S;
	if (S == "ABC") {
		std::cout << "ARC" << endl;
	}
	else {
		std::cout << "ABC" << endl;
	}

	return 0;
}


Measured memory_bytes: 3628
import sys
input = sys.stdin.readline
from bisect import *

S = input()[:-1]
RL = []

for i in range(len(S)-1):
    if S[i]=='R' and S[i+1]=='L':
        RL.append(i)
        
ans = [0]*len(S)

for i in range(len(S)):
    if S[i]=='L':
        idx = bisect_left(RL, i)
        mark = RL[idx-1]
    else:
        idx = bisect_left(RL, i)
        mark = RL[idx]
    
    if (i-mark)%2==0:
        ans[mark] += 1
    else:
        ans[mark+1] += 1
        
print(*ans)

Measured memory_bytes: 51548
def main():
    N, P = (int(i) for i in input().split())

    def prime_factorize(n):
        res = []
        for i in range(2, n+1):
            if i*i > n:
                break
            if n % i != 0:
                continue
            ex = 0
            while n % i == 0:
                ex += 1
                n //= i
            res.append((i, ex))
        if n != 1:
            res.append((n, 1))
        return res

    pf = prime_factorize(P)
    ans = 1
    for p, e in pf:
        ans *= p**(e//N)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 62204
#include<iostream>
#include<string>
#include<algorithm>
#include <stdio.h>
using namespace std;
int main(){
 int a,b,c;
 cin >>a>>b>>c;

 for(int i=a; i<=a*b; i+=a){
   if(i%b ==c) {cout<<"YES"<<endl; return 0;}
 }
 cout<<"NO"<<endl; return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n,k,x,y,i,sum=0;
    scanf("%d%d%d%d",&n,&k,&x,&y);
    if(k>n) k=n;
    for(i=0;i<k;i++){
        sum+=x;
    }
    for(i=0;i<n-k;i++){
        sum+=y;
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 128
def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    plus = []
    minus = []
    total = 0
    for _ in range(N):
        s = input().strip()
        h = 0
        bottom = 0
        for ss in s:
            if ss == "(":
                h += 1
            else:
                h -= 1
                bottom = min(bottom, h)
        total += h
        if h > 0:
            plus.append((bottom, h))
        else:
            minus.append((bottom-h, -h))
    if total != 0:
        print("No")
        sys.exit()
    plus.sort(reverse=True)
    minus.sort(reverse=True)
    height = 0
    for b, h in plus:
        if height + b < 0:
            print("No")
            sys.exit()
        height += h
    height = 0
    for b, h in minus:
        if height + b < 0:
            print("No")
            sys.exit()
        height += h
    print("Yes")
        


if __name__ == '__main__':
    main()

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

#define maxi 500000+10
#define lm 1000000+10
pair<int , pair<int , int>>  pr[maxi] ;
int tree[maxi] ;
int p[lm] ;
int ans[maxi] ;
void update(int idx, int val)
{
while(idx < maxi)
{
tree[idx] += val;
idx += (idx & -idx);
}
}

int read(int idx)
{
int sum = 0;
while(idx > 0)
{
sum += tree[idx];
idx -= (idx & -idx);
}
return sum;
}

int main()
{
   int n ;
   scanf("%d" , &n) ;
   int q ;
   cin>>q ;
   int a[n+1] ;
   for(int i=1 ; i<=n ; i++)
   scanf("%d", &a[i]) ;
   
   int x =1;

   for(int i=1 ; i<=q ; i++)
   {
       scanf("%d %d" , &pr[i].second.first , &pr[i].first) ;
       pr[i].second.second = i ;
   }
   sort(pr+1 , pr+q+1)  ;
   memset(tree , 0 , sizeof(tree)) ;
   memset(p , -1 , sizeof(p)) ;
   for(int i=1 ; i<=n ; i++)
   {
       if(p[a[i]]!= -1)
       update(p[a[i]] , -1)  ;
       p[a[i]] = i ;
       update(i , 1) ;


   while(x<=q && pr[x].first == i)
   {
       ans[pr[x].second.second] = read(pr[x].first) - read(pr[x].second.first-1);

       x++;

   }
   }
   for(int i=1 ;i<=q ; i++)
   printf("%d\n", ans[i]) ;




}

Measured memory_bytes: 19392
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
#include <bits/stdc++.h>
using namespace std;
 
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define cout_precision cout.setf(ios::fixed); cout.precision(32);
 
using ll = int64_t; using vll = vector<ll>; using vvll = vector<vll>;
using pll = pair<ll, ll>; using vpll = vector<pll>; using vvpll = vector<vpll>;
 
// ------------------------------------------------------------------------------------------------

ll n, cnt;

void func() {
    cin >> n;
    cnt = 0;
    for (ll i = 1, p; i <= n; i++) {
        cin >> p;
        if (p != i) {
            cnt++;
        }
    }
    cout << ((cnt <= 2)? "YES" : "NO") << endl;
}

int main() {
    fast_io; cout_precision;
    ll t = 1; // cin >> t;
    for (ll i = 1; i <= t; i++) {
        func();
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
  int n;
  cin >> n;
  string s = to_string(n);

  rep (i,3) {
    if (s[i] == '7') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  
  cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
constexpr ll  MOD = (1e9+7);
constexpr int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
constexpr int lcm(int a, int b) { return a / gcd(a, b) * b; }

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
ll factorial(ll n, ll m=2) {
    // calculate n!
    m = max(2LL, m);
    ll rtn = 1;
    for (ll i=m; i<=n; i++) {
        rtn = (rtn * i) % MOD;
    }
    return rtn;
}
ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b;
        swap(a, b);
        u -= t * v;
        swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
ll modpow(ll a, ll n) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)
            res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n, m, x; cin >> n >> m >> x;
    vector<ll> c(n);
    vector<vector<ll>> a(n, vector<ll>(m));
    rep(i, n) {
        cin >> c[i];
        rep(j, m) cin >> a[i][j];
    }
    ll ans = 1e16;
    for (int bit=0; bit<(1<<n); ++bit) {
        ll cost = 0;
        vector<ll> und(m, 0);
        for (int i=0; i<n; i++) {
            if ((bit>>i)&1) {
                for (int j=0; j<m; ++j) {
                    und[j] += a[i][j];
                }
                cost += c[i];
            }
        }
        // check
        bool flag = true;
        for (ll tmp : und) {
            if (tmp < x) flag = false;
        }
        if (flag) chmin(ans, cost);
    }
    if (ans == 1e16) puts("-1");
    else cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3620
#include <stdio.h>

int main() {
    int n,k;
    n = 100;
    int ans = 0;
	int al,bl;
    int tm;
    scanf("%d %d", &n, &k);
    for(int i=0; i < n; i++) {
        scanf("%d", &tm);
        al = tm;
        bl = k - tm;
        if(al < bl ) { // A
            ans+=al*2;
        } 
        else { // B
            ans+=bl*2;
        }
    }

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

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

int main() {
    int n;cin>>n;
    rep(i,26)rep(j,15){
        if(4*i + 7*j == n){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    
    cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    scanf("%d %d", &n, &k);
    int arr[n];
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &arr[i]);
    }
    bool ans[n-k];
    memset(ans,false,sizeof(ans));
    for (int i = 0; i < n-k; i++)
    {
        if(arr[k+i] > arr[i]){
            ans[i] = true;
        }
        else
        {
            ans[i] = false;
        }
        
    }
    // if(k==n-1){
    //     printf("No\n");
    //     return 0;
    // }
    for (int i = 0; i < n-k; i++)
    {
        if(ans[i]){
            printf("Yes\n");
        }
        else
        {
            printf("No\n");
        }
        
    }
    
}

Measured memory_bytes: 4576
#include <stdio.h>
#include <stdlib.h>

#define N 4

int map[N][N];
int cpy[N][N];
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};

int dfs(int x, int y, int point, int depth, int limit);
int result();

int main() {
    int i, j;
  
    for(i = 0; i < N; i++) {
        for(j = 0; j < N; j++) {
            scanf("%d", &map[i][j]);
        }
    }
    printf("%d\n", result());
    
    return 0;
}


int dfs(int x, int y, int point, int depth, int limit) {
    int i, h = 0, v, tmp;
    for(i = 0; i < N*N; i++) {
        v = map[i/N][i%N];
        if(v) {
            v--;
            h += abs(i/N-v/N)+abs(i%N-v%N);
        }
    }
    if(h == 0) return depth;
    if(depth+h > limit) return -1;

    for(i = 0; i < N; i++) {
        int nx = x+dx[i], ny = y+dy[i], res;
        if(~point && i == (point+2)%N) continue;
        if(!(0<=nx && nx<N && 0<=ny && ny<N)) continue;
        tmp = map[y][x];
        map[y][x] = map[ny][nx];
        map[ny][nx] = tmp;
        res = dfs(nx, ny, i, depth+1, limit);
        if(~res) return res;
        tmp = map[y][x];
        map[y][x] = map[ny][nx];
        map[ny][nx] = tmp;
    }

    return -1;
}

int result() {
    int x, y, ans, i, j, flg = 0, limit;
    for(i = 0; i < N; i++) {
        for(j = 0; j < N; j++) {
            if(!map[i][j]) {
                x = j;
                y = i;
                flg = 1;
                break;
            }
        }
        if(flg) break;
    }
    for (limit = 0; limit < 100; limit++) {
        for (i = 0; i < N; i++) {
            for (j = 0; j < N; j++) {
                cpy[i][j] = map[i][j];
            }
        }
        if((ans = dfs(x, y, -1, 0, limit)) != -1) return ans;
        for (i = 0; i < N; i++) {
            for (j = 0; j < N; j++) {
                map[i][j] = cpy[i][j];
            }
        }
    }
    return -1;
}




Measured memory_bytes: 2148
N = int(input())
a_list = map(int, input().split())

count = {}
for a in a_list:
    if a not in count.keys():
        count[a] = 1
    else:
        count[a] += 1

result = 0
for item, item_count in count.items():
    if item <= item_count:
        result += item_count - item
    else:
        result += item_count

print(result)

Measured memory_bytes: 23284
#include <bits/stdc++.h>
#include <unistd.h>
#include <sys/time.h>
#include <stdlib.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<P, ll> T;
typedef pair<long double , ll> Ps;
typedef pair<ll, bool> Pb;

const ll INF = 1e18;
const ll fact_table = 3200008;
long double Pi = 3.1415926535897932384626;

priority_queue <ll> pql;
priority_queue <P> pqp;
priority_queue <P> bag;
//big priority queue
priority_queue <ll, vector<ll>, greater<ll> > pqls;
priority_queue <P, vector<P>, greater<P> > pqps;
//small priority queue
//top pop

ll dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
ll dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
char dir[] = "DRUL";
//↓,→,↑,←

/*
#define endl "\n"
#ifdef ENJAPMA
#undef endl
#endif
*/
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<(x);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define CLEAR(a) a = decltype(a)();
#define pc(x) cout << x << ",";
#define rep(i, n) for (ll i = 0; i < (n); i ++)

// const ll mod = 998244353ll;
const ll mod = 1000000007ll;

ll mypow(ll a, ll b, ll mod) {ll x = 1; while (b) {while (!(b & 1)) {(a *= a) %= mod; b >>= 1;}(x *= a) %= mod; b--;} return x;}
void YES(bool cond) { if (cond) { p("YES");} else { p("NO");} return;}
void Yes(bool cond) { if (cond) { p("Yes");} else { p("No");} return;}
void line() { p("--------------------"); return;}

/*
ll fact[fact_table + 5], rfact[fact_table + 5];

void c3_init() {
    fact[0] = rfact[0] = 1;
    for (ll i = 1; i <= fact_table; i++) {
        fact[i] = (fact[i - 1] * i) % mod;
    }
    rfact[fact_table] = mypow(fact[fact_table], mod - 2, mod);
    for (ll i = fact_table; i >= 1; i--) {
        rfact[i - 1] = rfact[i] * i;
        rfact[i - 1] %= mod;
    }
    return;
}
ll c3(ll n, ll r) {
    return (((fact[n] * rfact[r]) % mod ) * rfact[n - r]) % mod;
}
*/
struct Timer {
    int64_t start;
    const int64_t CYCLES_PER_SEC = 2800000000;
    Timer() { reset(); }
    void reset() { start = getCycle(); }
    inline double get() { return (double)(getCycle() - start) / CYCLES_PER_SEC; }
    inline int64_t getCycle() {
        uint32_t low, high;
        __asm__ volatile ("rdtsc" : "=a" (low), "=d" (high));
        return ((int64_t)low) | ((int64_t)high << 32);
    }
};

Timer timer;

bool multicase = false;

ll n, m, k, w, num, a, b, c, d, e, h, q, ans, sum, l;

typedef vector<ll> vec;
typedef vector<vector<ll>> mat;

string s, t;

void solve() {
    cin >> n;
    n -= 400;
    n /= 200;
    n = 8 - n;
    p(n);
    return;
}

int main() {
    // init();
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll q, testcase = 1;
    if (multicase) {
        cin >> q;
    } else {
        q = 1;
    }
    while (q--) {
        // pu("Case ");pu("#");pu(testcase);pu(": ");
        solve();
        testcase++;
    }
    // solve();
    return 0;
}



Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<double> v(N);
  for(int i = 0; i<N; i++){
    cin >> v.at(i);
  }
  sort(v.begin(),v.end());
  double ans = v.at(0);
  for(int i = 1; i < N; i++){
    ans= (ans+v.at(i))/2;
  }
  cout << setprecision(10)<< ans << endl;
  
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

int ctoi(char c){
	return c - '0';
}


int main(){
	int k;
	string s;
	cin >> k >> s;
	if (s.length() <= k){
		cout << s << endl;
	}else{
		for (int i = 0; i < k; i++){
			cout << s[i];
		}
		cout << "..." << endl;
	}
	return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define boost ios::sync_with_stdio(false); cin.tie(0)
#define ll              long long int
#define ld              long double
#define mk              make_pair
#define pb              push_back
#define f               first
#define s               second
#define fo(i,a,b)       for(i=a;i<b;i++)
#define foe(i,a,b)      for(i=a;i<=b;i++)
#define all(x)          x.begin(),x.end()
#define vi              vector<int>
#define vl              vector <long long int>
#define pii             pair <int,int>
#define pll             pair <long long int, long long int>
#define vpii            vector< pair<int,int> >
#define vpll            vector < pair <long long int,long long int> >
#define MOD             1000000007
using namespace std;
const int inf = INT_MAX;
const ll inf64 = LLONG_MAX;


int main()
{
    boost;
    ll n;
    cin >> n;
    ll arr[n],i;
    vl v1,v2;
    map <ll,ll> mp1,mp2;
    foe(i,1,n)
    {
    	cin >> arr[i-1];
    	mp1[i + arr[i-1]]++;
    	mp2[i-arr[i-1]]++;
    	   
    }
    ll ans = 0;
    for(auto x : mp1)
    {
    	if(mp2[x.f] > 0)ans += x.s*mp2[x.f];
    }
    cout << ans;
    
    



    
    return 0;
}

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

public class Main {
    static PrintWriter out = new PrintWriter(System.out);
    static Scanner sc = new Scanner(System.in);
    static BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    public static void main(String[] args) throws IOException {
        Main main = new Main();
//        main.solve();
//        out.flush();
        System.out.println(main.solve());
    }
    long solve() throws IOException{
        int n = sc.nextInt();
        char[] s = sc.next().toCharArray();
        long ans = 0;
        Map<Integer,Set<Integer>> map = new HashMap<>();
        int[] arr = new int[n];
        map.put(0,new HashSet<>(n)); map.put(1,new HashSet<>(n));map.put(2,new HashSet<>());
        for(int i=0;i<n;i++){
            if(s[i]=='R') arr[i]=0;
            else if(s[i]=='G') arr[i] = 1;
            else arr[i] = 2;
        }
        for(int j=n-1;j>0;j--){
            for(int i=0;i<j;i++){
                if(arr[i]==arr[j]) continue;
                int target = helper(arr[i],arr[j]);
                Set<Integer> set = map.get(target);
                ans += set.size();
                if(set.contains(2*j-i)) ans -= 1;
            }
            map.get(arr[j]).add(j);
        }
        return ans;
    }
    int helper(int i, int j){
        for(int c=0;c<3;c++){
            if(c==j||c==i) continue;
            return c;
        }
        return 0;
    }
}



Measured memory_bytes: 57280
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
   cin>>a[i]; 
  }
  int count=0;
  for(int i=0;i<n;i++){
    if(a[i]!=i+1){
      if(a[a[i]-1]!=i+1){
        cout<<"NO"<<endl;
        return 0;
      }else if(count!=1){
        swap(a[i],a[a[i]-1]);
        count++;
      }else{
        cout<<"NO"<<endl;
        return 0;        
      }
    }
  }
  cout<<"YES"<<endl;
}

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

using namespace std;

int d[105], A[105][105];

int main() {

	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	int n, k;
	cin >> n >> k;
	int cnt = 0;
	set<int> snukes, nomischief;
	for (int i = 1; i <= n; ++i) {
		snukes.insert(i);
	}
	for (int i = 0; i < k; ++i) {
		cin >> d[i];
		for (int j = 0; j < d[i]; ++j) {
			cin >> A[i][j];
			nomischief.insert(A[i][j]);
		}
	}
	vector<int> v(105);
	vector<int>::iterator mischief;
	mischief = set_difference(snukes.begin(), snukes.end(), nomischief.begin(), nomischief.end(), v.begin());
	v.resize(mischief - v.begin());
	cout << v.size() << '\n';
	return 0;
}

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

// #define NDEBUG
#include<assert.h>
const int INF = 1001001001;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int x ;
  cin >> x;
  if(x >= 30) puts("Yes");
  else puts("No");
  return 0;
}

Measured memory_bytes: 3632