akhauriyash/Code-Regression huggingface dataset:
// ARC081-D
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debugB(x, y) cerr<<#x<<": "<<bitset<y>(x) << endl;
#define line() cerr << "---------------" << endl;

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

template<typename T>
   void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

int N;
char S[2][60];
const ll INF = 1e9+7;

int main() {
   cin >> N;
   rep (i, 2) {
      string s;
      cin >> s;
      rep (j, N) {
         S[i][j] = s[j];
      }
   }
   string s;
   rep (i, N) {
      if (S[0][i] == S[1][i]) {
         s.push_back('x');
      } else {
         s.push_back('y');
         i++;
      }
   }

   ll ans = 0;
   if (s[0] == 'x') {
      ans += 3;
   } else {
      ans += 6;
   }
   repp (i, 1, s.size()) {
      if (s[i-1] == 'x') {
         ans = ans * 2 % INF;
      } else {
         if (s[i] == 'y') {
            ans = ans * 3 % INF;
         }
      }
   }
   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 764
import java.util.*;

class Main {
    public static int frog(int[] h, int n, int k) {
    	int[] dp = new int[n];

    	for(int i = 1; i < n; i++) {
    		dp[i] = dp[i-1] + Math.abs(h[i] - h[i-1]);
    		for(int j = 2; j <= k; j++) {
    			if(j > i) break;
    			dp[i] = Math.min(dp[i], dp[i-j] + Math.abs(h[i] - h[i-j]));
    		}
    	}

    	return dp[n-1];
    }

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

    	int n = sc.nextInt();
    	int k = sc.nextInt();
    	int[] h = new int[n];
    	for(int i = 0; i < n; i++) {
    		h[i] = sc.nextInt();
    	}

    	System.out.println(frog(h, n, k));
    }
}

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

using namespace std;

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

using ll = long long;
using ld = long double;
using Point = complex<ld>;
const ld eps = 1e-9, pi = acos(-1.0);

namespace std
{
bool operator<(const Point &lhs, const Point &rhs)
{
    if (lhs.real() < rhs.real() - eps)
        return true;
    if (lhs.real() > rhs.real() + eps)
        return false;
    return lhs.imag() < rhs.imag();
}
} // namespace std

Point input_point()
{
    ld x, y;
    cin >> x >> y;
    return Point(x, y);
}

bool eq(ld a, ld b)
{
    return (abs(a - b) < eps);
}

ld dot(Point a, Point b)
{
    return real(conj(a) * b);
}

ld cross(Point a, Point b)
{
    return imag(conj(a) * b);
}

class Line
{
public:
    Point a, b;
    Line() : a(Point(0, 0)), b(Point(0, 0)) {}
    Line(Point a, Point b) : a(a), b(b) {}
};

// CCW::counter clockwise
int ccw(Point a, Point b, Point c)
{
    b -= a;
    c -= a;
    if (cross(b, c) > eps)
        return 1; // a,b,c : counter-clockwise
    if (cross(b, c) < -eps)
        return -1; // a,b,c : clockwise
    if (dot(b, c) < 0)
        return 2; // c,a,b : on a line
    if (norm(b) < norm(c))
        return -2; // a,b,c : on a line
    return 0;      // a,c,b : on a line
}

bool isis_ll(Line l, Line m)
{
    return !eq(cross(l.b - l.a, m.b - m.a), 0);
}

Point is_ll(Line s, Line t)
{
    Point sv = s.b - s.a, tv = t.b - t.a;
    assert(cross(sv, tv) != 0);
    return s.a + sv * cross(tv, t.a - s.a) / cross(tv, sv);
}

typedef vector<Point> Polygon;

Polygon convex_cut(const Polygon &ps, Line l)
{
    int n = ps.size();
    Polygon Q;
    REP(i, n)
    {
        Point A = ps[i], B = ps[(i + 1) % n];
        Line m = Line(A, B);
        if (ccw(l.a, l.b, A) != -1)
            Q.push_back(A);
        if (ccw(l.a, l.b, A) * ccw(l.a, l.b, B) < 0 && isis_ll(l, m))
            Q.push_back(is_ll(l, m));
    }
    return Q;
}

// a, b の垂直二等分線. a -> b を90度反時計回り回転
Line bisector(Point a, Point b)
{
    Point mid = (a + b) * Point(0.5, 0);
    return Line(mid, mid + (b - a) * Point(0, pi / 2));
}

// polygon を ps でボロノイ分割する時の ps[index] に割り当てられる多角形
Polygon voronoi(const Polygon &polygon, const vector<Point> &ps, int index)
{
    Polygon p = polygon;
    int n = ps.size();
    for (int j = 0; j < n; j++)
    {
        if (index == j)
            continue;
        Line l = bisector(ps[index], ps[j]);
        p = convex_cut(p, l);
    }
    return p;
}

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

    int N, M;
    cin >> N;
    Polygon island;
    for (int i = 0; i < N; i++)
    {
        ld x, y;
        cin >> x >> y;
        island.push_back(Point(x, y));
    }
    cin >> M;
    vector<Point> cir;
    for (int i = 0; i < M; i++)
    {
        ld x, y;
        cin >> x >> y;
        cir.push_back(Point(x, y));
    }
    ld ret = 0;
    for (int i = 0; i < M; i++)
    {
        auto p = voronoi(island, cir, i);
        for (auto v : p)
        {
            ret = max(ret, abs(cir[i] - v));
        }
    }
    cout << fixed << setprecision(10) << ret << endl;
}



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

