akhauriyash/Code-Regression huggingface dataset:
using System;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Diagnostics.Contracts;

class Program
{
    static void Main()
    {
        var input = ReadLine();
        if ((!input.Contains("A")) || (!input.Contains("B")))
        {
            WriteLine("No");
        }
        else
        {
            WriteLine("Yes");
        }
        ReadKey();
    }
}

static class MyUtil
{
    /// <summary>
    /// 指定の桁のビットを取得します。
    /// </summary>
    /// <param name="num"></param>
    /// <param name="count">取得する桁。</param>
    /// <returns></returns>
    public static int GetBit(this int num, int count)
    {
        int mask = (int)Math.Pow(2, count - 1);
        return (num & mask) == 0 ? 0 : 1;
    }

    /// <summary>
    /// <c>int</c>を2進数ビット配列に変換します。
    /// </summary>
    /// <param name="num"></param>
    /// <returns></returns>
    public static int[] ToBitArray(this int num)
    {
        const int size = sizeof(int) * 8;
        var array = new int[size];
        for (int i = 0; i < size; i++)
        {
            array[i] = num.GetBit(size - i);
        }
        return array;
    }

    public static long[] ReadlongArray()
    {
        return ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
    }

    public static int[] ReadintArray()
    {
        return ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
    }

    /// <summary>
    /// <see cref="IEnumerable{T}"/>の各要素を並べてコンソールに出力します。各要素の間には半角スペースが一つ入ります。
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="ts"></param>
    public static void WriteToConsole<T>(this IEnumerable<T> ts)
    {
        StringBuilder stringBuilder = new StringBuilder();
        foreach (T t in ts)
        {
            stringBuilder.Append(t.ToString());
            stringBuilder.Append(" ");
        }
        stringBuilder.Remove(stringBuilder.Length - 1, 1);
        Console.WriteLine(stringBuilder.ToString());
    }

    public static void WriteToDebugConsole<T>(this IEnumerable<T> ts)
    {
        StringBuilder stringBuilder = new StringBuilder();
        foreach (T t in ts)
        {
            stringBuilder.Append(t.ToString());
            stringBuilder.Append(" ");
        }
        stringBuilder.Remove(stringBuilder.Length - 1, 1);
        System.Diagnostics.Debug.WriteLine(stringBuilder.ToString());
    }
}


Measured memory_bytes: 13140
import java.io.*;

/**
 * ??´??°?????\??? "x" ????????????x???3????????????????????????
 * (1 ??? x ??? 100)
 * 
 * (ex)
 * 1 -> 1
 * 3 -> 27
 * 100 -> 1000000
 * 
 * @author shirakawa_d
 */
class Main {
    public static void main(String[] args) {
        try {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            String line = br.readLine();
            System.out.println(getCubicOf(line));
        } catch (Exception e) {
            System.out.println(e);
        }
    }

    /**
     * @param line
     *            ??´??°x?????\???
     * @return x???3???
     */
    private static long getCubicOf(String line) {
        long x = Long.parseLong(line);
        return (long)Math.pow(x, 3);
    }
}

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

// 総数を1000000007（素数）で割った余り
const long long mod = 1e9 + 7;

using ll = long long;
using pii  = pair<int, int>;
using pll = pair<ll, ll>;
#define ull unsigned long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define vs vector<string>
#define vpii vector<pii>
#define vpll vector<pll>

#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; i++)
#define rep1(i, n) for (int i = 1, i##_len = (n); i <= i##_len; i++)
#define repr(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rep1r(i, n) for (int i = ((int)(n)); i >= 1; i--)

#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define RSORT(x) sort(rall(x));
#define pb push_back
#define mp make_pair

#define INF (1e9)
#define PI (acos(-1))
#define EPS (1e-7)

ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }

int main(){
    char c;
    cin >> c;
    if (islower(c)) cout << 'a' << endl;
    else cout << 'A' << endl;
    return 0;
}


Measured memory_bytes: 3608
import sys

N = int(input())
A = [int(v) for v in sys.stdin.readline().split()]

v = 1
remove = 0
for i in range(N):
    if A[i] == v:
        v += 1
    else:
        remove += 1
if remove == N:
    print(-1)
else:
    print(remove)


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

const int nil=-1;
struct node{
	int parent;
	int degree;
	int left;
	int right;
	int sibling;
	int depth;
	int height;
};
node *nodes;int n;

int height_setd(int id, int d) //????????????height, ????????¨??¨??????depth????¨????
{
	//if( d==0 )
	//	cout<<"root : "<<id<<endl;
	int res;
	if( id==nil ){
		res=-1;
	}else{
		nodes[id].depth=d;
		res= nodes[id].height=max(
			1 +height_setd(nodes[id].left, d+1),
		 	1 +height_setd(nodes[id].right, d+1)
		);
	}
	return res;

}
int trackRoot(int start){
	int prt=nodes[start].parent;
	if( prt==nil )
		return start;
	else
		return trackRoot(prt);
}

void show()
{
	for( int i=0; i<n; i++ ){
		printf("node %d: parent = %d, sibling = %d, degree = %d, depth = %d, height = %d, ",
			i,
			nodes[i].parent,
			nodes[i].sibling,
			nodes[i].degree,
			nodes[i].depth,
			nodes[i].height
		);

		if( nodes[i].parent==nil ){
			printf("root\n");
		}else if( nodes[i].degree==0 ){
			printf("leaf\n");
		}else{
			printf("internal node\n");
		}
	}
}


	
	

int main()
{
	cin>>n;nodes=new node[n];
	for(int i=0;i<n;i++)
		nodes[i].parent=nodes[i].left=nodes[i].right=nodes[i].sibling=nil;
	

	for(int i=0,id,l,r; i<n; i++){
		cin>>id;

		cin>>l>>r;
		if( l!=nil ){
			nodes[id].left=l;
			nodes[l].parent=id;
		}
		if( r!=nil ){
			nodes[id].right=r;
			nodes[r].parent=id;
		}
		if( r!=nil && l!=nil ){
			nodes[id].degree=2;
			nodes[r].sibling=l;
			nodes[l].sibling=r;
		}else if( r==nil && l==nil ){
			nodes[id].degree=0;
		}else{
			nodes[id].degree=1;
		}
		l=r=nil;
	}
	//cout<<"h(root) :"<<height_setd(root, 0)<<endl;;
	height_setd(trackRoot(0), 0);
	show();
	
}

Measured memory_bytes: 1176
#include <stdio.h>

