akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define rep(i,a,n) for(int i=a;i<n;++i)
#define per(i,a,n) for(int i=n-1;i>=a;--i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define sz(x) ((int)x.size())
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)
const ll linf=1e18;
const int inf=1001001001;
const ll mod=1e9+7; // 998244353 = (119<<23)+1
// head
const int nax=1e5+7;
int n,m;
int s[nax];
map<int,int> add;
set<int> up;
int main() {
	  ios::sync_with_stdio(false);
  	cin.tie(0);
		cin>>n>>m;
		rep(i,0,n) cin>>s[i];
		rep(i,0,m) {
			int b,c;
			cin>>b>>c;
			add[c]+=b;
			up.insert(c);
		}
		auto it=up.end();
		--it;
		ll ans=0;
		sort(s,s+n);
		rep(i,0,n) {
			while(true) {
				if(add[*it]==0) {
					if(it==up.begin()) break;
					else --it;
				}
				else {
					if(*it<=s[i]) break;
					add[*it]--;
					s[i]=*it;
					break;
				}
			}
//			cout<<s[i]<<'\n';
			ans+=(ll)s[i];
		}
		cout<<ans;
		return 0;
}

Measured memory_bytes: 9984
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int operands[100];
int top = 0;
void push(int);
int  pop(void);
main(){
  int x, a, b;
  char s[1000000];
  while(scanf("%s", s) != EOF){
    switch(s[0]){
    case '+':
      a = pop();
      b = pop();
      top++;
      operands[top] = a + b;
      break;     
    case '-':
      a = pop();
      b = pop();
      top++;
      operands[top] = b - a;
      break;     
    case '*':
      a = pop();
      b = pop();
      top++;
      operands[top] = a * b;
      break;      
    default :
      x = atoi(s);
      push(x);
      break;
    }
  }
  printf("%d\n", operands[1]);
  return 0;
}

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

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

Measured memory_bytes: 556
def abc111_c():
    import collections
    
    b_len = int(int(input()) / 2)
    a = list(map(int, input().split()))
    b1 = a[::2]
    b2 = a[1::2]
    b1_count = collections.Counter(b1).most_common()
    b2_count = collections.Counter(b2).most_common()

    if len(b1_count) == 1:
        if len(b2_count) == 1:
            if b1_count[0][0] == b2_count[0][0]:
                return b_len
            else:
                return 0
        else:
            if b1_count[0][0] == b2_count[0][0]:
                return b_len - b2_count[1][1]
            else:
                return b_len - b2_count[0][1]
    elif len(b2_count) == 1:
        if b2_count[0][0] == b1_count[0][0]:
            return b_len - b1_count[1][1]
        else:
            return b_len - b1_count[0][1]
    else:
        if b1_count[0][0] == b2_count[0][0]:
            return 2 * b_len - max(b1_count[0][1] + b2_count[1][1], b1_count[1][1] + b2_count[0][1])
        else:
            return 2 * b_len - b1_count[0][1] - b2_count[0][1]


print(abc111_c())

Measured memory_bytes: 21084
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
#ifdef LOCAL_TEST
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
#endif
	int n;
	cin >> n;
	set<int> st;
	rep(i, n) {
		int a;
		cin >> a;
		if(st.count(a) > 0) st.erase(a);
		else st.insert(a);
	}
	cout << st.size() << endl;
	return 0;
}

Measured memory_bytes: 4864
#include<stdio.h>
int main(void)
{
  int ope;
  char str[8];
    
  fgets(str,sizeof(str),stdin);
  
  ope = str[0] - str[2];
  
  if(ope > 0)
  {
    puts(">");
  }else if(ope == 0)
  {
    puts("=");
  }else
  {
    puts("<");
  }
  return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int r, g, b;
  cin >> r >> g >> b;
  int n = r * 100 + g * 10 + b;
  if (n % 4 == 0) {
    cout << "YES" << endl;
  } else cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 3652
N = int(input())
h = list(map(int, input().split()))
h.append(0)

t = 0

def Water(n):
    global h
    while h[n] != 0:
        h[n] -= 1
        n += 1
        #print(h, t)

for i in range(N):
    while h[i] != 0:
        Water(i)
        t += 1

print(t)

Measured memory_bytes: 9132
n,m,x,y = map(int,input().split())
X = list(map(int,input().split()))
Y = list(map(int,input().split()))
X.append(x)
Y.append(y)
X.sort()
Y.sort()

for i in range(-100,100):
    if X[-1] < i <= Y[0]:
        print("No War")
        exit()

print("War")



Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,z[100009],zi,dp[100009];
vector <int> v[100009];
bool bo[100009];
void dfs(int q){
	bo[q]=1;
	for(vector <int>::iterator it=v[q].begin(); it!=v[q].end(); it++){
		if(bo[(*it)]==1) continue;
		dfs((*it));
	}
	z[zi]=q;
	zi--;
}
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>a>>b;
	for(c=1; c<=b; c++){
		cin>>d>>e;
		v[d].push_back(e);
	}
	zi=a;
	for(c=1; c<=a; c++){
		if(bo[c]==1) continue;
		dfs(c);
	}
	for(c=a; c>=1; c--){
		for(vector <int>::iterator it=v[z[c]].begin(); it!=v[z[c]].end(); it++){
			if(dp[z[c]]<dp[(*it)]+1) dp[z[c]]=dp[(*it)]+1;
		}
	}
  e=0;
	for(c=1; c<=a; c++){
		if(e<dp[c]) e=dp[c];
	}
  cout<<endl;
	cout<<e;
	return 0;
}

Measured memory_bytes: 7936
#include<stdio.h>

int n,A[2000];
/*判定*/
int solve(int i,int m){
  if(m==0)return 1;
  if(i>=n)return 0;
  int res=solve(i+1,m)||solve(i+1,m-A[i]);
  return res;}

