akhauriyash/Code-Regression huggingface dataset:
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define uint unsigned int
#define ull  unsigned long long
typedef string str;
typedef long long ll;
typedef double db;
typedef pair<int, int> pii;
typedef map<int, int> mii;
typedef vector<int> vi;
typedef vector<bool> vb;
#define pb push_back
#define fi first
#define se second
#define in insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
const int INF = 1e9 + 5;
const int N = 2e5 + 1;
// int a[N][N];

// int a[1][N], b[N][1];
int main(){
    speed;
    int n, m;
    cin >> n >> m;
    map<int, mii > v;
    int ok = 0;
    for(int i = 0; i < m; ++i){
        int x, y;
        cin >> x >> y;
        v[x][y] = 1;
        if(x == 1 && v[y][n]){
            ok = 1;
        }
        if(y == n && v[1][x]){
            ok = 1;
        }
    }
    if(ok){
        cout << "POSSIBLE";
    }
    else{
        cout << "IMPOSSIBLE";
    }
}

Measured memory_bytes: 41092
//  -- ILSH -- //
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define ve vector
#define vii vector < int >
#define vll vector < ll > 
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpi vector < pii >
#define vpl vector < pll >
#define viii vector < vii >
#define vlll vector < vll >
#define fi first
#define sz size 
#define len length 
#define se second 
//const ll mod=998244353;
const ll mod = 1000000000+7;
const ll N=200000+6;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll a,b;
    cin>>a>>b;
    ll c=__gcd(a,b);
    cout<<((a*b)/c)<<'\n';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
std::string n;
int s = 0;
int main() {
  std::cin >> n;
  std::reverse(n.begin(), n.end());
  for (int i = 0, k = 0; k || i < n.length(); i++) {
    if (i == n.length()) n.push_back('0');
    int w = (n[i] - '0') * 9 + k;
    k = w / 10;
    n[i] = w % 10 + '0';
    s += n[i] - '0';
  }
  for (int ans = 1; ; ans++) {
    for (int i = 0, k = 9; k; i++) {
      if (i == n.length()) n.push_back('0');
      s -= n[i] - '0';
      int w = n[i] - '0' + k;
      k = w / 10;
      n[i] = w % 10 + '0';
      s += n[i] - '0';
    }
    if (s <= 9 * ans) {
      std::cout << ans << std::endl;
      break;
    }
  }
}


Measured memory_bytes: 900
#include<stdio.h>
#define M 1000000
int MIN(int a,int b){return a<b?a:b;}
int n,r=1,x[M],y[M],z[M],bv[M],gx,gy,gz,min,m[M]={0};
int f(int a,int b,int c,int d,int e){
  x[r]=a;
  y[r]=b;
  z[r]=c;
  bv[r]=d;
  m[r]=e;
  r++;
  //printf("%d %d %d %d\n",a,b,c,m[r-1]);
  //l=abs(a-gx)+abs(b-gy)+abs(c-gz);
  min=MIN(min,m[r-1]+abs(a-gx)+abs(b-gy)+abs(c-gz));
}
int main(){
  int t;
  scanf("%d",&n);
  scanf("%d %d %d %d %d %d",&x[0],&y[0],&z[0],&gx,&gy,&gz);
  bv[0]=9;
  m[0]=0;
  min=abs(x[0]-gx)+abs(y[0]-gy)+abs(z[0]-gz);//printf("min:%d\n",min);
  /*if(x[0]<n-1)f(x[0]+1,y[0]  ,z[0]  ,9,1);
  if(x[0]>0  )f(x[0]-1,y[0]  ,z[0]  ,9,1);
  if(y[0]<n-1)f(x[0]  ,y[0]+1,z[0]  ,9,1);
  if(y[0]>0  )f(x[0]  ,y[0]-1,z[0]  ,9,1);
  if(z[0]<n-1)f(x[0]  ,y[0]  ,z[0]+1,9,1);
  if(z[0]>0  )f(x[0]  ,y[0]  ,z[0]-1,9,1);//*/
  for(t=0;r<M-20;t++){
    if(x[t]<n-1)f(x[t]+1,y[t]  ,z[t]  ,9,m[t]+1);
    if(x[t]>0  )f(x[t]-1,y[t]  ,z[t]  ,9,m[t]+1);
    if(y[t]<n-1)f(x[t]  ,y[t]+1,z[t]  ,9,m[t]+1);
    if(y[t]>0  )f(x[t]  ,y[t]-1,z[t]  ,9,m[t]+1);
    if(z[t]<n-1)f(x[t]  ,y[t]  ,z[t]+1,9,m[t]+1);
    if(z[t]>0  )f(x[t]  ,y[t]  ,z[t]-1,9,m[t]+1);
    if(bv[t]-0&&gx-x[t])f(    x[t],    z[t],n-1-y[t],0,m[t]+1);//xto
    if(bv[t]-1&&gx-x[t])f(    x[t],n-1-z[t],    y[t],1,m[t]+1);//xhan
    if(bv[t]-2&&gx-x[t])f(    x[t],n-1-y[t],n-1-z[t],2,m[t]+2);//xw
    if(bv[t]-3&&gy-y[t])f(    z[t],    y[t],n-1-x[t],3,m[t]+1);//yto
    if(bv[t]-4&&gy-y[t])f(n-1-z[t],    y[t],    x[t],4,m[t]+1);//yhan
    if(bv[t]-5&&gy-y[t])f(n-1-x[t],    y[t],n-1-z[t],5,m[t]+2);//yw
    if(bv[t]-6&&gz-z[t])f(    y[t],n-1-x[t],    z[t],6,m[t]+1);//zto
    if(bv[t]-7&&gz-z[t])f(n-1-y[t],    x[t],    z[t],7,m[t]+1);//zhan
    if(bv[t]-8&&gz-z[t])f(n-1-x[t],n-1-y[t],    z[t],8,m[t]+2);//zw
  }
  printf("%d\n",min);
  return 0;
}

      

Measured memory_bytes: 20128
#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 pq priority_queue
#define P pair<int,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
int c=0;
string s;

