akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>

int binarySearch(int,int *,int);

int main()
{
  int i,j,n,q,S[1000000],T[1000000];

  scanf("%d",&n);
  for(i = 0;i < n;i++)
    scanf("%d",&S[i]);

  scanf("%d",&q);
  for(i = 0;i < q;i++)
    scanf("%d",&T[i]);

  i = 0;

  for(j = 0;j < q;j++)
    {
      if(binarySearch(n,S,T[j]) == 1)
	i++;
    }
  printf("%d\n",i);

  return 0;
}

int binarySearch(int n,int *A,int key)
{
  int left,right,mid;

  left = 0;
  right = n;

  while(left < right)
    {
      mid = (left + right) / 2;

      if(A[mid] == key)
	return 1;
      else if(key < A[mid])
	right = mid;
      else left = mid + 1;
    }
  return 0;
}



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

int solve(vector<int> arr,int n){
	vector<int> dp(n+1);
	dp[1] = 0;
	for(int i=2;i<=n;i++){
		int op1 = abs(arr[i]-arr[i-1])+dp[i-1];
		int op2 = (i==2)?INT_MAX:abs(arr[i]-arr[i-2])+dp[i-2];

		dp[i] = min(op1,op2);
	}
	return dp[n];
}

int main(){
	int n;
	cin>>n;
	vector<int> arr(n+1);
	for(int i=1;i<=n;i++){
		cin>>arr[i];
	}
	cout<<solve(arr,n)<<endl;
}

Measured memory_bytes: 4516
package main

import (
	"fmt"
)

func main() {
	var s string

	fmt.Scan(&s)

	var ans string
	for _, char := range s {
		if char == '0' {
			ans += string('0')
		} else if char == '1' {
			ans += string('1')
		} else if char == 'B' && ans != "" {
			tmp := []rune(ans)
			ans = string(tmp[:(len(tmp) - 1)])
		}
	}

	fmt.Println(ans)

}


Measured memory_bytes: 512
N, M, C = gets.chomp.split(" ").map(&:to_i)
B = gets.chomp.split(" ").map(&:to_i)

ans = 0
N.times do 
  a = gets.chomp.split(" ").map(&:to_i)
  x = C
  M.times do |i|
    x += a[i] * B[i]
  end
  if x > 0
    ans += 1
  end
end

puts ans

Measured memory_bytes: 1788
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define re register
#define pb push_back
#define fi first
#define se second
const int N=1e6+10;
const int mod7=1e9+7;
const int mod=998244353;
void read(int &a)
{
    a=0;int d=1;char ch;
    while(ch=getchar(),ch>'9'||ch<'0')
        if(ch=='-')
            d=-1;
    a=ch^48;
    while(ch=getchar(),ch>='0'&&ch<='9')
        a=(a<<3)+(a<<1)+(ch^48);
    a*=d;
}
void read(ll &a)
{
    a=0;int d=1;char ch;
    while(ch=getchar(),ch>'9'||ch<'0')
        if(ch=='-')
            d=-1;
    a=ch^48;
    while(ch=getchar(),ch>='0'&&ch<='9')
        a=(a<<3)+(a<<1)+(ch^48);
    a*=d;
}
int vis[2020];
int main()
{
    string s;cin>>s;
    int res=0,b=1;
    ll ans=0;
    for(re int i=s.size()-1;~i;i--)
    {
        vis[res]++;
        res=res+(s[i]-'0')*b;
        res%=2019;
        ans+=vis[res];
        b=b*10%2019;
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 3860
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,k;
    scanf("%d%d",&n,&k);
    int h[100000]={0};
    for(int i=0;i<n;i++){
        scanf("%d",&h[i]);
    }
    int c=0;
    for(int j=0;j<n;j++){
        if((h[j]-k)>=0){
            c=c+1;
        }
    }
    printf("%d",c);
}


Measured memory_bytes: 640
x=int(input())
y=list(map(int, input().split()))
t=1
for i in range(x):
	if y[i]<0:
		t=t*-1
	y[i]=abs(y[i])

if t==1:
	print(sum(y))
else:
	print(sum(y)-(min(y)*2))

Measured memory_bytes: 14412
import java.util.*;

public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		ArrayList<Integer> no = new ArrayList<Integer>();
		ArrayList<Integer> score = new ArrayList<Integer>();

		while(true){
			String s = sc.next();
			if(s.equals("0,0")) break;
			no.add(Integer.parseInt(s.split(",")[0]));
			score.add(Integer.parseInt(s.split(",")[1]));
		}

		while(sc.hasNextInt()){
			int n = sc.nextInt();
			int idx = -1;
			for(int i=0;i<no.size();i++){
				if(no.get(i) == n){
					idx = i;
					break;
				}
			}

			HashMap<Integer,Boolean> map = new HashMap<Integer,Boolean>();
			int rank = 1;
			int x = score.get(idx);
			for(int k=0;k<no.size();k++){
				if(score.get(k) > x && map.get(score.get(k)) == null){
					rank++;
					map.put(score.get(k),true);
				}
			}

			System.out.println(rank);
		}
	}
}

Measured memory_bytes: 12000
import java.util.Scanner;

