akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<=(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define Eback(s) s.erase(s.end()-1,s.end())
#define rev(v) reverse(all(v))
#define minvec(v) *min_element(all(v))
#define maxvec(v) *max_element(all(v))
#define sumvec(v) accumulate(all(v),0LL)
#define mapmin(v) v.rbegin()->first
#define mapmax(v) v.begin()->first
#define pb push_back
#define pf push_front
#define m_p make_pair
#define DOUBLE fixed << setprecision(15)
#define OK cerr<<"OK\n"
#define OK1 cerr<<"OK1\n"
#define OK2 cerr<<"OK2\n"
#define SIZE(s) (int)s.size()
#define INF ((1LL<<62)-(1LL<<31))
#define zero(x,n) setw(x) << setfill('0') << n
#define endl '\n'

typedef long long ll;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<long long> vll;
typedef vector<vll> vvll;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<string> vs;

typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;
typedef vector<pair<ll,ll>> vpll;

const double pi = acos(-1.0);
const ll mod=1000000007;
const ll mod2=998244353;

template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}

template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<(int)v.size(); i++) {
		if (i)ost << " ";
		ost << v[i];
	}
	ost << "} \n";
	return ost;
}

template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p:v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}

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

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

void YES(bool b) {cout << ((b)?"YES\n":"NO\n");}
void Yes(bool b) {cout << ((b)?"Yes\n":"No\n");}
void yes(bool b) {cout << ((b)?"yes\n":"no\n");}
void Yay(bool b) {cout << ((b)?"Yay!\n":":(\n");}

ll powmod(ll a,ll b){ll c=1; while(b>0){ if(b&1){ c=a*c%mod; } a=a*a%mod; b>>=1; } return c;}
ll nCrmod(ll n,ll r){ll x=1,y=1; rep(i,r){x=x*(n-i)%mod; y=y*(i+1)%mod;} return x*powmod(y,mod-2)%mod;}
ll gcd(ll x, ll y) {return __gcd(x,y);}
ll lcm(ll x, ll y) {return x/__gcd(x,y)*y;}

int main()
{
	ll n;
	cin >> n;
	set<ll> a;
	rep(i,n){
		ll x;
		cin >> x;
		a.insert(x);
	}
	if(a.size()%2) cout << a.size() << endl;
	else cout << a.size()-1 << endl;
	return 0;
}

Measured memory_bytes: 4992
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		for(var a=0;a>=0;a++){
			string[] str = Console.ReadLine().Split();
			int H = int.Parse(str[0]);
			int W = int.Parse(str[1]);
			if(H==0){
				break;
			} else {
				for(var i=0;i<H;i++){
					string s = "";
					for(var j=0;j<W;j++){
						if(i==0 || i==H-1 || j==0 || j==W-1){
							s += "#";
						} else {
							s += ".";
						}
					}
					Console.WriteLine(s);
				}
				Console.WriteLine("");
			}
		}
	}
}


Measured memory_bytes: 9048
#include <iostream>
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

int gcd(int a, int b){
  if (a<b)
    swap(a,b);
  if (b == 0)
    return a;
  else
    return gcd(b, a%b);
}

