akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<vector>
#define push push_back
#define all(v) v.begin(),v.end()
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int max(int a,int b){
	return (a>b)?a:b;
}

int min(int a,int b){
	return (a<b)?a:b;
}

int main(){
	int n,k;
	cin>>n>>k;
	string s;
	cin>>s;
	vector<int> vec;
	int now=1,tmp=0;
	rep(i,s.size()){
		if(s[i]==(char)(now+'0'))tmp++;
		else{
			now=1-now;
			vec.push(tmp);
			tmp=1;
		}
	}
	if(tmp!=0)vec.push(tmp);
	if(vec.size()%2==0)vec.push(0);
	int ans=0;
	tmp=0;
	int left=0,right=0;
	for(int i=0;i<vec.size();i+=2){
		int nextleft=i,nextright=min(i+2*k+1,vec.size());
		while(left<nextleft){
			tmp-=vec[left];
			left++;
		}
		while(right<nextright){
			tmp+=vec[right];
			right++;
		}
		ans=max(ans,tmp);
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 4064
#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define ul unsigned long
#define ui unsigned int
#define pb push_back
#define ul unsigned long
#define show(x) ;//cerr << #x << ':' << x << endl;

using namespace std;
long dp[100000];
long mincost(vector<long> &v, long i, long j)
{
    ll ret = 0;
    show(i);
    show(j);
    if (j + 2 < v.size())
    {
        // show(j);
        // show(j + 1);
        // show(j + 2);
        if (dp[j] == -1)
        {
            dp[j] = min(mincost(v, j, j + 1), mincost(v, j, j + 2));
        }
        ret += dp[j];
    }
    else if (j + 1 < v.size())
    {
        // show(j);
        // show(j + 1);
        if (dp[j] == -1)
        {
            dp[j] = mincost(v, j, j + 1);
        }
        ret += dp[j];
    }
    show(ret);
    show(v[j]);
    show(v[i]);
    ret += abs(v[j] - v[i]);
    show(ret);
    return ret;
}

int main(int argc, const char **argv)
{
    cin.tie(0);
    cout.tie(0);
    long n;
    cin >> n;
    vector<long> v;
    memset(dp, -1, sizeof(dp));
    for (ull i = 0; i < n; i++)
    {
        ull t;
        cin >> t;
        v.push_back(t);
    }
    cout << mincost(v, 0, 0);
}

Measured memory_bytes: 4212
#include <iostream>
#include <algorithm>
#include <tuple>
#include <vector>
#include <string>
#include <queue>
#include <cmath>
#include <set>
#include <map>

using namespace std;
using ll = long long;

int main()
{
    ll l, r;
    cin >> l >> r;
    int rep = r-l;
    rep = min(rep, 673);
    ll ans = 2018;
    for(int i = 0; i < rep; i++){
        for(int j = l + i + 1; j < l+1+rep; j++){
            ans = min(ans, ((l+i)*j)%2019);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3604
#include <stdio.h>

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


Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
int main() {
	int n, l,x,sum,r;
	cin >> n >> l;
	int a = l;
	x = l + n - 1;
	if (a > 0) {
		r = a;
	}
	else if (a <= 0 && x >= 0) {
		r = 0;
	}
	else {
		r = x;
	}
	sum = ((x-a+1)*(a+x))/2;
	sum -= r;
	cout << sum<< endl;

}

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



string lcs(string s, string t) {

	int dp[s.size() + 1][t.size() + 1];
	memset(dp, 0, sizeof(dp));
	string ans;
	vector<int> idx;
	for (int i = 1; i <= s.size(); i++) {
		for (int j = 1; j <= t.size(); j++) {
			if (s[i - 1] == t[j - 1])
			{
				dp[i][j] = 1 + dp[i - 1][j - 1];
				//idx.push_back(i - 1);
			}
			else
				dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
		}
	}
	//cout << dp[s.size()][t.size()] << endl;
	int j = t.size(), i = s.size();
	while (j >= 0 && i >= 0) {
		if (dp[i][j] == 1 + dp[i - 1][j - 1] && s[i - 1] == t[j - 1])
		{
			idx.push_back(i);
			i -= 1;
			j -= 1;
		}
		else {
			if (dp[i - 1][j] > dp[i][j - 1])
				i -= 1;
			else
				j -= 1;
		}
	}
	for (int i : idx)	ans += s[i - 1];
	reverse(ans.begin(), ans.end());
	return ans;
}

int main() {

// #ifndef ONLINE_JUDGE
// 	freopen("input.txt", "r", stdin);
// 	freopen("output.txt", "w", stdout);
// #endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);

	string s, t;
	cin >> s >> t;

	if (s.size() <= t.size())
		cout << lcs(s, t) << endl;
	else
		cout << lcs(t, s) << endl;

	return 0;
}

Measured memory_bytes: 35456
#include<set>
#include<map>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<math.h>
#include<time.h>
#include<vector>
#include<bitset>
#include<memory>
#include<utility>
#include<fstream>
#include<stdio.h>
#include<sstream>
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
using namespace std;
int main()
{
    #ifdef absi2011
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    int n,k;
    scanf("%d%d",&n,&k);
    int i;
    int t=(n-1)%(k-1);
    if (t>0) t=1;
    printf("%d\n",(n-1)/(k-1)+t);
    return 0;
} 


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

using pii = pair<int,int>;
using ll = long long;
#define rep(i, j) for(int i=0; i < (int)(j); i++)
#define repeat(i, j, k) for(int i = (j); i < (int)(k); i++)
#define all(v) v.begin(),v.end()
#define debug(x) cerr << #x << " : " << x << endl

template<class T> bool set_min(T &a, const T &b) { return a > b  ? a = b, true : false; }
template<class T> bool set_max(T &a, const T &b) { return a < b  ? a = b, true : false; }
// vector
template<class T> istream& operator >> (istream &is , vector<T> &v) { for(T &a : v) is >> a; return is; }
template<class T> ostream& operator << (ostream &os , const vector<T> &v) { for(const T &t : v) os << "\t" << t; return os << endl; }
// pair
template<class T, class U> ostream& operator << (ostream &os , const pair<T, U> &v) { return os << "<" << v.first << ", " << v.second << ">"; }

const int INF = 1 << 30;
const ll INFL = 1LL << 60;


class Solver {
  public:
    void go(int now, int prev, const vector<vector<pii>> &E, vector<int> &c) {
        for(auto &p : E[now]) {
            if(p.first == prev) continue;
            c[p.first] = p.second % 2 == 0 ? c[now] : (c[now] + 1) % 2;
            go(p.first, now, E, c);
        }
    }

    bool solve() {
        int N; cin >> N;
        vector<vector<pii>> E(N);
        rep(i , N - 1) {
            int u, v, w; cin >> u >> v >> w;
            E[u - 1].emplace_back(v - 1, w);
            E[v - 1].emplace_back(u - 1, w);
        }
        vector<int> c(N);
        c[0] = 0;
        go(0, -1, E, c);
        rep(i, N) cout << c[i] << endl;
        return 0;
    }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    Solver s;
    s.solve();
    return 0;
}


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

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

	int N;
	cin >> N;
	int cnt = 0;
	for (int a = 1; a < N; a++) {
		cnt += (N - 1) / a;
	}
	cout << cnt << "\n";
	return 0;
}


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

int main(){
  long long int a,b;
  int q,p,n;
  char c;

  cin >> q;
  a = b = 0;

  while(q--){
    cin >> p >> c >> n;
    if(c=='(')a += n;
    else b += n;
    if(a==b)cout << "Yes\n";
    else cout << "No\n";
  }
}

Measured memory_bytes: 0
main=do
    n<-readLn::IO Int
    putStrLn $ f2 n

f2 :: Int -> String
f2 n
    | n==0 = "0"
    | True = fe n []

fe n r
    | n==0 = r
    | odd n = fo ((n-1)`div`2) ('1':r)
    | True  = fo (n`div`2) ('0':r)

fo n r
    | n==0 = r
    | odd n = fe ((n+1)`div`2) ('1':r)
    | True  = fe (n`div`2) ('0':r)


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

#define rep(i, n) for (int i = 0; i < int(n); i++)
#define rrep(i, n) for (int i = int(n) - 1; i >= 0; i--)
#define reps(i, n) for (int i = 1; i <= int(n); i++)
#define rreps(i, n) for (int i = int(n); i >= 1; i--)
#define repc(i, n) for (int i = 0; i <= int(n); i++)
#define rrepc(i, n) for (int i = int(n); i >= 0; i--)
#define repi(i, a, b) for (int i = int(a); i < int(b); i++)
#define repic(i, a, b) for (int i = int(a); i <= int(b); i++)
#define each(x, y) for (auto &x : y)
#define all(a) (a).begin(), (a).end()
#define bit(b) (1ll << (b))
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define rsort(v) sort(all(v)); reverse(all(v))

using namespace std;

using i32 = int;
using i64 = long long;
using f80 = long double;
using vi32 = vector<i32>;
using vi64 = vector<i64>;
using vf80 = vector<f80>;
using vstr = vector<string>;

inline void yes() { cout << "Yes" << '\n'; exit(0); }
inline void no() { cout << "No" << '\n'; exit(0); }
inline i64 gcd(i64 a, i64 b) { if (min(a, b) == 0) return max(a, b); if (a % b == 0) return b; return gcd(b, a % b); }
inline i64 lcm(i64 a, i64 b) { return a / gcd(a, b) * b; }
void solve(); int main() { ios::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(16); solve(); return 0; }
template <typename T> class pqasc : public priority_queue<T, vector<T>, greater<T>> {};
template <typename T> class pqdesc : public priority_queue<T, vector<T>, less<T>> {};
template <typename T> inline void amax(T &x, T y) { if (x < y) x = y; }
template <typename T> inline void amin(T &x, T y) { if (x > y) x = y; }
template <typename T> inline T power(T x, i64 n) { T r = 1; while (n > 0) { if (n & 1) r *= x; x *= x; n >>= 1; } return r; }
template <typename T> istream& operator>>(istream &is, vector<T> &v) { for (auto &x : v) is >> x; return is; }
template <typename T> ostream& operator<<(ostream &os, const vector<T> &v) { rep(i, v.size()) { if (i) os << ' '; os << v[i]; } return os; }

void solve() {
  int H, W; cin >> H >> W;
  vstr S(H); cin >> S;
  vector<vi64> xsums(H + 2, vi64(W + 2));
  vector<vi64> ysums(H + 2, vi64(W + 2));
  reps(i, H) reps(j, W) {
    if (S[i - 1][j - 1] == '#') continue;
    xsums[i][j] = xsums[i][j - 1] + 1;
    ysums[i][j] = ysums[i - 1][j] + 1;
  }
  rreps(i, H) rreps(j, W) {
    if (xsums[i][j] > 0) amax(xsums[i][j], xsums[i][j + 1]);
    if (ysums[i][j] > 0) amax(ysums[i][j], ysums[i + 1][j]);
  }
  i64 ans = 1;
  reps(i, H) reps(j, W) {
    amax(ans, xsums[i][j] + ysums[i][j] - 1);
  }
  cout << ans << '\n';
}


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

#define var auto
#define ll long long
//#define APPLY(a, f) f(a.begin(), a.end())
#define APPLY(a, f, ...) f(a.begin(), a.end(), __VA_ARGS__)
#define FUN1(x, f) [&](auto& x){return f;}
#define FUN2(x, y, f) [&](auto& x){return f;}
using namespace std;


int main() {
    while (true){
        int n, m, C, s, g;
        cin >> n >> m >> C >> s >> g;
        if (n == 0) return 0;
        vector<vector<vector<int>>> edgesPerRailway(C, vector<vector<int>>(n, vector<int>(n, 1 << 29)));
        for (int i = 0; i < m; i++){
            int x, y, d, c;
            cin >> x >> y >> d >> c;
            x--;
            y--;
            c--;
            edgesPerRailway[c][x][y] = min(edgesPerRailway[c][x][y], d);
            edgesPerRailway[c][y][x] = min(edgesPerRailway[c][y][x], d);
        }

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

        for (int ind = 0; ind < C; ind++){

            for (int i = 0; i < n; i++)
                for (int j = 0; j < n; j++)
                    for (int k = 0; k < n; k++)
                        edgesPerRailway[ind][j][k] = min(edgesPerRailway[ind][j][k], edgesPerRailway[ind][j][i] + edgesPerRailway[ind][i][k]);
            vector<int> sequence(200001);
            vector<int> q(p[ind] - 1);
            vector<int> r(p[ind]);
            for (int i = 0; i < p[ind] - 1; ++i) cin >> q[i];
            for (int i = 0; i < p[ind]; ++i) cin >> r[i];
            int curPtr = 0;
            for (int i = 1; i < sequence.size(); i++){
                sequence[i] = sequence[i - 1] + r[curPtr];
                if (curPtr < q.size() && i == q[curPtr]) curPtr++;
            }
            for (int i = 0; i < n; i++){
                for (int j = 0; j < n; j++){
                    if (edgesPerRailway[ind][i][j] == (1 << 29)) continue;
                    edgesPerRailway[ind][i][j] = sequence[edgesPerRailway[ind][i][j]];
                }
            }
        }

        vector<vector<int>> mat(n, vector<int>(n, 1 << 29));
        for (int r = 0; r < C; r++)
            for (int i = 0; i < n; i++)
                for (int j = 0; j < n; j++){
                    mat[i][j] = min(mat[i][j], edgesPerRailway[r][i][j]);
                }

        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                for (int k = 0; k < n; k++)
                    mat[j][k] = min(mat[j][k], mat[j][i] + mat[i][k]);

        var res = mat[s - 1][g - 1];
        if (res == (1 << 29)) res = -1;
        cout << res << endl;
    }
}


Measured memory_bytes: 4492
while True:
	[m, f, r] = [int(i) for i in input().split()]
	
	if m == -1 and f == -1 and r == -1:
		break
		
	elif m == -1 or f == -1:
		print('F')
			
	elif m + f >= 80:
		print('A')
	elif 65 <= m + f and m + f < 80:
		print('B')
	elif 50 <= m + f and m + f < 65:
		print('C')
	elif 30 <= m + f and m + f < 50 and 50 <= r:
		print('C')
	elif 30 <= m + f < 50:
		print('D')
	else:
		print('F')


Measured memory_bytes: 5600
#include<bits/stdc++.h>
#define ll long long
#define mo 1000000007
using namespace std;
string st;
ll a[30],ansn=1,n;
int main(){
	cin>>n>>st;
	for (int i=0;i<n;i++)a[st[i]-'a']++;
	for (int i=0;i<26;i++)ansn=ansn*(a[i]+1)%mo;
	cout<<ansn-1<<endl;
	return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    double respuesta  = 0;
    cin>>n;
    int resto = n % 2;
    respuesta = round(n/2);
    cout<<respuesta + resto<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();
		System.out.println((H-h)*(W-w));
	}
}

Measured memory_bytes: 21844
package main
import (
  "fmt"
  "sort"
  "math"
)

func enumeration(src []int) (result [][]int) {
  length := int(math.Pow(2, float64(len(src))))
  result = make([][]int, length)
  
  index := 0
  result[index] = []int{}
  index++
  
  for _, n := range src {
    max := index
    for i:=0;i<max;i++ {
      result[index] = copyAndAppend(result[i], n)
      index++
    }
  }
  
  
  return result
}

func copyAndAppend(src []int, n int) []int {
  dst := make([]int, len(src)+1)
  copy(dst, src)
  dst[len(src)] = n
  return dst
}

func arr_common(a []int, b []int) int {
  count := 0
  for _, aa := range a {
    for _, bb := range b {
      if aa == bb {
        count++
        break
      }
    }
  }
  return count
}

func main() {
  var n, m int
  fmt.Scan(&n, &m)
  p := make([]int, m)
  s := make([][]int, m)
  var s_exist []int
  for i:=0;i<n;i++ {
    s_exist = append(s_exist, i+1)
  }
  k := make([]int, m)
  for i:=0;i<m;i++ {
    fmt.Scan(&k[i])
    s[i] = make([]int, k[i])
    for j:=0;j<k[i];j++ {
      fmt.Scan(&s[i][j])
    }
  }
  for i:=0;i<m;i++ {
    fmt.Scan(&p[i])
  }
  sort.Ints(s_exist)
  enum := enumeration(s_exist)
  //fmt.Println(enum)
  count := 0
  
  for _, nn:= range enum {
    cond := true
    if len(nn) == 0 {
      aa := true
      for _, nnnn := range p {
        if (nnnn > 0) {
          aa = false
          break
        }
      }
      if aa {
        count++
      }
      continue
    }
    for ki := range k {
      common := arr_common(nn, s[ki])
      //fmt.Println(kk, nn, s[ki], common%2, p[ki])
      if common%2 != p[ki] {
        cond = false
       	break
      }
    }
    
    if cond {
      //fmt.Println("true")
      count++
    } else {
      //fmt.Println("false")
    }
  }
  fmt.Println(count)
}

Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

// for i in f..<t {... : as Swift
#define forin(i, f, t) for(auto i = f; i < t; i++)

using namespace std;
using ll = long long;

string s;
int k;

int dfs(vector<string> &subs, string str, vector<int> indexes) {
    if (!str.empty())
        subs.push_back(str);
    if (subs.size() == k)
        return true;
    vector<char> minCs;
    while (true) {
        vector<int> nIndexes;
        char minC = INFINITY;
        for (auto i : indexes) {
            cerr << i << ' ';
            if (i + 1 < s.size() && (minC == char(INFINITY) || s[i + 1] < minC)) {
                bool able = true;
                if (!minCs.empty()) {
                    if (find(minCs.begin(), minCs.end(), s[i + 1]) != minCs.end())
                        able = false;
                }
                if (able)
                    minC = s[i + 1];
            }
        }
        for (auto i : indexes) {
            if (s[i + 1] == minC) {
                nIndexes.push_back(i + 1);
            }
        }
        cerr << minC << endl;
        if (minC == char(INFINITY))
            return false;
        if (dfs(subs, str + minC, nIndexes))
            return true;
        minCs.push_back(minC);
    }
}

int main() {
    cin >> s;
    cin >> k;
    vector<int> indexes;
    for (int i = 0; i < s.size(); i++) {
        indexes.push_back(i - 1);
    }
    
    vector<string> subs;
    dfs(subs, "", indexes);
    for (auto s : subs)
        cerr << s << endl;
    cout << subs.back() << endl;
    
    return 0;
}



Measured memory_bytes: 512
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;
typedef long double lb;
#define int long long
#define double long double
#define endn "\n"
typedef pair<int,int> P;
template<class T> inline bool chmin(T& a, T b){if(a>b){a = b;return 1;}return 0;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a = b;return 1;}return 0;}
const int MOD = 1000000007;
//const int MOD = 998244353;
template<class T> inline int add(T& a, T b, T M = MOD){a=(a+M)%M;b=(b+M)%M;a=(a+b)%M;return a;};
template<class T> inline int mul(T& a, T b, T M = MOD){if(a>=M)a%=M;if(b>=M)b%=M;a*=b;if(a>=M)a%=M;return a;};
const ll INF = 1e16;
const double EPS = 1e-10;
const double PI = 3.141592653589793;
const string abc="abcdefghijklmnopqrstuvwxyz";
const string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

////////////////////////////////////////////////////////////////////
///////////////////////___modpow___////////////////////
ll modpow(ll a,  ll n, const ll &MOD = MOD){
  ll ret = n == 0 ? 1 : modpow(a, n/2, MOD);
  (ret *= ret) %= MOD;
  if(n%2)((ret *= a) %= MOD);
  return ret;
}
///////////////////////___modinv___////////////////////
ll modinv(ll d, const ll &MOD = MOD){
  return modpow(d, MOD-2, MOD);
}
////////////////////////////////////////////////////////////////////

int a, b, q, s[110000], t[110000];
vector<int> query;
signed main(){
  cin>>a>>b>>q;
  rep(i,a)cin>>s[i];
  rep(i,b)cin>>t[i];
  rep(i,q){
    int x;cin>>x;query.push_back(x);
  }
  rep(i,q){
    int x = query[i];int ret = INF;
    auto sl = upper_bound(s,s+a,x);
    auto sr = lower_bound(s,s+a,x);
    auto tl = upper_bound(t,t+b,x);
    auto tr = lower_bound(t,t+b,x);
    int xx;
    if(sl != s+0){
      sl--;int sum = abs(x-(*sl));xx = *sl;
      auto l = upper_bound(t,t+b,xx);
      auto r = lower_bound(t,t+b,xx);
      if(l != t)l--;
      sum += min(abs(*l - *sl), abs(*r - *sl));
      chmin(ret, sum);
    }
    if(sr != s+a){
      int sum = abs(x-(*sr));xx = *sr;
      auto l = upper_bound(t,t+b,xx);
      auto r = lower_bound(t,t+b,xx);
      if(l != t)l--;
      sum += min(abs(*l - *sr), abs(*r - *sr));
      chmin(ret, sum);
    }
    if(tl != t+0){
      tl--;int sum = abs(x-(*tl));xx = *tl;
      auto l = upper_bound(s,s+a,xx);
      auto r = lower_bound(s,s+a,xx);
      if(l != s)l--;
      sum += min(abs(*tl - *l), abs(*tl - *r));
      chmin(ret, sum);
    }
    if(tr != t+b){
      int sum = abs(x-(*tr));xx = *tr;
      auto l = upper_bound(s,s+a,xx);
      auto r = lower_bound(s,s+a,xx);
      if(l != s)l--;
      sum += min(abs(*tr - *l), abs(*tr - *r));
      chmin(ret, sum);
    }
    cout << ret << endl;
  }
}


Measured memory_bytes: 3828
N, D = map(int,input().split(' '))


## 座標を取り出す
list_mapping = []
for n in range(N):
  mapping = list(map(int,input().split(' ')))
  list_mapping.append(mapping)

  
## 距離を計算
cnt = 0

for m in list_mapping:
  ## 他の全ての座標と計算
  for n in range(N):
    _ = list_mapping[n]
    if m != _:
      dis_2 = [(x - y) ** 2 for (x, y) in zip(m, _)]
      dis = sum(dis_2) ** (1/2)
    else:
      continue
    
    if dis.is_integer():
      cnt += 1
      
print(int(cnt / 2))


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int n,a[200002],cnt=0,ans=0;
  cin >> n;
  a[0]=0,a[n+1]=0;
  for(int i=1; i<=n; i++) {
    cin >> a[i];
  }
  for(int i=1; i<=n+1; i++) {
    cnt+=abs(a[i-1]-a[i]);
  }
  for(int i=1; i<=n; i++) {
    cout << cnt-abs(a[i-1]-a[i])-abs(a[i]-a[i+1])+abs(a[i+1]-a[i-1]) << endl;
  }
}

Measured memory_bytes: 1664
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long

using namespace std;

const int N=1e5+5, INF=1e18+18;
int n, l, ans=0;
struct node
{
    node *c[2]={NULL, NULL};
    int d, cnt=0;
    bool end=false;
};
node *getNode(int d)
{
    node *ret = new node;
    ret->d = d;
    return ret;
}
void insert(string &s, int idx, node *curr)
{
    curr->cnt++;
    if(idx==s.length())
    {
        curr->end = true;
        return;
    }
    if(!curr->c[0])
    {
        curr->c[0] = getNode(curr->d + 1);
    }
    if(!curr->c[1])
    {
        curr->c[1] = getNode(curr->d + 1);
    }
    int ch = s[idx]-'0';
    insert(s, idx+1, curr->c[ch]);
}
void dfs(node *curr)
{
   // cout << curr->cnt << endl;
    //  cout << curr->d << endl;
    int h = l - curr->d + 1;
    if(!curr->c[0] && !curr->c[1])
    {
        if(curr->end) return;
        int div;
        for(int i = 1; i < INF; i<<=1)
        {
            if(h%i==0) div=i;
        }
     //   cout << curr->d << " " << div << endl;
        ans^=div;
        return;
    }
    dfs(curr->c[0]);
    dfs(curr->c[1]);
}
signed main()
{
    cin >> n >> l;
    node *root = getNode(0);
    for(int i = 0; i < n; i++)
    {
        string s;
        cin >> s;
        insert(s, 0, root);
    }
    dfs(root);
    if(ans)
    {
        cout << "Alice";
    }
    else
    {
        cout << "Bob";
    }
}

Measured memory_bytes: 11264
using System;

public class Serval{
  public static void Main(){
    var line = Console.ReadLine().Split(' ');
    var h = int.Parse(line[0]);
    var a = int.Parse(line[1]);
    var cnt = 0;
    do{
      h = h-a;
      cnt++;
    }while(h>0);
    Console.WriteLine(cnt);
  }
}

Measured memory_bytes: 13140
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<ll, ll>;
const ll mod = 1000000007;



ll gcd(ll i,ll j){
  if(i<0)i=-i;
  if(j<0)j=-j;
  if(i<j){
    swap(i, j);
  }
  ll r=i%j;
  while(r!=0){
    i=j;
    j=r;
    r=i%j;
  }
  return j;
}

long long modpow(long long a, long long n, ll mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


int main(){
  int n;
  cin >> n;
  map<P, int> mp;
  int zero=0;
  rep(i, n){
    ll a, b;
    cin >> a >> b;

    if(a==0 && b==0){
      zero++;
      continue;
    }
    if(a==0){
      mp[P(0, 1)]++;
    } else if(b==0){
      mp[P(1, 0)]++;
    } else {
      if(a<0){
        a=-a;
        b=-b;
      }
      ll gcdab=gcd(a, b);
      mp[P(a/gcdab, b/gcdab)]++;
    }
  }
  ll ans=1;
  ans*=(modpow(2, mp[P(0, 1)], mod)+modpow(2, mp[P(1, 0)], mod)+mod-1)%mod;
  mp[P(0, 1)]=0;
  mp[P(1, 0)]=0;
  ans%=mod;
  for(auto p: mp){
      ll x=p.first.first;
      ll y=p.first.second;
      ll nx, ny;
      if(y>0){
        nx=y;
        ny=-x;
      } else {
        nx=-y;
        ny=x;
      }
      ans*=(modpow(2, mp[p.first], mod)+modpow(2, mp[P(nx, ny)], mod)+mod-1)%mod;
      mp[p.first]=0;
      mp[P(nx, ny)]=0;
      ans%=mod;
  }
  ans+=mod-1;
  ans+=zero;
  ans%=mod;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 28580
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while (true) {
			int n = sc.nextInt();
			if (n == 0)
				break;
			int[][] field = new int[21][21];
			for (int i = 0; i < 21; i++)
				for (int j = 0; j < 21; j++)
					field[i][j] = 0;
			for (int i = 0; i < n; i++) {
				int x = sc.nextInt();
				int y = sc.nextInt();
				field[x][y] = 1;
			}
			int m = sc.nextInt();
			int nx = 10;
			int ny = 10;
			for (int i = 0; i < m; i++) {
				String s = sc.next();
				int d = sc.nextInt();
				if (s.equals("N"))
					for (int j = 0; j < d; j++) {
						ny++;
						if (field[nx][ny] == 1) {
							field[nx][ny] = 0;
							n--;
						}
					}
				if (s.equals("S"))
					for (int j = 0; j < d; j++) {
						ny--;
						if (field[nx][ny] == 1) {
							field[nx][ny] = 0;
							n--;
						}
					}
				if (s.equals("E"))
					for (int j = 0; j < d; j++) {
						nx++;
						if (field[nx][ny] == 1) {
							field[nx][ny] = 0;
							n--;
						}
					}
				if (s.equals("W"))
					for (int j = 0; j < d; j++) {
						nx--;
						if (field[nx][ny] == 1) {
							field[nx][ny] = 0;
							n--;
						}
					}
			}
			if (n == 0)
				System.out.println("Yes");
			else
				System.out.println("No");
		}
		sc.close();
	}
}

Measured memory_bytes: 38552
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) {
        FastReader sc = new FastReader();
        long N = sc.nextLong();
        long ans = N-1;
        for (long i=1; i*i<=N; i++) {
            if (N%i==0) {
                ans = Math.min(ans, i+(N/i)-2);
            }
        }
        System.out.println(ans);
    }
    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

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

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

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

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

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


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;
typedef pair<int, int> p;

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  cout << a * b / 2 << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
using namespace std;

