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

#define endl '\n'
#define ll long long
#define int long long
#define re register
#define pb(x) push_back(x);
#define ce(x) cout << x << '\n';

using db = long double;
using pll = pair < ll, ll >;
#define scan(a, n) 		for(int i = 0; i < n; i++)cin >> a[i];

#define rep(i,x,n,inc) for(i=x ; i<n ; i+=inc)
#define repr(i,x,n,inc) for( i=x ; i>n ; i+=inc)
#define all(a)      (a).begin(),(a).end()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
#define hell 1000000007
#define infl LLONG_MAX

#define Foxen(i,s) for (i=s.begin(); i!=s.end(); i++)
#define Fill(s,v) memset(s,v,sizeof(s))
#define cout_p(x, p) cout << fixed << setprecision((p)) << x << endl     //print with precision

#define tc(tt) \
    ll tt;    \
    cin >> tt; \
    for (ll _tt = 0; _tt < tt; _tt++) // testcase 

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

 
	ll t, i, x, j, y, 	 k, n;
	cin >> x;
	ll z = 100;	i = 0;
	while (z < x) {
		z += z / 100;
		i++;
	}

	ce(i)


}


Measured memory_bytes: 3652
#include <stdio.h>
int main (void){
	int tempa,tempb,c,d,e,f,g,h,i,j;
	scanf("%d %d %d %d %d",&tempa,&tempb,&c,&d,&e);
	if(tempa<=0){
	h=-tempa*c+d+e*tempb;
		printf("%d\n",h);
	}
	else if(tempa>0){
		g=(tempb-tempa)*e;
		printf("%d\n",g);
	}
	else{
		i=d+e*tempb;
		printf("%d\n",i);
	}
	return 0;
}



Measured memory_bytes: 2704
import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto n = readln.chomp.to!size_t;
  auto ai = readln.split.to!(short[]);

  auto k = ai.reduce!(max);
  auto bi = countingSort(ai, k);

  foreach (i, b; bi) {
    write(b);
    if (i < n - 1) write(" ");
  }
  writeln;
}

short[] countingSort(short[] ai, int k)
{
  auto ci = new int[](k + 1);

  foreach (a; ai) ++ci[a];
  foreach (i; 1..k+1) ci[i] += ci[i - 1];

  auto bi = new short[](ai.length);

  foreach_reverse (a; ai) {
    bi[ci[a] - 1] = a;
    --ci[a];
  }

  return bi;
}

Measured memory_bytes: 69636
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <mutex>
#include <cmath>
#include <set>
#include <climits>
#include <bitset>

#define mod 1e9+7
#define mp make_pair
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
using ll = long long;
using pii = pair<int, int>;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll h, n;
    ll x = 0;
    cin >> h >> n;
    vector<ll> b(n);
    string ans = "Yes";
    rep(i,n){
        cin >> b[i];
        x += b[i];
    }
    if(x < h) ans = "No";
    cout << ans;
    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#define ArraySizeOf(array)     (sizeof(array) / sizeof(array[0]))
#define res(i,n) for(int i=n;;i++)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define rev(i,n) for(int i=n-1;i>=0;i--)
#define REV(i,n) for(int i=n-1;i>0;i--)
#define req(i,n,m) for(int i=n;i<m;i++)
#define REQ(i,n,m,l) for(int i=n;i<m;i+=l) 
#define _GLIBCXX_DEBUG
int INF = 1e9 + 7;
unsigned NthDayOfWeekToDay(unsigned n, unsigned dow, unsigned dow1)
{
    unsigned day;
    if (dow < dow1) dow += 7;
    day = dow - dow1;
    day += 7 * n - 6;
    return day;
}
signed gcd(long long x, long long y) {
    if (y == 0)return x;
    return gcd(y, x % y);
}
signed lcm(long long x, long long y) {
    return x / gcd(x, y) * y;
}
unsigned DayToWeekNumber(unsigned day)
{
    return (day - 1) / 7 + 1;
}
unsigned AnotherDayOfWeek(unsigned day, unsigned day0, unsigned dow0)
{
    return (dow0 + 35 + day - day0) % 7;
}
using namespace std;
signed main() {
    string S; cin >> S;
    bool a=true;
    REP(i, S.size())if (S.at(i) != '9')a=false;
    if (a == true)cout << S.at(0) - 48 + 9 * (S.size() - 1) << endl;
    else cout << S.at(0) - 49 + 9 * (S.size() - 1) << endl;
}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<bitset>
#include<vector>
#include<set>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<deque>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;

int main(){
    string w, t;
    int ans = 0;
    cin >> w;
    for(int i=0; i < w.size(); i++)if('A' <= w[i] && w[i] <= 'Z')w[i] -= 'A' - 'a';
    while(cin >> t){
        if(t == "END_OF_TEXT")break;
        for(int i=0; i < t.size(); i++)if('A' <= t[i] && t[i] <= 'Z')t[i] -= 'A' - 'a';
        if(w == t)ans++;
    }
    cout << ans << endl;
    return 0;
}