int main(){
  
  int N, X; cin >> N >> X;
  
  vector<int> x(N);
  for (int i=0; i<N; i++){
    int xtemp; cin >> xtemp;
    x[i] = abs(xtemp-X);
  }
  
  int ans = gcd(x[0], x[1]);
  for (int i=2; i<N; i++)
    ans = gcd(ans, x[i]);
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include<numeric>
#include<cmath>
#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 INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
using pll = pair<ll,ll>;
using vvii = vector<vector<int> >;
using vvll =  vector<vector<ll> >;

const ll inf = 1LL << 60;

int main(){
    cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
    ll N,M,K; cin>>N>>M>>K;
    vector<ll> A(N),B(M);
    vector<ll> suma(N+1,0),sumb(M+1,0);
    REP(i,N){
        cin >> A[i];
        suma[i+1] = suma[i] + A[i];
    }
    REP(i,M){
        cin >> B[i];
        sumb[i+1] = sumb[i] + B[i];
    }
    int maxi = 0;
    REP(i,N+1){
        ll now = K - suma[i];
        if(now < 0) break;
        else{
            int itr = upper_bound(ALL(sumb),now) - sumb.begin() - 1;
            maxi = max(maxi,i + itr);
        }
    }

    cout << maxi << endl;
}

Measured memory_bytes: 9504
#include<bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i = 0; i < (int)c; i++)
const int inf = pow(10,9);
 
int main(){
  int N;
  cin >> N;
  vector<int> X(N);
  rep(i,N) cin >> X.at(i);
  int sum = inf;
  int Xmax = X.at(0);
  int Xmin = X.at(0);
  
  for (int i = 0; i < N;i++){
    Xmax = max(Xmax, X.at(i));
    Xmin = min(Xmin, X.at(i));
  }
  
  for (int i = Xmin; i <= Xmax; i++){
    int a = 0;
    rep(j,N) a += (X.at(j) - i)*(X.at(j) - i);
    sum = min(a,sum);
  }
  
  cout << sum << endl;
  
}

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

int main() {
	// your code goes here
int n,m;
long long a=0;
cin>>n>>m; vector<int>v(n);
for(int i=0;i<n;i++) {
    cin>>v[i]; a+=v[i];
}
int c=0;
for(int i=0;i<n;i++) {
if(4*m*v[i]>=a) c++;
}
if(c>=m)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 256
N=input()
#print N
a=map(int, raw_input().split())
#print a

cnt4=0
cnt2=0
kisuu=0
for i in range(len(a)):
	#print a[i]
	if a[i]%4==0:
		cnt4+=1
	elif a[i]%4!=0 and a[i]%2==0:
		cnt2+=1
	elif a[i]%2==1:
		kisuu+=1


#print cnt4
#print cnt2
#print kisuu

if cnt4>0 and cnt2==0 and kisuu==0:
	print 'Yes'
elif cnt4==kisuu:
	print 'Yes'
elif cnt4+1==kisuu and cnt2==0:
	print 'Yes'
else:
	print 'No'



Measured memory_bytes: 11320
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define f(i,a,n) for(i=a;i<n;i++)
#define rf(i,a,n) for(i=a;i>=n;i--)
#define ll long long
#define pii pair<int,int>
#define pll pair<long long,long long>
#define vi vector<int>
#define vll vector<long long>
#define umii unordered_map<int,int>
#define umci unordered_map<char,int>
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define F first
#define S second
#define all(v) begin(v),end(v)
#define mkp make_pair
#define setn1(a)  memset(a,-1,sizeof(a))
#define set0(a) memset(a,0,sizeof(a))
#define setl(b) memset(a,1000000001,sizeof(a))
#define M 1000000007
#define I 1000000000000000001
#define TakeInput freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);freopen("error.txt","w",stderr);


using namespace std;

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

int main()
{
	#ifndef ONLINE_JUDGE
	//TakeInput
	#endif
	fast;
	ll n,a,cnt=0;
	cin >> n >> a;
	while(n>0)
	{
		cnt++;
		n=n-a;
	}
	cout << cnt;
	return 0;
}


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

int main() {
  
  int D, G;
  cin >> D >> G;
  vector<int> p(D), c(D);
  for(int i = 0; i < D; i++) {
    cin >> p[i] >> c[i];
  }
  ll sum = 0;
  ll count = 0;
  ll ans = 10000000000000;
  for(int bit = 0; bit < (1 << D); bit++) {
    ll sum = 0;
    ll n = 0;
    for(int i = 0; i < D; i++) {
      if(bit & (1 << i)) { sum += 100 * p[i] * (i + 1) + c[i]; n += p[i]; }
    }
    if(sum >= G) {
      if(ans > n) { ans = n; }
    } else {
      for(int j = D - 1; j >= 0; j--) {
        if(bit & (1 << j)) continue;
        for(int i = 0; i < p[j]; i++) {
          sum += 100 * (j + 1);
          n++;
          if(sum >= G) {
            if(ans > n) { ans = n; break; }
          }
        }
      }
    }
  }

  cout << ans;
    return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())

    l = [0] * (N+1)
    l[0] = 2
    l[1] = 1

    for i in range(2, N+1):
        l[i] = l[i-1] + l[i-2]
    
    print(l[-1])


if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
import java.util.*

fun main(args: Array<String>) {
    val pw = java.io.PrintWriter(System.out)
    Problem.solve(Scanner(System.`in`), pw)
    pw.flush()
}

class UnionFind(size: Int) {
    private val par: IntArray = IntArray(size) { -1 }
    private val rank = IntArray(size) { 0 }

    private fun root(x: Int): Int =
        if (par[x] < 0) {
            x
        } else {
            par[x] = root(par[x])
            par[x]
        }

    fun count(x: Int): Int = -par[root(x)]

    fun isSame(x: Int, y: Int) = root(x) == root(y)

    fun unite(x: Int, y: Int) {
        val rootOfX = root(x)
        val rootOfY = root(y)
        if (rootOfX == rootOfY) return
        if (rank[rootOfX] < rank[rootOfY]) {
            par[rootOfY] += par[rootOfX]
            par[rootOfX] = rootOfY
        } else {
            par[rootOfX] += par[rootOfY]
            par[rootOfY] = rootOfX
        }
        if (rank[rootOfX] == rank[rootOfY]) rank[x]++
    }
}

object Problem {
    fun solve(sc: Scanner, pw: java.io.PrintWriter) {
        val N = sc.next().toInt()
        val M = sc.next().toInt()
        val K = sc.next().toInt()

        // Friend Graph
        val A2B = Array(N + 2) { mutableSetOf<Int>() }
        val group = UnionFind(N + 2)
        repeat(M) {
            val A = sc.next().toInt()
            val B = sc.next().toInt()
            A2B[A].add(B)
            A2B[B].add(A)
            group.unite(A, B)
        }

        // Block Graph
        val C2D = Array(N + 2) { mutableSetOf<Int>() }
        repeat(K) {
            val C = sc.next().toInt()
            val D = sc.next().toInt()
            if (group.isSame(C, D)) {
                C2D[C].add(D)
                C2D[D].add(C)
            }
        }

        val result = (1..N).map { i ->
            group.count(i) - 1 - A2B[i].count() - C2D[i].count()
        }.joinToString(" ")
        println(result)
    }
}


Measured memory_bytes: 153060
#include <bits/stdc++.h>
#define rep(i, n) for (lli i = 0; i < (n); i++)
#define rrep(i, n) for (lli i = (n)-1; i >= 0; i--)
using namespace std;
using lli = long long int;
lli dp1[5000 * 5100] = {};
lli dp2[5000 * 5100] = {};

int c[3][2] = {};
lli calc1(int u){
    if(u<0)return 0;
    lli &ret = dp1[u];
    // Bでu円持ってるときの最適
    if(ret>0)return ret;
    ret = u;
    rep(i,3){
        if(u-c[i][1]>=0)
        ret = max(calc1(u-c[i][1]) + c[i][0], ret);
    }
    return ret;
}
lli calc2(int u){
    if(u<0)return 0;
    lli &ret = dp2[u];
    // Aでu円持ってるときの最適
    if(ret>0)return ret;
    ret = u;
    rep(i,3){
        if(u-c[i][0]>=0)
        ret = max(calc2(u-c[i][0]) + c[i][1], ret);
    }
    return ret;
}
int main(){
    lli n;cin >> n;
    rep(j,2)rep(i,3)cin >> c[i][j];
    lli x = calc2(n);
    cout << max(calc1(x),n) << endl;
}


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

// マクロ //
#define rep(v,times) for(int v = 0; v < (int)(times); v++)
#define req(v,first,endplus1) for(int v = first; v < (int)(endplus1); v++)
#define all(x) x.begin(), x.end()
#define sort(x) sort(all(x))
#define uniq(x) x.erase(unique(all(x)), x.end())
#define vsum(x) accumulate(all(x), 0)
#define cou(x) cout << x << endl
#define y() cout << "Yes" << endl
#define n() cout << "No" << endl
#define Y() cout << "YES" << endl
#define N() cout << "NO" << endl
#define x2(x) (x) * (x)

// 型エイリアス //
using lint = long long;
using pii = pair<int, int>;
using vpii = vector<pii>;
using plili = pair<lint, lint>;
using vplili = vector<plili>;
using vi = vector<int>;
using vli = vector<lint>;
using vc = vector<char>;
using vs = vector<string>;
using vb = vector<bool>;
using vvi = vector<vi>;
using vvli = vector<vli>;
using vvb = vector<vb>;
using vvc = vector<vc>;
using vvs = vector<vs>;
using mii = map<int, int>;
using mili = map<int, lint>;
using mci = map<char, int>;
using mcli = map<char, lint>;
using msi = map<string, int>;
using msli = map<string, lint>;


// 関数 //
template<class T, class Q> lint gcd_(T a, Q b) {
    int t;
    while (b != 0) {
        t = a % b;
        a = b;
        b = t;
    }
    return a;
}

template<class T, class Q> lint lcm_(T a, Q b) {
    return a * b / gcd_(a, b);
}

template<class T, class Q> double distance(T a, Q b) {
    double dist;
    dist = sqrt(x2(a.first - b.first) + x2(a.second - b.second));
    return dist;
}

lint perm(int a) {
    lint perm = 1;
    for (int i = a; i >= 1; i--) {
        perm *= i;
    }
    return perm;
}

lint combination(int n, int m) {
    long double c = 1;
    for (int i = n, k = 1; i > m; i--, k++) {
        c *= i;
        c /= k;
    }
    return (lint)c;
}

template<class T, class Q> inline bool chmin(T& a, Q b) {
    if (a > b) { 
        a = b;
        return true; 
    }
    return false;
}

template<class T, class Q> inline bool chmax(T& a, Q b) {
    if (a < b) { 
        a = b; 
        return true; 
    }
    return false;
}

// 定数 //
const double pi = acos(-1);
const int mod = 1000000007;
const int inf = 1045141919;
const lint linf = ((1LL << 62) - 1);
const int dx4[4] = { 1,0,-1,0 };
const int dy4[4] = { 0,1,0,-1 };
const int dx8[8] = { 1,1,0,-1,-1,-1,0,1 };
const int dy8[8] = { 0,1,1,1,0,-1,-1,-1 };

// End of Template //



int main() {

    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
        
    int N;
    cin >> N;

    N >= 30 ? y() : n();


}

Measured memory_bytes: 3644
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <sstream>
#define ull unsigned long long
#define ll long long
#define INF 1000000007
using namespace std;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string x;
    cin >> x;
    int s=0,t=0;
    for(int i=0;i<x.size();i++){
        if(x[i]=='S'){
            s++;
        }
        else if(x[i]=='T'){
            if(s>0){
                s--;
            }
            else t++;
        }
    }
    cout << t+s << endl;

    return 0;
}

Measured memory_bytes: 720
#include <stdio.h>

int main(void){
  int a,b,c;
  int x;

  scanf("%d %d %d", &a, &b, &c);

  if(a > b){
    x = a;
    a = b;
    b = x;
  }
  if(b > c){
    x = b;
    b = c;
    c = x;
  }
  if(a > b){
    x = a;
    a = b;
    b = x;
  }

  printf("%d %d %d\n", a, b, c);

  return 0;
}

Measured memory_bytes: 1836
#include <bits/stdc++.h>
#define pb push_back
#define FOR(i,a,b) for(int i = a; i < b ; i++)
using namespace std;

int main()
{
	int a,p;
	cin>>a>>p;
	a = a * 3 + p;
	cout<<a / 2<<endl;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
#define int ll
const int N=2e5+3;
int f[N],a[N];
int32_t main()
{
	#ifndef ONLINE_JUDGE
	freopen("in","r",stdin);
	freopen("out","w",stdout);
	#endif

	int n,k;cin>>n>>k;
	for(int i=0;i<n;i++)
	{cin>>a[i];f[a[i]]++;}

	vector<int> val;
	for(int i=0;i<N;i++)
		if(f[i])val.push_back(f[i]);
	sort(val.begin(),val.end());
	int now=val.size();
	if(now<=k){puts("0");return 0;}
	int ans=0;
	for(int i=0;i<(now-k);i++)ans+=val[i];
	cout<<ans;
}


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

int main(){
    int x, a, b;
    cin >> x >> a >> b;

    if(a >= b){
        cout << "delicious" << endl;
    }else{
        if(b - a <= x){
            cout << "safe" << endl;
        }else{
            cout << "dangerous" << endl;
        }
    }
}

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

int partition(int A[],int p,int r){
    int x=A[r];
    int i=p-1;
    for(int j=p;j<r;j++){
        if(A[j]<=x){
            i++;
            swap(A[i],A[j]);
        }
    }
    swap(A[i+1],A[r]);
    return i+1;
}

int main(){
    int n;
    cin>>n;
    int A[n];
    rep(i,n) cin>>A[i];

    int res=partition(A,0,n-1);

    rep(i,n){
        if(i) cout<<" ";
        if (i==res) cout<<"[";
        cout<<A[i];
        if (i==res) cout<<"]";
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 3384
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstring>
#include<string>
using namespace std;
int n,x[105],ans=0x3f3f3f3f;
int main(){
	cin>>n;
	for(int i=1;i<=n;i++)cin>>x[i];
	for(int i=1;i<=100;i++){
		int s=0;
		for(int j=1;j<=n;j++)s+=(x[j]-i)*(x[j]-i);
		ans=min(ans,s);
	}
	cout<<ans;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final List<Integer> colors = new ArrayList<>();

        for (int i = 0; i < n; i++) {
            final int next = scanner.nextInt();
            insert(colors, next);
        }

        System.out.println(colors.size());
    }

    private static void insert(final List<Integer> list, final int value) {
        if (list.isEmpty()) {
            list.add(value);
            return;
        }

        if (value <= list.get(0)) {
            list.add(0, value);
            return;
        }

        if (value > list.get(list.size() - 1)) {
            list.set(list.size() - 1, value);
            return;
        }

        //final int index = mySearch(list, value, 0, list.size() - 1);
        int index;
        for (index = 0; index < list.size(); index++) {
            if (list.get(index) >= value) {
                break;
            }
        }
        list.set(index - 1, value);
    }

    private static int mySearch(final List<Integer> list, final int value, final int start, final int end) {
        if (end - start <= 1) {
            return start;
        }

        final int means = (start + end) / 2;
        if (value <= list.get(means)) {
            return mySearch(list, value, start, means);
        } else {
            return mySearch(list, value, means + 1, end);
        }
    }
}


Measured memory_bytes: 49448
# -*- coding: utf-8 -*-


def main():
    from collections import defaultdict
    import sys
    input = sys.stdin.readline

    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    summed = [0 for _ in range(n + 1)]
    d = defaultdict(int)

    # See:
    # https://www.youtube.com/watch?v=7bbIZTIeDZM
    # KeyInsight:
    # 愚直解から計算量を減らす工夫
    # ◯: 1. 任意の要素数の和を計算、O(N)→累積和、前計算が(N)・各クエリの処理がO(1)
    # ◯: 2. mの倍数→mod m = 0
    # △: modの世界に対する理解
    #    累積和のうち、x, y番目の値a, bの差がmで割り切れる
    #    (b - a) mod m == 0
    #    a mod m == b mod mとなる
    #    mで割った余りが一致する個数を数えればよい
    for i in range(n):
        summed[i + 1] = (summed[i] + a[i]) % m

    ans = 0

    # ある地点jにおいて、mで割った余りが一致する個数を数える
    for j in range(n + 1):
        ans += d[summed[j]]
        d[summed[j]] += 1

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 21908
abcd=input()

res=''
for i in range(2**3):
    B=format(i,'b').zfill(3)
    sum_=int(abcd[0])
    res=abcd[0]
    j=1
    for k in range(3):
        if B[k]=='1':
            sum_+=int(abcd[j])
            res+='+'
        else:
            sum_-=int(abcd[j])
            res+='-'
        res+=abcd[j]
        j+=1
    if sum_==7:
        break

print('{}=7'.format(res))

Measured memory_bytes: 9204
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int D = sc.nextInt();
		int[][] x = new int[N][D];
		for (int n = 0; n < N; n++) {
			for (int d = 0; d < D; d++) {
				x[n][d] = sc.nextInt();
			}
		}
		int count = 0;
		for (int i = 0; i < N; i++) {
			for (int j = i + 1; j < N; j++) {
		      	double sum = 0;
				for (int d = 0; d < D; d++) {
					int dx = x[i][d] - x[j][d];
					sum += dx * dx;
				}
				double dist = Math.sqrt(sum);
				if (dist == Math.floor(dist)) {
					count++;
				}
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 21972
import std.algorithm;
import std.stdio;

int solve (int n)
{
	auto p = new int [n];
	auto q = new int [n];
	foreach (int i, ref c; p)
	{
		readf (" %s", &c);
		c -= 1;
		q[c] = i;
	}
	int cur = 1;
	int res = cur;
	foreach (i; 1..n)
	{
		if (q[i] > q[i - 1])
		{
			cur += 1;
			res = max (res, cur);
		}
		else
		{
			cur = 1;
		}
	}
	return n - res;
}

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		writeln (solve (n));
	}
}


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

vector<vector<int>> adj;
vector<int> vis, dist, in_degree;

void dfs(int u) {
  vis[u] = true;
  for(int v : adj[u]) {
    dist[v] = max(dist[v], dist[u] + 1);
    in_degree[v]--;
    if(in_degree[v] == 0) dfs(v);
  }
}

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

  int n, m;
  cin >> n >> m;

  adj.resize(n+1);
  vis.resize(n+1);
  dist.resize(n+1);
  in_degree.resize(n+1);

  int x, y;
  for(int i=0; i<m; i++) {
    cin >> x >> y;
    adj[x].push_back(y);
    in_degree[y]++;
  }
  
  for(int i=1; i<=n; i++) {
    if(!vis[i] && in_degree[i]==0) {
      dfs(i);
    }
  }

  cout << *max_element(dist.begin(), dist.end()) << '\n';
  
  return 0;
}

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

#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))

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

int main(){
ll X,Y; cin>>X>>Y;
bool ans=false;
for(int i=0;i<=X;i++){
    if(i*2+(X-i)*4==Y){
        ans=true;
    }
}
if(ans){
    cout<<"Yes"<<endl;
}else{
    cout<<"No"<<endl;
}

}

Measured memory_bytes: 3636
#include <stdio.h>

int main(){
  int h,w;
  scanf("%d %d",&h,&w);
  char s[51][51];
  for(int i=0;i<h;i++){
    scanf("%s",&s[i]);
  }
  
  int dx[8] = {0,1,0,-1,1,1,-1,-1};
  int dy[8] = {1,0,-1,0,1,-1,1,-1};
  int x,y;
  int count;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(s[i][j] == '#') continue;
      
      count = 0;
      for(int k=0;k<8;k++){
        x = i + dx[k];
        y = j + dy[k];
        if(x < 0 || x >= h || y < 0 || y >= w) continue;
        if(s[x][y] == '#') count++;
      }
      s[i][j] = '0' + count;
    }
    printf("%s\n",s[i]);
  }
  
  return 0;
}

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