public class Main {


	
	public static void main(String args[]){
		
		Scanner sc = new Scanner(System.in);
		
		for(int i =0;sc.hasNext();i++){
			
			int value = Integer.parseInt(sc.next());
			if(value == 0){
				break;
			}
			System.out.println("Case "+(i+1) + ": "+value);
		}

		sc.close();
	}

}



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

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	ll x;
	cin>>x;
	if(x<=599) cout<<8;	
	else if(x<=799) cout<<7;	
	else if(x<=999) cout<<6;
	else if(x<=1199) cout<<5;
	else if(x<=1399) cout<<4;
	else if(x<=1599) cout<<3;
	else if(x<=1799) cout<<2;
	else if(x<=1999) cout<<1;	
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
#define sz(c)       int(c.size())
#define rep(i,a,b)  for (int i=a; i<(b); ++i)
#define per(i,a,b)  for (int i=(b)-1; i>=(a); --i)
#define fore(c,...) for (auto __VA_ARGS__:(c))
using namespace std;
typedef long long ll;



int main() {
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	cout<<fixed<<setprecision(10);

	int N,M;
	cin>>N>>M;
	vector<int> s(M), c(M);
	rep(i,0,M) cin>>s[i]>>c[i], s[i]--;

	rep(i,0,999) {
		string x=to_string(i);
		if (sz(x)!=N) continue;

		bool ok=true;
		rep(j,0,M) if (x[s[j]]-'0'!=c[j]) ok=false;
		if (ok) {
			cout<<i<<'\n';
			return 0;
		}
	}
	cout<<-1<<'\n';
}


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

int main()
{
    vector<int> iroha(3);
    for(int i = 0; i < 3; i++) {
        cin >> iroha.at(i);
    }

    int cnt_5 = 0;
    int cnt_7 = 0;

    for(int i = 0; i < 3; i++) {
        if(iroha.at(i) == 5) {
            cnt_5++;
        }
        else if(iroha.at(i) == 7) {
            cnt_7++;
        }
    }

    if(cnt_5 == 2 && cnt_7 ==1) {
        cout << "YES" <<endl;
    }
    else {
        cout << "NO" << endl;
    }
  
    return 0; 
}

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

int A,B;

int main(){
	scanf("%d%d",&A,&B);
	if(A>=13) printf("%d\n",B);
	else if(A<=5) printf("%d\n",0);
	else printf("%d\n",B/2);
	return 0;
}

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

string change(string A,string B,string C){
  int a=A.size(),b=B.size();
  int i=0;
  string res="";
  while(i<a){
    bool f=true;
    for(int j=0;j<b;j++){
      if(i+j>=a||A[i+j]!=B[j]){
	f=false;
	break;
      }
    }
    if(f){
      res+=C;
      i+=b;
    }else{
      res.push_back(A[i]);
      i++;
    }
  }//while
  return res;
}

int n;
string t[10],u[10],si,ti;
map<string,int> visited;
void solve(){
  visited.clear();
  queue<string> Q;
  Q.push(si);
  visited[si]=1;
  while(!Q.empty()){
    string s=Q.front();Q.pop();
    if(s==ti){
      cout<<visited[s]-1<<endl;
      return;
    }
    for(int i=0;i<n;i++){
      string next=change(s,t[i],u[i]);
      if(next.size()>ti.size())continue;
      if(visited[next]==0){
	visited[next]=visited[s]+1;
	Q.push(next);
      }
    }
  }
  cout<<-1<<endl;
}

int main(){
  while(1){
    cin>>n;
    if(n==0)break;
    for(int i=0;i<n;i++)
      cin>>t[i]>>u[i];
    cin>>si>>ti;
    solve();
  }
  return 0;
}

Measured memory_bytes: 1480
import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		List<Triangle> triangleList = new ArrayList<>();
		while (stdIn.hasNextInt()) {
			triangleList.add(new Triangle(stdIn.nextInt(), stdIn.nextInt(), stdIn.nextInt()));
		}

		Counter c = new Counter(triangleList);
		stdIn.close();

		System.out.println(c.countLegalTriangle() + " " + c.countTriangle(TriangleType.RIGHT) + " "
				+ c.countTriangle(TriangleType.ACUTE_ANGLED) + " " + c.countTriangle(TriangleType.OBTUSE_ANGLED));
	}
}

class Counter {
	private Map<TriangleType, Integer> countMap = new EnumMap<>(TriangleType.class);

	public Counter(List<Triangle> triangleList) {
		for (Triangle triangle : triangleList) {
			try {
				add(triangle);
			} catch (IllegalArgumentException e) {
				break;
			}
		}
	}

	private void add(Triangle t) {
		TriangleType type = Triangle.secern(t);

		if (!countMap.containsKey(type)) {
			countMap.put(type, 1);
			return;
		}
		countMap.replace(type, countMap.get(type) + 1);
	}

	public int countLegalTriangle() {
		return countMap.entrySet().stream().filter(e -> e.getKey() != TriangleType.ILLEGAL).mapToInt(e -> e.getValue())
				.sum();
	}

	public long countTriangle(TriangleType t) {
		return countMap.entrySet().stream().filter(e -> e.getKey() == t).mapToInt(e -> e.getValue()).sum();
	}
}

class Triangle {
	private int first;
	private int second;
	private int third;

	public Triangle(int first, int second, int third) {
		int[] edges = { first, second, third };

		Arrays.sort(edges);
		// sorted
		this.first = edges[0];
		this.second = edges[1];
		this.third = edges[2];
	}

	public static boolean isTriangle(Triangle t) {
		return t.first + t.second > t.third;
	}

	public static TriangleType secern(Triangle t) {
		if (t == null) {
			throw new IllegalArgumentException("null NG");
		}

		if (!isTriangle(t)) {
			throw new IllegalArgumentException("null NG");
		}

		int former = t.first * t.first + t.second * t.second;
		int latter = t.third * t.third;

		if (former == latter) {
			return TriangleType.RIGHT;
		}

		return former > latter ? TriangleType.ACUTE_ANGLED : TriangleType.OBTUSE_ANGLED;
	}