#define ll long long
#define ld long double
#define F first
#define S second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define ppb pop_back
#define vll vector<ll>
#define vi vector<int>
#define endl "\n"

const ll INF = 1000000007;


const int max_size = 200005;
int parent[max_size];
int Size[max_size];

int root(int x){
	while(x!=parent[x]){
		parent[x] = parent[parent[x]];
		x = parent[x];
	}
	return x;
}

void sunion(int x,int y){
	int rx = root(x);
	int ry = root(y);
	if(rx != ry){
		if(Size[rx] > Size[ry]){
			parent[ry] = parent[rx];
			Size[rx] += Size[ry];
		}
		else{
			parent[rx] = parent[ry];
			Size[ry] += Size[rx];
		}
	}
}


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tc=1;
	//cin >> tc;
	while(tc--){
		int n;
		cin >> n;
		int m;
		cin >> m;
		int u,v;
		for (int i=1;i<=n;i++) {
			parent[i] = i;
			Size[i] = 1;
		}
		for (int i=0;i<m;i++) {
			cin >> u >> v;
			sunion(u,v);
		}
		int maxSize = 0;
		for (int i=1;i<=n;i++) {
			int r = root(i);
			maxSize = max(maxSize,Size[r]);
		}
		cout << maxSize << endl;
	}
	return 0;
}


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

using namespace std;

int main() {
    map<string,int> mp;
    set<string> str;
    string s;
    int n;
    long long c=0,k;
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>s;
        sort(s.begin(),s.end());
        str.insert(s);
        mp[s]++;
    }
    for(auto x:mp){
        if(x.second>1){
            k = x.second;
            c+=k*(k-1)/2;
        }
    }
    cout<<c;
    return 0;
}

Measured memory_bytes: 20608
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(lint i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  lint N;
  cin>>N;
  lint sq=sqrt(double(N));
  cerr<<sq<<endl;
  lint ans=0;
  FOR(i,1,sq+1){
    if(N%i==0){
      lint m=i-1;
      if(m!=0){
        if(N%m==N/m)ans+=m;
      }
      if(i!=N/i){
        m=N/i-1;
        if(N%m==N/m)ans+=m;
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
array_1 = list(map(int, input().split()))
array_2 = list(map(int, input().split()))
array_3 = list(map(int, input().split()))
for a in range(101):
    for b in range(101):
        for c in range(101):
            if array_1[0]-a==array_2[0]-b and array_2[0]-b==array_3[0]-c and array_3[0]-c==array_1[0]-a and array_1[1]-a==array_2[1]-b and array_2[1]-b==array_3[1]-c and array_3[1]-c==array_1[1]-a and array_1[2]-a==array_2[2]-b and array_2[2]-b==array_3[2]-c and array_3[2]-c==array_1[2]-a:
                print('Yes')
                exit()
print('No')

Measured memory_bytes: 3064
n, k = gets.split.map(&:to_i)

if k.odd?
  puts (n / k) ** 3
else
  tmp1 = 0
  tmp2 = 0
  (1..n).each do |i|
    if i % k == 0
      tmp1 += 1
    elsif (2 * i) % k == 0
      tmp2 += 1
    end
  end
  puts (tmp1) ** 3 + ((tmp2) ** 3)
end


Measured memory_bytes: 1916
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ 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 ) * } } ; }
#[allow(unused_macros)]
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 ) * } } ; }
#[allow(unused_macros)]
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 : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;

fn func(x:i64) -> i64 {
    if x/10==0 {return x;}
    x%10 + func(x/10)
}

fn main() {
    input!{n:i64};

    println!("{}", if n%func(n) == 0 {"Yes"} else {"No"});

}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define all(c) (c).begin(),(c).end()
#define pb push_back
#define dbg(...) do{cerr<<__LINE__<<": ";dbgprint(#__VA_ARGS__, __VA_ARGS__);}while(0);

using namespace std;

namespace std{template<class S,class T>struct hash<pair<S,T>>{size_t operator()(const pair<S,T>&p)const{return ((size_t)1e9+7)*hash<S>()(p.first)+hash<T>()(p.second);}};template<class T>struct hash<vector<T>>{size_t operator()(const vector<T> &v)const{size_t h=0;for(auto i : v)h=h*((size_t)1e9+7)+hash<T>()(i)+1;return h;}};}
template<class T>ostream& operator<<(ostream &os, const vector<T> &v){os<<"[ ";rep(i,v.size())os<<v[i]<<(i==v.size()-1?" ]":", ");return os;}template<class T>ostream& operator<<(ostream &os,const set<T> &v){os<<"{ "; for(const auto &i:v)os<<i<<", ";return os<<"}";}
template<class T,class U>ostream& operator<<(ostream &os,const map<T,U> &v){os<<"{";for(const auto &i:v)os<<" "<<i.first<<": "<<i.second<<",";return os<<"}";}template<class T,class U>ostream& operator<<(ostream &os,const pair<T,U> &p){return os<<"("<<p.first<<", "<<p.second<<")";}
void dbgprint(const string &fmt){cerr<<endl;}template<class H,class... T>void dbgprint(const string &fmt,const H &h,const T&... r){cerr<<fmt.substr(0,fmt.find(","))<<"= "<<h<<" ";dbgprint(fmt.substr(fmt.find(",")+1),r...);}
typedef long long ll;typedef vector<int> vi;typedef pair<int,int> pi;const int inf = (int)1e9;const double INF = 1e12, EPS = 1e-9;