int main(){
    long N;
    cin >> N;
    long dive,i;
    double root = sqrt(N);

    for (i = 1; i < N; i++){
        if(N % i == 0){
            dive = N / i;
            //cout << dive << endl;
        }
        if (i >= root) break;
    }
    long copy = dive;
    int count = 0;
    while(1){
        copy = copy / 10;
        count++;
        if (copy == 0) break;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

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 (b<a) { a=b; return 1; } return 0; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

int main(){
    ll a,b;cin>>a>>b;
    cout << (b%a==0?a+b:b-a) << ednl;
}


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()
}

func main() {
	sc.Split(bufio.ScanWords)
	N := getInt()
	K := getInt()
	X := getInt()
	Y := getInt()

	a := N
	b := 0
	if a >= K {
		a = K
		b = N - K
	}

	fmt.Println(a*X + b*Y)
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=2e5+5;
const ll MOD=1e9+7;

int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n;cin>>n;
    if(n%2==0){
        ll k=n/2;
        ll ans=0,val=5;
        while(val<=k){
            ans+=k/val;
            val*=5;
        }
        cout<<ans<<"\n";
    }
    else{
      /*  ll k=n/2;
        ll a1=0,a2=0;
        ll val=5;
        k*=2;
        while(val<=k){
            a1+=k/val;
            val*=5;
        }

        k/=2;
        val=5;
        while(val<=k){
            a2+=k/val;
            val*=5;
        }*/

        cout<<0;//a1-a2;
    }
}


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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using pii = pair<int, int>;
using vi = vector<int>;
using lint = long long;

const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const double eps = 1e-9;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};