	public int getFirst() {
		return first;
	}

	public int getSecond() {
		return second;
	}

	public int getThird() {
		return third;
	}

	@Override
	public String toString() {
		return "Triangle [first=" + first + ", second=" + second + ", third=" + third + "]";
	}
}

enum TriangleType {
	RIGHT, ACUTE_ANGLED, OBTUSE_ANGLED, ILLEGAL;
}


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

int main()
{
  string w, t;
  int count = 0;
  
  cin >> w;
  for (;;) {
    cin >> t;
    if (t == "END_OF_TEXT") break;
    for (string::iterator p = t.begin(); p != t.end(); p++) *p = (char)tolower(*p);
    if (w == t) count++;
  }
  cout << count << endl;

  return 0;
}


Measured memory_bytes: 3192
// YOU THINK YOU KNOW ME.//


#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
#define int                      long long
#define MOD                     1000000007
#define inf                     9e18
#define ld                      long double
#define countbit                __builtin_popcount
#define loop(i,a,n)				for(int i=a;i<n;i++)
#define pb                      push_back
#define pf                      push_front
#define mp                      make_pair
#define f                       first
#define s                       second
#define isvowel(a)              (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define boost                   ios_base::sync_with_stdio();cin.tie(0);cout.tie(0);
#define cases                   int tests;cin>>tests;while(tests--)
#define all(s)                  s.begin(),s.end()
#define line                    cout<<endl;
#define watch(x)                cout<<(#x)<<" is "<<x<<endl
//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rich_set;
bool isprime(int n){if(n==1)return false;if(n==2)return true;for(int i=2;i<=sqrt(n);i++){if(n%i==0){ return false;}}return true;}
int poww(int b,int e){if(e==0)return 1;else if(e%2==0){int a=pow(b,e/2);return a*a;}else {int a=pow(b,e/2);return b*a*a;}}
int powm(int x,int y,int m=MOD){x=x%m;int res=1;while(y){if(y&1)res=res*x;res%=m;y=y>>1;x=x*x;x%=m;}return res;}
int modInverse(int a, int m=MOD) { return powm(a, m-2, m);}
void print(vector<int>v){for(int i=0;i<v.size();i++){cout<<v[i]<<" ";}}
void print(int arr[]){int size = *(&arr + 1) - arr; for(int i=0;i<size;i++){cout<<arr[i]<<" ";}}
string to_bin(int n){string res="";int i=0;while(n>0){if(n%2==1){res=res+'1';}else{res=res+'0';}n/=2;i++;}reverse(all(res));return res;}
int to_dec(string s){int n=s.size(),ans=0,temp=1;for(int i=n-1; i>=0; i--){int x=s[i]-'0';ans+=x*temp;temp*=2;}return ans;}
void result(bool f){if(f)cout<<"YES"<<endl;else cout<<"NO"<<endl;}



void solve(){
	int n;
    cin>>n;
    int arr[n];
    int brr[n];
    int crr[n];
    int dp[n][5];
    loop(i,0,n){
        cin>>arr[i]>>brr[i]>>crr[i];
    }
    dp[0][1]=arr[0];
    dp[0][2]=brr[0];
    dp[0][3]=crr[0];
    loop(i,1,n){
        dp[i][1] = max(dp[i-1][2]+arr[i],dp[i-1][3]+arr[i]);
        dp[i][2] = max(dp[i-1][1]+brr[i],dp[i-1][3]+brr[i]);
        dp[i][3] = max(dp[i-1][1]+crr[i],dp[i-1][2]+crr[i]);
    }
    int ans = max(dp[n-1][1],max(dp[n-1][2],dp[n-1][3]));
    cout<<ans<<endl;
}
int32_t main(){
	boost
  //cases
	solve();	
	
	//return 0;
}

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

using namespace std;

using ll = long long;
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORE(i, a, b) for (int i = (a); i <= (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repe(i, n) for (int i = 0; i <= (n); ++i)
#define all(v) (v).begin(), (v).end()
#define sp cout << fixed << setprecision(10)
typedef pair<int, int> P;
const int inf = (int)1e9;
const int mod = (int)1e9 + 7;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }

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

    string s;
    cin >> s;

    int cnt1 = 0;
    rep(i, s.length()) {
        if (i % 2 == 0) {
            if (s[i] == '1') cnt1++;
        } else {
            if (s[i] == '0') cnt1++;
        }
    }
    int cnt2 = 0;
    rep(i, s.length()) {
        if (i % 2 == 0) {
            if (s[i] == '0') cnt2++;
        } else {
            if (s[i] == '1') cnt2++;
        }
    }

    cout << min(cnt1, cnt2) << endl;

    return 0;
}

Measured memory_bytes: 512
/*
 * @Filename: 
 * @Author: shifaqiang
 * @Email: 14061115@buaa.edu.cn
 * @Github: https://github.com/luoboganer
 * @Date: 2020-07-12 00:38:24
 * @LastEditors: shifaqiang
 * @LastEditTime: 2020-07-12 01:02:08
 * @Software: Visual Studio Code
 * @Description: 
 */