void rec(int n, vi &v){
	if(n == 0) return;
	ll lo = 0, hi = n, mid;
	while(lo + 1 < hi){
		mid = (lo + hi) / 2;
		if(mid * (mid + 1) / 2 >= n) hi = mid;
		else lo = mid;
	}
	v.pb(hi);
	rec(n - hi, v);
}

int main(){
	cin.tie(0); cin.sync_with_stdio(0);
	
	int n; cin >> n;
	vi ans;
	rec(n, ans);
	/*
	cout << ans.size() << endl;
	rep(i, ans.size()) cout << ans[i] << (i==ans.size()-1?"\n":" ");
	*/
	for(int i : ans) cout << i << endl;
	
	return 0;
}

Measured memory_bytes: 512
import math
temp=input().split()
n=int(temp[0])
l=int(temp[1])
t=int(temp[2])
lis = [[int(j) for j in input().split()] for i in range(n)]
cou=0
for i in range(n):
	if lis[i][1]==1:lis[i][0] += t
	else:lis[i][0] -= t
	cou += math.floor(lis[i][0] / l)

li = []
for i in range(n):li.append(lis[i][0] % l)
li.sort()
for i in range(n):
	print(li[(i + cou) % n] % l)

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

int L, dp[200001];
string s, t;



int solve(int i) {
  if (i == L) return 1;
  if (i > L) return 0;
  if (dp[i] != -1) return dp[i];
  if (solve(i + s.size())) return dp[i] = 1;
  if (solve(i + t.size())) return dp[i] = 1;
  else return dp[i] = 0;
}

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

  memset(dp, -1, sizeof dp);

  cin >> L >> s >> t;

  if (s > t) swap(s, t);

  string ans = "", tmp;

  for (int i = 0; i < 2; ++i) {
    tmp = "";
    if (i == 1) swap(s, t);

    while (tmp.size() < L) {
      if (solve(tmp.size() + s.size())) tmp += s;
      else tmp += t;
    }

    if (ans == "") ans = tmp;
    else ans = min(ans, tmp);
  }

  cout << ans << endl;

  return 0;
}

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

int main(){
    int n;
    cin >> n;
    int min = 9*6;
    for(int a = 1; a < n; a++){
        int b = n-a,sum = 0;
        string s1 = std::to_string(a);
        string s2 = std::to_string(b);
        for(int i = 0; i < s1.size(); i++) sum += s1[i] - '0';
        for(int i = 0; i < s2.size(); i++) sum += s2[i] - '0';
        if(min > sum) min = sum;
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
vector<int> G[200010];
int cnt[200010] = {};
void dfs(int s, int p){
	for(auto v:G[s]){
		if(v==p) continue;
		cnt[v] += cnt[s];
		dfs(v,s);
	}
}
		
int main(){
	int i,n,q;
	cin >> n >> q;
	for(i=0;i<n - 1;i++){
		int a,b; cin >> a >> b; a--; b--;
		G[a].push_back(b); G[b].push_back(a);
	}
	for(i=0;i<q;i++){
		int a,b; cin >> a >> b; a--; cnt[a] += b;
	}
	dfs(0,-1);
	for(i=0;i<n;i++){
		cout << cnt[i] << " ";
	}
	cout << endl;
}


Measured memory_bytes: 23424
import java.util.*;
import java.math.*;
 
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入
		int n = sc.nextInt();
		int m = sc.nextInt();
		int c = sc.nextInt();
		ArrayList<Integer> listB = new ArrayList<>();
		int count =0;
 
		for(int i=0;i<m;i++){
			listB.add(sc.nextInt());
		}
		for(int i=0;i<n;i++){
			int sum =0;
			for(int j=0;j<m;j++){
				int a = sc.nextInt();
				sum += a * listB.get(j);
			}
			if(sum + c >0){
				count++;
			}

		}


        System.out.println(count);
 
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <string>
#include <stdio.h>

using namespace std;
/*0が羊、1が狼*/
int n;
char s[100100];
int x[100100];

void p(){
  for(int i = 0; i < n; i++){
    if(x[i] == 0) cout << 'S';
    else cout << 'W';
  }
  cout << endl;
}

int main(){
  cin >> n;
  cin >> s;

  int result = 1;
  for(int j = 0; j < 4; j++){
    fill(x, x + n + 1, -1);
    x[0] = j % 2;
    x[1] = j / 2;
    for(int i = 1; i < n - 1; i++){
      if(x[i] == 0 && s[i] == 'o'){
        x[i+1] = x[i-1];
      }
      else if(x[i] == 0 && s[i] == 'x'){
        x[i+1] = 1 - x[i-1];
      }
      else if(x[i] == 1 && s[i] == 'o'){
        x[i+1] = 1 - x[i-1];
      }
      else if(x[i] == 1 && s[i] == 'x'){
        x[i+1] = x[i-1];
      }
    }
    if((x[n-1] == 0 && s[n-1] == 'o') || (x[n-1] == 1 && s[n-1] == 'x')){
      if(x[0] == x[n-2]){
        if((x[0] == 0 && s[0] == 'o') || (x[0] == 1 && s[0] == 'x')){
          if(x[1] == x[n-1]){
            p();
            result = 0;
            break;
          }
        }
        else if((x[0] == 0 && s[0] == 'x') || (x[0] == 1 && s[0] == 'o')){
          if(x[1] == 1 - x[n-1]){
            p();
            result = 0;
            break;
          }
        }
      }
    }
    else if((x[n-1] == 0 && s[n-1] == 'x') || (x[n-1] == 1 && s[n-1] == 'o')){
      if(x[0] == 1 - x[n-2]){
        if((x[0] == 0 && s[0] == 'o') || (x[0] == 1 && s[0] == 'x')){
          if(x[1] == x[n-1]){
            p();
            result = 0;
            break;
          }
        }
        else if((x[0] == 0 && s[0] == 'x') || (x[0] == 1 && s[0] == 'o')){
          if(x[1] == 1 - x[n-1]){
            p();
            result = 0;
            break;
          }
        }
      }
    }
  }
  if(result == 1){
    cout << -1 << endl;
  }

  return 0;
}


Measured memory_bytes: 768
#include <stdio.h>
#include <algorithm>

#define MAX_N 105
#define MAX_W 1000000005
#define MAX_V 1005

using namespace std;

long long N, W;

long long inp[MAX_N][2];
long long dp[MAX_N][MAX_V*MAX_N];

long long knap(int, int);		// max value

int main() {
	scanf(" %lld %lld", &N, &W);

	long long i, j;
	for(i = 0; i<N; i++) {
		scanf(" %lld %lld", &inp[i][0], &inp[i][1]);
	}

	int tmp_max = 0;
	for(i = MAX_V * MAX_N; i >= 0; --i) {
		long long erg = knap(0, i);

		if(erg <= W) {
			printf(" %lld", i);
			return 0;
		}
	}
}

long long knap(int index, int value) {

	if(value < 0) return numeric_limits<int>::max();
	if(value == 0) return 0;
	if(index == N) return numeric_limits<int>::max();

	if(dp[index][value] != 0) return dp[index][value];

	long long a = knap(index+1, value-inp[index][1]) + inp[index][0];
	long long b = knap(index+1, value);

	long long erg = min(a, b);

	dp[index][value] = erg;

	return erg;

}

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

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

    vector<bool> ac(N+1, false);
    vector<ll> wa(N+1, 0);

    ll pt = 0;
    rep(i, 0, M){
        ll p;
        string s;
        cin >> p >> s;
        if(ac[p]) continue;
        if(s == "AC"){
            ac[p] = true;
            pt++;
        }else{
            wa[p]++;
        }
    }
    ll ps = 0;
    rep(i, 1, N+1){
       if(ac[i]) ps += wa[i];
    }
    cout << pt << " " << ps << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int k = sc.nextInt();
        int s = sc.nextInt();
        int cnt = 0;
        for(int i = 0; i <= k; i++){
            for(int j = 0; j <= k; j++){
                if(0 <= s - i - j && k >= s - i - j) cnt++;
            }
        }
        System.out.println(cnt);
    }
}

