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

#ifdef SG
	#include <debug.h>
#else
	template<typename T> struct outputer;
	struct outputable {};
	#define PRINT(...)
	#define OUTPUT(...)
	#define show(...)
	#define debug(...)
	#define deepen(...)
	#define timer(...)
	#define fbegin(...)
	#define fend
	#define pbegin(...)
	#define pend
#endif

#define ARG4(_1,_2,_3,_4,...) _4

#define forn3(i,l,r) for (int i = int(l); i < int(r); ++i)
#define forn2(i,n) forn3 (i, 0, n)
#define forn(...) ARG4(__VA_ARGS__, forn3, forn2) (__VA_ARGS__)

#define ford3(i,l,r) for (int i = int(r) - 1; i >= int(l); --i)
#define ford2(i,n) ford3 (i, 0, n)
#define ford(...) ARG4(__VA_ARGS__, ford3, ford2) (__VA_ARGS__)

#define ve vector
#define pa pair
#define tu tuple
#define mp make_pair
#define mt make_tuple
#define pb emplace_back
#define fs first
#define sc second
#define all(a) (a).begin(), (a).end()
#define sz(a) ((int)(a).size())

typedef long double ld;
typedef int64_t ll;
typedef uint64_t ull;
typedef uint32_t ui;
typedef uint16_t us;
typedef uint8_t uc;
typedef pa<int, int> pii;
typedef pa<int, ll> pil;
typedef pa<ll, int> pli;
typedef pa<ll, ll> pll;
typedef ve<int> vi;

template<typename T> inline auto sqr (T x) -> decltype(x * x) {return x * x;}
template<typename T1, typename T2> inline bool umx (T1& a, T2 b) {if (a < b) {a = b; return 1;} return 0;}
template<typename T1, typename T2> inline bool umn (T1& a, T2 b) {if (b < a) {a = b; return 1;} return 0;}

const int N = 500;
const int X = 1000000000;

struct Input {
	int n, m, x, y;
	
	bool read () {
		return !!(cin >> n >> m >> x >> y);
	}

	void init (const Input &input) {
		*this = input;
	}
};

struct Data: Input {
	bool res;
	int ans[N][N];
	
	void write () {
		if (!res) {
			puts("No");
			return;
		}
		puts("Yes");
		forn (i, n) {
			forn (j, m) {
				if (j) {
					printf(" ");
				}
				printf("%d", ans[i][j]);
			}
			puts("");
		}
	}
};


namespace Main {
	
	struct Solution: Data {
		
		void solve () {
			if (n % x) {
				forn (i, n) {
					forn (j, m) {
						if (i % x == 0) {
							ans[i][j] = X - 1;
						} else if (i % x == x - 1) {
							ans[i][j] = -X;
						} else {
							ans[i][j] = 0;
						}
					}
				}
				res = 1;
				return;
			}
			if (m % y) {
				forn (i, n) {
					forn (j, m) {
						if (j % y == 0) {
							ans[i][j] = X - 1;
						} else if (j % y == y - 1) {
							ans[i][j] = -X;
						} else {
							ans[i][j] = 0;
						}
					}
				}
				res = 1;
				return;
			}
			res = 0;
			return;
		}
		
		void clear () {
			*this = Solution();
		}
	};
}


Main::Solution sol;

int main () {
	cout.setf(ios::showpoint | ios::fixed);
	cout.precision(20);

	#ifdef SG
		freopen((problemname + ".in").c_str(), "r", stdin);
//		freopen((problemname + ".out").c_str(), "w", stdout);
		while (sol.read()) {
			sol.solve();
			sol.write();
			sol.clear();
		}
	#else
		sol.read();
		sol.solve();
		sol.write();
	#endif
	
	/*
	int t;
	cin >> t;
	forn (i, t) {
		sol.read();
		sol.solve();
		sol.write();
		sol.clear();
	}
	*/
	
	return 0;
}


Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	double n,k;
	cin>>n>>k;
	double ans=0;
	for(ll i=1;i<=n;i++){
		double now=i;
		double cnt=1/n;
		while(now<k){
			cnt/=2;
			now*=2;
		}
		ans+=cnt;
	}
	printf("%.10f",ans);
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
int main(void){
    int a,b;
    scanf("%d %d",&a,&b);
    while(a!=0 && b!=0){
        int board[16][16]={{0}};
        int m;
        scanf("%d",&m);
        for(int i=0;i<m;i++){
            int c,d;
            scanf("%d %d",&c,&d);
            board[c-1][d-1]=-1;
        }
        board[0][0]=1;

        for(int i=1;i<a;i++){
            if(board[i][0]!=-1){
                board[i][0]=board[i-1][0];
            }
            else{
                board[i][0]=0;
            }
            for(int j=1;j<b;j++){
                if(board[0][j]!=-1){
                    board[0][j]=board[0][j-1];
                }
                else{
                    board[0][j]=0;
                }
                if(board[i][j]==-1){
                    board[i][j]=0;
                }
                else{
                    board[i][j]=board[i-1][j]+board[i][j-1];
                }
            }
        }
        printf("%d\n",board[a-1][b-1]);
        scanf("%d %d",&a,&b);
    }
    return 0;
}

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

int mod = (int)1e9 + 7;
int INF = (int)2e18;

int fib[100005];

int mul(int a, int b) {
    return ((a % mod) * (b % mod)) % mod;
}