template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, string s = "\n") { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ")
{ if (!v.size()) puts(""); rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }

signed main() {
  int h = in(), w = in();
  int cnt = 0;
  char c;
  rep(i, h) rep(j, w) {
    cin >> c;
    if (c == '#') cnt++;
  }

  cout << (cnt == h + w - 1 ? "Possible" : "Impossible") << endl;
}


Measured memory_bytes: 256
while 1 do
       a,op,b = STDIN.gets.split
       a = a.to_i
       b = b.to_i

       case op
       when '+' then
           puts a + b
       when '-' then
           puts a - b
       when '*' then
           puts a * b
       when '/' then
           puts a / b
       else
           break
    end
end

Measured memory_bytes: 8632
package main

import "fmt"

func main() {
	var str string
	var n int32
	fmt.Scan(&n)
	fmt.Scan(&str)

	for _, s := range str{
		x := s - 'A'
		x = (x+n)%26
		fmt.Print(string('A'+x))
	}
	fmt.Println("")
}

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

int main() {
    int n,mx=0,h;
    cin>>n;
    int ans=0;
    while (n--) {
        cin>>h;
        if (mx<=h) {
            mx=h;
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <string>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cmath>
#include <functional>
#include <numeric>
#include <iomanip>
#define fi first
#define se second
#define fcout(n) cout<<fixed<<setprecision((n))
#define cinl(str) getline(cin,(str))
using namespace std;
bool value(int y,int x,int R,int C){return 0<=y&&y<R&&0<=x&&x<C;}
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long > vll;
typedef vector< vi > vvi;
double pie=acos(-1);
int INF=1000000007;
int dx[4] = { 0,-1,0,1 };
int dy[4] = { -1,0,1,0 };


int main() {
	int x;
	cin>>x;
	if(x<1200){
		cout<<"ABC"<<endl;
	}
	else{
		cout<<"ARC"<<endl;
	}
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n-1);
  rep(i,n-1) cin >> a.at(i);
  vector<int> res(n,0);
  
  rep(i,n-1){
    res.at(a.at(i)-1)++;  
  }
  rep(i,n) cout << res.at(i) << endl;
  
  return 0; 
}


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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
#define int ll
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<vvc> vvvc;
typedef pair<int, int> pii;
typedef pair<pii, pii> piii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector< vi > vvi;
typedef vector< vvi > vvvi;
typedef vector<short> vs;
typedef vector<vs> vvs;
typedef vector<vvs> vvvs;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<ld> vld;
typedef vector<vld> vvld;
typedef vector<vvld> vvvld;
typedef vector<string> vst;
typedef vector<vst> vvst;
typedef pair<ld, ld> pld;

#define inmin(a, b) a = min(a, (b))
#define inmax(a, b) a = max(a, (b))
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define sqr(x) ((x) * (x))
#define fori(i, n) for(int i = 0; i < int(n); ++i)
#define SZ(a) ((int)((a).size()))
#define triple(T) tuple<T, T, T>
#define quad(T) tuple<T, T, T, T>
#define watch(x) cerr << (#x) << " = " << (x) << endl;

#ifdef RUS_HOME
#define cerr cout
#else
#define cerr if (false) cerr
#endif

const double PI = 2 * acos(0.0);
#define rand shittttty_shit
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937_64 rng_64(chrono::steady_clock::now().time_since_epoch().count());

const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";


template <class T0, class T1>
inline ostream & operator << (ostream &out, pair<T0, T1> &a) {
    return out << "{" << a.first << ", " << a.second << "}";
}

template <class T0, class T1>
inline istream & operator >> (istream &in, pair<T0, T1> &a) {
    return in >> a.first >> a.second;
}

template <class T0, class T1, class T2>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << "}";
}

template <class T0, class T1, class T2, class T3>
inline ostream & operator << (ostream &out, tuple<T0, T1, T2, T3> &a) {
    return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a) << ", " <<  get<3>(a) << "}";
}

template<class T>
inline ostream & operator << (ostream &out, vector<T> &a) {
    out << "[";
    fori (i, a.size())
        out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
    return out;
}


void smain();



signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
#ifdef RUS_HOME
    freopen("input", "r", stdin);
    clock_t start = clock();
#endif
    cout << setprecision(12) << fixed;
    smain();
#ifdef RUS_HOME
    cout << "\n\n\n\nTOTAL EXECUTION TIME: " << float( clock () - start ) /  CLOCKS_PER_SEC << endl;
#endif
    return 0;
}