Measured memory_bytes: 23760
n, C = map(int, input().split())
stc = [list(map(int, input().split())) for i in range(n)]
m = 0
for i in stc:
    m = max(m, i[1])
lis = [[0] * C for i in range(m + 1)]
for i in stc:
    for j in range(i[0], i[1] + 1):
        lis[j][i[2] - 1] = 1
ans = 0
for i in lis:
    ans = max(ans, sum(i))
print(ans)

Measured memory_bytes: 59468
#include<bits/stdc++.h>
using namespace std;
long long read()
{
	char ch=getchar();long long x=0,ff=1;
	while(ch<'0'||ch>'9') {if(ch=='-') ff=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*ff;
}
void write(long long aa)
{
	if(aa<0) putchar('-'),aa=-aa;
	if(aa>9) write(aa/10);
	putchar(aa%10+'0');
	return;
}
const long long inf=1000000005;
const long long mod=1e9+7;
long long n,X,Y,sum,ans;
long long jl[200005],mn[200005],val[200005];
long long fac[200005],ny[200005],col[200005];
long long ksm(long long aa,long long bb)
{
	long long ans=1;
	while(bb)
	{
		if(bb&1) ans=(ans*aa)%mod;
		bb>>=1;
		aa=(aa*aa)%mod;
	}
	return ans;
}
long long C(long long aa,long long bb)
{
	return fac[bb]*ny[aa]%mod*ny[bb-aa]%mod;
}
int main()
{
	n=read(),X=read(),Y=read();
	fac[0]=1;
	for(long long i=1;i<=n;++i)
	{
		col[i]=read(),val[i]=read();
		jl[col[i]]++;
		mn[i]=inf;
		fac[i]=(fac[i-1]*i)%mod;
	}
	ny[n]=ksm(fac[n],mod-2);
	for(long long i=n;i>=1;--i) ny[i-1]=(ny[i]*i)%mod;
	for(long long i=1;i<=n;++i) mn[col[i]]=min(mn[col[i]],val[i]);
	long long mx=0,mxx=0;
	for(long long i=1;i<=n;++i)
	if(mn[i]!=inf)
	{
		if(!mx||mn[i]<mn[mx]) mxx=mx,mx=i;
		else if(!mxx||mn[i]<mn[mxx]) mxx=i;
	}
	for(long long i=1;i<=n;++i)
	{
		if(mn[col[i]]!=val[i]&&mn[col[i]]+val[i]<=X) continue;
		if(col[i]==mx&&val[i]+mn[mxx]<=Y) continue;
		if(col[i]!=mx&&val[i]+mn[mx]<=Y) continue;
		jl[col[i]]--;
	}
	ans=1;
	sum=jl[mx];
	for(long long i=1;i<=n;++i)
	if(i!=mx&&mn[i]+mn[mx]<=Y) {sum+=jl[i];ans=(ans*C(jl[i],sum))%mod;}
	write(ans);
	return 0;
} 


Measured memory_bytes: 9600
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
   int n;
   long double max_distance;
   int count = 0;
   cin >> n >> max_distance;
   for( int i = 0; i < n; i++){
       long double x, y;
       cin >> x >> y;
       if ( (sqrt( x*x + y*y )) <= max_distance){
           count++;
       }
   }
   cout << count << endl;
   
   return 0;
}

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