signed main() {
    fib[0] = 1;
    fib[1] = 1;
    for (int i = 2; i <= 100003; i++) {
        fib[i] = (fib[i - 1] + fib[i - 2]) % mod;
    }
    int N, M;
    cin >> N >> M;
    vector<int> a(M);
    for (int i = 0; i < M; i++) cin >> a[i];
    for (int i = 0; i < M - 1; i++) {
        if (a[i] + 1 == a[i + 1]) {
            cout << 0 << endl;
            return 0;
        }
    }
    int ans = 1;
    if (M == 0) {
        cout << fib[N] << endl;
        return 0;
    }
    for (int i = 0; i <= M; i++) {
        if (i == M) {
            ans = mul(ans, fib[N - a[i - 1] - 1]);
        } else if (i == 0) {
            ans = mul(ans, fib[a[0] - 1]);
        } else {
            ans = mul(ans, fib[a[i] - a[i - 1] - 2]);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
#include <cmath>

long N;
std::vector<int> primes;
std::vector<std::pair<int,int>> facts;

void solve();
int digits(long);
long forward(long);

int main()
{
  std::cin >> N;
  /*
  for (int i=1; i<=6; i++) {
    std::cout << "forward(" << i<< "): " << forward(i) << '\n';
  }
  */
  solve();
  return 0;
}

int digits(long x)
{
  if (x<=0) return 0;
  else return digits(x/10) + 1;
}

long forward(long digits)
{
  int ret = 1;
  for (int i=0; i<digits; i++) ret *= 10;
  return ret-1;
}

void solve()
{
  int ans = digits(N);
  if (!(N%2)) ans = digits(N/2);
  long i = 3;
  const long sq = std::sqrt(N) + 1;
  while (i <= sq) {
    //std::cout << i << "\n";
    //if (i==26010) std::cout << "Daole\n";
    if (!(N%i)) {
      int x = digits(N/i);
      //std::cout << i << "is a candidate\n";
      if (ans > x) {
        //std::cout << "Found: " << i << '\n';
        ans = x;
        //std::cout << "answer updated to " << ans <<  " by " << i << '\n';
        i = forward(digits(i));
        //std::cout << "Forwarded to: " << i << '\n';
      }
    }
    i += 1;
  }

/*
  std::cout << "listing up primes..." << '\n';
  if (!(N%2)) ans = digits(N/2);
  primes.push_back(2);
  for (int i=3; i <= N; i+=2) {
    auto iter=primes.begin();
    for (; iter!=primes.end(); iter++) {
      if (!(i%(*iter))) break;
    }
    if (iter==primes.end()) { // if new prime is found
      primes.push_back(i);
    }
  }

  std::cout << "factorizing..." << '\n';
  for (auto iter=primes.begin(); iter!=primes.end(); iter++) {
    int n = 0;
    int N_copied = N;
    while (!(N_copied%(*iter))) {
      n++;
      N_copied /= *iter;
    }
    if (n>0) facts.push_back(std::make_pair(*iter, n));
  }

  auto iter = facts.begin();
  for (; iter!=facts.end(); iter++) {
    std::cout << (*iter).first << ": " << (*iter).second << '\n';
  }
*/

/*
  if (!(N%2)) ans = digits(N/2);
  for (int i=3; i*i <= N; i+=2) {
    if (!(N%i)) {
      int x = digits(N/i);
      //std::cout << i << ": " << N/i << '\n';
      if (ans > x) ans = x;
    }
  }
*/
  std::cout << ans << '\n';
}



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

int main() {
  int a,b,h,m;cin>>a>>b>>h>>m;
  double pi=acos(-1);
  double th=(double)(h*60+m)/720*2*pi;
  double tm=(double)m/60*2*pi;
  double x1=a*cos(th),y1=a*sin(th);
  double x2=b*cos(tm),y2=b*sin(tm);
  double dx=x1-x2,dy=y1-y2;
  double ans=sqrt(dx*dx+dy*dy);
  cout<<fixed<<setprecision(10)<<ans<<endl;
}

Measured memory_bytes: 4068
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
typedef pair<int,int> PP;
typedef long long ll;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false


signed main(void){
    int R;
    cin >> R;
    double Ans = 2*R;
    Ans *= PI;
    printf("%.8f\n",Ans);
    
    return 0;
}



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

int main() {
  int N;
  cin >> N;
  vector<int> v(N);
  vector<int> c(N);
  for (int &vn : v) cin >> vn;
  for (int &cn : c) cin >> cn;
  
  int sum = 0;
  for (int i = 0; i < N; i++) {
    if (v[i] - c[i] > 0)
      sum += v[i] - c[i];
  }
  cout << sum << endl;  
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<(n);i++) 
using namespace std;
int main() {
    long long H;
    cin >> H;
    long long sam = 0;
     int b=0;
    while (H != 0) {
        H = H / 2;
        b++;
        sam += pow(2,b-1);
    }
    cout << sam;
}

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


{

    long long int a,b,i,j,k,c,temp;

    cin>>a>>b;
    if(a>b)

    {
        temp=a;
        a=b;
        b=temp;
    }



    for(i=a; i<=b; i++)

    {


        if(abs(a-i)==abs(b-i))
        {

            c=1;
            break;
        }
        else
            c=0;

    }

    if(c==0)
        cout<<"IMPOSSIBLE"<<endl;
    else if(c==1)
        cout<<i<<endl;





    return 0;
}


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


int main()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int k;
    cin>>k;
    string s;
    cin>>s;
    if(k>=s.size()) cout<<s;
    else{
        for (int i = 0; i < k; i++){
            cout << s[i];
        }
        cout << "...";
    }
    
    
    
    
}

Measured memory_bytes: 3576
#include <set>
#include <array>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <vector>
#include <tuple>
#include <string>
#include <math.h>
#include <time.h>
#include <bitset>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <limits>
#include <climits>
#include <numeric>
#include <functional>

#define lnd '\n'
// #define reverse(i, n) for(ll i = n-1; i >= 0; --i)
#define from(i, n) for (ll i = 0; i < n; ++i)
#define loop(i, n) for(ll i = 0; i < n; i++)
#define REPN(i, n) for (ll i = 1; i <= n; ++i)
#define ALL(s) (s).begin(), (s).end()
#define rALL(s) (s).rbegin(), (s).rend()
#define sz(s) (int)(s).size()
#define mk make_pair
#define pb push_back
#define sqr(s) ((s) * (s))

using namespace std;

typedef long long ll;
typedef long long int lli;
typedef long double ld;
typedef unsigned long long ull;
typedef unsigned int ui;

template <class T>
T GCD (T a, T b) {
  if(a == 0) return b;
  return GCD(b%a, a);
}

template <class T>
T LCM(T a, T b){
  return a*b/GCM(a,b);
}

template <class T>
T modpow(T x, T p){
    T res = 1;
    while(p > 0){
        if(p&1) res *= x;
        x *= x;
        p /= 2;
    }
    return res;
}

template <class T>
T modpow(T x, T p, ll mod){
    T res = 1;
    while(p > 0){
        if(p&1) res = (res*x)%mod;
        x = (x*x)%mod;
        p /= 2;
    }
    return res%mod;
}

template <class T>
void print(T a[], ll n){
    for (ll i = 0; i < n; i++) std::cout << a[i] << ' ';
    cout << endl;
}

template<class T>
void printc(T c){
    for(auto const& v: c) std::cout << v << ' ';
    cout << endl;
}

struct HASH{
  size_t operator()(const pair<long,long>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};

bool pair_sort(const pair<int, int> &p1, const pair<int,int> &p2){
    if(p1.first != p2.first) return p1.first < p2.first;
    else return p1.second < p2.second;
}

const int INF = std::numeric_limits<int>::max();
const ll M_INF = std::numeric_limits<ll>::min();
const ll LL_INF = std::numeric_limits<ll>::max();

void solution();
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    solution();
    return 0;
}

ll result[200005] = {0};
void fact(ll n) {
   if (n >= 0) {
      result[0] = 1;
      for (ll i = 1; i <= n; ++i) {
         result[i] = i * result[i - 1];
      }
   }
}

void solution(){
  int n;
  cin >> n;
  set<string> draws;
  loop(i, n){
    string s;
    cin >> s;
    draws.insert(s);
  }

  cout << draws.size() << endl;
}     



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

#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define intll int long long
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
  int n ;
  cin >> n ;
  vector<intll> A(n+1) , B(n) ;
  
  rep(i,n+1) cin >> A.at(i) ;
  rep(i,n)   cin >> B.at(i) ;
  
  intll ans = 0;
  rep(i,n){
   if(B.at(i) >= A.at(i)){
     if(A.at(i+1) >=  B.at(i) - A.at(i)){
       A.at(i+1) -= B.at(i) -A.at(i);
       ans += B.at(i) ;
      
     }
     else {
       ans += A.at(i) + A.at(i+1);
       A.at(i+1) = 0 ;
  
     }
   }
   else {
     ans += B.at(i) ;
   }
  }
    
    cout << ans ;
    
     


}


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

using namespace std;

#define endl '\n'
#define ll long long

const ll mod = 1e9 + 7;
const ll maxn = 1e5 + 5;
const double pi = 3.1415926535897932384626433832795028841971693993751058209749445923078;
//iostream::sync_with_stdio(false);

int main()
{
    string s;
    cin >> s;
    if(s[2] == s[3] && s[4] == s[5] &&s[2] > 96 && s[4] > 96)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}



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

using namespace std;

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

	int X;

	cin >> X;

	int ans = 0;
	for (; X > 0; X -= ++ans);

	cout << ans << '\n';

	return 0;
}


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