int main(){
	cin >> s;
	REP(i,0,s.size()) if(s[i]-'0') c++;
	cout << c << endl;
	return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
#define ff first
#define ss second
#define mp(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define check(x) cout << #x << " : " << (x) << endl
#define all(v) v.begin(),v.end() 
#define endl '\n'  
typedef long long ll; 
typedef unsigned long long ull; 
typedef long double ld;
typedef pair< ll , ll > mypair;
typedef priority_queue <ll> max_heap;
typedef priority_queue <mypair, vector<mypair>, greater<mypair> > min_heap;
const ll mod=1e9+7;
const ll inf=1e16;
const ll N=1e5+10;

int main()
{
	boost;
	int a[100];
	int n;
	cin>>n;
	for(int i=1;i<=n;i++) cin>>a[i];
	int cnt=0;
	for(int i=1;i<=n;i++) if(i!=a[i]) cnt++;
	if(cnt>2) cout<<"NO";
	else cout<<"YES";	
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
#define FOR(I,A,B) for(int I=int(A);I<int(B);++I)
 
struct RUQ{//平方分割 0-index
	int n,rn,bn,Q=0;
	vector<int> a,b,at,bt;
	RUQ(int n_){
		n = n_; rn = sqrt(n); bn = ceil((double)n/rn);
		a.resize(n,2147483647);at.resize(n,0);
		b.resize(bn,2147483647);bt.resize(n,0);
	}
	int value(int s){
		return (at[s]<bt[s/rn]?b[s/rn]:a[s]);
	}
	void updete(int s,int t,int x){
		Q++;
		FOR(i,s,t+1){
			if(i%rn==0 && (i+rn-1)<=t){
				b[i/rn] = x;
				bt[i/rn] = Q;
				i += rn-1;
			}else{
				a[i] = x;
				at[i] = Q;
			}
		}
	}
};
int main(){
	int n,q,s,t,x,com;
	cin >> n >> q;
	RUQ data(n);
	FOR(Q,1,q+1){
		cin>>com;
		if(com){//find
			cin >> s;
			cout << data.value(s) << "\n";
		}else{//updete
			cin >> s >> t >> x;
			data.updete(s,t,x);
		}
	}
}


Measured memory_bytes: 3900
#include <bits/stdc++.h>
#define MAX (ll)(4e3 + 4)
#define MOD (ll)(1e9 + 7)
#define INF (ll)(1e18 + 3)
#define PI (double)(3.14159265)

using namespace std;
using ll = long long;
using ld = long double;

int main () {
	int n;
	cin >> n;
	string st;	
	cin >> st;
	vector<int> ind[10];
	for (int i = 0; i < st.size (); i++) {
		ind[st[i] - '0'].push_back (i);
	}
	int cc = 0, sm = -1;
	for (int o = 0; o < 10; o++) {
		if (ind[o].size () == 0) {
			continue;
		}
		sm = ind[o][0];
		for (int t = 0; t < 10; t++) {
			if (ind[t].size () == 0) {
				continue;
			}
			auto xx = upper_bound (ind[t].begin (), ind[t].end (), sm);
			if (xx == ind[t].end ()) {
				continue;
			}
			int xm = *xx;
			for (int k = 0; k < 10; k++) {
				if (ind[k].size () == 0) {
					continue;
				}
				if (ind[k].back () > xm) {
					cc++;
				}
			}
		}
	}	
	cout << cc << "\n";
}
				


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

using namespace std;

const long long inf = 1e18;

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

    int n, k;
    cin >> n >> k;
    cout << ((n / 2 + n % 2 >= k) ? "YES" : "NO");
}


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

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  auto mx = max_element(a.begin(), a.end());
  pair<int, int> ans(1 << 30, -1);
  for (int i = 0; i < n; ++i)
    if (mx != a.begin() + i)
      ans = min(ans, pair<int, int>(abs(*mx - a[i] * 2), a[i]));
  cout << *mx << " " << ans.second << endl;
  return 0;
}

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

