akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <string>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <functional>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <list>
#include <tuple>
#include <bitset>
#include <ciso646>
#include <cassert>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef vector<ll> vec;

inline bool check(ll x, ll y, ll xMax, ll yMax) { return x >= 0 && y >= 0 && xMax > x && yMax > y; }
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 T sqr(T x) { return x*x; }
template<class T> inline T mypow(T x, ll n) { T res = 1; while (n > 0) { if (n & 1)res = res * x;	x = x * x;	n >>= 1; }return res; }
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

#define For(i,a,b)	for(ll (i) = (a);i < (b);(i)++)
#define rep(i,n)	For(i,0,n)
#define rFor(i,a,b)	for(ll (i) = (a-1);i >= (b);(i)--)
#define rrep(i,n)	rFor(i,n,0)
#define each(i,n)	for(auto &i : n)
#define clr(a)		memset((a), 0 ,sizeof(a))
#define mclr(a)		memset((a), -1 ,sizeof(a))
#define all(a)		(a).begin(),(a).end()
#define sz(a)		(sizeof(a))
#define tostr(a)	tostring(a)
#define dump(val) 	cerr << #val " = " << val << endl;
#define Fill(a,v)	fill((int*)a,(int*)(a+(sz(a)/sz(*(a)))),v)

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

const ll mod = 1e9 + 7;
const ll INF = 1e17 + 9;

#define int ll
#define double ld

signed main() {
	cin.tie(0);
	ios_base::sync_with_stdio(false);

	int n;
	cin >> n;

	vector<int> a(n), b(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i] >> b[i];
	}

	int sum = 0;
	rrep(i, n) {
		int c = b[i] - (a[i] + sum) % b[i];
		if (b[i] != c) {
			sum += c;
		}
	}
	cout << sum << endl;

	return 0;
}

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

int proc(int x, int y, int z)
{
    return x*x + y*y + z*z + x*y + y*z + z*x;
}

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

    vector<int> a(N);
    for (int x = 1; x < 10000; x++) {
        for (int y = 1; y < 10000; y++) {
            for (int z = 1; z < 10000; z++) {
                int r = proc(x,y,z);
                if (r > N) break;
                // a[r] += (x == z ? 1 : 3); 
                a[r] += 1;
            }
        }
    }

    for (int i = 1; i <= N; i++) {
     cout << a[i] << endl;
    }
  
    return 0;
}



Measured memory_bytes: 3584
#include <iostream>
#include <algorithm>
using namespace std;
bool check_acgt(string check_str){
    //cout << check_str << endl;
    if(check_str == "A") return true;
    if(check_str == "C") return true;
    if(check_str == "G") return true;
    if(check_str == "T") return true;
    return false;
}

int main(void){
    string S; //1-10文字
    int max_count = 0;
    int tmp_count = 0;

    cin >> S;

    //ACGT文字列をカウントする
    for(int char_i=0; char_i<S.length(); char_i++)
    {
        if(check_acgt(S.substr(char_i,1)))
        {
            //cout << S.substr(char_i,1) << endl;
            tmp_count++;
        }
        else
        {
            //ACGT文字列終わり⇒現状の最大値より長ければcountを更新
            if(tmp_count > max_count) max_count = tmp_count;
            tmp_count = 0;
        }
    }

    if(tmp_count > max_count)
    {
        //最後までACGT文字列だった場合の反映
        max_count = tmp_count;
    }
    
    cout << max_count << endl;

    return 0;
}

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

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

const std::string alphabet = "abcdefghijklmnopqrstuvwxyz";

char next_alphabet(const char& c) {
  return alphabet[(alphabet.find(c) + 1) % alphabet.size()];
}

const std::unordered_map<char, i64> requirements = {
  {'a', 0},
  {'b', 25},
  {'c', 24},
  {'d', 23},
  {'e', 22},
  {'f', 21},
  {'g', 20},
  {'h', 19},
  {'i', 18},
  {'j', 17},
  {'k', 16},
  {'l', 15},
  {'m', 14},
  {'n', 13},
  {'o', 12},
  {'p', 11},
  {'q', 10},
  {'r', 9},
  {'s', 8},
  {'t', 7},
  {'u', 6},
  {'v', 5},
  {'w', 4},
  {'x', 3},
  {'y', 2},
  {'z', 1}
};

int main() {
  std::string s;
  i64 K;
  std::cin >> s >> K;
  const i64 N = s.size();

  for (i64 i = 0; i < N - 1; ++i) {
    if (requirements.at(s[i]) <= K) {
      K -= requirements.at(s[i]);
      s[i] = 'a';
    }
  }
  for (i64 i = 0; i < K % 26; ++i) {
    s.back() = next_alphabet(s.back());
  }

  std::cout << s << std::endl;
  return 0;
}

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

using namespace std;

using State = string::const_iterator;
using ll = long long;
string pro;
vector<map<int, ll>> arr;
using res_t = pair<bool, ll>;

inline int ctoi(char c)
{
	if ('a' <= c && c <= 'z') return c - 'a';
	else if ('A' <= c && c <= 'Z') return c - 'A' + 26;
	assert(0);
	return 0;
}

bool init(int f = false)
{
	if (f) {
		arr.clear();
		arr.resize(52);
	}
	cin >> pro;
	if (pro == ".") return false;
	return true;
}

ll number(State& s)
{
	ll res = 0;
	while (isdigit(*s)) {
		res *= 10;
		res += *s - '0';
		s++;
	}
	return res;
}