if(n%2 == 1):
    print("No")
else:
    flag = False
    for i in range(n//2):
        if(s[i] != s[i+n//2]):
            flag = True
            print("No")
    
    if(flag == False):
        print("Yes")

Measured memory_bytes: 3060
n = int(input())
ans = 0
for i in range(n+1):
    t = 0
    if i % 2 == 0:
        continue
    else:
        for j in range(i+1):
            if j != 0:
                if i % j == 0:
                    t += 1
    if t == 8:
        ans += 1
print(ans)

Measured memory_bytes: 2940
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;

//vector string deque break continue
#define forn(i, s, f) for (int i = (int)s; i < (int)f; i++)
#define ll long long
#define ull unsigned long long
#define ld long double
#define pii pair <int, int>
#define fs first
#define sc second
#define pf push_front
#define pb push_back
#define pop_f pop_front
#define pop_b pop_back
#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()

template <typename T> istream& operator>>(istream& in, vector <T>& a) {for (auto& i : a) in >> i; return in;}
template <typename T> ostream& operator<<(ostream& out, vector <T>& a)  {for (auto& i : a) out << i << " "; return out;}
template <typename T, typename U> void chkmin(T& a, U b) {if (a > b) a = b;}
template <typename T, typename U> void chkmax(T& a, U b) {if (a < b) a = b;}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    string s;
    cin >> s;
    deque <char> a;
    for (char c : s)
        a.pb(c);
    int i = 0;
    int q;
    cin >> q;
    while (q --> 0) {
        int type;
        cin >> type;
        if (type == 1)
            i = (i + 1) % 2;
        else {
            int f;
            char c;
            cin >> f >> c;
            if (f == 1) {
                if (i == 0)
                    a.push_front(c);
                else
                    a.push_back(c);
            } else {
                if (i == 0)
                    a.push_back(c);
                else
                    a.push_front(c);
            }
        }
    }
    if (i != 0)
        reverse(all(a));
    for (char c : a)
        cout << c;
    return 0;
}

Measured memory_bytes: 976
# https://atcoder.jp/contests/abc073/tasks/abc073_b

import itertools
import collections
import bisect

def main():
    N = int(input())
    ans = 0
    for _ in range(N):
        l, r = map(int, input().split())
        ans += r - l + 1
    print(ans)

    
if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define IOS ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
#define fi first
#define se second
#define pf push_front
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define debug(val) cerr << "Value " << #val << " : " << val << '\n';
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
const ll mod = 1e9 + 7;
const ll inf = 0x3f3f3f3f;
const ld epsilon = 10e-9;
const ll nax = 0;
ll x;
	
int main(void){
	IOS
	cin >> x;
	for(int i=1;;i++){
		if(i*x%360==0){ 
			cout << i << '\n';
			return 0;
		}
	}
}


Measured memory_bytes: 3588
// https://atcoder.jp/contests/abc173/tasks/abc173_b

#include "algorithm"
#include "bitset"
#include "cmath"
#include "functional"
#include "iomanip"
#include "iostream"
#include "map"
#include "numeric"
#include "queue"
#include "set"
#include "string"
#include "vector"
#define rep(i, to) for (ll i = 0; i < (to); ++i)
#define rep1(i, to) for (ll i = 1; i <= (to); ++i)
#define repf(i, from, to) for (ll i = from; i < (to); ++i)
#define repr(i, from) for (ll i = from - 1; i >= 0; --i)
#define all(vec) vec.begin(), vec.end()
#define unless(cond) if (!(cond))
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
template <typename T>
using V = vector<T>;
using VL = V<ll>;
using VVL = V<VL>;
template <typename T, typename U>
using P = pair<T, U>;
using PL = P<ll, ll>;
using VPL = V<PL>;

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

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

template <typename T>
inline ll len(V<T> arr) {
  return arr.size();
}

struct exit_exception : public std::exception {
  const char* what() const throw() { return "Exited"; }
};

template <typename T>
void drop(T res) {
  cout << res << endl;
  throw exit_exception();
}

const ll INF = 1e18;

void solve();

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

  try {
    solve();
  } catch (exit_exception& e) {
  }

  return 0;
}
#endif

void solve() {
  ll N;
  cin >> N;

  map<string, ll> mp;

  rep(i, N) {
    string r;
    cin >> r;
    mp[r]++;
  }

  cout << "AC x " << mp["AC"] << "\n";
  cout << "WA x " << mp["WA"] << "\n";
  cout << "TLE x " << mp["TLE"] << "\n";
  cout << "RE x " << mp["RE"] << "\n";
}


Measured memory_bytes: 3640
import sys
from fractions import gcd
import bisect
 
stdin = sys.stdin
 
ns = lambda: stdin.readline().rstrip()
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
s = lambda h: [list(map(int, stdin.readline().split())) for i in range(h)]

n, l = na()
st = []
for i in range(n):
        st.append(ns())
st.sort()
print(*st, sep='')

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

typedef long long ll;
#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define REPM(i,n) for(ll i=(n); 0<=i; i--)
#define VI vector<int>
#define VL vector<ll>
#define VD vector<double>
#define VS vector<string>
#define V_SORT_U(x) sort(x.begin(), x.end());                   //昇順
#define V_SORT_D(x) sort(x.begin(), x.end(),greater<int>());    //降順
#define V_SUM(x) accumulate(x.begin(), x.end(), 0)
#define STR_TRANS_UP(x) transform(x.begin(), x.end(), x.begin(), ::toupper); 
#define STR_TRANS_LOW(x) transform(x.begin(), x.end(), x.begin(), ::tolower);
#define SetPre(x) setprecision(x)

int main(void){
    char alpha;
    cin >> alpha;
    string result;
    switch(alpha)
    {
        case 'a':
        result = "a";
        case 'b':
        result = "a";
        case 'c':
        result = "a";
        case 'd':
        result = "a";
        case 'e':
        result = "a";
        case 'f':
        result = "a";
        case 'g':
        result = "a";
        case 'h':
        result = "a";
        case 'i':
        result = "a";
        case 'j':
        result = "a";
        case 'k':
        result = "a";
        case 'l':
        result = "a";
        case 'm':
        result = "a";
        case 'n':
        result = "a";
        case 'o':
        result = "a";
        case 'p':
        result = "a";
        case 'q':
        result = "a";
        case 'r':
        result = "a";
        case 's':
        result = "a";
        case 't':
        result = "a";
        case 'u':
        result = "a";
        case 'v':
        result = "a";
        case 'w':
        result = "a";
        case 'x':
        result = "a";
        case 'y':
        result = "a";
        case 'z':
        result = "a";
        break;
        default:
        result = "A";
        
    }
    cout << result;
    
    return 0;
}

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

    int n; cin >> n;
    string s; cin >> s;
    vector<int> h(n + 1);
    for (int i = 0; i < n; i++) h[i + 1] = h[i] + (s[i] == '(' ? 1 : -1);
    int m = -*min_element(h.begin(), h.end());
    for (int i = 0; i < m; i++) cout << '(';
    cout << s;
    for (int i = 0; i < h[n] + m; i++) cout << ')';
    cout << '\n';
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, raw_input().split())
ab = [map(int, raw_input().split()) for _ in xrange(N)]
cd = [map(int, raw_input().split()) for _ in xrange(M)]

