akhauriyash/Code-Regression huggingface dataset:
n, d = map(int, input().split())
xl = list(list(map(int, input().split())) for _ in range(n))

cnt = 0
for i in range(n-1):
    for j in range(i+1, n):
        _d = 0
        for k in range(d):
            _d += (xl[i][k] - xl[j][k]) ** 2
        ans = _d ** 0.5
        if int(ans) == ans:
            cnt += 1

print(cnt)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)n;i++)
using Graph = vector<vector<int> >;
using GraphC = vector<vector<char> >;
const int INF = 1000000000;
typedef pair<int, int> P;
const int MAX_N = 1000000000;
typedef int64_t ll;
template<class T> inline bool chmax(T & a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T & a, T b) { if (a > b) { a = b; return 1; } return 0; }

GraphC A(100, vector<char>(100));

int main() {
	int H, W;
	cin >> H >> W;
	rep(i, H) {
		rep(j, W) {
			cin >> A.at(i).at(j);
		}
	}
	rep(i, H) {
		rep(j, W) {
			cout << A.at(i).at(j);
		}
		cout << endl;
		rep(j, W) {
			cout << A.at(i).at(j);
		}
		cout << endl;
	}
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int lli;
const lli inf = 1e18;
const lli mod = 1e9 +7;
typedef pair<lli, lli> pll;

int main(){
    char c;
    cin >> c;
    cout << (char)(c+1) << endl;
    return 0;
}

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

//int const N = 1;
int const MOD = 1e9 + 7;

ll bigmod(ll a, ll b)
{
    if(b==0)
        return 1 % MOD;
    ll x = bigmod(a,b/2);
    x = (x * x) % MOD;
    if(b%2)
        x = (x * a) % MOD;
    return x;
}

int const N = 1e5 + 10;

ll n,w;// h[N];
ll dp[110][N] ;
ll ara[N][5] ;

ll wei[110] , val[110] ;


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

    cin >> n >> w;

    for(int i = 1; i <= n; i++)
        cin >> wei[i] >> val[i] ;


    for(int i = 1; i <= n; i++)
    {
        for(int ww = 0; ww <= w; ww++)
        {
            dp[i][ww] = dp[i-1][ww];
            if(ww >= wei[i])
            {
                dp[i][ww] = max(dp[i][ww],
                               val[i] + dp[i-1][ww-wei[i]]);
            }
        }
    }
    cout << *max_element(dp[n],dp[n] + w + 1);
    return 0;
}




Measured memory_bytes: 80128
#include "bits/stdc++.h"
#include<unordered_map>
#pragma warning(disable:4996)
using namespace std;

const int My_Inf=2147483647;
const long long int My_LInf=9223372036854775807;

int main() {
	int N; cin >> N;
	while (N--) {
		vector<int>rs;
		while (1) {
			int a; cin >> a;
			if (!a)break;
			rs.push_back(a);
		}
		vector<vector<int>>edges(1000);
		vector<int>edgenum(1000);
		vector<int>root;
		int nowroom = -1;
		int nextroom = 0;
		for (int i = 0; i < rs.size(); ++i) {
			if (rs[i] > 0) {
				if (i) {
					edges[nowroom].push_back(nextroom);
					edges[nextroom].push_back(nowroom);
				}
				nowroom = nextroom;
				nextroom = nextroom + 1;
				root.push_back(nowroom);
				edgenum[nowroom] = rs[i];
				int checkroom = nowroom;
				while (1) {
					if (edges[checkroom].size() < edgenum[checkroom]) {
						nowroom = checkroom;
						break;
					}
					else {
						root.pop_back();
						if (root.empty()) {
							break;
						}
						checkroom = root.back();
					}
				}
			}
			else {
				edges[nowroom].push_back(*(root.end() + rs[i]-1));
				edges[*(root.end() + rs[i] - 1)].push_back(nowroom);
				int checkroom = nowroom;
				while (1) {
					if (edges[checkroom].size() < edgenum[checkroom]) {
						nowroom = checkroom;
						break;
					}
					else {
						root.pop_back();
						if (root.empty()) {
							break;
						}
						checkroom = root.back();
					}
				}
			}
		}
		int id = 0;
		while (edges[id].size()) {
			sort(edges[id].begin(), edges[id].end());
			cout << id + 1;
			for (int i = 0; i < edges[id].size(); ++i) {
				cout <<" "<< edges[id][i]+1;
			}
			cout << endl;
			id++;
		}
		
	}
	return 0;
}