int main(){
  int q,mi[2000],i;

  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&A[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&mi[i]);}
  for(i=0;i<q;i++){
    /*一致と不一致の場合*/
    if(solve(0,mi[i]))printf("yes\n");
    else printf("no\n");
  }
  return 0;}
 



Measured memory_bytes: 2704
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
void solve()
{
    ll N;
    cin >> N;
    vector<ll> a(N);
    for (int i = 0; i < N; i++) {
        cin >> a[i];
    }
    vector<ll> xa = a;
    sort(xa.begin(), xa.end());
    xa.erase(unique(xa.begin(), xa.end()), xa.end());
    for (int i = 0; i < N; i++) {
        a[i] = (ll)(lower_bound(xa.begin(), xa.end(), a[i]) - xa.begin());
    }

    vector<ll> imos(xa.size() + 1);
    for (int i = 0; i < N; i++) {
        imos[0]++;
        imos[a[i] + 1]--;
    }
    for (int i = 0; i < xa.size(); i++)
        imos[i + 1] += imos[i];
    vector<ll> ans(N);
    vector<pll> p;
    for (int i = 0; i < N; i++) {
        if (p.empty())
            p.push_back({ a[0], i });
        if (p[p.size() - 1].first < a[i])
            p.push_back({ a[i], i });
    }

    ll sum = 0;
    ll idx = 0;
    for (int i = 0; i < xa.size(); i++) {
        if (i == 0) {
            sum += xa[i] * imos[i];
        } else {
            sum += (xa[i] - xa[i - 1]) * imos[i];
        }

        if (p[idx].first == i) {
            ans[p[idx].second] = sum;
            sum = 0;
            idx++;
        }
    }
    for (int i = 0; i < N; i++) {
        cout << ans[i] << endl;
    }
}
int main(void)
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    solve();
    return 0;
}

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

#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))

using namespace std;

typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;

template<typename P, typename Q>
ostream& operator << (ostream& os, pair<P, Q> p)
{
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

int main(int argc, char *argv[])
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  int n;
  while (cin >> n) {
    vector<int> a(n);
    each (i, a) cin >> i;

    int bit = 0;

    int begin = 0;
    int end = 0;

    lli sum = 0;
    while (begin <= end) {
      while (end < n) {
        if (bit & a[end]) break;
        bit |= a[end];
        ++end;
      }

      sum += end - begin;
      bit ^= a[begin];
      ++begin;
    }

    cout << sum << endl;
  }

  return 0;
}