int main() {
  int N,K,c=0;
  cin >> N >> K;
  vector<int> p(N);
  for(int i=0; i<N ; i++){
    cin >> p.at(i) ;
  }
  sort(p.begin(), p.end());
  for(int i=0; i<K ; i++){
    c = c + p.at(i);
  }
  cout << c ;
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
 
#define rep(i, n)      for (int i = 0; i < (n); i++)
#define repr(i, n)     for (int i = (n) - 1; i >= 0; i--)
#define repe(i, l, r)  for (int i = (l); i < (r); i++)
#define reper(i, l, r) for (int i = (r) - 1; i >= (l); i--)
#define repi(i, l, r)  for (int i = (l); i <= (r); i++)
#define repir(i, l, r) for (int i = (r); i >= (l); i--)
#define range(a) a.begin(), a.end()
void init_io() { std::cin.tie(nullptr); std::ios::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(15); }
 
using namespace std;
using ll = long long;

int main() { init_io();
  int n; cin >> n;
  string s; cin >> s;
  cout << (s.substr(0, n / 2) == s.substr(n / 2) ? "Yes" : "No") << endl;
}


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

#define o(output) cout << output << endl

using namespace std;

string s;
int a,b,c,d;
char A,B;
priority_queue<int,vector<int>,greater<int> >small;

int main(){
  cin >> a >> b;
  if(a+b<10)o(a+b);
  else o("error");
}
  

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FASTIO ios::sync_with_stdio(false);cin.tie(0);
#define ADD +
#define SUBTRACT -
#define MULTIPLY *
#define DIVIDE /
#define MOD %
#define INCREMENT(x) ++x
#define DECREMENT(x) --x
#define in(a,b) cin>>a>>b;
#define out(a,b) cout<<a<<endl<<b<<endl;
#define scan(a) scanf("%d",&a);
#define print(a) printf("%d\n",a);
#define scanii(a,b) scanf("%d %d",&a,&b);
#define printii(a,b) printf("%d\n%d\n",a,b);
#define scaniii(a,b,c) scanf("%d %d %d",&a,&b,&c);
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define ll long long
#define ull unsigned long long
#define sll signed long long
#define pi acos(-1)
#define mod 1000000007
#define TRUE 1
#define FALSE 0
#define ZERO 0
#define MP make_pair
#define F first
#define S second
#define f1(i,a) for(int i=0;i<a;++i)
#define f2(i,a) for(int i=a-1;i>=0;--i)
#define en puts("");
#define elif else if
typedef ll int lli;
typedef sll int slli;
typedef ull int ulli;
const int sz=10000;
using namespace std;

int clue();
int result();
void show();
bool check(int n) {
    for(int i=2;i*i<=n;++i) {
        if(n%i==0)
        return false;
    }
    return true;
}


// bool cmp(pair<int,int>p,pair<int,int>q) {
//     // return p.first>q.first;//descending by first
//     // return p.first<q.first;//ascending by first
//     // return p.second>q.second;//descending by second
//     return p.second<q.second;//ascending by second
// }

bool cmp(int p,int q) {
    return p>q;//descending
    // return p<q;//ascending
}


int main() {

    int t;
    // cin>>t;
    t=1;
    while(t-->0) {
        clue();
    }

    return 0;
}
int clue() {

    int n;
    string s,p;
    cin>>n>>s>>p;
    f1(i,n) {
        cout<<s[i]<<p[i];
    }
    en

    // ()?cout<<"Yes"<<endl:cout<<"No"<<endl;
    
    return 0;
}

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

#define REP(i, n) for (int i=0;i<int(n);++i)
#define FOR(i, a, b) for (int i=int(a);i<int(b);++i)
#define EACH(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

struct HeavyLight {
  vector<vector<int> > len,tree;
  int pathCount,n;
  vector<int>size,parent,in,out,path,pathSize,pathPos,pathRoot;

  HeavyLight(vector<vector<int> >t)
    :tree(t),n(tree.size()),size(n),parent(n),in(n),out(n),
     path(n),pathSize(n),pathPos(n),pathRoot(n){
    int time=0;
    dfs(0,-1,time);
    buildPaths(0,newPath(0));
  }

  void dfs(int u, int p, int &k){
    in[u]=k++, parent[u]=p, size[u]=1;
    EACH(v,tree[u])if(*v!=p)dfs(*v, u, k),size[u]+=size[*v];
    out[u]=k++;
  }

  int newPath(int u){ pathRoot[pathCount]=u; return pathCount++; }

  void buildPaths(int u, int pt){
    path[u]=pt, pathPos[u]=pathSize[pt]++;
    EACH(v,tree[u])if(*v != parent[u])
      buildPaths(*v, 2*size[*v] >= size[u] ? pt : newPath(*v));
  }

  bool isAncestor(int p, int ch){
    return in[p] <= in[ch] && out[ch] <= out[p];
  }

  int lca(int a,int b){
    for(int root; !isAncestor(root=pathRoot[path[a]],b);a=parent[root]);
    for(int root; !isAncestor(root=pathRoot[path[b]],a);b=parent[root]);
    return isAncestor(a,b)?a:b;
  }
};

//Usage: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_5_C
int main(void){
  //ios::sync_with_stdio(false);

  int n;
  cin >> n;
  vector<vector<int> >tree(n);
  
  REP(i,n){
    int k;
    cin >> k;
    REP(j,k){
      int ch;
      cin >> ch;
      tree[i].push_back(ch);
    }
  }

  HeavyLight hl = HeavyLight(tree);

  int q;
  cin >> q;
  while(q--){
    int u,v;
    cin >> u >> v;
    cout << hl.lca(u,v) << "\n";
  }
  
  return 0;
}

Measured memory_bytes: 24432
#include <iostream>

using namespace std;

int main() {
  
   int price;
   cin >> price;
  
   bool flag = false;
  
   for(int i = 0;i <= price; i++){
     for(int j = 0; j <= price; j++){
       if( 7 * i + 4 * j == price)	flag = true;
     }
   }
  
  if(flag == false)	cout << "No" << endl;
  else cout << "Yes" << endl;
}

Measured memory_bytes: 256
N = int(input())
pre_x = 0
pre_y = 0
pre_t = 0
for n in range(N):
  t, x, y = list(map(int, input().split()))
  length = x- pre_x + y - pre_y
  if (t - pre_t) >= length and ((t - pre_t) - length) % 2 == 0:
    continue
  else:
    print('No')
    exit(0)

print('Yes')


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <climits>
#include <list>
#include <time.h>
#include <unordered_map>
#include <bitset>
#include <exception>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define FILE "file"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)
#define dinf 1e+14

typedef long long ll;
#define pb push_back
#define mp make_pair

const int maxn = 100000;
ll a[maxn];

void solve()
{
    ll a, b;
    cin >> a >> b;
    cout << (a + b + 1) / 2;
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0), cout.tie(0);
    //freopen(FILE ".in", "r", stdin);freopen(FILE ".out", "w", stdout);
    //freopen("file.in", "r", stdin);freopen("file.out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--)
    {
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
typedef pair<double, int> P;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(2);
    vector<P> ans;
    priority_queue<P, vector<P>, greater<P>> que;
    for(int i = 0; i < 3; i++)
    {
        priority_queue<P, vector<P>, greater<P>> tmp;
        for(int j = 0; j < 8; j++)
        {
            int p; cin >> p;
            double t; cin >> t;
            tmp.push(P(t, p));
        }
        ans.push_back(tmp.top()); tmp.pop();
        ans.push_back(tmp.top()); tmp.pop();
        while(tmp.size())
        {
            que.push(tmp.top());
            tmp.pop();
        }
    }
    for(int i = 0; i < 6; i++)
    {
        ans.push_back(que.top());
        que.pop();
    }
    for(int i = 0; i < 8; i++) cout << ans[i].second << " " << ans[i].first << endl;
    return 0;
}




Measured memory_bytes: 3308
//naveen mall
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define pb               push_back
#define sz(c)            (int)c.size()
#define len(c)           (int)c.length()
#define vec              vector
#define int              long long int
#define all(c)           c.begin(), c.end()
#define rall(c)          c.rbegin(), c.rend()
#define trav(a,i)        for(auto i: a)
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define invect(v,n)       for(int i=0;i<n;i++ ){int arb;cin>>arb;v.pb(arb);}
#define inset(s,n)        fl(i,0,n){int aset;cin>>aset;s.insert(aset);}
#define display(c)        trav(c,i) cout<<i<<" ";cout<<"\n";
#define F                 first
#define S                 second
#define pii               pair<int,int>
#define PB                pop_back
#define endl              "\n"
#define what(x) cerr <<  #x << " is " << x << endl;
int sum() { return 0; }template<typename T,typename... Args>T sum(T a, Args... args) { return a + sum(args...); }


void solve()
{   
	
	string s,t;
	cin>>s>>t;
	if(t.substr(0LL,len(s))==s)
		cout<<"Yes";
	else
		cout<<"No";




}
signed main()
{fast
    int t;
 t=1;
 
 //  cin>>t;
  while(t--)
     {
      solve();
     }
 
 
 
}

Measured memory_bytes: 3656
import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
		    arr[i] = sc.nextInt();
		}
		int[] sorted = (int[])(arr.clone());
		Arrays.sort(sorted);
		int base = sorted[n / 2];
		int bef = sorted[n / 2 - 1];
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < n; i++) {
		    if (arr[i] >= base) {
		        sb.append(bef);
		    } else {
		        sb.append(base);
		    }
		    sb.append("\n");
		}
		System.out.print(sb);
	}
}