Measured memory_bytes: 3204
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

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

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main() {
	int n,x;
	cin >> n >> x;
	int a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	LL ans = 0;
	if (a[0] > x) {
		ans += a[0] - x;
		a[0] = x;
	}

	for (int i = 0; i < n-1; i++) {
		if (a[i] + a[i+1] > x) {
			ans += a[i] + a[i+1] - x;
			a[i+1] = x - a[i];
		}
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
#define REP(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define REPR(i, n) for(ll (i) = (n); (i) >= 0; (i)--)
#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); (i)++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
#define _GLIBCXX_DEBUG

template <uint MD> struct ModInt {
    using M = ModInt;
    const static M G;
    uint v;
    ModInt(ll _v = 0) { set_v(uint(_v % MD + MD)); }
    M& set_v(uint _v) {
        v = (_v < MD) ? _v : _v - MD;
        return *this;
    }
    explicit operator bool() const { return v != 0; }
    M operator-() const { return M() - *this; }
    M operator+(const M& r) const { return M().set_v(v + r.v); }
    M operator-(const M& r) const { return M().set_v(v + MD - r.v); }
    M operator*(const M& r) const { return M().set_v(uint(ull(v) * r.v % MD)); }
    M operator/(const M& r) const { return *this * r.inv(); }
    M& operator+=(const M& r) { return *this = *this + r; }
    M& operator-=(const M& r) { return *this = *this - r; }
    M& operator*=(const M& r) { return *this = *this * r; }
    M& operator/=(const M& r) { return *this = *this / r; }
    bool operator==(const M& r) const { return v == r.v; }
    M pow(ll n) const {
        M x = *this, r = 1;
        while (n) {
            if (n & 1) r *= x;
            x *= x;
            n >>= 1;
        }
        return r;
    }
    M inv() const { return pow(MD - 2); }
    friend ostream& operator<<(ostream& os, const M& r) { return os << r.v; }
};
using Mint = ModInt<1000000007>;

const double PI = 3.14159265358979323846;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}

ll gcd(ll a, ll b) {
    return b != 0 ? gcd(b, a % b) : a;
}

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

int main()
{	
    string s, t;
    cin >> s >> t;
    int ans = 0;
    REP(i, s.length()){
        if(s[i] != t[i]) ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3916
using System;

namespace AizuOnLine
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                string[] data = Console.ReadLine().Split(' ');
                int m = int.Parse(data[0]);
                int f = int.Parse(data[1]);
                int r = int.Parse(data[2]);

                if(m==-1 && f == -1 &&  r == -1)
                {
                    break;
                }

                Console.WriteLine(Judge(m, f, r));
            }
        }

        static string Judge(int m, int f, int r)
        {
            string rank = string.Empty;

            if (m == -1 || f == -1)
            {
                rank = "F";
            }
            else if (80 <= m + f)
            {
                rank = "A";
            }
            else if (65 <= m + f)
            {
                rank = "B";
            }
            else if (50 <= m + f)
            {
                rank = "C";
            }
            else if (30 <= m + f) 
            {
                if (50 <= r)
                {
                    rank = "C";
                }
                else
                {
                    rank = "D";
                }
            }
            else
            {
                rank = "F";
            }

            return rank;
        }
    }
}

Measured memory_bytes: 8908
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
    void solve(Scanner sc, PrintWriter pw) {
        int N = sc.nextInt();
        int X = sc.nextInt();
        int T = sc.nextInt();
        pw.println((N + X - 1) / X * T);
    }
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        PrintWriter pw = new PrintWriter(System.out);
        new Main().solve(sc, pw);
        pw.flush();
        pw.close();
        sc.close();
    }
}


Measured memory_bytes: 35788
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>

#define CH(N,A,B) (A<=N&&N<B)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define RREP(i,a,b) for(int i=(b-1);a<=i;i--)
#define F first
#define S second

using namespace std;

const long long INF = 1LL<<50;

int N,M;
long long a[2010], b[2010], c[2010];

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

  REP(i,0,M){
    cin>>a[i]>>b[i]>>c[i];
    c[i] = (-1)*c[i];
  }

  //BF
  long long d[1010];
  REP(i,0,N) d[i] = INF;
  d[0] = 0;

  REP(i,0,N-1){
    REP(j,0,M){
      if(d[a[j]-1]==INF) continue; /*0から到達不可能な起点は除外*/
      long long t;
      if(d[a[j]-1]+c[j] <= (-1)*INF) t = (-1)*INF;
      else t = d[a[j]-1]+c[j];
      d[b[j]-1] = min(d[b[j]-1], t);
    }
  }
  long long ans = d[N-1];

  bool negative[1010]; //positive[i]:0->iのどこかで正の閉路がある。
  REP(i,0,N) negative[i] = false;
  REP(i,0,N){
    REP(j,0,M){
      if(d[a[j]-1]==INF) continue;
      //long long tmp = d[b[j]-1];
      long long t;
      if(d[a[j]-1]+c[j] <= (-1)*INF) t = (-1)*INF;
      else t = d[a[j]-1]+c[j];
      d[b[j]-1] = min(d[b[j]-1], t);
      /*
      if(tmp != d[b[j]-1]){
        negative[b[i]-1] = true;
      }
      if(negative[a[j]-1] == true){
        negative[b[j]-1] = true;
      }
      */
    }
  }

  //if(negative[N-1]) cout<<"inf"<<endl;
  if(ans != d[N-1]) cout<<"inf"<<endl;
  else cout<<(-1)*ans<<endl;

  return 0;
}


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