Measured memory_bytes: 1024
{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
import Data.Array

main :: IO ()
main = do
  n <- readLn :: IO Int
  pos <- fmap (map read . words) getLine :: IO [Int]
  ios <- fmap (map read . words) getLine :: IO [Int]
  solve pos ios

data Tree a = Leaf | Node a (Tree a) (Tree a) 

solve pos ios = postOrder $ reconstruct pos ios
  where
    reconstruct :: [Int] -> [Int] -> Tree Int
    reconstruct pos [] = Leaf
    reconstruct [] ios = Leaf
    reconstruct pos ios = Node p (reconstruct pos l) (reconstruct pos r)
      where
        (l, p, r) = fromJust . head . filter isJust $ map (flip splitIfEqual ios) pos

splitIfEqual :: (Eq a) => a -> [a] -> Maybe ([a], a, [a])
splitIfEqual k as = go k [] as
  where
    go _ _ [] = Nothing
    go k bs (a:as) = if k == a 
                     then Just (reverse bs, k, as)
                     else go k (a:bs) as


postOrder :: Tree Int -> IO ()
postOrder = putStrLn . unwords . map show . postOrderedList 
  where
    postOrderedList :: Tree Int -> [Int]
    postOrderedList Leaf = []
    postOrderedList (Node x left right) = (postOrderedList left) ++ (postOrderedList right) ++ [x]






Measured memory_bytes: 4128
#include <bits/stdc++.h>
using namespace std;
using ll     = long long;
using prefix = __attribute__((constructor))void;
const ll MOD = 1000000007;
const ll INF = 9223372036854775807LL;

#define elif           else if
#define def            inline auto
#define func           inline constexpr ll
#define up(i,a,n)      for(ll i=(a),i##_1=(n);i<=i##_1;++i)
#define down(i,a,n)    for(ll i=(a),i##_1=(n);i>=i##_1;--i)
#define rep(i,n)       up(i,0,n-1)
#define append(a)      push_back(a)

func    gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
func    lcm(ll a,ll b) {return a*b/gcd(a,b);}
def     dig(ll a)      {return to_string(a).length();}
prefix  init()         {cin.tie(0),ios::sync_with_stdio(0);}

ll A,B;

signed main(){
    cin>>A>>B;
    cout<<((A*B)&1?"Yes":"No")<<endl;
}
//for compilation: g++ -o _ _.cpp -std=c++14 (or 17)
//
//for fastening: g++ -O2 -o _ _.cpp -std=c++14 (or 17)
//for fastening: g++ -O3 -mtune=native -march=native -o _ _.cpp -std=c++14 (or 17)


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

int main() {
  int N, R;
  cin >> N >> R;
  
  if (N<10) R += 100*(10-N);
  
  cout << R << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
 
#define N 1000000
 
int count = 0;
 
void insertSort(int *A, int n,int g)
{
  
int i,j,v;
 
  for(i = g;i < n;i ++)
{
    v = A[i];
    j = i-g;
    while(j >= 0 && A[j] > v)
{
      A[j+g] = A[j];
      j = j-g;
      count ++;
    }
    A[j+g] = v;
  }
}

 void shellSort(int *A,int n)
{
  int i,m,cm;
  
  count = 0;
  cm = 0;
  m = 5;
  
int G[5] = {1000,100,10,4,1};
 
  for(i = 0;i < m;i ++)
{
    insertSort(A,n,G[i]);
    if(G[i] <= n) cm ++;
  }

  printf("%d\n",cm);
 
  for(i = 0;i < m-1;i ++)
{
  if(G[i] <= n) {
printf("%d ",G[i]);
  }
  }
 
  printf("%d\n",G[i]);
  printf("%d\n",count);

  for(i = 0;i < n;i ++)
{
printf("%d\n",A[i]);
  }
}

 
int main(){
  
  int n,i;

  int A[1000000];
 
  scanf("%d",&n);
 
  for(i = 0;i < n;i ++)
    {
      scanf("%d",&A[i]);
    } 

  shellSort(A,n);

  return 0;
}

Measured memory_bytes: 4504
import java.util.Scanner;


public class Main {

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

		char[] str = sc.next().toCharArray();
		int q = sc.nextInt();
		
		for (int i = 0; i < q; i++) {
			String cmd = sc.next();
			int a = sc.nextInt();
			int b = sc.nextInt();

			if (cmd.equals("print")) {
				StringBuffer result = new StringBuffer();
				for (int j = a; j <= b; j++) {
					result.append(str[j]);
				}
				System.out.println(result);
			} else if (cmd.equals("reverse")) {
				for (int j = a, k = b; j < k; j++, k--) {
					char temp = str[j];
					str[j] = str[k];
					str[k] = temp;
				}
			} else if (cmd.equals("replace")) {
				char[] p = sc.next().toCharArray();
				for (int j = a, k = 0; j <= b; j++, k++) {
					str[j] = p[k];
				}
			}
		}

		sc.close();
	}
}

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

int main() {
    int N, M;
    while (cin >> N >> M, N) {
        int D, P, res = 0;
        int Ps[11] = {0};
        for (int i=0; i<N; ++i) {
            cin >> D >> P;
            res += D * P;
            Ps[P] += D;
        }
        for (int i=10; i>=0; --i) {
            if (M <= Ps[i]) {
                res -= M * i;
                M = 0;
            } else {
                res -= Ps[i] * i;
                M -= Ps[i];
            }
        }
        cout << res << endl;
    }
    return 0;
}

Measured memory_bytes: 1160
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"

using ll = long long;
using P = pair<int, int>;

const long long MOD = 1e9+7;

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

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

template<class T, class U>
ostream& operator <<(ostream &os, pair<T, U> p) {
    cout << '(' << p.first << ", " << p.second << ')';
    return os;
}

template<class T>
void print(const vector<T> &v, const string &delimiter) { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

int main() {
    string s;
    cin >> s;
    deque<char> que;
    for (char c: s) que.push_back(c);

    int q;
    cin >> q;
    int rev = 0;
    rep(_q, q) {
        int k;
        cin >> k;
        if (k == 1) rev ^= 1;
        else {
            int f;
            char c;
            cin >> f >> c;
            if (f == 1) {
                if (!rev) que.push_front(c);
                else que.push_back(c);
            }
            else {
                if (!rev) que.push_back(c);
                else que.push_front(c);
            }
        }
    }

    if (!rev) while (!que.empty()) {
        cout << que.front();
        que.pop_front();
    }
    else while (!que.empty()) {
        cout << que.back();
        que.pop_back();
    }
    cout << endl;
}

Measured memory_bytes: 896
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	void run() {
		Scanner sc = new Scanner(System.in);
		long A = sc.nextLong();
		long B = sc.nextLong();
		long C = sc.nextLong();
		long K = sc.nextLong();
		long ans;
		if (K % 2 == 0) {
			ans = A - B;
		} else {
			ans = B - A;
		}
		System.out.println(ans);
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}

}


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

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 1e5 + 5;


int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);
  //cout << fixed << setprecision(6);
  int n,m;
  cin>>n>>m;
  set<int> factors;
  for (int f=1; f*f <= m; f++) {
    if (m%f == 0) {
      factors.insert(f);
      factors.insert(m/f);
    }
  }
  
  int ans = 0;
  for (auto f: factors) {
    if (m/f >= n) {
      ans = max(ans, f);
    }
  }
  
  cout<<ans<<endl;

  
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Library;
using static Library.Input;

namespace AtCoderTemplate
{
    class ProgramB
    {
        static void Main()
        {
            int n = NextInt, k = NextInt;
            System.Console.WriteLine(IntList.Count(x => x >= k));
        }
    }
}

namespace Library
{
    class Input
    {
        static IEnumerator<string> enumerator = new string[] { }.AsEnumerable().GetEnumerator();

        public static string Line => Console.ReadLine();

        public static string[] StrArr => Line.Split(' ');

        public static int NextInt => int.Parse(NextWord());

        public static long NextLong => long.Parse(NextWord());

        public static List<int> IntList => StrArr.Select(int.Parse).ToList();

        public static List<long> LongList => StrArr.Select(long.Parse).ToList();

        public static IEnumerable<long[]> TakeLine(int N)
        {
            return Enumerable.Repeat(0, N).Select(_ => Console.ReadLine().Split(' ').Select(long.Parse).ToArray());
        }

        public static string NextWord()
        {
            while (!enumerator.MoveNext())
            {
                enumerator = StrArr.AsEnumerable().GetEnumerator();
            }
            return enumerator.Current;
        }
    }
}


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

int main() {
    long long h;
    int cou = 1;
    long long ans = 0;
    scanf("%ld", &h);
    while (h != 1) {
        h /= 2;
        cou++;
    }
    for (int i = 0; i < cou; i++) {
        ans += pow(2, i);
    }
    printf("%ld\n", ans);
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
    string Answer="No";
    int N,Red=0;
    char input;
    scanf("%d",&N);
    for(int i=0; i<=N; i++){
        if((input=getchar())=='R') Red++;
    }
    if(2*Red-N>0) Answer="Yes";
    cout<<Answer;
    return 0;
}

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