Measured memory_bytes: 75212
#include <iostream>
#include <stack>
#include <algorithm>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <functional>
#include <string>
#include <cstdlib>
#include <numeric>
#include <cstdbool>
#include <map> 
#include<set>
#include<queue>

typedef long long ll;


#define rep(i,n) for(ll i=0;i<n;i++)
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; }

const long long INF = 1000000000000000;
const ll inf = -1e18;
typedef pair<ll, ll> P;
ll ma = 1000000000 + 7;
ll mx = 1000003;
ll h, w, n,m,k; string s,t;
char maze[60][60];
int dis[101][101]; int graph[52][52]; bool vis[52];
int dx[4] = { 1, 0, -1, 0 };
int dy[4] = { 0, 1, 0, -1 };
ll gcd(ll x, ll y) {
	if (x % y == 0) return y;
	return gcd(y, x % y);

}
ll lcm(ll a,ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
void comb(vector<vector <ll> >& v) {
	for (ll i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (ll k = 1; k < v.size(); k++) {
		for (int j = 1; j < k; j++) {
			v[k][j] = (v[k - 1][j - 1] + v[k - 1][j])%ma;
		}
	}
}

int GetDigit(int num) {
	return log10(num) + 1;
}

int main() {
	cin >> n;
	vector<ll> a(n);
	vector<ll> b(n);
	rep(i, n) {
		cin >> a[i];
		b[i] = 0;
	}
	for (ll i = 0; i < n-1; i++) {
		if (a[i] < a[i + 1]) {
			a[i + 1]--;
			b[i + 1] = 1;
		}
	}
	for (ll i = 0; i < n-1; i++) {
		if (a[i] > a[i + 1]&&b[i]==0) {
			a[i]--;
			b[i] = 1;
		}
	}
	rep(i, n-1) {
		if (a[i] > a[i + 1]) {
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 1792
from collections import Counter
S = list(input())
def zeroandnot0(a, b):
    if (a == 0 and b != 0) or (a != 0 and b == 0):
        return True
    else:
        return False
c = Counter(S)
if zeroandnot0(c['E'], c['W']) or zeroandnot0(c['N'], c['S']):
    print('No')
else:
    print('Yes')


Measured memory_bytes: 3316
#include<cstdio>
#include<functional>
#include<algorithm>
using namespace std;
int main(void)
{
	int x,nen,i;
	scanf("%d",&x);
	nen=x/100;
	printf("ai1333");
	for(i=0;i<nen;i++)	{
		printf("3");
	}
	printf("\n");
	return 0;
}


Measured memory_bytes: 2736
#include <bits/stdc++.h>
#pragma GCC optimize "Ofast,omit-frame-pointer,inline"
using namespace std;
typedef long long ll;

#define REP(i,n) for(int i=0; i<int(n); i++)
#define rep(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VP vector<pair<int,int>>
#define VPP vector<pair<int,pair<int,int>>>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define VB vector<bool>
#define VVB vector<vector<bool>>
#define fore(i,a) for(auto &i:a)
typedef pair <int, int> P;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
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; }

const int  INF = 1 << 29;
const ll INFL = 1LL << 60;
const ll mod = 998244353;


int main() {

	int x, y;
	cin >> x >> y;

	REP(i, x + 1) {
		int a = i * 2;
		int b = (x - i) * 4;
		int c = a + b;
		if (c == y) {
			cout << "Yes" << endl;
			return 0;
		}
	}

	cout << "No" << endl;

}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;i++)
#define INF 10000000000000000
int main(void){
    ll n,m;cin>>n>>m;
    vector<ll>v(n);rep(i,n)cin>>v[i];sort(v.begin(),v.end());
    ll x,y;
    vector<pair<ll,ll>>r(m);
    rep(i,m){cin>>x>>y;r[i]=make_pair(y,x);}
    sort(r.begin(),r.end());reverse(r.begin(),r.end());
    int count=0;
    rep(i,m){
        ll f=r[i].first,s=r[i].second;
        while(f>v[count]&&s>0){
            v[count]=f;count++;s--;
        }
    }
    ll ans=0;
    rep(i,n)ans+=v[i];
    cout<<ans;
}


Measured memory_bytes: 2560
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;

namespace AtcoderSubmit
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var L = line[0];
            var R = line[1];
            var d = line[2];
            var count = Enumerable.Range(L, R - L + 1).Count(i => i % d == 0);
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 28132
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        long H = sc.nextLong();
        long monsters = 1;
        long sum = 0;
        while(H > 0){
            H /= 2;
            sum += monsters;
            monsters *= 2;
        }
        
        System.out.println(sum);
    }
}

Measured memory_bytes: 23892
import collections
import copy

n = int(input())
now = list(input())
ans = collections.Counter(now)
now = set(now)

for i in range(n-1):
    s = list(input())
    li = collections.Counter(s)
    now = set(s) & now
    d = ans.copy()
    ans = dict()
    for i in now:
        ans[i] = min(d[i], li[i])

if len(list(ans.keys())) == 0:
    print("")
    exit()
ansli = []
for i in ans:
    ansli += [i]*ans[i]

ansli.sort()
print("".join(map(str, ansli)))

Measured memory_bytes: 3444
import sys
n, m = [int(i) for i in sys.stdin.readline().split()]
ls = []
best = 0
for i in range(n):
    x, y, z = [int(i) for i in sys.stdin.readline().split()]
    ls.append((x, y, z))

for kireisa in [-1,1]:
    for oisisa in [-1,1]:
        for ninkido in [-1,1]:
            _ls = []
            for x, y, z in ls:
                _x = x * kireisa
                _y = y * oisisa
                _z = z * ninkido
                _ls.append(_x + _y + _z)
            best = max(sum(sorted(_ls, reverse=True)[:m]), best)
print(best)

Measured memory_bytes: 40048
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
using namespace std;
int h, w, n, result;
char map[1005][1005];
bool vis[1005][1005];
int x[10], y[10];
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
struct Node
{
    int x, y;
    int step;
};
void BFS(int sx, int sy, int target)
{
    queue <Node> que;

    Node s, t;
    s.x = sx;
    s.y = sy;
    s.step = 0;
    memset(vis, false, sizeof(vis));

    que.push(s);
    vis[sx][sy] = true;

    while(!que.empty())
    {
        s = que.front();
        que.pop();

        if(map[s.x][s.y] == target + '0')
        {
            result += s.step;
            break;
        }

        for(int i = 0; i < 4; i++)
        {
            int tx = s.x + dx[i];
            int ty = s.y + dy[i];

            if(tx >= 0 && tx < h && ty >= 0 && ty < w && !vis[tx][ty] && map[tx][ty] != 'X')
            {
                vis[tx][ty] = true;
                t.x = tx;
                t.y = ty;
                t.step = s.step + 1;
                que.push(t);
            }
        }
    }

    return;
}
int main(void)
{
    while(scanf("%d%d%d", &h, &w, &n) != EOF)
    {
        for(int i = 0; i < h; i++)
            scanf("%s", map[i]);

        for(int i = 0; i < h; i++)
            for(int j = 0; j < w; j++)
            {
                if(map[i][j] == 'S')
                {
                    x[0] = i;
                    y[0] = j;
                }
                else if(map[i][j] >= '0' && map[i][j] <= '9')
                {
                    x[map[i][j] - '0'] = i;
                    y[map[i][j] - '0'] = j;
                }
            }

        result = 0;

        for(int i = 0; i < 9; i++)
        {
            BFS(x[i], y[i], i + 1);
        }

        printf("%d\n", result);
    }

	return 0;
}



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

using  namespace  std;

#define PI              acos(-1.0)
#define lcm(a,b)        (a * (b / __gcd(a,b)))
#define en '\n'

#define READ_IN freopen("Input.txt","r",stdin);
#define READ_OUT freopen("Output.txt","w",stdout);


void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define trace(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define trace(x...)
#endif

typedef long long int  ll;
typedef unsigned long long int llu;

int main(void){

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

    vector<int> ar(n);
    int sum =0;
    for(int i=0;i<n;i++)
    {cin >> ar[i];
        sum+=ar[i];
    }

    int ck = sum/(4*m*1.0);
    int cnt=0;
    for(int i=0;i<n;i++){
        if(ar[i]*4*m>=sum){
            cnt++;
        }
    }

    if(cnt>=m){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }



    return 0;
}


Measured memory_bytes: 256
s = gets.chomp
former = s[0..1].to_i
latter = s[2..3].to_i

index =
  ((former > 0 && former < 13) ? 1 : 0) +
  ((latter > 0 && latter < 13) ? 2 : 0)

puts %w(NA MMYY YYMM AMBIGUOUS)[index]


Measured memory_bytes: 1788
//#include <stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
#define PI 3.14159265359;


int main(){
				int N=0;
				cin>>N;
	if(N>=30){cout<<"Yes"<<endl;}
	else{cout<<"No"<<endl;}
	
	//Hoge* hoge=new Hoge(N);
	//hoge->func0();
	
	return 0;
	//delete hoge;
}//end of main

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using u128 = __uint128_t;

#define int long long
#define idxSet tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#define atIdx find_by_order
#define idxOf order_of_key
#define MOD 1000000007
#define MAX 200005
#define endl '\n'

#define v(type) vector<type>
#define p(type1, type2) pair<type1 , type2>
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int dp[MAX];

void solve() {
    int n;
    cin>>n;
    int a[n];
    for (int i = 0; i < n; ++i) {
        cin>>a[i];
    }
    sort(a , a + n);
    if(n == 2){
        cout<<a[1]<<" "<<a[0]<<endl;
        return;
    }
    if(a[n-1] % 2 == 0){
        int m = a[n-1] / 2;
        int ith = 0;
        int v = abs( m- a[0]);
        for(int i = 1 ; i < n - 1 ; i++){
            if(abs(a[i] - m) < v){
                v = abs(a[i] - m);
                ith = i;
            }
        }
        cout<<a[n-1]<<" "<<a[ith]<<endl;
    }else {
        int m1 = a[n-1] / 2 ;
        int m2 = m1 + 1;
        int v = min(abs(a[0] - m1) , abs(a[0] - m2));
        int ith = 0;
        for(int i = 1 ; i< n -1 ; i++){
            if(abs(a[i] - m1) < v || abs(a[i] - m2) < v ){
                v = min(abs(a[i] - m1) , abs(a[i] - m2));
                ith = i;
            }
        }
        cout<<a[n-1]<<" "<<a[ith]<<endl;
    }
}

int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
    //cin>>t;
    while (t--)
        solve();
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include<cmath>
#include<set>
#include<cstdio>
#include<algorithm>
#include<utility>
#include<queue>
#include<vector>
#include<cstring>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int INF = 0x7fffffff;
const double pi = acos(-1.0);
const int N = 100 + 5;
char s[N];
char a[26];
int main() {
	int n;
	int ans = 0;
	scanf("%d%s", &n, s);
	for (int i = 1; i < n; i++) {
		int cnt = 0;
		memset(a, 0, sizeof(a));
		int j;
		for (j = 0; j < i; j++) {
			a[s[j] - 'a']++;
		}
		while (j < n) {
			if (a[s[j] - 'a']) {
				cnt++;
				a[s[j] - 'a'] = 0;
			}
			j++;
		}
		ans = max(cnt, ans);
	}
	printf("%d", ans);
	return 0;
}


Measured memory_bytes: 256
import math
A, B, H, M = map(int,input().split())

l = 0.5*(H*60+M)
s = 6*M

d = min(abs(l-s), 360-abs(l-s))
#print(d)

c = (A**2+B**2-2*A*B*math.cos(math.radians(d)))**(0.5)
print(c)

Measured memory_bytes: 9500
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define N 105
#define INF 1000000000
typedef long long ll;
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) int(x.size())
#define IN(a) cin>>(a)
#define OUT(a) cout<<(a)<<endl
typedef pair<int,int> P;
const int MAX = 100005;
const int MOD = 1000000007;
ll dp[MAX];
int main(){
    int n,k;
    cin>>n>>k;
    vector<P>a(n);
    REP(i,n){
        int t,d;
        cin>>t>>d;
        t--;
        a[i]={d,t};
    }
    sort(ALL(a));
    reverse(ALL(a));
    vector<int>cnt(n+2,0);
    ll sum=0;
    int x=0;
    priority_queue<P,vector<P>,greater<P>>qmin;
    REP(i,k){
        sum+=a[i].first;
        if(cnt[a[i].second]==0)x++;
        cnt[a[i].second]++;
        qmin.push(a[i]);
    }
    priority_queue<P>qmax;
    vector<int>cnt2(n+2,0);
    for(int i=k;i<n;i++){
        if(cnt[a[i].second]==0&&cnt2[a[i].second]==0){
            cnt2[a[i].second]++;
            qmax.push(a[i]);
        }
    }
    dp[x]=sum;
    while(SZ(qmin)>0&&SZ(qmax)>0){
        P p=qmin.top();
        qmin.pop();
        if(cnt[p.second]>1){
            cnt[p.second]--;
            sum-=p.first;
            P r=qmax.top();
            qmax.pop();
            sum+=r.first;
            //cnt[r.second]++;
            x++;
            dp[x]=sum;
        }
    }
    ll ans=0;
    REP(i,x+3){
        if(dp[i]==0)continue;
        ans=max(ans,dp[i]+(ll)i*i);
    }
    OUT(ans);
    return 0;
}

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

int main(){

   int n;
   cin >> n;
   int mn = 3e5, ans = 0;
   for(int i = 0; i < n; i++){
      int val; cin >> val;
      mn = min(val , mn);
      if(mn >= val)  ans++;
   }  
   cout << ans << endl;

   return 0;
}

Measured memory_bytes: 256
import Control.Applicative
import Control.Monad
import Data.List

main = do
  n <- (read::String -> Int) <$> getLine
  arr <- sort . map (read::String -> Int) . words <$> getLine
  let lb = (arr !! ((n `div` 2) - 1)) + 1
      ub = arr !! (n `div` 2)
  if lb <= ub 
    then print $ ub - lb + 1
    else print 0
  

Measured memory_bytes: 29052
N=int(input())
suits=['S','H','C','D']
cards=[]

for _ in range(N):
    s,n=input().split()
    if s=='S':
        cards.append(int(n))
    elif s=='H':
        cards.append(13+int(n))
    elif s=='C':
        cards.append(26+int(n))
    else:
        cards.append(39+int(n))
for i in range(1,53):
    if i not in cards:
        print(suits[(i-1)//13],(i-1)%13+1)
    


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;A++)
#define mp make_pair
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////




ll N,A[101010];
ll mk[101010];
ll i, j, k;


int main(){
    scanf("%lld", &N);
    fornum(i,0,N){
        scanf("%lld", &A[i]);
        mk[A[i] - 1] = i;
    }
    fornum(i,0,N){
        printf("%lld ", mk[i] + 1);
    }
    return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <iomanip>

#define REP(i,n) for(int i=0;i<n;++i)
#define RREP(i,n) for(int i=n-1;i>=0;--i)
#define FOR(i,m,n) for(int i=m;i<n;++i)
#define RFOR(i,m,n) for(int i=m-1;i>=n;--i)
#define ALL(v) v.begin(),v.end()
#define PB(a) push_back(a)
#define INF 1000000001
#define MOD 1000000007

using namespace std;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	char c;
	cin >> c;
	if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl;
	}
	
	return 0;
}


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

#define int long long
#define MAX 1100
int _rank[MAX*MAX], per[MAX*MAX];

void init(){
  for(int i = 0; i < MAX*MAX; i++){
    _rank[i] = 1;
    per[i] = i;
  }
}

int find(int x){
  return x == per[x]? x : per[x] = find(per[x]);
}

void unite(int x, int y){
  y = find(y);
  x = find(x);

  if(x == y) return;

  if(_rank[y] > _rank[x]){
    per[x] = y;
  } else {
    per[y] = x;
    if(_rank[y] == _rank[x]) _rank[x]++;
  }
}

bool same(int y, int x){
  return find(y) == find(x);
}


signed main(){
  int W, H, N;
  int tx, ty;
  int x, y;
  static string T[MAX];

  int dxy[4] = {0,0,1,-1};

  cin>>W>>H;

  for(int i = 0; i < H; i++){
    cin>>T[i];
  }

  init();
  
  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){

      if(T[i][j] == 't'){
	ty = i;
	tx = j;
      }
	if(T[i][j] == '#') continue;
	
      for(int k = 0; k < 4; k++){
	int nx = j + dxy[k], ny = i + dxy[3 - k];

	if(nx < 0 || nx >= W || ny < 0 || ny >= H) continue;

	if(T[ny][nx] == '#') continue;

	unite(i*MAX + j, ny*MAX + nx);
      }
    }
  }
  cin>>N;

  if(same(0,ty*MAX + tx)){
    cout<<0<<endl;
    return 0;
  }

  for(int i = 0; i < N; i++){
    cin>>x>>y;
    
    if(T[y][x] == '.') continue;
    T[y][x] = '.';
    
    for(int k = 0; k < 4; k++){
      int nx = x + dxy[k], ny = y + dxy[3 - k];
      
      if(nx < 0 || nx >= W || ny < 0 || ny >= H) continue;
      
      if(T[ny][nx] == '#') continue;

      unite(y*MAX + x, ny*MAX + nx);
    }


    if(same(0, ty*MAX + tx)){
      cout<<i+1<<endl;
      return 0;
    }
  }


  cout<<-1<<endl;
  return 0;
}