string cipher(int &p,string& s);

char incl(char x){
    if(x=='Z') return 'A';
    else return x+1;
}
char decl(char x){
    if(x=='A') return 'Z';
    else return x-1;
}
char letter(int &p,string &s){
    char x=s[p++];
    if(x=='+') return incl(letter(p,s));
    else if(x=='-') return decl(letter(p,s));
    return x;
}
string parseStr(int &p,string& s){
    if(s[p]=='['){
        p++;
        string ret=cipher(p,s);
        assert(s[p++]==']');
        reverse(ret.begin(),ret.end());
        return ret;
    }
    else{
        return string{letter(p,s)};
    }
}
string cipher(int &p,string& s){
    string res;
    while(p!=s.size() && s[p]!=']'){
        res+=parseStr(p,s);
    }
    return res;
}
string dfs(int idx,string& str){
    if(idx==str.size()){
        int p=0;
        return cipher(p,str);
    }
    if(str[idx]!='?') return dfs(idx+1,str);
    string res="";
    for(char x='A';x<='Z';x++){
        str[idx]=x;
        string ret=dfs(idx+1,str);
        if(res=="") res=ret;
        else res=min(res,ret);
    }
    str[idx]='?';
    return res;
}
string solve(string str){
    return dfs(0,str);
}
int main(){
    string s;
    while(cin>>s,s!="."){
        cout<<solve(s)<<endl;
    }
    return 0;
}


Measured memory_bytes: 3164
module ABC069

	! <module>s to import
	use, intrinsic :: iso_fortran_env


	! require all variables to be explicitly declared
	implicit none


	! accessibility of <subroutine>s and <function>s in this <module>
	public :: ABC069_B


	! constants for this <module>
	integer( kind=INT32 ), parameter, private :: len_TargetString_max = 100


	! contained <subroutine>s and <function>s are below
	contains


	subroutine ABC069_B

		! variables for this <subroutine>
		character( len=len_TargetString_max, kind=1 ) :: word_input

		integer( kind=INT16 ) :: len_word

		! STEP.01
		! read out the target word
		read( unit=INPUT_UNIT, fmt='(A)' ) word_input

		! STEP.02
		! get the length of the target word
		len_word = len_trim( word_input )

		! STEP.03
		! output the result
		write( unit=OUTPUT_UNIT, fmt='(A1,I0,A1)', advance='yes' ) word_input(1:1), len_word-2, word_input(len_word:len_word)

		! STEP.END
		return

	end subroutine ABC069_B

end module ABC069


program main

	! <module>s to import
	use, non_intrinsic :: ABC069

	! require all variables to be explicitly declared
	implicit none

	call ABC069_B

end program main


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <climits>
#include <iomanip>
#include <deque>
#include <limits>
#include <map>
#include <set>
#include <functional>

using namespace std;

int main()
{
  int64_t N;

  cin >> N;

  int num = 0;
  for (int64_t b = 1; b <= N - 1; b++) {
    if (N % b == 0) {
      num += N / b - 1;
    }
    else {
      num += N / b;
    }
  }

  cout << num << endl;

  return 0;
}


Measured memory_bytes: 3580
import java.util.Scanner;
public class Main {
	
	static int Euclid(int a, int b) {
		int ret;
		int excess = a % b;
		if(excess == 0) return(b);
		
		ret = Euclid(b, excess);
		
		return(ret);
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner stdIn = new Scanner(System.in);
		
		while(stdIn.hasNext()) {
			int a = stdIn.nextInt();
			int b = stdIn.nextInt();
			
			int ans = Euclid(Math.max(a, b), Math.min(a, b));
			System.out.println(ans);
		}
	}

}

Measured memory_bytes: 17200
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
  	long a=sc.nextLong(),b=sc.nextLong(),n=sc.nextLong(),x,f;
  	x=Math.min((b-1),n);
  	f=(a*x/b)-a*(x/b);
  	System.out.print(f);
  }
}