int kek(int x){
    return max(0LL,(3-x+1)*100000);
}

void smain() {

    int n,sum=0;
    cin>>n;
    vi a(n);
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum+=a[i];
    }
    int pref=0,ans=1e18;
    for(int i=0;i<n;i++){
        pref+=a[i];
        if(pref*2<sum){
            inmin(ans,sum-2*pref);
        }else{
            inmin(ans,2*pref-sum);
        }
    }
    cout<<ans;



}

Measured memory_bytes: 1792
#include <bits/stdc++.h> 
#define ll long long int
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL);
#define fr(i,a,b) for(long long int i=a; i<b; i++)
#define pb push_back
#define mp make_pair
using namespace std;
signed main() 
{
    fast
    ll t=1;
    //cin>>t;
    while(t--)
    {
           ll n;
           cin>>n;
           ll a[n],count=0;
           map<ll,ll>m;
           set<ll>s;
           for(ll i=0;i<n;i++) {cin>>a[i];s.insert(a[i]);m[a[i]]++;}
           vector<ll>arr;
           for(auto i:s) arr.pb(i);
           for (int i = 0; i < arr.size(); i++) { 
        for (int j = i + 1; j < arr.size(); j++) { 
            for (int k = j + 1; k < arr.size(); k++) 
                if ( arr[i] + arr[j] > arr[k] && arr[i] + arr[k] > arr[j] 
                    && arr[k] + arr[j] > arr[i]) 
                    count=count+m[arr[i]]*m[arr[j]]*m[arr[k]]; 
        } }
           cout<<count<<"\n";
    }
}

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