using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  vector<int> l(n);
  for (int i = 0; i < n; i ++) {
    cin >> l[i];
  }
  sort(l.begin(), l.end());
  int count = 0;
  for (int i = 0; i < n - 2; i ++) {
    for (int j = n - 1; j > i + 1; j --) {
      for (int k = i + 1; k < j; k ++) {
        if (l[k] < l[j] + l[i] && l[k] > l[j] - l[i]) {
          count += 1;
        }
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
using System;

public class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine().Trim());
        var maxj = -1;  var maxp = 0;
        for (int i = 0; i < n; i++)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var a = int.Parse(line[0]);
            var b = int.Parse(line[1]);
            if (a>maxj) { maxj = a;  maxp = b; }
        }
        Console.WriteLine(maxj + maxp);
    }
}


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

int N;

int *inverse(int *a){
	int i;
	int *a_inv = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		a_inv[a[i]] = i;
	}
	return a_inv;
}

int *mul(int *a, int *b){
	int i;
	int *c = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		c[i] = a[b[i]];
	}
	return c;
}

int *power(int *a, int n){
	if(n == 0){
		int i;
		int *ans = (int *)malloc(sizeof(int) * N);
		for(i = 0; i < N; i++){
			ans[i] = i;
		}
		return ans;
	}
	else if(n % 2 == 0){
		return power(mul(a, a), n / 2);
	}
	else{
		return mul(a, power(a, n - 1));
	}
}

int main(){
	int K, i;
	scanf("%d%d", &N, &K);
	K--;
	int *p = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%d", &p[i]);
		p[i]--;
	}
	int *q = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%d", &q[i]);
		q[i]--;
	}
	int **ans_small = (int **)malloc(sizeof(int *) * 6);
	ans_small[0] = p;
	ans_small[1] = q;
	for(i = 2; i < 6; i++){
		ans_small[i] = mul(ans_small[i - 1], inverse(ans_small[i - 2]));
	}
/*	for(i = 0; i < 6; i++){
		printf("ans_small[%d]\n", i);
		int j;
		for(j = 0; j < N; j++){
			printf("%d ", ans_small[i][j]);
		}
		printf("\n");
	}
*/	int *qPQp = mul(mul(q, inverse(p)), mul(inverse(q), p));
	int *ans = mul(mul(power(qPQp, K / 6), ans_small[K % 6]), power(inverse(qPQp), K / 6));
	for(i = 0; i < N; i++){
		printf("%d ", ans[i] + 1);
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 42240
#include<bits/stdc++.h>
using namespace std;
#define int long long
 
#define check(a)         cout<<#a<<" : "<<a<<endl;
#define check2(a, b)     cout<<#a<<" : "<<a<<" | "<<#b<<" : "<<b<<endl;
#define check3(a, b, c)  cout<<#a<<" : "<<a<<" | "<<#b<<" : "<<b<<" | "<<#c<<" : "<<c<<endl;

void testCase(){
    int k; cin >> k;
    string add = "ACL";

    for(int i = 0; i < k; i++){
        cout << add;
    }
}
 
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif

    int t = 1;
    // int t; cin >> t;
    while(t--)
        testCase();
    
    return 0;
}

Measured memory_bytes: 3612
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for _ in range(n)]
def LIR(n):
    return [LI() for _ in range(n)]
def SR(n):
    return [S() for _ in range(n)]
