akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9+7;

ll N, M;
vector<vector<ll>> V;
vector<ll> P;
ll ans = 0;

int dfs(vector<ll> U){
    if(U.size() == N){
        bool flag = true;
        for(int i = 0; i < M; i++){
            ll cnt = 0;
            for(auto s : V[i]){
                if(U[s] == 1){
                    cnt++;
                }
            }
            if(cnt% 2 != P[i])flag = false;
            if(!flag) return 0;
        }
        ans++;
        return 0;

    }
    for(int i = 0; i < 2; i++){
        vector<ll> W = U;
        W.push_back(i);
        dfs(W);
    }
    return 0;
}


int main(){
    cin >> N >> M;
    V.resize(M);
    for(int i = 0; i < M; i++){
        ll k; cin >> k;
        for(int j = 0; j < k; j++){
            ll a; cin >> a; a--;
            V[i].push_back(a);
        }
    }
    P.resize(M); for(int i = 0; i < M; i++) cin >> P[i];
    dfs({});
    cout << ans << endl;



}


Measured memory_bytes: 256
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;
const int MOD = 998244353;

int power(long long x, int p) {
    if (p == 0)
        return 1;

    long long half = power(x, p / 2);
    half = half*half%MOD;

    if (p % 2)
        half = half * x % MOD;

    return half;
}

int main() {
    int n;
    cin >> n;
    vector<int> x(n), y(n);

    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }
    long long res = 1;
    for (int i = 0; i < n; i++) {
        res = res * 2 % MOD;
    }

    set<pair<int, int>> lr;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            int dx = x[j] - x[i], dy = y[j] - y[i];

            int left = i, right = j;

            int cnt = 2;
            for (int k = 0; k < n; k++) {
                if (k == i || k == j)
                    continue;
                int dx2 = x[k] - x[i], dy2 = y[k] - y[i];
                if (dx*dy2 == dy*dx2) {
                    left = min(left, k);
                    right = max(right, k);
                    cnt++;
                }
            }
            if (left != i || right != j)
                continue;
            res = (res + MOD - power(2, cnt) + cnt + 1) % MOD;
        }
    }
    res = (res + MOD - n - 1) % MOD;

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define llu unsigned long long

int take() {
    int n;
    scanf("%d",&n);
    return n;

}
double ttake() {
    double n;
    scanf("%lf",&n);
    return n;
}
ll takes() {
    ll n;
    scanf("%lld",&n);
    return n;

}

#define Int take()
#define Dnt ttake()
#define LL takes()
#define done {return 0;}
#define fr(n) for(int i=1;i<=n;i++)
#define FR(a,b,x) for(int i=(a);i<=(b);i+=(x))
#define rfr(n) for(int i=n;i>=1;i--)
int cas;
#define print printf("Case %d:",++cas)
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define pii pair<int,int>
#define vii vector<pii>
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define mk  make_pair
#define fill(x,v) memset(x,v,sizeof x)

using namespace std;

