akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace CSharp
{
    class Program
    {
        static void Main(string[] args)
        {
            ReadString();
            long[] A = ReadLongArray();

            int numNegatives = A.Count(x => x < 0);
            long ans;
            if (numNegatives % 2 == 0)
            {
                ans = A.Sum(x => Abs(x));
            }
            else
            {
                ans = A.Sum(x => Abs(x)) - A.Min(x => Abs(x)) * 2;
            }

            Console.WriteLine(ans);
        }

        #region Helpers

        static int[] ReadIntArray() => Console.ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        static long[] ReadLongArray() => Console.ReadLine().Split().Select(s => long.Parse(s)).ToArray();

        static int[] ReadLineIntArray(int count) => Enumerable.Repeat(0, count).Select(_ => int.Parse(Console.ReadLine())).ToArray();
        static long[] ReadLineLongArray(int count) => Enumerable.Repeat(0, count).Select(_ => long.Parse(Console.ReadLine())).ToArray();

        static string ReadString() => Console.ReadLine();
        static int ReadInt() => int.Parse(Console.ReadLine());
        static long ReadLong() => long.Parse(Console.ReadLine());

        static void ReadInt(out int first)
        {
            var array = ReadIntArray();
            first = array[0];
        }

        static void ReadInt(out int first, out int second)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
        }

        static void ReadInt(out int first, out int second, out int third)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadInt(out int first, out int second, out int third, out int fourth)
        {
            var array = ReadIntArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        static void ReadLong(out long first)
        {
            var array = ReadLongArray();
            first = array[0];
        }

        static void ReadLong(out long first, out long second)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
        }

        static void ReadLong(out long first, out long second, out long third)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
        }

        static void ReadLong(out long first, out long second, out long third, out long fourth)
        {
            var array = ReadLongArray();
            first = array[0];
            second = array[1];
            third = array[2];
            fourth = array[3];
        }

        #endregion
    }
}

Measured memory_bytes: 31324
#include<stdio.h>
int main(void)
{
	int n,p[101],i,j,cnt;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		scanf("%d",&p[i]);
	}
	for(i=100;i>=1;i--){
		cnt=0;
		for(j=1;j<=n;j++){
			if(i<=p[j]){
				cnt++;
			}
		}
		if(cnt>=i)	break;
	}
	printf("%d\n",i);
	return 0;
}



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

int main() {
  int N;
  cin >> N;
  vector<vector<int>> A(N, vector<int>(N));
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < N; j++) {
      cin >> A.at(i).at(j);
    }
  }
  long ans = 0;
  for (int i = 0; i < N; i++) {
    for (int j = i + 1; j < N; j++) {
      int d = A.at(i).at(j);
      for (int k = 0; k < N; k++) {
        if (k == i || k == j) continue;
        int d2 = A.at(i).at(k) + A.at(k).at(j);
        if (d2 < d) return cout << -1 << "\n", 0;
        if (d2 == d) goto NG;
      }
      ans += d;
      NG:;
    }
  }
  cout << ans << "\n";
}

Measured memory_bytes: 640
import java.util.*;
import java.io.*;

public class Main {
	static FastReader f = new FastReader();
	static PrintWriter out = new PrintWriter(System.out);

	public static void main(String[] args) {
		solve();
		out.close();
	}

	static void solve() {
		String s = f.next(), t = f.next();
		int min = Integer.MAX_VALUE;
		for(int i=0;i<s.length()-t.length()+1;i++) {
			int cnt = 0;
			for(int j=0;j<t.length();j++) {
				if(s.charAt(i+j) != t.charAt(j)) {
					cnt++;
				}
			}
			min = Math.min(cnt, min);
		}

		out.println(min);
	}

	static class FastReader {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st;

