akhauriyash/Code-Regression huggingface dataset:
/*
ID: computerbox --> Huseyn Hajiyev
LANG: C++
TASK: target_mode_on
*/
#include <bits/stdc++.h>
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#define _CRT_SECURE_NO_WARNINGS
//#include <boost/multiprecision/cpp_int.hpp>
//using boost::multiprecision::cpp_int;
#define FAST_READ ios_base::sync_with_stdio(0);cin.tie(0);
#define in freopen("input.txt", "r", stdin);
#define out freopen("output.txt", "w", stdout);
#define ll long long
#define debt(x,y)cout<<"#x = "<<(x)<<" and "<<"#y = "<<(y)<<endl;
#define deb(x)cout<<"#x = "<<(x)<<endl;
#define COUT(n, a) cout<< fixed << setprecision(a) << n<<endl
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define endl "\n"
#define arr(a,n) for(ll i=1;i<=n;i++) cout<<a[i]<<" "; cout << "\n";
#define vecc(a,n) for(ll i=0;i<n;i++) cout<<a[i]<<" "; cout << "\n";
#define CURTIME() cerr << clock() * 1.0 / CLOCKS_PER_SEC << endl
#define DTIME(ccc) __begin = clock(); ccc; cerr<<"Time of work = "<<(clock()-__begin)/CLOCKS_PER_SEC<<endl;
#define MAXN 2000

using namespace std;

#define debug(args...)(Debugger()) , args
class Debugger
{
  public:
  Debugger(const std::string& _separator=", ") :
  first(true),separator(_separator){}
  template<typename ObjectType>
  Debugger& operator,(const ObjectType& v)
  {
        if(!first)cerr<<separator;
        cerr<<v;
        first=false;
        return *this;
  }
  ~Debugger() {cerr<<endl;}      
  private:
    bool first;
    string separator;
};
 
template <typename T1, typename T2>
inline ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p)
{
   return os<<"("<<p.first<<", "<<p.second<<")";
}
template<typename T>
inline ostream &operator<<(ostream & os,const vector<T>& v)
{
    bool first=true;
    os<<"[";
    for(unsigned ll i=0;i<v.size();i++)
    {
        if(!first)os<<", ";
        os<<v[i];
        first=false;
    }
        return os<<"]";
}
template<typename T>
inline ostream &operator<<(ostream & os,const set<T>&v)
{
    bool first=true;
    os<<"[";
    for(typename set<T>::const_iterator ii=v.begin();ii!=v.end();++ii)
    {
        if(!first)os<<", ";
        os<<*ii;
        first=false;
    }
    return os<<"]";
}
template<typename T1, typename T2>
inline ostream &operator<<(ostream & os,const map<T1, T2>&v)
{
        bool first=true;
        os<<"[";
        for(typename map<T1,T2>::const_iterator ii=v.begin(); ii!=v.end();++ii)
        {
            if(!first)os<<", ";
            os<<*ii;
            first=false;
        }
        return os<<"]";
}

ll n;
ll massiv[MAXN];
int main(){
FAST_READ;
ll n,ii;
cin>>n>>ii;
ll cnt=0;
for(ll i=n;i>=ii;i--)
{
  cnt++;
}
cout<<cnt<<endl;






return 0;
} 


Measured memory_bytes: 764
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>
#include <stack>
#include <tuple>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)


typedef long long int ll;
typedef double D;      // ??§?¨?????????????double???long double?????????
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;


const int INF = (1<<30) - 1;
const D EPS = 1e-9;

#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

class Block{
public:
    int label, start, size;
    Block(int label, int start, int size): label(label), start(start), size(size){};
};

int N;

void write(vector<Block> &blocks, int label, int size){
    for(int i=0; i<blocks.size(); i++){
        if(blocks[i].label == -1){
            if(size == blocks[i].size){
                blocks[i].label = label;
                break;
                
            }else if(size < blocks[i].size){
                int start = blocks[i].start;
                int lest_size = blocks[i].size - size;
                auto it = blocks.erase(blocks.begin() + i);
                it = blocks.insert(it, Block(-1, start+size, lest_size));
                blocks.insert(it, Block(label, start, size));
                break;
                
            }else{
                blocks[i].label = label;
                size -= blocks[i].size;
            }
        }
    }
}

void del(vector<Block> &blocks, int label){
    //?????????????????£????????????????????????
    for(int i=0; i<blocks.size(); i++)
        if(blocks[i].label == label)
            blocks[i].label = -1;
    
}

void read(vector<Block> &blocks, int pointer){
    for(int i=0; i<blocks.size(); i++)
        if(blocks[i].start <= pointer && pointer < blocks[i].start + blocks[i].size)
            cout << blocks[i].label << endl;
}

void solve(){
    vector<Block> blocks;
    blocks.push_back(Block(-1, 0, INF));
    
    char c;
    while(N--){
        cin >> c;
        if(c == 'W'){
            int label, size;
            cin >> label >> size;
            write(blocks, label, size);
        }
        if(c == 'D'){
            int label; cin >> label;
            del(blocks, label);
        }
        if(c == 'R'){
            int pointer; cin >> pointer;
            read(blocks, pointer);
        }
    }
}