def LSR(n):
    return [LS() for _ in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    s = input()
    if s[-1] != "s":
        s += "s"
    else:
        s += "es"
    print(s)
    return

#Solve
if __name__ == "__main__":
    solve()


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

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll H[105];

int main()
{
    int N;
    cin >> N;
    REP(i, N)
    {
        cin >> H[i];
    }

    ll sum = 0;
    int index = 0;
    while (index < N)
    {
        if (H[index] == 0)
        {
            index++;
            continue;
        }

        ll min = H[index];
        int i = index;
        for (; i < N; ++i)
        {
            if (H[i] > 0)
            {
                min = std::min(min, H[i]);
                continue;
            }
            break;
        }
        sum += min;
        FOR(j, i, index)
        {
            H[j] -= min;
        }
    }
cout << sum << endl;
return 0;
}

Measured memory_bytes: 256
/*

This Submission is to determine how many 120/240 min const. delivery point there are.

//info
120 req. steps <= 5
*/
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 0.00000001
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define MOD 1000000007
#define seg_size 262144
#define REP(a,b) for(long long a = 0;a < b;++a)

unsigned long xor128() {
	static unsigned long x = time(NULL), y = 362436069, z = 521288629, w = 88675123;
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}
int main() {
	int n;
	cin >> n;
	vector<double> hoge;
	REP(i, n) {
		double a;
		cin >> a;
		hoge.push_back(a);
	}
	double ans = 0;
	sort(hoge.begin(), hoge.end());
	double tmp = 1;
	for (int q = hoge.size() - 1; q >= 0; --q) {
		if(q != 0)
		tmp *= 0.5;
		ans += hoge[q] * tmp;
	}
	cout << fixed << setprecision(10);
	cout << ans << endl;
}

Measured memory_bytes: 888
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<stack>
#include<queue>
#include<string>
using namespace std;

int main(void){
        int i,j,c;
        string s,t;
        cin >> s;
        cin >> t;
        c=0;
        for(i=0;i<s.length();i++){
                if(s[i]!=t[i]){
                        c++;
                }
        }
        printf("%d\n",c);
        return 0;
}


Measured memory_bytes: 3896
#include <bits/stdc++.h>
#define ll long double
#define f first
#define s second
#define mod 1000000007
#define N 500043
#define mp(a,b) make_pair(a,b)
#define loop(a,b) for(int i=a;i<b;i++)
#define test int t; cin >> t; while(t--)
using namespace std;

long double dp[305][305][305];

ll solve (int one,int two,int three,int &n){
    if(one < 0 || two<0 || three<0)
        return 0;
    if(three==0&&two==0&&one==0){
        return 0;
    }
    if(dp[one][two][three] > 0)
        return dp[one][two][three];

    int remaining = one + two + three;
    ll exp_val = n+one*solve(one-1,two,three,n) + two*solve(one+1,two-1,three,n) +
                    three*solve(one,two+1,three-1,n);

    return dp[one][two][three] = exp_val/remaining;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int>vec(n);
    int coun1=0,coun2=0,coun3=0;
    for(int i=0;i<n;i++){
        cin >> vec[i];
        if(vec[i]==1) coun1++;
        else if(vec[i]==2) coun2++;
        else coun3++;
    }
    memset(dp,-1,sizeof dp);
    cout << fixed << setprecision(9) << solve(coun1,coun2,coun3,n);
}


Measured memory_bytes: 447176
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;

int N, a, b;

int main(void){

    cin >> N >> a >> b;
    printf("%d %d\n",min(a, b), (a+b) - N > 0 ? (a+b) - N : 0);

  return 0;
}

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

using namespace std;

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

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

//------------------------------- Dubug Functions ---------------------------//

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

//------------------------------- Solver ------------------------------------//

map<i64, i64> mp;

i64 f(i64 x)
{
    if (mp.count(x))
    {
        return mp[x];
    }
    if (x == 1)
    {
        return mp[x] = 1;
    }
    return mp[x] = 2 * f(x / 2) + 1;
}

void solve()
{
    i64 h, n;
    cin >> h >> n;
    akari<i64> dp(h + 1, 1e15);
    dp[0] = 0;
    akari<i64> as(n), bs(n);
    for (int i = 0; i < n; i++)
    {
        cin >> as[i] >> bs[i];
        for (int x = 0; x <= h; x++)
        {
            dp[min(h, x + as[i])] = min(dp[min(h, x + as[i])], dp[x] + bs[i]);
        }
    }
    cout << dp.back() << endl;
}

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


Measured memory_bytes: 384
N = int(input())
ans = ""
if N == 0:
    print(0)
else:
    while N != 1 and N != 0:
        if N % (-2):
            ans = "1" + ans
        else:
            ans = "0" + ans
        N = -(N//2)
    if N == 1:
        ans = "1" + ans
    print(ans)


Measured memory_bytes: 2940
s = input();

odd = ('R', 'U', 'D',)
even = ('L', 'U', 'D',)


cnt = 0
for i in range(len(s)):
    if ((i+1) % 2 == 0) and (s[i] in even):
        cnt += 1
    elif ((i+1) % 2 == 1) and (s[i] in odd):
        cnt += 1

if cnt == len(s):
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
#include <iomanip>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
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;}

bool comp(pair<int,int> l,pair<int,int> r){
	return l.second<r.second;
}

int main(){
	int n,k;
	cin >> n >> k;
	map<int,int> a;
	REP(i,n){
		int in;
		cin >> in;
		a[in]++;
	}
	
	if(k>=(int)a.size()){
		cout << 0 << endl;
		return 0;
	}
	
	vector<pair<int,int>> v;
	for(auto x:a){
		v.push_back(x);
	}
	
	sort(v.begin(),v.end(),comp);
	
	int ans=0;
	REP(i, (int)a.size()-k){
		ans += v[i].second;
	}
	
	cout << ans << endl;
	
	return 0;
}

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

using namespace std;
typedef long long ll;
#define rep(i,j,n) for (int i = j; i < (n); i++)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1e9;

int main(){

  int n;cin>>n;
  string s;cin>>s;

  map<char,ll>mp;
  rep(i,0,n){
    mp[s[i]]++;
  }

  ll ans=1;
  for(map<char,ll>::iterator itr=mp.begin();itr!=mp.end();itr++){
    ans*=(itr->second+1);
    ans%=mod;
  }

  out(ans-1);


  return 0;
}


Measured memory_bytes: 512
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        ABC121_2 solver = new ABC121_2();
        solver.solve(1, in, out);
        out.close();
    }

    static class ABC121_2 {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int N = in.nextInt();
            int M = in.nextInt();
            int C = in.nextInt();
            int accnt = 0;
            int[] B = new int[M];
            for (int i = 0; i < M; i++) {
                B[i] = in.nextInt();
            }
            for (int i = 0; i < N; i++) {
                int ttl = 0;
                for (int b : B) {
                    int A = in.nextInt() * b;
                    ttl += A;
                }
                if ((ttl + C) > 0) {
                    accnt++;
                }
            }
            out.println(accnt);

        }

    }
}



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