Measured memory_bytes: 22972
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin >> a >> b;
  if(a%3==0||b%3==0||(a+b)%3==0){
    cout << "Possible" << endl;
  }
  else{
    cout << "Impossible" << endl;
  }
}

Measured memory_bytes: 3576
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
const int MAX=100000;
const int NIL=-1;

int n;
vector<int> G[MAX];
int color[MAX];

void dfs(int r,int c){
    stack<int> S;
    S.push(r);
    color[r]=c;
    while(!S.empty()){
        int u=S.top();S.pop();
        for(int i=0;i<G[u].size();i++){
            int v=G[u][i];
            if(color[v]==NIL){
                color[v]=c;
                S.push(v);
            }
        }
    }
}

void assignColor(){
    int id=1;
    for(int i=0;i<n;i++)
        color[i]=NIL;
    for(int u=0;u<n;u++)
        if(color[u]==NIL)
            dfs(u,id++);
}

int main(){
    int s,t,m,q;

    cin>>n>>m;

    for(int i=0;i<m;i++){
        cin>>s>>t;
        G[s].push_back(t);
        G[t].push_back(s);
    }

    assignColor();

    cin>>q;

    for(int i=0;i<q;i++){
        cin>>s>>t;
        if(color[s]==color[t])
            cout<<"yes\n";
        else
            cout<<"no\n";
    }
}