int main(){
	int N ; cin >> N;
    vector<int> a(N);
    for(int i = 0; i < N; i++) cin >> a[i];
    cout << (*max_element(a.begin(), a.end()) < accumulate(a.begin(), a.end(), 0) - *max_element(a.begin(), a.end()) ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 384
#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;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 
const int mod=1e9+7;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename A,typename B> istream& operator>>(istream&,pair<A,B>&);
template<typename A> istream& operator>>(istream&,vector<A>&);
void add(int&,int);
int mul(int,int);
int powz(int,int);
template<typename A> ostream& operator<<(ostream&,vector<A>&);
 
const int N=1000006;

void solve(){
	int n;
	cin>>n;
	vi v(n);
	cin>>v;
	int ans=0;
	for(int i=1;i<n-1;i++){
		vi z;
		z.pb(v[i]);
		z.pb(v[i-1]);
		z.pb(v[i+1]);
		sort(all(z));
		if(z[1]==v[i]){
			ans++;
		}
	}
	cout<<ans;

}
	
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tc=1;
	//~ cin>>tc;
	for(int _=0;_<tc;_++){
		//~ cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
	if(a<0)a+=mod;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)res=mul(res,a);
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
	    output<<i<<' ';
	return output;	
}


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

int main() {
    int N, res=0;
    cin >> N;
    int n = N;
    
    for(int i=9; i>=0; i--){
      int k = int(pow(10, i));
      res += int (n / k);
      n = n % k;
    }
    // printf("%d\n", res);
    
    if(N%res==0) cout << "Yes" << endl;
    else cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
// ???
#include<iostream>
#include<vector>
#include<map>
using namespace std;

typedef long long ll;

int main(){
    int n;
    cin >> n;
    vector<int> v(n);
    for(int i = 0; i < n; i++)  cin >> v[i];
    int k = n/2;
    map<int,ll> dp[n];
    // dp[i][x] := use v[i], count x, max value
    dp[0][0] = 0;
    dp[0][1] = v[0];
    dp[1][0] = 0;
    dp[1][1] = max(v[0], v[1]);
    for(int i = 2; i < n; i++){
        int residual = (n-i-1)/2;
        for(int now = max(k-residual, 1); now <= k; now++){
            if(dp[i-2].count(now-1) == 0)   break;
            dp[i][now] = dp[i].count(now) ? max(dp[i][now], dp[i-2][now-1]+v[i]) : dp[i-2][now-1]+v[i];
            if(dp[i-1].count(now))  dp[i][now] = max(dp[i][now], dp[i-1][now]);
        }
        // for(auto p : dp[i]) if(dp[i-1].count(p.first))  dp[i][p.first] = max(p.second, dp[i-1][p.first]);
    }
    ll ma = -(1ll<<60);
    for(int i = 0; i < n; i++)  if(dp[i].count(k))   ma = max(ma, dp[i][k]);
    cout << ma << endl;
    return 0;
}

Measured memory_bytes: 32300
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
#include<random>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s; cin >> s;
    int n = s.size();
    // n = 2
    if(s[0] == '0' || s[n - 2] == '0' || s[n - 1] == '1'){
        cout << -1 << '\n';
        return 0;
    }
    for(int i = 1; i < n - 2; i++){
        if(s[i] != s[n - 2 - i]){
            cout << -1 << '\n';
            return 0;
        }
    }
    int cnt = 1, head = 1;
    for(int i = 0; i < n - 1; i++){
        if(s[i] == '1'){
            cout << head << ' ' << cnt + 1 << '\n';
            head = cnt + 1;
        }else{
            cout << head << ' ' << cnt + 1 << '\n';
        }
        cnt++;
    }
}


Measured memory_bytes: 1616
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <vector>
#include <sstream>
#include <string>
#include <cstdio>
#include <array>

using namespace std;

//デバッグ時はTESTを定義する。本番時はこの行をコメントアウトする
//#define TEST //*******************************************************************************************************************************************

//そうすることで、以下に定義する、デバッグ時にのみ標準出力する、doutコマンドが実現できる。本番時はダミーストリームに出力
//#ifdef TEST
//    #define dout cout
//#else
//    stringstream dummy; //デバッグ時のdoutコマンドのダミー出力先
//    #define dout dummy
//#endif


int main(void) {
    string s;
    cin >> s;
    
    for(int i=0; i<s.size(); i+=2) {
        cout << s[i];
    }
    cout << endl;
    
    return 0;
}

Measured memory_bytes: 512
def inp():
    return input()
def iinp():
    return int(input())
def inps():
    return input().split()
def miinps():
    return map(int,input().split())
def linps():
    return list(input().split())
def lmiinps():
    return list(map(int,input().split()))
def lmiinpsf(n):

    return [list(map(int,input().split()))for _ in range(n)]

n = iinp()
x = 10**9+7

a = 1
b = 1
c = 1

if n == 1:
    print(0)
    exit()

for i in range(n):
    a *= 10
    a %= x
    b *= 9
    b %= x
    c *= 8
    c %= x

b *= 2
b %= x

b -= c
if b < 0:
    b += x

a -= b
if a < 0:
    a += x

print(a)

Measured memory_bytes: 9228
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
bool bo[100];
#define ll long long int
 
int main()
{
	ll n,m;
	cin>>n>>m;
	char a[n+10][n+10],b[m+10][m+10];
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			cin>>a[i][j];
		}
	}
	for(int i=0;i<m;i++)
	{
		for(int j=0;j<m;j++)
		{
			cin>>b[i][j];
		}
	}
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n;j++)
		{
			if((n-i)>=m && (n-j)>=m){
			bool bb=0;
			if(a[i][j]==b[0][0])
			{
				int cnt=0;
				for(int k=0;k<m;k++)
				{
					for(int l=0;l<m;l++)
					{
						if(a[i+k][j+l]==b[k][l])
						{
							cnt++;
						}
						else
						{
							bb==1;
							cnt=0;
							break;
						}
						if(cnt==(m*m))
						{
							cout<<"Yes"<<endl;
							return 0;
						}
					}
					if(bb==1) break;
				}
			}
		}
		}
	}
	cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