#include <algorithm>
#include <iostream>
#include <math.h>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char *argv[])
{
    int n, k;
    cin >> n >> k;
    vector<int> heights(n), dp(n, 0);
    for (auto i = 0; i < n; i++)
    {
        cin >> heights[i];
    }
    for (auto i = 1; i < n; i++)
    {
        dp[i] = numeric_limits<int>::max();
        int max_steps = min(i, k);
        for (auto j = 1; j <= max_steps; j++)
        {
            dp[i] = min(dp[i], dp[i - j] + abs(heights[i] - heights[i - j]));
        }
    }
    cout << dp[n - 1] << endl;
}

Measured memory_bytes: 4056
def main():
    n, m = map(int, input().split())
    st = [list(map(int, input().split())) for _ in [0]*m]
    g = [[] for _ in [0]*n]
    [g[a-1].append(b-1) for a, b in st]
    toP = [0]*n
    toE = [0]*n
    fromE = [0]*n
    toP[0] = 1
    for i in range(n-1):
        p = toP[i]
        if p > 0:
            toE[i] /= toP[i]
        e = toE[i]
        l = len(g[i])
        for j in g[i]:
            toP[j] += p/l
            toE[j] += (e+1)*p/l
    for i in range(n-2, -1, -1):
        l = len(g[i])
        for j in g[i]:
            fromE[i] += (fromE[j]+1)/l
    allE = fromE[0]
    ans = fromE[0]
    for s, t in st:
        if g[s-1]:
            temp = allE
            l = len(g[s-1])
            if l < 2:
                continue
            p = toP[s-1]
            temp = allE
            for j in g[s-1]:
                temp -= p*(toE[s-1]+1+fromE[j])/l
                if j != t-1:
                    temp += p*(toE[s-1]+1+fromE[j])/(l-1)
            ans = min(temp, ans)
    print(ans)


main()

Measured memory_bytes: 85464
//#include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#include <queue>
//#include <windows.h>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) ((bit>>(i)) & 1)
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define OUTPUT_PERMUTATION(n) do{VI v(n); iota(ALL(v), 1); do{REPx(x, v) cout << x << " "; ENDL} while(next_permutation(ALL(v)));} while(0);
#define MAKE_PERMUTATION(n, PER) do{VVI a(fact(n), VI(n)); int idx = 0; VI v(n); iota(ALL(v), 1); do{REP(roop, n) a[idx][roop] = v[roop]; idx++;} while(next_permutation(ALL(v))); PER = a;} while(0); // int fact(), VVI PERを宣言しておく
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VVC = vector<VC>;
using VS = vector<string>;
using VVS = vector<VS>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VD = vector<double>;
const int INF = 2e9;
const LL MOD = 1e9 + 7;

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

void END(){cout << 1 << endl; exit(0);}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int k;
  cin >> k;
  queue<LL> q;
  REP2(i, 1, 10) q.push(i);
  LL ans;
  REP(i, k)
  {
    ans = q.front(); q.pop();
    LL tail = ans % 10;
    if (tail != 0) q.push(ans*10 + tail-1);
    q.push(ans*10+tail);
    if (tail != 9) q.push(ans*10 + tail+1);
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main() {

    int n, k, res = 0, row = 1, w = 0;

    scanf("%d %d", &n, &k);

    while ( n >= row ) {
	if ( row*k >= w ) {
	    ++res;
	    w += row;
	    n -= row;
	}
	else if ( n >= row+1 ) ++row;
	else break;
    }
    
    printf("%d\n", res);
    return 0;
}



Measured memory_bytes: 2112
#include<iostream>
    using namespace std;
    int main()
    {
      int n;
      std::cin >> n;
      int a[n];
      int b[n];
      int c[n-1];
      int sum = 0;
      //int sum2 = 0;

      for (size_t i = 0; i < n; i++) {
        std::cin >> a[i];
      }
      for (size_t i = 0; i < n; i++) {
        std::cin >> b[i];
      }
      for (size_t i = 0; i < n-1; i++) {
        std::cin >> c[i];
      }

      //std::cout << "fin" << '\n';

      for (size_t i = 0; i < n; i++) {
        int x;
        x = a[i];
        //std::cout << b[x-1] << '\n';
        sum += b[x-1];

        if (a[i]-a[i-1] == 1) {
          //std::cout << c[x-2] << '\n';
          sum += c[x-2];
        }
      }

      std::cout << sum << '\n';
      //std::cout << sum2 << '\n';
      return 0;
    }


Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using static System.Math;
using Debug = System.Diagnostics.Debug;


static class P
{
    static void Main()
    {
        var nd = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var points = Enumerable.Repeat(0, nd[0]).Select(_ => Console.ReadLine().Split().Select(long.Parse).ToArray()).ToArray();
        var res = 0;
        for (int i = 0; i < points.Length; i++)
        {
            for (int j = i + 1; j < points.Length; j++)
            {
                var len = points[i].Zip(points[j], (x, y) => Abs(x - y) * Abs(x - y)).Sum();
                var sqrtLen = (long)Sqrt(len);
                if (sqrtLen * sqrtLen == len) res++;
            }
        }
        Console.WriteLine(res);
    }
}


Measured memory_bytes: 13652
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <string>

using namespace std;
int main(int argc, const char * argv[]) {
    
    int n, t;
    cin >> n >> t;

    int m=1001;
    int index = 1;
    for (int i=0; i<n; i++) {
        int x, y;
        cin >> x >> y;
        if (t >= y && m > x) {
            m = x;
        }
    }

    if (m>=1001) 
        cout << "TLE" << endl;
    else 
        cout << m << endl;


    return 0;
}

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b + c >= 22) {
    cout << "bust\n";
  } else {
    cout << "win\n";
  }
}


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