Measured memory_bytes: 8900
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<string>
#include<cstring>
#include<algorithm>
#include<set>
#include<map>
#include<iomanip>

#define REP(i,n) for(int i=0;i<(n);i++)
#define EPS (1e-7)
#define INF (2e9)
// cout << setprecision(10)

using namespace std;
typedef long long int ll;

int H, W;
int s[101][101];

int dp[101][101];
int main(void){
    cin >> H >> W;
    char c;
    REP(i,H) REP(j,W){
        cin >> c;
        if(c=='#') s[i+1][j+1] = 0;
        else s[i+1][j+1] = 1;
    }
    REP(i,101){
        dp[0][i] = 1000;
        dp[i][0] = 1000;
    }

    for(int i=1;i<=H;i++) for(int j=1;j<=W;j++){
        if(i==1 and j==1) continue;
        int left, up;
        left = dp[i-1][j] + int(s[i-1][j]!=s[i][j]);
        up = dp[i][j-1] + int(s[i][j-1]!=s[i][j]);
        dp[i][j] = min(left, up);
    }

    cout << ceil(double(dp[H][W]) / 2) + int(s[1][1]==0 and s[H][W]==0) << endl;

    return 0;
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{

	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);

// #ifndef ONLINE_JUDGE
// 	freopen("input.txt" , "r" , stdin);
// 	freopen("output.txt" , "w" , stdout);
// #endif

	string s;
	cin >> s;
	int k;
	if (s[0] == s[s.length() - 1])
	{
		k = s.length() - 3;

	}
	else
	{
		k = s.length() - 2;
	}

	if (k % 2)
		cout << "First" << endl;
	else
		cout << "Second" << endl;


}


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