#include <numeric>
#include <math.h>

using namespace std;



void func()
{
	int X,Y,Z;
	cin >> X >>Y>>Z;

	cout << Z << " " << X << " " << Y << endl;
}

int main() {

//	while (1)
		func();
	return 0;
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define ll long long
#define pi pair<int,int>
#define pl pair<ll,ll>
#define pd pair<double,double>
#define ld long double
#define pld pair<ld,ld>
#define lg length()
#define sz size()
#define pb push_back
#define INF 1000000005
#define LINF 1000000000000000005

int n,k,a[105],dp[100005];

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n >> k;
    for(int i=1;i<=n;i++) cin >> a[i];
    for(int i=1;i<=k;i++){
        for(int j=1;j<=n;j++){
            if(a[j]<=i && dp[i-a[j]]==0) dp[i]=1;
        }
    }
    if(dp[k]) cout << "First";
    else cout << "Second";
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
void print(vector <pair<double,double>> points)
{    for(int i=0;i<points.size();i++)
        printf("%0.8f %0.8f\n",points[i].first,points[i].second);
}
void newcurve(vector <pair<double,double>> &points){
    vector <pair<double,double>> points2;
    double d,angle,tmp,x1,x2,x3,tmpx,y1,y2,y3,tmpy;
    for(auto i=0;i<points.size()-1;i++) {
        tmp=atan((points[i].second-points[i+1].second)/(points[i+1].first-points[i].first));
        d=sqrt(pow(points[i].first-points[i+1].first,2)+pow(points[i].second-points[i+1].second,2));
        x1=(2*points[i].first+points[i+1].first)/3;
        x2=(points[i].first+2*points[i+1].first)/3;
        tmpx=(points[i].first+points[i+1].first)/2;
        y1=(2*points[i].second+points[i+1].second)/3;
        y2=(points[i].second+2*points[i+1].second)/3;
        tmpy=(points[i].second+points[i+1].second)/2;
        if((points[i+1].first-points[i].first)==0) {x3=points[i+1].first;y3=tmpy;}
        else if((points[i+1].first-points[i].first)<0)  {x3=tmpx-d/6*sqrt(3)*sin(tmp);y3=tmpy-d/6*sqrt(3)*cos(tmp);}
        else  {x3=tmpx+d/6*sqrt(3)*sin(tmp);y3=tmpy+d/6*sqrt(3)*cos(tmp);}
        points2.push_back(points[i]);
        points2.emplace_back(x1,y1);
        points2.emplace_back(x3,y3);
        points2.emplace_back(x2,y2);
    }
    points2.emplace_back(100,0);
    points.clear();
    points=points2;
}
int main()
{
    vector <pair<double,double>> points;
    points.emplace_back(0,0); points.emplace_back(100,0);
    int num;cin>>num;
    for(int i=0;i<num;i++) {
        newcurve(points);
    }
    print(points);
    return 0;
}


Measured memory_bytes: 3560
#include <cstdio>
#include <vector>
using namespace std;
int n, m, a[200009], b[200009], e[400009], c[100009], s[100009], cnt, col[100009];
bool dfs(int pos) {
	bool ret = true; cnt++;
	for (int i = c[pos]; i < c[pos + 1]; i++) {
		if (col[e[i]] == col[pos]) ret = false;
		if (col[e[i]] == 0) {
			col[e[i]] = 3 - col[pos];
			if (!dfs(e[i])) ret = false;
		}
	}
	return ret;
}
void reader(int *x) {
	for (char c = getchar_unlocked(); 48 <= c && c <= 57; c = getchar()) *x = *x * 10 + c - 48;
}
int main() {
	reader(&n); reader(&m);
	for (int i = 0; i < m; i++) {
		reader(&a[i]); reader(&b[i]);
		c[--a[i]]++; c[--b[i]]++;
	}
	for (int i = 0; i < n; i++) s[i + 1] = s[i] + c[i]; c[0] = 0;
	for (int i = 0; i < n; i++) c[i + 1] = s[i + 1];
	for (int i = 0; i < m; i++) e[s[a[i]]++] = b[i], e[s[b[i]]++] = a[i];
	int c0 = 0, c1 = 0, c2 = 0;
	for (int i = 0; i < n; i++) {
		if (col[i] == 0) {
			col[i] = 1; cnt = 0;
			bool res = dfs(i);
			if (cnt == 1) c0++;
			else if (!res) c1++;
			else c2++;
		}
	}
	printf("%lld\n", 1LL * (c1 + c2) * (c1 + c2) + 1LL * c2 * c2 + 1LL * n * n - 1LL * (n - c0) * (n - c0));
	return 0;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
#define rep(i,n) for (ll i=0; i<(n); ++i)
#define rep1(i,n) for (ll i=1; i<=(n); ++i)
typedef long long ll;
bool debug=false;
string yes = "Yes";
string no = "No";
const ll mod = 998244353;
const double e = 0.000000001;

int main(){
  ll n; cin >> n;
  string s; cin >> s;
  ll e=0,w=0;
  for(auto c:s){
    if(c=='E') e++;
    else w++;
  }
  ll le=0,lw=0;
  ll ans=n;
  for(auto c:s){
    if(c=='E'){
      ans = min(ans, (e-le-1)+lw);
      le++;
    }
    else {
      ans = min(ans, (e-le)+lw);
      lw++;
    }
  }
  cout << ans;

  return 0;
}


Measured memory_bytes: 900
S = int(input())
K = int(input())
import numpy as np

S_list = list(map(int, str(S)))

#最初から何文字1が連続するか
count = 0
for i in S_list:
    if int(i) == 1:
        count+=1
    else:
        break

#文字列が1文字ならその文字を返す
if len(S_list) == 1:
    print(int(S_list[0]))
    exit()


if count < K:
    S_list = np.array(S_list).reshape(-1,1)
    print(int(S_list[count]))
else:
    print(1)

Measured memory_bytes: 18084
from math import factorial

n, k = map(int, input().split())

class Facts():
    # 階乗のメモ化
    # 組み合わせ数、順列数の計算を高速に行う
    def __init__(self, max_num=10**5, p=10**9 + 7):
        self.p = p
        self.max_num = max_num
        self.fact = [1] * (self.max_num + 1)
        for i in range(1, self.max_num + 1):
            self.fact[i] = self.fact[i-1] * i
            self.fact[i] %= self.p

    def comb(self, n, k):
        # nCk mod p を求める
        if n < 0 or k < 0 or n < k:
            return 0
        if n == 0 or k == 0:
            return 1
        a = self.fact[n]
        b = self.fact[k]
        c = self.fact[n-k]
        return (a*self.power_func(b, self.p-2) *
                self.power_func(c, self.p-2)) % self.p

    def perm(self, n, k):
        # nPk mod p を求める
        if n < 0 or k < 0 or n < k:
            return 0
        if n == 0 or k == 0:
            return 1
        a = self.fact[n]
        b = self.fact[n-k]
        return (a * self.power_func(b, self.p-2)) % self.p


    def power_func(self, a, b):
        # a^b mod p　を繰り返し二乗法で求める
        if b == 0:
            return 1
        if b % 2 == 0:
            d = self.power_func(a, b//2)
            return d*d % self.p
        if b % 2 == 1:
            return (a*self.power_func(a, b-1)) % self.p

MOD = 10 ** 9 + 7
facts = Facts(n)

for i in range(1, k+1):
    ans = facts.comb(n-k+1, i) * facts.comb(k-1, i-1) % MOD
    print(ans)





Measured memory_bytes: 3444
N=int(input())
#ls=[]
ds={}
for i in range(N):
    s=input()
    #dc={}
    #for ss in s:#sを辞書化
        #if ss in dc.keys():
            #dc[ss]+=1
        #else:
            #dc[ss]=1
    #s=sorted(s)
    s="".join(sorted(s))#sを比較できる形へ

    #ls.append(dc)
    #if dc in ds:#文字列がそれぞれ何個重複しているかわかる
    #_TypeError: unhashable type: 'dict'
    #_辞書のキーはイミュータブルでなければならない
    #    ds[dc]+=1
    #else:
    #    ds[dc]=1"""

    if s in ds:
        ds[s]+=1
    else:
        ds[s]=1

ans=0
for i in ds:
    ans+=ds[i]*(ds[i]-1)/2
#print(ls)
#for i in range(N):
    #for j in range(i+1,N):
        #if ls[i]==ls[j]:
        #    ans+=1

    #dc=ls[i]
    #del ls[i]
    #if dc in ls:
print(int(ans))


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


int main() {
    int x, a, b;
    cin >> x >> a >> b;
    if (b - a <= 0) {
        cout << "delicious" << endl;
    } else if (b - a <= x) {
        cout << "safe" << endl;
    } else {
        cout << "dangerous" << endl;
    }
    return 0;
}


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

#define st first
#define nd second
#define all(x) (x).begin(), (x).end()

using namespace std;
using namespace placeholders;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

template <class T> void mini(T &l, T r){l = min(l, r);}
template <class T> void maxi(T &l, T r){l = max(l, r);}

template <class TH> void _dbg(const char *sdbg, TH h){cerr << sdbg << "=" << h << "\n";}
template <class TH, class ...TA> void _dbg(const char *sdbg, TH h, TA... a){
	while (*sdbg != ','){cerr << *sdbg++;}cerr << "=" << h << ","; _dbg(sdbg + 1, a...);
}
template <class T> ostream &operator <<(ostream &os, vector<T> V){
	os << "["; for (auto vv: V) os << vv << ","; return os << "]";
}
template <class L, class R> ostream &operator <<(ostream &os, pair<L, R> P){
	return os << "(" << P.st << "," << P.nd << ")";
}

#ifdef SFIC
	#define eput(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
	#define eput(...) 218
#endif

int main(){
	int x;
	scanf("%d", &x);
	vector<vector<int>> a;
	for (int i = 1; i <= 18; ++i){
		a.push_back({i, i + 1, 0});
		a.push_back({i, i + 1, 1 << i - 1});
	}

	int tot = 0;
	for (int i = 19; i >= 1; --i)
		for (; x >= (1 << i - 1); x -= 1 << i - 1){
			a.push_back({i, 20, tot});
			tot += 1 << i - 1;
		}
	printf("%d %d\n", 20, a.size());
	for (auto &x: a)
		printf("%d %d %d\n", x[0], x[1], x[2]);
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int X = scan.nextInt();
		int Y = scan.nextInt();
		int Z = scan.nextInt();
		int sum = 0;
		int count = 0;
		sum += Z;
		while(true) {
			sum += (Y + Z);
			if(X >= sum) {
				count++;
			} else {
				System.out.println(count);
				break;
			}
		}
		scan.close();

	}

}


Measured memory_bytes: 21716
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cstring>
const int MOD = 1e9 + 7;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
typedef long long ll;
using namespace std;
int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A[3];
	for(int i = 0; i < 3; i++)
	{
		cin >> A[i];
	}
	sort(A, A + 3);
	int cnt = 0;
	while(1)
	{
		if(A[0] == A[1] || A[0] == A[1] - 1)
			break;
		A[0] += 2;
		cnt++;
	}
	if(A[0] != A[1])
		cnt++;
	cnt += A[2] - A[0];
	cout << cnt << endl;
	return 0;
}

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

int main(){
    int n,k; cin>>n>>k;
    double ans=0;
    for(int i=1;i<=n;i++){
        double p=1;
        int x=i;
        while(x<k){
            x*=2;
            p/=2.0;
        }
        ans+=p/n;
    }
    printf("%.20f\n",ans);
}

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

ll gcd(ll x,ll y) {return y ? gcd(y,x%y) : x;} 
ll lcm(ll x,ll y) {return x/gcd(x,y)*y;}

int dp[105][4][2];

int main(){
    string s;
    cin >> s;
    int t;
    cin >> t;
    int n;
    n=s.size();
    dp[0][0][0]=1;
    rep(i,n){
        rep(j,4){
            rep(k,2){
                int nd=s[i]-'0';
                rep(d,10){
                    int ni=i+1,nj=j,nk=k;
                    if(d!=0) nj++;
                    if(nj>t) continue;
                    if(nk==0){
                        if(nd<d) continue;
                        if(nd!=d) nk=1;
                    }
                    dp[ni][nj][nk]+=dp[i][j][k];
                }
            }
        }
    }
    
    cout << dp[n][t][0]+dp[n][t][1] << endl;
    
    return 0;
}











Measured memory_bytes: 256
use std::io;
use std::str::FromStr;
use std::collections::HashMap;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn input_vec() -> Vec<u64> {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.split_whitespace().map(|s| s.parse().unwrap()).collect()
}

fn dp(i: usize, yesterday: usize, happiness_vec: &Vec<Vec<u64>>, cache: &mut HashMap<usize, u64>) -> u64 {
    if i == happiness_vec.len() {
        return 0;
    }

    if cache.contains_key(&(i * 10 + yesterday)) {
        return *cache.get(&(i * 10 + yesterday)).unwrap();
    }

    let mut max = 0u64;
    for j in 0..3usize {
        if j == yesterday {
            continue;
        }
        let res = dp(i+1, j, happiness_vec, cache) + happiness_vec[i][j];
        if res > max {
            max = res;
        }
    }
    cache.insert(i * 10 + yesterday, max);
    max
}

fn main() {
    let n: u64 = input();
    let mut happiness_vec: Vec<Vec<u64>> = Vec::new();
    let mut cache: HashMap<usize, u64> = HashMap::new();
    for _ in 0..n {
        let happiness = input_vec();
        happiness_vec.push(happiness);
    }
    println!("{}", dp(0, 10, &happiness_vec, &mut cache));
}


Measured memory_bytes: 63944
#include <bits/stdc++.h>
using namespace std;
bool month(char c1, char c2){
  int MM = (c1 - '0') * 10 + c2 - '0';
  return 1 <= MM && MM <= 12;
}
int main(){
  char c1,c2,c3,c4;
  cin >> c1 >> c2 >> c3 >> c4;
  if (month(c1,c2)){
    if (month(c3,c4)){
      cout << "AMBIGUOUS";
    } else {
      cout << "MMYY";
    }
  } else {
    if (month(c3,c4)){
      cout << "YYMM";
    } else {
      cout << "NA";
    }
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll= long long;
using vi= vector<int>;
using vvi= vector<vi>;
#define REP(i,x,n) for(int i=x; i<n; i++)
#define rep(i,n) REP(i,0,n)
#define all(x) x.begin(), x.end()

int main(){
  int n,k,q;
  cin >> n >> k >> q;
  vector<int> score(n,k-q);
  vector<int> c(q);
  rep(i,q)  cin >> c[i];

  rep(i,q){
    score[c[i]-1]++;
  }
  rep(i,n){
    //cout << score[i] << endl;
    if(score[i]>0)  cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}

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

int64_t sol(int64_t a, int64_t b, int64_t n){
    int64_t i = min(n,b-1);
    return floor((double)a*i/b) - a*floor((double)i/b);
}

int main(){
    int64_t a,b,n;
    cin >> a >> b >> n;
    cout << sol(a,b,n);
    return 0;
}

Measured memory_bytes: 3544
#include<iostream>
#include<string>
using namespace std;
int main(void){
	int i,a;
	string s;
	cin>>s;
	a=0;
	for(i=0;i<4;i++){
		if(s[i]=='+'){
			a++;
		}
		else{
			a--;
		}
	}
	cout<<a<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<algorithm>
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
using namespace std;

int main(){
  int n,k,q;
  cin >> n >> k >> q;
  vector<int> a(n,k-q);
  rep(i,q){
    int b;
    cin >> b;
    b--;
    a[b]++;
  }
  rep(i,n){
    if(a[i]>0){
      puts("Yes");
    }else{
      puts("No");
    }
  }
}

Measured memory_bytes: 1024
n = int(input())
a = list(map(int,input().split()))

for i in range(n):
    a[i] = [a[i],i]

a.sort()
a.reverse()
a.append([0,-1])

b = [0]*n
c = float('inf')

for i in range(n):
    c = min(c,a[i][1])
    b[c] += (a[i][0]-a[i+1][0])*(i+1)

print('\n'.join(map(str,b)))

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

int main()
{
    int N, M, C;
    int ans = 0;
    cin >> N >> M >> C;
    vector<int> B = vector<int>(M);
    vector<int> A = vector<int>(M);

    rep(i, M) cin >> B[i];

    rep(i, N)
    {
        rep(s, M) cin >> A[s];
        int sum = 0;
        rep(j, M)
        {
            sum += A[j] * B[j];
        }
        sum += C;
        if (sum > 0)
            ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstring>
using namespace std;
int main() {
	int n,k;
	scanf("%d%d",&n,&k);
	if(n%k==0){
		cout<<"0"<<endl;
		return 0;
	} else {
		cout<<"1"<<endl;
		return 0;	
	}
	return 0;
}

Measured memory_bytes: 256
s = input()
if "E" in s and "W" in s and "N" in s and "S" in s:
  print("Yes")
elif "E" in s and "W" in s and "N" not in s and "S" not in s:
  print("Yes")
elif "E" not in s and "W" not in s and "N" in s and "S" in s:
  print("Yes")
else:
  print("No")


Measured memory_bytes: 2940
from math import factorial

def combinations_count(n, r):
    ''' 組み合わせ '''
    return factorial(n) // (factorial(n - r) * factorial(r))

def max_ave():
    N, A, B = map(int, input().split())
    v = list(map(int, input().split()))
    sort_v = sorted(v, reverse=True)

    # 平均の最大値を求める
    sum_A = 0
    for i in range(A):
        sum_A += sort_v[i]
    max_ave_v = sum_A / A

    print(max_ave_v)

    # 選び方を求める
    V = sort_v[:A]
    num = v.count(min(V))
    a = V.count(min(V))
    cnt = 0
    if max(V) == min(V):
        for i in range(A,B+1):
            if num < i:
                continue
            cnt += combinations_count(num,i)
    else:
        cnt = combinations_count(num,a)
    
    print(cnt)

max_ave()

Measured memory_bytes: 3064
#include<iostream>
#include<vector>
#define MAX int(7.5*1e6)
using namespace std;

int main(){
  int n, m;
  while(1) {
    scanf("%d %d\n", &m, &n);
    if(n == 0)break;
    bool isBoring[MAX] = {};
    for (int i = 0; i < n; i++) {
      while(isBoring[m] == true) m++;
      for (int j = m; j < MAX; j+=m) {
        isBoring[j] = true;
      }
    }
    while(isBoring[m] == true)m++;
    std::cout << m << std::endl;
  }
  return 0;
}

Measured memory_bytes: 10424