akhauriyash/Code-Regression huggingface dataset:
/*
 * main.c
 *
 *  Created on: 2019/07/21
 *      Author: family
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main()
{
	int N = 0, ans = 0;
	scanf("%d", &N);
	if(N < 100) {
		if (N < 10) {
			ans = N;
		} else {
			ans = 9;
		}
	} else if (N < 1000) {
		ans = 9 + ((N+1) - 100);
	} else if (N <= 100000) {
		if(N < 10000) {
			ans = 909;
		} else if (N < 100000) {
			ans = 909 + ((N+1) - 10000);
		} else {
			ans = 90909;
		}
	} else {

	}
	printf("%d\n",ans);
    return 0;
}


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

int main() {
  int n;
  cin >> n;
  int t, a;
  cin >> t >> a;
  vector<double> h(n);
  rep(i,n) {
    cin >> h[i];
    h[i] = abs(a - t + h[i]*6/1000.0);
  }
  
  int p = 0;
  rep(i,n) {
    if (h[p] > h[i]) p = i;
  }
  
  cout << p+1 << endl;
}

Measured memory_bytes: 256
from operator import itemgetter
from collections import deque
def main():
    n, m = map(int, input().split())
    ab = [tuple(map(int, input().split())) for _ in range(m)]

    ab = sorted(ab, key=itemgetter(1))
    ab = deque(ab)

    cnt = 1
    me = ab.popleft()
    while ab:
        me_n = ab.popleft()
        if me_n[0] < me[1]:
            continue
        else:
            cnt += 1
            me = me_n
    print(cnt)


if __name__ == '__main__':
    main()

Measured memory_bytes: 19288
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N; ll K;
int A[201010], F[201010];
//---------------------------------------------------------------------------------------------------
bool check(ll ma) {
	ll cnt = 0;
	rep(i, 0, N) {
		int ok = 0, ng = A[i] + 1;
		while (ok + 1 != ng) {
			int md = (ok + ng) / 2;
			if (1LL * md * F[i] <= ma) ok = md;
			else ng = md;
		}
		cnt += A[i] - ok;
	}
	return cnt <= K;
}
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> K;
	rep(i, 0, N) cin >> A[i];
	rep(i, 0, N) cin >> F[i];

	sort(A, A + N);
	sort(F, F + N, greater<int>());

	ll ng = -1, ok = infl;
	while (ng + 1 != ok) {
		ll md = (ng + ok) / 2;
		if (check(md)) ok = md;
		else ng = md;
	}
	cout << ok << endl;
}







Measured memory_bytes: 1792
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#include<assert.h>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
#define SZ(x) ((int)x.size())
using namespace std;
inline LL read()
{
	LL f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
template<typename T>inline void chkmin(T &x,T y){x=x<y?x:y;}
template<typename T>inline void chkmax(T &x,T y){x=x>y?x:y;}
const int MAXN=200005;
struct Tree
{
	int f,g,lc,rc,dep;
	Tree(){f=g=lc=rc=dep=0;}
	friend bool operator <=(Tree n1,Tree n2){return 1LL*n1.f*n2.g<=1LL*n1.g*n2.f;}
}w[2*MAXN];int rt[MAXN],tot;
int merge(int x,int y)
{
	if(!x||!y)return x|y;if(w[y]<=w[x])swap(x,y);
	w[x].rc=merge(w[x].rc,y);
	if(w[w[x].rc].dep>w[w[x].lc].dep)swap(w[x].lc,w[x].rc);
	w[x].dep=w[w[x].rc].dep+1;return x;
}
int n,P[MAXN],V[MAXN];LL ans;
int main()
{
	n=read();
	for(int i=2;i<=n;i++)P[i]=read();
	for(int i=1;i<=n;i++)V[i]=read();
	for(int i=n;i>=1;i--)
	{
		Tree temp;
		if(V[i])temp.f=1;else temp.g=1;
		while(rt[i]&&w[rt[i]]<=temp)
		{
			ans+=1LL*temp.f*w[rt[i]].g;
			temp.f+=w[rt[i]].f;temp.g+=w[rt[i]].g;
			rt[i]=merge(w[rt[i]].lc,w[rt[i]].rc);
		}w[++tot]=temp;
		rt[i]=merge(tot,rt[i]);
		if(P[i])rt[P[i]]=merge(rt[P[i]],rt[i]);
	}int pres=0;
	while(rt[1])
	{
		ans+=1LL*w[rt[1]].g*pres;pres+=w[rt[1]].f;
		rt[1]=merge(w[rt[1]].lc,w[rt[1]].rc);
	}pr2(ans);
	return 0;
}


Measured memory_bytes: 10368
#include <bits/stdc++.h>
#define INF 1000'000'000
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//freopen("in", "r", stdin);
	int a, b, c, k, ans = 0;
	cin >> a >> b >> c >> k;
	ans += min(a,k), k -=  min(a,k);
	k-= min(k,b);
	ans -= min(k,c);
	cout << ans << endl;
	return 0;
}





Measured memory_bytes: 3628
#include "bits/stdc++.h"

using namespace std;

#define ll long long
#define vi  vector<int>
#define vvi vector<vi>
#define pi  pair<int,int>
#define mp  make_pair
#define pb  push_back
#define MOD 1e9 + 7
#define PAI  3.1415
#define all(x) (x).begin(),(x).end()
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
#define pr(x) cout << x << endl
#define Endl endl
#define rep(i,n) for(int i = 0 ; i < n; i++)

const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
const int ddx[8] = {-1,0,1,-1,1,-1,0,1};
const int ddy[8] = {-1,-1,-1,0,0,1,1,1};
const int inf = 99999999;
const ll linf = 1LL << 62;

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

ll lcm(ll a,ll b){
  if(a < b)swap(a , b);
  return (a/gcd(a , b))*b;
}

int main(){

  int n; cin >> n;
  string s[610];

  rep(i,n)cin >> s[i];

  rep(i,n){
    rep(j,n-1){
       s[i] += s[i][j];
    }
  }

  int cnt = 0;

  rep(wide,n){
    bool flag = true;
    rep(i,n){
      rep(j,n){
        if(i == j)continue;
        if (s[i][j + wide] != s[j][i + wide]) flag = false;
      }
    }
    if(flag)cnt += n;
  }

  pr(cnt);

  return 0;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <numeric>

#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF (int)1e9
#define INFL 1e18
#define MOD 1e9+7
#define pb push_back
#define MP make_pair
typedef long long int ll;
typedef std::pair<int,int> P;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;
int main() {
    int n,m;
    cin>>n>>m;
    cout<<((1900*m+100*(n-m))*(1<<m))<<endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 2147483647
#define lli long long int
#define MOD 1000000007
#define pb push_back

using namespace std;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;
typedef pair<int,int> pii;
typedef vector<pair<int,int>> vpii;

int main() {
	
	int n,w; cin >> n >> w;
	vvi table(n+10,vi(w+10,0));

	vi val(n,0);
	vi wei(n,0);
	for (int i = 0; i < n; i++) {
		cin >> val[i] >> wei[i];
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= w; j++) {
			if(j >= wei[i]) {
				table[i+1][j] = max(table[i][j],table[i][j-wei[i]] + val[i]);
			}else{
				table[i+1][j] = table[i][j];
			}
		}
	}
	
	cout << table[n][w] << endl;

	return 0;
}

Measured memory_bytes: 7004
#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define N 512
#define SQ(X) ((X) * (X))
#define MAX(A,B) ((A) < (B) ? (B) : (A))

static int r[N];
static int n;

static double d[N];

main()
{
  double rval;
  int i, j;
  
  scanf("%d", &n);
  for (i = 0; i < n; ++i) {
    scanf("%d", &r[i]);
    
    d[i] = r[i];
    for (j = 0; j < i; ++j) {
      const double tmp = d[j] + sqrt(SQ(r[i] + r[j]) - SQ(r[i] - r[j]));
      d[i] = MAX(d[i], tmp);
    }
  }
  
  rval = 0.;
  for (i = 0; i < n; ++i) {
    rval = MAX(rval, d[i] + r[i]);
  }
  printf("%.4f\n", rval);
  
  return EXIT_SUCCESS;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include<vector>
#include<cstdlib>
#include<stdio.h>
#include <cmath>
#include <limits>
#include<iomanip>

using namespace std;
 
template <class T> using V = vector<T>;
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
using graph = V<V<int>>;
using pq = priority_queue<ll>;


 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>=(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
#define pb(a) push_back(a);
  
 

ll sum(ll n) {
ll m=0;
  while(n){
    m+=n%10;
    n/=10;
  }
  return m;
}
 
 
const int MAX = 510000;
const int MOD = 1000000007;
 
long long fac[MAX], finv[MAX], inv[MAX];
 
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
 
 
#define comuse Comuse()
 
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
 
 
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}




 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 


signed main() {
  long double a,b,x;
    ci(a>>b>>x);
  long double t=(2*a*a*b-2*x)/a/a;
  long double ans=a/t;
  if(t>b){
    t=2*x/a/b;
    ans=t/b;
  }
  long double pi=3.14159265;
  long double eight=180;
  long double nine=90;
  cout<<setprecision(9)<<nine-atanl(ans)*eight/pi<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
template<typename T>inline T read(){
	T f=0,x=0;char c=getchar();
	while(!isdigit(c)) f=c=='-',c=getchar();
	while(isdigit(c)) x=x*10+c-48,c=getchar();
	return f?-x:x;
}
namespace run{
	const int N=5009;
	int head[N],nex[N<<1],to[N<<1],cnt;
	inline void add(int u,int v){
		nex[++cnt]=head[u];
		head[u]=cnt,to[cnt]=v;
	}

	int A[N],n,f[N];
	inline void dfs(int u,int _f){
		for(int i=head[u];i;i=nex[i])
			if(to[i]^_f){
				dfs(to[i],u);
				if(A[u]>A[to[i]] && !f[to[i]]) f[u]=1;
			}
	}
	int main(){
		n=read<int>();
		for(int i=1;i<=n;i++) A[i]=read<int>();
		for(int i=1;i<n;i++){
			int u=read<int>(),v=read<int>();
			add(u,v),add(v,u);
		}

		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++) f[j]=0;
			dfs(i,0);
			if(f[i]) printf("%d ",i);
		}
		printf("\n");
		return 0;
	}
}
int main(){
#ifdef my
	freopen(".in","r",stdin);
	freopen(".out","w",stdout);
#endif
	return run::main();
}

Measured memory_bytes: 4004
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define dup(x,y) (((x)+(y)-1)/(y))
#define ALL(x) (x).begin(), (x).end()
typedef long long ll;
typedef pair<int, int> pii;
const double EPS = 1e-10;
const int INF = 1e9;
const ll LINF = 1e15;
const int MOD = 1000000007;
const double PI = acos(-1);
int dx[4] = {0,1,0,-1};
int dy[4] = {1,0,-1,0};

typedef pair<ll, ll> pll;

int main() {
	ll n;
	cin >> n;
	vector<pii> v;
	ll c = n;
	for (ll i = 2; i * i <= c; i++) {
		if (c % i == 0) {
			pll p;
			p.first = i;
			p.second = 0;
			while (c % i == 0) {
				p.second++;
				c /= i;
			}
			v.push_back(p);
		}
	}
	if (c != 1) v.push_back(pll(c, 1));

	ll ans = 0;
	for (auto p: v) {
		ll c = 1;
		ll x = p.second;
		while (c <= x) {
			x -= c;
			c++;
			ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 3632
function main()
    n, m = parse.(Int, split(readline()))
    h = parse.(Int, split(readline()))
    a = Vector{Int}(undef, m)
    b = Vector{Int}(undef, m)

    par = collect(1:n)

    groups = [[i] for i in 1:n]
    for i in 1:m
        a[i], b[i] = parse.(Int, split(readline()))
        push!(groups[a[i]], b[i])
        push!(groups[b[i]], a[i])
    end

    cnt = 0
    for i in 1:n
        if length(groups[i]) == 1
            cnt += 1
        else
            g = groups[i][2:end]
            if all(h[i] .> h[g])
                cnt += 1
            end
        end
    end

    println(cnt)

end

function root!(par, x)
    if par[x] == x
        return x
    else
        return par[x] = root!(par, par[x])
    end
end

function unite!(par, x, y)
    x = root!(par, x)
    y = root!(par, y)
    if x == y
        return nothing
    end

    par[x] = y
    return nothing
end
main()


Measured memory_bytes: 243224
n, T = map(int, raw_input().split())

ans = 9999999999999999999999999999999999999999999999999999999999999999999999999999
for i in xrange(n):
    c, t = map(int, raw_input().split())
    if t <= T:
        ans = min(ans, c)
if ans > 999999999999999999999999999999999999999999999999999999999999999:
    print "TLE"
else:
    print ans

Measured memory_bytes: 2568
#include <bits/stdc++.h>
using namespace std;
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;
}
#define DEBUG
#ifdef DEBUG
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << '(' << p.first << ',' << p.second << ')';
    return os;
}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << '{';
    for(int i = 0; i < (int)v.size(); i++) {
        if(i) {
            os << ',';
        }
        os << v[i];
    }
    os << '}';
    return os;
}
void debugg() { cerr << endl; }
template <class T, class... Args>
void debugg(const T &x, const Args &... args) {
    cerr << " " << x;
    debugg(args...);
}
#define debug(...)                                                             \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debugg(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

struct Setup {
    Setup() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(15);
    }
} __Setup;

using ll = long long;
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

struct UnionFind {
    vector<int> par;

    UnionFind(int n) : par(n, -1) {}
    void init(int n) { par.assign(n, -1); }

    int root(int x) {
        if(par[x] < 0)
            return x;
        else
            return par[x] = root(par[x]);
    }

    bool issame(int x, int y) { return root(x) == root(y); }

    bool merge(int x, int y) {
        x = root(x);
        y = root(y);
        if(x == y)
            return false;
        if(par[x] > par[y])
            swap(x, y); // merge technique
        par[x] += par[y];
        par[y] = x;
        return true;
    }

    int size(int x) { return -par[root(x)]; }
};

int main() {
    int n, m;
    cin >> n >> m;
    UnionFind uf(n);
    for(int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        uf.merge(a, b);
    }
    set<int> se;
    for(int i = 0; i < n; i++) {
        se.insert(uf.root(i));
    }
    int sz = se.size();
    cout << sz - 1 << endl;
}

Measured memory_bytes: 7508
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define len(x) ((long long)(x).size())
#define g(a, b) __gcd((a), (b))
#define l(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using pll = pair<ll, ll>;
template<class T>void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T>void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U>bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U>bool isin(T el, U container) { return find(all(container), el) != container.end(); }
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; }
template<class T>ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T>ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;



int main()
{
        ll N;
        cin >> N;
        vll a(N);
        rep(i, 0, N) cin >> a[i];

        ll mul4 = 0;
        ll mul2 = 0;
        rep(i, 0, N) {
                if (a[i] % 4 == 0) ++mul4;
                if (a[i] % 2 == 0) ++mul2;
        }
        mul2 -= mul4;

        if (N % 2 == 0) {
                if (mul2 + 2 * mul4 >= N) {
                        cout << "Yes" << endl;
                } else {
                        cout << "No" << endl;
                }
        } else {
                if (mul2 + 2 * mul4 +1 >= N) {
                        cout << "Yes" << endl;
                } else {
                        cout << "No" << endl;
                }
        }
}

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

int gcd(int a, int b) {  
    if (!b)  
        return a;  
    return gcd(b, a%b);  
}  

int main(){
  int A, B, K, c, i;
  cin >> A >> B >> K;
  
  c = gcd(A, B);
  
  for (i = c; i >= 1; i--){
    if(c%i == 0){
      K--;
    }
    if(K == 0){
      break;
    }
  }
  
  cout << i << endl;
  return 0;
}

Measured memory_bytes: 256
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
#define x first
#define y second
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ll long long
#define ld long double
#define ii pair<int,int>
#define ull unsigned long long
#define all(k) k.begin(),k.end()
#define rall(k) k.rbegin(),k.rend()
#define db(x) cerr<<#x<<" = "<<x<<endl
#define len(v) ((int)v.size())
#define endl '\n'



void solve(){
  int m[3][3];
  map<int,ii> mp;
  for(int i=0;i<3;i++){
    for(int j=0;j<3;j++){
      cin>>m[i][j];
      mp[m[i][j]]={i,j};
    }
  }

  int n;
  cin>>n;
  while(n--){
    int b;
    cin>>b;
    if(mp.count(b)){
      ii oi = mp[b];
      m[oi.x][oi.y]=-1;
    }
  }

  if(
      m[0][0]+m[0][1]+m[0][2]==-3 or
      m[1][0]+m[1][1]+m[1][2]==-3 or
      m[2][0]+m[2][1]+m[2][2]==-3 or

      m[0][0]+m[1][0]+m[2][0]==-3 or
      m[0][1]+m[1][1]+m[2][1]==-3 or
      m[0][2]+m[1][2]+m[2][2]==-3 or

      m[0][0]+m[1][1]+m[2][2]==-3 or
      m[2][0]+m[1][1]+m[0][2]==-3 

    ){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }

}
int32_t main(){
  ios::sync_with_stdio(0); cin.tie(0);
  int t; 
#ifdef TESTCASE
  cin>>t;
#else 
  t = 1;
#endif
  while(t--) solve();
}


Measured memory_bytes: 256
s = sorted(set(input()))

alphabet = [chr(ord("a") + i) for i in range(26)]
ans = "None"
for actual, expected in zip(s, alphabet):
    if actual != expected:
        ans = expected
        break

if ans == "None" and s[len(s)-1] != "z":
    ans = alphabet[len(s)]
print(ans)


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pll pair<ll,ll>
#define sll set<ll>
#define msll multiset<ll>
#define mll map<ll,ll>
#define vll vector<ll>
#define vpl vector<pll>
#define gll greater<ll>
#define gpl greater<pll>
#define spl set<pll>
#define mspl multiset<pll>
#define lb lower_bound
#define bp __builtin_popcount
#define ub upper_bound
#define prq priority_queue
#define mp make_pair
#define pb push_back
#define mem(x,y) memset(x, y, sizeof x)
#define endl "\n"
#define sz(x) (ll)x.size()
#define sqr(x) x*x
#define rapido ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll;
typedef long double ld;
ll mx=INT_MAX;
ll mn=INT_MIN;
ll MOD=1e9+7;
const ll maxs=1e7+5;
ll INF = 1e18;
const ll lg=22; 

ll fast(ll base , ll expo){
    ll res = 1;
    while(expo>=1){
        if(expo%2) res *= base;
        base *= base;
        expo /= 2;
    }
    return base;
}

void code_idhr_h(){
    string S,T; cin>>S>>T;
    ll ans = 0;
    for(ll i=0; i<sz(S); i++){
        if(S[i] != T[i]) ans++;
    }
    cout<<ans<<endl;
}

int main(){
    rapido;
    ll T=1; //cin>>T;
    while(T--){
        mx = INT_MIN;
        code_idhr_h();
    }
    return 0;
}

Measured memory_bytes: 3800
#include<cstdio>
#include<map>
using namespace std;

int n, a[200000], ind[200001], loc[200001];
long k;

int main() {
    scanf("%d %ld", &n, &k);
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);

    fill(loc, loc + n + 1, (int) 1e9);
    int cnt;
    int offset = 0;
    loc[0] = 0;
    for (cnt = 1; cnt <= n && cnt <= k; cnt++) {
        ind[cnt] = a[ind[cnt - 1]] - 1;
        if (loc[ind[cnt]] == (int) 1e9) loc[ind[cnt]] = cnt;
        else {
            offset = loc[ind[cnt]];
            cnt -= offset;
            break;
        }
    }
    
    int ans;
    if (k <= offset) ans = ind[k] + 1;
    else ans = ind[(k - offset) % cnt + offset] + 1;

    printf("%d\n", ans);
    return 0;
}


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

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

    int n, q;
    cin >> n >> q;
    string s;
    cin >> s;

    vector<int> A(n);
    for(int i = 1; i < n; i++){
        A[i] += A[i - 1] + (s[i - 1] == 'A' and s[i] == 'C');
    }

    for(int i = 0; i < q; i++){
        int l, r;
        cin >> l >> r;
        l--; r--;
        cout << A[r] - A[l] << endl;
    }

    /*
    for(auto x : A){
        cout << x << ' ';
    }
    cout << endl;
    */

    return 0;
}

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