res_t expression(State& s)
{
	if (isdigit(*s)) {
		return make_pair(true, number(s));
	} else {
//		cout << s - pro.begin() << endl;
		int a = ctoi(*s);
		s++;
		s++;
		auto res = expression(s);
		s++;
		if (!res.first || res.second >= arr[a][-1] || arr[a].count(res.second) == 0) return make_pair(false, 0);
		return make_pair(true, arr[a][res.second]);
	}	
}
	
bool assignment(State& s)
{
	int a = ctoi(*s);
	s++;
	if (arr[a].size() == 0) {
		s++;
		arr[a][-1] = number(s);
		s++;
		return true;
	} else {
		s++;
		auto res = expression(s);
		s++;
		s++;
		auto r = expression(s);
		arr[a][res.second] = r.second;
		if (res.second >= arr[a][-1]) return false;
		if (!r.first || !res.first) return false;
	}
	return true;
}

int solve()
{
	int res = 1e9;
	int pos = 1;
	do {
		State s = pro.begin();
		if (!assignment(s)) {
			res = min(res, pos);
		}
		pos++;
	} while (init());
	if (res == 1e9) return 0;
	return res;
}

int main()
{
    while (init(true)) {
        cout << solve() << endl;
    }
}


Measured memory_bytes: 3104
# coding: utf-8
import re
import math
import itertools
from copy import deepcopy
import fractions
import random
from heapq import heappop,heappush
import time
import os
import sys
import datetime
from functools import lru_cache
readline=readline = sys.stdin.readline
sys.setrecursionlimit(2000)
#import numpy as np
alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def fac_list(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s


#@lru_cache(maxsize=None)  
def f():
    return 1
#main
N=int(input())
A=list(map(int,input().split()))
count=[0]*(N+1)
ze=0
for a in A:
    count[a]+=1
for a in count:
    if(a<2):continue
    ze+=(a-1)*a//2

for k in range(1,N+1):
    ans=ze
    num=A[k-1]
    cnt=count[num]
    ans-=(cnt-1)*cnt//2
    ans+=(cnt-2)*(cnt-1)//2
    print(ans)


Measured memory_bytes: 118392
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;

int n;
ll a[10000];

void solve() {
    rep(i,n) cin >> a[i];
    ll x = 0;
    rep(i,n) x += a[i];
    int ans = 0;
    rep(i,n) if (a[i]*n <= x) ans++;
    cout << ans << endl;
}

int main() {
#ifndef LOCAL
    ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
    cout.precision(20);
    cerr << fixed;
    cerr.precision(6);
#ifdef LOCAL
    //freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif  
    while (cin >> n) {
        if (n == 0) break;
        solve();
    }
    //cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    return 0;
}



Measured memory_bytes: 3252
<?php

fscanf(STDIN, "%d %d %d", $n, $m, $x);
$C = [];
$A = [];

for ($i = 0; $i < $n; ++$i) {
    $tmp = array_map('intval', explode(' ', trim(fgets(STDIN))));
    $C[] = $tmp[0];
    array_splice($tmp, 0, 1);
    $A[] = array_values($tmp);
}

$min_flg = false;
$min = PHP_INT_MAX;
for ($i = 0; $i < 1<<$n; ++$i) {

    $tmp_min = 0;
    $algo = array_fill(0, $m, 0);
    for ($j = 0; $j < $n; ++$j) {
        if ($i & (1<<$j)) {
            // i番目の本を選んでいる場合
            foreach ($A[$j] as $key => $tmp) {
                $algo[$key] += $tmp;
            }

            $tmp_min += $C[$j];
        }
    }

    /* echo "algo: " . implode(',', $algo), PHP_EOL; */

    // 対象の本を全て読み終わる
    $flg = true;
    foreach ($algo as $tmp_algo) {
        if ($tmp_algo < $x) {
            $flg = false;
            break;
        }
    }

    if ($flg) {
        $min_flg = true;
        $min = min($tmp_min, $min);
    }
}

echo $min_flg ? $min : -1;


Measured memory_bytes: 16212
//Kleene Inversion

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define irep(i,a) for(auto i = a.begin(); i != a.end(); ++i)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, string>;
using garph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    int n,k;cin>>n>>k;
    vecrep(n,a,int);
    int ans = 0;
    rep(i,0,n){
        rep(j,0,n){
            if(i==j)continue;
            if(a[j]<a[i]){
                if(i<j){
                    ans=(ans+k*(1+k)/2)%1000000007;
                }else{
                    ans=(ans+(k-1)*(1+(k-1))/2)%1000000007; 
                }
            }
        }
    }
    cout<<ans<<nnn;
    return 0;
}

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

int main()
{
  int A, B, C;
  cin >> A >> B >> C;
  if (C >= A && C <= B) cout << "Yes" << endl;
  else cout << "No" << endl;  
  return 0;
}

Measured memory_bytes: 256
from collections import deque

n,m=map(int,input().split())
x=[[]for i in range(n)]
cnt=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    a-=1
    b-=1
    x[a].append(b)
    x[b].append(a)

D=deque([])
D.append(0)
visit=[False]*n
visit[0]=True

while D:
    v=D.popleft()
    for i in x[v]:
        if visit[i]:continue
        visit[i]=True
        cnt[i]=v
        D.append(i)
print("Yes")
for i in range(1,n):
    print(cnt[i]+1)

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

using namespace std;