cum = [0]*(N+1)
for i in range(1, N+1):
    cum[i] = cum[i-1] + a[i-1]

ret = 10**10
for i in range(1, N):
    x = cum[i]
    y = cum[-1] - x
    if abs(x-y) < ret:
        ret = abs(x-y)
    
print(ret)

Measured memory_bytes: 76880
package main

import "fmt"

func min(a int, b int) int {
	if a <= b {
		return a
	}
	return b
}

func max(a int, b int) int {
	if a >= b {
		return a
	}
	return b
}

func main() {
	var n int
	fmt.Scan(&n)
	a := make([]int, n+1)
	b := make([]int, n)
	for i := 0; i < n+1; i++ {
		fmt.Scan(&a[i])
	}
	for i := 0; i < n; i++ {
		fmt.Scan(&b[i])
	}

	cnt := 0
	for i := 0; i < n; i++ {
		if a[i] >= b[i] {
			cnt += b[i]
		} else {
			cnt += a[i]
			tmp := a[i+1]
			a[i+1] = max(a[i+1]-(b[i]-a[i]), 0)
			cnt += tmp - a[i+1]
		}
	}
	fmt.Println(cnt)
}


Measured memory_bytes: 5504
#include <iostream>
#include <algorithm>
#include <cstring>
using namespace std;

const int MAXN = 510;
int bit[MAXN], n;
void add(int p, int val) {
	for (; p<=n; p+=p&-p)
		bit[p]+=val;
}
int sum(int p) {
	int ans=0;
	for (; p>0; p-=p&-p)
		ans += bit[p];
	return ans;
}
struct Line {
	int l,r;
	int id;
	bool operator<(const Line& rhs) const {
		return l<rhs.l;
	}
}line[200010], query[200010];
int main() {
	int m,q;
	cin>>n>>m>>q;
	for (int i=0; i<m; i++)
		cin>>line[i].l>>line[i].r;
	for (int i=0; i<q; i++) {
		cin>>query[i].l>>query[i].r;
		query[i].id = i;
	}
	sort(line, line+m);
	sort(query, query+q);

	int ans[200010];
	for (int i=0; i<m; i++)
		add(line[i].r, 1);
	for (int i=0, starter=0; i<q; i++) {
		while(starter<m && line[starter].l<query[i].l)
			add(line[starter++].r, -1);
		// cout<<"query="<<query[i].id<<"  starter="<<starter<<endl;
		ans[query[i].id] = sum(query[i].r);
	}

	for (int i=0; i<q; i++)
		cout<<ans[i]<<endl;
	return 0;
}

Measured memory_bytes: 5120
#include <stdio.h>

int main(int argc, const char * argv[])
{
    int depth,width,i,j;
    
    while(1){
        scanf("%d %d",&depth,&width);
        
        if(depth==0 && width==0){
            break;
        }
        
        for(i = 0;depth > i;i+=1){
            
            for(j = 0;width > j;j+=1){
                if(i==0||j==0||j==width-1||i==depth-1){
                    printf("#");
                }else{
                    printf(".");
                }
            }
            
            printf("\n");
            
        }
        printf("\n");
    }
    
    return 0;
}

Measured memory_bytes: 572
#include <iostream> // cout, endl, cin
#include <cmath> //sqrt pow
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
 
#define rep(i,n) for(int i = 0; i < n; i++)
#define vi vector<int>
#define vvi vector<vi>
#define pii pair<int, int>
#define mod 1000000007
using ll = long long;
using namespace std;
int main(){
  int s;
  cin >> s;
  int cnt = 0;
  if(s == 4 || s == 2 || s == 1){
    cout << 4 << endl;
    return 0;
  }
  while(s != 4){
    if(s & 1){
      s *= 3;
      s++;
    }else s /= 2;
    cnt++;
  }
  cout << cnt + 4 << endl;
}

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

int main(){

    int N;
    cin >> N;
    set<int> mochi;
    for(int i = 0; i < N; i++){
        int d;
        cin >> d;
        mochi.insert(d);
    }

    cout << mochi.size() << endl;

    return 0;
}

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


bool is_prime(LL x){
    for(LL i=2;i*i<=x;i++){
        if(x%i==0)return 0;
    }
    return 1;
}

int main()
{

    int n;
    int a, b;
    cin >> n;
    if(n == 1){
        cout <<"Hello World";
    }
    else{
        cin >> a >> b;
        cout << a + b;
    }
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void){
    int n,l,i,j;
    char s[101][101];
    char tmp[101];
    scanf("%d%d",&n,&l);
    for(i=0;i<n;i++)
        scanf("%s",s[i]);
    
    for(i=0;i<n;i++){
        for(j=i+1;j<n;j++){
            if(strcmp(s[i],s[j])>0){
                strcpy(tmp,s[i]);
                strcpy(s[i],s[j]);
                strcpy(s[j],tmp);
            }
        }
    }
    for(i=0;i<n;i++)
        printf("%s",s[i]);
}

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

using namespace std;

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

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

  sort(begin(v), end(v));

  if (v[0] == 5 && v[1] == 5 && v[2] == 7) cout << "YES" << "\n";
  else cout << "NO" << "\n";
}


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

#define Fast           ios_base::sync_with_stdio(0);cin.tie(0),cout.tie(0)
#define FO             freopen("in.txt", "r", stdin)
#define FC             freopen("out.txt", "w", stdout)
#define aise           cout<<"aise"<<endl
#define pb             push_back
#define pf             push_front
#define ppb            pop_back
#define ppf            pop_front
#define mp             make_pair
#define ll             long long
#define all(x)         x.begin(), x.end()
#define mset(v, a)     memset(v, a, sizeof(v))
#define pll            pair< ll, ll >
#define pd             pair< double, double >
#define ff             first
#define ss             second
#define pi             acos(-1.0)
#define mxN            2010
#define inf            1e14
#define mod            1000000007