int main () {
	int n, v, a[1000];
	int i, j, k;
	scanf("%d", &n);
	for ( i = 0; i < n; i++ ) {
		scanf("%d", &a[i]);
	}
	for ( k = 0; k < n; k++ ) {
		printf("%d", a[k]);
		if ( k != n - 1 ) {
			putchar(' ');
		}
	}
	putchar('\n');
	for ( i = 1; i < n; i++ ) {
		v = a[i];
		j = i - 1;
		while ( j >= 0 && a[j] > v ) {
			a[j + 1] = a[j];
			j--;
		}
		a[j + 1] = v;
		for ( k = 0; k < n; k++ ) {
			printf("%d", a[k]);
			if ( k != n - 1 ) {
				putchar(' ');
			}
		}
		putchar('\n');
	}

	return 0;
}


Measured memory_bytes: 1928
N, A, B, C = list(map(int, input().split()))
L = []
for i in range(N):
    L.append(int(input()))

# print(N,A,B,C,L)

INF = 10 ** 9

def dfs(cur, a, b, c):
  if cur == N:
      return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a,b,c) > 0 else INF
  ret0 = dfs(cur + 1, a, b, c)
  ret1 = dfs(cur + 1, a + L[cur], b, c) + 10
  ret2 = dfs(cur + 1, a, b + L[cur], c) + 10
  ret3 = dfs(cur + 1, a, b, c + L[cur]) + 10
  return min(ret0,ret1,ret2,ret3)

print(dfs(0,0,0,0))

Measured memory_bytes: 3064
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
#S = str(input())
A, B, X = map(int, input().split())

if X < A :
  print ("NO")
  exit()

if A+B >= X :
  print ("YES")
else :
  print ("NO")



Measured memory_bytes: 38256
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>

using namespace std;

int main(int argc, char const *argv[])
{
    int h1, h2, m1, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    int start1= 0, start2=0;

    if(m2>k){
        start2 = m2 -k;
        start1 = h2;
    } else{
        start2 = 60 - abs(m2-k);
        start1 = h2 -1;
    }

    //cout << start1 << ":" << start2 << endl;

    int ans = 0;
    if(start1 < h1){ //開始0時、起床22時のようなパターン
        ans = (start1 + 24) * 60 + start2 - h1 * 60 - m1;        
    }else{
        ans = start1 * 60 + start2 - h1 * 60 - m1;
    }

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


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return abs(a*b)/gcd(a,b);}
std::vector<bool> IsPrime; void sieve(size_t max){if(max+1 > IsPrime.size())IsPrime.resize(max+1,true);IsPrime[0] = false;IsPrime[1] = false;for(size_t i=2; i*i<=max; ++i)if(IsPrime[i])for(size_t j=2; i*j<=max; ++j)IsPrime[i*j] = false;}
#define roundup(divisor,dividend) (divisor + (dividend - 1)) / dividend
#define all(x) (x).begin(),(x).end()
#define size_t int
int n,ans=0;
std::vector<int> p;
int main(){
  cin >> n;
  p.resize(n);
  for (size_t i = 0; i < n; i++) {
    cin >> p[i];
  }
  for (size_t i = 0; i < n-1; i++) {
    if(p[i] == i+1){;
      ans++;
      swap(p[i],p[i+1]);
    }
  }
  if(p[n-1] == n){
    ans++;
  }
  cout << ans << endl;
}


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

template <typename T,typename U> class SegmentTree{
	public :
		// rewrite
		inline T get(U x){
			return x;
		}

		inline T merge(T l,T r){
			return min(l,r);
		}

		int n;
		SegmentTree(int size,T o):out(o){
			for(n=1;n<size;n<<=1);
			data=vector<T>(2*n,out);
			flag=vector<bool>(2*n,false);
			lazy=vector<U>(2*n);
		}

		void update(int a,int b,U x,int k,int l,int r){
			if(r<=a||b<=l) return;
			if(a<=l&&r<=b){data[k]=get(x),flag[k]=true,lazy[k]=true;return;}
			lazy_evaluate(k,l,r);
			update(a,b,x,k*2+1,l,(l+r)/2);
			update(a,b,x,k*2+2,(l+r)/2,r);
			data[k]=merge(data[k*2+1],data[k*2+2]);
		}

		void update(int a,int b,U x){return update(a,b,x,0,0,n);}

		T query(int a,int b,int k,int l,int r){
			if(r<=a||b<=l) return out;
			if(a<=l&&r<=b) return data[k];
			lazy_evaluate(k,l,r);
			T vl = query(a,b,k*2+1,l,(l+r)/2);
			T vr = query(a,b,k*2+2,(l+r)/2,r);
			return merge(vl,vr);
		}

		T query(int a,int b) {return query(a,b,0,0,n);}

	private:
		vector<T> data;
		vector<bool> flag;
		vector<U> lazy;
		const T out;

		inline void lazy_evaluate(int k,int l,int r){
			if(flag[k]==false) return;
			U x=lazy[k];
			update(l,(l+r)/2,x,k*2+1,l,(l+r)/2);
			update((l+r)/2,r,x,k*2+2,(l+r)/2,r);
			flag[k]=false;
		}
};

SegmentTree<int,int> *rmq;

int main(void){
	int N,Q;
	cin >>  N >> Q;
	rmq= new SegmentTree<int,int> (N,INT_MAX);

	for(int i=0;i<Q;i++){
		int type;
		cin >> type;
		if(type){
			int s,t;
			cin >> s >> t;
			cout << rmq->query(s,t+1) << endl;
		}else{
			int a,x;
			cin >> a >> x;
			rmq->update(a,a+1,x);
		}
	}
	return 0;
}

Measured memory_bytes: 3284
#include "bits/stdc++.h"
using namespace std;