int main() {
  string s;

  cin >> s;

  int a = 0, z = (int)s.size() - 1;

  while (s.at(a) != 'A') a++;
  while (s.at(z) != 'Z') z--;

  cout << s.size() - a - ((int)s.size() - (z + 1));

  return 0;
}

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


template <typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v){
    if(!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}

template <typename T1, typename T2>
std::ostream &operator<<(std::ostream &out, const std::pair<T1, T2> &p) {
    out << "[" << p.first << ", " << p.second << "]";
    return out;
}
//---------
int a[200003];

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

    sort(ord.begin(), ord.end());

    set<ll> ss;
    ss.insert(-1);
    ss.insert(n);
    ll ans = 0;

    for(auto &p : ord){
        auto it = ss.lower_bound(p.second);
        auto up = *it;
        auto lo = *--it;
        auto m = p.second;
        //cout << "up = " << up << " lo = " << lo << " m = " << m << endl;
        ans += p.first * (m - lo) * (up - m);
        ss.insert(p.second);
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
    int n, m, tmp_a, tmp_b;
    cin >> n >> m;
    int a[m], b[m], count[n];
    fill(count, count+n, 0);

    for (int i = 0; i < m; i++) {
        cin >> tmp_a >> tmp_b;
        a[i] = tmp_a-1;
        count[tmp_a-1]++;
        b[i] = tmp_b-1;
        count[tmp_b-1]++;
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        int tmp = i;
        while (count[tmp] == 1) {
            for (int j = 0; j < m; j++) {
                if (a[j] == tmp || b[j] == tmp) {
                    if (a[j] == tmp) tmp = b[j];
                    else if (b[j] == tmp) tmp = a[j];
                    count[a[j]]--; count[b[j]]--;
                    a[j] = -1; b[j] = -1; ans++;
                    break;
                }
            }
        }
    }

    cout << ans << endl;
    return 0;
}

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;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999999
#define MOD 1000000007
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
typedef vector<llong> LV;

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



int main() {
	int A,B,C;
    cin >> A >> B >>C;
    // string S;
    // cin >> S;
    if((A==B) && (B==C)){
        cout << "Yes" <<endl;
    }else{
        cout << "No" << endl;
    }

    llong ans=0;
   








}


Measured memory_bytes: 256
package main

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

var (
	BufferSize = 10 * 10 * 10 * 10 * 10 * 10 * 10
)

func scanStr(sc *bufio.Scanner) string {
	if !sc.Scan() {
		panic(nil)
	}

	return sc.Text()
}

func scanInt(sc *bufio.Scanner) int {
	if !sc.Scan() {
		panic(nil)
	}

	i, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}

	return i
}