Measured memory_bytes: 35536
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int N, K; scanf("%d%d", &N, &K);
    vector<int> P(N);
    for(int i=0; i<N; i++) scanf("%d", &P[i]), P[i]--;
    vector<int> C(N);
    for(int i=0; i<N; i++) scanf("%d", &C[i]);

    ll ans = -LONGINF;
    vector<bool> visited(N);
    for(int i=0; i<N; i++) {
        if(visited[i]) continue;
        vector<int> cycle;
        int x = i;
        while(true) {
            visited[x] = true;
            cycle.emplace_back(C[x]);
            x = P[x];
            if(x == i) break;
        }

        int M = cycle.size();
        ll cost_w = accumulate(cycle.begin(), cycle.end(), 0LL);
        vector<ll> pref(M+1, -LONGINF);
        for(int i=0; i<M; i++) {
            ll sum = 0;
            for(int j=0; j<M; j++) {
                int p = (i+j)%M;
                sum += cycle[p];
                chmax(pref[j+1], sum);
            }
        }

        for(int k=1; k<=M; k++) {
            if(k > K) continue;
            int d = (K - k) / M;            
            chmax(ans, max(0LL, cost_w * d) + pref[k]);
        }
    }
    cout << ans << endl;
    return 0;
}


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

int main () {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  while (A > 0 && C > 0) {
    C -= B;
    if (C <= 0) {
      cout << "Yes";
      break;
    }
    A -= D;
    if (A <= 0) {
      cout << "No";
      break;
    }
  }
}

Measured memory_bytes: 3580
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <functional>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

const ll INF = 1e17;

ll solve() {
    int n;
    cin >> n;
    VL a(n + 1);
    REP(i,n+1) a[i] = in();
    if (n == 0){
        if (a[0] == 1) return 1;
        else return -1;
    }
    if (a[0] != 0) return -1;
    VL ma(n + 1);
    ma[0] = 1;
    REP(i,n){
        ma[i + 1] = 2 * ma[i] - a[i + 1];
        chmin(ma[i + 1], INF);
        if (ma[i] <= 0) return -1;
    }
    if (ma[n] < 0) return -1;
    ll ans = a[n], x = a[n];
    FORR(i,n-1,0){
        chmin(x, ma[i]);
        x += a[i];
        ans += x;
    }
    return ans;
}

int main(void){
    cout << solve() << endl;
    return 0;
}


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

int main()
{
    int k,n,sum=0;
    cin>>n>>k;
    vector<int>vec;
    for(int i=0;i<n;i++)
    {
        int a;
        cin>>a;
        vec.push_back(a);
    }
    sort(vec.begin(),vec.end());
    for(int i=k-1;i>=0;i--)
    {
           sum+=vec[--n];
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define GET_ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
int main(){
    long long a,b,x;
    cin >> a >> b >> x;
    if(a+b >= x && a <= x) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

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

/***********************************************/
/* Dear online judge:
 * I've read the problem, and tried to solve it.
 * Even if you don't accept my solution, you should respect my effort.
 * I hope my code compiles and gets accepted.
 *  ___  __     _______    _______      
 * |\  \|\  \  |\  ___ \  |\  ___ \     
 * \ \  \/  /|_\ \   __/| \ \   __/|    
 *  \ \   ___  \\ \  \_|/__\ \  \_|/__  
 *   \ \  \\ \  \\ \  \_|\ \\ \  \_|\ \ 
 *    \ \__\\ \__\\ \_______\\ \_______\
 *     \|__| \|__| \|_______| \|_______|
 */
const long long mod = 1000000007;

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

	int N;
	cin>>N;
	vector<int> a(N);
	for(int i = 0;i < N;i++) cin>>a[i];
	sort(a.rbegin(),a.rend());
	int res = 0;
	for(int i = 0;i < N;i += 2) {
		res += a[i];
		if(i + 1 != N) res -= a[i+1];
	}
	cout<<res<<'\n';
	return 0;
}


Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    char[] r;
    foreach (c; readln.chomp) {
        if (c == '?') {
            r ~= 'D';
        } else {
            r ~= c;
        }
    }
    writeln(r);
}

Measured memory_bytes: 3044
import sys
from collections import deque
input = sys.stdin.readline
number=int(input())
vacation = [list(map(int,input().rstrip().split())) for _ in range(number)]
#print(vacation)
#capable = deque([0,1,2])
#did = deque([])
#print(max(vacation[0]))
table = [[0]*3 for _ in range(number+1)]
for i in range(1,number+1):
    table[i][0] = max(table[i-1][1],table[i-1][2]) + vacation[i-1][0]
    table[i][1] = max(table[i-1][0],table[i-1][2]) + vacation[i-1][1]
    table[i][2] = max(table[i-1][0],table[i-1][1]) + vacation[i-1][2]
print(max(table[number]))


Measured memory_bytes: 50132
#include <iostream>
#include <algorithm>
using namespace std;
#define MAXSIZE 100

int main(){
    int i, n, a[MAXSIZE];
    cin >> n;
    for(i = 0; i < n; i++){
        cin >> a[i];
    }
    sort(a, a + n);
    int alice_score = 0, bob_score = 0, turn = 0;
    for(i = n - 1; i > -1; i--){
        if(turn == 0){
            alice_score += a[i];
            turn = 1;
        }else{
            bob_score += a[i];
            turn = 0;
        }
    }
    cout << alice_score - bob_score << endl;
    return 0;
}

Measured memory_bytes: 256
N = gets.to_i
EDGES = (N-1).times.map { gets.split.map(&:to_i) }

nodes = {}
EDGES.each_with_index do |edge, i|
  nodes[edge[0]] ||= []
  nodes[edge[0]] << {edge: i, node: edge[1]}
  nodes[edge[1]] ||= []
  nodes[edge[1]] << {edge: i, node: edge[0]}
end

max_edges = 0
colors = {}

search_nodes = []
current_node = EDGES[0][0]
while current_node
  edges = nodes[current_node].size
  max_edges = edges if max_edges < edges

  used_colors = {}
  nodes[current_node].each do |edge|
    used_colors[colors[edge[:edge]]] = true if colors[edge[:edge]]
  end

  cur_color = 1
  nodes[current_node].each do |edge|
    next if colors[edge[:edge]]
    cur_color += 1 while used_colors[cur_color]
    colors[edge[:edge]] = cur_color
    search_nodes << edge[:node]

    cur_color += 1
  end

  current_node = search_nodes.pop
end

puts max_edges
0.upto(N-2) do |i|
  puts colors[i]
end

Measured memory_bytes: 103804
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define REP(i,n)   for (int i = 0; i < (n); ++i)
#define SORT(a)    sort((a).begin(), (a).end());
#define UNIQ(a)    SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end());
#define FIND(a,x)  find((a).begin(), (a).end(), (x)) != (a).end()
#define REVERSE(a) reverse((a).begin(), (a).end());
#define OUT(d) cout << (d);
#define OUT_L(d) std::cout<<(d)<<"\n";
#define Yes() printf("Yes\n");
#define No() printf("No\n");
#define YES() printf("YES\n");
#define NO() printf("NO\n");
#define CEIL(x, y) ((x + y - 1) / (y))

using namespace std;
using ll = long long;
using P = pair<ll,ll>;

const ll MOD = 1000000007; // 10^9 + 7

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  srand((unsigned)time(NULL));

  int n; cin >> n;
  ll ans = 1;
  for (int i = 1; i <= n; i++)
    ans = ans * i % MOD;
  OUT_L(ans)
}


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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}