//NCR iterative
/*voidcomb_table(intN)
{
    for(inti=0; i<=N; ++i)
    {
        for(intj=0; j<=i; ++j)
        {
            if(j==0or j==i)
            {
                C[i][j]=1LL;
            }
            else
            {
                C[i][j]=(C[i-1][j-1]+C[i-1][j]);
            }
        }
    }
}*/


//NCR recursive
/*ll dp[55][55];

ll NCR(ll n,ll r)
{

    if(n==r)
        return dp[n][r]=1;
    if(r==0)
        return dp[n][r]= 1;
    if(r==1)
        return dp[n][r]=n ;
    if(dp[n][r] != -1)
        return dp[n][r];
    return dp[n][r] = NCR(n-1,r)+NCR(n-1,r-1);
}*/

//Sieve:
/*bool Flag[1000010];
vector<ll> Prime;

void sieve()
{

    ll val=sqrt(1000010);
    for(ll i=4;i<=1000005; i+=2) Flag[i]=1;
    for(ll i=3;i <= val;i+=2)
    {

        if(Flag[i]==0)
        {

            for(ll j=i*i;j<=1000005;j+=i) Flag[j]=1;
        }
    }
    Flag[1]=1;
    for(ll i=1;i<=1000000;i++)
        if(Flag[i]==0) Prime.pb(i);
}*/


//Conversion
/*string bin(ll x)
{

    string ret;
    while(x)
    {

        ll t=x%2;
        char c;
        if(t==1)
            c='1';
        else
            c='0';
        ret.pb(c);
        x/=2;
    }
    reverse(all(ret));
    return ret;
}*/

/*ll lcm(ll x, ll y)
{

    ll ret=__gcd(x,y);
    return (x*y)/ret;
}*/

/*ll dx[]= {0,0,1,-1};
ll dy[]= {1,-1,0,0};*/

 int main()
 {

     ll n,m;
     cin >> n >> m;
     char a[n][n], b[m][m];
     for(ll i=0;i<n;i++)
     {

         for(ll j=0;j<n;j++) scanf(" %c",&a[i][j]);
     }
     for(ll i=0;i<m;i++)
     {

         for(ll j=0;j<m;j++) scanf(" %c",&b[i][j]);
     }
     bool tf=0;
     for(ll ai=0;ai<n;ai++)
     {

         for(ll aj=0;aj<n;aj++)
         {

             ll cnt=0;
             for(ll i=0;i<m;i++)
             {

                 if(ai+i>=n) break;
                 for(ll j=0;j<m;j++)
                 {

                     if(aj+j>=n) break;
                     if(b[i][j]==a[ai+i][aj+j]) cnt++;
                 }
             }
             if(cnt==m*m) tf=1;
         }
     }
     if(tf) cout << "Yes";
     else cout << "No";
 }


Measured memory_bytes: 256
#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 <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

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

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

signed main() {
    int n, a, b; cin >> n >> a >> b;
    int x[100010];

    int ans = 0;
    rep(i,0,n) cin >> x[i];
    rep(i,1,n) {
        int d = x[i] - x[i-1];
        if(d*a > b) ans += b;
        else ans += d*a;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B, M;
  cin >> A >> B >> M;
  
  vector<int> reizouko{};
  vector<int> range{};
 
  for (int i = 0; i < A; i++) {
    int a;
    cin >> a;
    reizouko.emplace_back(a);
  }
  for (int i = 0; i < B; i++) {
    int b;
    cin >> b;
    range.emplace_back(b);
  }
 
  int mini = *min_element(reizouko.begin(), reizouko.end()) + *min_element(range.begin(), range.end());
  int MIN = 1000000;
 
  for(int i = 0; i < M; i++){
    int x, y, c;
    cin >> x >> y >> c;
    int money = reizouko[x-1] + range[y-1] - c;
    MIN = min(MIN, money);
  }
  MIN = min(MIN, mini);
  cout << MIN << endl;
}

Measured memory_bytes: 1400
#include <iostream>
using namespace std;
using lli = long long int;

int main(){
	lli K;
	lli array[50]={0};
	
	cin >> K;
	
	for(int i=0;i<50;i++){
		array[i]=i;
	}
	
	for(int i=0;i<50;i++){
		array[i]+=(K/50);
	}
	for(int i=0;i<K%50;i++){
		array[49-i]++;
	}
	cout << 50 << endl;
	for(int i=0;i<50;i++){
		cout << array[i] << " ";
	}
	cout << endl;
	
//	a+=K/2;
//	b+=K-K/2;
//	cout << 2 << endl << a << " " << b << endl;
	
	/*
	while(true){
		lli a=0,b=1;
		lli K;
	cin >> K;
	for(int i=0;i<K;i++){
		a+=2;b--;
		i++;
		if(i>=K){break;}
		b+=2;a--;
	}
	cout << 2 << endl << a << " " << b << endl;
	}*/
	return 0;
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)

    val a = sc.nextInt()
    val b = sc.nextInt()

    val ans = if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 ==0) {
        "Possible"
    } else {
        "Impossible"
    }
    println(ans)
}

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