int main(){
    int N;  string S;
    cin >> N >> S;
    int cnt = 0;
    int nBracket = 0;
    for(int i=0; i<N; i++){
        if(S[i]=='(') cnt++;
        else cnt--;
        nBracket = max(nBracket, -cnt);
    }
    for(int i=0; i<nBracket; i++) S = "(" + S;

    N = S.length();
    cnt = 0;
    for(int i=0; i<N; i++){
        if(S[i]=='(') cnt++;
        else cnt--;
    }
    for(int i=0; i<cnt; i++) S = S + ")";

    cout << S << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string ss,s,sss,st;
    cin>>ss;
    s=ss;
    int t=ss.size();
    reverse(s.begin(),s.begin()+t);
    if(s==ss)
    {
        int l,k;
        k=ss.size();
        l=(k-1)/2;
        s.erase(s.begin()+l,s.end());
        sss=s;
        reverse(s.begin(),s.end());
        if(sss==s)
        {
            sss="";
            st=ss;
            l=(k+3)/2;
            l=l-2;
            st.erase(st.begin(),st.begin()+l+1);
            sss=st;
            reverse(st.begin(),st.end());
            if(sss==st)
            {
                cout<<"Yes"<<endl;
            }
            else
                cout<<"No"<<endl;

        }
        else
            cout<<"No"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;
}


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

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;

template<class T> void swap(T &a, T &b ){
    T temp;
    temp = a;
    a = b;
    b = temp;   
}

int main(){
    string weather[3] = {"Sunny","Cloudy","Rainy"};;
    string s;
    int i;
    cin >> s;

    for(i=0;i<3;i++){
        if(weather[i] == s){
            cout << weather[(i+1)%3] << endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#define rep(i,n) for(int i = 0;i<(n);i++);
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 100100100100100;


int main() {
	ll N;
	cin >> N;
	vector<ll> time(5);
	for (int i = 0; i < 5; i++) cin >> time[i];
	sort(time.begin(), time.end());
	if (N % time[0] == 0) cout << 5 + N / time[0] - 1 << endl;
	else cout << 5 + N / time[0] << endl;
}

Measured memory_bytes: 256
X=int(input())

if X < 600:
    print(8)
elif X < 800:
    print(7)
elif X < 1000:
    print(6)
elif X < 1200:
    print(5)
elif X < 1400:
    print(4)
elif X < 1600:
    print(3)
elif X < 1800:
    print(2)
else:
    print(1)

Measured memory_bytes: 9172
#include <iostream>
using namespace std;
int main(void){
    int N;
    cin>>N;
    for(int i=0;i<=25;i++){
        for(int j=0;j<10;j++){
            if(N==4*i+j*7){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define int long long
#define all(x) (x).begin(), (x).end()
using namespace std;

const int N = 3e5 + 5;

int kol[N];

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    for (int x = 1; x <= 100; x++)
        for (int y = 1; y <= 100; y++)
            for (int z = 1; z <= 100; z++)
                kol[x * x + y * y + z * z + x * y + x * z + y * z]++;
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++)
        cout << kol[i] << "\n";
    return 0;
}


Measured memory_bytes: 4072
#include <cstdio>
#include <iostream>
#include <sstream>

#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>

#include <chrono>
#include <random>

using namespace std;
using i64 = int_fast64_t;
using ui64 = uint_fast64_t;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<i64>;
using vvl = vector<vl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vb = vector<bool>;
using vvb = vector<vb>;
using pii = pair<int, int>;
using pll = pair<i64, i64>;

//////////////////////////////////////////////////

template <typename T>
struct edge {
  int f, t;
  T data;
  edge(int f_, int t_, T data_) : f(f_), t(t_), data(data_){};
  edge(){};
  bool operator<(const edge& r) { return this->data < r.data; }
};

template <typename T>
struct graph {
  vector<vector<edge<T> > > data;
  graph(int n) : data(n){};
  graph(){};
  int size() { return (int)data.size(); }
  void add_edge(int f, int t, T c) { data[f].emplace_back(f, t, c); }
};

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vi c(n);
  graph<int> g(n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g.add_edge(a, b, 0);
    g.add_edge(b, a, 0);
  }
  for (auto&& x : c) cin >> x;
  sort(c.begin(), c.end());
  int idx = 0;
  int ret = 0;
  vi res(n);
  vb d(n, true);
  while (idx < n) {
    // cerr << idx << endl;
    for (int i = 0; i < n; i++) {
      if (!d[i]) continue;
      int t = 0;
      for (auto&& x : g.data[i]) t += d[x.t];
      if (t <= 1) {
        res[i] = c[idx++];
        d[i] = false;
      }
    }
  }
  for (auto&& f : g.data)
  for (auto&& e : f) ret += min(res[e.f], res[e.t]);
  cout << ret / 2 << endl;
  for (auto&& x : res) cout << x << " ";
  cout << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i = x; i < n; i++)
#define MAX 100
#define INF 1000000001
#define ADD_ROOT(size)                          \
    void *root_ADD_ROOT_[size + 2];             \
    root_ADD_ROOT_[0] = root;                   \
    for (int i = 1; i <= size; i++)             \
        root_ADD_ROOT_[i] = NULL;               \
    root_ADD_ROOT_[size + 1] = ROOT_END;        \
    root = root_ADD_ROOT_

#define DEFINE1(var1)                           \
    ADD_ROOT(1);                                \
    Obj **var1 = (Obj **)(root_ADD_ROOT_ + 1)

#define ad(x) int i = 100;
// enum {
//   AST_INT,
//   AST_SYM,
//   AST_STR,
//   AST_FUNCALL,
// };



// double winProb(int Rp, int Rq) {
//     return 1/(1+pow(10, (Rq-Rp)/400.));
// }

// int R[1<<10];
// double dp[12][1<<10];
int n;


int main() {
  cin >> n;
  vector<int> a(n);
  REP(i,0,n) cin >> a[i];
  
  long long ans = 0;
  REP(i,0,n) {
      while (a[i] % 2 == 0) {
              a[i] = a[i] / 2;
              ans += 1;
          }
      }
    //   cout << log(a[i]) << endl;
  
  
  cout << ans << endl;
  
//   int ans = 1 + (n-2)/(k-1);
//   cout << ans << endl;
  
  
//   int mn = INF;
//   int min_idx = -1;
//   REP(i,0,n) {
//       if (a[i] < mn) {
//           mn = a[i];
//           min_idx = i;
//       }
//   }
  
//   int one_step = k - 1;
//   int left = 0;
//   int right = 0;
//   left = min_idx % 2 == 1 ? ((min_idx+1) / one_step) : (min_idx / one_step);
//   right = ((n-1) - min_idx) % 2 == 1 ? (((n-1) - min_idx) + 1) / one_step : ((n-1) - min_idx) / one_step;
  
//   cout << left + right << endl;
//   if (sum - n)
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end() // 昇順ソート
#define rall(v)(v).rbegin(), (v).rend() // 降順ソート

typedef long long int LL;
typedef long long int ll;
#define pll pair < ll, ll >
#define F first
#define S second
const int MOD = 1000000007;
template < class T > bool chmax(T & a,const T & b) { if (a < b) { a = b; return true; } return false; }
template < class T > bool chmin(T & a,const T & b) { if (a > b) { a = b; return true; } return false; }
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

LL INF = (1LL << 31) - 1;
int n;              // 配列サイズ
vector<LL> seg;     // セグ木

void segch(int i,int x){    // 配列i番目要素をxに変更
    i += (n-1);
    seg[i] = x;
    while(i > 0){
        i = (i-1)/2;
        seg[i] = min(seg[2*i+1],seg[2*i+2]);    //**
    }
}

LL getq_sub(int a,int b,int k,int l,int r){ 
    // k:現在見ているノードの位置  [l,r):dat[k]が表している区間
    if(r <= a || b <= l)return INF;             //**
    else if(a <= l && r <= b)return seg[k];     
    else{                                       
        int ind = (l+r)/2;
        int vl = getq_sub(a,b,2*k+1,l,ind);
        int vr = getq_sub(a,b,2*k+2,ind,r);
        return min(vl,vr);                      //**
    }
}


LL getq(int a,int b){     // [a,b) の区間でminを返す
    return getq_sub(a,b,0,0,n);
}




int main() {
    // 入力　__ 配列サイズn と 配列A
    cin >> n;
    vector<LL> A(n);rep(i,n)A[i] = INF;
    int q;cin >> q;

    vector<int> com(q);
    vector<int> x(q);
    vector<int> y(q);
    rep(i,q)cin >> com[i] >> x[i] >> y[i];


    // 配列の要素数を 2^x 個にするためにINFで埋める  
    rep(i,32){
        if(n <= pow(2,i)){
            n = pow(2,i);
            break;
        }
    }
    int st = A.size();
    for(int i = st;i < n;i++)A.push_back(INF);

    // seg木の配列初期化
    seg.resize(2*n-1);rep(i,2*n-1)seg[i] = INF; //**
    rep(i,n)segch(i,A[i]);   

    rep(i,q){
        if(com[i] == 0){
            segch(x[i],y[i]);
        }
        else{
            cout << getq(x[i],y[i]+1) << endl;
        }
    }

}


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

// Shortcut

#pragma optimize ("O3")
#define int long long
#define endl '\n'
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << ' ';
#define PrintVl(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << endl;
#define PrintA(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << ' ';
#define PrintAl(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a));
#define mmset(a) memset(a, 0x3f, sizeof(a));
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());

// Data Structure

#define pque priority_queue
#define mts multiset
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 5e3 + 5, mod = 1e9 + 7, inf = 1e9 + 7;

int n;
int a[4], b[4], c[N], d[N * N];

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n;
    ForE(i, 1, 3) cin >> a[i];
    ForE(i, 1, 3) cin >> b[i];
    ForE(i, 0, n){
        ForE(j, 1, 3){
            if (i - a[j] >= 0){
                c[i] = max(c[i], c[i - a[j]] + b[j] - a[j]);
            }
        }
    }
    n += c[n];
    ForE(i, 0, n){
        ForE(j, 1, 3){
            if (i - b[j] >= 0){
                d[i] = max(d[i], d[i - b[j]] + a[j] - b[j]);
            }
        }
    }
    n += d[n];
    cout << n;
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

Measured memory_bytes: 195584
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
const int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  map<char, int> mp;
  string s;
  cin >> s;
  rep(i, sz(s)) mp[s[i]]++;
  for (auto e : mp) {
    if (e.S != 2) {
      cout << "No" << endl;
      return;
    }
  }
  cout << "Yes" << endl;
}


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

#define REP( i, n )     for( int (i) = 0; (i) < (n); (i)++ )
#define ALL( a )        (a).begin(), (a).end()

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

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

const int INF = 1e9;
const ll LINF = 1e18;
const int MOD = 1e9 + 7;

int main(){
    string day[] = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
    string s; cin >> s;

    REP( i, 7 ){
        if( s == day[i] ){
            cout << 7 - i << endl;
            break;
        }
    }
}

/*
05

*/

Measured memory_bytes: 256
def f(n):
    if n % 2:
        return 3*n + 1
    else:
        return n // 2

s = int(input())
aPrev = s
isFound = [False] * 10**6
isFound[aPrev] = True
for m in range(2, 10**6 + 1):
    a = f(aPrev)
    if isFound[a]:
        print(m)
        break
    aPrev = a
    isFound[a] = True


Measured memory_bytes: 10868
#include <iostream>
using namespace std;
int main(void){
    int n;
    scanf("%d",&n);
    int a[n];
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    int ans=0;
    for(int i=0;i<n;i++){
        int j=i;
        while(j!=n&&a[i]==a[j])j++;
        ans+=(j-i)/2;
        i=j-1;
    }
    printf("%d",ans);
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<sstream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cfloat>
#include<functional>
#include<map>
#include<string>
#include<cstring>
#include<vector>
#include<queue>
#include<stack>
#include<deque>
#include<set>
#include<bitset>
#include<list>
#include<numeric>
#include<complex>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<long long, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<long long, long long> ll_ll;
typedef pair<double, double> d_d;
typedef vector<int> Vint;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define rep2d(i, j, n) for(i = 0;i < n;++i)for(j = i + 1;j < n;++j)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << x << "\n"
#define pri2(x, y) cout << x << " " << y << "\n"
#define pri3(x, y, z) cout << x << " " << y << " " << z << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << x << "\n"
#define debug2(x, y) cout << " --- " << x << " " << y << "\n"
#define debug3(x, y, z) cout << " --- " << x << " " << y << " " << z << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

string f[50];

signed main(void){
  int i, j, k;
  for(int testcase = 0;testcase >= 0;testcase++){
    int2(n, m);
    scn(n, f);
    int cnt[n][3];
    string wbr = "WBR";
    rep(i, n)rep(j, 3)cnt[i][j] = 0;

    rep(i, n)rep(j, m)rep(k, 3)if(f[i][j] == wbr[k])++cnt[i][k];

    int res = n * m;
    rep1(i, n)rep1(j, n){
      k = n - i - j;
      if(k <= 0)continue;
      int ans = 0, x;
      rep(x, i)ans += m - cnt[x][0];
      rep(x, j)ans += m - cnt[x + i][1];
      rep(x, k)ans += m - cnt[x + i + j][2];
      res = min(res, ans);
    }
    pri(res);

/*/

//*/ break;
  }
  return 0;
}

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

using namespace std;

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

      
   
    int a,b;
    cin>>a>>b;
    if(a+b==15)
      cout<<"+";
      
    else if(a*b==15)
      cout<<"*";
      
    else
     cout<<"x";
      
         
	return 0;
	
} 

Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

typedef pair<int, int> P;
const int INFTY = 1001001001;

int main()
{
    int N;
    cin >> N;
    vector<P> vec1(N), vec2(N);
    for(int i=0;i<N;++i){
        cin >> vec1[i].first >> vec1[i].second;
    }
    for(int i=0;i<N;++i){
        cin >> vec2[i].first >> vec2[i].second;
    }

    sort(vec1.begin(), vec1.end(), greater<P>());
    
    int ans = 0, y_min, min_index, x, y;
    for(int i=0;i<N;++i){
        x = vec1[i].first;
        y = vec1[i].second;
        y_min = INFTY;
        for(int j=0;j<N;++j){
            if(x < vec2[j].first && y < vec2[j].second){
                if(vec2[j].second < y_min){
                    y_min = vec2[j].second;
                    min_index = j;
                }
            }
        }
        if(y_min != INFTY){
            ++ans;
            vec2[min_index] = P(-1, -1);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

int main()
{
    string N;cin>>N;
    ll K=in();
    if(K>N.length()){cout<<0<<endl;return 0;}

    ll ans=0;
    for(ll digit=K;;++digit){
        if(digit<N.length()){
            ll d=1;
            for(int i=0;i<K-1;++i)d*=(digit-1-i);
            for(int i=1;i<=K-1;++i)d/=i;
            for(int i=0;i<K;++i)d*=9;
            ans+=d;
        }else{
            if(K==1){
                for(char i='1';i<='9';++i){
                    string foo=i+string(digit-1,'0');
                    if(foo<=N)++ans;
                }
            }else if(K==2){
                for(char i='1';i<='9';++i){
                    string foo=i+string(digit-1,'0');
                    for(int j=0;j<digit-1;++j){
                        for(char k='1';k<='9';++k){
                            string bar=foo;
                            bar[digit-1-j]=k;
                            if(bar<=N)++ans;
                        }
                    }
                }
            }else{
                for(char i='1';i<='9';++i){
                    string foo=i+string(digit-1,'0');
                    for(int j=0;j<digit-1;++j){
                        for(char k='1';k<='9';++k){
                            string bar=foo;
                            bar[digit-1-j]=k;
                            for(int l=j+1;l<digit-1;++l){
                                for(char m='1';m<='9';++m){
                                    string baz=bar;
                                    baz[digit-1-l]=m;
                                    if(baz<=N)++ans;
                                }
                            }
                        }
                    }
                }
            }
            break;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
  int n,r;
  
  scanf("%d", &n);
  scanf("%d", &r);
  
  if (  n >= 10) {
    printf("%d\n", r);
  }
  else {
     printf("%d\n", r+(10-n)*100);
  }
  
  return 0;
}

Measured memory_bytes: 128
N = int(input())
days = [list(map(int,input().split())) for i in range(N)]

dp = [[10**18]*3 for i in range(N)]
for i in range(3):
    dp[0][i] = days[0][i]

for i in range(1,N):
    dp[i][0] = max(dp[i-1][1] + days[i][0],dp[i-1][2] + days[i][0])
    dp[i][1] = max(dp[i-1][0] + days[i][1],dp[i-1][2] + days[i][1])
    dp[i][2] = max(dp[i-1][0] + days[i][2],dp[i-1][1] + days[i][2])

print(max(dp[N-1][0],dp[N-1][1],dp[N-1][2]))


Measured memory_bytes: 47336
#include <algorithm>
#include <iostream>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
int main() {
    int N;
    cin >> N;
    vector<double>U(N);
    rep(i, 0, N){
        cin >> U[i];
    }
    sort(U.begin(), U.end());
    double ans = (U[0]+U[1])/2;
    rep(i, 2, N){
        ans = (ans+U[i])/2;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
N = int(input())
d = [0]*(N+1)

n = int(pow(N, 0.5))+1
for i in range(1, n+1):
    for j in range(1, n+1):
        for k in range(1, n+1):
            res = i**2+j**2+k**2+i*j+j*k+k*i
            if res>N: break
            d[res] += 1
for i in range(1, N+1):
    print(d[i])

Measured memory_bytes: 9496
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cstdio>
using namespace std;

int main() {
	int N, K;
	cin >> N >> K;

	double ans = 0.0;
	for (int i = 1; i <= N; i++) {
		int point = i;
		double num = 1.0;
		while (point < K) {
			point *= 2;
			num /= 2.0;
		}
		ans += num;
	}

	ans /= N;
	cout << fixed << setprecision(10) << ans << endl;


	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<queue>
#include<cmath>
#define rep(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define min_(a,b) ((a)<(b)?(a):(b))
using namespace std;

int N;
struct Book{
	int page;
	int write;
};
Book book[1000];
int dp[1000 * 1000*3];
int sum = 0;
int deal = 0;
int solve(){
	memset(dp, 0, sizeof(dp));
	int s = book[N - 1].page*2-sum;
	//cout << endl<<s << endl<<endl;
	dp[0] = -1;
	rep(i, 0, N - 1){
		rep(j, 1, s + 1){
			if (j - book[i].write >= 0 && dp[j - book[i].write] != 0 && dp[j - book[i].write] <= i&&dp[j]==0)dp[j] = i + 1;
			//cout << dp[j] << "/";
		}
	//	cout << endl << endl;
	}
	for (int i = s; i >= 0; i--)
		if (dp[i] != 0){
		return(s - i);
	}


}

int main(void){
	while (true){
		cin >> N;
		if (N == 0)return(0);
		int max_n=0,max_i=0;
		sum = 0;
		deal = 0;
		rep(i, 0, N){
			cin >> book[i].page >> book[i].write;
			sum += book[i].page;
			deal += book[i].write;
			if (book[i].page > max_n)max_n = book[i].page, max_i = i;
		}
		if (sum >= max_n * 2)cout << sum + deal << endl;
		else{
			Book tmp = book[max_i];
			book[max_i] = book[N - 1];
			book[N - 1] = tmp;
			cout << sum+deal+solve() << endl;
		}


	}
}

Measured memory_bytes: 12892
fun main(args : Array<String>) {
    val (h, w) = readLine()!!.split(" ").map { it.toInt() }
    val aa = Array(h) { readLine()!!.split(" ").map { it.toInt() }.toMutableList() }

    var cnt = 0
    val ans = mutableListOf<Move>()

    aa.forEachIndexed { hIdx, hList ->
        hList.forEachIndexed { wIdx, a ->
            if (hIdx == h-1) {
                if (wIdx != w-1 && a % 2 == 1) {
                    cnt++
                    aa[hIdx][wIdx+1]++
                    aa[hIdx][wIdx]--
                    ans.add(Move(hIdx, wIdx, hIdx, wIdx+1))
                }
            } else {
                if (a % 2 == 1) {
                    cnt++
                    aa[hIdx+1][wIdx]++
                    aa[hIdx][wIdx]--
                    ans.add(Move(hIdx, wIdx, hIdx+1, wIdx))
                }
            }
        }
    }

    println(cnt)
    ans.forEach { move ->
        println("${move.sY+1} ${move.sX+1} ${move.dY+1} ${move.dX+1}")
    }
}

data class Move(val sY: Int, val sX: Int, val dY: Int, val dX: Int)

Measured memory_bytes: 66124
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+7;
int dp[maxn],a[maxn],col[5];
const int mod=1e9+7;
int main()
{
	int n;cin>>n;ll ans=1;
	ll now=3;
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if(a[i]==0) ans*=now,col[now]++,now--;
		if(now<0)
		{
			cout<<0<<endl;
			return 0;
		}
		if(a[i]!=0)
		{
			int tmp=0;int id=0;
			for(int j=1;j<=3;j++)
			{
				if(a[i]==col[j])
				{
					id=j;
					tmp++;
				}
			}
			col[id]++;
			ans*=tmp;ans%=mod;
		}
		//for(int i=1;i<=3;i++) cout<<col[i]<<" ";
		//cout<<endl;
	}
	if(a[1]!=0) cout<<0<<endl;
	else cout<<ans<<endl;
	return 0;
 } 
 /*

*/

Measured memory_bytes: 640