signed main()
{   
    gearup;
    int n;cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    map<ll,ll> mp;
    rep(i,n) mp[a[i]]++;
    ll total =0;
    for(auto m : mp){
        total += m.second * (m.second-1)/2;
    }
    rep(i,n){
        ll num = mp[a[i]];
        ll b = num*(num-1)/2;
        ll c = (num-1)*(num-2)/2;
        cout << total - b + c << endl;
    }
}

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

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

long long lcm(long long a, long long b)
{
   long long g = gcd(a,b);
   return a / g * b;
}

int main() {
  int N;
  cin >> N;
  
  long long answer = 1;
  
  for(int i =0;i<N;i++){
  	long long T;
    cin >> T;
    answer = lcm(answer,T);
  }
  
  cout << answer << endl;
  return 0;
}


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

int main() {
  int n,w;
  cin>>n>>w;
  vector<vector<long long>>dp(n+1,vector<long long>(w+1));
  vector<int>weight(n);
  vector<int>value(n);
  for(int i=0;i<n;i++) cin>>weight[i]>>value[i];
  for(int i=1;i<n+1;i++){
    for(int j=0;j<w+1;j++){
      dp[i][j]=dp[i-1][j];
      if(j-weight[i-1]>=0)dp[i][j]=max(dp[i][j],dp[i-1][j-weight[i-1]]+value[i-1]);
    }
  }
  cout<<dp[n][w]<<endl;
}


Measured memory_bytes: 80256
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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

const ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

int main(){
  int N, i; cin >> N >> i;
  cout << N - i + 1 << endl;
}


Measured memory_bytes: 256
//
//AOJ vol11-1160
//http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1160&lang=jp
//20170616
//640009E
//Yang Bo
//

#include <iostream>

using namespace std;

int a[50][50];
int h, w;

int recursion(int y, int x)
{
  int number = 1;
  a[y][x] = 0;

  if (x < w - 1)
    if (a[y][x + 1] == 1)
      number = recursion(y, x + 1);
  if (y < h - 1)
    if (a[y + 1][x] == 1)
      number = recursion(y + 1, x);
  if (x > 0)
    if (a[y][x - 1] == 1)
      number = recursion(y, x - 1);
  if (y > 0)
    if (a[y - 1][x] == 1)
      number = recursion(y - 1, x);
  if (y < h - 1 && x < w - 1)
    if (a[y + 1][x + 1] == 1)
      number = recursion(y + 1, x + 1);
  if (y < h - 1 && x > 0)
    if (a[y + 1][x - 1] == 1)
      number = recursion(y + 1, x - 1);
  if (y > 0 && x < w - 1)
    if (a[y - 1][x + 1] == 1)
      number = recursion(y - 1, x + 1);
  if (y > 0 && x > 0)
    if (a[y - 1][x - 1] == 1)
      number = recursion(y - 1, x - 1);
  

  //cout << "recursion(" << y << ", "<< x << ") = " << number << endl;
  return number;
}

