akhauriyash/Code-Regression huggingface dataset:
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <cstring>
#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
#include <cmath>
#include <numeric>
#include <float.h>
using namespace std;
// repマクロの定義
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// allマクロの定義
#define all(v) v.begin(), v.end()
typedef unsigned long long ll;
// 最大公約数求める関数
int my_gcd(int n , int m){
  if(n < m){
    int tmp = n;
    n = m;
    m = tmp;
  }
  int l  = n % m;
  while(l != 0){
    n = m;
    m = l;
    l = n % m;
}
return m;
}

//char⇒int関数
 int ctoi(char c) {
 	switch (c) {
		case '0': return 0;
		case '1': return 1;
		case '2': return 2;
		case '3': return 3;
		case '4': return 4;
		case '5': return 5;
		case '6': return 6;
		case '7': return 7;
		case '8': return 8;
		case '9': return 9;
		default: return 0;
	}
}



int main(){
int A,B,C,K; cin >> A >> B >> C >> K;
int a,b,c;
int sum = 0;
a = K - A;
if(a > 0){
sum += A;
b = a - B;
if(b > 0){
	sum -= b;
}
}
else{
	sum = K;
}
	cout << sum << endl;
}


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

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

Measured memory_bytes: 3096
def resolve():
    A,V =map(int,input().split())
    B,W = map(int,input().split())
    T = int(input())
    AB =abs(A-B)
    VW = V-W

    if AB == 0 and VW ==0:
        print("YES")
        return
    elif VW <=0:
        print("NO")
        return

    if AB/VW > T:
        print("NO")
    else:
        print("YES")
resolve()

Measured memory_bytes: 61888
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    if(A <= 8 && B <= 8){
      System.out.println("Yay!");
    }else{
      System.out.println(":(");
    }
  }
}


Measured memory_bytes: 23636
package main
import (
    "fmt"
)