Measured memory_bytes: 3084
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define ll long long
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repeat(i,s,n) for(int (i)=s; (i)<(n); (i)++)
#define revrep(i,n) for(int (i)=(n)-1;i>=0; i--)

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<setprecision(std::numeric_limits<float>::max_digits10);
  int n;
  int m;
  cin>>n>>m;
  vector<vector<int>> g(n);
  vector<int> deg(n);
  rep(i,m) {
    int x,y;
    cin>>x>>y;
    g[x-1].push_back(y-1);
    deg[y-1]++;
  }
  queue<int> q;
  const int inf = 1e6;
  vector<int> dp(n,-inf);
  rep(i,n) {
    if(deg[i]==0) {
      q.push(i);
      dp[i]=0;
    }
  }
  while(!q.empty()) {
    int x = q.front();
    q.pop();
    for(auto&y : g[x]) {
      dp[y]=max(dp[x]+1,dp[y]);
      deg[y]--;
      if(deg[y]==0) {
        q.push(y);
      }
    }
  }
  int ans=0;
  rep(i,n) {
    ans=max(ans,dp[i]);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 6528
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;

int main(){
  string str;
  cin >> str;
  REP(i, str.size()) printf("x");
  printf("\n");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
//const int mod = ;

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  int n;
  cin >> n;
  vi a(n), b(n), c(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i) cin >> b[i];
  for (int i = 0; i < n; ++i) cin >> c[i];
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  sort(c.begin(), c.end());
  ll res = 0;
  for (int i = 0; i < n; ++i) {
    int ita = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
    int itc = upper_bound(c.begin(), c.end(), b[i]) - c.begin();
    res += (ll)(ita) * (n - itc);
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 1408
a, b, c, d = map(int, input().split())
list=[]

for i in range(101):
  list.append(0)
for i in range(a,b+1):
  list[i]=1
for i in range(c,d+1):
  list[i]+=1

ans = 0
for i in range(101):
  if list[i] == 2:
    ans +=1

if ans ==0:
  print(ans)
else:
  print(ans-1)
  

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
#define pb push_back

typedef long long ll;
typedef pair<int,int> pi;
const int MAXN = (int)2e5+7;
const ll MOD = (ll)998244353;

template<typename T,size_t size>
struct BIT {
    T a[size]; int n;
    void init(int _n){n=_n;memset(a,0,sizeof(T)*(_n+1));}
    void erase(int x) {     for(int i=x;i<=n;i+=i&-i)a[i]=0; }
    void update(int x,T y){ for(int i=x;i<=n;i+=i&-i)a[i]+=y;}
    T query(int x){T re=0;  for(int i=x;i;i-=i&-i)re+=a[i];return re;}
};
BIT<int,MAXN>bit;//你数组所开最大的值

pi a[MAXN];
vector<int> vp;
int getID(int x) {return lower_bound(vp.begin(),vp.end(),x)-vp.begin()+1; }

int lu[MAXN];
int ld[MAXN];
int ru[MAXN];
int rd[MAXN];

ll fp[MAXN];

int main()
{
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    fp[0] = 1;
    rep(i,1,MAXN-1) fp[i] = fp[i-1]*2%MOD;
    rep(i,0,MAXN-1) fp[i] = fp[i]-1;

    int N;
    cin >> N;
    rep(i,1,N) {
        cin >> a[i].first >> a[i].second;
        vp.pb(a[i].second);
    }
    sort(vp.begin(),vp.end());
    rep(i,1,N) a[i].second = getID(a[i].second);

    sort(a+1,a+1+N);
    bit.init(N+1);
    rep(i,1,N) {
        int id = a[i].second;
        lu[i] = bit.query(N) - bit.query(id);
        ld[i] = bit.query(id);
        bit.update(id,1);
    }

    bit.init(N+1);
    for(int i = N;i >= 1;i --) {
        int id = a[i].second;
        ru[i] = bit.query(N) - bit.query(id);
        rd[i] = bit.query(id);
        bit.update(id,1);
    }

    ll ans = N*(fp[N-1]+1)%MOD;
    //debug(ans);
    rep(i,1,N) {
        int luu = lu[i];
        int ldd = ld[i];
        int ruu = ru[i];
        int rdd = rd[i];
        ll fist = fp[ldd]*fp[ruu]%MOD;
        ll seco = fp[ldd]*fp[ruu]%MOD*fp[luu]%MOD;
        ll thir = fp[ldd]*fp[ruu]%MOD*fp[rdd]%MOD;
        ll four = fp[ldd]*fp[ruu]%MOD*fp[rdd]%MOD*fp[luu];
        ll five = fp[luu]*fp[rdd]%MOD;
        ll six  = fp[luu]*fp[rdd]%MOD*fp[ruu]%MOD;
        ll seven = fp[luu]*fp[rdd]%MOD*fp[ldd]%MOD;
        ans += fist+seco+thir+four+five+six+seven;
//        debug(luu);
//        debug(ldd);
//        debug(ruu);
//        debug(rdd);
//        debug("*******");
        ans %= MOD;
    }
    cout << ans << endl;
}


Measured memory_bytes: 8308
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>
#include <fstream>

using namespace std;
using ll = long long;

#define REP(i,a) for(int i = 0;i < (a);++i)
#define FOR(i,a,b) for(int i = (a);i < (b); ++i)
#define FORR(i,a,b) for(int i = (a) - 1;i >=(b);--i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond,yes,no){cout <<((cond)?(yes):(no))<<endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(),(list).rend())
#define ASSERT(cond,mes) assert(cond && mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template<typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())is >> v[i];
    return is;
}

template <typename T>
ostream& operator<<(ostream& os, vector<T>& v) {
    REP(i, (int)v.size())os << v[i] << endl;
    return os;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)n = a;
    if (n > b)n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i*i <= n; ++i) {
        if (n%i == 0) {
            ret.push_back(i);
            if (i != 1 && i*i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

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

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

struct ToUpper {
    char operator()(char c) { return toupper(c); }
};

struct ToLower {
    char operator()(char c) { return tolower(c); }
};

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

    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    cin >> A;

    ll ans = 0;
    REP(i, N) {
        REP(j, N) {
            if (A[i] > A[j]) {
                if (i < j) {
                    ans += (ll)(K + 1) * K / 2;
                    ans %= MOD;
                }
                else {
                    ans += (ll)(K) * (K - 1) / 2;
                    ans %= MOD;
                }
            }
        }
    }

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
long long int a,b,k;
cin>>a>>b>>k;
  if(a<k)
  {
    if(k-a>b)
      b=0;
    else 
      b=b-(k-a);
     
    a=0;
  }
  else 
    a=a-k;
  
  cout<<a<<" "<<b;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main () {
  char day[4];
  int i;

  scanf("%s", day);

if(strcmp(day, "MON") == 0){
  printf("6\n");
  }
else if(strcmp(day, "TUE") == 0){
  printf("5\n");
}
else if(strcmp(day, "WED") == 0){
  printf("4\n");
}
else if(strcmp(day, "THU") == 0){
  printf("3\n");
}
else if(strcmp(day, "FRI") ==0){
  printf("2\n");
}
else if(strcmp(day, "SAT") ==0){
  printf("1\n");
}
else{
  printf("7\n");
}

  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) (a).begin(),(a).end()
#define print(A,x,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i]x;}cout<<endl;
#define pprint(A,y,m,n) rep(j,0,m){print(A[j],y,n);}
const long mod=1e9+7;
const int size=1e6;
const long inf=1e15;
int main(){
	int N,M;cin>>N>>M;
	long x[N][3];
	rep(i,0,N) cin>>x[i][0]>>x[i][1]>>x[i][2];
	long dp[N+1][M+1][8]={};
	rep(i,1,N+1)rep(j,1,M+1)rep(k,0,8) dp[i][j][k]=-inf;
	rep(i,1,N+1)rep(j,1,min(i,M)+1){
		rep(k,0,8){
			long t=0;
			rep(l,0,3){
				if(k&(1<<l)) t+=x[i-1][l];
				else t-=x[i-1][l];
			}
            if(i==j) dp[i][j][k] = dp[i-1][j-1][k] + t;
			else dp[i][j][k] = max(dp[i-1][j][k] , dp[i-1][j-1][k] + t);
		}
	}
	long ans=0;
	rep(i,0,8){
		ans=max(ans,dp[N][M][i]);
	}cout<<ans<<endl;
}

Measured memory_bytes: 62848
n = int(input())
l = sorted(map(int, input().split()))
ret = 0
for i in range(n):
    k = i + 2
    for j in range(i + 1, n):
        while k < n and l[i] + l[j] > l[k]:
            k += 1
        ret += k - j - 1
print(ret)


Measured memory_bytes: 3316
#include <stdio.h>
#include <stdlib.h>

int main(void){
	int d, x, sum;
	while(scanf("%d",&d) != EOF){
		sum = 0;
		for(x = 0;x <= 600 - d;x += d)
			sum += d * x * x;
		printf("%d\n",sum);
	}
	return 0;
}

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

int main(){
	int n;
	while (std::cin >> n && n){
		std::vector<int> score;
		for (int i = 0; i < n; ++i){
			int s;
			std::cin >> s;
			score.push_back(s);
		}
		std::sort(score.begin(), score.end());
		score.pop_back();
		score.erase(score.begin());
		int ans = 0;
		int cnt = 0;
		for (auto it = score.begin(); it != score.end(); ++it){
			ans += *it;
			cnt++;
		}
		std::cout << ans/cnt << std::endl;
	}
	return 0;
}

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

int main() {
    int N;
    int t[110000], x[110000], y[110000];
    cin >> N;
    t[0] = x[0] = y[0] = 0;  // 初期状態                                                                                                                                                                    
    for (int i = 0; i < N; ++i) cin >> t[i+1] >> x[i+1] >> y[i+1];  // 1-index にしておく                                                                                                                   
    bool can = true;
    for (int i = 0; i < N; ++i) {
        int dt = t[i+1] - t[i];
        int dist = abs(x[i+1] - x[i]) + abs(y[i+1] - y[i]);
        if (dt < dist) can = false;
        if (dist % 2 != dt % 2) can = false;  // dist と dt の偶奇は一致する必要あり！                                                                                                                      
    }

    if (can) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s;
    int h[92] = {};
    getline(cin,s);
    for(int i = 0;i<4;i++)
        h[(int)s[i]]++;
    if(h[(int)s[0]] == 2&&h[(int)s[1]] == 2&&h[(int)s[2]] == 2)
        cout<<"Yes";
    else
        cout<<"No";
    return 0;
}

Measured memory_bytes: 256
S = str(input())

count =  0
AP_streak = 0
P_pos = []
P_count = 0

S=S.replace('BC', 'P')

N = len(S)

for i in range (0, N):
	V = S[i]
	if V != 'P' and V!= 'A':
		count+=sum(P_pos)-(P_count*(P_count+1))//2
		AP_streak = 0
		P_pos = []
		P_count = 0
	if V == 'A':
		AP_streak+=1
	if V == 'P':
		if AP_streak > 0:
			AP_streak+=1
			P_count+=1
			P_pos.append(AP_streak)

count+=sum(P_pos)-(P_count*(P_count+1))//2

print(count)

Measured memory_bytes: 11728
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;
typedef long double ld;
#define MOD 1000000007
#define INF 1000000000
#define mp make_pair
#define pb push_back
#define ss second
#define ff first
#define endl '\n'
#define pl cout<<endl;
void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); }
const long long INFll=1ll*INF*INF;
const long double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define debug(x) cout << x << endl;
#define sz(a) int((a).size())
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
    //unordered_map<long long, int, custom_hash>
    //gp_hash_table<long long, int, custom_hash>
};
long long genrand(long long L,long long R)
{
	return uniform_int_distribution<long long>(L, R)(rng);
}
int mul(int a, int b,int mod = MOD) {
	return int(a * 1ll * b % mod);
}
int norm(int a,int mod = MOD) {
	while(a >= mod) a -= mod;
	while(a < 0) a += mod;
	return a;
}
int powmod(int x,int y,int mod = MOD){
	int res = 1;
	while(y>0)
	{
		if(y&1)
			res = mul(res,x,mod);
		x = mul(x,x,mod);
		y=y>>1;
	}
	return res;
}
int inv(int a,int mod = MOD) {
	return powmod(a, mod - 2);
}
int main() {
	
	long double r; cin>>r;
	long double ans = r * 2 * acos(-1);
	cout<<fixed<<setprecision(20)<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 3784
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N;
	int dp[10][10] = { 0 };


	cin >> N;

	int cnt = 0;
	eFOR(i, 1, N) {
		int a = i;

		int y = a % 10;
		while (a >= 10)a /= 10;
		int x = a;
		if (x == 0 || y == 0)continue;
		dp[x][y]++;
		if (x == y)cnt++;
	}
	int ans = 0;
	eFOR(i, 1, N) {
		int a = i;

		int y = a % 10;
		while (a >= 10)a /= 10;
		int x = a;
		if (x == 0 || y == 0)continue;

		ans += dp[y][x];
	}
	/*int ans = 0;
	REP(i, 10) {
		REP(j, 10) {
			cout << i << " " << j << " "<<dp[i][j] << endl;
			ans += dp[i][j];
		}
	}
	cout << ans << endl;
	*/
	cout << ans << endl;
	return 0;
}



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

int solve(int n) {
    vector<int> dp = {1, 1, 2};
    for(int i = 3; i <= n; i++) {
        dp.push_back(dp[i - 3] + dp[i - 2] + dp[i - 1]);
    }
    int day = (dp[n] + 9) / 10;
    return (day + 364) / 365;
}

int main() {
    vector<int> n;
    int tmp = 100000;
    while(true) {
        cin >> tmp;
        if(tmp == 0) break;
        n.push_back(tmp);
    }
    REP(i, n.size()) cout << solve(n[i]) << endl;
}



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


int main(){
  int a[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  int k;
  cin >> k;
  cout << a[k-1] << endl;
  return 0;
}


Measured memory_bytes: 256
import sys
def main():
    input = sys.stdin.readline
    class UnionFindTree:
        def __init__(self, n):
            self.parent = [-1] * n

        def find(self, x):
            p = self.parent
            while p[x] >= 0: x, p[x] = p[x], p[p[x]]
            return x

        def union(self, x, y):
            x, y, p = self.find(x), self.find(y), self.parent
            if x == y: return
            if p[x] > p[y]: x, y = y, x
            p[x], p[y] = p[x] + p[y], x

        def same(self, x, y): return self.find(x) == self.find(y)
        def size(self, x): return -self.parent[self.find(x)]

    N, M, K=map(int, input().split())
    friend_or_block = [0] * N
    friends_chain = UnionFindTree(N)

    for _ in range(M):
        a, b = map(int, input().split())
        a, b = a-1, b-1
        friends_chain.union(a, b)
        friend_or_block[a] += 1
        friend_or_block[b] += 1

    for _ in range(K):
        c, d = map(int, input().split())
        c, d = c-1, d-1
        if friends_chain.same(c, d):
            friend_or_block[c] += 1
            friend_or_block[d] += 1

    print(*[friends_chain.size(i) - friend_or_block[i] - 1 for i in range(N)])

if __name__ == '__main__':
    main()



Measured memory_bytes: 60764
# -*- coding: utf-8 -*-
_ = input()
a = list(map(int, input().split()))
rank_set={x//400 for x in a if x < 3200}
cnt_over3200=len(list(filter(lambda x: x>=3200, a)))
ans=len(rank_set)
if ans == 0:
    print('{} {}'.format(1, cnt_over3200))
else:
    print('{} {}'.format(ans, ans+cnt_over3200))


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

int main(){
  int a, b, c, d, t_turn, a_turn;
  cin >> a >> b >> c >> d;
  

  t_turn = c / b;
  if (c % b != 0) {
    t_turn++;
  }
    
  a_turn = a / d;
  if (a % d != 0){
    a_turn++;
  }

  if (t_turn <= a_turn){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 3472
#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <queue>

using namespace std;                

#define INT_MX 0x7fffffff

typedef long long lld;
typedef long double llf;
typedef pair<int, int> pii;

int main(void) {
    
    int arr[5];
    int k;
    
    for(int i=0;i<5;i++){
        cin>>arr[i];
    }
    cin>>k;
    
    for(int i=0;i<4;i++){
        for(int j=i+1;j<5;j++){
            
            if((arr[j]-arr[i])>k){
                printf(":(");
                return 0;
            }
            
        }
    }
    printf("Yay!");
    
    return 0;
}







































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

using namespace std;
typedef long long ll;
#define int ll

template<typename T1,typename T2> inline void chmin(T1 &a, T2 b){ if(a > b) a = b; }
template<typename T1,typename T2> inline void chmax(T1 &a, T2 b){ if(a < b) a = b; }

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
const int MAX_N = 100010;

int N, K;
vector<int> A;

int S;  // 閉路の始点
vector<bool> isVisited; // 滞在済み？
int s_d;      // 閉路までの距離
int loop_d;   // 閉路の距離

void dfs1(int i) {
    if(isVisited[i]) {
        S = i;
        return;
    }
    isVisited[i] = true;
    dfs1(A[i]);
}

void dfs2(int i) {
    if(i == S) { return; }
    s_d++;
    dfs2(A[i]);
}

void dfs3(int i) {
    if(i == S) { return; }
    loop_d++;
    dfs3(A[i]);
}

int a_d;

void dfs4(int i) {
    if(a_d <= 0) {
        printf("%lld\n", i + 1);
        return;
    }
    a_d--;
    dfs4(A[i]);
}

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

    cin >> N >> K;
    A.resize(N);
    REP(i, N) {
        cin >> A[i];
        A[i]--;
    }

    isVisited.assign(N, false);
    dfs1(0);
    s_d = 0;
    dfs2(0);
    loop_d = 1;
    dfs3(A[S]);
    if(A[S] == S) { loop_d = 0; }

    if(s_d >= K) {
        a_d = K;
        dfs4(0);
    }
    else {
        if(loop_d == 0) {
            printf("%lld\n", S + 1);
            return 0;
        }
        a_d = (K - s_d) % loop_d;
        dfs4(S);
    }

    return 0;
}


Measured memory_bytes: 4780
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define INF 1 << 30

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

int main(void) {
	int num, i, a, m = INF, ans = 0;
	cin >> num;
	rep(i, num) {
		cin >> a;
		chmin(m, a);
		if (a == m)
			ans++;
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
	
#define ll long long int
#define pb push_back
#define rep(i , j , n) for(ll i = j ; i < n ; i++)
#define per(i , j , n) for(ll i = j ; i >= n ; i--)
 


int main(){
	set<string> s;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        string x;
        cin >> x;
        s.insert(x);
    }
    cout << s.size();
}


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


def main():
    s = int(input())
    a = list()
    a.append(s)
    i = 0

    while True:
        if a[i] % 2 == 0:
            tmp = a[i] // 2
        else:
            tmp = 3 * a[i] + 1

        i += 1

        if tmp in a:
            print(i + 1)
            exit()

        a.append(tmp)


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N, M;
    cin >> N >> M;
    VEC(VEC(int)) edges(N);
    FOR(i, 0, M) {
        int u, v;
        cin >> u >> v;
        u--; v--;
        edges[u].push_back(v);
    }

    VEC(VEC(int)) Dist(N, VEC(int)(3, -1));
    int S, T;
    cin >> S >> T;
    S--; T--;

    queue<Pii> bfsQ;
    auto add = [&Dist, &bfsQ, &edges](int node, int turn, int newdist)
    {
        if (Dist[node][turn] >= 0)
            return;

        Dist[node][turn] = newdist;
        bfsQ.push(Pii(node, turn));
    };

    add(S, 0, 0);
    while (!bfsQ.empty()) {
        Pii nodet = bfsQ.front();
        bfsQ.pop();
        int node = nodet.first, turn = nodet.second;
        for (int next : edges[node])
            add(next, (turn + 1) % 3, Dist[node][turn] + 1);
    }

    if (Dist[T][0] < 0)
        cout << -1;
    else
        cout << Dist[T][0] / 3;
    cout << "\n";
    return 0;
};


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

int main(){

int H,W;
while(1){
    cin>>H>>W;
    if(H==0 && W==0){
        break;
    }

    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cout<<"#";
        }
        cout<<endl;
    }
    cout<<endl;
}
    return 0;
}


Measured memory_bytes: 3072
#include<stdio.h>

int A[1000];

int f(int n){
  if(n==0 || n==1)return A[n] = 1;
  if(A[n] != -1)return A[n];
  return A[n] = f(n-1)+f(n-2);
}

int main(){
  int n,i;
  for(i=0;i<1000;i++){
    A[i]=-1;
  }

  scanf("%d",&n);
  printf("%d\n",f(n));

  return 0;
}



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

int main(){
    int min = 1e9, max = -1e9, n, A[200000];
    cin >> n;
    for(int i = 0; i < n; i++) cin >> A[i];
    for(int i = 0; i < n - 1; i++){
        min = min > A[i] ? A[i] : min;
        max = max < A[i+1] - min ? A[i+1] - min : max;
    }
    cout << max << endl;
    return 0;
}


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

int main() {
    string s; cin >> s;

    if (s <= "2019/04/30") {
        puts ("Heisei");
    }
    else {
        puts ("TBD");
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int[] dist = new int[]{0,6,7,5,5,20,15};
		int[][] toll = new int[][]{
				{},
				{6},
				{10,7},
				{12,9,5},
				{14,12,8,5},
				{27,23,20,17,12},
				{33,30,27,26,23,10}
			};
		
		while(true){
			int[] a = new int[6];
			a[0] = sc.nextInt();
			if(a[0]==0) break;
			
			for(int i=1;i<6;i++) a[i] = sc.nextInt();
			
			int t;
			if(a[0]>a[3]){
				t = a[0];
				a[0] = a[3];
				a[3] = t;
			}
			
			int sumd = 0;
			for(int i=a[0];i<a[3];i++) sumd += dist[i];

			boolean flag = false;
			if(sumd <= 40){
				for(int i=0;i<2;i++){
					if(a[1+3*i]==18 || (a[1+3*i]==17 && a[2+3*i]>=30) || (a[1+3*i]==19 && a[2+3*i]<=30)){
						flag = true;
						break;
					}
				}
			}
			
			t = toll[a[3]-1][a[0]-1];
			if(flag==true) t = (t+1)/2;
			System.out.println(t*50);
		}	
	}	
}

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

int main(){
    
    int n;
    long b[100005]={0};
    
    scanf("%d",&n);
    for(int i=0;i<n-1;i++) scanf("%ld",&b[i]);
    
    long long sum=b[0]+b[n-2];
    
    for(int i=0;i<n-2;i++){
        sum+=min(b[i],b[i+1]);
    }
    
    printf("%lld\n",sum);
    
    return 0;
}


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

void Main() {
  int N;
  cin >> N;
  int H[N];
  for (auto &h : H) {
    cin >> h;
  }

  int hr = 1000000000+1;
  for (int i=N-1; 0<=i; --i) {
    if(H[i] <= hr) {
      hr = H[i];
      continue;
    }
    if(H[i] - 1 == hr) {
      hr = H[i]-1;
      continue;
    } else {
      cout << "No\n";
      return;
    }
  }
  cout << "Yes\n";
}

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  Main();
}


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

int main(){
    int t;
    cin >> t;
    while(t--){
        int k,p;
        cin >> k >> p;
        int ans = k%p;
        if(ans == 0)ans = p;
        cout << ans << endl;
    }
}



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


int main() {
  string s ;
  cin >> s ;
  
  int n=s.size();
  int c=0;
  int d=0;
  for(int i=0;i<n;i++){
    if(i==0){
      if(s.at(i)!='A'){
        cout <<"WA" << endl;
        break;
      }
    }
    
    if(i==1){
      if(s.at(i)<97||s.at(i)>122){
        cout << "WA" <<endl;
        break;
      }
    }
    if(i>1&&i<n-1){
      if(s.at(i)>=97&&s.at(i)<=122){
        c++;
      }
      if(s.at(i)=='C'){
        d++;
      }
    }
    if(i==n-1){
      if(s.at(i)<97||s.at(i)>122){
        cout << "WA" <<endl;
        break;
      }
      if(s.at(i)>=97&&s.at(i)<=122&&c==n-4&&d==1){
        cout << "AC"<< endl;
      }
      else{
        cout << "WA" <<endl;
      }
    }
  }
}
      
    

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x1 = sc.nextInt();
		int y1 = sc.nextInt();
		int x2 = sc.nextInt();
		int y2 = sc.nextInt();

int x3,y3,x4,y4;
int xsa,ysa;
xsa=x2-x1;
ysa=y2-y1;
x3=x2-ysa;
y3=y2+xsa;
x4=x3-xsa;
y4=y3-ysa;


System.out.println(x3+" "+y3+" "+x4+" "+y4);

	}}