for i in xrange(N):
    mi = -1
    mv = float('inf')
    for j in xrange(M):
        dist = abs(ab[i][0]-cd[j][0]) + abs(ab[i][1]-cd[j][1])
        if dist < mv:
            mv = dist
            mi = j
    print mi+1


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

using namespace std;

int main() {
    string s, p;
    cin >> s >> p;
    bool found = false;
    if (s.length() < p.length()) {
        cout << "No" << endl;
        return 0;
    }
    for (int i = 0; i < s.length(); i++) {
        string a;
        if (s.length() - i < p.length()) {
            a = s.substr(i) + s.substr(0, p.length() - (s.length() - i));
        } else {
            a = s.substr(i, p.length());
        }
        if (a == p) {
            found = true;
            break;
        }
    }
    if (found) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}



Measured memory_bytes: 3216
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>

int main(void){
    int i, AC=1, C=0;
    char S[15];
    scanf("%s", S);
    if(S[0]!='A')AC=0;
    for(i=2; i<=strlen(S)-2; i++){
        if(S[i]=='C') C++;
    }
    if(C!=1)AC=0;
    C=0;
    for(i=0; i<strlen(S); i++){
        if(S[i]-'Z' <= 0)C++;
    }
    if(C!=2)AC=0;
    if(AC) printf("AC\n");
    else printf("WA\n");
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <math.h>

int main(void) {

  long n;
  scanf("%ld", &n);
  long m,k;
  long sum = 0;
  for (k = 1; k <= sqrt(n); k++) {
    if (n%k == 0) {
      m = (n/k)-1;
      if (m > k) {
        sum += m;
      }
    }
  }
  printf("%ld\n", sum);

  return 0;
}

Measured memory_bytes: 128
import sys

def solve():
    input = sys.stdin.readline
    N, K = map(int, input().split())
    S = []
    for _ in range(N):
        t, d = map(int, input().split())
        S.append((d, t))
    S.sort(reverse = True)
    upperKCount = 0
    appeared = set()
    maxPoint = 0
    for i in range(K):
        maxPoint += S[i][0]
        if S[i][1] not in appeared:
            upperKCount += 1
            appeared |= {S[i][1]}
    maxPoint += upperKCount ** 2
    appeared = set()

    typeMax = []
    typeNum = 0
    typeLower = []
    others = 0
    for d, t in S:
        if t in appeared: 
            typeLower.append(d)
            others += 1
        else:
            typeMax.append(d)
            typeNum += 1
            appeared |= {t}
    typeMaxSum = [0] * (typeNum + 1)
    typeLowerSum = [0] * (others + 1)
    for i in range(typeNum): typeMaxSum[i+1] = typeMaxSum[i] + typeMax[i]
    for i in range(others): typeLowerSum[i+1] = typeLowerSum[i] + typeLower[i]
    for k in range(upperKCount + 1, min(typeNum, K) + 1):
        maxPoint = max(maxPoint, k ** 2 + typeMaxSum[k] + typeLowerSum[K - k])
    print(maxPoint)
    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 28604
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;
using ll = long long;

int main() {
    ll N, X, s = 0;
    cin >> N >> X;
    vector<ll> L(N);
    for (auto& l : L) cin >> l;
    for (int i = 0; i < N; i++) {
        s += L[i];
        if (s > X) {
            cout << i + 1 << endl;
            return 0;
        }
    }
    cout << N + 1 << endl;
    return 0;
}

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

idx = max(enumerate(H), key=lambda x: x[1])[0]

cmp = H[idx]-1
flg = 0

if N>1:
    if idx!=N-1:
        for i in range(idx, N):
            if H[i]<cmp:
                flg = 1
        if flg==0:
            print('Yes')
        else:
            print('No')

    else:
        idx = max(enumerate(H[0:N-1]), key=lambda x: x[1])[0]
        cmp = H[idx]-1
        flg = 0
        for i in range(idx, N-1):
            if H[i]<cmp:
                flg = 1
        if flg==0:
            print('Yes')
        else:
            print('No')
else:
    print('Yes')

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

int main()
{
    long long  n,m,a;
    while(scanf("%lld %lld",&n,&m)==2)
    {
        //a=0;
        if(n==1&&m==1)
            a=1;
        else if(n==1)
            a=m-2;
        else if(m==1)
            a=n-2;
        else if(m==2||n==2)
            a=0;
        else
        {
            a=(n-2)*(m-2);
        }
        printf("%lld\n",a);
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
long long  n,k;
int main(){
    ios::sync_with_stdio(false);
    cin>>n>>k;
    if(k&1){
        cout<<(n/k)*(n/k)*(n/k)<<endl;
    } else{
        if(n%k>=k/2)
            cout<<(n/k)*(n/k)*(n/k)+(n/k+1)*(n/k+1)*(n/k+1)<<endl;
        else
            cout<<2*(n/k)*(n/k)*(n/k)<<endl;
    }
}



Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int a, b , c;

bool solve() {
    return a == b && b == c;
}

void input() {
    cin >> a >> b >> c;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    cout << (solve()?"Yes":"No") << endl;
}


Measured memory_bytes: 256
def f(n):
  a=[];f=2
  while f*f<=n:
    if n%f==0:a.append(f);n//=f
    else:f+=1
  if n!=1:a.append(n)
  return set(a)
s=[2];n=int(input())
for L in range(3,n+1):
  c=True
  for M in s:
    if L%M==0:c=False
  if c==True:s.append(L)
A=[int(input())for i in range(n+1)]
P=sorted(list(set(s)|f(abs(A[0]))))
for p in P:
  B=A[0:n+2];b=0
  for j in range(n+1):
    if p+j<n+1:B[j+p-1]=(B[j+p-1]+B[j])%p
    elif B[j]%p!=0:b=1;break
  if b==0:print(p)

Measured memory_bytes: 49116
using System;

namespace arc059_b
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            bool ret = false;
            for (int i = 1; i < s.Length && !ret; i++)
            {
                if (s[i - 1] == s[i])
                {
                    ret = true;
                    Console.WriteLine(i + " " + (i + 1));
                }
            }
            for (int i = 2; i < s.Length && !ret; i++)
            {
                if (s[i - 2] == s[i])
                {
                    ret = true;
                    Console.WriteLine((i - 1) + " " + (i + 1));
                }
            }
            if (!ret)
            {
                Console.WriteLine("-1 -1");
            }
        }
    }
}