//g++ -std=c++0x -msse4.2 -O3
//#include <bits/stdc++.h>
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    //cout.precision(10);
    
    while(cin>>N, N){
        solve();
        cout << endl;
    }
    
    return 0;
}

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

int main() {
  unsigned N;
  std::cin >> N;
  std::vector<unsigned long long> p(N);
  for (unsigned i = 1; i <= N; ++i) {
    unsigned tmp;
    std::cin >> tmp;
    p[tmp - 1] = i;
  }
  std::vector<unsigned long long> a(N);
  std::vector<unsigned long long> b(N);
  for (unsigned long long i = 0ull; i < N; ++i) {
    unsigned long long cnt = 0ull;
    for (unsigned long long j = i + 1; j < N; ++j) {
      if (p[i] > p[j]) {
        ++cnt;
      }
    }
    a[i] = i * 21000ull  + p[i] - cnt + 1ull;
    b[i] = cnt + (N - i) * 21000ull;
  }
  for (unsigned i = 0; i < N - 1; ++i) {
    std::cout << a[i] << " ";
  }
  std::cout << a[N - 1] << std::endl;
  for (unsigned i = 0; i < N - 1; ++i) {
    std::cout << b[i] << " ";
  }
  std::cout << b[N - 1];
  return 0;
}

Measured memory_bytes: 1152
#include <stdio.h>

int main(void)
{
	int h[2];
	int m[2];
	int s[2];
	int i;
	int time;
	int time_h;
	int time_m;
	int time_s;
	
	for (i = 0; i < 3; i++){
		scanf("%d %d %d %d %d %d", &h[0], &m[0], &s[0], &h[1], &m[1], &s[1]);
		
		s[0] += (h[0] * 3600) + (m[0] * 60);
		s[1] += (h[1] * 3600) + (m[1] * 60);
		time = s[1] - s[0];
		time_h = time / 3600;
		time_m = (time % 3600) / 60;
		time_s = time - (time_h * 3600 + time_m * 60);
		
		printf("%d %d %d\n", time_h, time_m, time_s);
	}
	
	return (0);
}

Measured memory_bytes: 1808
#include <iostream>
using namespace std;
int main(){
  char s[6];
  cin >> s;
  int k=0;
  for(int i=0;i<6;i++)
  {
      if (isupper(s[i]))
            k=1;
  }
	if (k!=1 && s[2] == s[3] && s[4] ==s[5])
  		cout << "Yes";
    else 
      cout << "No";
  
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007 
#define ll long long 
#define N 100005
#define all(v) v.begin(),v.end()
#define pii pair<int,int>
#define piii pair<int, pii>
#define print(x) cout << #x << "=" << x << "\t";
#define endl "\n"
#define newline cout << endl;

int n;
int a[25][25];
int cnt[1 << 21];
vector<int> v[1 << 21];
int dp[1 << 21];

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); 
    cin >> n;
    for(int i=0;i<n;i++)
        for(int j=0;j<n;j++)
            cin >> a[i][j];
    
    int lim = (1 << n);
    for(int i=1;i<lim;i++) {
        cnt[i] = __builtin_popcount(i);
        for(int j=0;j<n;j++)
            if (i & (1 << j))
                v[i].push_back(j);
    }

    for(int j=0;j<n;j++)
        dp[(lim - 1) ^ (1 << j)] = a[0][j];

    for(int i=1;i<n;i++)
        for(int j=1;j<lim;j++)
            if (cnt[j] == n - i)
                for(auto u : v[j])
                    dp[j - (1 << u)] = (dp[j - (1 << u)] + a[i][u] * dp[j]) % mod;

    cout << dp[0];
    return 0;
}


Measured memory_bytes: 217472
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
use std::io::{Write, BufWriter};
// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, [ $t:tt ]) => {{
        let len = read_value!($next, usize);
        (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    }};

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn solve() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }
    input!(n: i32, l: i32);
    let mut mi = (1 << 28, 0);
    let mut tot = 0;
    for i in 0..n {
        tot += l + i;
        mi = min(mi, ((l + i).abs(), l + i));
    }
    puts!("{}\n", tot - mi.1);
}