Measured memory_bytes: 22996
N = gets.to_i
max_num = 0
res = 1
[*1..N].each do |n|
    num = 0
    x = n
    loop do
        break if x%2 != 0
        num += 1
        x /= 2
    end
    if max_num < num then
        max_num = num
        res = n
    end
end
puts res

Measured memory_bytes: 1788
#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;

int main(){
    int N, K;
    cin >> N >> K;
    double ans = 0.0;
    double fac = 1.0;
    for(int i=N; i>=1; i--){
        while(i * fac < K){
            fac *= 2.0;
        }
        ans += 1.0 / fac;
    }
    ans /= N;
    cout << fixed << setprecision(32) << ans << endl;
    return 0;
}

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

#define INF 1e9
#define LLINF 1e18
#define pi 3.14159265358979323
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;

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


int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (a == c) {
        cout << 0 << endl;
    }
    else cout << 1 << endl;
}

Measured memory_bytes: 3644
// AtCode.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>
#include <queue>
#include <bitset>
#include <iomanip>

using namespace std;

#define PI 3.14159265358979323846
#define INF 1e+9

long long gcd(long long a, long long b) {
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}

int main() {

	long long x, y;
	cin >> x >> y;

	long long ans = gcd(x, y);

	cout << ans << endl;

	return 0;
}