int main() {
	int N, M;
	cin >> N >> M;
	vector<vector<bool> > V(N, vector<bool>(N, true));
	for (int i = 0; i < M; i++) {
		int A, B;
		cin >> A >> B;
		A--, B--;
		V[A][B] = false;
		V[B][A] = false;
	}
	vector<pair<int, int> > VP;
	int NOW = 0;
	vector<bool> Flag(N, false);
	vector<int> C(N, -1);
	queue<int> Q;
	for (int i = 0; i < N; i++) {
		if (!Flag[i]) {
			Q.push(i);
			C[i] = 0;
			int COUNT[2] = {};
			while (!Q.empty()) {
				int P = Q.front();
				Q.pop();
				Flag[P] = true;
				COUNT[C[P]]++;
				for (int NP = 0; NP < N; NP++) {
					if (NP == P) continue;
					if (V[P][NP]) {
						if (C[NP] == -1) {
							C[NP] = 1 - C[P];
							Q.push(NP);
						}
						else {
							if (C[NP] != 1 - C[P]) {
								cout << -1 << endl;
								return 0;
							}
						}
					}
				}
			}
			VP.push_back({ COUNT[0], COUNT[1] });
			NOW++;
		}
	}
	vector<bool> DP(N + 1, false);
	DP[0] = true;
	for (int i = 0; i < NOW; i++) {
		vector<bool> CurDP(N + 1, false);
		for (int j = 0; j <= N; j++) {
			if (DP[j]) {
				if (j + VP[i].first <= N) CurDP[j + VP[i].first] = true;
				if (j + VP[i].second <= N) CurDP[j + VP[i].second] = true;
			}
		}
		for (int j = 0; j <= N; j++) {
			DP[j] = CurDP[j];
		}
	}
	int ANS = M;
	for (int i = 0; i <= N; i++) {
		if (DP[i]) {
			ANS = min(ANS, i * (i - 1) / 2 + (N - i) * (N - i - 1) / 2);
		}
	}
	cout << ANS << endl;
}

Measured memory_bytes: 384
//From Naruto to Hokage
//#include <RJ>
#include<bits/stdc++.h>
using namespace std;

#define ll          long long
#define pb          push_back
#define endl        '\n'
#define mii         map<ll,ll>
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll)x.size()
#define hell        1000000007
#define INF         (1ll<<60)
#define rep(i,a,b)  for(ll i=a;i<=b;i++)
#define rrep(i,a,b)  for(ll i=a;i>=b;i--)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define time        cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll lcm(ll a, ll b) { return a * (b / gcd(a, b)); }
const int N=100005;
mii m;
bool isPrime(ll N){
    if(N<2)return false;
    if(N<4)return true;
    if((N&1)==0)return false;
    if(N%3==0)return false;
    ll curr=5,s=sqrt(N);
    while(curr<=s){
        if(N%curr==0)return false;
        curr+=2;
        if(N%curr==0)return false;
        curr+=4;
    }
    return true;
}
void solve(){
    ll a,b;
    cin>>a>>b;
    for(ll i=1;i*i<=a;i++){
        if(a%i==0){
            m[i]=1;
            if((i*i)!=a) m[a/i]=1;
        }
    }
    vi temp;
    for(ll i=1;i*i<=b;i++){
        if(b%i==0){
            if(m[i]) temp.pb(i);
            if((i*i)!=b){
                if(m[b/i]) temp.pb(b/i);
            }
        }
    }
    ll ans=1;
    rep(i,0,sz(temp)-1){
        if(isPrime(temp[i])) ans++;
    }
    cout<<ans;
}
signed main()
{
    ios
    int TESTS=1;
    //cin>>TESTS;
    while(TESTS--){
        solve();
    }
    time
    return 0;
}

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

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

int main() {
  int mod = 1000000007;
  int s;
  cin >> s;
  long sum[s + 10];
  sum[0] = sum[1] = sum[2] = 0;
  sum[3] = 1;
  for (int i = 4; i <= s; i++) {
    sum[i] = (sum[i - 1] + sum[i - 3]) % mod;
  }
  cout << sum[s] << endl;
}

Measured memory_bytes: 3624
#include <iostream>

using namespace std;

int main(int argc, const char *argv[]) {
  int A, B;
  cin >> A >> B;

  for(int i = 1; i<4;i++){
    if ((A * B * i) % 2 == 1) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
  return 0;
}


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

int dist[SIZE][SIZE];
bool used[SIZE][SIZE];
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int n;

void dfs(int x,int y)
{
	for(int t=0;t<4;t++)
	{
		int nx=x+dx[t],ny=y+dy[t];
		if(0<=nx&&nx<n&&0<=ny&&ny<n)
		{
			if(dist[nx][ny]>dist[x][y]+(used[nx][ny]?1:0))
			{
				dist[nx][ny]=dist[x][y]+(used[nx][ny]?1:0);
				dfs(nx,ny);
			}
		}
	}
}
int main()
{
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			dist[i][j]=min(min(i+1,j+1),min(n-i,n-j));
			used[i][j]=true;
		}
	}
	int ret=0;
	for(int i=0;i<n*n;i++)
	{
		int p;
		scanf("%d",&p);p--;
		int x=p/n,y=p%n;
		dist[x][y]--;
		used[x][y]=false;
		dfs(x,y);
		ret+=dist[x][y];
	}
	printf("%d\n",ret);
}

Measured memory_bytes: 24316
package main

import (
	"bufio"
	"fmt"
	"os"
	"reflect"
	"strconv"
	"strings"
)

func mapf(f interface{}, list interface{}) interface{} {
	fv, listv := reflect.ValueOf(f), reflect.ValueOf(list)

	if fv.Kind() != reflect.Func || listv.Kind() != reflect.Slice {
		return nil
	}

	len := listv.Len()
	ret := reflect.MakeSlice(reflect.SliceOf(fv.Type().Out(0)), len, listv.Cap())

	for i := 0; i < len; i++ {
		v := fv.Call([]reflect.Value{listv.Index(i)})
		ret.Index(i).Set(v[0])
	}

	return ret.Interface()
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()

	arr, _ := mapf(strconv.Atoi, strings.Split(scanner.Text(), " ")).([]int)
	a, b := arr[0], arr[1]

	fmt.Printf("%d %d\n", a*b, 2*(a+b))
}



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

using namespace std;

int main(){
	string str, ans="CODEFESTIVAL2016";
	cin>>str;
	int cnt=0;
	for(int i=0; i<16; i++){
		if(str[i]!=ans[i]){
			cnt++;
		}
	}
	cout<<cnt<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      int H, W;
      cin >> H >> W;
      
      vector<vector<char>> data(H, vector<char>(W));
      for (int i=0; i<H; i++){
        for (int j=0; j<W; j++){
          cin >> data.at(i).at(j);
        }
      }
      
      bool test;
      for (int i=0; i<H; i++){
        test =false;
        for (int j=0; j<W; j++){
          if (data.at(i).at(j)=='#'){
            test=true;
            break;
          }        
        }
        if (test) continue;
        else {
          for (int j=0; j<W; j++){
            data.at(i).at(j)='X';
          }
        }
      }
      
      
      for (int i=0; i<W; i++){
        test=false;
        for (int j=0; j<H; j++){
          if (data.at(j).at(i)=='#'){
            test=true;
            break;
          }        
        }
        if (test) continue;
        else {
          for (int j=0; j<H; j++){
            data.at(j).at(i)='X';
          }
        }
      }
      
      int count;
      for (int i=0; i<H; i++){
        count=0;
        for (int j=0; j<W; j++){
          if (data.at(i).at(j)=='X'){
            count++;
            continue;
          }
          else cout << data.at(i).at(j);
        }
        if(count==W) continue;
        else cout << endl;
      }

      
    }



      

      

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