Measured memory_bytes: 13140
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:u64 = read();
    let mut ans = 0;
    for i in 0..=n {
        let remainder = i%15;
        //println!(" {:?} mod 15 = {:?}",i,remainder);
        ans += match remainder{
            0 => 0,
            3 => 0,
            5 => 0,
            6 => 0,
            9 => 0,
            10 => 0,
            12 => 0,
            _ => i,
        }
    }

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


Measured memory_bytes: 2140
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    cin >> n;
    long long a[n + 1];
    long long b[n + 1];
    for (int i = 0; i < n + 1; i++)
    {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++)
    {
        cin >> b[i];
    }
    long long kill_num = 0;
    for (int i = 0; i < n; i++)
    {
        kill_num += min(a[i], b[i]);
        b[i] -= min(a[i], b[i]);
        kill_num += min(a[i + 1], b[i]);
        a[i + 1] -= min(a[i + 1], b[i]);
    }

    cout << kill_num << endl;

    return 0;
}

Measured memory_bytes: 1792
using System.Linq;
using static System.Math;
using static System.Console;
class Z { static void Main() => new K(); }
class K
{
	int[] G() => ReadLine().Split().Select(int.Parse).ToArray();
	public K()
	{
		var N = int.Parse(ReadLine());
		var t = G();
		var v = G();
		var V = v.Max();
		// dp[n, v] = t[0]+...+t[n-1] を走り終えたときに速度が v/2 である場合の、そこまでの最大の走行距離 * 16
		// その速度に到達できなければ dp[n, v] = -1 とする
		// 答えは dp[N, 0] / 16
		var dp = new int[N + 1, 2 * V + 1];
		dp[0, 0] = 0;
		// dp[n, v] >= 0 となる v の最大値を M[n] とする
		var M = new int[N + 1];
		for (var i = 1; i <= 2 * V; i++) dp[0, i] = -1;
		for (var n = 0; n < N; n++)
		{
			M[n + 1] = Min(M[n] + 2 * t[n], 2 * v[n]);
			for (var w = M[n + 1] + 1; w <= 2 * V; w++) dp[n, w] = -1;
			for (var w = 0; w <= M[n + 1]; w++)
			{
				for (var u = 0; u <= M[n]; u++)
				{
					// dp[n, u] => dp[n+1, w]
					if (u - 2 * t[n] > w || u + 2 * t[n] < w) continue;
					int au = 2 * v[n] - u,  bw = 2 * v[n] - w, run;
					// 時間に余裕があれば、加速して速度キープして減速
					if (au + bw <= 2 * t[n]) run = 2 * (8 * t[n] * v[n] - au * au - bw * bw);
					// 加速して減速、最大速度は x/4 (< v[n]) までしか到達できない
					else
					{
						var x = 2 * t[n] + u + w;
						run = x * x - 2 * (u * u + w * w);
					}
					dp[n + 1, w] = Max(dp[n + 1, w], dp[n, u] + run);
				}
			}
		}
		WriteLine(dp[N, 0] / 16m);
	}
}