		String next() {
			while(st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch(IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		String nextLine() {
			String str = "";

			try {
				str = br.readLine();
			} catch(IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		double nextDouble() {
			return Double.parseDouble(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}
	}
}

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

typedef long long s64;
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define per(i,r,l) for(int i=r;i>=l;--i)
const int N=2e5+5;
int a[N],nex[N];

int main()
{
//	freopen("1.in","r",stdin);
	int n;cin>>n;
	rep(i,1,n)scanf("%d",a+i);
	nex[n+1]=n+1;
	per(i,n,1)nex[i]=a[i]?i:nex[i+1];
	s64 ans=0;
	rep(l,1,n)
	{
		int r=l,now=a[l];
		while(r<=n)
		{
			r=nex[r+1];
			if(a[r]&now)break;
			now+=a[r]; 
		}
		ans+=r-l;
	}
	cout<<ans;
}

Measured memory_bytes: 1792
import java.awt.*;
import java.io.*;
import java.util.*;

class Main {
    static Scanner scanner = new Scanner();

    public static void main(String[]$) throws IOException {
        int n = scanner.nextInt();
        Point[] a = new Point[n];
        Point[] b = new Point[n];
        for (int i = 0; i < n; i++) {
            a[i] = b[i] = new Point(scanner.nextInt(), i);
        }
        Arrays.sort(b, Comparator.comparingInt(array -> array.x));
        for (int i = 0; i < n; i++) {
            a[b[i].y].x = i;
        }
        int count = 0;
        for (int i = 0; i < n; i++) {
            if (a[i].x % 2 != i % 2) {
                count++;
            }
        }
        System.out.println(count / 2);
    }

    static class Scanner {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 1 << 15);
        StringTokenizer tokenizer;

        String next() throws IOException {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
            return tokenizer.nextToken();
        }

        int nextInt() throws IOException {
            return Integer.parseInt(next());
        }

        long nextLong() throws IOException {
            return Long.parseLong(next());
        }
    }
}

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


int main(){
    int n;
    cin >> n;
    for(; n > 0; n /= 10){
        if(n%10 == 9){
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B,C,D;
  cin>>A>>B>>C>>D;
  
  int aoki,taka;
  aoki = (C+B-1)/B;
    taka = (A+D-1)/D;
  if(aoki<=taka)cout<<"Yes"<<endl;
  if(aoki>taka)cout<<"No"<<endl;
  
}


Measured memory_bytes: 3600
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

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


    rep(ite,k){
        string u = s;
        drep(i,n){
            u += s[i];
        }

        if(ite==k-1){
            rep(i,n+1){
                string s_;
                srep(j,i,i+n){
                    s_ += u[j];
                }
                if(s_ < s){
                    s = s_;
                }
            } 
        }else{
            string t;
            rep(i,n+1){
                string t_;
                srep(j,i,i+n){
                    t_ += u[j];
                }
                reverse(t_.begin(), t_.end());
                if(i==0){
                    t = t_;
                }else{
                    if(t_ < t){
                        t = t_;
                    }
                }
            } 
            reverse(t.begin(), t.end());
            s = t;
        }

        int flag = 0;
        rep(i,n-1){
            if(s[i]!=s[i+1]){
                flag = 1;
                break;
            }
        }
        if(flag == 0)break;
    }

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



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

using namespace std;

int GCD(int a, int b){return b == 0 ? a : GCD(b, a % b);}

bitset<1003> prime;

int main(){

    cin.sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    //freopen("input.txt", "r", stdin);

    int n;
    long long prod = 1, MOD = 1000000007;

    cin >> n;

    for(int i = 2; i <= n; i += 2)
        prime[i] = 1;

    for(int j = 2; j <= n; j += j)
        prod += n / j;

    for(int i = 3; i <= n; i += 2){

        if(prime[i] == 0){

            // Count number of times n! can be divided by i

            long long cnt = 1;

            for(long long j = i; j <= n; j *= i)
                cnt += n / j;

            prod = prod * cnt % MOD;

            for(int j = i * i; j <= n; j += i + i)
                prime[j] = 1;

        }

    }

    cout << prod;

    return 0;
}


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

int A[200010];

int main() {
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    sort(A, A + N);
    for (int i = 0; i < N - 1; i++) {
        if (A[i] == A[i + 1]) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Measured memory_bytes: 1024
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll N;
vll leftv;
vll rightv;
vll aaa;

ll ltmp;
string stmp;
double dtmp;


vector<ll> G[base10_5+10];
map<string,ll> color_map;
ll top_color[base10_5+10]={};
string getMapId(ll from, ll to){
    return to_string(from) + "-" + to_string(to);
}





/*
max 448,000,000
count_map['0']=0;
for(auto x : count_map) {
    string key = x.first;
    ll value = x.second;
}
*/
vll ans;
int main(){

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



    //木構造であることを利用すれば一気に解ける
    //子要素はまず、親要素との間の色を使う、そしてそれ以外の色を子要素に対して使う
    //一回木構造を組んで親ー子のセットでマップを組んで色を決めて、それを入力順に出力する。


    cin >> N;
    rep(ni,N-1){
        ll li,ri;
        cin >> li;
        cin >> ri;
        G[li].push_back(ri);
        leftv.push_back(li);
        rightv.push_back(ri);
    }
    /*
    N = base10_5;
    rep(ni,N-1){
        ll li = 1;
        ll ri = ni + 2;
        G[li].push_back(ri);
        leftv.push_back(li);
        rightv.push_back(ri);
    }
    */

    for( ll nodei = 1 ; nodei <=N-1 ; nodei++ ){
        ll base_color = 1;
        rep(gi,G[nodei].size()){
            ll child_nodei = G[nodei][gi];
            if(base_color==top_color[nodei]) base_color++;

            string map_id = getMapId(nodei,child_nodei);
            color_map[map_id]=base_color;
            top_color[child_nodei] = base_color;

            base_color++;
        }
    }

    ll K = 0;
    rep(ni,N-1){
        ll li = leftv[ni];
        ll ri = rightv[ni];
        string map_id = getMapId(li,ri);
        ll color = color_map[map_id];

        if(K < color) K = color;
    }

    cout << K << endl;
    rep(ni,N-1){
        ll li = leftv[ni];
        ll ri = rightv[ni];
        string map_id = getMapId(li,ri);
        ll color = color_map[map_id];

        cout << color << endl;
    }


}

Measured memory_bytes: 17616
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define pb push_back
#define SZ(x) ((ll).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repi(i, a, b) for(ll i = ll(a); i < ll(b); i++)
const double PI = acos(-1);
const int mod = 1e9+7;
const long long INF = (1LL << 60);
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}

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

  ll a, b, c;
  cin >> a >> b >> c;

  if(a == b && b == c){
    if(a % 2 == 1) cout << 0 << endl;
    else cout << -1 << endl;
    return 0;
  }

  ll ans = 0;
  while(1){
    if(a % 2 == 1 || b % 2 == 1 || c % 2 == 1) break;
    ll tmp1 = a/2, tmp2 = b/2, tmp3 = c/2;
    a = tmp2 + tmp3, b = tmp1 + tmp3, c = tmp1 + tmp2;
    ans++;
    //cout << a << ' ' << b << ' ' << c << endl;
  }
  cout << ans << endl;
  return 0;
}

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

bool NARA(int x){
  if(x >=1){
    if(x <=12){
      return true;
    }else{
      return false;
    }
  }else{
    return false;
  }
}
      

int main() {
  int S;
  cin >>S;
  int zenhan,kouhan;
  zenhan = S/100;
  kouhan = S%100;
  
  if(NARA(zenhan)){
    if(NARA(kouhan)){
      cout <<"AMBIGUOUS" <<endl;
    }else {
      cout <<"MMYY" <<endl;
    }
   }else if(NARA(kouhan)){
    cout <<"YYMM" <<endl;
  }else{
    cout << "NA" <<endl;
  }
  
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <set>
using namespace std;
int main(){
    std::ios::sync_with_stdio(false);
    cin.tie(0);
    set<string> S;
    int n;
    cin >> n;
    string op;
    for(int i=0;i<n;++i){
        cin >> op;
        if(op=="insert"){
            string val;
            cin >> val;
            S.insert(val);
        }else if(op=="find"){
            string val;
            cin >> val;
            if(S.count(val)!=0){
                cout << "yes" << endl;
            }else{
                cout << "no" << endl;
            }
        }
    }
}


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

int n, m, x, c[12], a[12][12];

int dp(int now, int choose[12], int tot[12]){
    if (now == n){
        for (int i = 0; i < m; i++){
            if (tot[i] < x) return -1;
        }
        int ret = 0;
        for (int i = 0; i < n; i++){
            if (choose[i]) ret += c[i];
        }
        return ret;
    }
    int mn = dp(now+1, choose, tot);
    for (int i = 0; i < m; i++){
        tot[i] += a[now][i];
    }
    choose[now] = 1;
    int ret = dp(now+1, choose, tot);
    for (int i = 0; i < m; i++){
        tot[i] -= a[now][i];
    }
    choose[now] = 0;
    if (mn == -1) mn = ret;
    else if (ret != -1 && ret < mn) mn = ret;
    return mn;
}

int main() {
    cin >> n >> m >> x;
    for (int i = 0; i < n; i++){
        cin >> c[i];
        for (int j = 0; j < m; j++){
            cin >> a[i][j];
        }
    }
    int _choose[12] = {}, _tot[12] = {};
    cout << dp(0, _choose, _tot) << "\n";
}


Measured memory_bytes: 3676
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <map>
using namespace std;

struct node{
    int key;
    node *p,*l,*r;
};

node *root,*NIL;


void insert(int k){
    node *z;
    z = (node *)malloc(sizeof(node));
    z->key=k;
    z->l=NIL;
    z->r=NIL;
    node *y=NIL;
    node *x=root;
    while(x != NIL){
        y=x;
        if(k < x->key) x = x->l;
        else x = x->r;
    }
    z->p=y;

    if(y==NIL) root=z;
    else if(k < y->key) y->l=z;
    else y->r=z;
}

void Preorder(node *u){
    cout << ' ' << u->key;
    if(u->l != NIL) Preorder(u->l);
    if(u->r != NIL) Preorder(u->r);
}

void Inorder(node *u){
    if(u->l != NIL) Inorder(u->l);
    cout << ' ' << u->key;
    if(u->r != NIL) Inorder(u->r);
}

int main(){
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        string s;
        cin >> s;
        if(s == "insert"){
            int k;
            cin >> k;
            insert(k);
        }
        else{
            Inorder(root);
            cout << endl;
            Preorder(root);
            cout << endl;
        }
    }
}


Measured memory_bytes: 26608
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
typedef long long ll;
multiset<ll> s;
int n;

int main()
{
    scanf("%d",&n);
    for(int i = 1; i <= n; i ++){
      int x;
      scanf("%d",&x);
      if(s.empty()){
        s.insert(x);
        continue;
      }
      auto it = s.lower_bound(x);
      if(it == s.begin()) s.insert(x);
      else{
        s.erase(-- it);
        s.insert(x);
      }
    }
    printf("%d\n", s.size());
    return 0;
}



Measured memory_bytes: 4992
month = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30]
day = ['Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday', 'Monday', 'Tuesday']
while True:
    m, d = map(int, input().split())
    if m == 0:
        break
    print(day[(sum(month[:m - 1]) + d) % 7])

Measured memory_bytes: 7504
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define int long long
#define INF 1145141919810364364
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int n, a[200010];
int cnt[200010];
int cnt2;

signed main() {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		cnt[a[i]]++;
	}
	for (int i = 1; i <= 200000; i++)cnt2 += cnt[i] * (cnt[i] - 1) / 2;
	for (int i = 0; i < n; i++) {
		int x = cnt[a[i]] * (cnt[a[i]] - 1) / 2 - (cnt[a[i]] - 1)*(cnt[a[i]] - 2) / 2;
		cout << cnt2 - x << endl;
	}
}


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

int main() {
	int A_1, A_2, A_3;
	cin >> A_1 >> A_2 >> A_3;
	int sum;
	sum = A_1 + A_2 + A_3;
	if (sum >= 22) cout << "bust" << endl;
	else cout << "win" << endl;
}

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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)

using namespace std;
using ll = long long;

const int MOD = 1000000007;

class mint {
  int n;
public:
  mint(int n_ = 0) : n(n_) {}
  friend mint operator-(mint a) { return -a.n + MOD * (a.n != 0); }
  friend mint operator+(mint a, mint b) { int x = a.n + b.n; return x - (x >= MOD) * MOD; }
  friend mint operator-(mint a, mint b) { int x = a.n - b.n; return x + (x < 0) * MOD; }
  friend mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
  friend mint &operator+=(mint &a, mint b) { return a = a + b; }
  friend mint &operator-=(mint &a, mint b) { return a = a - b; }
  friend mint &operator*=(mint &a, mint b) { return a = a * b; }
  friend bool operator==(mint a, mint b) { return a.n == b.n; }
  friend bool operator!=(mint a, mint b) { return a.n != b.n; }
  friend istream &operator>>(istream &i, mint &a) { return i >> a.n; }
  friend ostream &operator<<(ostream &o, mint a) { return o << a.n; }
};

const int B = 2500;

mint dp[55][55][5050];

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N, K;
  cin >> N >> K;
  dp[0][0][B] = 1;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= N; j++) {
      for (int k = 0; k <= 2*B; k++) {
        if (dp[i][j][k] == 0) continue;
        dp[i+1][j][k] += dp[i][j][k];
        if (j>0) dp[i+1][j][k+i-i] += j*dp[i][j][k];
        dp[i+1][j+1][k-i-i] += dp[i][j][k];
        if (j>0) dp[i+1][j][k-i+i] += j*dp[i][j][k];
        if (j>0) dp[i+1][j-1][k+i+i] += j*j*dp[i][j][k];
      }
    }
  }
  cout << dp[N][0][B+K] << endl;
}

Measured memory_bytes: 59904
import sys

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def main():
    H, W, M = MI()
    hh = [0]*(H+1)
    ww = [0]*(W+1)
    bomb = set()
    for _ in range(M):
        h, w = MI()
        hh[h] += 1
        ww[w] += 1
        bomb.add((h, w))
    h_max = max(hh)
    w_max = max(ww)
    ans = h_max+w_max
    h_index = [i for i, v in enumerate(hh) if v == h_max]
    w_index = [i for i, v in enumerate(ww) if v == w_max]
    flag = True
    for i in h_index:
        for j in w_index:
            if (i, j) not in bomb:
                flag = False
                break
        if not flag:
            break
    if flag:
        ans -= 1
    print(ans)

if __name__ == '__main__':
    main()

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

int main(){
  int x;vector<int> anss;
  while(cin>>x){
    anss.push_back(1+0.5*x*(x+1));
  }
  for(int i=0;i<anss.size();i++){
    cout<<anss[i]<<endl;
  }
  return 0;
}

Measured memory_bytes: 3108
#include <stdio.h>

int main()
{
	int n, i;
  	scanf("%d", &n);
  	int a[n+1], b[n+1];
  	for(i=1; i<=n; i++){
    	scanf("%d", &a[i]);
    }
  
  	for(i=1; i<=n; i++){
    	b[a[i]]=i;
    }
	
  	for(i=1; i<=n; i++){
    printf("%d ", b[i]);
    }
  
}

Measured memory_bytes: 1536
'''input
0
'''

S=input()

da, db=0,0
A=[]
B=[]
# print(da,db)

for i in range(len(S)):
	A.append(i%2)
	B.append((i+1)%2)
	# print(S[i])
	da+=abs(A[i]-int(S[i]))
	db+=abs(B[i]-int(S[i]))

# print(A, B)
print(min(da, db))

Measured memory_bytes: 4848
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
#include <unordered_set>
// #include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
// using namespace boost::multiprecision;

const double EPS = 1e-10;
long long const MOD = 1000000007;

typedef vector<int> vec;
typedef vector<vec> mat;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

long long my_mod_pow(long long x, long long n) {
	long long ret = 1;
	for (; n > 0; n >>= 1, x = x * x % MOD) {
		if (n & 1) {
			ret = ret * x % MOD;
		}
	}
	return ret;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

void fastInput() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

int main(void) {
    Int sum = 0;
    int N; cin >> N;
    vector<int> d(N);
    for (int i = 0; i < N; i++) {
        cin >> d[i];
    }
    for (int i = 0; i < N; i++) {
        for (int j = i+1; j < N; j++) {
            sum += d[i] * d[j];
        }
    }

    cout << sum << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<map>
#include<string>
#include<sstream>
using namespace std;
int inf = 1000000000;

int main(){

  int a, b, c;
  cin >> a >> b >> c;

  for(int i=1; i<1000; i++){
    if( (i*a)%b == c ){
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;

  return 0;
}





//


Measured memory_bytes: 256
#include<stdio.h>

int bubbleSort(int A[], int N){
  int i, j, v, sw = 0;
  int flag = 1;
  for(i=0; flag; i++){
    flag = 0;
    for(j=N-1; j>=i+1; j--){
      if(A[j]<A[j-1]){
	v = A[j];
	A[j] = A[j-1];
	A[j-1] = v;
	flag = 1;
	sw++;
      }
    }
  }

  return sw;
}

int main(){
  int i, A[100], N, sw;
  scanf("%d", &N);
  for(i=0; i<N; i++) scanf("%d", &A[i]);

  sw = bubbleSort(A, N);

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

  printf("\n");
  printf("%d\n", sw); 

  return 0;
}

     
      
	
     
      
     



Measured memory_bytes: 2048
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ll long long 
#define REP(i, a, b) for (ll i = a; i < b; i++)
#define REPI(i, a, b) for (ll i = b - 1; i >= a; i--)
#define i_os ios::sync_with_stdio(0);  cin.tie(0);  cout.tie(0);
#define INF (ll)1e18 + 100
#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/
#define o_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define o_setll tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
typedef tree<pair<ll, ll>,null_type,less<pair<ll, ll>>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set1;
//1. order_of_key(k) : number of elements strictly lesser than k
//2. find_by_order(k) : k-th element in the set

int main() 
{
	ll n,k;
	cin>>n>>k;
	ll arr[n+1];
	REP(i,1,n+1) cin>>arr[i];
	REP(j,0,k){
		ll pref[n+1] = {0},pref1[n+1] = {0};
		REP(i,1,n+1){
			if(i + arr[i] <= n){
				pref[i + arr[i]]++;
			}
			else {
				pref[n]++;	
			}
			if(i - arr[i] - 1 >= 1){
				pref1[i - arr[i] - 1]++;
			}
		}
		REPI(i,1,n){
			pref[i] += pref[i+1];
		}
		REPI(i,1,n){
			pref1[i] += pref1[i+1];
		}
		REP(i,1,n+1){
			pref[i] = pref[i] - pref1[i]; 
		}
		bool f = 0;
		ll ct = 0;
		REP(i,1,n+1){
			if(arr[i] != pref[i]) f = 1;
			arr[i] = pref[i];
			if(arr[i] == n) ct++;
		}
		if(ct == n || f == 0){
			break;
		}
	}
	REP(i,1,n+1) cout<<arr[i]<<" ";
	cout<<endl;
	return 0;
}

Measured memory_bytes: 8316
#!/usr/bin/env python3

def main():
    s = input()
    word_list = ['dream', 'dreamer', 'erase', 'eraser']

    i = len(s)
    while 0 < i:
        f = False
        for w in word_list:
            if s[i - len(w):i] == w:
                i -= len(w)
                f = True
                break
        if not f:
            break

    print('YES' if f else 'NO')


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
using ll = int64_t;
using P = pair<ll,ll>;
int64_t INF = 10010010010;
// int64_t INF = 1000000007;
// int64_t INF = 9223372036854775807;
// int64_t INF = 998244353;

vvi mem(21,vi(0));

ll getSalary(ll i){
    if(mem.at(i).size()==0) return 1;
    if(mem.at(i).size()==1) return 2*getSalary(mem.at(i).at(0))+1;
    ll maxS = -1;
    ll minS = INF;
    for(ll j:mem.at(i)){
        maxS = max(maxS, getSalary(j));
        minS = min(minS, getSalary(j));
    }
    return maxS + minS + 1;
}
int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    string s;
    cin >> s;
    // 切り替わる数を左右で比較
    ll res = 0;
    rep(i,s.size()-1) if(s.at(i)!=s.at(i+1)) res++;
    cout << res << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

int main()
{
	ll a,b,c,k;
	ll ans=0;
	
	cin>>a>>b>>c>>k;
	if(k%2==0)
		ans=a-b;
	else
		ans=(a-b)*-1;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

public class Main {

  private static void solve() {
    int n = nextInt();
    int h = nextInt();
    int w = nextInt();

    System.out.println((n - h + 1) * (n - w + 1));
  }

  private static void run() {
    br = new BufferedReader(new InputStreamReader(System.in));
    out = new PrintWriter(System.out);

    solve();

    out.close();
  }

  private static StringTokenizer st;
  private static BufferedReader br;
  private static PrintWriter out;

  private static String next() {
    while (st == null || !st.hasMoreElements()) {
      String s;
      try {
        s = br.readLine();
      } catch (IOException e) {
        return null;
      }
      st = new StringTokenizer(s);
    }
    return st.nextToken();
  }

  private static int nextInt() {
    return Integer.parseInt(next());
  }

  private static long nextLong() {
    return Long.parseLong(next());
  }

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

Measured memory_bytes: 21076
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

public class Main {

    private static final String LINE_SEPARATOR = System.getProperty("line.separator");

    public static void main(String[] args) {
        System.out.println(process(readAll(System.in)));
    }

    protected static String process(String data) {
        final String[] split = data.split("\\n");

        int i = 1;
        StringBuilder sb = new StringBuilder();
        for (String s : split) {
            if ("0".equals(s)) {
                break;
            }
            if (sb.length() > 0) {
                sb.append(LINE_SEPARATOR);
            }
            sb.append("Case ").append(i++).append(": ").append(s);
        }

        return sb.toString();
    }

    protected static String readAll(InputStream is) {
        InputStreamReader r = null;
        BufferedReader br = null;

        try {
            r = new InputStreamReader(is);
            br = new BufferedReader(r);
            StringBuilder sb = new StringBuilder();
            String s;

            while ((s = br.readLine()) != null) {
                sb.append(s).append('\n');
            }

            return sb.toString();
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            if (br != null) {
                try {
                    br.close();
                } catch (IOException e) {
                }
            }
            if (r != null) {
                try {
                    r.close();
                } catch (IOException e) {
                }
            }
        }
    }
}

Measured memory_bytes: 25244
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

struct pkt
{
    int x, y, h;
};

int main()
{
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    vector<pkt> p(n);
    for (int i = 0; i < n; ++i)
        cin >> p[i].x >> p[i].y >> p[i].h;
    for (int x = 0; x <= 100; ++x)
    {
        for (int y = 0; y <= 100; ++y)
        {
            int h;
            for (int i = 0; i < n; ++i)
            {
                int dl = abs(x - p[i].x) + abs(y - p[i].y);
                if (p[i].h > 0)
                    h = p[i].h + dl;
            }
            bool ok = true;
            for (int i = 0; i < n; ++i)
            {
                int dl = abs(x - p[i].x) + abs(y - p[i].y);
                if (max(h - dl, 0) != p[i].h)
                    ok = false;
            }
            if (ok)
            {
                cout << x << " " << y << " " << h;
                return 0;
            }
        }
    }
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
	int a[1000], n, i, j, t, c=0, min;	cin >> n;
	for(i = 0;i < n;i++) cin >> a[i];
	for(i = 0;i < n;i++){
		min = i;
		for(j = i;j < n;j++){
			if(a[j] < a[min]) min = j;
		}
		if(i != min){
			t = a[min];
			a[min] = a[i];
			a[i] = t;
			c++;
		}
	}
		for(i = 0;i < n;i++){
			if(i) cout << " ";
			cout << a[i];
		}
		cout << endl << c << endl;
			return 0;
		
}



Measured memory_bytes: 3104
#include <cstdio>

using namespace std;
int n,p,nr,x,i,j;
long long nr1,nr2,nr3;
int main()
{
    scanf ("%d %d", &n, &p);
    nr=0;
    for (i=1;i<=n;i++)
    {
        scanf ("%d", &x);
        if (x%2==1)
            nr++;
    }
    nr1=1LL;
    for (i=1;i<=(n-nr);i++)
        nr1=(1LL)*nr1*2;
    if (p==0)
    {
        p=2;
        nr3=(0LL)+nr1;
    }
    else
        nr3=0LL;
    for (i=p;i<=nr;i+=2)
    {
        nr2=1LL;
        for (j=(i+1);j<=nr;j++)
            nr2=(1LL)*nr2*j/(j-i);
        nr3=(0LL)+nr3+(1LL)*nr1*nr2;
    }
    printf ("%lld\n", nr3);
    return 0;
}


Measured memory_bytes: 128
# include "cstdio"
# include "iostream"

using namespace std;

const int maxm=4e2+10;
const long long Inf=1ll<<60;

int N;
long long A[maxm],Add[maxm],DP[maxm][maxm];

int main(){
	register int i,k,Left,Right;
	scanf("%d",&N);
	for(i=1;i<=N;i++) scanf("%lld",A+i),Add[i]=Add[i-1]+A[i];
	for(i=2;i<=N;i++){
		for(Left=1;Left+i-1<=N;Left++){
			Right=Left+i-1;
			DP[Left][Right]=Inf;
			for(k=Left;k<Right;k++){
				DP[Left][Right]=min(DP[Left][Right],DP[Left][k]+DP[k+1][Right]+Add[Right]-Add[Left-1]);
			}
		}
	}
	printf("%lld\n",DP[1][N]);
	return 0;
}

Measured memory_bytes: 1536
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define gcd __gcd
#define lcm(n, m) (n * m / gcd(n, m))
#define np next_permutation
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define repill(i, m, n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define repll(i, n) repill(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define each(i, n) for(auto&& i: n)
#define so(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(), n.end())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// sqrt ルート, int 2*10^9, gcd　最大公約数

int main() {
  ll L, R, a = 2018;
  ci(L, R);
  repi(i, L, R){
    if(i % 2019 == 0){
      co(0);
      rt;
    }
  }
  repill(i, L % 2019, R % 2019 + 1){
    repill(j, L % 2019, R % 2019 + 1){
      if(i != j){
        a = min(a, (i * j) % 2019);
      }
    }
  }
  co(a);
}

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

int v[12];
int H, W;

void func(int x) {
    for (int i = 0; i < H + W; i++) {
        v[i] = x % int(pow(2, i + 1)) / int(pow(2, i));
    }
}

int main() {
    int K, num, ans = 0, count;
    cin >> H >> W >> K;
    vector<vector<char>>c(H, vector<char>(W)), d(H, vector<char>(W));
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            cin >> c.at(i).at(j);
        }
    }
    num = pow(2, H + W);
    for (int i = 0; i < num; i++) {
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                d.at(i).at(j) = c.at(i).at(j);
            }
        }
        func(i);
        for (int j = 0; j < H+W; j++) {
            if (v[j] == 1) {
                if (j < H) {
                    for (int k = 0; k < W; k++) {
                        if (d.at(j).at(k) != 'r') {
                            d.at(j).at(k) = 'r';
                        }
                    }
                }
                else {
                    for (int k = 0; k < H; k++) {
                        if (d.at(k).at(j-H) != 'r') {
                            d.at(k).at(j-H) = 'r';
                        }
                    }
                }
            }
        }
        count = 0;
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if (d.at(i).at(j) == '#') {
                    count++;
                }
            }
        }
        if (count == K) {
            ans++;
        }
    }
    cout << ans;
}

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

int main(){
  string s;
  cin>>s;
  if(s.size()!=26){
    map<char,int> mp;
    rep(i,s.size()){
      mp[s[i]]=1;
    }
    rep(i,26){
      if(mp['a'+i]!=1){
        s+=('a'+i);
        break;
      }
    }
    cout<<s<<endl;
  }else{
    if(s=="zyxwvutsrqponmlkjihgfedcba"){
      cout<<-1<<endl;
      return 0;
    }
    vector<char> tmp;
    tmp.push_back(s[25]);
    for(int i=24; i>=0; i--){
      char ch='{';
      for(auto x : tmp){
        if(x > s[i]){
          ch=min(ch,x);
        }
      }
      if(ch!='{'){
        s = s.substr(0,i);
        s+=ch;
        break;
      }
      tmp.push_back(s[i]);
    }
    cout<<s<<endl;
  }
}


Measured memory_bytes: 3556
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
#include <iomanip>
#include <fstream>
#include <stack>

using namespace std;
 
#define ll int
typedef unsigned long long ull;
typedef long double ld;

#define pii         pair<ll ,ll >
#define vi          vector<ll >
#define vii         vector<pii>
#define mi          map<ll ,ll >
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define pb          push_back
#define hell        1000000007 
#define rep(i,a,b)  for(ll int i=a;i<b;i++)
#define take        for(ll i=0;i<n;i++) cin>>v[i];
#define MAXN        1000005



int spf[MAXN];
    void sieve()
    {
        spf[1] = 1;
        for (int i=2; i<MAXN; i++)
            spf[i] = i;
        for (int i=4; i<MAXN; i+=2)
            spf[i] = 2;
 
        for (int i=3; i*i<MAXN; i++)
        {
            if (spf[i] == i)
            {
                for (int j=i*i; j<MAXN; j+=i)
 
                    if (spf[j]==j)
                        spf[j] = i;
            }
        }
    }
set<int> gf(int x)
    {
        set<int> ret;
        while (x != 1)
        {
            ret.insert(spf[x]);
            x = x / spf[x];
        }
        return ret;
    }


void solve()
{
	ll n;
	cin>>n;
	vi v(n);
	ll mx=0;
	for(ll i=0;i<n;i++)
	{
		cin>>v[i];
		mx=max(mx,v[i]);
	}
	vector<set<ll> >z;
	mi m;
	for(auto x:v)
	{
		set<ll>s=gf(x);
		z.pb(s);
	}
	ll g=1;
	for(auto &x:z)
	{
		for(auto &xx:x)
		{
			m[xx]++;
			g=max(g,m[xx]);
		}
	}
//	cout<<g<<endl;
	if(g==1)
	{
		cout<<"pairwise coprime"<<endl;
	}
	else if(g<n)
	{
		cout<<"setwise coprime"<<endl;
	}
	else
	{
		cout<<"not coprime"<<endl;
	}
	
}
int main()
{
	ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
      
    ll t;
    sieve();
    t=1;
        
    
   // cin>>t;
    while(t--)
    solve();
}

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

int main() {
    int N; cin >> N;
    vector<vector<int>> var(N, vector<int>(2));
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < 2; j++) {
            cin >> var.at(i).at(j);
        }
    }
    
    long double sum = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i+1; j < N; j++) {
            sum += sqrt((var.at(i).at(0) - var.at(j).at(0)) * (var.at(i).at(0) - var.at(j).at(0)) + (var.at(i).at(1) - var.at(j).at(1)) * (var.at(i).at(1) - var.at(j).at(1))) * 2;
        }
    }
    cout << setprecision(15);
    cout << sum / N << endl;
}