constexpr size_t MAX_SIZE = 1000000;

int main()
{
	std::string N;
	int sum = 0, kuri = 0, kuri5 = 0;

	std::cin >> N;

	for (auto it = N.rbegin(); it != N.rend(); ++it)
	{
		int ci = *it - '0' + kuri;
		if (ci >= 5) ci += kuri5;

		kuri5 = 0;
		kuri = 0;

		if (ci < 5)
		{
			sum += ci;
		}
		else if (ci > 5)
		{
			sum += 10 - ci;
			kuri = 1;
		}
		else
		{
			sum += 5;
			kuri5 = 1;
		}
	}

	sum += kuri;

	std::cout << sum;
}

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

using namespace std;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long int h, v;
    cin >> h >> v;
    if(h == 1 || v == 1) {
        cout << 1 << endl;
        return 0;
    }
    h *= v;
    if(h%2)
        cout << (h/2)+1 << endl;
    else
        cout << h/2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <regex>
#include <cmath>

using namespace std;

int main() {
    int x = 0, n, max = 0;
    string s;
    cin >> n >> s;

    for (int i = 0; i < n; ++i) {
        if(s[i] == 'I') {
            x++;
            if(max < x){
                max = x;
            }
        }
        else if(s[i] == 'D') {
            x--;
        }
    }

    cout << max << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iterator>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <numeric>
#include <iomanip>
#include <limits>
#include <set>
#include <map>
#include <type_traits>
#include <cstdint>
#include <queue>
#define _USE_MATH_DEFINES
#include <math.h>
#include <sstream> // std::stringstream
#include <bitset>  // std::bitset<N>

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;

//素因数分解
void factoring(ll n, map<ll, ll>& mp) {
	for (ll i = 2; i * i <= n; i++) {
		while (n % i == 0) {
			mp[i]++;
			n /= i;
		}
	}
	if (n != 1) mp[n]++;
}

//絶対値
template<class T, class U = std::make_unsigned_t<T>>
U SafeAbs( T x ) {
    return x < 0 ? -static_cast<uintmax_t>(x) : x;
}

//最大・最小
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;
}

//xのn乗
ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}
//xの逆元
ll mod_inv(ll x, ll mod) {//O(log(mod))
    return mod_pow(x, mod - 2, mod);
}

//nCr
ll ncr(ll n, ll r, ll mod){
	ll res=1;
	ll num=1,den=1;
	for(ll i=n;i>=n-r+1;i--){
		(den*=i)%=mod;
	}
	for(ll i=1;i<=r;i++){
		(num*=i)%=mod;
	}
	
	res=den*mod_inv(num,mod);

	return res%mod;
}


//二分探索
bool isOk(ll index, ll key,vector<ll> &a){
	
	if(a[index]>key){
		return true;
	}
	
	return false;
}

ll bin_search(ll key, vector<ll> &a){
	
	ll l=-1;
	ll r=a.size();

	while(abs(r-l)>1){
		ll mid = (l+r)/2;
		if(isOk(mid, key, a)){
			r=mid;
		}
		else{
			l=mid;
		}
	}
	return r;
}

/*
//深さ優先探索
void dfs(vector<vector<ll>> &gra,vector<bool> &seen, ll v){

	seen[v]=true;

	for(auto next : gra[v]){
		if(seen[next]){
			continue;
		}

		dfs(gra,seen,next);
	}
	
}
*/
const ll MOD=1000000007;

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

void solve(){
	ll ans = 0;
	ll x;
	cin >> x;

	if(x<600){
		ans = 8;
	}
	else if (x < 800)
	{
		ans = 7;
	}
	else if(x < 1000)
	{
		ans = 6;

	}else if(x<1200){
		ans = 5;

	}else if(x<1400){
		ans = 4;
	}else if(x<1600){
		ans = 3;
	}
	else if (x < 1800) {
		 ans = 2; 
	}else{
		ans = 1;
	}
	cout << ans << endl;
}

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



Measured memory_bytes: 3636
N = int(input())
ABC = []
for i in range(N):
    a,b,c = map(int, input().split())
    ABC.append((a,b,c))

dpA = [0 for _ in range(N)]
dpB = [0 for _ in range(N)]
dpC = [0 for _ in range(N)]

for i in range(N):
    if i == 0:
        dpA[0] = ABC[i][0]
        dpB[0] = ABC[i][1]
        dpC[0] = ABC[i][2]
    else:
        dpA[i] =  max(dpB[i-1], dpC[i-1]) + ABC[i][0]
        dpB[i] =  max(dpA[i-1], dpC[i-1]) + ABC[i][1]
        dpC[i] =  max(dpA[i-1], dpB[i-1]) + ABC[i][2]

print(max(dpA[-1],dpB[-1],dpC[-1]))


Measured memory_bytes: 32456
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<map>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define INF = 1000000100;


int main(){
    int a1,a2,a3;
    cin >> a1 >> a2 >> a3;
    if(a1+a2+a3>=22) cout << "bust" << endl;
    else cout << "win" << endl;
    return 0;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define INF 1000000000
#define pi 3.14159265358979323846264338327950L
#define FOR(i,a,b) for(int i=a;i<b;i++)

int main()
{
    //freopen("contest.txt","r",stdin);
    //freopen("contest.txt","w",stdout);
    IOS
    string s;
    cin>>s;
    if(s[1]=='B')
        cout<<"ARC"<<endl;
    else
        cout<<"ABC"<<endl;
    return 0;
}


Measured memory_bytes: 3636
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (1LL<<60)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
typedef unsigned long long int ull;
typedef long long lint;
 
using namespace std;
 
int main(void){
  int N;
  cin >> N;
  double x[N];
  string u[N];
  double ans=0;
  rep(i,N) cin >> x[i] >> u[i];
  rep(i,N){
    if(u[i]=="BTC") ans+=380000.0*x[i];
    else ans+=x[i];
  }
  cout << ans << endl;
}

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

///******************************** C o n t a i n e r ********************************///

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

///*********************************** C o n s t ***********************************///

const int       N=1e6+3;
const double    PI = acos(-1);

ll dx[] = {+1, 0, -1, 0, +1, +1, -1, -1};
ll dy[] = {0, +1, 0, -1, +1, -1, +1, -1};

///********************************** M a r c o ***********************************///

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) x.size()
#define el <<'\n'