using namespace std;
int main()
{
	int INF = 1000000;
	int N, X, cnt = 0;
	int m[1100];
	int min = INF;
	cin >> N >> X;
	for (int i = 0; i < N; i++) {
		cin >> m[i];
		X -= m[i];
		if (m[i] < min) min = m[i];
	}
	
	cnt = X / min + N;
	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
typedef long long ll;
int n,m,a,b,inv[300010],fac[300010],Ans;
inline int read()
{
	int x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1; ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0'; ch=getchar();}
	return x*f;
}
inline int qpow(int bas,int pw)
{
	int ans=1;for(;pw;pw>>=1,bas=1ll*bas*bas%mod)
		if(pw&1) ans=1ll*ans*bas%mod; return ans;
}
inline void Add(int &x,int y)
{
	x+=y; if(x>=mod) x-=mod;
	if(x<0) x+=mod;
}
inline int C(int n,int m)
{
	return 1ll*fac[n]*inv[n-m]%mod*inv[m]%mod;
}
int main()
{
	n=read(); m=read(); a=read(); b=read();
	if(a==0||b==0) {printf("%d\n",C(n+m,n)); return 0;}
	fac[0]=1; for(int i=1;i<=300000;i++) fac[i]=1ll*fac[i-1]*i%mod;
	inv[300000]=qpow(fac[300000],mod-2); 
	for(int i=299999;i>=0;i--) inv[i]=1ll*inv[i+1]*(i+1)%mod; 
	for(int i=b+1;i<=m;i++)
	{
		// cout << n-a-1 << " " << i-1 << endl;
		// cout << m-i << " " << a-1 << endl;
		Add(Ans,1ll*C(n-a+i-2,i-1)*C(a+m-i-1,a-1)%mod);
	}
	cout << Ans << endl; 
	return 0 ;
}

Measured memory_bytes: 2688
#include <stdio.h>
#define K 100
#define I 1000000000

int G[K][K];
int S[K];
int min[K];
int parent[K];

int out(int n)
{
  int i=0,m=0,sum=0,u=0,j=0;
  for(i=0;i<K;i++)
    {
      S[i]=-1;
      min[i]=I;
      parent[i]=-1;
    }

  min[0]=0;

  while(1)
    {
      m=I;
      for(i=0;i<n;i++)
	{
	  if(S[i]!=1 && min[i]<m)
	    {
	      m=min[i];
	      u=i;
	    }
	}

      if(m==I) break;
      S[u]=1;

      for(i=0;i<n;i++)
	{
	  if(S[i]!=1 && G[u][i] != -1)
	    {
	      if(G[u][i]<min[i])
		{
		  min[i]=G[u][i];
		  parent[i]=u;
		  S[i]=0;
		}
	    }
	}
    }
  
  for(i=0;i<n;i++)
    {
      if(parent[i] != -1) sum += G[parent[i]][i];
    }
  return sum;
}

int main()
{
  int i,j,n;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      for(j=0;j<n;j++)
	{
	  scanf("%d",&G[i][j]);
	}
    }
  
  printf("%d\n",out(n));

  return 0;
}



Measured memory_bytes: 1992
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()

int main(){
    string s;cin>>s;
    bool flag=true;
    if(s.at(0)!='A'){
        flag=false;
    }
    int Ccount=0;
    int Cpoint=0;
    for(int i=2;i<s.size()-1;i++){
        if(s.at(i)=='C'){
            Ccount++;
            Cpoint=i;
        }
    }
    if(Ccount!=1){
        flag=false;
    }
    rep(i,s.size()){
        if(i==0 || i==Cpoint){
            continue;
        }else{
            if(!islower(s.at(i))){
                flag=false;
            }
        }
    }
    if(flag)cout<<"AC"<<endl;
    else cout<<"WA"<<endl;

}

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

using ll = long long;
using ld = long double;
using vi = vector<int>;

#define rep(i, a, b) for(auto i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define PB push_back

struct edge{int to;};
using graph = vector<vector<edge>>;

ll calc(ll a, ll b, ll x) {
  return (a * x) / b - a * (x / b);
}

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

  ll a, b, n;
  cin >> a >> b >> n;
  ll mod = n % b;
  ll choice;
  if (n < b - 1) {
    choice = n;
  } else {
    choice = b - 1;
  }
  cout << calc(a, b, choice) << '\n';
}


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

typedef long long ll;
const ll mod=1e9+7;
const ll N=1e5+1;
const ll INF=1e10;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	ll n,t,q;
	ll sum=0;
	cin>>n;
	vector<ll> cnt(N);
	for(int i=0;i<n;i++){
		cin>>t;
		cnt[t]++;
		sum+=t;
	}
	cin>>q;
	while(q--){
		ll b,c;
		cin>>b>>c;
		t=cnt[b];
		cnt[b]=0;
		sum-=(t*b);
		sum+=(t*c);
		cnt[c]+=t;
		cout<<sum<<'\n';
	}
}


Measured memory_bytes: 3992
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = input()
if n[-1] in ['2','4','5','7','9']:
    print('hon')
elif n[-1] in ['0','1','6','8']:
    print('pon')
else:
    print('bon')


Measured memory_bytes: 10420
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N,K=MI()
    ans = 0
    for b in range(K+1,N+1):
        ans += N//b * (b-K)
        ans += max(0,(N%b)-K+1)
        if K==0:
            ans -= 1
    print(ans)
if __name__ == '__main__':
    main()

Measured memory_bytes: 6028
#include<iostream>
#include <string>
#include<algorithm>
#include <set>
#include <cmath>
using namespace std;

int main(void) {
	ios::sync_with_stdio(false);
	int N, A, B, i, j, k, p1, p2, p3;
	cin >> N;
	cin >> A >> B;
	int P[N];
	for (i = 0; i < N; i++) cin >> P[i];
	p1 = 0;
	p2 = 0;
	p3 = 0;
	for (i = 0; i < N; i++) {
		if (P[i] <= A)p1 += 1;
		else if (P[i] <= B)p2 += 1;
		else p3 += 1;
	}
	if (p1 >= p2)k = p2;
	else k = p1;
	if (k >= p3)k = p3;
	cout << k;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
#define inf (int)(1e9+7)
#define abs(x) (x >= 0 ? x : -(x))
#define ceil(a, b) a / b + !!(a % b)
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }
// template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    /*
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    */
    
    /*
    int a, b, c;
    cin >> a >> b >> c;
    */
    
    /*
    int n;
    cin >> n;
    string s;
    cin >> s;
    */
    
    int n;
    cin >> n;
    int k;
    cin >> k;
    
    int c = 0;
    rep(i, n) {
        int a;
        cin >> a;
        if (a >= k) c++;
    }
    cout << c << endl;
}


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