int main(void){
    
    int w, h, x, y, r;
    cin >> w >> h >> x >> y >> r;
    
    if((r <= x && x <= w-r) && (r <= y && y <= h-r)) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 3120
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = int64_t;
#define rep(i, j, n) for (int i = j; i < (int)n; ++i)
#define rrep(i, j, n) for (int i = (int)n - 1; j <= i; --i)

#define dbg(x) cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'
template <typename T>
ostream& operator<<(ostream& os, vector<T>& a) {
  for (int i = 0; i < (int)a.size(); ++i)
    os << a[i] << " \n"[i == (int)a.size() - 1];
  return os;
}

constexpr ll MOD = 1000000007;
constexpr int INF = 0x3f3f3f3f;
constexpr ll INFL = 0x3f3f3f3f3f3f3f3fLL;

int d[33][33], c[505][505];
int pre[3][33];

int main() {
  int n, m;
  cin >> n >> m;
  rep(i, 0, m) rep(j, 0, m) cin >> d[i][j];
  rep(i, 0, n) rep(j, 0, n) {
    cin >> c[i][j];
    --c[i][j];
  }

  // あまり3種類
  // それぞれを
  rep(a, 0, m) {
    rep(i, 0, n) {
      rep(j, 0, n) {
        int k = (i + j) % 3;
        pre[k][a] += d[c[i][j]][a];
      }
    }
  }
  int ans = INF;

  rep(i, 0, m) {
    rep(j, 0, m) {
      rep(k, 0, m) {
        if (i == j | j == k || k == i) continue;
        ans = min(ans, pre[0][i] + pre[1][j] + pre[2][k]);
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4560
N = int(input())
D = [tuple(map(int,input().split())) for i in range(N)]
for (a1,a2),(b1,b2),(c1,c2) in zip(D,D[1:],D[2:]):
    if a1==a2 and b1==b2 and c1==c2:
        print('Yes')
        exit()
print('No')


Measured memory_bytes: 9172
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const long long int INF = 1e18;
const long long int MOD = 1e9+7;

typedef pair<ll, ll> pairs;
typedef vector<pairs> p;

struct edge{
    ll to, cost;
};


ll gcd(ll a,ll b){
    if(b == 0){
        return a;
    }else{
        return gcd(b, a%b);
    }
}

ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

// 素数
vector<bool> IsPrime;
void sieve(size_t max){
    if(max+1 > IsPrime.size()){
        IsPrime.resize(max+1,true);
    } 
    IsPrime[0] = false;
    IsPrime[1] = false;

    for(size_t i=2; i*i<=max; ++i){
        if(IsPrime[i]){
            for(size_t j=2; i*j<=max; ++j){
                IsPrime[i*j] = false;
            }
        }
    }
}

// べき乗の余り
ll modpow(ll a, ll n){
    ll res = 1;
    while(n){
        if(n & 1){
            res = res * a % MOD;
        }
        a = a * a % MOD;
        n = n >> 1;
    }
    return res;
}

// コンビネーション
ll MAXN = 2e5+10;
vector<ll> inv(MAXN);
ll nCk(ll n, ll k) {
	ll res = 1;
	for(ll i = 1; i <= k; i++) {
		res = res*(n-i+1) % MOD;
	}
 
	for(ll i = 1; i <= k; i++) {
		res = res*inv[i] % MOD;
	}
	return res;
}

// 回文
bool kai(string S){
    bool flag = true;
    for(ll i=0;i<S.size()/2;++i){
        if(S[i] != S[S.size()-i-1]){
            flag = false;
            break;
        }
    }
    return flag;
}
// ---------------------------------------------

int main(){
    ll n, m;
    cin>>n>>m;
    vector<ll> g[n];
    vector<ll> a(m), b(m);
    for(ll i=0;i<m;++i){
        cin>>a[i]>>b[i];
        a[i]--; b[i]--;
        g[a[i]].push_back(b[i]);
        g[b[i]].push_back(a[i]);
    }

    ll ans = 1;
    vector<bool> d(n, false);
    for(ll i=0;i<n;++i){
        ll sum = 1;
        if(d[i] == true or g[i].size() == 0)continue;
        d[i] = true;

        queue<ll> que;
        for(ll j=0;j<g[i].size();++j){
            if(d[g[i][j]] == false){
                que.push(g[i][j]);
                d[g[i][j]] = true;
                sum++;
            }
        }
        while(!que.empty()){
            ll x = que.front();
            que.pop();
            for(ll j=0;j<g[x].size();++j){
                if(d[g[x][j]] == false){
                    que.push(g[x][j]);
                    d[g[x][j]] = true;
                    sum++;
                }
            }
        }
        ans = max(ans, sum);
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 21588
extern crate core;

use std::io::{self, Read};

fn main() {
    let mut input = String::new();
    io::stdin().read_to_string(&mut input).unwrap();
    let output = run(input.trim().to_string());
    println!("{}", output);
}

fn run(input: String) -> String {
    let list = input
        .split_whitespace()
        .skip(1)
        .map(|x| x.parse::<i64>().unwrap())
        .scan(0, |state, x| {
            *state = *state + x;
            Some(*state)
        })
        .collect::<Vec<_>>();
    let mut min = None;

    //0..iまでをすぬけが取る
    for i in 0..list.len() - 1 {
        let sunu = list[i];
        let kuma = list.last().unwrap() - list[i];
        let v = (sunu - kuma).abs();
        min = Some(match min {
            None => v,
            Some(m) => {
                if v < m {
                    v
                } else {
                    m
                }
            }
        });
    }
    min.unwrap().to_string()
}

macro_rules! tests {
    ($($name:ident: $input:expr=>$output:expr,)*) => {
        mod tests {
            $(
                #[test]
                fn $name() {
                    assert_eq!(super::run($input.to_string()), $output.to_string());
                }
            )*
        }
    }
}

tests! {
    test1: "6
1 2 3 4 5 6" => "1",
    test2: "2
10 -10" => "20",
}


Measured memory_bytes: 12540
#include<iostream>
#include<boost/format.hpp>

using namespace std;

int main(){
  int N;
  int K;
  int x[100];
  int dis;
  
  cin >> N;
  cin >> K;

  for(int i=0; i<N; i++) x[i]=0;  
  for(int i=0; i<N; i++) cin >> x[i];  

  dis=0;
  for(int i=0; i<N; i++) {
    int a_d, b_d;

    if( x[i] == 0 ) continue;

    // TypeA
    a_d = x[i];

    // TypeB
    if( x[i] <= K ){ b_d = K    - x[i]; }
    else           { b_d = x[i] - K   ; }

    dis += (a_d < b_d) ? (a_d*2) : (b_d*2);
  }

  cout << dis << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  long long a=0;
  cin>>N;
  for(int i=1;i<=N;i++){
    if(i%3==0){
    
    }else if(i%5==0){
    
    }else{
      a=a+i;
    }
  }
  cout<<a<<endl;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1)
typedef long long int ll;

int main()
{
    //freopen("in.txt","r",stdin);
    //freopen("o.txt","w",stdout);
    int a1,b1,a2,b2,dif1=0,dif2=0;
    cin>>a1>>b1>>a2>>b2;
    dif1=a2-a1;
    dif2=b2-b1;
    cout<<(a2-dif2)<<" "<<b2+dif1<<" "<<(a1-dif2)<<" "<<b1+dif1;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define test ll t;cin>>t;while(t--)
#define input1(n) ll n;cin>>n;
#define input2(a,b) ll a,b;cin>>a>>b;
#define mod 1000000007
ll min(ll a,ll b)
{
    if(a<b)
    return a;
    return b;
}

int main()  
{  
    input1(n);
    ll ar[n];
    for(ll i=0;i<n;i++)
    cin>>ar[i];
    // for(ll i=0;i<n;i++)
    // cout<<ar[i]<<" ";
    ll dp[n+1];
    dp[0]=0;
    dp[1]=abs(ar[1]-ar[0]);
    for(ll i=2;i<n+1;i++)
    {
        dp[i]=min(dp[i-1]+abs(ar[i]-ar[i-1]),dp[i-2]+abs(ar[i]-ar[i-2]));
    }
    // for(ll i=0;i<n+1;i++)
    // cout<<dp[i]<<" ";
    cout<<dp[n-1]<<"\n";
    
    return 0;
}


Measured memory_bytes: 5192
loop do
  n, k = gets.split.map(&:to_i)
  break if n == 0
  points =
    k.times.map do
      c, a, b = gets.split
      a = a.to_i; b = b.to_i
      case c
      when 'xy'
        [a, b, 0]
      when 'yz'
        [0, a, b]
      when 'xz'
        [a, 0, b]
      end
    end
 
  cross_points = {}
  ans = n * n * n - k * n
  points.combination(2).each do |a, b|
    c = a.zip(b)
    if c.all?{ |p, q| !(p == 0 && q == 0) } && c.any?{ |p, q| p == q }
      cp = c.map{ |p, q| [p, q].max }
      cross_points[cp] ||= 0
      cross_points[cp] += 1
      ans += 1 if cross_points[cp] <= 2
    end
  end
  puts ans
end

Measured memory_bytes: 8840
#include <bits/stdc++.h>
using namespace std;
vector<int> egde[100005];
int A[100005];
int n,k;

int getroot(int nd, int fr){
	
	for (int i=0;i<egde[nd].size();i++){
		if (egde[nd][i]!=fr){
			return getroot(egde[nd][i],nd);
			
		}
	}
	return nd;
}

long long getans(int nd, int fr, int ko){
	if (ko<=0) return 0;
	long long ans = ko;
	int count = 1;
	if (nd!=fr) count=2;
	for (int i=0;i<egde[nd].size();i++){
		if (egde[nd][i]!=fr){
			ans = (ans * getans(egde[nd][i],nd,k-count))%1000000007;
			count++;
		}
	}
	
	return ans;
}

int main(){
	cin >> n >> k;
	for (int i=0;i<n-1;i++){
		int a,b;
		cin >> a >> b;
		egde[a].push_back(b);
		egde[b].push_back(a);
	}
	
	int r = getroot(1,1);
	
	
	long long ans = getans(r,r,k);
	cout << ans;
	return 0;
}

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

int main() {
  int a,b,c,k,s=1,t=1;
  cin >> a >> b >> c >> k;
  
  if(a<b){
      s=0;
      
    }else{
  
  while(k>0){
    if(a<b){
      s=0;
      break;
    }else{
      b=b*2;
      k--;
      if(a<b){
      s=0;
      break;
    }
    }
  }
  }
  if(b<c){
      t=0;
      
    }else{
  
  while(k>0){
    if(b<c){
      t=0;
      break;
    }else{
      c=c*2;
      k--;
       if(b<c){
      t=0;
      break;
    }
    }
  }
  }
  
  if(s==0&&t==0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
  
  
  
  
}

Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>
#include <queue>

using namespace std;

struct Edge{
	int s,d,w,n;
	Edge(){}
	Edge(int s,int d,int w,int n=0):s(s),d(d),w(w),n(n){}
	bool operator<(const Edge& e)const{return w<e.w;}
	bool operator>(const Edge& e)const{return w>e.w;}
};

const int INFTY=1<<29;

int main()
{
	for(int c,n,m,s,d;cin>>c>>n>>m>>s>>d,c|n|m|s|d;){
		s--; d--;
		vector<vector<Edge> > g(n);
		for(int i=0;i<m;i++){
			int s,d,w; cin>>s>>d>>w;
			s--; d--;
			g[s].push_back(Edge(s,d,w));
			g[d].push_back(Edge(d,s,w));
		}
		priority_queue<Edge,vector<Edge>,greater<Edge> > pq;
		vector<vector<int> > cost(n,vector<int>(c+1,INFTY));
		pq.push(Edge(-1,s,0,0));
		while(pq.size()){
			Edge cur=pq.top(); pq.pop();
			if(cost[cur.d][cur.n]!=INFTY)
				continue;
			cost[cur.d][cur.n]=cur.w;
			for(int i=0;i<g[cur.d].size();i++){
				Edge& e=g[cur.d][i];
				pq.push(Edge(e.s,e.d,cur.w+e.w,cur.n));
				if(cur.n<c)
					pq.push(Edge(e.s,e.d,cur.w+e.w/2,cur.n+1));
			}
		}
		
		cout<<*min_element(cost[d].begin(),cost[d].end())<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 0
/*
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd
#define prev asdgSHJsfgsdfhdsh
#define hash asdgasdgasdgdfrywewery

#define eps 1e-12
#define M_PI 3.141592653589793
#define bsize 300

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 200031;

long long A,B,C,ans;

int main(){
//    freopen("apache.in","r",stdin);
//    freopen("apache.out","w",stdout);
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0);
    //cin.tie(0);

    cin>>A>>B>>C;

    if (C>0){
    	int rounds=min(B,C);
    	ans+=rounds*2;
    	B-=rounds;
    	C-=rounds;
    }
    if (C>0){
    	int rounds=min(A,C);
    	ans+=rounds;
    	A-=rounds;
    	C-=rounds;
    }

    if (C)
    	ans+=1,
		--C;

    ans+=B;

    cout<<ans<<endl;

//    cin.get(); cin.get();
    return 0;
}


Measured memory_bytes: 256
import scala.io.StdIn

object Main extends App {
  StdIn.readInt
  val p = StdIn.readLine.split(" ").map(_.toInt).foldLeft((0, Int.MaxValue)) {
    (a, b) => if (b < a._2) (a._1 + 1, b)
    else a
  }
  println(p._1)
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
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; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }

vector<int> g[100010];
int h[100010];

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

    int N, M;
    cin >> N >> M;
    vector<int> A(N-1+M), B(N-1+M);
    rep(i, N-1+M) {
        cin >> A[i] >> B[i];
        A[i]--; B[i]--;
        g[A[i]].pb(B[i]);
        h[B[i]]++;
    }
    int parent = -1;
    rep(i, N) if (h[i] == 0) parent = i;

    vector<int> dist(N);
    queue<int> q;
    q.push(parent);
    while(!q.empty()) {
        int v = q.front();
        q.pop();
        rep(i, g[v].size()) {
            int u = g[v][i];
            h[u]--;
            dist[u] = max(dist[u], dist[v] + 1);
            if (h[u] == 0) {
                q.push(u);
            }
        }
    }
    vector<int> par(N, -1);
    rep(i, N-1+M) {
        int f = A[i];
        int to = B[i];
        if (dist[to] - dist[f] == 1) {
            par[to] = f;
        }
    }
    rep(i, N) cout << par[i] + 1 << endl;
    return 0;
}

Measured memory_bytes: 8320
n = gets.to_i
h = gets.split.map(&:to_i)
ans = 0
cnt = 0
(0..(n-2)).each do |i|
    if h[i] >= h[i+1]
        cnt += 1
        ans = cnt if ans < cnt
    else
        cnt = 0
    end
end
puts ans

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 1e5 + 5;

void solve(){
	ll p, n;
	cin >> n >> p;
	ll ans = 1ll;
	if (n == 1) {
		cout << p << endl;
		return;
	}
	for(ll i = 2ll; i * i <= p; i++) {
		if (p % i == 0) {
			ll cnt = 0;
			ll v = p;
			for(; v % i == 0; v /= i, cnt++);
			if (cnt >= n) {
				ans = i;
			}
		}
	}
	cout << ans << endl;
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


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

int main() {
  int a, b, c, x;
  cin >> a >> b >> c >> x;

  int answer = 0;
  for (int i = 0; i <= a; i++){
    for (int j = 0; j <= b; j++){
      for(int k = 0; k <= c; k++){
        if (500*i+100*j+50*k > x) break;
        if (500*i+100*j+50*k == x) answer++;
      }
    }
  }
  cout << answer << endl;
}

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

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

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

using RLE = vector<pair<char, int>>;
RLE rle(string s)
{
    vector<pair<char, int>> res;
    char c; int l;
    for (int i = 0; i < (int)s.length(); i++) {
        if (i == 0) {
            c = s[i]; l = 1;
        } else if (s[i] == c) {
            l++;
        } else {
            res.push_back({c, l});
            c = s[i]; l = 1;
        }
    }
    res.push_back({c, l});
    return res;
}

int main()
{
    int n, k; cin >> n >> k;
    string s; cin >> s;

    RLE rs = rle(s);
    vector<int> l(n), r(n);

    int pos = 0;
    if (s.front() == '0') {
        l.push_back(pos); r.push_back(pos);
    }
    for (auto& e : rs) {
        if (e.first == '1') {
            l.push_back(pos);
            pos += e.second;
            r.push_back(pos);
        } else {
            pos += e.second;
        }
    }
    if (s.back() == '0') {
        l.push_back(pos); r.push_back(pos);
    }

    int num = min(k, (int)l.size()-1);
    int ans = 0;
    for (int i = 0; i <(int)l.size() - num; i++) {
        ans = max(ans, r[i+num] - l[i]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3188
n = int(input())
for i in range(n) :
    a = input()
    b = input()
    if len(a) > 80 or len(b) > 80 :
        print("overflow")
    else :
        ans = str(int(a)+int(b))
        if len(ans) > 80 :
            print("overflow")
        else :
            print(int(a) + int(b))


Measured memory_bytes: 5584
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt(), m = scanner.nextInt();
        int sum = 0;
        for (int i = 1; i < n; i ++)
            sum += i;
        for (int j = 1; j < m; j ++)
            sum += j;
        System.out.println(sum);
    }

}


Measured memory_bytes: 21844
fun main(args: Array<String>) {
    val input = readLine()!!.split(" ").map { it.toInt() }

    val peopleCount = input[0]
    val trickCount = input[1]

    var havingMap = arrayOfNulls<Boolean>(peopleCount)

    repeat(trickCount) {
        val trickidex = readLine()!!.toInt()
        val having = readLine()!!.split(" ").map { it.toInt() }
        having.forEach { havingMap[it - 1] = true }
    }

    println(havingMap.count { it == null })
}

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

int main(){
    char b;
    cin >> b;

    if(b == 'A'){
        cout << 'T' << endl;
    }
    if(b == 'T'){
        cout << 'A' << endl;
    }
    if(b == 'C'){
        cout << 'G' << endl;
    }
    if(b == 'G'){
        cout << 'C' << endl;
    }
    return 0;
}

Measured memory_bytes: 256
program dm
    implicit none
    integer::N
    integer,allocatable,dimension(:)::A
    integer(16),allocatable,dimension(:)::nums
    integer::i
    integer(16)::S
    read*,N
    allocate(A(N),nums(N))
    nums=0
    read*,A
    do i=1,N
        nums(A(I))=nums(A(I))+1
    end do
    S=0
    do i=1,N
        S= S+(nums(i)*(nums(i)-1))/2
    end do
    do i=1,N
        print"(i0)",S-nums(A(i))+1
    end do
end program dm

Measured memory_bytes: 7040
#include <stdint.h>
#include <algorithm>
#include <bitset>
#include <functional>
#include <iostream>
#include <vector>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))

typedef struct {
  int a;
  int b;
} PairInt;

bool operator<(const PairInt& left, const PairInt& right) {
  return left.a < right.a;
}

int getLimit(int a) {
  for (int i = 0; i < 31; i++) {
    if ((1 << i) - 1 > a) return (1 << (i - 1)) - 1;
  }
  return 0;
}

inline bool ends_with(std::string const& value, std::string const& ending) {
  if (ending.size() > value.size()) return false;
  return std::equal(ending.rbegin(), ending.rend(), value.rbegin());
}

int main(int argc, char* argv[]) {
  std::string s;
  std::cin >> s;
  std::cout << s.substr(0, s.length() - 8) << std::endl;
  return 0;
}



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

#define FAST {ios::sync_with_stdio(false); cin.tie(NULL);}
#define pb push_back
#define fi first
#define se second
#define f(i,a,b) for(int i=a;i<b;i++)

vector<vector<int>> grid;
vector<int> visited,len; 
//visited: -1 ; 0-discovered; 1-assigned

void dfs(int node){
	if(grid[node].size() == 0){
		visited[node] = 0;
		return;
	}

	int elem = INT_MIN;
	for(auto p: grid[node]){
		if(visited[p] == -1)
			dfs(p);
		elem = max(elem, visited[p]);
	}

	visited[node] = max(visited[node], elem+1);
}

int main(){

    FAST
	
	int n,m;
	cin>>n>>m;

	grid = vector<vector<int>> (n+1);
	
	for(int i=0;i<m;i++){
		int u,v;
		cin>>u>>v;
		grid[u].pb(v);
	}

	visited = vector<int> (n+1,-1);
	
	for(int i=1;i<=n;i++)
	{
		if(visited[i] == -1)
		{
			dfs(i);
		}
	}

	int ans = INT_MIN;
	for(auto elem: visited){
		ans = max(ans,elem);
	}
	cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 11804
use std::str::FromStr;
use std::fmt::Debug;
use std::cmp;

#[allow(dead_code)]
fn read_as_vec<T>() -> Vec<T>
where T: FromStr, <T as FromStr>::Err : Debug{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().split_whitespace().map(|c| T::from_str(c).unwrap()).collect()

}

#[allow(dead_code)]
fn read_as_string() -> String{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim().to_string()
}

fn enumerate_3colors(c: usize) -> Vec<Vec<usize>>{
    let mut v: Vec<Vec<usize>> = vec![];
    for i in 0..c{
        for j in 0..c{
            for k in 0..c{
                v.push(vec![i, j, k]);
            }
        }
    }

    v.into_iter().filter(|x| x[0] != x[1] && x[1] != x[2] && x[2] != x[0]).collect()
}
fn main(){
    let line = read_as_vec::<usize>();
    let (n, c) = (line[0], line[1]);

    let mut diff: Vec<Vec<u64>> = Vec::new();

    for _ in 0..c{
        diff.push(read_as_vec::<u64>());
    }

    let mut grid: Vec<Vec<usize>> = Vec::new();

    for _ in 0..n{
        let line = read_as_vec::<usize>();
        grid.push(line.into_iter().map(|x| x-1).collect());
    }

    let mut grid_counter = vec![vec![0;c];3];

    for i in 0..n{
        for j in 0..n{
            grid_counter[(i+j)%3][grid[i][j]] += 1;
        }
    }

    let grid_counter = grid_counter;
    let enums = enumerate_3colors(c);

    let mut min_cost = std::u64::MAX;
    for color in enums{
        let mut cost = 0;
        for i in 0..3{
            for j in 0..c{
                cost += diff[j][color[i]] * grid_counter[i][j];
            }
        }

        min_cost = cmp::min(min_cost, cost);
    }

    println!("{}", min_cost);
}


Measured memory_bytes: 8444
#include<bits/stdc++.h>
using namespace std;
map<string, int> m;
int main()
{
	int n;
	scanf("%d",&n);
	while(n--)
	{
		int t, y;
		string x;
		scanf("%d",&t);
		if(t == 0)
		{
			cin >> x;
			scanf("%d",&y);
			m[x] = y;
		}
		else if(t == 1) 
		{
			cin >> x;
			if(m.count(x))printf("%d\n",m[x]);
			else printf("0\n");
		}
		else if(t == 2) 
		{
			cin >> x;
			m.erase(x);
		}
		else if(t == 3)
		{
			map<string, int>::iterator it, it2;
			string l, r;
			cin >> l;
			cin >> r;
			it = m.lower_bound(l);
			it2 = m.upper_bound(r);
			for(; it!=it2; it++) 
			{
				cout << (*it).first;
				printf(" ");
				cout << (*it).second << endl;
			}
		}
		
	}
	return 0;
}


Measured memory_bytes: 27868
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

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

		Scanner sc = new Scanner();
		int r = sc.nextInt();
		int d = sc.nextInt();
		int x = sc.nextInt();

		for(int i = 0; i < 10; i++){
			int next = r * x - d;
			System.out.println(next);
			x = next;
		}
	}
}

class Scanner {
	private static final int SPACE = (int)' ';
	private static final int LINE_END_0 = 13;
	private static final int LINE_END_1 = 10;
	private static final int BEFORE = -1;
	private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	
	public String next(){
		StringBuilder sb = new StringBuilder();
		
		int length = BEFORE;
		readLoop: while(true) {
			try {
				int value = br.read();
				switch(value) {
				case LINE_END_1:
					if(length == BEFORE)
						break;
					
					if((int)sb.charAt(length) == LINE_END_0)
						sb.deleteCharAt(length);
				case SPACE:
					break readLoop;
				}
				sb.append((char)value);
				length++;

			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return sb.toString();
	}
	
	public String[] nextArray(int length) {
		String[] array = new String[length];
		for(int i = 0; i < length; i++)
			array[i] = next();
		return array;
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
	
	public double[] nextDoubleArray(int length) {
		double[] array = new double[length];
		for(int i = 0; i < length; i++)
			array[i] = nextDouble();
		return array;
	}
	
	public int nextInt() {
		return Integer.parseInt(next());
	}
	
	public int[] nextIntArray(int length) {
		int[] array = new int[length];
		for(int i = 0; i < length; i++)
			array[i] = nextInt();
		return array;
	}
	
	public long nextLong() {
		return Long.parseLong(next());
	}
	
	public long[] nextLongArray(int length) {
		long[] array = new long[length];
		for(int i = 0; i < length; i++)
			array[i] = nextLong();
		return array;
	}
	
	public boolean ready() {
		try {
			return br.ready();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}
}


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

int main() {
  int N;
  cin >> N;
  if ((N / 10) % 111 == 0 || (N % 1000) % 111 == 0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}

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

int main(void){

  int N, M, Q;
  scanf("%d %d %d\n", &N, &M, &Q);

  int *A;
  A = (int*)calloc((N+1)*(N+1),sizeof(int));

  int L,R;
  for(int i=0; i<M; i++){
    scanf("%d %d", &L, &R);
    A[L*(N+1)+R] = A[L*(N+1)+R] + 1;
  }

  for(int i=1; i<=N; i++){
    for(int j=i; j<=N; j++){
      A[i*(N+1)+j] = A[i*(N+1)+j] + A[i*(N+1)+j-1];
    }
  }
  for(int i=1; i<=N; i++){
    for(int j=i; j<=N; j++){
      A[i*(N+1)+j] = A[i*(N+1)+j] + A[(i-1)*(N+1)+j];
    }
  }
  int ans=0;

  for(int i=0; i<Q; i++){
    scanf("%d %d", &L, &R);
    ans = A[R*(N+1)+R] - A[(L-1)*(N+1)+R];
    printf("%d\n", ans);
  }

  return 0;
}


Measured memory_bytes: 1792
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define mod1 1000000007
#define mod2 1000000009
int getTheAnswer() {
    return 42;
}

using namespace std;
using ll=long long;

class BSubstring {
public:
	void solve(std::istream& cin, std::ostream& cout) {
        string a,b;
        cin>>a>>b;
        int n=a.length(),m=b.length(),len=0;
        if (n==m){
            int count=0;
            for (int i=0;i<n;i++)
                if (a[i]==b[i])
                    count++;
            cout<<n-count;
        }
        else{
            for (int i=0;i<n-m;i++){
                int count=0;
                for (int j=i,k=0;j<n&&k<m;j++,k++)
                    if (a[j]==b[k])
                        count++;
                len=max(len,count);
            }
            cout<<m-len;
        }
	}
};


int main() {
	BSubstring solver;
	std::ios::sync_with_stdio(false);
	std::cin.tie(NULL);
	std::cout.tie(NULL);
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int[] b = new int [a+1];
        for(int i=1; i<=a; i++) {
            b[i] = sc.nextInt();
        }
        int next = 1;
        for(int i=1; i<=1000000; i++) {
            if(b[next] == 2) {
                System.out.println(i);
                return;
            }
            next = b[next];
        }
        System.out.println("-1");
    }
}

Measured memory_bytes: 51028
n = int(input())
c = list(map(int, input().split()))
k = 1
count = 0
while True:
  q = 0
  for i in range(n):
    if (c[i]%2 ==1):
      q += 1
  if (q > 0):
    break
  else:
    for j in range(n):
      c[j] = c[j] / 2
    count += 1
print(count)
  

Measured memory_bytes: 3060
a,b,c,d=map(int,input().split())
print("R"*(c-a)+"U"*(d-b)+"R"+"D"*(d-b+1)+"L"*(c-a+1)+"UL"+"U"*(d-b+1)+"R"*(c-a+1)+"D"+"L"*(c-a)+"D"*(d-b))

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

#define ll long long
using namespace std;

int main() {
    ll a, b;
    cin >> a >> b;
    b++;
    ll ret = 0;
    for (ll i = 1; i <= 40; i++) {
        ll count = (b >> i) * (1LL << (i - 1));
        count += max((b % (1LL << i)) - (1LL << (i - 1)), 0LL);
        count -= (a >> i) * (1LL << (i - 1));
        count -= max((a % (1LL << i)) - (1LL << (i - 1)), 0LL);
        if (count % 2 == 1)ret += 1LL << (i - 1);
    }
    cout << ret << endl;
    return 0;
}

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

#define ll long long 

using namespace std;

int n;
string s;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>s;
    if (s.size()&1==1) return cout<<"No",0;
    for(int i=0; i<n/2; i++){
        if(s[i]!=s[n/2+i]){
            return cout<<"No",0;
        }
    }
    cout<<"Yes";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    vector<string>s(N);
    for(int i = 0; i < N; i++) {
        cin >> s.at(i);
    }
    
    int M;
    cin >> M;
    vector<string>t(M);
    for(int i = 0; i < M; i++) {
        cin >> t.at(i);
    }
    
    
    int ans = 0;
    int cnt = 0;
    for(int i = 0; i < N; i++) {
        cnt = 0;
        for(int j = 0; j < N; j++) {
            if(s.at(i) == s.at(j)) {
                cnt++;
            }    
        }
        for(int k = 0; k < M; k++) {
            if(s.at(i) == t.at(k)) {
                cnt--;
            }
        }
        ans = max(ans, cnt);
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"io"
	"os"
)

const Mod = 1000000007

func main() {
	sc := NewScanner(os.Stdin, 4*1005*1000)
	h, w := sc.Int(), sc.Int()

	grid := make([][]byte, h)
	for i := 0; i < h; i++ {
		grid[i] = sc.Bytes()
	}

	var dp [1001][1001]int
	dp[0][0] = 1

	for i := 0; i < h; i++ {
		for j := 0; j < w; j++ {
			if grid[i][j] != '.' {
				continue
			}
			if i == 0 && j == 0 {
				dp[i][j] = 1
				continue
			}
			if i == 0 {
				dp[i][j] = dp[i][j-1]
				continue
			}
			if j == 0 {
				dp[i][j] = dp[i-1][j]
				continue
			}

			dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % Mod
		}
	}

	fmt.Println(dp[h-1][w-1])
}

type Scanner struct {
	r   io.Reader
	buf []byte
	sep byte
	eof bool
	iniSize, maxSize,
	start, end int
}

func NewScanner(r io.Reader, size int) *Scanner {
	return &Scanner{
		r:       r,
		iniSize: size,
		maxSize: 64 * 1024,
		sep:     ' ',
	}
}

func (s *Scanner) Bytes() (b []byte) {
	s.shift()
	for ; s.end < len(s.buf) && !s.skip(); s.read() {
		s.end++
		if s.sep == 0 {
			break
		}
	}
	b = s.buf[s.start:s.end]
	s.start = s.end
	return
}

func (s *Scanner) Int() int { return ParseInt(s.Bytes()) }

func (s *Scanner) shift() {
	for s.read(); s.end < len(s.buf) && s.skip(); s.read() {
		s.start++
		s.end++
	}
}

func (s *Scanner) skip() bool {
	b := s.buf[s.end]
	return b == '\n' || b == s.sep
}

func (s *Scanner) read() {
	if s.eof || s.end < len(s.buf) {
		return
	}
	s.extend()
	_, err := s.r.Read(s.buf[s.end:])
	if err == io.EOF {
		s.eof = true
	}
}

func (s *Scanner) extend() {
	size := len(s.buf) * 2
	if size == 0 {
		size = s.iniSize
	}
	if size > s.maxSize {
		size = s.maxSize
	}
	b := make([]byte, size)
	copy(b, s.buf[s.start:s.end])
	s.buf = b
	s.end -= s.start
	s.start = 0
}

func ParseInt(b []byte) (n int) {
	var i int
	if b[0] == '-' {
		i++
	}
	for ; i < len(b); i++ {
		n *= 10
		n += int(b[i] - '0')
	}
	if b[0] == '-' {
		return -n
	}
	return
}


Measured memory_bytes: 9472
#include<bits/stdc++.h>
using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pii pair<int,int>
#define piii pair<int,pii>
#define mp make_pair
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = INT_MAX;
const ll LLINF = LLONG_MAX;
const double eps = 1e-5;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))
  
#define DIV 1000000007
typedef vector<ll> Array;
typedef vector<Array> matrix;
typedef tuple<int,int,int> tiii;
#define mt make_tuple
ll pow(ll x,ll n,ll m){ll r=1;while(n>0){if(n&1==1)r=r*x%m;x=x*x%m;n>>=1;}return r%m;}

int main(){
  map<int,int> m;
  int n; cin >> n;
  ll ans = 0;
  rep(i,n){
    int in; cin >> in;
    if(m[in])
      ans--,m[in]--;
    else
      ans++,m[in]++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 4864