int main()
{
  while (cin >> w >> h) {
    if (w == 0)
      break;
    else {
      for (int i = 0; i < h; i++) {
	for (int j = 0; j < w; j++) {
	  cin >> a[i][j]; //??\???
	}
      }
      int ans = 0;
      for (int i = 0; i < h; i++) {
	for (int j = 0; j < w; j++) {
	  if (a[i][j] == 1) {
	    //cout << "i = " << i << " ,j = " << j << endl;
            ans += recursion(i, j);
	  }
	}
      }
      cout << ans << endl;
    }
  }
}

/*
??¢?????´??????????????????????????????????????????????´°?????????????°???\?????????????£???????????????£???????????£??????
*/

Measured memory_bytes: 3208
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main() {

    string S; cin >> S;
    int ans = 0;
    for(int i=0; i < S.size(); i++) {
        if(S.at(i) == 'o') ans++;
    }

    if(ans + (15 - S.size()) >= 8) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

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

typedef long long ll;
typedef vector<int> vi;            typedef vector<vi> vii;
typedef vector<ll> vl;             typedef vector<vl> vll;
typedef pair<int,int> pi;          typedef pair<pi,int> pii;
typedef pair<ll,ll> pl;            typedef pair<pl,ll> pll;
typedef pair<int,bool> pib;        typedef pair<ll,bool> plb;

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define in insert
#define er erase
//user-defined hash table for pairs --------------------------------------------------------------------------------------------------
struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
}; 

//returns (a^n mod p)---------------------------------------------------------------------------------------------------------------
ll power(ll a,ll n,ll p)
{
	if(n == 0)
	{
		return 1;
	}
	else if(n%2 == 0)
	{
		ll ans = power(a,n/2,p);
		return (ans*ans)%p;
	}
	else 
	{
		ll ans = power(a,n-1,p);
		return (ans*a)%p;
	}
}

//returns (a^-1 mod p)(if p is prime)----------------------------------------------------------------------------------------------
ll inverse(ll a,ll p)
{
   return power(a,p-2,p);
}
//----------------------------------------------------------------------------------------------------------------------------------


void solve()
{
   int n;
   cin>>n;
   int a[n];
   for(int i=0;i<n;i++)
   {
   	  cin>>a[i];
   }
   vi v;
   for(int i=0;i<n;i++)
   {
   	  if(i == n-1 || a[i] != a[i+1])
   	  {
         v.pb(a[i]);
   	  }
   }
   int x = v.size();
   int i = 0;
   ll amount = 1000;
   while(i < x-1)
   {
   	  if(v[i] < v[i+1])
   	  {
         int j = i;
         while(j < x)
         {
         	if(j == x-1 || v[j] > v[j+1])
         	{
         		break;
         	}
         	j++;
         }
         if(j < x)
         {
         	amount += (amount/v[i])*(v[j]-v[i]);
         }
         i = j+1;
   	  }
   	  else
   	  {
   	  	i++;
   	  }
   }
   cout<<amount<<endl;
}


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef PAVANSAI006
    freopen("inp.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
    freopen("err.txt", "w", stderr);
#endif
    ll t = 1;
    //cin>>t;
    while(t--)
    {
    	solve();
    }
    
}

Measured memory_bytes: 3672
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <stdbool.h>
typedef long long LL;
typedef long double Lf;
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))
#define N 1001
#define MOD 1000000007
int acs(const void* a, const void* b) { return *(int*)a - *(int*)b; }//1,2,3,4
int des(const void* a, const void* b) { return *(int*)b - *(int*)a; }//9,8,7,6
int cmp_char(const void* a, const void* b) { return *(char*)a - *(char*)b; }//a,b,c,d
int cmp_str(const void* a, const void* b) { return strcmp(*(const char**)a, *(const char**)b); }//aaa,aab
//temmie_のsnippet

int main() {
	LL n,m;
	scanf("%lld%lld",&n,&m);
	if(n==1&&m==1)n=1;
	else if(n==1||m==1)n=(n>m?n-2:m-2);
	else n=(n-2)*(m-2);
	printf("%lld",n);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;
const int MAX_NUM = 999999999;
int64 N;
int ans;
vector<int> target = {7, 5, 3};
void dfs(int64 num) {
	if (num > N) return;
	int64 t_num = num; 
	int flg = 0;
	while (t_num > 0) {
		int modulo = t_num % 10;
		if (modulo == 7) flg |= 1;
		if (modulo == 5) flg |= 2;
		if (modulo == 3) flg |= 4;
		t_num /= 10;	
	}
	if (flg == 7) ans++;
	for (int i = 0; i < target.size(); ++i) {
		dfs((num * 10) + target[i]);
	}
}
void solve() {
	cin >> N;
	for (int i = 0; i < target.size(); ++i) {
		dfs(target[i]);
	}
	cout << ans << endl;
	return;
}
int main() {
	solve();
	return 0;
}

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

int main()
{
    int i=0,sum=0;
    char a[10];
    scanf("%s",a);
    while(a[i]!='\0')
    {
        if(a[i]=='+')
            sum++;
        else if(a[i]=='-')
            sum--;
            i++;
    }
    printf("%d",sum);
    return 0;
}

Measured memory_bytes: 128
use std::collections::HashSet;
fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let v: Vec<usize> = s.trim().split_whitespace().map(|x| x.parse().unwrap()).collect();
    let mut x: Vec<usize> = Vec::new();
    let mut y: HashSet<usize> = HashSet::new();
    for _ in 0..v[1] {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let u: Vec<usize> = s.trim().split_whitespace().map(|x| x.parse().unwrap()).collect();
        if u[0] == 1 {x.push(u[1]);}
        if u[1] == v[0] {y.insert(u[0]);}
    }
    for i in &x {
        if y.contains(i) {println!("POSSIBLE"); return}
    }
    println!("IMPOSSIBLE");
}