int main(){
  int N;
  cin >> N;
  double sum = 0;
  int n = 1;

  vector<int> x(N);
  vector<int> y(N);

  for(int i = 0; i < N; i++){
    cin >> x.at(i) >> y.at(i);
  }


  int k = 1;
  for(int i = 1; i < N; i++){
    k *= i;
  }

//  cout << "K= "<< k <<endl;

  for(int i = 0; i < N; i++){
    for(int j = 0; j < N; j++){
      if(i!=j){
        sum += sqrt(pow(x.at(i)-x.at(j),2)+pow(y.at(i)-y.at(j),2));
      //  cout << i << "&" << j << ": " <<sum <<endl;
      }
    }
  }


 for(int i = 1; i <= N; i++){
   n *= i;
 }

// cout << "sum = :" << sum << endl;
// cout << "n = :" << n << endl;

 double ave = 0;
 ave = sum*k/n;

 std::cout << std::setprecision(14)  << ave << endl;


}


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

#define ll long long int
#define mod 1000000007

using namespace std;


int main()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
  
  ll n, k;
  cin >> n >> k;
  vector<pair<ll,bool>> vec;
  for(ll i = 0; i < n;i++){
      ll x;
      cin >> x;
      vec.push_back(make_pair(x,false));
  }
  if(k <= n){
       int i = 0;
  ll x = 0;
    for(;x < k;x++){
          i = vec[i].first - 1;
       
    }
    cout << i+1;
  }
  else{
  int i = 0;
  ll x = 0;
    for(;x < k;x++){
      if(vec[i].second == false){
          vec[i].second = true;
          i = vec[i].first - 1;
         
          
      }
      else
      break;
  }
  for(ll b = 0;b<vec.size();b++){
      vec[b].second = false;
  }
 
  ll p =0;
  for(;p<k;p++){
       if(vec[i].second == false){
          vec[i].second = true;
          i = vec[i].first - 1;
         
          
      }
      else
      break;
  }
  k = k-x;
  k = k%p;
  
  for(ll q = 1;q<=k;q++){
      i = vec[i].first - 1;
  }
  cout << i+1;
  }
  
}









Measured memory_bytes: 7440
#include<stdio.h>
int main()
{
int a[1000],i,n;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=n-1;i>=1;i--)
{
printf("%d ",a[i]);
}
printf("%d\n",a[0]);
return 0;
}




Measured memory_bytes: 2028
#include <iostream>

using namespace std;

int main() {
    char c[4];
    for (int i=0; i<4; i++) cin >> c[i];

    for (int i=0; i<3; i++) {
        if (c[i] == c[i+1]) {
            cout << "Bad" << endl;
            return 0;
        }
    }

    cout << "Good" << endl;
    return 0;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#include <stdio.h>
using namespace std;
int n;
struct node 
{
	int v;
	int id;
}a[100005],b[100005];
int book[100005];
int to[100005];
bool cmp(node x,node y)
{
	return x.v<y.v;
}
void solve()
{
	sort(a+1,a+n+1,cmp);
	sort(b+1,b+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		if(a[i].v>b[i].v)
		{
			cout<<"No"<<endl;
			return;
		}
	}
	for(int i=1;i<n;i++)
	{
		if(a[i+1].v<=b[i].v)
		{
			cout<<"Yes"<<endl;
			return;
		}
	}
	for(int i=1;i<=n;i++)
	{
		to[a[i].id]=b[i].id;
	}
	int qnum=0;
	for(int i=1;i<=n;i++)
	{
		int top=i,flag=0;
		while(book[top]==0)
		{
			flag=1;
			book[top]=1;
			top=to[top];
		}
		if(flag) qnum++;
	}
	if(qnum!=1)
	cout<<"Yes"<<endl;
	else
	{
		cout<<"No"<<endl;
	}
}
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	scanf("%d",&a[i].v),a[i].id=i;
	for(int i=1;i<=n;i++)
	scanf("%d",&b[i].v),b[i].id=i;
	solve();
	return 0;
} 

Measured memory_bytes: 2560
import java.util.Scanner;
import java.util.Arrays;