int n, m;

int main() {
	cin >> n >> m;

	int h[n + 1];
	memset(h, 0, sizeof(h));

	for(int i = 1; i <= n; i++) cin >> h[i];

	int a[m + 1], b[m + 1];
	bool f[n + 1], tt[n + 1];

	memset(a, 0, sizeof(a));
	memset(b, 0, sizeof(b));
	memset(f, true, sizeof(f));
	memset(tt, false, sizeof(tt));

	for(int i = 1; i <= m; i++) {
		cin >> a[i] >> b[i];

		if(h[a[i]] < h[b[i]]) f[a[i]] = false;
		else if(h[a[i]] > h[b[i]]) f[b[i]] = false;
		else if(h[a[i]] == h[b[i]]) f[a[i]] = f[b[i]] = false;
	}

	int t = 0;
	for(int i = 1; i <= n; i++) if(f[i]) t++;

	cout << t;

//	system("pause");
	return 0;
}

Measured memory_bytes: 5000
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int N,d[100000]={0};
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>d[i];
    }
    sort(d,d+N);
    cout<<"\n";
    cout<<d[N/2]-d[N/2-1]<<endl;
    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int main() {
    int N, M; cin >> N >> M;
    vector<vector<int>> G(N);
    for (int i = 0; i < M; i++) {
        int A, B; cin >> A >> B; A--, B--;
        G[A].push_back(B);
    }
    vector<int> ans;
    for (int root = 0; root < N; root++) {
        queue<pair<int, int>> Q;
        vector<int> previous(N, -1);
        Q.emplace(root, -1);
        bool done = false;
        while (!Q.empty()) {
            int node, prev;
            tie(node, prev) = Q.front();
            Q.pop();
            if (previous[node] != -1) {
                continue;
            }
            previous[node] = prev;
            if (node == root && prev != -1) {
                done = true;
                break;
            }
            for (auto next : G[node]) {
                Q.emplace(next, node);
            }
        }
        if (done) {
            vector<int> ans2;
            int node = root;
            do {
                ans2.push_back(node);
                node = previous[node];
            } while (node != root);
            if (ans.empty() || ans.size() > ans2.size()) {
                ans = ans2;
            }
        }
    }
    if (ans.empty()) {
        cout << -1 << '\n';
    } else {
        cout << ans.size() << '\n';
        for (auto a : ans) cout << a + 1 << '\n';
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  vector<int> S(n);
  for (int i = 0; i < n; i++){
    cin >> S[i];
  }
  sort(S.begin(), S.end());
  int q;
  cin >> q;
  vector<int> T(q);
  for (int i = 0; i < q; i++){
    cin >> T[i];
  }
  int C = 0;
  for (int i = 0; i < q; i++){
    bool res = false;
    if (S[0] == T[i]){
      res = true;
    } else if (S[0] < T[i]){
      //S[v] >= T[i]
      int fv = 0;
      int tv = n;
      while (tv - fv > 1){
        int mv = (tv + fv) / 2;
        if (S[mv] >= T[i]){
          tv = mv;
        } else {
          fv = mv;
        }
      }
      if (S[tv] == T[i]){
        res = true;
      }
    }
    if (res){
      C++;
    }
  }
  cout << C << endl;
}


Measured memory_bytes: 3404
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<stdexcept>
#include<stdio.h>
#include<queue>
#include<stack>
#include <cmath>
#include<bits/stdc++.h>
#include<math.h>
#define cinf(n,x) for(int i=0;i<n;i++) cin >> x[i];
#define pi pair<int,int> 
using namespace std;
using ll = long long;

int main(){
    int x,a; cin >> x >> a;
    if(x < a) cout << "0";
    else cout << "10";
}

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

int main() {
	int n;
	cin>>n;
	vector<string> w(n);
	for(int i=0;i<n;i++) {
		cin>>w[i];
	}
	bool f = true;
	for (int i=0;i<n-1;i++){
		if(w[i][w[i].size()-1] != w[i+1][0]) f = false;
	}

	sort(w.begin(),w.end());
	for(int i=0;i<n-1;i++) {
		if (w[i] == w[i+1]) f=false;
	}
	if(f) cout << "Yes" << endl;
	else  cout << "No" << endl;
}


Measured memory_bytes: 256
N = int(input())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

factorial = [1, 1] # factorial[n] = n!
for i in range(2, N):
    factorial += [factorial[-1] * i]

def get_order(P, N, factorial):
    order = 0
    num = [i+1 for i in range(N)]
    for i in range(N):
        order += sum(list(map(lambda x: x < P[i], num)))* factorial[N - i - 1]
        num.remove(P[i])
    order += 1
    return order

print(abs(get_order(P, N, factorial) - get_order(Q, N, factorial)))

Measured memory_bytes: 3064
#include<stdio.h>

int main(){
 int n;
 int min;
 int max = -1e18;
 scanf("%d%d",&n,&min);
 for(int i; i < n-1; i++){
  int temp;
  scanf("%d",&temp);
  if(max < temp - min){
   max = temp - min;
  }
  if(temp < min){
   min = temp;
  }
 }
 printf("%d\n",max);
}


Measured memory_bytes: 2148
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args){
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int Q = sc.nextInt();
		int[][] railMap = new int[N+1][N+1];
		for(int i=0;i<M;i++){
			railMap[sc.nextInt()][sc.nextInt()]++;
		}
		for(int i=1;i<=N;i++){
			for(int j=1;j<=N;j++){
				railMap[i][j] += railMap[i][j-1];
			}
		}
		int res;
		int row;
		int col;
		for(int i=0;i<Q;i++){
			res = 0;
			row = sc.nextInt();
			col = sc.nextInt();
			for(int j=row;j<=col;j++){
				res+= (railMap[j][col] - railMap[j][row-1]);
			}
			out.println(res);
		}
		out.flush();
	}
}