#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define fraction() cout.unsetf(ios::floatfield); cout.precision(0); cout.setf(ios::fixed,ios::floatfield);

///*********************************** F u n c t i o n ***********************************///

ll powmod(ll a,ll b){if(!a) return 0;ll pr=1;while(b>0){if(b&1){pr*=a;--b;}a*=a;b/=2;}return pr;}
bool isPrime(ll n){ if(n<=1)return false;if(n<=3)return true;if(n%2==0 or n%3==0)return false;for(ll i=5;i*i<=n;i+=6){if(n%i==0 or n%(i+2)==0)return false;}return true;}
///**************************************************** C o d e ****************************************************///
///-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=///
bool a[1000005]; vl v;
void seive(){
    ll mx=sqrt(1000005),ii,jj;
    for(ii=3;ii<=mx;ii+=2)
        if(!a[ii])
            for(jj=ii*ii;jj<1000004;jj+=2*ii) a[jj]=true;
    v.pb(2);
    for(ii=3;ii<1000004;ii+=2)if(!a[ii]) v.pb(ii);
}



void _case()
{
    ll n,i,ans=0,y;
    cin>>n;
    y=sz(v);
    map<ll,ll> m;
    m[1]++;
    for(i=0;i<y and v[i]<=n;i++){
        if(n%v[i]==0){
            ll cnt=0,j=v[i];
            while(n%j==0){
                cnt++;
                n/=j;
            }
            ans+=(-1+sqrt(1+8*cnt))/2;
        }
    }
    if(!m[n] and isPrime(n)) ans++;
    cout<<ans el;
}

main()
{
    seive();
        _case();

}


///Thank you.


///Brainless_Loco Terminates Here!



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

int main() {
    int r, g, b,x;
    cin >> r >> g >> b;
    x = 100 * r + 10 * g + b;
    if (x % 4 == 0) {
        cout << "YES" << endl;
    }
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rrep(i,n) for(int (i)=((n)-1);(i)>=0;(i)--)
#define itn int
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
const long long INF = 1LL << 60;
const int MOD = 1000000007;
signed main(void){
    int n; cin>>n;
    string s; cin>>s;
    vector <vector<int>> dp(5005,vector <int>(5005));
    rrep(i,n)rrep(j,n) if(s[i] == s[j]) dp[i][j] = dp[i+1][j+1] + 1;
    int ans = 0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            ans = max(ans , min(j-i, dp[i][j]));
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 196096
#[warn(unused_imports)]
use proconio::{
   fastout, input,
   marker::{Bytes, Chars, Isize1, Usize1}
};

#[fastout]
fn main() {
   input! {
      s: Chars,
      t: Chars,
   }
   let n = s.len();
   for i in 0..n{
      if s[i] != t[i] {
         println!("No");
         return;
      }
   }
   println!("Yes");
}


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

int main() {
  int num, sumA, sumB;
  cin >> num;
  vector<int> cards(num);
  sumA, sumB = 0;
  
  for(int i = 0; i < num; i++)
    cin >> cards.at(i);
  
  sort(cards.begin(), cards.end());		//カードは小さい順にソート
  reverse(cards.begin(), cards.end());	//カードをリバース(大きい順に並び替え)
  
  for(int i=1; i < num+1; i++)
  {
    //偶数時(Aliceの手番)
    if(i%2 == 1) {
      sumA += cards.at(i-1);
    }
    if(i%2 == 0) {
      sumB += cards.at(i-1);
    }
  }
  cout << sumA - sumB << endl;
}


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

int main() 
{ 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll a, b, c, d;
    cin >> a >> b >> c >> d;
    while(a > 0 && c > 0) {
        c -= b;
        if(c > 0) {
            a -= d;
        }
    }
    cout << (a > 0 ? "Yes" : "No") << "\n";
    return 0; 
}

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

int main() {
    ll H, W;
    cin >> H >> W;
    vector<vector<ll>> A(H, vector<ll>(W)), B(H, vector<ll>(W)),
        D(H, vector<ll>(W));
    rep(y, H) rep(x, W) { cin >> A[y][x]; }
    rep(y, H) rep(x, W) { cin >> B[y][x]; }
    rep(y, H) rep(x, W) { D[y][x] = abs(A[y][x] - B[y][x]); }

    ll dr = 1e4;
    vector<vector<vector<bool>>> enable(
        H, vector<vector<bool>>(W, vector<bool>(dr, false)));

    enable[0][0][D[0][0]] = true;
    rep(y, H) rep(x, W) {
        ll d = D[y][x];
        if (y > 0) {
            rep(k, dr) {
                if (enable[y - 1][x][k]) {
                    if (k + d < dr) enable[y][x][k + d] = true;
                    enable[y][x][abs(k - d)] = true;
                }
            }
        }
        if (x > 0) {
            rep(k, dr) {
                if (enable[y][x - 1][k]) {
                    if (k + d < dr) enable[y][x][k + d] = true;
                    enable[y][x][abs(k - d)] = true;
                }
            }
        }
    }

    ll ans = 0;
    while (1) {
        if (enable[H - 1][W - 1][ans]) {
            cout << ans << endl;
            break;
        }
        ans++;
    }
    return 0;
}


Measured memory_bytes: 8704
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        while(true) {
            int a = scan.nextInt();
            int b = scan.nextInt();
            if (a==0 && b==0) break;
            if (a>b) System.out.println(b+" "+a);
            else System.out.println(a+" "+b);
         }
    }
}

Measured memory_bytes: 35408
#include<stdio.h>
#include<math.h>//マイナス無限大を使うためにインクルードする
#include<string.h>
#define Max 2000000

int size,A[Max];

int RIGHT(int a){
    return 2*a+1;
}
int LEFT(int a){
    return 2*a;
}
int PARENT(int a){
    return a/2;
}

void maxheapify(int i){
    int left,right,largest;
    int temp=0;
    left=LEFT(i);
    right=RIGHT(i);
    if(left<=size && A[left]>A[i]){
        largest=left;
        }else{
            largest=i;
        }
    if(right<=size && A[right]>A[largest]){
        largest=right;
    }
    if(largest!=i){
        //swap
        temp=A[i];
        A[i]=A[largest];
        A[largest]=temp;
        maxheapify(largest);
    }
}