Measured memory_bytes: 3820
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
#include <sstream>
#include <bitset>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;


int main()
{
    ll K;
    cin >> K;
    
    vector<int> remain(K,-1);
    ll tmp=7,cnt=1,ans=-1;
    while(true){
        tmp%=K;
        if(tmp==0){
            ans=cnt;
            break;
        }else if(remain[tmp]!=-1){
            break;
        }
        remain[tmp]=1;
        cnt++;
        tmp=tmp*10+7;
    }
    

    cout << ans << endl;
    


    return 0;
}

Measured memory_bytes: 7148
//NEVER GIVE UP I AM GOING TO IMPROVE ONE DAY.
//PRACTICE,PRACTICE,PRACTICE!!!
#include<bits/stdc++.h>
#define int long long int
// #define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mem(a,b) memset(a,b,sizeof(a))
#define inf 1e18
#define endl "\n"
#define all(v) v.begin(),v.end()
#define fast ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0); 
#define dbg(x)  cerr << #x << " = " << x << endl;
const int M=100005;
const int mod=1000000007;
const double pi = acos(-1.0);
using namespace std;
int32_t main(){

    #ifndef ONLINE_JUDGE 
        freopen("in.txt", "r", stdin); 
        freopen("out.txt", "w", stdout); 
    #endif 

    fast;
    int t;
    t=1;
    // cin>>t;
    // int test=t;
    while(t--){
        int n,d;
        cin>>n>>d;
        int count=0;
        for(int i=0;i<n;i++){
            int a,b;
            cin>>a>>b;
            int x=a*a+b*b;
            int y=sqrt(x);
            if(y*y!=x){
                y++;
            }
            if(y<=d){
                count++;
            }
        }
        cout<<count<<endl;
    }
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s, t;
    int a, b;
    string u;
    cin >> s >> t >> a >> b >> u;
    if(s == u){
        cout << a-1 << " " << b << endl;
    }else{
        cout << a << " " << b-1 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer([]byte{}, 200100)

	S := getString()
	N, mod := len(S), 2019

	// 特殊処理
	if mod == 2 || mod == 5 {
		ans := 0
		for i := 0; i < N; i++ {
			val := int(S[i] - '0')
			if val%mod == 0 {
				ans += i + 1
			}
		}
		out(ans)
		return
	}

	m := make(map[int]int)
	cur := 0
	m[cur] = 1
	digit := 1
	ans := 0
	for i := N - 1; i >= 0; i-- {
		cur += digit * int(S[i]-'0')
		cur %= mod
		ans += m[cur]
		m[cur]++
		digit = digit * 10 % mod
	}
	out(ans)
}


Measured memory_bytes: 2680
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    map<int, int> mp;
    rep(i, n) mp[a[i]]++;

    int ans = 0;
    for (auto p : mp) {
        int ideal = p.first, real = p.second;
        if (real < ideal) ans += real;
        else ans += real - ideal;
    }
    cout << ans << endl;

}

Measured memory_bytes: 5120