class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
}

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

int main(){
  int H1,H2,M1,M2,K;
  cin >> H1 >> M1 >> H2 >> M2 >> K;
  int X = H1*60 + M1 , Y = H2*60 + M2;
  cout << (Y-X)-K << endl;
  return 0;
}


Measured memory_bytes: 3592
#include <stdio.h>

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

Measured memory_bytes: 580
n=int(input())
l=list(map(int,input().split()))
l.sort()

cnt=0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if (l[i]==l[j] or l[j]==l[k] or l[k]==l[i]):
                continue
            if l[k]-l[j]-l[i]<0:
                cnt+=1

print(cnt)


Measured memory_bytes: 73484
#define _CRT_SECURE_NO_WARNINGS

#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<map>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<math.h>

#define REPS(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) for (int i = 0; i < (n); i++)

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;

const int mod = 1e9 + 7;
const long double pi = 3.141592653589793238462643383279502884197;
const long double eps = 1e-7;

int main() {
	string s, t;
	cin >> s;
	cin >> t;
	int size = s.size();
	string s_rot = s;
	REP(i, size) {
		char c = s_rot[0];
		s_rot.erase(s_rot.begin());
		s_rot += c;
		if (s_rot == t) {
			cout << "Yes";
			return 0;
		}
	}
	cout << "No";
	system("pause");
	return 0;
}

Measured memory_bytes: 504
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
vector<int> a[2001];
int ans[2001];
bool c[2001];
int main()
{
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	int n, x, y; cin >> n >> x >> y;
	if (x > y)swap(x, y);
	for (int i = 1; i < n; i++) {
		a[i].push_back(i + 1);
		a[i + 1].push_back(i);
	}
	a[x].push_back(y);
	a[y].push_back(x);
	queue<pair<int,int>> q;

	for (int i = 1; i < n; i++) {
		memset(c, false, sizeof(c));
		q.push({ i,0 });
		c[i] = true;
		while (!q.empty()) {
			int x = q.front().first;
			int y = q.front().second;
			if (i < x)ans[y] += 1;
			q.pop();
			for (int next : a[x]) {
				if (c[next])continue;
				c[next] = true;
				q.push({ next,y + 1 });
			}
		}
	}

	for (int i = 1; i < n; i++) {
		cout << ans[i] << '\n';
	}



}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
template<class t, class u>
ostream& operator<<(ostream& os, const pair<t, u>& p) {
  return os << "{" << p.first << ", " << p.second << "}";
}
template<class t> ostream& operator<<(ostream& os, const vector<t>& v) {
  os << "{";
  rep(i, v.size()) { if(i) os << ", "; os << v[i]; }
  return os << "}";
}
// template<class t> ostream& operator<<(ostream& os, const set<t>& se) {
//   os << "{";
//   auto itr = se.begin();
//   rep(i, se.size()) { if(i) os << ", "; os << *itr; itr++; }
//   return os << "}";
// }
// template<class t, class u>
// ostream& operator<<(ostream& os, const map<t, u>& mp) {
//   os << "{";
//   auto itr = mp.begin();
//   rep(i, mp.size()) { if(i) os << ", "; os << *itr; itr++; }
//   return os << "}";
// }
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  string S;
  cin >> S;
  if(S == "SUN") cout << 7 << endl;
  else if(S == "MON") cout << 6 << endl;
  else if(S == "TUE") cout << 5 << endl;
  else if(S == "WED") cout << 4 << endl;
  else if(S == "THU") cout << 3 << endl;
  else if(S == "FRI") cout << 2 << endl;
  else if(S == "SAT") cout << 1 << endl;
  return 0;
}



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

using namespace std;



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

  int n;
  cin >> n;
  int x[n];
  for(int i = 0; i < n; i++){
    cin >> x[i];
  }
  int ans = 1000000000;
  for(int i = 1; i <= 100; i++){
    int cost = 0;
    for(int j = 0; j < n; j++) {
      cost += (x[j] - i) * (x[j] - i);
    }
    ans = min(ans, cost);
  }
  cout << ans;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<deque>
#include<map>
#include<queue>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const int mod=1000000007;
int dy[]={-1,0,1,0};
int dx[]={0,1,0,-1};



//#define int ll
bool isprime(int p) {
	if (p == 1) return false;
	for (int i = 2; i < p; i++) {
		if (p%i == 0) return false;
	}
	return true;
}
 
int n;
 
int main() {
	cin >> n;
	for (int i = 31; i <= 55555; i += 30) {
		if (isprime(i) == true) {
			if (i != 31) cout << " ";
			cout << i; n--;
		}
		if (n == 0) break;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,k,ans=0,h;
int main()
{
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>h;
		if(h>=k)	ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256