Measured memory_bytes: 10492
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repit(it, li) for(auto it=li.begin(); it!=li.end(); it++)
using namespace std;
using ll = long long;
using P = pair<int,int>;

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

   reverse(s.begin(), s.end());
   int c=0;
   vector<int> stp;
   while(c<n){
      int d;
      for(d=min(m, n-c); d>0 && c+d<n+1 && s[c+d]=='1'; d--);
      if(d==0){
         cout<< (-1)<<endl;
         return 0;
      }
      stp.push_back(d);
      c+=d;
   }
   reverse(stp.begin(), stp.end());

   for(int e : stp) cout<<e<<" ";
   cout<<endl;
   return 0;
}


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

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

  if(a*b%2==0) {
    cout << "Even" << endl;
  } else {
    cout << "Odd" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
#0521
while True:
    n = int(input())
    if n == 0:
        break
    x = 1000 - n
    cnt = 0
    if x >= 500:
        cnt += 1
        x = x - 500
    if x > 100:
        cnt = cnt + x//100
        x = x - (100 * (x//100))
    if x >= 50:
        cnt = cnt + x//50
        x = x - (50 * (x//50))
    if x >= 10:
        cnt = cnt + x//10
        x = x - (10 * (x//10))
    if x >= 5:
        cnt = cnt + x//5
        x = x - (5 * (x//5))
    print(cnt + x)


Measured memory_bytes: 5584
fn main() {
    let scan = std::io::stdin();
    let mut line = String::new();
    let _ = scan.read_line(&mut line);
    let vec: Vec<&str> = line.split_whitespace().collect();

    let mut n: Vec<i32> = Vec::new();

    for x in vec {
        n.push(x.parse().unwrap());
    }

    let mut ans: i32 = 0;
    for x in 1..n[0]+1{
        let mut cnt: i32 = 0;
        let mut tmp: i32 = x;
        while tmp != 0{
            cnt += tmp % 10;
            tmp = tmp / 10;
        }
        if cnt <= n[2] && cnt >= n[1] {ans += x};
    }

    println!("{}", ans);

}


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

int main(){
    int n,c;
    long long ave = 0;
    
    cin >> n;
    for(int i = 0 ; i < n ; i++){
        cin >> c;
        ave += c;
    }
    cout << (int)(ave/n) << endl;
    
    return 0;
}

Measured memory_bytes: 1156
#!/usr/bin/env python3
import heapq

h, w = map(int, input().split())
cx, cy = map(lambda x: int(x) - 1, input().split())
dx, dy = map(lambda x: int(x) - 1, input().split())
s = [input() for _ in range(h)]
c = [[10**6] * w for _ in range(h)]


def bfs():
    d = ((1, 0), (-1, 0), (0, 1), (0, -1))
    d2 = (
        (-2, -2),
        (-2, -1),
        (-2, 0),
        (-2, 1),
        (-2, 2),
        (-1, -2),
        (-1, -1),
        (-1, 1),
        (-1, 2),
        (0, -2),
        (0, 2),
        (1, -2),
        (1, -1),
        (1, 1),
        (1, 2),
        (2, -2),
        (2, -1),
        (2, 0),
        (2, 1),
        (2, 2),
    )
    hp = []

    heapq.heappush(hp, (0, (cx, cy)))
    c[cx][cy] = 0

    while hp:
        cp, (
            x,
            y,
        ) = heapq.heappop(hp)
        if (x, y) == (dx, dy):
            c[x][y] = cp
            break
        for i in range(4):
            nx = x + d[i][0]
            ny = y + d[i][1]
            if 0 <= nx < h and 0 <= ny < w and s[nx][ny] != "#" and c[nx][
                    ny] > cp:
                heapq.heappush(hp, (cp, (nx, ny)))
                c[nx][ny] = cp
        cp += 1
        for i in range(20):
            nx = x + d2[i][0]
            ny = y + d2[i][1]
            if 0 <= nx < h and 0 <= ny < w and s[nx][ny] != "#" and c[nx][
                    ny] > cp:
                c[nx][ny] = cp
                heapq.heappush(hp, (cp, (nx, ny)))

    return c[dx][dy] if c[dx][dy] < 10**6 else -1


print(bfs())


Measured memory_bytes: 102876
#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 all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  ll ans = 1;
  rep(i, n) {
    (ans *= (i+1)) %= mod;
  }
  cout << ans << "\n";
  return 0;
}


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


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
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 100010;

int main(){
    int n, m, q;
    scanf("%d%d%d", &n, &m, &q);
    int cnt[n+10][n+10];
    rep(i, n+10)rep(j, n+10) cnt[i][j] = 0;
    rep(i, m){
        int L, R;
        scanf("%d%d", &L, &R);
        ++cnt[L][R];
    }
    rep(i, n+10)rep(j, n+9) cnt[i][j+1] += cnt[i][j];
    rep(j, n+10)rep(i, n+9) cnt[i+1][j] += cnt[i][j];

    rep(_, q){
        int a, b;
        scanf("%d%d", &a, &b);
        printf("%d\n", cnt[b][b]-cnt[a-1][b]-cnt[b][a-1]+cnt[a-1][a-1]);
    }
}

Measured memory_bytes: 4784
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApp1
{
	class Program
	{
		static void Main(string[] args)
		{
			var input = Console.ReadLine().Split(' ')
				.Select(x => int.Parse(x))
				.ToArray();
			if (input[1] == 1)
			{
				Console.WriteLine("YES");
			}
			else if((input[0]+1)/2 >= input[1])
			{
				Console.WriteLine("YES");
			}
			else
			{
				Console.WriteLine("NO");
			}
		}
	}
}


Measured memory_bytes: 13268
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back

vector<int>adj[100001];
vector<int>vis(100001);
vector<int>in_degree(100001);
vector<int>dist(100001);

void dfs(int a){
	vis[a]=1;
	for(auto b:adj[a]){
		dist[b]=max(dist[b],dist[a]+1);
		in_degree[b]--;
		if(in_degree[b]==0){
			dfs(b);
		}
	}
}

int32_t main(){
	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,m,x,y,ans=0;
    cin>>n>>m;
    for(int i=0;i<m;i++){
    	cin>>x>>y;
    	adj[x].pb(y);
    	in_degree[y]++;
    }
    for(int i=1;i<=n;i++){
    	if(vis[i]!=1 && in_degree[i]==0){
    		dfs(i);
    	}
    }
    for(int i=1;i<=n;i++){
    	ans = max(ans,dist[i]);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 15564
n=int(input()) 
l=list(map(int,input().split())) 
dic_l={} 
lst_1=[] 
for i in range(n): 
	dic_l[l[i]]=i 
for j in range(1,n+1):
	lst_1.append(str(dic_l[j]+1)) 
print(" ".join(lst_1))

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

int main() {
    int W,H,x,y,r;
    cin >> W>>H>>x>>y>>r;

    if (x >= r && y >= r && x <= W-r && y <= H-r)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}



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

int main() {
    int N;
    cin>>N;
    vector<int> vec(N);
    for(int i=0;i<N;i++){
        cin>>vec.at(i);
    }
    sort(vec.begin(),vec.end());
    cout<<vec.at(N-1)-vec.at(0)<<endl;
}


Measured memory_bytes: 256
// https://atcoder.jp/contests/abc153/tasks/abc153_e

#include <bits/stdc++.h>

using namespace std;

#define ll long long 
#define REPL(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++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; }
#define radrad(a)  180.0 * a / M_PI
#define pow(x) x*x
static const int MAX = 10010;
static const ll INFTY = 1e12;
static const ll NUMMAX = 1000000007;
static const ll MOD = 1000000007;
#define LOOP 10000000
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

// 入力
int H, W;
vector<string> field;
int result = 100;
int dfs_res = 0;


typedef struct{
    int haba;
    int daiji;
} info;

int main() {

    int H, N;
    cin >> H >> N;
    vector<int> A(N), B(N);
    REP(i, N){
        cin >> A[i] >> B[i];
    }

    vector<vector<ll>> dp(N+1, vector<ll>(H+1, INFTY));

    dp[0][0] = 0;
    // DPループ
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j <= H; ++j) {
            chmin(dp[i+1][j], dp[i][j]);
            chmin(dp[i+1][min(j+A[i], H)], dp[i+1][j] + B[i]);
        }
    } 
    //REP(i, N+1){
    //    REP(j, H+1){
    //        cout << dp[i][j] << " ";
    //    } cout << endl;
    //}
    cout << dp[N][H] << endl;

    return 0;
}
/*
                   _ooOoo_
                  o8888888o
                  88" . "88
                  (| -_- |)
                  O\  =  /O
               ____/`---'\____
             .'  \\|     |//  `.
            /  \\|||  :  |||//  \
           /  _||||| -:- |||||-  \
           |   | \\\  -  /// |   |
           | \_|  ''\---/''  |   |
           \  .-\__  `-`  ___/-. /
         ___`. .'  /--.--\  `. . __
      ."" '<  `.___\_<|>_/___.'  >'"".
     | | :  `- \`.;`\ _ /`;.`/ - ` : | |
     \  \ `-.   \_ __\ /__ _/   .-` /  /
======`-.____`-.___\_____/___.-`____.-'======
                   `=---='
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
         pass System Test!
*/




Measured memory_bytes: 78592