void Increase(int i,int key){
    int temp;
    if(key<A[i]){
        //printf("key is smaller than presently number\n");
    }
    A[i]=key;
    while(i > 1 && A[PARENT(i)] < A[i]){
        temp=A[i];
        A[i]=A[PARENT(i)];
        A[PARENT(i)]=temp;

        i=PARENT(i);
    }
}

//集合Aに要素を挿入する
void Insert(int key){
    size+=1;
    A[size]=-INFINITY;
    Increase(size,key);
}

//Aから最大のキーをもつ要素を削除し、その要素を返す
int Extract(){
    int maximum;
    if(size < 1){
        //printf("Heap under flow\n");
        return -INFINITY;
    }
    maximum=A[1];
    A[1]=A[size--];
    maxheapify(1);
    return maximum;
}



int main(){
    char text[8];
    char moji1[7]="insert";
    char moji2[8]="extract";
    char owari[4]="end";
    int num,i,j=0;
    
    while(1){
        scanf("%s",text);
        if(text[0]=='e' && text[2]=='d'){
            return 0;
        }
        //insert
        if(text[0]=='i'){
            scanf("%d",&num);
            Insert(num);
        }//extract
        else{
            printf("%d\n",Extract());
        }
   j++;
    }
    return 0;
}


Measured memory_bytes: 5700
N, K = map(int, input().split())
if N > K:
  N -= (N//K)*K
ans = N if N <= abs(N-K) else abs(N-K)
print(ans)

# flag = True
# while flag:
#   if N > K:
#     N = abs(N-K)
#   else:
#     ans = N if N <= N -K else N-K
#     flag = False

Measured memory_bytes: 9148
#include <stdio.h>

int main(void) {

	int W,H,x,y,r;
	scanf("%d %d %d %d %d",&W,&H,&x,&y,&r);

	if(x>=r && x<=W-r && y>=r && y<=H-r){
		printf("Yes\n");
	} else {
		printf("No\n");
	}
	return 0;
}

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

int miniChar(string S1, string S2) 
{ 	int n = S1.size(), m = S2.size(); 

	int ans = INT_MAX; 
	for (int i = 0; i < m - n + 1; i++) { 		int minChar = 0; 
		for (int j = 0; j < n; j++) { 
			if (S1[j] != S2[i + j]) { 
				minChar++; 
			} 
		} 
		ans = min(minChar, ans); 
	} 
	return ans; 
} 

int main(){
	string s,t;
	cin >> s >> t;
	cout << miniChar(t, s); 
	return 0; 
} 


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

int main(){
    int x,y;
    cin >> x >>y;
    ll ans;
    (x % y == 0)?ans = -1:ans = x;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<math.h>
#include<queue>
#include<cstdio>
#include<set>
#include<map>
using namespace std;
using ll = long long;

int main(){
    ll N,K;
    cin >> N >> K;
    vector<ll> A(N+1);
    for(ll i=1; i<=N; i++){
        cin >> A.at(i);
    }
    ll num=1;
  	ll sum=0;
    vector<ll> tele(N+1,-1), kako(N+1,-1);
    tele.at(0)=1;
  	kako.at(1)=0;
  	num = A.at(num);
  	bool a=true;
    while(kako.at(num)<0){
      	kako.at(num)=sum+1;      	
      	tele.at(sum)=num;
        num = A.at(num);
        sum = sum+1;
      	if(sum==K){
          	a=false;
			break;
        }
    }	
  	if(a){
  		tele.at(sum)=num;
  		ll c=kako.at(num);
  		ll d=sum+1-c;
  		ll e=K-c;
  		ll f=e%d;
  		if(f==0) f=d;
  		ll amari=f+c-1;
   	 	cout << tele.at(amari) << endl;
    }else{
		tele.at(sum)=num;
      	cout<<tele.at(sum-1)<<endl;
    }
    return 0;
}

Measured memory_bytes: 7996
//============================================================================
// Name        : AOJ.cpp
// Author      : Akari Fujii
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <cctype>
#include <string>
#include<algorithm>

using namespace std;
typedef long long ll;
int main(){


	int n,k;
	int d=1;

	cin>>n;
	cin>>k;

	for(int i=1; i<n+1; ++i){
		if(d*2<d+k){
			d=d*2;
		}else{
			d=d+k;
		}
	}

	cout<<d<<endl;





	return 0;
}


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

using namespace std;

typedef long long ll ;
#define REP(x,n) for(int x=0;x<n;x++)

// vector 操作  vector<int> data(10,5) 5が10個　data(10) 要素数10
// v.size(), v.empty(), v.insert(itr,値), v.erase(itr) (first,last),
// sort(itr), find(all(x),値),reverse(itr),accumulate(itr,0) 積算,
//v.swap
// stringも同じ itrがただの数字になる
// s.substr(n,m)n番目以降m文字取り出す　erase(n,m)も  s.find
#define vei vector<int> 
#define velli vector<long long int> 
#define pb(x) push_back(x) // 末尾にxを加える
#define pb2 pop_back() // 末尾削除
#define all(x) (x).begin(),(x).end() //イテレーター
#define be(x) (x).begin()
//auto  auto begin = v.begin()とか

// map 操作  map<string,int> mp キー=string 値=int型  pair< , >型
// 代入:mp["abc"]=123  mp.erase(キー)
// itr = mp.begin()のとき　itr->first = key, itr->second = val
// mp.find(key) itrを返す
typedef pair<int, int> p; 
//q(p.first,p.second)で定義できる？

// lcm( , ) gcd( , ) 最大公約数　最小公倍数


int f(char ch){

    int turn;

    if(ch=='a') turn=1;
    else if(ch=='b') turn=2;
    else turn=3; 

    return turn;
}


int main (){

    string sa;
    string sb;
    string sc;
    cin >> sa >> sb >> sc;

    int la = sa.size();
    int lb = sb.size();
    int lc = sc.size();

    // cout << int (sa[0]) << endl;

    //sa.erase(sa.begin());
    int turn = 1;

   // while(sa.size()!=0 && sb.size()!=0 && sc.size()!=0 ){
       int xxx = 1;
        while(1){
        switch(turn){

            case 1:  {char a = sa[0];
                     turn = f(a);
                     if(sa.size()==0) {cout << 'A'; goto X;}
                     sa.erase(sa.begin());
                     break;}
            case 2:  {char b = sb[0];
                     turn = f(b);
                     if(sb.size()==0) {cout << 'B'; goto X;}
                     sb.erase(sb.begin());
                     break;}
            case 3:  {char c = sc[0];
                     turn = f(c);
                     if(sc.size()==0) {cout << 'C'; goto X;}
                     sc.erase(sc.begin());
                     break;}
            }
        }
        X: ;
    }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define V vector
#define PB push_back
#define MP make_pair
#define EB emplace_back
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " is " << x << endl
#define int ll

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

const int INF = 1e9 + 7, N = 3e3 + 87;

int a[N], p[N];

signed main()
{
	IO_OP;
	
	int n, ans = 0;
	cin >> n;
	for(int i=0;i<n;i++) {
		int l;
		cin >> l;
		a[l]++;
	}
	for(int i=1;i<N;i++) p[i] = p[i-1] + a[i];
	for(int i=1;i<N;i++) {
		if(a[i] == 0) continue;
		if(a[i] >= 3)
			ans += a[i] * (a[i] - 1) * (a[i] - 2) / 6;
		if(a[i] >= 2)
			ans += a[i] * (a[i] - 1) / 2 * (p[2 * i - 1] - a[i]);
	}
	for(int i=1;i<N;i++)
		for(int j=1;j<i;j++)
			ans += a[i] * a[j] * (p[i + j - 1] - p[i]);
	cout << ans << endl;

}





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

int dist(int x, int y){
  return (int)(abs(x)+abs(y));
}

int main(){
  int N,M;
  cin>>N>>M;
  vector<int> a(N),b(N);
  vector<int> c(M),d(M);
  for(int i=0;i<N;i++){
    cin>>a.at(i)>>b.at(i);
  }
  for(int i=0;i<M;i++){
    cin>>c.at(i)>>d.at(i);
  }
  for(int i=0;i<N;i++){
    int k=0;
    for(int j=0;j<M;j++){
      if(dist(a.at(i)-c.at(j),b.at(i)-d.at(j))<dist(a.at(i)-c.at(k),b.at(i)-d.at(k))){
        k=j;
      }
    }
    cout<<k+1<<endl;
  }
}

Measured memory_bytes: 256
import numpy as np
a, b, x = map(int, input().split())

if x > (a**2)*b/2:
    ans = np.degrees(np.arctan((b*2)/a - (x*2)/(a**3)))
else:
    ans = 90 - np.degrees(np.arctan((x*2)/(a*(b**2))))
    
print(ans)    

Measured memory_bytes: 12496
from operator import itemgetter
a = int(input())
l = []
for i in range(a):
    t,T = map(int,input().split())
    l.append((t,T))
l = sorted(l, key=itemgetter(1), reverse=False)
# print(l)
E = 0
S = 0 
s = 0
for i , j in l :
    E += abs(E-j)
    S += i
    if S>E:
        s=1 
def Y(a,t = 0):
    if a==t : print('YES')
    else : print('NO')
def y(a, t =0):
    if a==t : print('Yes')
    else : print('No')

y(s)

Measured memory_bytes: 33412
N=int(input())
S=input()
maxLen=i=j=0
while j<N:
  if j-i > N-j:
      break  

  t=S[i:j]
  if t in S[j:]:
    maxLen=max(maxLen,len(t))
    j+=1
  else:
    i+=1
print(maxLen)  

Measured memory_bytes: 3188
n = gets.to_i
a = gets.split.map(&:to_i)
h = Hash.new(0)
a.each do |x|
  h[x] += 1
end
ans = 0
h.each do |k, v|
  if v > k
    ans += v - k
  elsif v < k
    ans += v
  end
end
puts ans

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

#define N 1000
#define pb push_back
#define mp make_pair
#define ll long long
#define mod 1000000007
#define fastio ios::sync_with_stdio(false); cin.tie(0)

bool mo(int n){
	if(n > 0 && n < 13) return true;
	return false;
}

int main(){
    fastio;
    // #ifndef ONLINE_JUDGE
    //     freopen("input.in", "r", stdin);
    //     freopen("output.out", "w", stdout);
    // #endif
	    
    int n, a, b;
    bool y = false, m = false;
    cin >> n;

    a = n/100;
    b = n%100;

   	m = mo(a);
   	y = mo(b);

   	if(y && m) cout << "AMBIGUOUS";
   	else if(y) cout << "YYMM";
   	else if(m) cout << "MMYY";
   	else cout << "NA";
   	cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define mem(x,v) memset(x,v,sizeof(x))
#define Rep(i,a,b) for(register int i=(a);i<=int(b);++i)
#define rep(i,a,b) for(register int i=(a);i<int(b);++i)
#define Dep(i,a,b) for(register int i=(a);i>=int(b);--i)
#define gc getchar
#define pc putchar
#define fi first
#define se second
inline ll read(){
    ll x=0;int f=1;char c=gc();
    for(;!isdigit(c);c=gc())if(c=='-')f=-1;
    for(;isdigit(c);c=gc())x=(x<<1)+(x<<3)+(c^48);
    return x*f;
}
inline void write(ll x){if(x<0)x=-x,pc('-');if(x>=10)write(x/10);putchar(x%10+'0');}
inline void writeln(ll x){write(x);pc('\n');}
inline void wri(ll x){write(x);pc(' ');}
const int maxn = 255*3;
const int mod = 1e9+7;
int n,m;
char s[maxn];
int ans,fac[maxn],ifac[maxn];
inline int qpow(int a,int b){
	int ans=1;
	for(;b;b>>=1,a=1ll*a*a%mod)
		if(b&1) ans=1ll*ans*a%mod;
	return ans;
}
void init(){
	n = read(),m = read();
	scanf("%s",s+1);
	fac[0] = 1;rep(i,1,maxn) fac[i] = 1ll * fac[i-1] * i % mod;
	ifac[maxn-1] = qpow(fac[maxn-1],mod-2);
	Dep(i,maxn-2,0) ifac[i] = 1ll * ifac[i+1] * (i+1) % mod;
	assert(ifac[0]==1);
}
inline int C(int n,int m){
	if(n<m||n<0) return 0;
	return 1ll * fac[n] * ifac[m] % mod * ifac[n-m] % mod;
}
#define cal(x,y) C((x)+(y)-1,(y)-1)
inline void add(int &x,int v){
	x+=v;
	if(x>=mod) x-=mod;
}
int q1[maxn],q2[maxn],suf[maxn],f[maxn][maxn];
bool used[maxn];
void solve(int S1,int S2){
	if(!S1&&!S2) return ++ans,void(0);
	if((S1+S2)*2>n+1 || S1+2*S2>m) return ;
	*q1=*q2=0;
	memset(used,0,sizeof(used));
	int x=0,y=0;
	Rep(i,1,m)
		if(s[i]=='r' && x<S1+S2) q1[++x]=i; else 
		if(s[i]=='b' && y<S2 && y<x) q2[++y]=i;
	if(y!=S2 || x!=S1+S2) return ;
	Rep(i,1,x) used[q1[i]]=true;
	Rep(i,1,y) used[q2[i]]=true;
	Dep(i,m,1) suf[i]=suf[i+1]+(!used[i]);
	Rep(i,1,S2) q2[i] = suf[q2[i]];
//	Rep(i,1,S2) wri(q2[i]);puts("");
	memset(f,0,sizeof(f));
	f[0][0]=1;
	int limit = max(2,n)+1;
	Rep(i,2,limit)Dep(j,S2-1,0)Rep(k,2*j,limit-i*(S2-j)){
		Rep(l,1,min(S2-j,(limit-k)/i)){
			if(k+i*l-2*(j+l) > q2[S2-(j+l)+1]) break;
			add(f[j+l][k+i*l],1ll*ifac[l]*f[j][k]%mod);
		}
	}
	int res = 0;
	Rep(i,0,limit){
		int sum=2*S1+2*i-2*S2-1;
		int par=2*S1+2*i+1;
		if (sum>=0&&sum<=n&&f[S2][i])
			add(res,1ll*f[S2][i]*cal(n-sum,par)%mod);
	}res = 1ll * res * fac[S1+S2] % mod * ifac[S1] % mod;
	add(ans,res);
}
int main(){
//	freopen("cover.in","r",stdin);
//	freopen("cover.out","w",stdout);
	init(); 
	ans = 0;
	Rep(S1,0,n)Rep(S2,0,n)solve(S1,S2);
	writeln(ans);
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define div1 1000000007
const long long INF = 1LL << 60;
using namespace std;
typedef long long ll;
typedef long double ld;
// a>b -> a==b;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
// a<b -> a==b;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main(void)
{
    ll R;

    cin >> R;

    cout << setprecision(20) << (ld)R*2*M_PI << endl;

    return 0;
}

Measured memory_bytes: 3788
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
#define PI 3.141592653589793

vector<int> to[101010];
ll color=1;
ll dp[101010][2];

int DFS(int a, int p){
  for(int u: to[a]){
    if(u==p) continue;
    DFS(u, a);
    dp[a][0]*=(dp[u][0]+dp[u][1])%mod; dp[a][0]%=mod;
    dp[a][1]*=(dp[u][0]); dp[a][1]%=mod;
  }
  return (dp[a][0]+dp[a][1])%mod;
}
  


int main(){
  int N; cin >> N;
  rep(i, N-1){
    int x, y; cin >> x >> y; x--; y--;
    to[x].push_back(y);
    to[y].push_back(x);
  }
  rep(i, 101010){
    rep(j, 2){
      dp[i][j] = 1;
    }
  }
  cout << DFS(0, -1) << endl;
}

Measured memory_bytes: 17580
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

pair<ll,ll> dp[3001][3001];

int main() {
  int n;
  cin >> n;
  vl a(n+1,0);
  rep(i,n) {
    cin >> a.at(i+1);
  }
  orep(i,n) {
    dp[1][i].fi = a.at(i);
    dp[1][i].se = 0;
  }

  orep(i,n-1) {
    orep(j,n-i) {
      if(dp[i][j].se+a.at(j+i) < dp[i][j+1].se+a.at(j)) {
        dp[i+1][j].fi = dp[i][j+1].se+a.at(j);
        dp[i+1][j].se = dp[i][j+1].fi;
      } else {
        dp[i+1][j].fi = dp[i][j].se+a.at(j+i);
        dp[i+1][j].se = dp[i][j].fi;
      }
    }
  }
  cout << dp[n][1].fi - dp[n][1].se << endl;


  return 0;
}


Measured memory_bytes: 139648
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <set>
#include <map>
#include <cassert>
#include <fstream>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;

int main() {
    

    
    map<map<char, ll>, ll> m;
    
    
    int n;
    cin >> n;
    
    for (int i = 0; i < n; ++i)
    {
        string s;
        cin >> s;
        map<char, ll> mm;
        for (int j = 0; j < s.size(); ++j)
        {
            mm[s[j]]++;
        }
        m[mm]++;
    }
    
    ll ret = 0;
    for (auto itr = m.begin(); itr != m.end(); ++itr)
    {
        if (itr->second != 1)
        {
            ll num = itr->second;
            ret += ((num * (num - 1)) / 2);
        }
    }
    
    cout << ret << endl;
    
    
    return 0;
}

Measured memory_bytes: 62336
import sys
import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline
from operator import itemgetter

N,Q=map(int,input().split())
C=[0]+list(map(int,input().split()))

QU=[list(map(int,input().split()))+[i] for i in range(Q)]


QU.sort(key=itemgetter(0))


# BIT(BIT-indexed tree)

LEN=N+3

BIT=[0]*(LEN+1) # 1-indexedなtree

def update(v,w): # index vにwを加える
    while v<=LEN:
        BIT[v]+=w
        v+=(v&(-v)) # 自分を含む大きなノードへ. たとえばv=3→v=4

def getvalue(v): # [1,v]の区間の和を求める
    ANS=0
    while v!=0:
        ANS+=BIT[v]
        v-=(v&(-v)) # 自分より小さい2ベキのノードへ. たとえばv=3→v=2へ
    return ANS

NUM=[[] for i in range(N+1)]
for i,c in enumerate(C):
    if i==0:
        continue
    if NUM[c]==[]:
        update(i,1)
    NUM[c].append(i)
    
NUMIND=[0]*(N+1)

ANS=[-1]*Q

ia=1

for x,y,ind in QU:

    while ia!=x:
        update(NUM[C[ia]][NUMIND[C[ia]]],-1)
        NUMIND[C[ia]]+=1
        if NUMIND[C[ia]]<len(NUM[C[ia]]):
            update(NUM[C[ia]][NUMIND[C[ia]]],1)
        ia+=1

    #print(x,y,ind)
    #print([getvalue(i) for i in range(1,N+1)])
    ANS[ind]=getvalue(y)

sys.stdout.write(" ".join(map(str,ANS))+"\n")

Measured memory_bytes: 301944