fn main() {
    // In order to avoid potential stack overflow, spawn a new thread.
    let stack_size = 104_857_600; // 100 MB
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e5 + 10;

int main() {
	ios::sync_with_stdio(false);
	ll n, num;
	string s;
	while(cin >> n) {
		int aed = 0, bst = 0, nab = 0, countab = 0, flag = 0;
		for(int i = 0; i < n; i++) {
			cin >> s;
			if(s[0] == 'B') {
				bst++;
			}
			if(s[s.length() - 1] == 'A') {
				aed++;
			}
			if((s[0] == 'B' && s[s.length() - 1] != 'A') || (s[s.length() - 1] == 'A' && s[0] != 'B')) {
				flag = 1;
			}
			for(int i = 0; i < s.length() - 1; i++) {
				if(s[i] == 'A' && s[i + 1] == 'B') {
					nab++;
				}
			}
		}
		if(!flag && bst != 0 && aed != 0) {
			cout << nab + min(aed, bst) - 1 << endl;
		} else {
			cout << nab + min(aed, bst) << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
rooms = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
n = int(input())
for i in range(n):
    b, f, r, v = map(int, input().split())
    rooms[b-1][f-1][r-1] += v

for i in range(4):
    for j in range(3):
        print(' ', end='')
        print(' '.join(map(str, rooms[i][j])))
    if i < 3:
        print('#' * 20)



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

public class Main{
	public static void main(String[] args) throws Exception{
		PrintWriter pw=new PrintWriter(System.out);
		MScanner sc = new MScanner(System.in);
		TreeSet<Long>v=new TreeSet<>();
		long n=sc.nextLong(),k=sc.nextLong();
		n=n%k;
		while(!v.contains(n)) {
			v.add(n);
			n=(Math.abs(n-k));
			
		}
		pw.println(v.pollFirst());
		
		pw.flush();
	}
	static class MScanner {
		StringTokenizer st;
		BufferedReader br;
		public MScanner(InputStream system) {
			br = new BufferedReader(new InputStreamReader(system));
		}
 
		public MScanner(String file) throws Exception {
			br = new BufferedReader(new FileReader(file));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
		public int[] intArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public long[] longArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public int[] intSortedArr(int n) throws IOException {
	        int[]in=new int[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		public long[] longSortedArr(int n) throws IOException {
	        long[]in=new long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        shuffle(in);
	        Arrays.sort(in);
	        return in;
		}
		static void shuffle(int[]in) {
			for(int i=0;i<in.length;i++) {
				int idx=(int)(Math.random()*in.length);
				int tmp=in[i];
				in[i]=in[idx];
				in[idx]=tmp;
			}
		}
		static void shuffle(long[]in) {
			for(int i=0;i<in.length;i++) {
				int idx=(int)(Math.random()*in.length);
				long tmp=in[i];
				in[i]=in[idx];
				in[idx]=tmp;
			}
		}
		public Integer[] IntegerArr(int n) throws IOException {
	        Integer[]in=new Integer[n];for(int i=0;i<n;i++)in[i]=nextInt();
	        return in;
		}
		public Long[] LongArr(int n) throws IOException {
	        Long[]in=new Long[n];for(int i=0;i<n;i++)in[i]=nextLong();
	        return in;
		}
		public String nextLine() throws IOException {
			return br.readLine();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public double nextDouble() throws IOException {
			return Double.parseDouble(next());
		}
 
		public char nextChar() throws IOException {
			return next().charAt(0);
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
 
		public boolean ready() throws IOException {
			return br.ready();
		}
 
		public void waitForInput() throws InterruptedException {
			Thread.sleep(3000);
		}
	}
	static void addX(int[]in,int x) {
		for(int i=0;i<in.length;i++)in[i]+=x;
	}
	static void addX(long[]in,int x) {
		for(int i=0;i<in.length;i++)in[i]+=x;
	}
}

Measured memory_bytes: 22996
from operator import itemgetter
n=int(input())
s=[input() for i in range(n)]
m=int(input())
t=[input() for i in range(m)]
d=dict()
for i in range(n):
  if s[i] not in d:
    d[s[i]]=1
  else:
    d[s[i]]+=1
for i in range(m):
  if t[i] in d:
    d[t[i]]-=1
d=sorted(list(d.items()),reverse=True,key=itemgetter(1))
if d[0][1]>0:
  print(d[0][1])
else:
  print(0)

Measured memory_bytes: 3064
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#include<bitset>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
ll dp[2001][2001]={};
int main(){
	int N;
	ll A[2001];
	vpll As;
	scan(N);
	rep(i,N){
		scan(A[i]);
		As.push_back({A[i],i});
	}
	sort(rALL(As));
	ll ans=0;
	rep(i,N){
		rep(j,i+1){
			dp[i+1][j+1]=max(dp[i+1][j+1],dp[i][j]+abs(j-As[i].second)*As[i].first);
			dp[i+1][j]=max(dp[i+1][j],dp[i][j]+abs(N-(i-j)-1-As[i].second)*As[i].first);
		}
	}
	/*rep(i,N+1){
		rep(j,N+1){
			printf("dp[%d][%d]:%lld\n",i,j,dp[i][j]);
		}
	}*/
	rep(j,N+1) ans=max(ans,dp[N][j]);
	prin(ans);
	return 0;
}


Measured memory_bytes: 26296
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
const int N = 100000 + 100;
const int MOD = 1000000007;
const int oo = 1e9;

int n , a , b;
vector<int> g[N];

int solve(int u , int p){
	int total = 0;
	for (int i = 0; i < g[u].size(); ++i){
		int v = g[u][i];
		if(v==p)continue;
		total += solve(v,u);
	}
	if(total>1){
		puts("First");
		exit(0);
	}
	return !total;
}
int main() {
	scanf("%d",&n);
	for (int i = 0; i < n-1; ++i){
		scanf("%d%d",&a,&b);
		g[a].pb(b);
		g[b].pb(a);
	}
	if(solve(1,-1)){
		puts("First");
	}else{
		puts("Second");
	}
	return 0;
}

Measured memory_bytes: 5888
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
 
using namespace std;
 
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
 
long gcd(long a, long b){
	if (a%b==0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}
}
 
long lcm(long a, long b){
	return (a*b) / gcd(a,b);
}
 
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a > b) { a = b; return 1; } return 0; }
 
typedef long long ll;

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-10;

int main(){
	int n, m;
	
	cin >> n >> m;
	
	if (n-m < 2 && n-m > -2){
		
		ll a1 = 1, a2 = 1;
		
		REP(i,n){
			a1 *= i+1;
			a1 %= MOD;
		}
		
		REP(i,m){
			a2 *= i+1;
			a2 %= MOD;
		}
		
		if (n == m) cout << (a1 * a2 * 2)%MOD << endl;
		else cout << (a1 * a2)%MOD << endl;
	}
	else  cout << 0 << endl;
	
	return 0;
}

Measured memory_bytes: 256
from collections import deque

def main():
    while True:
        try:
            S = input()
            M = int(input())
            H = tuple(int(input()) for _ in range(M))
        except EOFError:
            break

        s = deque(S)
        for h in H:
            s.rotate(-h)

        print(*s, sep='')

main()

Measured memory_bytes: 8064
S = str(input())
S = S[::-1]

def solve(S):
    sl = 0
    while True:
        if len(S) == sl:
            return True
        if S[sl:sl+7] in {"remaerd"}:
            sl += 7
        elif S[sl:sl+6] in {"resare"}:
            sl += 6
        elif S[sl:sl+5] in {"maerd","esare"}:
            sl += 5
        else:
            return False
if solve(S):
    print("YES")
else:
    print("NO")

Measured memory_bytes: 3188
/*
ID: varunra2
LANG: C++
TASK: codechef
*/
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits.h>
#include <limits>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <utility>
#include <vector>

using namespace std;

#define EPS 1e-9
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert(B <= A && A <= C)
#define INF (int)1e9
#define MEM(a, b) memset(a, (b), sizeof(a))
#define MOD 1000000007
#define MP make_pair
#define PB push_back
#define PI 3.1415926535897932384626433832795
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()

typedef pair<int, int> PII;
typedef vector<int> VI;

const double pi = acos(-1.0);
typedef long int int32;
typedef long long int int64;
typedef map<int, int> MPII;
typedef multiset<int> MSETI;
typedef set<int> SETI;
typedef set<string> SETS;
typedef unsigned long int uint32;
typedef unsigned long long int uint64;
typedef vector<PII> VII;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef long long ll;

#define watch(x) cerr << (#x) << " is " << (x) << endl
#define printvii(v)                                    \
  cerr << (#v) << "=";                                 \
  for_each(v.begin(), v.end(), [](PII i) -> void {     \
    cerr << "(" << i.first << "," << i.second << "),"; \
  });                                                  \
  cerr << endl;
#define printvi(v)                                                       \
  cerr << (#v) << "=";                                                   \
  for_each(v.begin(), v.end(), [](int i) -> void { cerr << i << ","; }); \
  cerr << endl;
int lrs(string str) {
  int n = str.length();
  int LCSRe[n + 1][n + 1];

  // Setting all to 0
  memset(LCSRe, 0, sizeof(LCSRe));

  string res;          // To store result
  int res_length = 0;  // To store length of result

  // building table in bottom-up manner
  int i, index = 0;
  for (i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      // (j-i) > LCSRe[i-1][j-1] to remove
      // overlapping
      if (str[i - 1] == str[j - 1] && LCSRe[i - 1][j - 1] < (j - i)) {
        LCSRe[i][j] = LCSRe[i - 1][j - 1] + 1;

        // updating maximum length of the
        // substring and updating the finishing
        // index of the suffix
        if (LCSRe[i][j] > res_length) {
          res_length = LCSRe[i][j];
          index = max(i, index);
        }
      } else
        LCSRe[i][j] = 0;
    }
  }

  // If we have non-empty result, then insert all
  // characters from first character to last
  // character of string
  if (res_length > 0)
    for (i = index - res_length + 1; i <= index; i++) res.push_back(str[i - 1]);

  return res.size();
}
int main(int argc, char const *argv[]) {

  int n;
  cin >> n;

  string s;
  cin >> s;

  cout << lrs(s);  

  return 0;
}


Measured memory_bytes: 97920
type ABC(stream:System.IO.TextReader) =
  member this.Scan1 f = stream.ReadLine() |> f
  member this.Scan2 f = stream.ReadLine().Split() |> Array.map f |> (fun a -> (a.[0], a.[1]))
  member this.Scan3 f = stream.ReadLine().Split() |> Array.map f |> (fun a -> (a.[0], a.[1], a.[2]))
  member this.Scan4 f = stream.ReadLine().Split() |> Array.map f |> (fun a -> (a.[0], a.[1], a.[2], a.[3]))
  member this.ScanVecH f = stream.ReadLine().Split() |> Array.map f
  member this.ScanVecV n f = [| for i in 1..n -> stream.ReadLine() |> f |]
  member this.ScanMatrix n f  = [ for i in 1..n do yield stream.ReadLine().Split() |> Array.map f ]
  member this.ScanCharMatrix n = [ for i in 1..n -> stream.ReadLine().ToCharArray() ]
  member this.Close () = stream.Close()

let util = ABC(stdin)

let N,K = util.Scan2 int
let S = util.Scan1 id

let lower c = (int c) - ((int 'A') - (int 'a')) |> char


String.mapi (fun i -> fun c -> if i + 1 = K then lower c else c) S
|> printfn "%s"






Measured memory_bytes: 11996
//8-A
import java.util.Scanner;

class Main {
    public static void main(String [] args){
    	
    	Scanner sc = new Scanner(System.in);

        String n = sc.nextLine();
        
        int num = n.length();
        
        for( int i = 0 ; i < num ; i++ ){
        	
        	if(Character.isLowerCase(n.charAt(i))){
        		
                System.out.print(Character.toUpperCase(n.charAt(i)));
                
            }else if(Character.isUpperCase(n.charAt(i))){
            	
                System.out.print(Character.toLowerCase(n.charAt(i)));
                
            }/*else if( n.charAt(i) == ' '){
            	
            	System.out.print(' ');
            	
            }*/else{
            	
                System.out.print(n.charAt(i));
                
            }
        	
        }
        
        System.out.println();
    }
}

Measured memory_bytes: 27112
#include <iostream>
#include<math.h>
#include <vector>
#include <numeric>
#include <algorithm>

using namespace std;

int main() {

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

    sort(A.begin(), A.end(), greater<>());

    int num = 0;
    for (int i = 1; i < 3; ++i) {
        num += abs(A[i - 1] - A[i]);
    }

    cout << num << endl;

    return 0;
}

Measured memory_bytes: 256
s = input()
if s[0] == s[1] == s[2] == 'R':
    print(3)
elif s[0] == s[1] == 'R' or s[1] == s[2] == 'R':
    print(2)
elif s[0] == 'R' or s[1] == 'R' or s[2] == 'R':
    print(1)
else:
    print(0)


Measured memory_bytes: 9052
n=int(input())
s=input()

v=0
rgb=[0,0,0]
for x in range(n):
  if s[x]=="R":
    rgb[0]+=1
  elif s[x]=="G":
    rgb[1]+=1
  else:
    rgb[2]+=1
  
base=rgb[0]*rgb[1]*rgb[2]
  
for a in range(n):
  for b in range(a+1,n):
    c=2*b-a
    if c>=n:
      break
    else:
      if s[a]!=s[b] and s[a]!=s[c] and s[b]!=s[c] and b*2==c+a:
        base-=1
          
print(base)

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"

using namespace std;
using ll = long long;

const ll MOD = 1000000007LL; // = 10^9 + 7
const double PI = 3.14159265358979;

void solve()
{
  int a, b, c, d, e, k;
  cin >> a >> b >> c >> d >> e >> k;
  cout << ((e - a > k) ? ":(" : "Yay!");
}

int main()
{
  fastio;
  solve();

  return 0;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
#define maxn 600
#define eps 1e-8
struct Edge{
	int from,next,to;
}edge[maxn*maxn/2+5];
int fi[maxn+5],se,si[maxn+5];
inline void add_edge(int u,int v){
	edge[++se].next=fi[u],edge[se].to=v,fi[u]=se,si[u]++,edge[se].from=u;
}
double p1[maxn+5],e1[maxn+5],e2[maxn+5];
int main(){
	int n,m,u,v;scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)scanf("%d%d",&u,&v),add_edge(u,v);
	p1[1]=1;
	for(int i=1;i<=n;i++){
		if(p1[i]<eps)continue;
		e1[i]/=p1[i];
		for(int j=fi[i];j;j=edge[j].next)p1[edge[j].to]+=p1[i]/si[i],e1[edge[j].to]+=p1[i]*(e1[i]+1)/si[i];
	}
	double ans=e1[n],ans1=0;
	for(int i=n-1;i;i--){
		for(int j=fi[i];j;j=edge[j].next){
			e2[i]+=(e2[edge[j].to]+1)/si[i];
		}
	}
	for(int i=1,u,v;i<=se;i++){
		if(si[u=edge[i].from]==1)continue;
		v=edge[i].to;
		ans1=max(ans1,p1[u]*(e2[u]-(e2[u]-(e2[v]+1)/si[u])*si[u]/(si[u]-1)));
	}
	printf("%.10lf",ans-ans1);
	return 0;
}

Measured memory_bytes: 2304
N, K = map(int, input().rstrip().split())
# print(N, K)
l = []
for _ in range(K):
    d = input().rstrip()
    As = [int(x) for x in input().rstrip().split()]
    l.extend(As)
    # print(d, As)
print(N - len(set(l)))


Measured memory_bytes: 9108
while True:
    a = [int(i) for i in input().split(" ")]
    num1 = a[0]
    num2 = a[1]
    if num1 == 0 and num2 == 0:
        break
    elif num1 <= num2:
        print(num1,num2)
    elif num1 > num2:
        print(num2,num1) 
    

Measured memory_bytes: 7584
#include <iostream>
#include <cstdint>

int64_t calc(int64_t N)
{
    if (N % 2 == 1) {
        return 0;
    } else {
        int64_t d = 10L;
        int64_t sum = 0L;
        while (N >= d) {
            sum += (N / d);
            d *= 5;
        }
        return sum;
    }
}

int main()
{
    int64_t N;
    std::cin >> N;
    std::cout << calc(N) << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
#include <queue>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
int main(){
    int n,a,b;
    cin>>n>>a>>b;
    int ans=a+b-n;
    if(ans<0) ans=0;
    cout<<min(a,b)<<" "<<ans<<endl;
    return 0;
}

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

using namespace std;

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// typedef
typedef long long llint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double pi = 3.14159265358979323846;

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
//

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

  int a, b, c;
  cin >> a >> b >> c;
  swap(a, b);
  swap(a, c);
  cout << a << " " << b << " " << c << endl;

  return 0;
}

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

using namespace std;
using ll = long long;

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

    vector<ll> H(N+1);
    for(ll i=0; i<N; ++i) cin >> H[i];
    H[N] = H[N-1] + 1;

    bool f = true;
    for(ll i=0; i<N; ++i){
        if(H[i] < H[i+1]) f = true;
        else if(H[i] == H[i+1]);
        else if(H[i] - H[i+1] == 1 && f) {f = false; --H[i];}
        else {f = false; break;}
    }

    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

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

  string s;
  cin >> s;
  int n = s.size();

  vector<int> vr(n, 0), vl(n, 0);
  int c = 1;
  rep(i, 1, n) {
    if (s[i] == 'R')
      c++;
    else {
      vr[i] = c;
      c = 0;
    }
  }

  c = 1;
  repr(i, 0, n - 1) {
    if (s[i] == 'L')
      c++;
    else {
      vl[i] = c;
      c = 0;
    }
  }

  vector<int> ans(n, 0);
  rep(i, 1, n) {
    if (s[i] == 'L' && s[i - 1] == 'R') {
      int r = vr[i], l = vl[i - 1];
      ans[i - 1] = (r + 1) / 2 + l / 2;
      ans[i] = r / 2 + (l + 1) / 2;
      i++;
    }
  }

  rep(i, 0, n) {
    if (i > 0)
      cout << " ";
    cout << ans[i];
  }
  cout << endl;
}


Measured memory_bytes: 4468
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << '\n';
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

//------------------------- Libraries -------------------------//

//--------------------------- Solve ---------------------------//

void solve() {
    int X; cin >> X;
    int ans = 0;
    if (400 <= X && X < 600) ans = 8;
    if (600 <= X && X < 800) ans = 7;
    if (800 <= X && X < 1000) ans = 6;
    if (1000 <= X && X < 1200) ans = 5;
    if (1200 <= X && X < 1400) ans = 4;
    if (1400 <= X && X < 1600) ans = 3;
    if (1600 <= X && X < 1800) ans = 2;
    if (1800 <= X && X < 2000) ans = 1;

    cout << ans << '\n';
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3648
a,b,k = list(map(int, input().split()))

c=b-a+1

a1=[]
b1=[]

for i in range(k):
    a1.append(a+i)
    b1.append(b-i)

if c>2*k-1:
    for i in range(k):
        print(a1[i])
    for i in range(k):
        print(b1[k-i-1])

else:
    for i in range(a,b+1):
        print(i)


Measured memory_bytes: 3060
def rem(a):
    res = []
    for x in a:
        if x.count('#') > 0:
            res.append(x)
    return res

h,w=map(int,input().split())
a = [list(input()) for _ in range(h)]

while a != rem(a):
    a = rem(a)


a = list(zip(*rem(list(zip(*a)))))

for x in a:
    print("".join(x))

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する

int main(){
    int x,y,z;
    cin>>x>>y>>z;
    cout<<(x-z)/(y+z)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repr(i, n) for (int i = n-1; i >= 0; i--)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using pii = pair<int, int>;
const int mod = 1e9+7;
const int INF = 1e9;
const int MAX = 1e6;
// const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// struct edge {int to, cost;};
// vector<edge> graph[MAX];
// bool visited[MAX];
// int dist[MAX];

int main() {
    // input
    int n, m;
    cin >> n >> m;
    scc_graph g(n);
    rep(i, m) {
        int u, v;
        cin >> u >> v;
        g.add_edge(u, v);
    }
    auto scc = g.scc();
    // output
    cout << (int)scc.size() << endl;
    for (auto v : scc) {
        cout << (int)v.size();
        for (int x : v) {
            cout << " " << x;
        }
        printf("\n");
    }
}

Measured memory_bytes: 40076
import sys
from sys import setrecursionlimit

setrecursionlimit(10 ** 5)
# sys.stdin = open('input.txt', 'r')
# sys.stdout = open('output.txt', 'w')

readline = sys.stdin.readline

def proc():
    a = list(map(int, readline().rstrip().split()))
    for i,j in enumerate(a):
        if not j:
            print (i+1)
            return



#for _ in range(int(readline())):
proc()

Measured memory_bytes: 9108
#include <cstdio>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
  double w[3];
  while(cin >> w[0] >> w[1] >> w[2] && w[0]){
    sort(w,w+3);
    double R = sqrt((w[0]*w[0]+w[1]*w[1])/4);
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
      double r;
      cin >> r;
      cout << (R<r?"OK":"NA") << endl;
    }
  }
}

Measured memory_bytes: 1240
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int hour = a+b;
    if(hour < 24){
      System.out.println(hour);
    }
    else{
      System.out.println(hour%24);
    }
  }
}


Measured memory_bytes: 21844
n = gets.to_i
p = gets.split.map(&:to_i)

need_swap = Array.new(n, 0)
n.times do |i|
  need_swap[i] = 1 if p[i] != i + 1
end

count = need_swap.count { |n| n == 1 }

if count == 0 || count == 2
  puts 'YES'
else
  puts 'NO'
end

Measured memory_bytes: 1916
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    int ans =a-b;
    ans = c- ans ;
    if(ans <0){
        cout << 0 << endl;
        return 0;
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep2(i,n) for(int i = 1; i <= (n); ++i)
#define rrep2(i,n) for(int i = (n); i > 0; --i)
#define srep(i,s,n) for(int i = s; i < (n); ++i)
#define rsrep(i,s,n) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<(x)<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { int n = (__VA_ARGS__).size(); rep(i, n) printf("%d%s", (__VA_ARGS__)[i], i != n-1 ? " " : "\n"); }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;



int main() {
    int n;
    cin >> n;
    vll a(n);
    rep(i, n) cin >> a[i];

    ll sum = accumulate(all(a), 0ll);
    vll r(n);
    r[0] = sum;
    rep(i, n) {
        if (i&1) r[0] -= a[i]*2;
    }
    srep(i, 1, n) {
        r[i] = a[i-1]*2-r[i-1];
    }

    rep(i, n) printf("%d%s", r[i], i != n-1 ? " " : "\n");
    return 0;
}

Measured memory_bytes: 2816
#include <iostream>
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

ll fmemo[200002];
ll imemo[200002];
ll ifmemo[200002];
ll s[200002];
ll t[200002];
int m;

ll modpow(ll x, ll n){
    ll res = 1;
    ll mul = x;
    while(n){
        if(n % 2) res = res * mul % MOD;
        mul = mul * mul % MOD;
        n /= 2;
    }
    return res;
}

ll fact(ll n){
    if(n == 0) return 1;
    if(fmemo[n]) return fmemo[n];
    return fmemo[n] = n * fact(n - 1) % MOD;
}

ll ifact(ll n){
    if(n == 0) return 1;
    if(ifmemo[n]) return ifmemo[n];
    return ifmemo[n] = imemo[n] * ifact(n - 1) % MOD;
}

ll com(ll n, ll k){
    if(k > n) return 0;
    if(k == n || k == 0) return 1;
    return (fact(n) * ifact(k) % MOD) * ifact(n - k) % MOD;
}

ll sum(int i){
    if(i == 0) return 0;
    if(s[i] > 0) return s[i];
    return s[i] = sum(i - 1) + i;
}

ll tate(int i){
    if(i == 1) return 0;
    if(t[i] > 0) return t[i];
    return t[i] = (tate(i - 1) + sum(i - 1)) % MOD;
}

ll count(int k){
    if(k == 0) return 0;
    ll line = sum(k - 1);
    int up = 1, down = m - 1;
    ll plsum = sum(m - 1);
    ll nowsum = plsum;
    for(int i = 1; i < m; i++){
        nowsum = nowsum + up - down;
        plsum += nowsum;
        up++;
        down--;
    }
    return (count(k - 1) + tate(m) + line * m * m + plsum * (k - 1)) % MOD;
}

int main()
{
    ll n, k;
    cin >> n >> m >> k;
    for(ll i = 1; i <= 200001; i++){
        imemo[i] = modpow(i, MOD - 2);
    }
    for(int i = 0; i <= 200001; i++){
        s[i] = 0, t[i] = 0;
    }
    cout << (com(n * m - 2, k - 2) * count(n)) % MOD << endl;
}


Measured memory_bytes: 17408
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;

int main()
{
    int a,b,c,t;
    scanf("%d%d%d",&a,&b,&c);
    if (a<b)
    {
        t=b;
        b=a;
        a=t;
    }
    if (a<c)
    {
        t=c;
        c=a;
        a=t;
    }
    if (b<c)
    {
        t=b;
        b=c;
        c=t;
    }
    int sum=0;
    sum+=a-b;
    c+=a-b;
    if ((a-c)%2==0) sum+=(a-c)/2;
    else sum+=(a-c)/2+2;
    printf("%d\n",sum);
    return 0;
}


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


#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define iout(x) printf("%d\n",x)
#define lout(x) printf("%lld\n",x)
#define REP(x,l,u) for(ll x = (l);x<=(u);x++)
#define RREP(x,l,u) for(ll x = (l);x>=(u);x--)
#define mst(x,a) memset(x,a,sizeof(x))
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define se second
#define fi first
#define dbg(x) cout<<#x<<" = "<<(x)<<endl;
#define sz(x) ((int)x.size())
#define cl(x) x.clear()

typedef  long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace std;

const int maxn = 300010;
const int mod = 1e9+7;
const double eps = 1e-6;
const double PI = acos(-1);

template<typename T> inline void read(T &x){
x=0;T f=1;char ch;do{ch=getchar();if(ch=='-')f=-1;}while(ch<'0'||ch>'9');do x=x*10+ch-'0',ch=getchar();while(ch<='9'&&ch>='0');x*=f;
}

template<typename A,typename B> inline void read(A&x,B&y){read(x);read(y);}
template<typename A,typename B,typename C> inline void read(A&x,B&y,C&z){read(x);read(y);read(z);}
template<typename A,typename B,typename C,typename D> inline void read(A&x,B&y,C&z,D&w){read(x);read(y);read(z);read(w);}
template<typename A,typename B> inline A fexp(A x,B p){A ans=1;for(;p;p>>=1,x=1LL*x*x%mod)if(p&1)ans=1LL*ans*x%mod;return ans;}
template<typename A,typename B> inline A fexp(A x,B p,A mo){A ans=1;for(;p;p>>=1,x=1LL*x*x%mo)if(p&1)ans=1LL*ans*x%mo;return ans;}

int n,m;

vector<int> has[maxn];

int sm[maxn*25],ls[maxn*25],rs[maxn*25],sz;

int rt[maxn];

int query(int x,int y,int l,int r,int pos){
	if(!pos)return 0;
	if(pos>=r)return sm[y]-sm[x];
	int M=l+r>>1;
	int ans=0;
	ans+=query(ls[x],ls[y],l,M,pos);
	if(pos>M)ans+=query(rs[x],rs[y],M+1,r,pos);
	return ans;
}

void update(int x,int &y,int l,int r,int pos){
	sm[y=++sz]=sm[x]+1;ls[y]=ls[x];rs[y]=rs[x];
	if(l==r)return;
	int M=l+r>>1;
	if(pos<=M)update(ls[x],ls[y],l,M,pos);else update(rs[x],rs[y],M+1,r,pos);
}

void Work(){
	REP(i,1,m){
		int ans=0;
		for(int j=i;j-i<=m;j+=i)
			ans+=query(rt[j-i],rt[min(m+1,j)-1],1,m,j-1);
		iout(n-ans);
	}
}

void Init(){
	read(n,m);
	REP(i,1,n){
		int x,y;
		read(x,y);
		has[x].PB(y);
	}
	REP(i,1,m){
		rt[i]=rt[i-1];
		for(auto x:has[i])update(rt[i],rt[i],1,m,x);
	}
}

int main(){
	Init();
	Work();
	return 0;
}


Measured memory_bytes: 80512
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, K;
    cin >> N >> K;
    string S;
    cin >> S;
    vector<int> Nums;
    int flag = 1;
    int cnt = 0;
    for (int i = 0; i < N; i++)
    {
        if (S[i] == (char)('0' + flag))
        {
            cnt++;
        }
        else
        {
            Nums.push_back(cnt);
            cnt = 1;
            flag = 1 - flag;
        }
    }
    if (cnt != 0)
    {
        Nums.push_back(cnt);
    }
    // 配列のサイズが偶数じゃなかった場合、端っこの処理がめんどくさい
    // 端っこに一個足すと良い
    if (Nums.size() % 2 == 0)
    {
        Nums.push_back(0);
    }
    // cout << "complete" << endl;
    // Kの値に応じてどこまで見れるか
    // K=0だったら1、K=1だったら3、etc
    // for (int i = 0; i < Nums.size(); i++)
    // {
    //     cout << i << "th:" << Nums[i] << endl;
    // }
    int RANGE = 2 * K + 1;
    int tmp = 0;
    int left = 0;
    int right = 0;
    int ans = 0;
    for (int i = 0; i < Nums.size(); i += 2)
    {
        int Nextleft = i;
        int Nextright = min(i + RANGE, (int)Nums.size());

        while (Nextleft > left)
        {
            tmp -= Nums[left];
            left++;
        }
        while (Nextright > right)
        {
            tmp += Nums[right];
            right++;
        }
        ans = max(ans, tmp);
    }

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

Measured memory_bytes: 1020
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

bool used[1000];

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	cin>>m>>n;
	for(i=0;i<n;i++){
		cin>>a;
		used[a]=true;
	}
	int s=0;
	for(i=0;i<1e3;i++){
		if(used[i])continue;
		if(abs(s-m)>abs(i-m))s=i;
	}
	cout<<s<<endl;
}

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

int main() {
  
  int N;
  int sum = 0;
  cin >> N;

  for(int i = 0; i<N; i++){
    
      int l,r;
      cin >> l >> r;
      
      sum += r-l+1;    

  }

  cout << sum << endl;

}



Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(x,y) (x=min(x,y))
#define chmax(x,y) (x=max(x,y))
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

int main(){
	int a, b, c, d;
  cin>>a>>b>>c>>d;
  cout<<max(a*b, c*d)<<endl;
	return 0;
}


Measured memory_bytes: 256
import { log } from 'util'

{
  const main = (
    input: string
  ): void | string | number | string[] | number[] => {
    const r = _reader(input)
    const [N] = r.nn()
    const s: string[] = []
    const t: number[] = []

    for (let i = 0; i < N; i++) {
      const l = r.ss()

      s.push(l[0])
      t.push(Number(l[1]))
    }
    const x = r.s()

    let found = false
    let sum = 0

    for (let i = 0; i < N; i++) {
      if (found) {
        sum += t[i]
      }
      found = found || x === s[i]
    }

    return sum
  }

  const _reader = (str: string, i = 0) => {
    const lines = str.trim().split('\n')
    const s = () => lines[i++] || ''
    const n = () => Number(s())

    const mn = (v: string[]) => v.map(Number)
    const sp = (v: string) => v.split(' ')
    const ss = () => sp(s())
    const nn = () => mn(ss())
    const nls = () => mn(lines.slice(i))
    const nnls = () => lines.slice(i).map(v => mn(sp(v)))

    return { lines, s, n, ss, nn, nls, nnls }
  }

  const _getInput = () => require('fs').readFileSync('/dev/stdin', 'utf8')
  const _res = main(_getInput())

  if (typeof _res === 'number' || typeof _res === 'string') console.log(_res)
  if (typeof _res === 'object') console.log(_res.join(' '))
}


Measured memory_bytes: 7372