string str;
int pos;

int exp();
int term();
int factor();
int henkan(string);
int ruijou(int);

int main(){
  int n;
  cin >> n;
  for(int i=0;i<n;i++){
    str="";
    getchar();
    while(1){
      char temp;
      cin >> temp;
      if(temp=='=') break;
      str+=temp;
    }
    
    pos=0;
    int ans=0;
    ans=exp();

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

int exp(){
  int x=term();
  
  while(str[pos]=='+' || str[pos]=='-'){
    char op=str[pos];
    pos++;
    if(op=='+'){
      x+=term();
    }
    else{
      x-=term();
    }
  }
  return x;
}

int term(){
  int x=factor();
  while(str[pos]=='*' || str[pos]=='/'){
    char op=str[pos];
    pos++;
    if(op=='*') x*=factor();
    else x/=factor();
  }
  return x;
}

int factor(){
  int x;

  if(str[pos]=='('){
    pos++;
    x=exp();
    pos++;
  }
  else{
    string number="";
    int i=pos;
    while(str[i]>='0' && str[i]<='9'){
      number+=str[i];
      i++;
    }
    pos=i;
    x=henkan(number);
  }
  
  return x;
}

int henkan(string number){
  int size=number.size();
  int sum=0;
  
  for(int i=0;i<size;i++){
    sum+=(number[i]-'0')*ruijou(size-i-1);
  }
  return sum;
}

int ruijou(int n){
  int sum=1;
  
  for(int i=0;i<n;i++){
    sum*=10;
  }
  
  return sum;
}

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

int main(){
  int n;
  cin >> n;
  if (n%2==0) cout << n/2 << endl;
  else cout << n/2+1 << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,l,r) for(int i=l;i<=r;++i)
#define drep(i,r,l) for(int i=r;i>=l;--i)
using namespace std;
const int sz=2e7+7;
const int mod=1e9+7;
int ans;
int w,h,k;
int inv[sz],fac[sz],ifac[sz];
void init(){
	fac[0]=ifac[0]=1;
	inv[1]=ifac[1]=fac[1]=1;
	for(int i=2;i<sz;i++){
		inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
		fac[i]=1ll*i*fac[i-1]%mod;
		ifac[i]=1ll*inv[i]*ifac[i-1]%mod;
	}
}
int C(int n,int m){
	if(n<m) return 0;
	return 1ll*fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}
int A(int n,int m){
	return 1ll*fac[n]*ifac[m]%mod;
}
int main(){
	init();
	scanf("%d%d%d",&w,&h,&k);
	ans=(ans+2ll*C(k,3)%mod*w%mod*h%mod*A(w+h-2,w+h-k)%mod)%mod;
//	printf("%d\n",ans);
	ans=(ans+2ll*C(k,2)%mod*w%mod*h%mod*A(w+h-2,w+h-k)%mod)%mod;
//	printf("%d\n",ans);
	ans=(ans+1ll*C(k,2)%mod*A(w+h,w+h-k)%mod)%mod;
//	printf("%d\n",ans);
	ans=(ans+2ll*k%mod*A(w+h,w+h-k)%mod)%mod;
	printf("%d\n",ans);
}

Measured memory_bytes: 234752
object Main extends App{
    val Array(a,b) = scala.io.StdIn.readLine.split(" ").map(_.toInt)
    val target = (a.toString + b.toString).toInt
    val upper_limit = (target/2.0).ceil.toInt
    if(0 < (1 to upper_limit).map(e => e*e).count(_ == target)) println("Yes") else println("No")
}

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

int main(){
    string s;
    cin>>s;
    if(s.size()==2)cout<<s<<endl;
    else reverse(s.begin(),s.end()),cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
k,n=map(int,input().split())
alist=list(map(int,input().split()))
difflist=[]
for i in range(n):
    tmpdiff=abs(alist[i]-alist[i-1])
    tmpdiff=min(tmpdiff,k-tmpdiff)
    difflist.append(tmpdiff)

print(k-max(difflist))

Measured memory_bytes: 26436
int main(void){
	int w[9<<14]={};
	int k;
	int U=0;
    int i=0;
    int j=0;
  	
	for(;~scanf("%d",&k);)j++&&w[k]++;
	for(;++i<1e5;)U=fmax(w[i-1]+w[i]+w[i+1],U); 		
	printf("%d",U);
}

Measured memory_bytes: 2700
#include <bits/stdc++.h>
using namespace std;
int main (){
  long long A,B,C;
  cin >>A>>B>>C;
  
  int ans=0;
  
  if (A%2==1 || B%2==1 | C%2==1){
    cout << 0 << endl;
  }
  else if (A==B && B==C){
    cout << -1 << endl;
  }
  else{
  while(A%2==0 && B%2==0 && C%2==0){
    int a=A/2;
    int b=B/2;
    int c=C/2;
    A=b+c;
    B=c+a;
    C=a+b;
    ans++;
  }
    cout << ans << endl;
  }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <cstdlib>
#include <ctime>
using namespace std;
#define pi acos(-1)
#define mod 1000000007
#define ll long long
#define ull unsigned long long
#define mem(a) memset(a,0,sizeof(a))
#define cio ios::sync_with_stdio(false);
int s[200010];
vector<int>v[200010];
int main()
{   	
	int n, m;
	cin >> n >> m;
	int a, b;
	for(int i = 1; i <= m; i++){
		cin >> a >> b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	queue<int>q;
	s[1] = 0;
	for(int i = 0; i < v[1].size(); i++){
		q.push(v[1][i]);
		s[v[1][i]] = 1;
	}
	while(!q.empty()){
		int p = q.front();
		q.pop();
		for(int i = 0; i < v[p].size(); i++){
			if(s[v[p][i]]==0&&v[p][i]!=1){
				q.push(v[p][i]);
				s[v[p][i]] = p;
			}
		}
	}
	int flag = 1;
	for(int i = 2; i <= n; i++){
		if(s[i]==0){
			flag = 0;
			break;
		}
	}
	if(!flag){
		cout << "No" << endl;
	}else{
		cout << "Yes" << endl;
		for(int i = 2; i <= n; i++){
			cout << s[i] << endl;
		}
	}
    return 0;
}


Measured memory_bytes: 12844
open Batteries
let () =
  let n = Scanf.scanf "%d " (fun a -> a) in
  let a_lst = Array.to_list @@ Array.init n (fun _ -> Scanf.scanf "%d " (fun a -> a)) in

  let rev_cumsum l =
    let rec aux last res = function
      | [] -> res
      | hd :: tl -> 
        let last = last + hd in
        aux last (last::res) tl
    in
    aux 0 [] l
  in
  let l = List.rev (rev_cumsum a_lst) in
  let aux sign =
    let _,res,_ =
      List.fold_left (fun (cum, cnt, sign) x -> 
          match sign with
          | `Plus -> if x + cum <= 0 then let x = x+cum in ((cum+1-x), (cnt+1-x), `Minus) else (cum,cnt,`Minus)
          | `Minus -> if x + cum >= 0 then let x = x+cum in ((cum+(-1-x)), (cnt-(-1-x)), `Plus) else (cum,cnt,`Plus)
        ) (0,0,sign) l
    in
    res
  in

  let ans1 = aux `Plus in
  let ans2 = aux `Minus in
  Printf.printf "%d\n" @@
  if ans1 > ans2 then ans2 else ans1



Measured memory_bytes: 10880
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
void solve(ll k)
{
  ll ans=0;
  for(ll i=1;i<=1e6;i++)
  {
    ans=(ans*10+7)%k;
    if(ans==0)
    {
      cout<<i;
      return;
    }
  }
  cout<<"-1";
  return;
}
int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ll k;
  cin>>k;
  solve(k);
  return 0;
}

Measured memory_bytes: 3652
/*
    AUTHOR:hruday pabbisetty
    NIT ROURKElA
    MALDGPXXQL6F9LR
*/
#include <bits/stdc++.h>
#include <tr1/unordered_map>
using namespace std;
#define opt ios_base::sync_with_stdio(0)
#define lli long long int
#define ulli unsigned long long int
#define I int
#define S string
#define D double
#define rep(i,a,b) for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define in(n) scanf("%lld",&n)
#define in2(a,b) scanf("%lld %lld",&a,&b)
#define in3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define out(n) printf("%lld\n",n)
#define inu(a) scanf("%lld",&a)
#define outu(a) printf("%llu",a)
#define ins(s) scanf("%s",&s)
#define outs(s) printf("%s",s)
#define nl printf("\n")
#define mod 1000000007
#define inf 100000000000000
typedef long long       ll;
typedef pair<lli,lli>  plli;
typedef vector<lli>     vlli;
typedef vector<ulli>    vulli;
typedef vector<ll>      vll;
typedef vector<string>  vs;
typedef vector<plli>     vplli;
#define MM(a,x)  memset(a,x,sizeof(a));
#define ALL(x)   (x).begin(), (x).end()
#define P(x)       cerr<<"{"#x<<" = "<<(x)<<"}"<<endl;
#define P2(x,y)       cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<"}"<<endl;
#define P3(x,y,z)  cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<"}"<<endl;
#define P4(x,y,z,w)cerr<<"{"#x" = "<<(x)<<", "#y" = "<<(y)<<", "#z" = "<<(z)<<", "#w" = "<<(w)<<"}"<<endl;
#define PP(x,i)     cerr<<"{"#x"["<<i<<"] = "<<x[i]<<"}"<<endl;
#define TM(a,b)     cerr<<"{"#a" -> "#b": "<<1000*(b-a)/CLOCKS_PER_SEC<<"ms}\n";
#define UN(v)    sort(ALL(v)), v.resize(unique(ALL(v))-v.begin())
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define sz() size()
//#define nl cout<<"\n"
#define MX1 100005
#define MX2 1000005
#define sqr(a) a*a*a
#define bs binary_search
#define lb lower_bound
#define ub upper_bound

lli power(lli a,lli b)
    {
    lli value;
    if(b==0)
        {
        return 1;
    }
    else if(b%2==0)
        {
        value=power(a,b/2)%mod;
        return(value*value)%mod;
    }
    else
        {
        value=power(a,b/2)%mod;
        return ((a*value)%mod*(value))%mod;
    }
}
int main()
{
      /*  #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
        #endif*/
    opt;
    string s;
    cin>>s;
    if(s.sz()<4)
    {
        cout<<"No";
    }
    else if(s.substr(0,4)=="YAKI")
    {
        cout<<"Yes";
    }
    else
    {
        cout<<"No";
    }
}


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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S,T;
    cin >> S >> T;

    bool res = 0;
    rep(i, S.length()){
        if(S[i] != T[i]) res = 1;
    }
    if(S.length() + 1 != T.length()) res = 1;

    if(res == 0) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define RI(a) scanf("%d",&a)
#define RII(a,b) scanf("%d%d",&a,&b)
#define RIII(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define F first
#define S second
#define REP(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#ifdef leowang
#define debug(...) do{\
	fprintf(stderr,"%s - %d : (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
	_DO(__VA_ARGS__);\
}while(0)
template<typename I> void _DO(I&&x){cerr<<x<<endl;}
template<typename I,typename...T> void _DO(I&&x,T&&...tail){cerr<<x<<", ";_DO(tail...);}
#else
#define debug(...)
#endif
//}}}
const ll maxn=100005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=2000000000;

int main()
{
	int n;
	cin>>n;
	if(n%10==n/100) puts("Yes");
	else puts("No");
	return 0;
}


Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, deque<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

vector<bool> isprime;
void eratosthenes(int N) {
  isprime.resize(N + 1);
  fill(begin(isprime), end(isprime), true);
  isprime[0] = false;
  isprime[1] = false;
  for (int i = 2; i < sqrt(N) + 1; i++)
    if (isprime[i])
      for (int j = 2; i * j <= N; j++) isprime[i * j] = false;
}

signed main() {
  eratosthenes(1000006);
  int X;
  cin >> X;
  rep(i, X, 100006) {
    if (isprime[i]) {
      cout << i << endl;
      return 0;
    }
  }
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define f(i,a,b) for( int i = a; i < b ; i++ ) 
#define af(i,a,b) for( int i = a; i >= b ; i--)
#define rep(i,a,b,k) for(int i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( int i = a; i >= b ; i-= k)
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define PI 3.14159265358979323846

typedef long double ld;
typedef long long int ll;
typedef vector<int> vi ;
typedef pair<int,int> ii ;
typedef vector<ii> vii 	;
ll inf=1e9;
ll num[100010];
ll dp[3010][3010];
ll solve(int i,int j,int p){
	if(dp[i][j]!=-inf) return dp[i][j];
	if(i==j){
		if(p==0) return num[i];
		else return -num[i];
	}
	if(p==0){
		ll a= max(solve(i+1,j,1)+num[i],solve(i,j-1,1)+num[j]);
		dp[i][j]=a;
		return a;		
	}
	else{
		ll b=min(solve(i+1,j,0)-num[i],solve(i,j-1,0)-num[j]);
		dp[i][j]=b;
		return b;
	}
}
int main(){
	fastio;
	int n,k;
	cin>>n;
	f(i,0,n) cin>>num[i];
	f(i,0,n) f(j,0,n) dp[i][j]=-inf;
	cout<<solve(0,n-1,0);
}

Measured memory_bytes: 71040
N,K=map(int,input().split())
H=list(map(int,input().split()))
DP=[0]*(N)
DP[0]=0
DP[1]=abs(H[1]-H[0])
for i in range(2,N):
  DP[i]=min([abs(H[i]-H[k])+DP[k] for k in range(max(i-K,0),i)])
print(DP[N-1])

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

int main() {
int A, B,M;
cin >>A>>B>>M;
vector<int>a(A);
vector<int>b(B);
for(int &x : a) cin >> x;
for(int &x : b) cin >> x;
vector<vector<int>>m;
for (int i = 0; i < M; i++)
{
  int x,y,z;
  cin >> x>>y>>z;
  m.push_back({x,y,z});
}
int mina = *min_element(a.begin(), a.end());
int minb = *min_element(b.begin(), b.end());
int min = mina+minb;
for (int i = 0; i < M; i++)
{
  int x=m[i][0], y=m[i][1], c=m[i][2];
  int val = a[x-1] + b[y-1] -c;
  if(min>val) min=val;
}
cout << min << endl;

  return 0;
}

Measured memory_bytes: 7604
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <cstring>
#include <cctype>
#include <cmath>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <math.h>
#include <bitset>
#include <iterator>
#include <iomanip>
#include <sstream>
#include <numeric>
#include <cassert>
#define INF 2000000000
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
long long gcd(long long a,long long b){if(a%b==0){return b;}else return gcd(b,a%b);}
long long lcm(long long a,long long b){if(a==0){return b;} return a/gcd(a,b)*b;}
#define MOD 1000000007
#define sym cout<<"---------"<<endl;
#define ll long long
#define P pair<int,int>
#define mk make_pair
#define en endl
#define RE return 0
#define int ll

int ans[1005];

void searching(int a){
  while(a!=1){
    for(int i=2; i<=a; i++){
      if(a%i==0){
        ans[i]++;
        a/=i;
        break;
      }
    }
  }
}

signed main(){
  int n; cin>>n;
  
  for(int i=n; i>=2; i--){
    searching(i);
  }
  int ret=1;
  for(int i=2; i<=n; i++){
    ret*=(1+ans[i]);
    ret%=MOD;
  }
  cout<<ret<<en;
}



Measured memory_bytes: 256
package main
 
import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)
 
func run() {

	var N int;
    N = nextInt();
    d := make([]int,N);
    for i := 0 ; i < int(N) ; i++ {
        d[i] = nextInt();
    }
	solve(N, d);

}

func solve(N int, d []int){
	sum := 0
	for i := 0; i < int(N); i++ {
		for j := i+1; j < int(N); j++ {
			sum += d[i]*d[j]
		}
	}	
	Println(sum)
}


// --- template ---
// Thanks https://gist.github.com/halllllll/853ab587fd82ee3ffe6f7fb7fb499695
 
var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
 
// Caution: You will get unexpected result if a single token is larger than this size.
const BufferSize = 64 * 1024 * 1024
 
func Print(a ...interface{}) (n int, err error) {
	return fmt.Fprint(out, a...)
}
 
func Printf(format string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, format, a...)
}
 
func Println(a ...interface{}) (n int, err error) {
	return fmt.Fprintln(out, a...)
}
 
func next() string {
	sc.Scan()
	return sc.Text()
}
 
func nextInt() int {
	a, err := strconv.Atoi(next())
	if err != nil {
		log.Fatal(err)
	}
	return a
}

func nextFloat() float64 {
	a, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		log.Fatal(err)
	}
	return a
}


type IntHeap []int
func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return h[i] > h[j] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IntHeap) Push(x interface{}) {
	// Push and Pop use pointer receivers because they modify the slice's length,
	// not just its contents.
	*h = append(*h, x.(int))
}

func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

/////数字と文字
// 基本クラス
type NS struct {
    Num int
    Str string
}

//////　数字と数字
// 基本クラス
type NN struct {
    Num1 int
    Num2 int
}

 
func main() {
	sc.Buffer(make([]byte, 0, BufferSize), BufferSize)
	sc.Split(bufio.ScanWords)
	run()
	out.Flush()
}



Measured memory_bytes: 2688
#include <bits/stdc++.h>
#include <algorithm>
#include <math.h>
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
#define INF 999999999
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

using llong = long long;
using namespace std;

int main(){
    llong a,b,x,n,ans=0;
    cin >> a >> b >> n;
    // if(n<100000){
    //     for(llong i=0;i<=n;i++){
    //         x = i;
    //         ans = max(ans,(a*x)/b-a*(x/b));
    //     }
    // }else if(b<n){
    //     for(llong i=1;i*b-1<=n;i++){
    //         x = i*b-1;
    //         ans = max(ans,(a*x)/b-a*(x/b));
    //     }
    // }else{
    //     x = n;
    //     ans = (a*x)/b-a*(x/b);
    // }
    if(b<=n){
        x = b-1;
        ans = (a*x)/b-a*(x/b);
    }else{
        x = n;
        ans = (a*x)/b-a*(x/b);
    }
    cout << ans << endl;
}

Measured memory_bytes: 3672
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;

  vector<int> a(n);
  for (auto& e : a)
    cin >> e;

  map<int, int> c;

  for (auto e : a) {
    c[e] += 1;
  }

  vector<int> cv;
  for (auto& e : c) {
    cv.push_back(e.second);
  }

  if (k >= cv.size()) {
    cout << 0 << endl;
	return 0;
  }

  sort(cv.begin(), cv.end());
  int ans = 0;
  for (int i = 0; i < cv.size() - k; i++) {
    ans += cv[i];
  }

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


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

struct Dog{
	int h, w;
	int dir;
};

Dog dog, tmp;

int h, w;
long long l;
int dh[4] = {-1,0,1,0};
int dw[4] = {0,1,0,-1};
char d[4] = {'N','E','S','W'};
int brd[100][100];

int main(){
	while(true){
		cin >> h >> w >> l;
		if(h == 0 && w == 0 && l == 0) break;
		rep(i,h){
			string str;
			cin >> str;
			rep(j,w){
				if(str[j] == '#') brd[i][j] = 1;
				else brd[i][j] = 0;
				if(str[j] == 'N'){dog.h = i; dog.w = j; dog.dir = 0;}
				if(str[j] == 'E'){dog.h = i; dog.w = j; dog.dir = 1;}
				if(str[j] == 'W'){dog.h = i; dog.w = j; dog.dir = 3;}
				if(str[j] == 'S'){dog.h = i; dog.w = j; dog.dir = 2;}
			}
		}
		bool end = false;
		for(int i = 1; i <= 100000; i++){
			while(true){
				int hh = dog.h+dh[dog.dir], ww = dog.w+dw[dog.dir];
				if(0>hh||hh>=h||0>ww||ww>=w||brd[hh][ww] == 1){
					dog.dir = (dog.dir+1)%4;
					continue;
				}
				dog.h = hh;
				dog.w = ww;
				break;
			}
			if(l == i){
				end = true;
				cout << dog.h+1 << " " << dog.w+1 << " " << d[dog.dir] << endl;
				break;
			}
		}
		if(end) continue;
		tmp.h = dog.h; tmp.w = dog.w; tmp.dir = dog.dir;
		l -= 100000;
		int cnt = 0;
		while(true){
			cnt++;
			while(true){
				int hh = dog.h+dh[dog.dir], ww = dog.w+dw[dog.dir];
				if(0>hh||hh>=h||0>ww||ww>=w||brd[hh][ww] == 1){
					dog.dir = (dog.dir+1)%4;
					continue;
				}
				dog.h = hh;
				dog.w = ww;
				break;
			}
			if(dog.h==tmp.h&&dog.w==tmp.w&&dog.dir==tmp.dir) break;
		}
		l %= cnt;
		for(int i = 0;;i++){
			if(l == i){
				cout << dog.h+1 << " " << dog.w+1 << " " << d[dog.dir] << endl;
				break;
			}
			while(true){
				int hh = dog.h+dh[dog.dir], ww = dog.w+dw[dog.dir];
				if(0>hh||hh>=h||0>ww||ww>=w||brd[hh][ww] == 1){
					dog.dir = (dog.dir+1)%4;
					continue;
				}
				dog.h = hh;
				dog.w = ww;
				break;
			}
		}
	}
}

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

using namespace std;

int main() {
    int a, b;
    string op;

    int ans = 0;

    cin >> a >> op >> b;

    if (op == "+") ans = a + b;
    else if (op == "-") ans = a - b;

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import heapq
n = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

a=0
m=0
s=0
ans = 0
A = heapq.nlargest(n[0] , A)
B = heapq.nlargest(n[1] , B)
len = len(C)
if len <(n[0]+n[1]):
    C = heapq.nlargest(len,C)
else:
    C = heapq.nlargest(n[0]+n[1] , C)
for i in range(n[0]+n[1]):
    if s == len:
        if a==n[0] and m<n[1]:
            saidai = B[m]
            m +=1
        else:
            saidai = max([ A[a],B[m] ])
            if A[a] >=B[m]:
                a +=1
            else:
                m +=1

    else:
        if a==n[0] and m<n[1]:
            saidai = max([ B[m],C[s] ])

            if C[s] >= B[m]:
                s +=1
            else:
                m +=1
        elif a<n[0] and m == n[1]:
            saidai = max([ A[a],C[s] ])

            if C[s] >= A[a]:
                s +=1
            else:
                a +=1

        else:
            saidai=max([ A[a],B[m],C[s] ])

            if A[a] >= B[m] and A[a] > C[s]:
                a +=1
            elif A[a] < B[m] and B[m] > C[s]:
                m +=1
            elif C[s] >= B[m] and A[a] <= C[s]:
                s +=1
    
    ans = ans + saidai

print(ans)

Measured memory_bytes: 28008
fn main() {
    proconio::input! {
        n: usize,
    }
    let f = || {
        let mut count = 0usize;
        for i in 1..=n {
            count += i;
            if count >= n {
                return (i, count);
            }
        }
        (0, 0)
    };
    let (max, sum) = f();
    let ignore = sum - n;
    let ans = (1..=max)
        .filter(|i| *i != ignore)
        .map(|i| i.to_string())
        .collect::<Vec<_>>()
        .join("\n");
    println!("{}", ans);
}


Measured memory_bytes: 2328
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<cstring>
#include<map>
#include<vector>
#include<queue>
#include<stack>
#include<climits>
#include<set>
#include<utility>
#include<typeinfo>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef set<int> S;
#define rep(i, n) for(int i=0; i<n; i++)
const ll MOD=1e9+7;

int main(){

  int n;
  cin >> n;
  cout << (n+1)/2 << endl;

	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        byte count = 0;
        Scanner sc = new Scanner(System.in);
        String inputString = sc.nextLine();
        if(inputString.charAt(0) == '+'){
            count++;
        } else{
            count--;
        }
        if(inputString.charAt(1) == '+'){
            count++;
        } else{
            count--;
        }
        if(inputString.charAt(2) == '+'){
            count++;
        } else{
            count--;
        }
        if(inputString.charAt(3) == '+'){
            count++;
        } else{
            count--;
        }
        System.out.println(count);
    }
}

Measured memory_bytes: 21716
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin >> n;
    long long int l[n];
    int ans = 0;
    for (int i = 0; i < n; ++i){cin >> l[i];}
    //sort(l, l+n);
    for (int i = 0; i < n-2; ++i){
        for (int j = i+1; j < n-1; ++j){
            for (int k = j+1; k < n; ++k){
                if(l[i] != l[j] && l[j] != l[k] && l[i] != l[k] && l[i]+l[j] > l[k] && l[i]+l[k] > l[j] && l[j]+l[k] > l[i]){
                    ++ans;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3608