Measured memory_bytes: 13436
_input_list = list(map(int, input().split(" ")))
a = _input_list[0]
b = _input_list[1]
c = _input_list[2]
d = _input_list[3]

alice_push_time = set(list(range(a, b + 1))) 
bob_push_time = set(list(range(c, d + 1)))

both_push_time = len(alice_push_time & bob_push_time)


if both_push_time > 0:
  both_push_time -= 1
print(both_push_time)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long 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;
}



int main(){
    ll a,b,k;
    cin >> a >> b >> k;
    if(a - k <0){
        k -= a;
        a = 0;
        if(b - k <0){
            b = 0;
        }
        else{
            b -= k;
        }
    }
    else{
        a -= k;
    }

    cout << a << " " << b << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define VI vector<int>
#define PII pair<int,int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define db double
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)x.size())
#define out(x) cout<<(#x)<<" = "<<x<<endl
mt19937 mrand(random_device{}());
const ll mod = 1000000007;
int rnd(int x){return mrand()%x;}
clock_t ac; double TLE(){return (double)(clock()-ac)/CLOCKS_PER_SEC;}

int main(){
 ios::sync_with_stdio(0);
 cin.tie(0);
 int n;
 cin>>n;
 if(n%1000==0)cout<<"0\n";
 else{
   int y = n/1000;
   int ans  = (y+1)*1000;
   cout<<ans-n<<"\n";
 }
}




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

int main(){
    int N;
    int a=0, w=0, t=0, r=0;
    string s;
    cin>>N;
    for (int i=0;i<N; i++){
        cin>>s;
        if (s=="AC"){
            a++;
        }
        else if (s=="WA"){
            w++;
        }
        else if (s=="TLE"){
            t++;
        }
        else if (s=="RE"){
            r++;
        }
    }
    cout<<"AC"<<" x "<<a<<endl;
    cout<<"WA"<<" x "<<w<<endl;
    cout<<"TLE"<<" x "<<t<<endl;
    cout<<"RE"<<" x "<<r<<endl;
    return 0;
}


Measured memory_bytes: 3604
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ld long double
#define INF 1000000000000000000
typedef pair<ll, ll> pll;
typedef pair<int, int> pint;

int main() {
    int N, M;
    cin >> N >> M;
    vector<ll> a(M), b(M), c(M, 0);
    vector<vector<ll>> dp(1100, vector<ll>(5000, INF));

    rep(i, M) {
        cin >> a[i] >> b[i];
        rep(j, b[i]) {
            int t;
            cin >> t;
            t--;
            c[i] += (1 << t);
        }
    }

    dp[0][0] = 0;
    for (int i = 0; i < M; i++) {
        for (int j = 0; j < (1 << N); j++) {
            dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);

            int nj = j | c[i];
            dp[i + 1][nj] = min(dp[i + 1][nj], dp[i][j] + a[i]);
        }
    }

    cout << (dp[M][(1 << N) - 1] < INF ? dp[M][(1 << N) - 1] : -1) << endl;
}

Measured memory_bytes: 46256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		List<Long> que = new ArrayList<>();
		for(int i = 1; i < 10; i++) {
			que.add((long) i);
		}
		int i = 0;
		while(que.size() < k) {
			long val = que.get(i);
			if(val % 10 != 0)
				que.add(10 * val + val % 10 - 1);
			que.add(10 * val + val % 10);
			if(val % 10 != 9)
				que.add(10 * val + val % 10 + 1);
			i++;
		}
		System.out.println(que.get(k - 1));

	}

}


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

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  vector<int> b(N);
  
  // N個の入力をN要素の配列bに受け取る
  for (int i = 0; i < N; i++) {
    cin >> b.at(i);
  }
  
  // 配列aを定義。小さい順
  for (int i = 0; i < N; i++) {
    a.at(i) = i + 1;
  }
  /*
  a: 1 2 3 4 5 6
  b: 6 3 4 2 1 5
  c: 5 4 2 3 6 1
  */

  int order = 0;
  
  for (int i=0; i<N; i++) {
    order = b.at(i);
    a.at(order-1) = i+1; 
  }
  
  for (int i=0; i<N; i++) {
    cout <<a.at(i) <<" ";
  }
}

Measured memory_bytes: 1536
N = int(input())

A = list(map(int, input().split()))

A.sort(reverse=True)

cnt = 0
x = [0] * 2

i = 0

while i < N-1:
  #print(i)
  if A[i] == A[i+1]:
    x[cnt] = A[i]
    i += 2
    cnt += 1
  else:
    i += 1
  
  if cnt >= 2:
    break
  
print(x[0]*x[1])

  

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