Measured memory_bytes: 3072
import sys
input = sys.stdin.readline

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    """
    まず，xとyを分離する=>xだけを考えるので1行とみなす．
    いっぺんにいくつも考えられないので，コマを2つだけ置いた時を考える．
    2この組み合わせで距離が1=>M-1通り，2=>M-2通り,...,M-1=>1通り
    (以下のように考えてΣしても良いがやや面倒
        (j列目にコマを固定すると，相手との距離はj,j-1,...,1,0,1,2,...,M-j))
    実際にはN列あるので，選び方がN^2
        同じ行・列を選んだ場合は不可能だけど，どうせ距離も0なので関係ない
        
    ある2つの組みに注目した時，それを何回数えるかは，外野の並べ方に依存
    (N*M-2)C(K-2)通り
    """
    N,M,K=MI()
    
    
    def cmb(n, r, mod):
        if (r < 0) or (n < r):
            return 0
        r = min(r, n - r)
        return (fact[n] * factinv[r] * factinv[n-r])%mod

    fact=[1,1]
    factinv=[1,1]
    inv=[0,1]
    
    for i in range(2, N*M+5+ 1):
        fact.append((fact[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod // i)) % mod)
        factinv.append((factinv[-1] * inv[-1]) % mod)
    
    tempj=0
    for j in range(M):
        tempj+=(M-j)*j
        
    tempi=0
    for i in range(N):
        tempi+=(N-i)*i

        
    ans=(tempj*N*N)%mod
    ans=(ans+tempi*M*M)%mod
    ans=(ans*cmb(N*M-2,K-2,mod))%mod
    
    print(ans)
    

main()


Measured memory_bytes: 109780
import numpy as np
H, W = map(int, input().split())
grid = np.array([], dtype=np.int)
for i in range(H):
    grid = np.append(grid, np.array([c=="." for c in input()]))

grid = grid.reshape(H,W)
row_test = np.where(np.sum(grid, axis=1)==W)
col_test = np.where(np.sum(grid, axis=0)==H)

grid = np.delete(grid, row_test[0], axis=0)
grid = np.delete(grid, col_test[0], axis=1)

for r in grid:
    res = ''
    for v in r:
        if v == 1:
            res += '.'
        else:
            res += '#'
    print(res)

Measured memory_bytes: 18984
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    s = str(input().rstrip('\n'))
    print("Yes" if s.count("R") > s.count("B") else "No")


if __name__ == '__main__':
    solve()


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

void loop(int n, char c){
  for(int i=0; i<n; i++)
    cout << c;
}


int main(){
  string s;
  while(cin >> s){
    for(int i=0; i<s.size(); i++){
      if(s[i] == '@'){
	i+=2;
	loop((s[i-1]-'0'), s[i]);
      }
      else cout << s[i];
    }
    cout << endl;
  }
  return 0;
}

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)    FOR (i,0,n)
#define ALL(f,x,...) ([&](decltype((x)) ALL) {                          \
            return (f)(begin(ALL), end(ALL), ## __VA_ARGS__); })(x)

using namespace std;

vector<char> vc;

int main()
{
    string S;
    cin >> S;

    vc.resize(3);

    bool flg = true;
    REP(i, 3)
    {
        vc[i] = S[i];
    }

    ALL(sort, vc);

    REP(i, 3)
    {
        if (i == 0 && vc[i] != 'a')
        {
            flg = false;
            break;
        }
        else if (i == 1 && vc[i] != 'b')
        {
            flg = false;
            break;
        }
        else if (i == 2 && vc[i] != 'c')
        {
            flg = false;
            break;
        }
    }

    if (flg) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
n,q=map(int,input().split())
A=[]
for i in range(0,n):
    A.append([])
for i in range(0,q):
    query=list(map(int,input().split()))
    if query[0]==0:
        A[query[1]].append(query[2])
    elif A[query[1]]!=[]:
        if query[0]==1:
            print(A[query[1]][-1])
        elif query[0]==2:
            A[query[1]].pop()


Measured memory_bytes: 13696
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>

class ex01 {
private:
    std::string board;
public:
    void run();
};


void ex01::run(){

    //初期ボード
    std::cin >> board;

    int count = 0;
    for (auto it = board.begin();it < board.end() - 1;it++){
        if (*it != *(it + 1)) {
            count++;
        }
    }
    std::cout << count << std::endl;;
}

int main(){
    ex01 ex;
    ex.run();
    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>

using namespace std;
typedef char CHAR;
typedef unsigned char UCHAR;
typedef short SHORT;
typedef unsigned short USHORT;
typedef int INT;
typedef unsigned int UINT;
typedef long long LLONG;
typedef unsigned long long ULLONG;

#define LengthOf(x)    (sizeof(x) / sizeof(x[0]))


int main(){

	string X;
	cin >> X;

	if (X[0] == '7' || X[1] == '7' || X[2] == '7') {
		cout << "Yes";
	}
	else {
		cout << "No";
	}

	return 0;
}

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

int main() {
  int A , B;
  cin >> A ;
  string op;
  cin >> op;
  cin >> B;
  if (op == "+"){
     cout << A + B << endl;
  }else if (op == "-"){
     cout << A - B << endl;
  } else if (op == "*"){
     cout << A * B << endl;
  } else if (op == "/" && B == 0){
     cout << "error" << endl;
  }else if (op == "/"){
    cout << A / B << endl;
  }else if (op == "="){
     cout << "error" << endl;
  }else if (op == "!"){
     cout << "error" << endl;
  }else if (op == "?"){
     cout << "error" << endl;
  }
}


Measured memory_bytes: 256
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
#include <iostream>
#include <string>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <cmath>
#include <climits>
#define all(x) (x).begin(),(x).end()

void solve(){

}
int main(){
    int n;
    cin >> n;
    vector<int> a;
    int x;
    for (int i = 0; i < n; i++){
        cin >> x;
        a.push_back(x);
    }
    sort(all(a));
    int ans = 0;
    for (int i = 0; i < n; i++){
        int tmp = a[i];
        int cnt = 1;
        while(tmp == a[i+1]){
            cnt++;
            tmp = a[i+1];
            i++;
        }
        if (cnt % 2 == 1){
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 892
#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <math.h>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <functional>
#include <numeric>
#include <iostream>
#include <string>
#include <time.h>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }

string S;

int main() {


	cin >> S;

	string W[] = { "","SAT","FRI","THU","WED","TUE","MON","SUN" };

	rep(i, 8) {
		if (S == W[i]) {
			printf("%d\n", i);
			return 0;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, P, X[1000];
vector<int>vec[1000];

pair<int, int> dfs(int x) {
	int s = 0;
	vector<bool>b(X[x] + 1, false);
	b[0] = true;
	for (int i : vec[x]) {
		pair<int, int>p = dfs(i);
		if (p == mkp(-1, -1))return p;
		s += p.first + p.second;
		for (int j = X[x]; j >= 0; --j) {
			if (b[j]) {
				b[j] = false;
				if (j + p.first <= X[x]) {
					b[j + p.first] = true;
				}
				if (j + p.second <= X[x]) {
					b[j + p.second] = true;
				}
			}
		}
	}
	for (int i = X[x]; i >= 0; --i) {
		if (b[i]) {
			return mkp(X[x], s - i);
		}
	}
	return mkp(-1, -1);
}

int main() {
	cin >> N;
	for (int i = 1; i < N; ++i) {
		cin >> P;
		vec[P - 1].push_back(i);
	}
	for (int i = 0; i < N; ++i) {
		cin >> X[i];
	}
	cout << ((dfs(0) == mkp(-1, -1)) ? "IMPOSSIBLE" : "POSSIBLE") << endl;
	return 0;
}

Measured memory_bytes: 512
n = int(input())
p = 10**9 + 7

def fact(n, p):
    n_ = 1
    yield n_
    for i in range(1, n+1):
         n_ = (n_*i) % p
         yield n_

def invfact(n, f, p):
    m = pow(f[n], p-2, p)
    yield m
    for i in range(n, 0, -1):
        m = m * i % p
        yield m

ans = 0
m = n - 1
f = list(fact(m, p))
rf = list(invfact(m, f, p))
rf.reverse()
perm = 0

for k in range((n+1)//2, n):
    perm_ = f[k-1] * rf[2*k-n] %p * f[k] % p
    ans += (perm_ - perm) %p * k % p
    ans %= p
    perm = perm_

print(ans)

Measured memory_bytes: 82212
H, W, M = list(map(int, input().split())) 
hw = [list(map(int, input().split())) for _ in range(M)]

LH = [0] * H
LW = [0] * W

R = {}
for i in range(M):
  h = hw[i][0] - 1
  w = hw[i][1] - 1
  LH[h] += 1
  LW[w] += 1
  if h in R:
    R[h][w] = 1
  else:
    R[h] = {}
    R[h][w] = 1

mah = max(LH)
maw = max(LW)
DH = []
DW = []

for i in range(H):
  if LH[i] == mah:
    DH.append(i)
for i in range(W):
  if LW[i] == maw:
    DW.append(i)

ans = mah + maw
for i in DH:
  if LH[i] != mah: continue
  for j in DW:
    if LW[j] != maw: continue
    if i not in R:
      break
    if j not in R[i]:
      break
  else:
    continue
  break
else:
  print(ans - 1)
  exit()

print(ans)


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

int main() {
  string s;
  cin >> s;
  if (s.length()%2 != 0) {
    cout << "No" << endl;
    return 0;
  }
  string ans = "Yes";
  for (int i=0; i < s.length()-1; i+=2) {
    if (s.at(i) != 'h' || s.at(i+1) != 'i') {
      ans = "No";
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
"""
ジャンボ高橋君はゴルフの練習をすることにしました。
ジャンボ高橋君の目標は飛距離をKの倍数にすることですが、ジャンボ高橋君の出せる飛距離の範囲はA以上B以下です。
目標の達成が可能であれば OK と、不可能であれば NG と出力してください。
"""
k = int(input())
a, b = map(int, input().split())
checkF = False
for i in range(a, b+1):
    if i % k == 0:
        checkF = True

print('OK' if checkF else 'NG')


Measured memory_bytes: 9176
S = input()

flag = 0
ans = ['Yes', 'No']

for (i,s) in enumerate(S):
    num = i+1
    if num%2 == 1:
        if s == 'L':
            flag = 1
    elif num%2 == 0:
        if s == 'R':
            flag = 1
print(ans[flag])

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG_OUTPUT
#define DEBUG_LOG(s) cout << s << endl;
#else
#define DEBUG_LOG(s) void();
#endif

int main(){
    string s;
    cin >> s;

    cout << ((s == "ABC") ? "ARC" : "ABC") << endl;
    return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
 
void read(int &x) {
    x=0;int f=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
    for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}
 
void print(int x) {
    if(x<0) putchar('-'),x=-x;
    if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}

#define lf double
#define ll long long 
#define pb push_back

#define pii pair<int,int > 
#define mp make_pair
#define fr first
#define sc second

#define iter_map map<int,int > :: iterator
#define iter_vec vector<int > :: iterator 
#define iter_set set<int > :: iterator 

const int maxn = 5e5+10;
const int inf = 1e9;
const lf eps = 1e-8;

struct DSU {
	int fa[maxn];
	void init(int n) {for(int i=1;i<=n;i++) fa[i]=i;}
	int find(int x) {return fa[x]==x?x:fa[x]=find(fa[x]);}
}dsu;

queue<pii > q;
set<int > e[maxn];
map<pii,int > s;
int n,d[maxn];

pii get(int x,int y) {return mp(min(x,y),max(x,y));}

void ins(int x,int y) {
	e[x].insert(y),e[y].insert(x);
	pii now=get(x,y);s[now]++;
	if(s[now]==2) q.push(now);
}

int main() {
	read(n);dsu.init(n);
	for(int i=1,x,y;i<n*2-1;i++) read(x),read(y),ins(x,y);
	for(int i=1,x,y;i<n;i++) {
		while(1) {
			if(q.empty()) {puts("NO");exit(0);}
			x=dsu.find(q.front().fr),y=dsu.find(q.front().sc);q.pop();
			if(x!=y) break;
		}
		if(e[x].size()>e[y].size()) swap(x,y);
		dsu.fa[x]=y,s.erase(get(x,y)),e[y].erase(x);
		for(iter_set it=e[x].begin();it!=e[x].end();it++) {
			int t=dsu.find(*it);
			if(t==y) continue;
			s.erase(get(x,t));ins(t,y);
			e[t].erase(x),e[x].erase(t);
		}
	}puts("YES");
	return 0;
}


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

int i;

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

    if ((b - a) % 2 == 0)
    {
        puts("Alice");
    }
    else
    {
        puts("Borys");
    }
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication33
{
    class Program
    {
        static bool PrimeNumbers(int a)
        {
            if (a == 2) return true;
            for(int b=2; ; b++)
            {
                if (a % b == 0) return false;
                if ((b + 1) * (b + 1) > a) return true;
            }
        }


        static void Main()
        {
            int s = 0;
            int a = int.Parse(Console.ReadLine());
            for(int b = 0; b < a; b++)
            { int c = int.Parse(Console.ReadLine());
                if (PrimeNumbers(c)) s++;
            }
            Console.WriteLine(s);
        }
    }
}

Measured memory_bytes: 9144
#include<stdio.h>

int main(void)
{
	int a,b;
	scanf("%d %d",&a,&b);
	
	if(a < b){
		printf("a < b\n");
	} else if(a > b){
		printf("a > b\n");
	} else { 
		printf("a == b\n");
	}

	return 0;

}

Measured memory_bytes: 580