func main(){
  var K,A,B int
  fmt.Scan(&K,&A,&B)
  if K <= A {
    fmt.Println(K+1)
    return
  }
  if B-A < 2 {
    fmt.Println(K+1)
    return
  }
  var koukannkaisuu int = (K - (A-1)) / 2

  var ans = koukannkaisuu * (B-A) + A

  if (K - (A-1)) %2 == 1 {
    ans ++
  }
  fmt.Println(ans)
  return
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
inline void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
template<class T> inline void operator>>(istream& is,vector<T>& v) { for(int& i : v){ is>>i; } }
template<class T> inline void operator<<(ostream& os,const vector<T>& v) { for(int i : v){ os<<i<<" "; } os<<endl; }
const int inf = 1001001001;
const ll linf = 1001001001001001001;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    string s;
    cin >> s;
    rep(i,s.size()) {
        if(s[i] == '7') {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 3640
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace std;

int main()
{
    int a,b,k,i,j;
    cin>>a>>b>>k;
    for(i=a;(i<(a+k))&&(i<=b);i++)
    {
        cout<<i<<endl;
    }
    int c;
    c=2*k-(b-a);
    if(c>=2)
    for(j=b-k+c;(j<=b)&&(j>=a);j++)
        cout<<j<<endl;
        else
            for(j=b-k+1;(j<=b)&&(j>=a);j++)
            cout<<j<<endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
params = [list(map(int, input().split())) for _ in range(N - 1)]

for i in range(N - 1):
    time = 0
    for j in range(i, N - 1):
        c = params[j][0]
        s = params[j][1]
        f = params[j][2]
        if s > time:
            time += s - time + c
        else:
            time += (s - time) % f + c
    print(time)
    
print(0)


Measured memory_bytes: 3188
#include <iostream>
#include<string>
#include<time.h>
#include<math.h>
#include<stdlib.h>
#include<map>
using namespace std;

int main() {
	int N, M, A=0,B;
	cin >> N >> M;
	int i;
	for (i = 0; i < M; i++) {
		cin >> B;
		A = A + B;
	}
	if (A > N) {
		cout << -1 << endl;
	}
	else {
		cout << N - A << endl;
	}
	return 0;
}

Measured memory_bytes: 3648
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
int main()
{

    long long int sx,sy,tx,ty,i,j,k,l,m,o,n,p,idx=0;
    char ar[1000000];
    scanf("%lld%lld%lld%lld",&sx,&sy,&tx,&ty);
    for(i=0; i<abs(ty-sy); i++)
    {
        ar[idx]='U';
        idx++;
    }
    for(j=0; j<abs(tx-sx); j++)
    {
        ar[idx]='R';
        idx++;
    }
    for(k=0; k<abs(ty-sy); k++)
    {
        ar[idx]='D';
        idx++;
    }
    for(l=0; l<abs(tx-sx); l++)
    {
        ar[idx]='L';
        idx++;
    }
    ar[idx]='L';
    idx++;
    for(m=0; m<=abs(ty-sy); m++)
    {
        ar[idx]='U';
        idx++;
    }
    for(n=0; n<=abs(tx-sx); n++)
    {
        ar[idx]='R';
        idx++;
    }
    ar[idx]='D';
    idx++;
    ar[idx]='R';
    idx++;

    for(o=0; o<=abs(ty-sy); o++)
    {
        ar[idx]='D';
        idx++;
    }
    for(p=0; p<=abs(tx-sx); p++)
    {
        ar[idx]='L';
        idx++;
    }
    ar[idx]='U';
    printf("%s",ar);

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace ConsoleApp3
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            List<char> c1 = new List<char>();

            for(int i = 0; i < line.Length; i++)
            {
                if (char.IsUpper(line[i]))
                {
                    c1.Add(char.ToLower(line[i]));
                }
                else if (char.IsLower(line[i]))
                {
                    c1.Add(char.ToUpper(line[i]));
                }
                else
                {
                    c1.Add(line[i]);
                }
            }

            foreach (char item in c1)
            {
                Console.Write(item);
            }
            Console.WriteLine();
        }

    }
}


Measured memory_bytes: 17884
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define debug(x) cerr<<#x<<": "<<x<<endl
#define trav(a,x) for(auto &a:x)
#define all(x) x.begin(),x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;

int digitsum(int x) {
    int r=0;
    while(x) {
        r+=x%10;
        x/=10;
    }
    return r;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    int ans=-1;
    for(int i=1;i<=n-i;++i) {
        int x = digitsum(i)+digitsum(n-i);
        if(ans==-1 || x<ans) ans=x;
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <limits>
#include <sstream>
#include <fstream>
#include <climits>
#include <map>
#include <numeric>
#include <functional>
#include <utility>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef long long ll;

int main(void) {
  int n, m;
  cin >> n >> m;
  vector<int> v(m, 0);
  rep(i, n) {
    int k;
    cin >> k;
    rep(j, k) {
      int a;
      cin >> a;
      --a;
      v[a]++;
    }
  }
  int cnt = 0;
  rep(i, v.size()) {
    if (v[i] == n) cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
from bisect import bisect_right as bsr
from collections import Counter as cnt
from collections import defaultdict as dd
from collections import deque
from fractions import gcd
from itertools import combinations as comb
from itertools import permutations as perm
from math import ceil, factorial, floor
from operator import itemgetter as ig
from statistics import mean as avg

sys.setrecursionlimit(1000000)

# お約束
args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def yesno(v, yes="Yes", no="No", upper=False):
    if upper:
        print([yes.upper(), no.upper()][not v])
    else:
        print([yes, no][not v])


def main():
    """エントリーポイント"""
    N, M = input(int, int)
    SC = input([[int, 2], M])

    ans = ["#"] * N
    for s, c in SC:
        if not (ans[s - 1] == "#") and not (ans[s - 1] == str(c)):
            print(-1)
            return
        ans[s - 1] = str(c)
    if 1 < N and ans[0] == "0":
        print(-1)
        return
    if ans[0] == "#":
        ans[0] = "0" if N == 1 else "1"
    print("".join(ans).replace("#", "0"))


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()


Measured memory_bytes: 5304
#include <iostream>
#include <math.h>
using namespace std;
int main(){
    int D, G, p[11], c[11];
    cin >> D >> G;
    for(int i = 0; i < D; ++i){
        cin >> p[i] >> c[i];
    }
 
    int ans = 1e9;
    for(int mask = 0; mask < (1 << D); ++mask){
        int s = 0, num = 0, rest_max = -1;
        for(int i = 0; i < D; ++i){
            if(mask >> i & 1){
                s += 100 * (i+1) * p[i] + c[i];
                num += p[i];
            }else{
                rest_max = i;
            }
        }
        if(s < G){
            int s1 = 100 * (rest_max + 1);
            int need = int(ceil((double(G - s) / s1)));
            if(need > p[rest_max]){
                continue;
            }
            num += need;
        }
        ans = min(ans, num);
    }
    cout << ans << endl;
}

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

using namespace std;

int main(int argc, char* argv[]) {
  int N;
  cin >> N;

  vector<string> s(N);
  for (int i = 0; i < N; ++i)
    cin >> s[i];

  long long m_n = 0;
  long long a_n = 0;
  long long r_n = 0;
  long long c_n = 0;
  long long h_n = 0;
  for (int i = 0; i < N; ++i) {
    if (s[i].front() == 'M')
      ++m_n;
    else if (s[i].front() == 'A')
      ++a_n;
    else if (s[i].front() == 'R')
      ++r_n;
    else if (s[i].front() == 'C')
      ++c_n;
    else if (s[i].front() == 'H')
      ++h_n;
  }

  long long ret = m_n * a_n * r_n;
  ret += a_n * r_n * c_n;
  ret += r_n * c_n * h_n;
  ret += c_n * h_n * m_n;
  ret += h_n * m_n * a_n;
  ret += m_n * a_n * c_n;
  ret += a_n * r_n * h_n;
  ret += r_n * c_n * m_n;
  ret += a_n * c_n * h_n;
  ret += m_n * r_n * h_n;

  cout << ret << endl;

  return 0;
}

Measured memory_bytes: 6144
N = int(input())
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

if N / min(A, B, C, D, E) > int(N / min(A, B, C, D, E)):
    print(5 + int(N / min(A, B, C, D, E)))
else:
    print(4 + int(N / min(A, B, C, D, E)))


Measured memory_bytes: 3064
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>

using namespace std;

typedef long long LL;
typedef unsigned int UI;
typedef long double LD;

#define rSort(a) 		sort(a.rbegin(),a.rend())
#define Sort(a) 		sort(a.begin(),a.end())
#define Reverse(a) 		reverse(a.begin(),a.end())
#define Sum(a)  		accumulate(a.begin(), a.end(), 0)
#define REP(i, n) 		for(UI i = 0;i < n;i++)
#define REPR(i, n) 		for(UI i = n;i >= 0;i--)
#define FOR(i, m, n) 	for(UI i = m;i < n;i++)
#define pb(i) 			push_back(i)
#define SWAP(x,y) 		((x!=y)&&(x^=y,y^=x,x^=y))

#define MOD  			(LL)1000000007;
#define LL_INF  		(LL)1 << 62;
#define INT_INF			(int)1 << 30


int main(int argc, char* argv[]) {

	cin.tie(0);
	ios::sync_with_stdio(false);

    string S, T;
	string res;
	bool flg;

	cin >> S >> T;
	string tmp;

	for (int i = 0; i + T.length() <= S.length(); i++) {

		tmp = S;
		flg = true;

		for (int j = 0; j < T.length(); j++) {
			if (S[i + j] != '?' && S[i + j] != T[j]){
				flg = false;
			}
			else{
				tmp[i + j] = T[j];
			}
		}

		if(flg){

			for (int j = 0; j < tmp.length(); j++){
				if (tmp[j] == '?'){
					tmp[j] = 'a';
				}
			}

            if (res == "" || tmp < res){
				res = tmp;
			}

		}

	}

	if (res == ""){
		cout << "UNRESTORABLE" << endl;
	}
	else{
		cout << res << endl;
    }

	return 0;

}



Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
using namespace std;
long long n,s,m,i,a[100000];
int main()
{
    cin>>m>>n;
    for (i=1;i<=n;i++)
    cin>>a[i],s+=a[i];
    if (s<=m){cout<<m-s;return 0;}
    cout<<-1;
}

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

int n, m;
int books[MAX];

int check(mid){
	//	巻号
	int pos = 0;

	//	本棚の段数だけループ
	for (int i = 0; i < n; i++){
		//		printf("i: %d  book : %d\n", i, books[pos]);
		int width = mid;
		for (; pos < m; pos++){
			//	空き幅が本の幅より大きければ格納
			if (width >= books[pos]){
				width -= books[pos];
			}
			else{
				break;
			}
		}
		if (pos >= m){ break; }
	}
	return pos;
}

int bs(left, right){
	int mid = (left + right) / 2;
//	printf("left mid right : %d %d %d\n", left, mid, right);
	if (left >= right){
		return mid;
	}

	//	本棚に収まるか？
	int pos = check(mid);

	//	本棚に全部収まった
	if (pos >= m){
		return bs(left, mid);
	}
	else{
		return bs(mid + 1, right);
	}
}

int main(){
	int i;
//	int books[100];
	int left, right, mid;
	int sum_width;
	
	while (scanf("%d %d",&n,&m), n || m){
		sum_width = 0;
//		printf("%d %d", n, m);
		for (i = 0; i < m; i++){
			scanf("%d", &books[i]);
			sum_width += books[i];
		}

//		printf("%d", books[0]);
		//	二分探索
		//	ただし、本棚の幅は 1500000 を超えないものとします。
		//	-> 最悪値 = すべて1段に収めた場合 = 本の幅の合計
		left = 1; right = sum_width;
		
		printf("%d\n",bs(left, right));
	}
}


Measured memory_bytes: 2128
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
ll a,b,c,i,j,k,l,m,n,ans,tmp,hoge,fuga,piyo;
ll x[10010],y[10010];
string s,str;
int main(){
  cin>>n>>m;
  for(int i=0;i<m;i++){
    cin>>x[i];
    ans+=x[i];
  }
  if(ans>n){
    cout<<-1;
  }else{
    cout<<n-ans;
  }
  return 0;
}

Measured memory_bytes: 3680
#include <bits/stdc++.h>
using namespace std;
int n,m,ans=0;
char c[2003][2003];
vector <int> g[2003],t[2003]; 
int main(){
	cin>>n>>m;
	for (int i=1;i<=n;i++) g[i].push_back(0);
	for (int i=1;i<=m;i++) t[i].push_back(0);
	for (int i=1;i<=n;i++) for (int j=1;j<=m;j++){
		cin>>c[i][j];
		if (c[i][j]=='#'){
			g[i].push_back(j);
			t[j].push_back(i);
		}
	}
	for (int i=1;i<=n;i++) g[i].push_back(m+1);
	for (int i=1;i<=m;i++) t[i].push_back(n+1);
	for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) if (c[i][j]!='#'){
		int s1=lower_bound(g[i].begin(),g[i].end(),j)-g[i].begin(); 
		int s2=lower_bound(t[j].begin(),t[j].end(),i)-t[j].begin();
		ans=max(ans,g[i][s1]-g[i][s1-1]+t[j][s2]-t[j][s2-1]-3);
	}
	cout<<ans;
}

Measured memory_bytes: 38272
from collections import Counter
n = int(input())
d = {}
cnt = 0
for i in range(n):
    s = input()
    s = list(s)
    s.sort()
    key = "".join(s)
    if key in d:
        cnt += d[key]
        d[key] += 1
    else:
        d[key] = 1
print(cnt)


Measured memory_bytes: 18236
#include <stdio.h>

typedef long long ll;

ll x[100005];
ll v[100005];
ll f1[100005];
ll f2[100005];
ll g[100005];
ll g2[100005];
ll tmp[100005];

ll max(ll a,ll b){
	if(a>=b){return a;}
	else{return b;}
}
ll min(ll a,ll b){
	if(a<=b){return a;}
	else{return b;}
}

int main(){

	int N;
	ll C;

	scanf("%d %lld",&N,&C);

	int i;

	for(i=1;i<=N;i++){
		scanf("%lld %lld",&x[i],&v[i]);
	}

	tmp[0]=0ll;
	for(i=1;i<=N;i++){
		tmp[i]=v[i]+tmp[i-1];
	}
	f1[0]=0ll;
	for(i=1;i<=N;i++){
		f1[i]=tmp[i]-x[i];
	}
	tmp[N]=v[N];
	for(i=N-1;i>=1;i--){
		tmp[i]=tmp[i+1]+v[i];
	}
	for(i=1;i<=N;i++){
		f2[i]=tmp[i]-(C-x[i]);
	}

	g[0]=f1[0];
	ll max_f=g[0];
	for(i=1;i<=N;i++){
		if(max_f<f1[i]){
			max_f=f1[i];
			g[i]=max_f;
		}
		else{
			g[i]=g[i-1];
		}
	}

	g2[0]=0ll;
	ll max_f2=0ll;
	for(i=1;i<=N;i++){
		if(max_f2<f1[i]-x[i]){
			max_f2=f1[i]-x[i];
			g2[i]=max_f2;
		}
		else{
			g2[i]=g2[i-1];
		}
	}

	ll ans=0ll;

	for(i=1;i<=N;i++){
		ans=max(ans,f1[i]);
	}
	for(i=N;i>=1;i--){
		ans=max(ans,f2[i]);
	}

	for(i=1;i<=N;i++){
		ll OA=g[i-1];
		ll OB=f2[i];
		ans=max(OB-(C-x[i])+OA,ans);
	}
	for(i=1;i<=N;i++){
		ll OA2=g2[i-1];
		ll OB=f2[i];
		ans=max(OA2+OB,ans);
	}

	printf("%lld\n",ans);

	return 0;
}

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

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

    int N = scanner.nextInt();
    int C = scanner.nextInt();
    int K = scanner.nextInt();
    int[] T = new int[N];
    for (int i = 0; i < N; i++) T[i] = scanner.nextInt();
    Arrays.sort(T);

    int last = 0;
    int cnt = 0;
    for (int i = 0; i < N; i++) {
      if (T[i] - T[last] > K || i - last + 1 > C) {
        cnt++;
        last = i;
      }
    }
    System.out.println(cnt + 1);
  }
}


Measured memory_bytes: 50288
//============================================================================
//Everyone has a different way of thinking, so God Created us
//   Hope You Respect My Way..,Thank You ):
// Author      : Murad
// Online Judge: Codeforces.cpp & Atcoder.cpp
// Description : Problem name
//============================================================================
#include<bits/stdc++.h>
#include<unordered_map>
#include<unordered_set>
#include<utility>
using namespace std;
typedef long long LL;
#define pi 3.1415926536
#define forn(i,a,b)for(int i=a;i<b;i++)
#define ULL unsigned long long
#define MP make_pair
#define ff first
#define ss second
#define endl '\n'
#define INF LL(1e9);
#define _INF INT32_MIN
#define pq priority_queue
#define MM multimap
#define PB push_back
#define EMPP emplace_back
#define vii vector<int>
#define vll vector<LL>
#define ipair pair<int,int>
#define lpair pair<LL,LL>
#define El3zba ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define modd 1000000007
#define sf1(v) scanf("%I64d",&v);
#define sf2(v1,v2) scanf("%I64d %I64d",&v1,&v2)
#define sf3(v1,v2,v3) scanf("%I64d %I64d %I64d",&v1,&v2,&v3)
//std::transform(s1.begin(), s1.end(), s1.begin(),::tolower);
char alphz[27] = { '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' };
float Euclidean(LL x1, LL x2, LL y1, LL y2) {
	return sqrt(pow(x1 - x2, 2) + pow(y1 - y2, 2));
}
LL GCD(LL a, LL b) {
	return !b ? a : GCD(b, a % b);
}
LL LCM(LL a, LL b) {
	return (a*b) / GCD(a, b);
}
void PrimeFactor(LL n)
{
	while (n % 2 == 0) {
		//printf("%d ", 2);
//		aa.insert(2);
		n /= 2;
	}
	for (int i = 3; i <= sqrt(n); i += 2)
	{
		if (n%i == 0) {
			//printf("%d ", i);
			//aa.insert(i);
			n /= i;
		}
	}
	if (n > 2) {
		//printf("%d ", n);
	//	aa.insert(n);
	};
}
bool Is_Square(LL x) {
	LL l = 0, r = x;
	while (l <= r) {
		LL mid = l + (r - l) / 2;
		if (mid*mid == x)return true;
		if (mid*mid > x)r = mid - 1;
		else l = mid + 1;
	}
	return false;
}
LL Power(LL x, LL y)
{
	LL temp;
	if (y == 0)return 1;
	temp = Power(x, y / 2);
	if (y % 2 == 0)
		return temp*temp;
	else return x*temp*temp;
}
bool Is_Prime(int x) {
	if (x == 2)return 1;
	else if (x % 2 == 0 || x < 2)return 0;
	for (int i = 3; i*i <= x; i += 2)
		if (x%i == 0)return 0;
	return 1;
}
bool Is_Palin(string s)
{
	int i = 0,j = (int)s.size() - 1;
	while (i < j)
	{
		if (s[i] != s[j])return 0;
		i++, j--;
	}
	return 1;
}
int main()
{
	El3zba;
	/***  بسم الله الرحمن الرحيم   ***/
	string s;
	cin >> s;
	if (Is_Palin(s))return cout << 0 << endl, 0;
	int ans = 5e+5, cnt = 0;
	int i = 0, j = (int)s.size()-1;
	while (i < j) {
		if (s[i] != s[j])cnt++;
		i++, j--;
	}
	cout << cnt << endl;
	return 0;
}

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

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

int n, m;
int main(){
    cin >> n >> m;
    cout << (1900 * m + 100 * (n - m)) * pow(2, m) << endl;
    return 0;
}


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

int main(){
    string s;
    cin >> s;
    ll N = s.size();
    ll P = 0;
    rep(i, 0, N){
        if(s[i] == 'p') P++;
    }
    cout << (ll)(N/2) - P << endl;
    return 0;
}

Measured memory_bytes: 512
#pragma GCC optimize("Ofast")

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <random>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;

typedef
tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;

#define pb push_back
#define F first
#define S second
#define all(a) (a).begin(), (a).end()

#define for1(i0, l0, r0) for (int i0 = l0; i0 < r0; ++i0)
#define for2(i0, l0, r0) for (int i0 = l0; i0 <= r0; ++i0)
#define forn(i0, n0) for (int i0 = 0; i0 < n0; ++i0)
#define forn1(i0, n0) for (int i0 = 1; i0 < n0; ++i0)
#define forr(i0, n0) for (int i0 = n0; i0 >= 0; --i0)
#define forr1(i0, r0, l0) for (int i0 = r0; i0 > l0; --i0)
#define forr2(i0, r0, l0) for (int i0 = r0; i0 >= l0; --i0)

#define Sort(a) sort(all(a))
#define Reverse(a) reverse(all(a))

typedef long double ld;
#define ui unsigned int
#define ull unsigned long long

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;

typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;

typedef vector<vi> vvi;
typedef vector<vd> vvd;
typedef vector<vll> vvll;
typedef vector<vb> vvb;

#define vpss vector<pss>
#define vvs vector<vs>
#define vvpii vector<vpii>
#define vvpll vector<vpll>
#define vpt vector<pt>
#define vvvi vector<vvi>
#define vsi vector<set<int>>
#define ss second
#define ff first

#define printvi(arr) for (int x0 : arr) cout << x0 << ' '; cout << '\n';
#define printvll(arr) for (ll x0 : arr) cout << x0 << ' '; cout << '\n';
#define printpair(pair0) cout << pair0.F << ' ' << pair0.S << '\n';
#define printvp(arr) for (auto pair0 : arr) printpair(pair0);
#define initArray(arr, N0, X0) memset(arr, X0, N0 * sizeof(int))
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout.precision(16);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
}

void solve() {
    int n;
    ll t;
    cin >> n >> t;
    t /= 2;
    ll minn = 2e9;
    vll a(n);
    ll maxd = 0;
    forn(i, n){
        cin >> a[i];
        maxd = max(maxd, a[i] - minn);
        minn = min(minn, a[i]);
    }
    ll ans = 0;
    minn = 2e9;
    set<pll> s;
    map<ll, int> cnt;
    map<ll, int> cnt0;
    forn(i, n){
        cnt0[a[i]]++;
        if (a[i] - minn == maxd){
            s.insert({a[i], minn});
            cnt[a[i]] = cnt0[a[i]];
            cnt[minn] = cnt0[minn];
        }
        minn = min(minn, a[i]);
    }
    for (pll p : s) ans += min(cnt[p.F], cnt[p.S]);
    cout << ans << '\n';
}

bool multitest = false;

int main() {
    init();
    int t = 1;
    if (multitest) cin >> t;
    forn(i, t) solve();
}

Measured memory_bytes: 19572
#include<bits/stdc++.h>
using namespace std;
#define MAX_V 10000
#define INF 1000000001
typedef pair<int,int> P;
struct edge { int to,cap,cost,rev; };
int V;
vector<edge> G[MAX_V];
int h[MAX_V];
int dist[MAX_V];
int prevv[MAX_V],preve[MAX_V];
void init_edge(){
  for(int i=0;i<V;i++)G[i].clear();
}
void add_edge(int from,int to,int cap,int cost){
  G[from].push_back((edge){to,cap,cost,(int)G[to].size()});
  G[to].push_back((edge){from,0,-cost,(int)G[from].size()-1});
}
int min_cost_flow(int s,int t,int f){
  int res = 0;
  fill(h,h+V,0);
  while(f>0){
 
    priority_queue< P, vector<P>, greater<P> >  que;
    fill( dist, dist+V , INF );
    dist[s]=0;
    que.push(P(0,s));
    while(!que.empty()){
      P p = que.top(); que.pop();
      int v = p.second;
      if(dist[v]<p.first)continue;
      for(int i=0;i<(int)G[v].size();i++){
        edge &e = G[v][i];
        if(e.cap>0&&dist[e.to] > dist[v]+e.cost+h[v]-h[e.to]){
          dist[e.to]=dist[v]+e.cost+h[v]-h[e.to];
          prevv[e.to]=v;
          preve[e.to]=i;
          que.push(P(dist[e.to],e.to));
        }
      }
    }
 
    if(dist[t]==INF){
      return -1;
    }
    for(int v=0;v<V;v++)h[v]+=dist[v];
 
    int d=f;
    for(int v=t;v!=s;v=prevv[v]){
      d=min(d,G[prevv[v]][preve[v]].cap);
    }
    f-=d;
    res+=d*h[t];
    for(int v=t;v!=s;v=prevv[v]){
      edge &e = G[prevv[v]][preve[v]];
      e.cap -= d;
      G[v][e.rev].cap += d;
    }
  }
  return res;
}
int main(){
  int E,F,a,b,c,d;
  cin>>V>>E>>F;
  while(E--){
    cin>>a>>b>>c>>d;
    add_edge(a,b,c,d);
  }
  cout<<min_cost_flow(0,V-1,F)<<endl;
  return 0;
}

Measured memory_bytes: 3416
function main(input) {
	const args = input.split('\n').map(n => parseInt(n, 10));
  	const N = args[0],
          A = args[1]
   
    let num = N % 500;
  	if (num <= A) {
      console.log('Yes');
    } else {
      console.log('No');
    }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 29424
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
const bool debug=false;
#define DEBUG if(debug==true)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(void) {
    ll a,b,q;
    cin >> a >> b >> q;
    vector<ll> va(a,0),vb(b,0),vq(q,0);
    rep(i,a){
        cin >> va[i];
    }
    rep(i,b){
        cin >> vb[i];
    }
    rep(i,q){
        cin >> vq[i];
    }
    sort(va.begin(),va.end());
    sort(vb.begin(),vb.end());
    rep(i,q){
        auto ap2 = lower_bound(va.begin(),va.end(),vq[i]);
        auto bp2 = lower_bound(vb.begin(), vb.end(),vq[i]);
        if(ap2==va.end()){ap2-=1;}
        if(bp2==vb.end()){bp2-=1;}
        vector<ll>::iterator ap=ap2-1,bp=bp2-1;
        if(a==1){ap++;}
        if(b==1){bp++;}
        if(a!=1&&*ap2==va[0]){ap+=2;}
        if(b!=1&&*bp2==vb[0]){bp+=2;}
        DEBUG{
            cout << "a1 " << *ap << " a2 " << *ap2 << endl;
            cout << "b1 " << *bp << " b2 " << *bp2 << endl;
        }
        ll xq = vq[i];
        ll res=0;
        res = abs(xq-*ap2)+abs(*ap2-*bp2);
        res = min(res,abs(xq-*ap2)+abs(*ap2-*bp));
        res = min(res,abs(xq-*ap)+abs(*ap-*bp2));
        res = min(res,abs(xq-*ap)+abs(*ap-*bp));
        res = min(res,abs(xq-*bp2)+abs(*bp2-*ap2));
        res = min(res,abs(xq-*bp2)+abs(*bp2-*ap));
        res = min(res,abs(xq-*bp)+abs(*bp-*ap2));
        res = min(res,abs(xq-*bp)+abs(*bp-*ap));
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstdio>
using namespace std;

vector<string> split(const string &str, char delim){
	vector<string> res;
	size_t current = 0, found;
	while((found = str.find_first_of(delim, current)) != string::npos){
		res.push_back(string(str, current, found - current));
		current = found + 1;
	}
	res.push_back(string(str, current, str.size() - current));
	return res;
}

class Trading {
	private:
		bool lastMonth;
		bool month;
	public:
		int id;
		int n;
		Trading(int num){
			id = num;
			n = 0;
			lastMonth = month = false;
		}
		void add(bool last){
			n++;
			if(last){
				lastMonth = true;
			}else {
				month = true;
			}
		}
		bool isValid(){
			return lastMonth && month;
		}

		friend bool operator < (const Trading &a, const Trading &b){
			return a.id < b.id;
		}
};

int main(){
	int id, n;
	bool find;
	string s;
	vector<string> strings;
	vector<Trading> tradings;
	while (getline(cin, s)) {
		if (s.size() == 0) {
			break;
		}
		strings = split(s, ',');
		id = atoi(strings[0].c_str());
		n = atoi(strings[1].c_str());
		
		find = false;
		for (int i = 0; i < tradings.size(); i++) {
			if(id == tradings[i].id){
				tradings[i].add(false);
				find = true;
				break;
			}
		}
		if(!find){
			Trading t(id);
			t.add(false);
			tradings.push_back(t);
		}
	}
	while (~scanf("%d,%d", &id, &n)) {
		find = false;
		for (int i = 0; i < tradings.size(); i++) {
			if(id == tradings[i].id){
				tradings[i].add(true);
				find = true;
				break;
			}
		}
		if(!find){
			Trading t(id);
			t.add(true);
			tradings.push_back(t);
		}
	}
	
	sort(tradings.begin(), tradings.end());
	for (int i = 0; i < tradings.size(); i++) {
		if(tradings[i].isValid()){
			cout << tradings[i].id << " " << tradings[i].n << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll,ll> P;
typedef string str;
typedef vector<P> vp;
typedef vector<string> vs;
typedef vector<bool> vb;

const ll mod=1e9+7;
const ll inf=1e16;

#define rep(i,m,n) for(ll i=m;i<n;i++)
#define repr(i,m,n) for(ll i=m-1;i>=n;i--)
#define fi first
#define se second
#define chmax(x,y) x=max(x,y)
#define chmin(x,y) x=min(x,y)
#define eb(x) emplace_back(x)
#define pb(x) pop_back(x)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define sum(x) accumulate(all(x),0)
#define pc(x) __builtin_popcount(x)
#define gll greater<ll>()

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

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

Measured memory_bytes: 6360
#include <iostream>

using namespace std;

int main()
{
	int first = 0;
	int second = 0;
	int third = 0;
	for (int i = 0; i < 10; ++i) {
		int input;
		cin >> input;
		if (first < input) {
			third = second;
			second = first;
			first = input;
			continue;
		}
		else if (second < input) {
			third = second;
			second = input;
			continue;
		}
		else if (third < input) {
			third = input;
		}
	}

	cout << first << endl
		<< second << endl
		<< third << endl;

	return 0;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define CR cerr<<endl;
#define MOD 1000000007
#define INF 9223372036854775807
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
signed main(){
	int N; cin >> N;
	vector<int> d(N);
	REP(i, N) cin >> d[i];

	sort(d.begin(), d.end());
	int l = d[N / 2 - 1];
	int r = d[N / 2];
	cout << r - l << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    int n; cin>>n;
    map<char,ll> m;
    set<char> s;
    s.insert('M');
    s.insert('A');
    s.insert('R');
    s.insert('C');
    s.insert('H');
    for(int i = 0; i < n; ++i) {
        string str; cin>>str;
        if(s.count(str[0])) {
            ++m[str[0]];
        }
    }

    ll res = 0;

    res += m['M'] * m['A'] * m['R'];
    res += m['M'] * m['A'] * m['C'];
    res += m['M'] * m['A'] * m['H'];
    res += m['M'] * m['R'] * m['C'];
    res += m['M'] * m['R'] * m['H'];
    res += m['M'] * m['C'] * m['H'];
    res += m['A'] * m['R'] * m['C'];
    res += m['A'] * m['R'] * m['H'];
    res += m['A'] * m['C'] * m['H'];
    res += m['R'] * m['C'] * m['H'];

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int,int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1e9

using data=tuple<int,int,int>;	//頂点、コスト、変更数
auto cmp=[](data a, data b){return get<1>(a) > get<1>(b);};

int main(){
	int n,m,c;
	while(cin>>n>>m>>c,n){
		vector<vector<pii>> edge(n+1);
		rep(i,m){
			int a,b,p; cin>>a>>b>>p;
			edge[a].emplace_back(b,p);
		}
		vvi ans(n+1,vi(m+1,INF));
		priority_queue<data,vector<data>,decltype(cmp)> pq(cmp);
		pq.emplace(1,0,0);
		while(!pq.empty()){
			int node,cost,change;
			tie(node,cost,change)=pq.top(); pq.pop();
			if(ans[node][change]!=INF) continue;
			ans[node][change]=cost;
			for(auto adj:edge[node]){
				int next=adj.first, dist=adj.second;
				//if(ans[next][change]==INF)
					pq.emplace(next, cost+dist, change);
				//if(ans[next][change+1]==INF)
					pq.emplace(next, cost, change+1);
			}
		}
		int result=m;
		rep(i,m+1) if(ans[n][i]<=c) result=min(result,i);
		cout<<result<<endl;
	}
	return 0;
}



Measured memory_bytes: 44436
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

int N,X;
vector<ll> S;

#define MAX_N 200020
ll inv[MAX_N+10],fac[MAX_N+10],ifac[MAX_N+10];

void setComb(){
  inv[0]=1;inv[1]=1;fac[1]=1;ifac[1]=1;fac[0]=1;ifac[0]=1;
  for(int i=2;i<MAX_N;i++){
    inv[i]=(-MOD/i)*inv[MOD%i]%MOD;
    fac[i]=fac[i-1]*i%MOD;
    ifac[i]=ifac[i-1]*inv[i]%MOD;
  }
  return;
}

ll comb(ll n,ll k){
  if(n<k||n<0||k<0) return 0;
  else return ((fac[n]*ifac[k]%MOD*ifac[n-k]%MOD+MOD)%MOD);
}

ll hcomb(ll n,ll r){
  if(n==0&&r==0) return 1;
  else if(n<0||r<0) return 0;
  else return comb(n+r-1,r);
}

ll ans;
ll dp[100010][220];

ll dfs(int now,int used){
  if(used==N){
    dp[now][0]=now;
    return dp[now][0];
  }
  if(dp[now][N-used]>0) return dp[now][N-used];

  ll res=0;
  for(int i=0;i<S.size();i++){
    if(now<S[i]) break;
    int x=now%S[i];
    int w=upper_bound(S.begin(),S.end(),x)-S.begin();
    ll z=fac[N-used-1]*ifac[w]%MOD;
    //z=z*comb(N-used-1,w)%MOD;
    /*z=z*fac[w]%MOD;
    z=z*fac[N-used-1-w]%MOD;
    z=z*ifac[N-used-1]%MOD;*/
    z=(z+MOD)%MOD;

    ll p=dfs(x,N-w);
    p=(p+MOD)%MOD;
    p=p*z%MOD;
    res=(res+p)%MOD;
  }
  res=(res+MOD)%MOD;

  return dp[now][N-used]=res;
}


int main(){
  cin>>N>>X;
  S.resize(N,0);
  for(int i=0;i<N;i++) cin>>S[i];
  sort(S.begin(),S.end());

  setComb();
  for(int i=0;i<=100000;i++){
      for(int j=0;j<=N;j++){
          dp[i][j]=-1;
      }
  }

  ll fir=0;
  for(int i=0;i<N;i++){
    if(S[i]>X) fir++;
  }

  ll p=dfs(X,fir);
  ll z=fac[N]*ifac[N-fir]%MOD;
  z=(z+MOD)%MOD;
  p=p*z%MOD;
  cout<<(p+MOD)%MOD<<endl;
  //cout<<(ans+MOD)%MOD<<endl;

  return 0;
}


Measured memory_bytes: 176768
#include <stdio.h>
int main(void) {
    int a,b,c;
    
    scanf("%d %d %d",&a,&b,&c);
    
    if (a < b && b < c) {
        printf("Yes\n");
    }
    else {
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>

using ll = long long;

using namespace std;


int main() {
    int h, w;
    cin >> h >> w;
    vector<string> red(h, string(w, '.')), blue(h, string(w, '.'));
    for (int i=0; i<h; i++) {
        for (int j=0; j<w; j++) {
            char c; cin >> c;
            if (c == '#')
                red[i][j] = blue[i][j] = '#';
            else if ((j < w-1 && i % 2 == 0) || j == 0)
                red[i][j] = '#';
            else 
                blue[i][j] = '#';
        }
    }
    for (auto r:red) cout << r << endl << endl;
    for (auto b:blue) cout << b << endl;
    return 0;
}

Measured memory_bytes: 1280
/**
  * @brief atcoder
  * @author yao
  */
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#define ft first
#define sd second
#ifdef DBG
#   define dbg_pri(x...) fprintf(stderr,x)
#else
#   define dbg_pri(x...) 0
#   define NDEBUG
#endif //DBG
#include <cassert>

typedef unsigned int uint;
typedef long long int lli;
typedef unsigned long long int ulli;

#define N 262144
#define M 1048576
#define P 0xe6006a2cf4c46aedull
#define Q 0xa53f309b5c65e11dull

char buf[N+M];
char *ss[N];
int nss[N];
ulli lu[M*26];
int nlu;
ulli hashs[N];
int cnt[128];

int main()
{
    int n;
    scanf("%d", &n);
    char *p = buf;
    for(int i=0;i<n;++i)
    {
        scanf("%s", p), nss[i] = strlen(p);
        ss[i] = p, p += nss[i] + 1;
    }
    for(int i=0;i<n;++i)
        dbg_pri("poi 3: %s\n", ss[i]);
    for(int i=0;i<n;++i)
    {
        for(int j=0;j<nss[i];++j)
            ++cnt[ss[i][j]];
        ulli x = 0;
        int tn = nlu;
        for(int j=nss[i]-1;j>=0;--j)
        {
            x = (unsigned __int128) x * Q % P;
            for(int k='a';k<='z';++k)if(cnt[k])
            {
                lu[tn++] = x ^ k;
                dbg_pri("poi 1: %c %s %016llx\n", (char)k, ss[i]+j+1, x^k);
            }
            x^=ss[i][j];
            --cnt[ss[i][j]];
        }
        hashs[i] = x;
        dbg_pri("poi 2: %s %016llx\n", ss[i], x);
        std::sort(lu+nlu, lu+tn);
        nlu = std::unique(lu+nlu,lu+tn)-lu;
    }
    std::sort(lu,lu+nlu);
    lli ans = 0;
    for(int i=0;i<n;++i)
        ans += std::upper_bound(lu,lu+nlu,hashs[i]) - std::lower_bound(lu,lu+nlu,hashs[i]);
    ans -= n;
    printf("%lld\n", ans);
    return 0;
}


Measured memory_bytes: 202436
#include <iostream>

int main(){
   int a[5];
   for(int i=0; i<5; ++i)
      std::cin >> a[i];
   int k;
   std::cin >> k;

   for(int i=0; i<4; ++i){
      for(int j=i+1; j<5; ++j){
	 if(a[j]-a[i]>k){
	    std::cout << ":(" << std::endl;
	    return 0;
	 }
      }
   }


   std::cout << "Yay!" << std::endl;

   return 0;
}


Measured memory_bytes: 256
/*
 * Author: .-O_O-.
 */
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include<bits/stdc++.h>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define rep0(a,b) for(int a=0;a<b;a++)
#define rep1(a,b) for(int a=1;a<=b;a++)
#define repp(a,b,c) for(int a=b;a<c;a++)
#define in insert
#define len length()
#define si size()
#define lb lower_bound
#define ub upper_bound
#define beg begin()
#define en end()
#define f first
#define s second
#define pr(a) cout<<a
#define pr2(a,b) cout<<a<<" "<<b<<"\n"
#define nx cout<<"\n"
#define int long long
// void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
                                                     
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]"<<endl;}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define deb(x...)
#endif
const ll mod = 1000000007;
const ll N = 200005;
const ll mm = 1e+18;
void solve()
{
    int r=0;
    int p=0;
    string s;
    cin>>s;
    int n=s.len;
    int ans=0;
    rep0(i,n){
        if(s[i]=='g'){
            if(r>p){
                ans++;
                p++;
            }
            else r++;
        }
        else{
            if(r==p){
                ans--;
                r++;
            }
            else p++;
        }
    }
    pr(ans);
}
signed main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
    //cin>>t;
    rep1(_i,t){
        //cout<<"Case #"<<_i<<": ";
        solve();
        //nx;
    }
    return 0;
}


Measured memory_bytes: 3760
import java.util.Scanner;

class Main{
    public static void main(String[] args){
        
        Scanner scanner = new Scanner(System.in);
        int a,b,c;
        int count=0;
        
        a = scanner.nextInt();
        b = scanner.nextInt();
        c = scanner.nextInt();
        
        for(int i = a;i <= b;i++){
            if(c%i == 0){
                count++;
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 26388
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <iomanip>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>

#define debug(x) cout << #x << " = " << x << endl
#define fori(i, ini, lim) for(int i = int(ini); i < int(lim); i++)
#define ford(i, ini, lim) for(int i = int(ini); i >= int(lim); i--)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;

void solve() {
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    bool has = false;
    while (n > 0) {
        has |= (n % 10) == 7;
        n /= 10;
    }
    cout << (has ? "Yes" : "No") << endl;
    return 0;
}



Measured memory_bytes: 3612
#include <iostream>
#include <utility>
#include <iomanip>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
typedef long long ll;
using namespace std;
const int N = 2e5 + 5;
const int MOD = 1000000007;

int main()
{
    int n;
    cin >> n;
    string a = "";
    for (int i = 0; i < n; ++i)
    {
        a += "ACL";
    }
    cout << a << endl;
}

Measured memory_bytes: 3592
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>

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++)

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

int main() {
    int n, k, s;
    cin >> n >> k >> s;
    rep(i, k) cout << s << " ";
    rep(i, n - k) cout << (s == (int)1e9 ? 1 : (int)1e9) << " ";
    cout << endl;
}

Measured memory_bytes: 1280
#include<iostream>
#include<queue>
#include<algorithm>
#include<vector>
#include<string>
#include<utility>
using namespace std;



int main() {
	
	int  p, q, r,max;
	cin >> p >> q >> r;

	if (p > q) max = p;
	else max = q;
	if (max < r)max = r;
	cout << p + q + r - max << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ


		Scanner sc = new Scanner(System.in);

		//入力表示
		int a=sc.nextInt();
		String s=sc.next();

		if(a>=3200) {
 			System.out.println(s);
		}else {
			System.out.println("red");
		}
    }
}

Measured memory_bytes: 22612
import java.util.Scanner;

public class Main {

    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());

        int result = 0;
        if (b % a == 0) {
            result = a + b;
        } else {
            result = b - a;
        }

        System.out.println(result);
    }
}

Measured memory_bytes: 23380
from collections import defaultdict
def main():
    # init
    h,w,d = map(int,input().split())
    dic = defaultdict(list)
    for i in range(h):
        nums = [int(x) for x in input().split()]
        for j,num in enumerate(nums):
            dic[int(num)] = [i,j]
    # memo
    ls = [0 for i in range(w*h+1)]
    for i in range(d+1,w*h+1):
        before,after = dic[i-d],dic[i]
        diff = abs(after[0]-before[0]) + abs(after[1]-before[1])
        ls[i] = ls[i-d]+ diff
    # ans
    q = int(input())

    for i in range(q):
        l,r = map(int,input().split())
        print(ls[r]-ls[l])
if __name__ == "__main__":
    main()

Measured memory_bytes: 72156
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
    int cnt;
    string s1, s2, tmp;
    vector<string> sv1, sv2;

    while (cin >> s1) {
        if (s1 == ".") { break; }

        cin >> s2;

        sv1.clear(); sv2.clear();
        tmp = ""; cnt = 0;
        if (s1 == s2) { cout << "IDENTICAL" << endl; }
        else {
            for (int i = 0; i < s1.size()+1; i++) {
                if (s1[i] != '"' && i != s1.size()) { tmp += s1[i]; }
                else { sv1.push_back(tmp); tmp = ""; }
            }
            for (int i = 0; i < s2.size()+1; i++) {
                if (s2[i] != '"' && i != s2.size()) { tmp += s2[i]; }
                else { sv2.push_back(tmp); tmp = ""; }
            }
            if (sv1.size() != sv2.size()) { cnt += 2; }
            else {
                for (int i = 0; i < sv1.size(); i++) {
                    if (sv1[i] != sv2[i] && i % 2 == 1) { cnt++; }
                    else if (sv1[i] != sv2[i]) { cnt += 2; break; }
                }
            }
            cout << ((cnt == 1) ? "CLOSE" : "DIFFERENT") << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 3204
#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,i,ans;
	ans=-1;
	cin>>n;
	long double n1;
	n1=n*1.0;
	for (i=1;i<=n;i++)
	{
		if (floor(i*1.08)==n1)
		{
			ans=i;
			break;
		}
	}
	if (ans==-1)
	{
		cout<<":("<<endl;
	}
	else
	{
		cout<<ans<<endl;
	}
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n,m,i,ans=0;
  cin >> n >> m;
  vector<int>h(n),cnt(n,0);
  for(i=0; i<n; i++){
    cin >> h.at(i);
  }
  vector<int>a(m),b(m);
  for(i=0; i<m; i++){
    cin >> a.at(i) >> b.at(i);
    if(h.at(a.at(i)-1)>=h.at(b.at(i)-1)){
      cnt.at(b.at(i)-1)++;
    }
    if(h.at(a.at(i)-1)<=h.at(b.at(i)-1)){
      cnt.at(a.at(i)-1)++;
    }
  }
  for(i=0; i<n; i++){
    if(cnt.at(i)==0){
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 4844