void Main() {
  int N, C;
  cin >> N >> C;

  int D[C][C];
  for (int i = 0; i < C; i++) {
    for (int j = 0; j < C; j++) {
      cin >> D[i][j];
    }
  }

  int c[N][N];
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      cin >> c[i][j];
      c[i][j]--;
    }
  }

  int num[3][C];
  memset(num, 0, sizeof(num));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      num[(i + 1 + j + 1) % 3][c[i][j]]++;
    }
  }

  long long ans = 99999999999;
  for (int i = 0; i < C; i++) {
    for (int j = 0; j < C; j++) {
      for (int k = 0; k < C; k++) {
        if (i == j || i == k || j == k) continue;
        long long tmp = 0;
        for (int l = 0; l < C; l++) {
          if (l != i) tmp += D[l][i] * num[0][l];
          if (l != j) tmp += D[l][j] * num[1][l];
          if (l != k) tmp += D[l][k] * num[2][l];
        }
        ans = min(ans, tmp);
      }
    }
  }
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}



Measured memory_bytes: 1280
n,k = map(int,input().split())
h = list(map(int,input().split()))
# ジェットコースターの乗れる人の数
able_num = 0
# リスト内の数字を取り出して、ｋより大きければ乗れる人をカウントアップ
for i in h:
    if i >= k:
        able_num += 1
print(able_num)

Measured memory_bytes: 18572
#include <stdio.h>

#define BUF_SIZE 256

int main(void) {
	char buf[BUF_SIZE];
	int d, sum=0;
	int i;
	
	while (fgets(buf, sizeof(buf), stdin) != NULL) {
		sscanf(buf, "%d", &d);
		
		for (i=1; i*d<=600-d; i++) {
			sum+= i*d*i*d*d;
		}
		
		printf("%d\n", sum);
		sum=0;
	}
	
	return 0;
}

Measured memory_bytes: 1036
n, k = map(int, input().split())
s = input()
happy = 0
try1 = 0
for i in range(n - 1):
    if s[i] == s[i + 1]:
        happy += 1
while happy <= n - 2 and try1 < k:
    if happy <= n - 3:
        happy += 2
    else:
        happy += 1
    try1 += 1
print(int(happy))

Measured memory_bytes: 3316
import heapq

def solve():
    N,K = map(int, input().split())
    nums = []
    num_dict = {}
    for _ in range(N):
        a,b = map(int, input().split())
        if a not in num_dict:
            heapq.heappush(nums, a)
            num_dict[a] = b
        else:
            num_dict[a] += b
            
    ret = 0
    while K>0:
        ret = heapq.heappop(nums)
        
        K -= num_dict[ret]
        
    print(ret)
    
solve()

Measured memory_bytes: 10768
n = int(input())
d = len(str(n))