int main(void){
	int n;
   double su=0.000000;
  std::cin>> n;
  std::vector<int> a(100);
  for(int i=0;i<n;i++){
  std::cin>> a.at(i);
    su=su+(1.0/a.at(i));
  }
  double k=1.0/su;
  std::cout<< k << std::endl;
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  if ((N % 1000) == 0)
    cout << 0 << endl;
  else if ((N % 1000) != 0)
    cout << 1000 - (N % 1000) << endl;
}


Measured memory_bytes: 3628
# 解説を見た

def main():
    S_MAX = 10 ** 9

    n, k, s = map(int, input().split())
    fill = (1) if (s == S_MAX) else (s + 1)
    # fill=1でよい理由は、N項すべて1でも、1の区間和がS_MAXに達しないため
    # fillがsと互いに素であれば、fillを何倍してもsにならないので、
    # s==S_MAXのとき、sは偶数であることに注目して、fillを奇数にしてもよいはず

    ret = [s] * k + [fill] * (n - k)
    print(*ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 6500
N = int(input())
S = list(input())
arufa = ['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O',
         'P','Q','R','S','T','U','V','W','X','Y','Z']
ans = []
for i in range(len(S)):
    for j in range(26):
        if arufa[j] == S[i] :
            p = (j + N) % 26
            ans.append(arufa[p])
print("".join(ans))

Measured memory_bytes: 3188
q,h,s,d=map(int,input().split())
n=int(input())
a=min(8*q,4*h,2*s,d)
b=min(4*q,2*h,s)
if n%2==0:
    print((n//2)*a)
else:
    print(((n//2)*a)+b)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
int main()
{
   /// int arr[100000];
    long long int cnt=0;
    long long int n,d,p,q;
    long double sum=0,sum2=0;
    cin>>n>>d;
    for(int i=0;i<n;i++)
    {
        cin>>p>>q;
        sum=sqrt((p*p)+(q*q));
      //  int k=abs(sum);
        //arr[i]=sum;
        if(sum<=d)cnt++;
    }
  //  sort(arr,arr+n);
 cout<<cnt<<endl;


    return 0;
}


Measured memory_bytes: 3592
n,y=map(int,input().split())
y//=1000
cnt=[0,0,0]
if n>y or n*10<y:print("-1 -1 -1")
else:
    for i in range(y//10+1):
        for j in range(y//5+1 - i):
            if i+j<=n and y-i*10-j*5==n-i-j:
                print("{} {} {}".format(i,j,n-i-j))
                exit()
    else:print("-1 -1 -1")

Measured memory_bytes: 41068
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<queue>
#include<string>
#include<sstream>
using namespace std;
int inf = 1e9;
int main(){

  string s, t;
  cin >> s >> t;
  for(int i=0; i<s.size(); i++){
    string ss = "";
    for(int j=i; j<i+s.size(); j++){
      ss += s[j%s.size()];
    }
    if( ss == t ){
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp> 
//using namespace boost::multiprecision; 

using namespace std;

//#Rohitpratap311
//#Keep Calm And Stay Happy

typedef long long ll;
typedef long double ld;

bool ifprime(ll n)
{
    if(n==2||n==3) { return true ; }
    for(ll i=2;i<=sqrt(n);i++)
    {
        if(n%i==0) { return false; }
    }
    return true;
}

ll gcd(ll a,ll b)
{
    if(b==0) { return a; }
    return gcd(b,a%b);
}
 
ll lcm(ll a,ll b)
{
    return (a*b)/gcd(a,b);
}

int main()
{
    
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--)
    {
        ll mod=1000000007;
        ll n;
        cin>>n;
        vector<ll> arr(n);
        for(ll i=0;i<n;i++) { cin>>arr[i]; }
        vector<ll> sum(n);
        sum[0]=arr[0];
        for(ll i=1;i<n;++i)
        {
            sum[i]=(sum[i-1]%mod+arr[i]%mod)%mod;
        }
        ll ans=0;
        for(ll i=1;i<n;++i)
        {
            ans=(ans+((arr[i]%mod)*(sum[i-1]%mod))%mod)%mod;
        }
        cout<<ans;


    }
    return 0;
}

Measured memory_bytes: 6388
#include<bits/stdc++.h>
using namespace std;
#define fast cin.sync_with_stdio(0);cin.tie(0)
#define pii pair<int,int>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define INF (((ll)1000000000) * ((ll)1000000000))
#define N 200005
#define ll long long
#define MOD 1000000007
#define gcd __gcd
#define fill(A,v) memset(A,v,sizeof(A))
#define all(x) (x).begin(), (x).end()
int a[N],l[N],r[N];
stack<int> s;
ll calc[N];
int main() {
	int t,i,j;
	int n;
	ll k,cnt=0;
		cnt=0;
		cin>>n;
		for(i=1;i<=n;i++)
		  cin>>a[i];
		a[0]=-1;
	a[n+1]=-1;
	while(!s.empty())
	  s.pop();
    s.push(0);
	for(i=1;i<=n;i++)
	{
		while(a[s.top()]>a[i])
		  s.pop();
		l[i]=s.top();
		s.push(i);
	}
	while(!s.empty())
	  s.pop();
	s.push(n+1);  
	for(i=n;i>=1;i--)
	{
		while(a[s.top()]>=a[i])
		  s.pop();
		 r[i]=s.top();
		 s.push(i);
	}
	for(i=1;i<=n;i++)
	{
      
       calc[i]=1LL*(i-l[i])*(r[i]-i);
       
	}

    ll sum=0;
	for(i=1;i<=n;i++)
	{
	    sum+=calc[i]*a[i];
	}
	cout<<sum<<"\n";
	
	return 0;
}

Measured memory_bytes: 4992
using System;
public class Pg
{
    public static void Main()
    {
        int ans = 0;
        string line;
        while ((line = Console.ReadLine()) != null)
        {
            line = line.Trim();
            string tmp = "";
            foreach (char s in line)
            {
                if (s >= 48 & s <= 57)
                {
                    tmp += s.ToString();
                }
                else
                {
                    if (tmp.Length > 0)
                    {
                        ans += int.Parse(tmp);
                        tmp = "";
                    }
                }
            }
            if (tmp.Length > 0)
            {
                ans += int.Parse(tmp);
            }
        }
        Console.WriteLine(ans);
    }
}



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

int main(){
	int n,m;
	cin>>n>>m;
	vector<int> h(n),v(n);
	for(int i=0; i<n; i++) cin>>h[i];
	for(int i=0; i<m; i++){
		int a;
		cin>>a;
		for(int j=0; j<n; j++){
			if(h[j] <= a){
				v[j]++;
				break;
			}
		}
	}
	int max=0,in;
	for(int i=0; i<n; i++){
		if(v[i] > max){
			max=v[in=i];
		}
	}
	cout<<1+in<<endl;
}

Measured memory_bytes: 3120
#include<iostream>
using namespace std;
int main() {
	int a, b;
	cin >> a;
	cin >> b;

	if ((a <= 0) && (b >= 0)) {
		cout << "Zero";
	}
	else if(a>0){
		cout << "Positive";
	}
	else {
		if ((b - a) % 2 == 0) {
			cout << "Negative";
		}
		else {
			cout << "Positive";
		}
	}

	return 0;
}

Measured memory_bytes: 256
#  Copyright: this code was written at 2020. for AtCoder by Silviase
s = input()
dp = [0 for i in range(len(s))]
for i in range(len(s)):
    if i == 0:
        dp[i] = 1
    else:
        if s[i] != s[i-1]:
            dp[i] = dp[i-1]+1
        else:
            if i == 1:
                dp[i] = dp[i-1]
            else:
                if i == 1:
                    dp[i] = 1
                elif i == 2:
                    dp[i] = 2
                else:
                    dp[i] = dp[i-3]+2
print(dp[len(s)-1])


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

int main(){
  string str_a;
  string str_b;
  string str_c;
  
  cin >> str_a >> str_b >> str_c ;
  
  cout << char(str_a.front()-32) << char(str_b.front()-32) << char(str_c.front()-32) << endl;
	return 0;
}
  

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define SIZE 100001
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)

int table[SIZE];
int solve(int n,int cnum,int *coin){
  rep(i,n+1)table[i]=n;
  table[0]=0;
  rep(i,n){
    rep(j,cnum){
      if ( i+coin[j]>n)continue;
      table[i+coin[j]]=min(table[i]+1,table[i+coin[j]]);
    }
  }
  return table[n];
}

main(){
  int n,m;
  while(cin>>n>>m&&n){
    int in[n],cnum=1<<n,coin[1<<n];
    rep(i,n)cin>>in[i];
    rep(i,cnum){
      coin[i]=0;
      rep(j,n){
	if ( ( (1<<j)&i)!=0)coin[i]+=in[j];
      }
    }
    cout << solve(m,cnum,coin) << endl;
  }
  return false;
}

Measured memory_bytes: 1256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(),x.end()
#define dbg(x) cout<<#x<<":"<<x<<endl
#define int long long
#define MOD 1000000007
typedef pair<int,int> P;
typedef pair<int,P> PP;

signed main(){
  int n,m,s,t;
  cin>>n>>m>>s>>t;
  s--,t--;
  vector<vector<int> > g(n);
  for(int i=0;i<m;i++){
    int x,y;
    cin>>x>>y;
    x--,y--;
    g[x].pb(y);
    g[y].pb(x);
  }
  int INF = 1000000000;
  queue<P> que;
  que.push(P(s,0));
  vector<int> d(n,INF);
  while(que.size()){
    int v=que.front().fi;
    int cost=que.front().se;
    que.pop();
    if(d[v]!=INF)continue;
    d[v]=cost;
    for(int i=0;i<g[v].size();i++){
	 int to=g[v][i];
	 if(d[to]==INF)que.push(P(to,cost+1));
    }
  }

  queue<P> que2;
  que2.push(P(t,0));
  vector<int> d2(n,INF);
  while(que2.size()){
    int v=que2.front().fi;
    int cost=que2.front().se;
    que2.pop();
    if(d2[v]!=INF)continue;
    d2[v]=cost;
    for(int i=0;i<g[v].size();i++){
	 int to=g[v][i];
	 if(d2[to]==INF)que2.push(P(to,cost+1));
    }
  }
  int l=d[t];
  vector<int> cntd(l+1,0),cntd2(l+1,0);
  for(int i=0;i<n;i++){
    //  cout<<d[i]<<" "<<d2[i]<<endl;
    if(d[i]<=l)cntd[d[i]]++;
    if(d2[i]<=l)cntd2[d2[i]]++;
  }
  
  int ans=0;
  for(int i=0;i<=l-2;i++){
    ans+=cntd[i]*cntd2[l-2-i];
  }
  cout<<ans<<endl;
  
  return 0;
}



Measured memory_bytes: 13092
#include<stdio.h>
int nixu (int x)
{
    int a=0;
    while(x>0)
    {
        a=a*10+x%10;
        x=x/10;
    }
    return a;
}
int main()
{
    int a,b,i;
    int sum=0;
    scanf("%d %d",&a,&b);
    for(i=a;i<=b;i++)
    {
        if(i==nixu(i))
            sum++;
    }

    printf("%d",sum);
    return 0;
}


Measured memory_bytes: 128