func main() {
	sc := bufio.NewScanner(os.Stdin)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, BufferSize)
	sc.Split(bufio.ScanWords)

	n := scanInt(sc)
	a := scanInt(sc)
	b := scanInt(sc)

	if a*n < b {
		fmt.Printf("%d\n", a*n)
	} else {
		fmt.Printf("%d\n", b)
	}

}


Measured memory_bytes: 4992
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC132
{
    class C
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] d = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int ans = 0;
            Array.Sort(d);
            int k = n / 2;
            ans = d[k] - d[k - 1];
            Console.WriteLine(ans);
        }
    }
}


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


int main() {
 int N;
 cin >> N;
  int x = 0;
  bool zoro = false;
  for (int i=0; i < N; i++){
  int a;
    int b;
    cin >> a >> b;
    if (a == b){
      x++;
    }else{
      x = 0;
    }
    if (x == 3){
      zoro = true;
    }
  }
  
  if (zoro){
  cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}

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

      
    if((N%1000) == 0){
      cout << "Yes" << endl;
    }
      
    else if((N/10)/(N/1000)==111){
	  cout << "Yes" << endl;
    }
      
    else if((N%1000)/(N%10)==111){
      cout << "Yes" << endl;
    }
      
    else{
      cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int sum = 0;
  
  for (int i = 0; i < N; i++)
  {
    int l, r;
    cin >> l >>r;
  	sum += r - l + 1;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
use std::io::*;

fn main() {
    let mut s: String = String::new();
    stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let a: i64 = itr.next().unwrap().parse().unwrap();
    let v: i64 = itr.next().unwrap().parse().unwrap();
    let b: i64 = itr.next().unwrap().parse().unwrap();
    let w: i64 = itr.next().unwrap().parse().unwrap();
    let t: i64 = itr.next().unwrap().parse().unwrap();

    let sa = (a - b).abs();
    let x = v - w;
    if x * t >= sa {
        println!("YES");
    } else {
        println!("NO");
    }
}


Measured memory_bytes: 2168
import math

n,d = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]

ans = 0

for i in range(n):
    for j in range(n):
        a = 0
        for k in range(d):
            a += (x[i][k]-x[j][k])**2
        if int(math.sqrt(a))**2==a:
            ans += 1

print((ans-n)//2)



Measured memory_bytes: 38704
H,W,D = map(int,input().split())
A = [list(map(int,input().split())) for _ in range(H)]
Q = int(input())
LR = [list(map(int,input().split())) for _ in range(Q)]

data = {A[i][j]:j + i * W for i in range(H) for j in range(W)}

memo = [0] * (H*W+1)
for i in range(1+D,H*W+1):
    a,b = data[i],data[i-D]
    memo[i] = memo[i-D] + abs(a%W - b % W) + abs(a//W - b//W)

for l,r in LR:
    if l == r:
        print(0)
        continue
    print(memo[r] - memo[l])
    

Measured memory_bytes: 44424
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int ll;
typedef vector<ll> vl;
typedef pair<ll, ll> PP;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define all(v) v.begin(), v.end()
#define ITR(v, i) for(auto ite = v.begin(); ite != v.end(); ite++)
const ll INF = 999999999999999;
const ll MOD = 1000000007;
const ll MAX_N = 500010;
ll a, b, c, d, e, f, p, t, x, y, z, q, m, n, r, h, k, w, l, ans;
vector<vl> V[13];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> m >> q;
    vl T[100];
    rep(i, q) {
        cin >> a >> b >> c >> d;
        T[i].push_back(a);
        T[i].push_back(b);
        T[i].push_back(c);
        T[i].push_back(d);
    }

    V[0].push_back({1});
    rep(i, n) {
        for(vl VV : V[i]) {
            for(ll j = VV.back(); j <= m; j++) {
                V[i + 1].push_back(VV);
                V[i + 1].back().push_back(j);
            }
        }
    }

    for(vl VV : V[n]) {
        t = 0;
        rep(i, q) {
            if(VV[T[i][1]] - VV[T[i][0]] == T[i][2])
                t += T[i][3];
        }
        ans = max(ans, t);
    }

    cout << ans << endl;
}


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

int main()
{
  long a,b,s,x,y;
  long c;
  
  cin >> a >> b;
  x=a;
  y=b;
  if(a<b)
  {
    s=a;
    a=b;
    b=s;
  }
  	s=b;
  while(s!=0)
  {
    s=a%b;
    a=b;
    b=s;
  }
  c=x*y/a;
  cout << c <<endl;
  
  return 0;
  
}

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


int main()
{
	int a,no,sum=0, d;

	cin>>no;
	d = no;
	while(no>0)
	{
		a=no%10;
		no=no/10;
		sum=sum+a;
	}
	 //d = no % sum;
	if( (d % sum) == 0)
        printf("Yes\n");
	else
        printf("No\n");
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <cstring>
#define _ ios::sync_with_stdio(false)
using namespace std;
typedef long long int ll;
const int MAXN=100000+10;
int vis[30]={0};
int s[110];
int sum=0;
int main(){
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s[i];
        sum+=s[i];
    }
    if(sum%10!=0){
        cout<<sum<<endl;
        return 0;
    }
    sort(s,s+n);
    for(int i=0;i<n;i++){
        if(s[i]%10!=0){
            cout<<sum-s[i]<<endl;
            return 0;
        }
    }
    cout<<0<<endl;
}



Measured memory_bytes: 256