if d % 2 == 1:
  ans = (100 ** ((d-1)//2) - 1) // 11 + (n - 10**(d-1) + 1)
else:
  ans = (100**(d//2) - 1) // 11
  
print(ans)

Measured memory_bytes: 3060
while data = gets
  a = data.chomp.split
  6.times do |i|
    a[i] = a[i].to_f
  end
  d = a[0]*a[4]-a[1]*a[3]
  x = ((a[2]*a[4]-a[1]*a[5])*1000).round/d/1000
  y = ((-a[2]*a[3]+a[0]*a[5])*1000).round/d/1000 
  x = 0 if -0.001 < x && x < 0.001
  y = 0 if -0.001 < y && y < 0.001
  printf("%.3f %.3f\n", x, y) 
end

Measured memory_bytes: 6164
/* 
	بسم الله الرحمن الرحیم
	
	(; طلا یک جهانی
*/

#include <bits/stdc++.h>
using namespace std;

const int MAX_N = 2000 + 5;
int n, m;
bool p[MAX_N];
vector<int> s[MAX_N];

void read_input() {
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int k;
		cin >> k;
		s[i].resize(k);
		for (int j = 0; j < k; j++)
			cin >> s[i][j], s[i][j]--;
	}
	for (int i = 0; i < m; i++)
		cin >> p[i];
}

void solve() {
	int ans = 0;
	for (int msk = 0; msk < 1 << n; msk++) {
		bool ok = true;
		for (int i = 0; i < m; i++) {
			bool q = 0;
			for (int j: s[i])
				q ^= msk >> j & 1;
			ok &= q == p[i];
		}
		ans += ok;
	}
	cout << ans;
}

int main() {
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	read_input();
	solve();
}


Measured memory_bytes: 256
#include <iostream>
#include<string>

using namespace std;

int main()
{   char op;
   int A,B,s;
   cin>>A>>op>>B;
   if (op=='+'){
      s=A+B;
   }
    else{
        s=A-B;
    }
    cout<<s;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
using namespace std;

int main(){
	int n,m;
	cin >> n >> m;
	vector<pair<int,int> > xy(n);
	for(int i=0; i<n; i++){
		int x,y;
		cin >> x >> y;
		xy[i] = make_pair(x,y);
	}
	sort(xy.begin(), xy.end());
	
	for(int q=0; q<m; q++){
		int x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		int count=0;
		vector<pair<int,int> >::iterator it;
		it = lower_bound(xy.begin(), xy.end(), make_pair(x1, (int)-1e9-1));
		for(int i=it-xy.begin(); i<n; i++){
			if(xy[i].first > x2) break;
			if(y1<=xy[i].second && xy[i].second<=y2){
				count++;
			}
		}
		cout << count << endl;
	}
	return 0;
}

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

int main(){
    ll n, m, x; cin >> n >> m >> x;
    vector<ll> cost(n);
    vector<vector<ll>> g(n, vector<ll> (m));

    rep(i,n){
        cin >> cost[i];
        rep(j,m){
            cin >> g[i][j];
        }
    }

    ll ans = 1002003004005006007;
    for(int bit = 0; bit < (1 << n); bit++){
        vector<ll> jud(m,0);
        ll tmp = 0;

        rep(i,n){
            if(bit & (1 << i)){
                tmp += cost[i];
                rep(j,m){
                    jud[j] += g[i][j];
                }
            }
        }

        bool ok = true;
        rep(i,m){
            if(jud[i] < x) ok = false;
        }

        if(ok) ans = min(ans, tmp);

    }
    if(ans != 1002003004005006007){
        cout << ans << endl;
        return 0;
    }

    cout << -1 << endl;

}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

int h[255], m[255];

void solve() {
  for (int c = 'a'; c <= 'z'; ++c) h[c] = m[c] = -1;
  string s; cin >> s;
  int n = s.size(), ans = 1e9;
  for (int i = 0; i < n; ++i) {
    m[s[i]] = max(m[s[i]], i-h[s[i]]-1);
    h[s[i]] = i;
  }
  for (char c = 'a'; c <= 'z'; ++c) {
    if (m[c] == -1) continue;
    ans = min(ans, max(m[c], n-1-h[c]));
  }
  printf("%d", ans);
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 256
n, m, l = map(int, input().split())
a = []
b = []

for i in range(n):
    a.append(list(map(int, input().split())))
for j in range(m):
    b.append(list(map(int, input().split())))

for i in range(n):
    li = []
    for j in range(l):
        su = 0
        for k in range(m):
            su += a[i][k] * b[k][j]
        li.append(su)
    print(" ".join(list(map(str, li))))



Measured memory_bytes: 6248
a,b,c,d=map(int,list(input()))
for i in range(2):
    for j in range(2):
        for k in range(2):
            if a+(i*2-1)*b+(j*2-1)*c+(k*2-1)*d==7:
                print(a,'-+'[i],b,'-+'[j],c,'-+'[k],d,'=7',sep='')
                exit()

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

int main(){
    int a[4], b[4];
    while(cin >> a[0] >> a[1] >> a[2] >> a[3]
              >> b[0] >> b[1] >> b[2] >> b[3] ){
        int hit = 0, blow = 0;
        for(int i = 0; i < 4; i++){
            for(int j = 0; j < 4; j++){
                if(a[i] == b[j]){
                    if(i == j){
                        hit++;
                    }else{
                        blow++;
                    }
                }
            }
        }
        cout << hit << ' ' << blow << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define pi 3.14159265359
int INF = 1000000000;

int main() {
  int N; cin >> N;
  cout << pow(N, 3) << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define loop(i,a,b) for(i=a;i<b;i++)
#define rloop(i,a,b) for(i=a;i>=b;i--)
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
const int inf=1000000001;
const ll INF=1e16;
#define MOD 1000000007
#define mod 1000000009
#define pi 3.14159265358979323846
static const int WHITE=0;
static const int GRAY=1;
static const int BLACK=2;
static const int N=101;

int n,tt=0;
vii M(N,vi(N,0));
vi color(N,WHITE),d(N),f(N),nt(N,0);

void dfs();
void dfs_visit(int);
int next(int);

int main(){
	int i,j,u,k,v;
	cin>>n;
	loop(i,0,n){
		cin>>u>>k;
		loop(j,0,k){
			cin>>v;
			M[u][v]=1;
		}
	}
	dfs();
}

void dfs(){
	int i;
	loop(i,1,n+1){
		if(color[i]==WHITE){
			dfs_visit(i);
		}
	}
	loop(i,1,n+1){
		cout<<i<<" "<<d[i]<<" "<<f[i]<<endl;
	}
}

void dfs_visit(int r){
	stack<int> s;
	s.push(r);
	color[r]=GRAY;
	d[r]=++tt;
	
	while(!s.empty()){
		int u=s.top();
		int v=next(u);
		if(v!=-1){
			if(color[v]==WHITE){
				color[v]=GRAY;
				d[v]=++tt;
				s.push(v);
			}
		}else{
			s.pop();
			color[u]=BLACK;
			f[u]=++tt;
		}
	}
}

int next(int u){
	int v;
	loop(v,nt[u]+1,n+1){
		nt[u]=v;
		if(M[u][v]){
			return v;
		}
	}
	return -1;
}

Measured memory_bytes: 3192
#include <stdio.h>
#define MAX 100

void push(int);
int pop();

int top = 0, S[MAX];

int main()
{
  int  x, y, z;
  char a[MAX];

  while(scanf("%s",a) != EOF){
    if(a[0] == '+'){
      x = pop();
      y = pop();
      push(y+x);
    }
    else if(a[0] == '-'){
      x = pop();
      y = pop();
      push(y-x);
    }
    else if(a[0] == '*'){
      x = pop();
      y = pop();
      push(y*x);
    }
    else{   
      push(atoi(a));
    }
  }
  
  printf("%d\n",pop());

  return 0;
}

void push(int x)
{
  top++;
  S[top] = x;
}

int pop()
{
  top--;
  return S[top+1];
}

Measured memory_bytes: 548
package main

import (
	"fmt"
)

func main() {
	var a, b, c, saidai, k int
	fmt.Scan(&a, &b, &c, &k)
	saidai = a
	if saidai < b {
		saidai = b
	}
	if saidai < c {
		saidai = c
	}
	m := a + b + c - saidai
	for i := 0; i < k; i++ {
		saidai *= 2
	}
	fmt.Println(saidai + m)
}


Measured memory_bytes: 512
#include <cstdio>

using namespace std;

int main()
{
	while (1){
		int hand[5];
		int state = 0;
		
		for (int i = 0; i < 5; i++){
			scanf("%d",hand + i);
			if (hand[i] == 0) return (0);
			state |= (1 << (hand[i] - 1));
		}
		
		if (__builtin_popcount(state) != 2){
			printf("3\n3\n3\n3\n3\n");
		}
		else {
			if (state == 5){
				for (int i = 0; i < 5; i++) printf("%d\n", hand[i] == 1 ? 2 : 1);
			}
			if (state == 6){
				for (int i = 0; i < 5; i++) printf("%d\n", hand[i] == 3 ? 2 : 1);
			}
			if (state == 3){
				for (int i = 0; i < 5; i++) printf("%d\n", hand[i] == 2 ? 2 : 1);
			}
		}
	}
}

Measured memory_bytes: 1044