public class Main {

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

    void solve() {
        Scanner sc = new Scanner(System.in);
        int A=sc.nextInt();
        int B=sc.nextInt();
        if(A<=8&&B<=8){
            System.out.println("Yay!");
        }else{
            System.out.println(":(");
        }
    }
}

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

int computeDays(int y, int m, int d){
  int days = 0;
  for(int nowy=1; nowy < y; nowy++){
    if(nowy % 3 == 0){
      days += 20 * 10;
    }else{
      days += 20*5 + 19*5;
    }
  }
  for(int nowm=1; nowm < m; nowm++){
    if(y % 3 == 0){
      days += 20;
    }else{
      if(nowm % 2 == 0){
	days += 19;
      }else{
	days += 20;
      }
    }
  }
  return days + d;
}

int main(void){
  int n;
  cin >> n;
  while(n--){
    int y, m, d;
    cin >> y >> m >> d;
    cout << computeDays(1000, 1, 1) - computeDays(y, m, d) << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int n;
string s;
int a[5];
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>s;
        if(s=="AC"){
            a[0]++;
        }else if(s=="WA"){
            a[1]++;
        }else if(s=="TLE"){
            a[2]++;
        }else{
            a[3]++;
        }
    }
    cout<<"AC x "<<a[0]<<endl;
    cout<<"WA x "<<a[1]<<endl;
    cout<<"TLE x "<<a[2]<<endl;
    cout<<"RE x "<<a[3]<<endl;
    
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(long long i=0;i<n;i++)
#define REP1(i,n) for(long long i=1;i<=n;i++)
#define REP2D(i,j,h,w) for(long long i=0;i<h;i++) for(long long j=0;j<w;j++)
#define REP2D1(i,j,h,w) for(long long i=1;i<=h;i++) for(long long j=1;j<=w;j++)
#define PER(i,n) for(long long i=((n)-1);i>=0;i--)
#define PER1(i,n) for(long long i=(n);i>0;i--)
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define FORE(i,a,b) for(long long i=(a);i<=(b);i++)
#define ITE(arr) for(auto ite=(arr).begin();ite!=(arr).end();++ite)
#define ALL(a) (a.begin()),(a.end())
#define RANGE(a) (a),(a+sizeof(a))
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define YNPRT(b) cout<<((b)?"Yes":"No")<<endl
#define REV(arr) reverse(ALL(arr))
#define PRT(a) cout<<a<<endl;
#define PRTLST(arr,num) REP(_i,num) cout<<_i<<" - "<<arr[_i]<<endl;
#define PRTLST2(arr2,d1,d2) REP(_i,d1) REP(_j,d2) cout<<_i<<","<<_j<<" : "<<arr2[_i][_j]<<endl;
#define PRTLST2D(arr2,d1,d2) do{cout<<"L\t";REP(_i,d2) cout<<_i<<"\t"; cout<<endl; REP(_i,d1){cout<<_i<<"\t";REP(_j,d2){cout<<arr2[_i][_j]<<"\t";}cout<<endl;}}while(0);
#define MIN(target,v1) (target)=min(target,v1)
#define MAX(target,v1) (target)=max(target,v1)
#define P1 first
#define P2 second
#define PB push_back
#define UB upper_bound
#define LB lower_bound
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int INF_INT = 2147483647;
const ll INF_LL = 9223372036854775807LL;
const ull INF_ULL = 18446744073709551615Ull;
const ll P = 92540646808111039LL;
const int Move[4][2] = {-1,0,0,1,1,0,0,-1};
const int Move_[8][2] = {-1,0,-1,-1,0,1,1,1,1,0,1,-1,0,-1,-1,-1};
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p) {os<<"( "<<p.P1<<" , "<<p.P2<<" )";return os;}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& v) {ITE(v) os << (ite-v.begin()) << " : " << *ite <<endl;return os;}
template<typename T>
ostream& operator<<(ostream& os,const set<T>& v) {os<<" { ";ITE(v) {os<<*ite;if(ite!=--v.end()){os<<" , ";}} os<<" } ";return os;}
template<typename T1,typename T2>
ostream& operator<<(ostream& os,const map<T1,T2>& m) {ITE(m) {os<<ite->P1<<"\t\t|->\t\t"<<ite->P2<<endl;} return os;}

//---------------------
#define MAXN 10005
//---------------------
ll n,a[MAXN];
bool init(){
    cin>>n;
    ZERO(a);
    if(n<=0) return false;
    REP(i,n){
        cin>>a[i];
    }
    return true;

}

int main()
{
    while(init()){
        ll sum=0;
        REP(i,n) sum+=a[i];
        double avg= sum/double(n);
        ll ct=0;
        REP(i,n) if(a[i]<=avg) ct++;
        cout<<ct<<endl;
    }
    return 0;
}



Measured memory_bytes: 3176
import numpy as np

n, m, q = map( int, input().split() )
#print( n, m, q )


a = [ 0 ] * q
b = [ 0 ] * q
c = [ 0 ] * q
d = [ 0 ] * q
for i in range( q ):
    a[ i ], b[ i ], c[ i ], d[ i ] = map( int, input().split() )
#    print( a[ i ], b[ i ], c[ i ], d[ i ] )


def loopA( ai ):
    global ans

    if ai == n:
#        print( A )
        sumA = int( 0 )
        for j in range( q ):
            if A[ b[j]-1 ] - A[ a[j]-1 ] == c[j]:
                sumA += d[ j ]
        ans = max( ans, sumA )

    elif ai <= n-1:
        for i in range( 1 if ai == 0 else A[ ai-1 ], m+1 ):
            A[ ai ] = i
            loopA( ai+1 )



A = [ 1 ] * n
ans = int( 0 )

loopA( 0 )
print( ans )


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

// input
string A, B;


void input() {
    cin >> A >> B;
}


int main() {
    input();
    int an = A.size();
    int bn = B.size();
    string ans;
    if (an != bn) {
        if (an > bn) ans = "GREATER";
        else ans = "LESS";
        cout << ans << endl;
        return 0;
    }
    rep(i, an) {
        if (A[i] != B[i]) {
            if (A[i] > B[i]) ans = "GREATER";
            else ans = "LESS";
            cout << ans << endl;
            return 0;
        }
    }
    ans = "EQUAL";
    cout << ans << endl;
}


Measured memory_bytes: 3620