bool approximatelyEqual(float a, float b, float epsilon) {
    return fabs(a - b) <= ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool essentiallyEqual(float a, float b, float epsilon) {
    return fabs(a - b) <= ( (fabs(a) > fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool definitelyGreaterThan(float a, float b, float epsilon) {
    return (a - b) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}

bool definitelyLessThan(float a, float b, float epsilon) {
    return (b - a) > ( (fabs(a) < fabs(b) ? fabs(b) : fabs(a)) * epsilon);
}
#define STR {struct info}
#define debug(x) {cout<<"ekhane"<<x<<endl;}
#define  SS second
#define  FF first
#define PQ priority_queue
#define great greatest
#define less lesser
#define mii map<int,int>
#define mil map<int,ll>
#define mll map<ll,ll>
#define msb map<string,bool>
#define M 100005
//////////////////////////////////////////


int main(){
    int n=Int;
    cout<<(24+(24-n));
    
    done;
}




Measured memory_bytes: 256
import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;

double[] cross(double[] a, double[] b) {
	return [a[1]*b[2]-a[2]*b[1],a[2]*b[0]-a[0]*b[2],a[0]*b[1]-a[1]*b[0]];
}
double dot(double[] a, double[] b) {
	return a[0]*b[0]+a[1]*b[1]+a[2]*b[2];
}
double norm(double[] a) {
	return sqrt(dot(a,a));
}

double[] readv() {
	auto s = readln().strip().split();
	return [to!double(s[0]),to!double(s[1]), to!double(s[2])];
}
void main() {
	auto a = readv();
	auto b = readv();
	auto A = readv();
	auto B = readv();
	auto C = readv();
	A[] -= C[];
	B[] -= C[];
	a[] -= C[];
	b[] -= C[];
	auto n = cross(A,B);
	auto k = -dot(n,b)/(dot(n,a)-dot(n,b));
	if(k < 0 || 1 < k) {
		writeln("HIT");
	} else {
		auto c = a.dup;
		c[] *= k;
		c[] += b[]*(1-k);
		auto S1 = norm(cross(A,B));
		auto A_ = A.dup;
		auto B_ = B.dup;
		A_[] -= c[];
		B_[] -= c[];
		auto S2 = norm(cross(A,c))+norm(cross(B,c))+norm(cross(A_,B_));
		double eps = 1e-5;
		if(abs(S1-S2) < eps)
			writeln("MISS");
		else
			writeln("HIT");
	}
}

Measured memory_bytes: 1108
#include<bits/stdc++.h>
using namespace std;
int main(){
  int N,M,Q,i,j;scanf("%d%d%d",&N,&M,&Q);
  int t[N][N],L,R;
  for(i=0;i<N;i++){
    fill(t[i],t[i]+N,0);
  }
  for(i=0;i<M;i++){
    scanf("%d%d",&L,&R);L--;R--;
    t[L][R]++;
  }
  for(i=N-2;i>=0;i--){
    for(j=0;j<N;j++) t[i][j] += t[i+1][j];
  }
  for(i=0;i<N;i++){
    for(j=1;j<N;j++) t[i][j] += t[i][j-1];
  }
  int p,q;
  for(i=0;i<Q;i++){
    scanf("%d%d",&p,&q);p--;q--;
    printf("%d\n",t[p][q]);
  }
}

Measured memory_bytes: 4780
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1e9 + 7;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template<class T>
istream& operator >> (istream& is, vector<T>& v)
{
	for (auto &i : v) is >> i;
	return is;
}
template<class T>
ostream& operator<<(ostream& os, vector<T>& v)
{
	const string delimiter = "\n";
	REP(i, v.size())
	{
		os << v[i];
		if (i != v.size() - 1) os << delimiter;
	}
	return os;
}
/*--------------------template--------------------*/

int main()
{
	cin.sync_with_stdio(false); cout << fixed << setprecision(10);
	int n; cin >> n;
	string s; cin >> s;
	int ans = 0;
	REP(i, n)
	{
		string a = s.substr(0, i);
		string b = s.substr(i);
		int cnt = 0;
		REP(j, 26)
		{
			char c = 'a' + j;
			if (count(ALL(a), c) && count(ALL(b), c)) cnt++;
		}
		chmax(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n,k;
	cin>>n>>k;
	vector<vector<int>> a(100,vector<int>(100));
	for(int i=0;i<k;i++){
		int d;
		cin>>d;
		for(int j=0;j<d;j++){
			cin>>a.at(i).at(j);
		}
	}
	int cnt=n;
	for(int i=1;i<=n;i++){
		bool flag=false;
		for(int j=0;j<100;j++){
			for(int l=0;l<100;l++){
				if(i==a.at(j).at(l)&&(!flag)){
					cnt--;
					flag=true;
				}
			}
		}
	}
	cout<<cnt<<endl;
}




Measured memory_bytes: 3644
p=*0..gets.to_i;s=0;
f=->a{a>p[a]?p[a]=f[p[a]]:a};
a,b=$<.map(&:split).transpose.map{|a|i=0;a.map{|a|[a.to_i,i+=1]}.sort.each_cons(2).map{|(x,i),(y,j)|[y-x,i,j]}};
(a+b).sort_by{|a|a[0]}.each{|c,a,b|a,b=[f[a],f[b]].sort;(s+=c;p[b]=a)if a!=b};
p s

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

/*
 * F - LCS
 */
public class Main
{
static char[] s;
static char[] t;
static CharBuf[][] cache2;
static String answer;

class CharBuf
{
private char c;
private CharBuf next;
private int length = -1;
private String str;

public CharBuf(final CharBuf buf, final char c)
{
	this.c = c;
	next = buf;
}

public CharBuf()
{
	length = 0;
}

public String toString()
{
	if( length == 0 )
	{
		return "";
	}
	else
	{
		if( str == null )
		{
			final StringBuilder buf = new StringBuilder( s.length );
			buf.append( c );
			CharBuf cb = next;
			while( cb.getLength() > 0 )
			{
				buf.append( cb.c );
				cb = cb.next;
			}

			str = buf.toString();
		}
		return str;
	}
}

public int getLength()
{
	if( length == -1 )
	{
		if( next == null )
		{
			length = 1;
		}
		else
		{
			length = next.getLength() + 1;
		}
	}
	return length;
}

}

public void run() throws Exception
{
	long now = System.currentTimeMillis();
	final BufferedReader reader = new BufferedReader( new InputStreamReader( getInputStream() ) );// System.in ) );
	s = reader.readLine().toCharArray();
	t = reader.readLine().toCharArray();
	cache2 = new CharBuf[ s.length ][ t.length ];

	CharBuf finalResult = search( 0, 0 );
	answer = finalResult.toString();

	p( answer );
	if( System.getProperty( "test" ) != null )
	{
		p( answer.length() );
		p( System.currentTimeMillis() - now );
	}
}

public static void main( String[] args ) throws Exception
{
	new Main().run();
}

public static InputStream getInputStream() throws IOException
{
	//p( System.getProperties() );
	if( System.getProperty( "test" ) != null )
	{
		return new FileInputStream( "1" );
	}
	else
	{
		return System.in;
	}
}

public CharBuf search( int I, int J )
{
	if( I == s.length || J == t.length )
	{
		//p( "return null" );
		return new CharBuf();
	}

	{
		final CharBuf cached = cache2[ I ][ J ];
		if( cached != null )
		{
			//p( "return cached:" + I + " " + J );//" " + cached );
			return cached;
		}
	}

	CharBuf result = null;

	if( s[ I ] == t[ J ] )
	{
		CharBuf searchResult = search( I + 1, J + 1 );
		CharBuf tmpResult = new CharBuf( searchResult, s[ I ] );
		result = tmpResult;
	}
	else
	{
		//捨てる場合の結果を取得
		final CharBuf resultOnDrop = search( I + 1, J );

		//捨てない場合の結果を取得
		//tの最初のs[ I ]と同じ文字の位置を探す
		int index = -1;
		for( int j = J + 1; j < t.length; ++j )
		{
			if( t[ j ] == s[ I ] )
			{
				index = j;
				break;
			}
		}

		if( index != -1 )
		{
			//見つかった
			CharBuf searchResult = search( I + 1, index + 1 );
			int lengthOnUse = searchResult.getLength() + 1;
			if( resultOnDrop.getLength() >= lengthOnUse )
			{
				result = resultOnDrop;
			}
			else
			{
				final CharBuf resultOnUse = new CharBuf( searchResult, s[ I ] );
				result = resultOnUse;

				//キャッシュ
				for( int j = J; j <= index; ++j )
				{
					cache2[ I ][ j ] = result;
				}
			}
		}
		else
		{
			result = resultOnDrop;
		}

	}

	//キャッシュ
	cache2[ I ][ J ] = result;

	return result;
}

public static void p( Object o )
{
	System.out.println( o );
}

}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

template <typename T>
struct RAQ //calculateはadd(区間加算 not update)
{
    int n;
    const T ex = 0; //dat 初期値(加算なので)
    const T em = 0; //lazy 初期値(加算なので)
    vector<T> dat, lazy; //tree本体
    RAQ(vector<T> v){
        int x = 1;
        int i;
        n = v.size();
        while(x < n) x <<= 1;
        n = x; 
        dat.resize(2*n-1, ex);
        lazy.resize(2*n-1, em);
        for(i = 0;i < v.size();++i){
            dat.at(i + n - 1) = v.at(i);
        }
        for(i = n-2;i >= 0;--i){
            dat.at(i) = calculate(dat.at(2*i+1), dat.at(2*i+2));
        }
    }
    
    T calculate(T a, T b){
        return a + b;
    }
    
    void eval(int now){
        if(lazy.at(now) == em) return;
        if(now < n - 1){ //区間加算なので半分にして足していく
            lazy.at(2*now + 1) += lazy.at(now)/2;
            lazy.at(2*now + 2) += lazy.at(now)/2;
        }
        dat.at(now) += lazy.at(now);
        lazy.at(now) = em;
    }
    
    void update(int a, int b, T x, int now, int l, int r){
        eval(now);
        if(a <= l && r<= b){
            lazy.at(now) += (r - l)*x; //上から書き換える。区間加算なので全部足す
            eval(now);
        }else if(a < r && l < b){
            update(a, b, x, 2*now + 1, l, (l + r)/2);
            update(a, b, x, 2*now + 2, (l + r)/2, r);
            dat.at(now) = calculate(dat.at(2*now + 1), dat.at(2*now + 2));
        }
    }
    void update(int a, int b, T x){update(a, b, x, 0, 0, n);}
    
    T query(int a, int b){return query_sub(a, b, 0, 0, n);}
    T query_sub(int a, int b, int now, int l, int r){
        eval(now);
        if(r <= a || b <= l) return ex;
        else if(a <= l && r <= b) return dat.at(now);
        else{
            T vl = query_sub(a, b, 2*now + 1, l, (l + r)/2);
            T vr = query_sub(a, b, 2*now + 2, (l + r)/2, r);
            return calculate(vl, vr);
        }
    }
    
    inline T operator[](int a) { return query(a, a + 1); }
    void print() {
        for (int i = 0; i < 2 * n - 1; ++i) {
            cout << (*this)[i];
            if (i != n) cout << ",";
        }
        cout << endl;
    }
};


int main()
{
    ll i,j;
    ll n,q;
    cin >> n >> q;
    vector<ll> c(n);
    rep(i,n){
        cin >> c.at(i);
    }

    vector<pair<pair<ll,ll>,ll>> kueri(q);
    vector<ll> ans(q);
    rep(i,q){
        ll l,r;
        cin >> l >> r;
        --l;    --r;
        kueri.at(i).first.second = l;
        kueri.at(i).first.first = r;
        kueri.at(i).second = i;
    }

    sort(all(kueri));

    vector<ll> prev(n+1, -1);
    vector<ll> v(n, 0);
    RAQ<ll> seg(v);
    ll r = 0;
    rep(i,q){
        ll left = kueri.at(i).first.second;
        ll right = kueri.at(i).first.first;
        ll ind = kueri.at(i).second;
        for(;r <= right;++r){
            ll f = prev.at(c.at(r)) + 1;
            seg.update(f, r + 1, 1);
            prev.at(c.at(r)) = r;
        }
        ll tmp = seg.query(left, left+1);
        ans.at(ind) = tmp;
    }
    for(auto x:ans) cout << x << endl;

    return 0;
}

Measured memory_bytes: 50980
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define RFOR(i,k,n) for (int (i)=(n)-1; (i)>=(k); --(i))
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define all(v) v.begin(), v.end()
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl
using namespace std;

int main() {
  string a2z = "abcdefghijklmnopqrstuvwxyz";
  string s;
  cin >> s;
  for(const auto c : s) {
    int pos = (int) a2z.find(c);
    if(pos+1) { a2z.erase(a2z.begin() + pos); }
  }
  if(a2z[0]) { cout << a2z[0] << endl; }
  else { cout << "None" << endl; }
  return 0;
}


Measured memory_bytes: 512
from sys import stdin
def main():
    #入力
    readline=stdin.readline
    n=int(readline())
    t=[0]*n
    x=[0]*n
    y=[0]*n
    for i in range(n):
        t[i],x[i],y[i]=map(int,readline().split())

    flag=True
    for i in range(n):
        if i==0:
            if t[i]==x[i]+y[i]:
                pass
            else:
                flag=False
                break
        else:
            a=t[i]-t[i-1]
            b=abs(x[i]-x[i-1])
            c=abs(y[i]-y[i-1])
            if a>=b+c and a%2==(b+c)%2:
                pass
            else:
                flag=False
                break

    if flag:
        print("Yes")
    else:
        print("No")

if __name__=="__main__":
    main()

Measured memory_bytes: 11636
#include<bits/stdc++.h>
using namespace std;
int main(){
	vector<string> str(2);
	cin>>str[0];
	cin>>str[1];
	vector<string> rev=str;
	reverse(rev[0].begin(),rev[0].end());
	reverse(rev[1].begin(),rev[1].end());
	reverse(rev.begin(),rev.end());
	printf("%s\n",rev==str?"YES":"NO");
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
const ll INF = 2ll * 1e9 + 100;

vector<pair<ll, ll>> sequence(ll x, ll A) {
  vector<pair<ll, ll>> seq;
  if (x < A) {
    seq.emplace_back(1, x);
  } else {
    if (A > 1) {
      seq.emplace_back(1, A - 1);
    }
    seq.emplace_back(A + 1, x + 1);
  }
  return seq;
}

ll findMaximumProduct(const ll len, const ll as, const ll bs) {
  ll mx = max({as * bs, (as + (len - 1)) * (bs - (len - 1))});
  ll M = (bs - as) / 2;
  for (ll x = max(0ll, M - 10); x <= min(len - 1, M + 10); x++) {
    mx = max(mx, (as + x) * (bs - x));
  }
  return mx;
}

ll findMaximumProduct(const vector<pair<ll, ll>>& seqA,
                      const vector<pair<ll, ll>>& seqB) {
  vector<ll> indA(seqA.size() + 1, 0), indB(seqB.size() + 1, 0);
  for (int i = 1; i <= seqA.size(); i++)
    indA[i] = indA[i - 1] + (seqA[i - 1].second - seqA[i - 1].first + 1);
  for (int i = 1; i <= seqB.size(); i++)
    indB[i] = indB[i - 1] + (seqB[i - 1].first - seqB[i - 1].second + 1);
  ll mx = 0;
  for (int i = 0; i < seqA.size(); i++) {
    for (int j = 0; j < seqB.size(); j++) {
      ll s = max(indA[i], indB[j]), t = min(indA[i + 1], indB[j + 1]);
      if (s < t) {
        ll as = seqA[i].first + (s - indA[i]),
           bs = seqB[j].first - (s - indB[j]);
        mx = max(mx, findMaximumProduct(t - s, as, bs));
      }
    }
  }
  return mx;
}

int main() {
  int Q;
  while (cin >> Q) {
    for (int q = 0; q < Q; q++) {
      ll A, B;
      cin >> A >> B;
      ll C = A * B;
      ll ok = 0, ng = INF;
      while (ng - ok > 1) {
        ll x = (ok + ng) / 2;
        assert(x > 0);
        auto seqA = sequence(x, A);
        auto seqB = sequence(x, B);
        reverse(seqB.begin(), seqB.end());
        for (auto& b : seqB) {
          swap(b.first, b.second);
        }
        if (findMaximumProduct(seqA, seqB) < C) {
          ok = x;
        } else {
          ng = x;
        }
      }
      cout << ok << endl;
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <iostream>
using namespace std;
#define lson l,(l+r)/2,rt<<1
#define rson (l+r)/2+1,r,rt<<1|1
#define dbg(x) cout<<#x<<" = "<< (x)<< endl
#define pb push_back
#define fi first
#define se second
#define ll long long
#define sz(x) (int)(x).size()
const int mxn=1e5+10;
int b[mxn];
int cnt[16];
int a[20];
int sz=0;
int dp[mxn];
bool flag[mxn];
inline void check(int mask){
	int x=0;
	for(int i=0;i<sz;i++){
		if(mask &(1<<i))x^=a[i];
	}
	flag[mask]= (x==0);
}
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<n;i++){
		int u,v,w;
		scanf("%d %d %d",&u,&v,&w);
		b[u]^=w;
		b[v]^=w;
	}
	for(int i=0;i<n;i++){
		cnt[b[i]]++;
	}
	int component=cnt[0];
	for(int i=1;i<16;i++){
		component+=cnt[i]/2;
		if(cnt[i]%2)a[sz++]=i;
	}
	int up=(1<<sz)-1;
	for(int i=1;i<=up;i++){
		check(i);
		for(int x=i;x;x=((x-1)&i)){
			if(flag[i])dp[i]=max(dp[i],1+dp[x^i]);
		}
	}
	cout<<n-component-dp[up];
	return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int X;
  cin >> X;
  cout << (X >= 30 ? "Yes" : "No") << endl;
  return 0;
}


Measured memory_bytes: 3628
def array_sum(array1)
  length = array1.length
  array_sum = 0
  for i in 0..(length-1)
    array_sum += array1[i]
  end
  return array_sum
end

def column_sum(array2, index)
  length = array2.length
  column_sum = 0
  for i in 0..(length-1)
    column_sum += array2[i][index]
  end
  return column_sum
end

def row_sum(array2)
  length = array2.length
  row_sums = []
  for i in 0..(length-1)
    row_sums.push(array_sum(array2[i]))
  end
  return row_sums
end

def columns_sum(array2, max_column)
  length = array2.length
  columns_sum = []
    for i in 0..(max_column-1)
      columns_sum.push(column_sum(array2, i))
    end
    return columns_sum
end


input_values_rc = gets.chomp.split.map(&:to_i)
r = input_values_rc[0]
c = input_values_rc[1]
input_values_array = []
r.times do
  input_values = gets.chomp.split.map(&:to_i)
  input_values_array.push(input_values)
end #input_values_array???????¬???????????????¢??§?¨????

row_sums = row_sum(input_values_array)
for i in 0..(r-1)
  print input_values_array[i].join(' ')
  print " "
  print row_sums[i]
  print"\n"
end
print columns_sum(input_values_array, c).join(' ')
print " "
print array_sum(columns_sum(input_values_array, c))
print "\n"

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

int gcd(int a, int b)
{
  return b ? gcd(b, a % b) : a;
}

int main()
{
  int k;
  cin >> k;
  ll ans = 0;
  for (int i = 1; i <= k; i++)
  {
    for (int j = 1; j <= k; j++)
    {
      for (int l = 1; l <= k; l++)
      {
        ans += gcd(i, gcd(j, l));
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int main(){
    int N, K;
    cin >> N >> K;
    int h[N];
    for(int i=0;i<N;i++){
        cin >> h[i];
    }
    int count=0;
    for(int i=0;i<N;i++){
        if(h[i]>=K) count++;
    }
    cout << count << endl;

    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void) {
	int i = 1;
	while(1){
		int x;
		scanf("%d", &x);
		if(x == 0){
			break;
		}else{
			printf("Case %d: %d\n", i, x);
			i++;
		}
	}
	return 0;
}



Measured memory_bytes: 2052
X = int(input())
l = list()
i = int()
while i**5-(i-1)**5 <= 10**9:
    l.append(i**5)
    l.append(0-i**5)
    i += 1
for i in range(len(l)):
    for j in range(i, len(l)):
        if abs(l[i]-l[j])==X:
            if l[i]-l[j]==X:
                A=l[i]
                B=l[j]
            else:
                A=l[j]
                B=l[i]
            #print(A,B)
            ifAM=False
            ifBM=False
            if A<0:
                ifAM=True
            if B<0:
                ifBM=True
            A=int(abs(A)**0.2)
            B=int(abs(B)**0.2)
            if ifAM:
                A=0-A
            if ifBM:
                B=0-B
            print(A, B)
            exit()

Measured memory_bytes: 9500
#include <iostream>
#include <unordered_set>

using namespace std;

int N;
int A[3][3];
unordered_set<int> B;

int main() {

    for (int i = 0; i < 3; i++) {
        cin >> A[i][0] >> A[i][1] >> A[i][2];
    }

    cin >> N;
    for (int i = 0; i < N; i++) {
        int b;
        cin >> b;
        B.insert(b);
    }

    bool bingo = false;

    //H
    for (int i = 0; i < 3; i++) {
        bool bingo_ = true;
        for (int j = 0; j < 3; j++) {
            bingo_ &= B.find(A[i][j]) != B.end();
        }
        bingo |= bingo_;
    }

    //V
    for (int j = 0; j < 3; j++) {
        bool bingo_ = true;
        for (int i = 0; i < 3; i++) {
            bingo_ &= B.find(A[i][j]) != B.end();
        }
        bingo |= bingo_;
    }

    //D
    bool bingo_ = true;
    for (int i = 0; i < 3; i++) {
        bingo_ &= B.find(A[i][i]) != B.end();
    }
    bingo |= bingo_;

    bingo_ = true;
    for (int i = 0; i < 3; i++) {
        bingo_ &= B.find(A[i][2 - i]) != B.end();
    }
    bingo |= bingo_;

    cout << (bingo ? "Yes" : "No") << endl;
}

Measured memory_bytes: 760
import collections
N = int(input())
D = list(map(int,input().split()))
M = int(input())
T = list(map(int,input().split()))

cntD = collections.Counter(D)
cntT = collections.Counter(T)

result = 'YES'
for t in cntT.keys():
    if cntT[t] > cntD[t]:
        result = 'NO'
        break
print(result)

Measured memory_bytes: 169444
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int ans = N;
    REP(i, 0, N) {
        int A = i, B = N - i;
        int k = 6 * 6 * 6 * 6 * 6 * 6;
        int cnt = 0;
        while(A > 0) {
            while(A - k >= 0) {A -= k; cnt++;}
            k /= 6;
        }
        k = 9 * 9 * 9 * 9 * 9;
        while(B > 0) {
            while(B - k >= 0) {B -= k; cnt++;}
            k /= 9;
        }
        ans = min(ans, cnt);
        //cout << i << " " << N - i << " " << cnt << endl;
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

        for(int i=0 ; i< 5; i++)
        {
            arr[i] = k.nextInt();
            if(arr[i] == 0)
            {
                System.out.println(i+1);
            }
        }
    }
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)
#define mp make_pair

int64 modpow(int64 a, int64 r){
    if(r == 0)return 1;
    if(r % 2 == 0){
        int64 x = modpow(a, r / 2);
        return x * x % MOD;
    }else{
        return modpow(a, r - 1) * a % MOD;
    }
}

int64 comb(int64 n, int64 r){
    r = min(r, n - r);
    if(r < 0)return 0;
    int64 res = 1;
    REP(i,r){
        res *= n - i;
        res %= MOD;
        res *= modpow(i + 1, MOD-2);
        res %= MOD;
    }
    return res;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    vector<int32> count(61,0);
    REP(i,n){
        int64 a;
        cin >> a;
        int32 x = 0;
        while(a > 0){
            count[x] += a % 2;
            a /= 2;
            x++;
        }
    }
    int64 ans = 0;
    int64 base = 1;
    REP(i,61){
        // ans += comb(count[i],2) * base % MOD;
        ans += count[i] * (n - count[i]) % MOD * base % MOD;
        ans %= MOD;
        base *= 2;
        base %= MOD;
    }
    ANS(ans);
    return 0;
}

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

///////////////////////////////////////////
const long long int INF = INT64_MAX;
//const long long int INF = 1000000;
const long long int Mod = 1000000007;
using ll = long long int;
using ci = const int;
using vi = vector<int>;
using Vi = vector<long long int>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(ll i=0;i<N;i++)
auto max(auto x,auto y){if(x>y){return x;}else{return y;}}
auto min(auto x,auto y){if(x>y){return y;}else{return x;}}
template<class T>bool chmax(T &former, const T &b) { if (former<=b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<=former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
typedef vector<vector<ll> > matrix;
///////////////////////////////////////////////////////////////////////////////////
ll kai(ll a,ll n){ll ans = 1;rep(i,n)ans*=a;return ans;}
ll h,w,k;
ll dp[101][9]={0}; //dp[i][j]:=高さi,横からj番目の場合の数
void cal(){
    rep(i,h){
        rep(j,w){
            rep(bit,1<<(w-1)){
                bool key = true;
                rep(t,w-2){
                    if((bit>>t & 1)==1 && (bit>>(t+1) & 1)==1)key = false;
                }
                if(key){//左、右、下に遷移
                    if((j-1>=0)&&(bit>>(j-1) & 1)==1){
                        dp[i+1][j-1]+=dp[i][j];
                        dp[i+1][j-1]%=Mod;
                    }else if((j+1<w) && (bit>>(j) & 1)==1){
                        dp[i+1][j+1]+=dp[i][j];
                        dp[i+1][j+1]%=Mod;
                    }else{
                        dp[i+1][j]+=dp[i][j];
                        dp[i+1][j]%=Mod;
                    }
                }
            }
        }
    }
}

int main(){
    cin>>h>>w>>k;
    dp[0][0]=1;
    cal();
    cout<<dp[h][k-1]<<endl;
    return 0;
}

Measured memory_bytes: 384
use std::io::Read;
fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    let n: usize = iter.next().unwrap().parse().unwrap();
    let mut x: Vec<i32> = (0..n).map(|_| iter.next().unwrap().parse().unwrap()).collect();
    x.insert(0, 0);
    let mut ans = 0 ;
    for i in 0..x.len()-1 {
        ans += std::cmp::max(0, x[i+1]-x[i]);
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
#include <algorithm>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;

int dp[1005][1005];
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int lcs(string &x, string &y) {
    memset(dp, 0, sizeof(dp));
    int xn = x.size();
    int yn = y.size();
    rep(i, xn) {
        rep(j, yn) {
            if (x[i] == y[j])
                dp[i + 1][j + 1] = max(dp[i][j] + 1, max(dp[i][j + 1], dp[i + 1][j]));
            else
                dp[i + 1][j + 1] = max(dp[i][j], max(dp[i][j + 1], dp[i + 1][j]));
        }
    }
    return dp[xn][yn];
}

int main() {
    int n;
    cin >> n;
    rep(i, n) {
        string x, y;
        cin >> x >> y;
        int ans = lcs(x, y);
        cout << ans << endl;
    }
}



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

namespace ConsoleApp86 {
    class Program {
        static void Main(string[] args) {
            var st = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int N = st[0];
            int M = st[1];

            var P = new int[M];
            var Y = new int[M];
            var index = new int[M];

            for (int i = 0; i < M; i++) {
                var x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                P[i] = x[0];
                Y[i] = x[1];
                index[i] = i;
            }

            var cityList = new List<Tuple<int, int>>[N];

            //初期化
            for (int i = 0; i < N; i++) {
                cityList[i] = new List<Tuple<int, int>>();
            }

            //数字を格納していく
            for (int i = 0; i < M; i++) {
                cityList[P[i] - 1].Add(new Tuple<int, int>(index[i], Y[i]));
            }

            //ソート
            for (int i = 0; i < N; i++) {
                cityList[i].Sort((p, q) => p.Item2.CompareTo(q.Item2));
            }

            var ans = new int[M];
            int counter;

            //答えに数値を当てはめていく
            for (int i = 0; i < N; i++) {
                counter = 1;
                for (int j = 0; j < cityList[i].Count(); j++) {
                    ans[cityList[i][j].Item1] = counter;
                    counter++;
                }
            }

            for (int i = 0; i < M; i++) {
                Console.WriteLine(String.Format("{0:D6}", P[i]) + String.Format("{0:D6}", ans[i]));
            }
        }
    }
}

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

// macros
#define pb emplace_back
#define mk make_pair
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define irep(itr, st) for(auto itr = (st).begin(); itr != (st).end(); ++itr)
#define irrep(itr, st) for(auto itr = (st).rbegin(); itr != (st).rend(); ++itr)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define bit(n) (1LL<<(n))
// functions
template <class T>bool chmax(T &a, const T &b){if(a < b){a = b; return 1;} return 0;}
template <class T>bool chmin(T &a, const T &b){if(a > b){a = b; return 1;} return 0;}
template <typename T> istream &operator>>(istream &is, vector<T> &vec){for(auto &v: vec)is >> v; return is;}
template <typename T> ostream &operator<<(ostream &os, const vector<T>& vec){for(int i = 0; i < vec.size(); i++){ os << vec[i]; if(i + 1 != vec.size())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_set<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T> ostream &operator<<(ostream &os, const unordered_multiset<T>& st){for(auto itr = st.begin(); itr != st.end(); ++itr){ os << *itr; auto titr = itr; if(++titr != st.end())os << " ";} return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p){os << p.first << " " << p.second; return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
template <typename T1, typename T2> ostream &operator<<(ostream &os, const unordered_map<T1, T2> &mp){for(auto itr = mp.begin(); itr != mp.end(); ++itr){ os << itr->first << ":" << itr->second; auto titr = itr; if(++titr != mp.end())os << " "; } return os;}
//  types
using ll = long long int;
using P = pair<int, int>;
// constants
const int inf = 1e9;
const ll linf = 1LL << 50;
const double EPS = 1e-10;
const int mod = 1000000007;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};
// io
struct fast_io{
  fast_io(){ios_base::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(20);}
} fast_io_;


int main(int argc, char const* argv[])
{
  int a, b; cin >> a >> b;
  cout << 6 - a - b << endl;
  return 0;
}


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

def pfact(m):
	pf = {}
	for i in range(2,int(m**0.5)+1):
		while m%i == 0:
			pf[i] = pf.get(i,0) + 1
			m //= i
	if m>1 : pf[m]=1
	return pf

ansl = [f"{n}:"]
for i, j in pfact(n).items():
	for _ in range(j):
		ansl.append(str(i))
print(" ".join(ansl))


Measured memory_bytes: 5652
#include<bits/stdc++.h>
using namespace std;
string s;
int main()
{
	cin>>s;
    int l=s.length();
    if(s[0]==s[l-1])
	{
        if(l%2) puts("Second");
        else puts("First");
    }
    else 
	{
        if(l%2) puts("First");
		else puts("Second");
    }
    return 0;
}

Measured memory_bytes: 512
a,b,c = map(int,input().split())
k = int(input())
t = 0

for i in range(k+1):
    mb = b * (2 ** i)
    if a < mb:
        r = k -i
        for j in range(r + 1):
            mc = c * (2 ** j)
            if mb < mc:
                print('Yes')
                t = 1
                break
        break

if t == 0:
    print('No')

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

int main(){
    int A,B,M;
    cin >> A >> B >> M;
    int a[A],b[B];
    rep(i,A) cin >> a[i];
    rep(i,B) cin >> b[i];
    int x[M],y[M],c[M];
    rep(i,M) cin >> x[i] >> y[i] >> c[i];
    int amin=1000000;
    int bmin=1000000;
    rep(i,A){
        amin=min(amin,a[i]);
    }
    rep(i,B){
        bmin=min(bmin,b[i]);
    }
    int ans=amin+bmin;

    rep(i,M){
        ans=min(ans,a[x[i]-1]+b[y[i]-1]-c[i]);
    }
    cout << ans << endl;


}

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

#define endl "\n"
#define all(x) x.begin(),x.end()
#define pb push_back
#define ff first 
#define ss second 
#define pii pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vii vector<pii>
#define vvi vector<vi>
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int N=100*1000;
const int mod=1e9+7;

int min3(int a,int b,int c){return min(a,min(b,c));}
int max3(int a,int b,int c){return max(a,max(b,c));}
int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

//#define int int64_t
//int a[N+2];

int32_t  main(){
  IOS;
  int n;cin>>n;
  int c1=0,c2=0,c3=0;
  int poki=0;
  int ans=0;
  fori(i,n){
    string s;cin>>s;
    for(int j=0;j+1<s.size();++j){
      if(s[j]=='A' && s[j+1]=='B')poki++;
    }
    if(s[0]=='B' && s.back()=='A'){c3++;continue;}
    if(s[0]=='B')c2++;
    if(s.back()=='A')c1++;
  }
 // cout<<c3<<" c3\n";
  if(c3>0){
    ans+=(c3-1);
    c3=1;
  }
  if(c1>0 && c2>0 && c3>0){
    ans+=2;
    c3=0;
    c1--;
    c2--;
  }
  int c=min(c1,c2);
  ans+=c;
  c1-=c,c2-=c;
  if(c1>0 && c3>0){
    ans+=1;
    c1--;
    c3--;
  }else if(c2>0 && c3>0){
    ans+=1;
    c3--;
    c2--;
  }
//  cout<<poki<<" poki\n";
  cout<<ans+poki<<endl;
  return 0;
}



Measured memory_bytes: 256
N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
plus=0
minus=0
gomi=0
for i in range(N):
  if(a[i]-b[i]<0):
    minus+=((b[i]-a[i])//2)*2
  else:
    plus+=a[i]-b[i]
if(minus>=plus*2):
  print("Yes")
else:
  print("No")

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


int main()
{
  int n, k;
  cin >> n >> k;
  int ans = 0;
  rep(i, n)
  {
    int h;
    cin >> h;
    if (h >= k)
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
ll fact[100001];
void factorial(ll n){
	fact[0]=1;
    for(ll i=1;i<=n;i++){
    	fact[i]=fact[i-1]*i;
    	fact[i]%=mod;
	}
}

int main(){

ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n,m,i,j;
    cin>>n;
    int h[n+1];
    for(i=1;i<n+1;i++)
    cin>>h[i];
    ll dp[n+1]={0};
    dp[1]=0;
    dp[2]=abs(h[1]-h[2]);
    for(i=3;i<=n;i++)
    {
    	dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
	}
	cout<<dp[n];

}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
 
using namespace std;
//using namespace __gnu_pbds;
//typedef tree< pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update>
//ordered_set;
int dx[] = {0, 1, 0, -1};
int dy[] = {-1, 0, 1, 0};
#define X first
#define Y second
#define int long long int 
const int N = (int)1e6 + 10;
const int MOD = (int) 1e9 + 7;


void solve(){
    string s; cin >> s;
    for(auto &x: s){
        if(x == '7'){
            cout << "Yes\n";
            return;
        }
    }
    cout << "No\n";
    return;
}

int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr); 
    //int t; cin >> t;
    //while(t--)
        solve();
    return 0;
}
/*
Sample inp
*/

Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        boolean debug = false;
        if (debug = false) {
            return;
        }
        System.out.println(str);
    }

    //木構造
    public static void main(String[] args) {

        int N;
        int D;
        int[][] xList;
        try (Scanner sc = new Scanner(System.in)) {
            N = sc.nextInt();
            D = sc.nextInt();
            xList = new int[N][D];
            for(int i = 0;i < N; i++){
                for(int j = 0;j < D; j++){
                    xList[i][j] = sc.nextInt();
                }
            }
        }
        int result = 0;
        for(int i = 0;i < N; i++){
            for(int j = i;j < N; j++){
                if(i == j){
                    continue;
                }
                if(check(xList[i] , xList[j]))
                    result++;
            }
        }

        System.out.println(result);
    }

    private static  boolean check(int i[] , int j[]){
        int length = i.length;
        int dis = 0;
        for(int d = 0; d < length;d++){
            int temp = j[d]- i[d];
            dis += temp * temp;
        }
        double t = Math.sqrt(dis);
        int ii = (int) (t / 1);
        return (double)ii == t;
    }

}


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

int max_k,len;

int main()
{
	string s;
	cin>>s;
	max_k=len=s.size();
	for (int i=1;i<=s.size()-1;i++)
	{
		if (s[i]!=s[i-1])  max_k=min(max_k,max(i,len-i));
	}
	cout<<max_k<<endl;
	return 0;
}

Measured memory_bytes: 512
//Kyokai no Kanata //
#include<bits/stdc++.h>

using namespace std;

typedef pair<int,int> II;
typedef vector<II> VII;
typedef vector<int> VI;
typedef vector< VI > VVI;
typedef long long int LL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))

#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names,Arg1&& arg1,Args&&... args){
  const char* comma=strchr(names+1,',');
  cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1,args...);
}
#else
#define trace(...)
#endif
float  inf=std::numeric_limits<double>::infinity();
LL INF=std::numeric_limits<LL>::max();
//FILE *fin = freopen("in","r",stdin);
//FILE *fout = freopen("out","w",stdout);
int main(){
  int n; cin >>n;
  int prevt=0,t,x,y,prevx=0,prevy=0;
  while(n--){
    cin>>t>>x>>y;
    int delt = (t-prevt)-(abs(prevx-x) + abs(prevy-y));
    if(delt<0 || delt&1 ) return 0*puts("No");
    prevt=t,prevx=x,prevy=y;
  }
  return 0*puts("Yes");
}

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

bool c1[20005],c2[20005],dp[10005][20005];
int a[10005];

int main(){
	int x,y,i,j,k=0,l=0;
	string t;
	
	cin>>t;
	cin>>x>>y;
	
	for(i=0;i<t.size();i++){
		if(t[i]=='F'){
			a[k]++;
			l++;
		}
		else{
			k++;
		}
	}
	
	x=x-a[0];
	
	dp[0][8000]=true;
	dp[1][8000]=true;
	
	for(i=2;i<=k+1;i+=2){
		for(j=0;j<=16000;j++){
			if(j-a[i-1]>=0){
				dp[i][j]=dp[i][j] || dp[i-2][j-a[i-1]];
			}
			if(j+a[i-1]<=16000){
				dp[i][j]=dp[i][j] || dp[i-2][j+a[i-1]];
			}
		}
	}
	
	for(i=3;i<=k+1;i+=2){
		for(j=0;j<=16000;j++){
			if(j-a[i-1]>=0){
				dp[i][j]=dp[i][j] || dp[i-2][j-a[i-1]];
			}
			if(j+a[i-1]<=16000){
				dp[i][j]=dp[i][j] || dp[i-2][j+a[i-1]];
			}
		}
	}
	
	if(k%2==1){
		if(dp[k+1][8000+y] && dp[k][8000+x])cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	else{
		if(dp[k][8000+y] && dp[k+1][8000+x])cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 155776
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

int main(){
    int d, e;
    cin >> d >> e;
    while(d > 0){
        double ans = 1000000000;
        for(int x=0; x<=d; x++){
            int y = d-x;
            ans = min(ans, abs(sqrt(x*x+y*y)-e));
        }
        cout << fixed << setprecision(20) << ans << endl;
        cin >> d >> e;
    }
}


Measured memory_bytes: 3220
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>
#include<unordered_map>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    while(1){
        int n, m, ans = 0;
        cin >> n >> m;
        if(n == 0 && m == 0){
            break;
        }
        vector<int> h(n + 1), w(m + 1);
        for(int i = 1; i <= n; i++){
            cin >> h[i];
        }
        for(int i = 1; i <= m; i++){
            cin >> w[i];
        }
        partial_sum(begin(h), end(h), begin(h));
        partial_sum(begin(w), end(w), begin(w));
        unordered_map<int, int> mp;
        for(int i = 1; i <= n; i++){
            for(int j = 0; j < i; j++){
                mp[h[j] - h[i]]++;
            }
        }
        for(int i = 1; i <= m; i++){
            for(int j = 0; j < i; j++){
                ans += mp[w[j] - w[i]];
            }
        }
        cout << ans << endl;
    }
        return 0;
}



Measured memory_bytes: 18704
# AOJ 1609: Look for the Winner!
# Python3 2018.7.13 bal4u

A = ord('A')
while True:
	n = int(input())
	if n == 0: break
	c = list(input().split())
	c = [ord(i)-A for i in c]
	f = [0]*26
	max1 = max2 = 0
	x1 = x2 = -1
	k, i = n, 0;
	while i < n:
		x = c[i]
		i, k = i+1, k-1
		f[x] += 1;
		if f[x] > max1:
			if x1 < 0 or x == x1: max1 = f[x]; x1 = x
			else: max2 = max1; x2 = x1; max1 = f[x]; x1 = x
		elif f[x] > max2: max2 = f[x]; x2 = x
		if max2+k < max1: break
	if max1 == max2: print("TIE")
	else: print(chr(x1+A), i)



Measured memory_bytes: 5624
#include<stdio.h>

int main()
{
int x,t1,t2,t3;
t1=0;t2=0;t3=0;
for(int i=0;i<10;i++){
scanf("%d",&x);
if(x>t1){t3=t2;t2=t1;t1=x;}
else if(x>t2){t3=t2;t2=x;}
else if(x>t3)t3=x;
}
printf("%d\n%d\n%d\n",t1,t2,t3);

return 0;
}

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


int main()
{
	long long K;
	char s[102];
	cin >> s >> K;
	int n=0;
	while (s[n] == '1')n++;
	if (K <= n) {
		cout << '1';
	}
	else {
cout << s[n];
	}
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

typedef pair<int, int> ii;
typedef pair<ll, ll> pll;

int main( int argc, char *argv[] ) {
	int n, a, t, tbest, ibest, x;
	cin >> n >> t >> a;
	t *= 1000;
	a *= 1000;
	tbest = 1e8;
	for ( int i = 0 ; i < n ; i++ ){
		cin >> x;
		if ( abs(t-6*x-a) < tbest ){
			tbest = abs(t-6*x-a);
			ibest = i + 1;
		}
	}
	cout << ibest << "\n";

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
 
int main(){
	char S[4];
	int ans=0;
	for(int i=0;i<4;i++){
		cin>>S[i];
		if(S[i]=='+')
			ans=ans+1;
		else
			ans=ans-1;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256