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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

class union_find{
	vector<int> a;
public:
	union_find(int n):a(n,-1){}
	int find(int x){
		if(a[x]<0) return x;
		return a[x]=find(a[x]);
	}
	void unite(int x,int y){
		x=find(x),y=find(y);
		if(x!=y){ a[x]+=a[y]; a[y]=x; }
	}
	int size(int x){ return -a[find(x)]; }
};

int main(){
	int n,k,l; scanf("%d%d%d",&n,&k,&l);

	union_find U1(n);
	rep(i,k){
		int u,v; scanf("%d%d",&u,&v); u--; v--;
		U1.unite(u,v);
	}

	union_find U2(n);
	rep(i,l){
		int u,v; scanf("%d%d",&u,&v); u--; v--;
		U2.unite(u,v);
	}

	int m1=0;
	map<int,int> f1;
	vector<int> id1(n);
	rep(u,n){
		int p=U1.find(u);
		if(f1.count(p)==0) f1[p]=m1++;
		id1[u]=f1[p];
	}

	int m2=0;
	map<int,int> f2;
	vector<int> id2(n);
	rep(u,n){
		int p=U2.find(u);
		if(f2.count(p)==0) f2[p]=m2++;
		id2[u]=f2[p];
	}

	union_find W(n);
	map<pair<int,int>,int> g; // representative
	rep(u,n){
		pair<int,int> a(id1[u],id2[u]);
		if(g.count(a)==0) g[a]=u;
		else              W.unite(u,g[a]);
	}
	rep(u,n) printf("%d ",W.size(u));

	return 0;
}


Measured memory_bytes: 33024
#include "bits/stdc++.h"
using namespace std ;


vector < vector < int > > g(100005) ;
map < long long , int > m ;
long long h( int a , int b ){
	int x = min(a,b) ;
	int y = max(a,b ) ;
	long long z = x*(1e6) + y ;
	return z ;
}
bool V[100005] ;
int K ;
void DFS( int u , int p ){
	int c = 1 ;
	V[u] = 1 ;
	int k ; 
	if( p == - 1)  k = -1 ;
	else k = m[h(p,u)] ;
	for( int i = 0 ; i  < g[u].size() ; i++ ){
		int v = g[u][i] ;
		if( !V[v] ){
			if( c == k ){
				c++ ;
			}
			m[h(u,v)]  = c ;
			c++ ;
			DFS(v,u) ;
		}
	}
}	
vector < pair < int , int > > p ;
int main(){
	int n , a, b ;
	cin >> n ;

	for( int i = 0 ; i < n-1 ; i++ ){
		cin >> a >> b ;
		p.push_back({a,b});
		g[a].push_back(b) ;
		g[b].push_back(a) ;
	}
	for( int i = 1 ; i <= n ; i++ ){
		K = max(( int)g[i].size(),K) ;
	}
	DFS(1,-1);
	cout << K << endl ; 
	for( int i = 0 ; i < p.size() ; i++ ){
		cout << m[h(p[i].first,p[i].second)] << endl ;
	}
	return 0 ;
}

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

int main(){
  int N;
  cin >> N;
  vector<int> A(100050);
  for (int i = 1; i <= N; i++){
    cin >> A.at(i);
  }
  
  int B = 1,C;
  bool D = false;
  int j;
  for( j = 1; j <= N; j++){
    C = A.at(B);
    if (C == 2){
      D = true;
      break;
    }
    B = C;
  }
  cout << (D ? j : -1) << endl;
}

Measured memory_bytes: 640
#include<iostream>
#include <algorithm>
#include<string>
#include<math.h>
#include <bits/stdc++.h>
using namespace std;
int main() {
    int x,a;
    cin>>x>>a;
    if(x>=13)cout<<a<<endl;
    else if(x<=5)cout<<0<<endl;
    else cout<<a/2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define loops(i, s, n) for (int i = s; i < n; i++)
#define loop(i, n) for (int i = 0; i < n; i++)
#define eps 1e-9
#define loopitr(mp) for (auto itr = mp.begin(); itr != mp.end(); itr++)
#define init(arr, n, val)       \
    for (int i = 0; i < n; i++) \
        arr[i] = val;
#define even_set 0xAAAAAAAA ... 1010101010
#define odd_set 0x55555555 ... 01010101
#define fastio                        \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
#define vall(v) v.begin(), v.end()
#define mkp make_pair
#define ret return
#define cont continue
#define nl endl
#define ff first
#define ss second
#define cnt_bits __builtin_popcount
#define init(arr, n, val)       \
    for (int i = 0; i < n; i++) \
        arr[i] = val;
const int mod = 1000000007;
bool dp[100001];
int main()
{

    fastio;
    int n, k;
    cin >> n >> k;
    int arr[n];
    for (int &x : arr)
    {
        cin >> x;
    }

    
    dp[0] = false;

    loops(i, 1, k + 1)
    {
        for (int x : arr)
        {
            if (i >= x && !dp[i - x])
                dp[i] = true;
        }
    }

    if (dp[k] == true)
        cout << "First" << endl;
    else
        cout << "Second" << endl;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e18+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

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

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

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

vector<pair<ll,ll>> factorize(ll n) {
    vector<pair<ll,ll>> res;
    for (ll i = 2; i*i <= n; ++i) {
        if (n%i) continue;
        res.emplace_back(i,0);
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) res.emplace_back(n,1);
    return res;
}

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

    ll n;
    cin>>n;
    ll ans=0;

    REP(i,n,2*n){
        vector<pair<ll,ll>> f = factorize(i);
        if(f.size()==1){
            if(f[0].second == 1){
                ans = i;
                break;
            }
        }
    }
    cout<<ans<<endl;
    return  0;
}


Measured memory_bytes: 256
readints()=parse.(Int,split(readline()))
readint()=parse.(Int,readline())

function ABC_E()
    N=readint()
    x=zeros(Int,N)
    y=zeros(Int,N)
    for i in 1:N
        x[i],y[i]=readints()
    end

    xay=x+y
    xmy=x-y
    zmi=minimum(xay)
    zma=maximum(xay)
    wmi=minimum(xmy)
    wma=maximum(xmy)

    maxD = maximum([zma-zmi,wma-wmi])
    print(maxD)
end

ABC_E()

Measured memory_bytes: 227640
#include <iostream>
// #include <algorithm>

using namespace std;

int main() {
	int n, m; cin >> n >> m;
	int maxl = 0, minr = 100005;
	for (int i = 0; i < m; ++i) {
		int l, r; cin >> l >> r;
		maxl = max(maxl, l);
		minr = min(minr, r);
	}
	if (maxl <= minr)cout << minr - maxl + 1 << endl;
	else cout << 0;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
#include <set>
using namespace std;
typedef long long ll;

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

  int takahashi = a;
  int aoki = c;
  while (true) {
    aoki = aoki - b;
    if (aoki <= 0) {
      cout << "Yes" << endl;
      return 0;
    }

    takahashi = takahashi - d;
    if (takahashi <= 0) {
      cout << "No" << endl;
      return 0;
    }
  }
  return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define mod 1000000007
#define int long long
#define ll long long
#define EPS 0.00000000000001
#define ld long double
#define inf 2000000000000
#define N 200000

int32_t main()
{
    IOS;

    int n,k;
    cin >> n >> k;
    int ans = 0;
    vector<int> v(n);
    vector<int> d(n,0);
    for(int i = 0;i < n;i++)
    {
        cin >> v[i];
        if(i > 0 and v[i] < v[i - 1])
            d[i] = 1;
    }
    set<int> s;
    int td = 0;
    for(int i = 0;i < k;i++)
    {
        td += d[i];
        s.insert(v[i]);
    }
    if(td)
        ans++;
    // cerr << td << endl;
    for(int i = k;i < n;i++)
    {
        // cerr << d[i - k +1] << " " << d[i] << " " << td << endl;
        td -= d[i - k + 1];
        td += d[i];
        int temp = *s.begin();
        s.erase(v[i - k]);
        if(d[i] == 1 or v[i] < *s.rbegin())
            ans++;
        else
            if(temp == v[ i - k])
            {
                ;
            }
            else
            {
                if(td)
                    ans++;
            }
        s.insert(v[i]);
        // cerr << ans << endl;
        // cerr << td << " " << d[i- k + 1] << " " << d[i] << endl;
    }
    int original = 0;
    int cnt = 1;
    for(int i = 1;i < n;i++)
    {
        if(v[i] < v[i - 1])
        {
            if(cnt >= k)
                original = 1;
            cnt = 1;
        }
        else
            cnt++;
    }
    if(cnt >= k)
        original = 1;
    cout << ans + original;

    return 0;
}
 
 

Measured memory_bytes: 12800
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(),(x).end()
 
using namespace std;
using ll = long long;
 
struct edge { int to, cost; };
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int MOD = 1e9+7;
const double EPS = 1.0e-10;
const double PI = acos(-1.0);
 
const int mx4[] = {0,1,0,-1};
const int my4[] = {1,0,-1,0};
const int mx8[] = {0,1,1,1,0,-1,-1,-1};
const int my8[] = {1,1,0,-1,-1,-1,0,1};

int main() {
	int flag = 1;
	string s;
	cin >> s;
	int l = 0,r = s.size()-1;
	while(l < r){
		if(s[l] != s[r]) flag = 0;
		l++,r--;
	}
	l = 0,r = (s.size()-1)/2-1;
	while(l < r){
		if(s[l] != s[r]) flag = 0;
		l++,r--;
	}
	l = (s.size()+3)/2-1,r = s.size()-1;
	while(l < r){
		if(s[l] != s[r]) flag = 0;
		l++,r--;
	}
	cout << (flag ? "Yes" : "No") << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

ll cnt[26] = {};
static const ll MAX = 200001;
ll dp[MAX] = {};

int main() {
   
    string s;
    cin >> s;
    dp[1] = 1;
    cnt[s[0] - 'a']++;
    for (ll i=1;i<s.length();i++){
        dp[i+1] = dp[i] + (i - cnt[s[i] - 'a']);
        cnt[s[i] - 'a']++;
    }
    cout << dp[s.length()] << endl;
}




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

using namespace std;

typedef long long ll;

const ll maxn = 30;
const ll ZERO = 0;
const ll SADAT = 7.84e-17;
const ll INF = 1e10;
const ll mod = 1e9+7;

#define endl '\n'
#define dokme(x) cout << x ;  return(0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);

int n ;
int a[maxn] , b[maxn] ,c[maxn];

int main(){
	cin >> n;
	for (int i = 0 ; i < n ; i ++){
		cin >> a[i];
	}
	for (int i =0 ; i < n ; i ++){
		cin >> b[i];
	}
	for (int i = 0 ; i < n-1 ; i ++){
		cin >> c[i];
	}
	ll ans = 0;
	for (int i = 0; i < n ; i++){
		ans += b[a[i]-1];
		if (i> 0){
			if (a[i-1] + 1 == a[i]){
				ans+=c[a[i-1]-1];
			}
		}
	}
	cout << ans;

	return(0);
}
//When we hit our lowest point, we are open to the greatest change.
//If I try, I fail. If I don't try, I'm NEVER GOING TO GET IT.
//Sometimes, l is like this dark tunnel. You can't always see the light at the end of the tunnel. But if you just keep moving... you will come to a better place.


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

int main() {
	int n, m, A[300][300], player[300] = { 0 }, pos[300] = { 0 };
	bool isremove[301] = { false };
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			scanf("%d", &A[i][j]);
			A[i][j]--;
		}
		player[A[i][0]]++;
	}
	int min_player = n;
	for (int remove = 1; remove < m; remove++) {
		int max_player_idx = 0;
		for (int i = 1; i < m; i++)
			if (player[max_player_idx] < player[i])
				max_player_idx = i;
		min_player = std::min(min_player, player[max_player_idx]);
		isremove[max_player_idx] = true;
		for (int i = 0; i < m; i++)
			player[i] = 0;
		for (int i = 0; i < n; i++) {
			for (; isremove[A[i][pos[i]]]; pos[i]++);
			if (pos[i] != m)
				player[A[i][pos[i]]]++;
		}
	}
	int max_player_idx = 0;
	for (int i = 1; i < m; i++)
		if (player[max_player_idx] < player[i])
			max_player_idx = i;
	min_player = std::min(min_player, player[max_player_idx]);
	printf("%d\n", min_player);
}


Measured memory_bytes: 512
N, A, B = map(int, input().split())

a = N // (A + B) #青赤のボールの塊の組み合わせが何個できるか
b = N %  (A + B) #そのあまり個数

if b <= A:
    num = a * A + b
else:
    num = a * A + A

print(num)



Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for (int i = 0; i <= (n); ++i)
#define rip(i,n) for (int i = 1; i <= (n); ++i)
using namespace std;
int main() {
	int n, k; cin >> n >> k;
	string s; cin >> s;
	if (s[k - 1] == 'A') {
		s[k - 1] = 'a';
	}
	else if (s[k - 1] == 'B') {
		s[k - 1] = 'b';
	}
	else if (s[k - 1] == 'C') {
		s[k - 1] = 'c';
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 256
N = int(input())
S = []

dic = dict()

for _ in range(N):
	s = ''.join(sorted(input()))
	
	if not s in dic:
		dic[s] = 1
	else:
		dic[s] += 1
	
ans = 0

for key, val in dic.items():
	if val > 1:
		ans += (val * (val - 1)) / 2
		
print(int(ans))

Measured memory_bytes: 60504
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<map>
#include<iomanip>


using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep(i,n) for(int i=0;i<(n);i++)
#define printfloat(x) cout << setprecision(7) << (x) << endl;

long double pi = 3.14159265359;

map<string,int> mp;
int n;
int main(){
    cin >> n;
    string s;
    rep(i,n){
        cin >> s;
        mp[s]++;
    }
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;

return 0;
}

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

int main() {
  int N,f,sum=0;
  cin >> N;
  f=N;
  while(f>0) {
    sum+=f%10;
    f/=10;
  }
  if(N%sum==0) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>
 int main(void)
 {
         int S;
         scanf("%d",&S);
         int h = S / 3600;
         int m = S % 3600 / 60;
         int s = S % 3600 % 60;
         if(S >= 0 && S < 86400){
                 printf("%d:%d:%d\n",h,m,s);
         }else{
                 printf("0???86400????????§??\???\n");
         }
         return 0;
 }

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define debug(x) cerr << "[(" << __LINE__ << ") " << (#x) << "]: " << x << endl;

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

    int n;
    cin >> n;
    int a[n];
    int duh = 0;
    for (int& e: a) {
        cin >> e;
        duh ^= e;
    }
    for (int i=0; i<n; i++) cout << (duh ^ a[i]) << " ";
    cout << "\n";
}


Measured memory_bytes: 4280
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり


N,P = MI()
A = LI()

x = sum(A[i] % 2 == 0 for i in range(N))  # Aiの中で、偶数であるものの個数
y = N-x  # Aiの中で、奇数であるものの個数

if y == 0:
    print(0 if P == 1 else 2**x)
else:
    print(2**(x+y-1))


Measured memory_bytes: 61996
#include<bits/stdc++.h>
using namespace std;
int main () {
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	int mx, mn; 
	mx = max(a , max(b, max(c, max(d , e))));
	mn = min(a , min(b, min(c, min(d , e))));
	if(mx - mn > k)
	cout << ":("; 
	else 
	cout << "Yay!";
}

Measured memory_bytes: 256
#include <iostream>

int main(){
  long A, B;
  int K;
  std::cin >> A >> B >> K;
  for(int i = 0; i < K; i++){
    if(A+i <= B) std::cout << A+i << std::endl;
  }
  for(int i = K-1; i >= 0; i--){
    if(B-i > A+K-1) std::cout << B-i << std::endl;
  }
}

Measured memory_bytes: 256
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

struct point {
  ld x, y;

  point() {}

  point(ld _x, ld _y): x(_x), y(_y) {}

  bool read() {
    double xx, yy;
    if (scanf("%lf%lf", &xx, &yy) < 2) {
      return false;
    }
    x = xx;
    y = yy;
    return true;
  }

  point operator - (const point &p) const {
    return point(x - p.x, y - p.y);
  }

  ld operator ^ (const point &p) const {
    return x * p.y - y * p.x;
  }

  ld slen() const {
    return x * x + y * y;
  }

  ld len() const {
    return sqrt(slen());
  }
};

point a, b, c;

int read() {
  if (!a.read() || !b.read() || !c.read()) {
    return false;
  }
  return true;
}

void solve() {
  ld s = abs((b - a) ^ (c - a));
  ld ha = s / (c - b).len(), hb = s / (a - c).len(), hc = s / (b - a).len();
  ld len = max((b - a).len(), max((c - b).len(), (a - c).len()));
  ld l = 0, r = 1e4;
  for (int it = 0; it < 200; it++) {
    ld m = (l + r) / 2;
    if (m > hc - eps) {
      r = m;
    }
    ld kc = (hc - m) / hc;
    ld hb0 = hb * kc;
    if (m > hb0 - eps) {
      r = m;
    }
    ld kb = kc * (hb0 - m) / hb0;
    ld ha0 = ha * kb;
    if (m > ha0 - eps) {
      r = m;
    }
    ld ka = kb * (ha0 - m) / ha0;
    if (len * ka < 2 * m) {
      r = m;
    } else {
      l = m;
    }
  }
  printf("%.20f\n", (double) l);
}

int main() {
  precalc();
#ifdef LOCAL
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (true) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws IOException {

		Scanner scan = new Scanner(System.in);

		int A, B;
		A = scan.nextInt();
		B = scan.nextInt();

		if (A <= 8 && B <= 8) {
			System.out.println("Yay!");
		} else {
			System.out.println(":(");
		}
	}

	//***********************以下共通関数************************************************
	/**
	 * 文字列を反転して返す
	 * @param pStr 文字列
	 * @return 反転した文字列
	 */
	public static String myReverse(String pStr) {
		if (pStr.length() < 1) {
			return "";
		}

		StringBuffer sb = new StringBuffer(pStr);
		return sb.reverse().toString();
	}

	/**
	 * 余りを求める。
	 * @param a
	 * @param b
	 * @return 余り。余りがマイナスの時はプラスで返す。
	 */
	public static long myMod(long a, long b) {
		long ret = 0;

		ret = a % b;

		if (ret < 0) {
			ret += b;
		}

		return ret;
	}

	/**
	 * 乗数を求める ※mod対応
	 * @param kisu 基数
	 * @param josu 乗数
	 * @param primeNumMod_0 法 mod値 使わない場合は「0」
	 * @return
	 */
	public static long myPowWithMod(long kisu, long josu, long primeNumMod_0) {

		long ans = 1;

		//乗数が0の場合→1
		if (josu == 0)
			return 1;

		if (primeNumMod_0 == 0) {
			//modを使わないとき

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= kisu;
					josu = josu / 2;
				} else {
					//累乗が奇数の時
					ans *= kisu;
					josu--;
				}
			}

			return ans;

		} else {
			//modを使うとき

			//初めに桁を落とす
			kisu = myMod(kisu, primeNumMod_0);

			while (josu > 0) {

				if (josu % 2 == 0) {
					//累乗が偶数の時

					kisu *= myMod(kisu, primeNumMod_0);
					josu = josu / 2;

				} else {
					//累乗が奇数の時
					ans *= myMod(kisu, primeNumMod_0);
					josu--;

				}
			}

			return myMod(ans, primeNumMod_0);

		}

	}

}


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

int main() {
  char A, B;
  cin >> A >> B;
  
  if (A == 'H') {
    cout << B << endl;
  } else {
    if (B == 'H') cout << "D" << endl;
    else cout << "H" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define REP1(i,a,b) for(int i=a; i<=(int)(b); i++)
#define ALL(x) begin(x),end(x)
#define PB push_back
using namespace std;
typedef int64_t LL;
typedef vector<int> VI;
typedef pair<int,int> PII;

LL n;
LL solve(LL x, LL k) {
    if(x<=1) return k;
    return k + solve(x/2, k*2);
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    cin >> n;
    LL ans = solve(n, 1);
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i, n) for(ll i=1;i<=(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define MOD 1000000007
#define INF 1000000000

void solve_abc_a() {
	ll n, m;
	ll x, y;
	//ll a, b, c, d;
	ll h;
	ll k;
	string s, t;
	char c;
	ll l_ans = 0;
	string s_ans = "NG";

	cin >> c;

	char d = 'a';

	if (c - d >= 0) {
		s_ans = "a";
	}
	else {
		s_ans = "A";
	}

	cout << s_ans << "\n";

	return;
}


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

	solve_abc_a();

	return 0;
}

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

typedef uint64_t u64;
typedef int64_t i64;
typedef uint32_t u32;
typedef int32_t i32;

using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

bool Sec_compare(pair<uint64_t, uint64_t> a, pair<uint64_t, uint64_t> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

u64 dec_dig(u64 num) {
  u64 res = 0;
  while (num > 0) {
    num /= 10;
    ++res;
  }
  return res;
}

u64 gcd(u64 a, u64 b) {
  if (a < b) {
    a ^= b;
    b ^= a;
    a ^= b;
  }

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

u64 lcm(u64 a, u64 b) { return (a / gcd(a, b)) * b; }

int main() {
  u64 H, A;
  cin >> H >> A;
  if ((H % A) == 0) {
    cout << H / A << endl;
  } else {
    cout << (H / A) + 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
 #include <vector>
 #include <algorithm>
 using namespace std;
  
 struct UnionFind {
     //自身が親であれば、その集合に属する頂点数に-1を掛けたもの
     //そうでなければ親のid
     vector<int> r;
  
     UnionFind(int N) {
         r = vector<int>(N, -1);
     }
  
     int root(int x) {
         if (r[x] < 0) return x;
         return r[x] = root(r[x]);
     }
  
     bool unite(int x, int y) {
         x = root(x);
         y = root(y);
         if (x == y) return false;
         if (r[x] > r[y]) swap(x, y);
         r[x] += r[y];
         r[y] = x;
         return true;
     }
  
     int size(int x) {
         return -r[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 -= 1; B -= 1;
         UF.unite(A, B);
     }
  
     //最大の友達集合を求める
     int ans = 0;
     for (int i = 0; i < N; i++)
     {
         ans = max(ans, UF.size(i));
     }
  
     cout << ans << endl;
 }

Measured memory_bytes: 4020
#include<bits/stdc++.h>
//#include<iostream>
//#include<cstring>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;

void init();
void work();

int main(){
//    freopen("in.txt","r",stdin);
    ios::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);
//    init();
//    int T;cin>>T;
//    while(T--)
    work();
    return 0;
}
void work(){
    ll x,y;
    cin>>x>>y;
    ll t=x>y?x-y:y-x;
    if(t<=1) cout<<"Brown";
    else cout<<"Alice";
}


Measured memory_bytes: 256
/* ex4_2 melo */
#include <stdio.h>
#include <math.h>//数学関数のヘッダーファイルを読み込む
#define PI 3.141592653589793238//円周率PIを十分な長さ定義する
int main(void){
    int lenN,lenM,hour,min;//整数の箱を四つ用意する
    double angleN,angleM,angleN_M,lenN_M;//倍精度の実数の箱を四つ用意する
    scanf("%d%d%d%d",&lenN,&lenM,&hour,&min);//時針の長さ、分針の長さ、H時、M分を代入する
    angleN=(2*PI/12)*hour+(2*PI/720)*min;//時針の0時から進んだ角度
    angleM=(2*PI/60)*min;//分針の0分から進んだ角度
    angleN_M=angleN-angleM;//時針と分針のなす角度（余弦なので-をとってもPIを超えていてもx軸対象なので問題ない）
    lenN_M=sqrt(lenN*lenN+lenM*lenM-2*lenN*lenM*cos(angleN_M));//余弦定理から、三角形の各辺A,B,Cと角ｃでC^2=A^2+B^2-2ABcos(c)が成り立つことを利用する
    printf("%.18lf\n",lenN_M);
    return 0;
}


Measured memory_bytes: 2556
#include "bits/stdc++.h"
using namespace std;

int main() {
    int n,q;
    cin >> n >> q;
    string s;
    cin >> s;
    vector<int>pref(n+1);
    for(int i = 0;i<n-1;i++){
        if(s[i] == 'A' && s[i+1] == 'C')pref[i+2] = pref[i+1] + 1;
        else pref[i+2] = pref[i+1];
    }
    for(int i = 0;i<q;i++){
        int l,r;
        cin >> l >> r;
        cout << pref[r] - pref[l] << '\n';
    }
    return 0;
}

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

const int A = 1000005;

int gcd(int x, int y){
    if(x % y == 0) return y;
    return gcd(y, x % y);
}

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    vector<int> c(A);
    rep(i,n) {
        cin >> a[i];
        c[a[i]]++;
    }

    //pairwise判定
    bool pairwise = true;
    //素因数iを約数にもつ要素が複数ある場合は、pairwiseではない
    for (int i = 2; i < A; i++) {
        int cnt = 0;
        //i=2なら2,4,6,8,...を調べていく
            for (int j = i; j < A; j += i) {
                cnt += c[j];
            }
        if (cnt > 1) pairwise = false;
    }
    if (pairwise) {
        cout << "pairwise coprime" << endl;
        return 0;
    }

    //setwise判定
    int g = 0;
    rep(i,n) g = gcd(g,a[i]);
    if (g == 1) {
        cout << "setwise coprime" << endl;
        return 0;
    }

    //当てはまらなければ、not coprime
    cout << "not coprime" << endl;
    return 0;
}



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

struct point{
  int win, lose, draw;
  string name;

  void clear()
  {
    win = lose = draw = 0;
    name = "";
  }
};

bool operator<(point a, point b)
{
  return (a.win != b.win)? a.win > b.win: a.lose < b.lose;
}

int main()
{
  multiset<point> team;
  multiset<point>::iterator it;
  int n, i, j, m;
  string s;
  point t;
  while (cin>>n, n) {
    team.clear();
    for (i = 0; i < n; i++) {
      t.clear();
      cin>>s;
      t.name = s;
      for (j = 0; j < n-1; j++) {
	cin>>m;
	if (m == 0) t.win++;
	if (m == 1) t.lose++;
	if (m == 2) t.draw++;
      }
      team.insert(t);
    }
    for (it = team.begin(); it != team.end(); it++)
      cout<<(*it).name<<endl;
  }
  return 0;
}

Measured memory_bytes: 0
N,T = map(int,input().split())
A = list(map(int,input().split()))
LST = []

for a in A:
  LST.append((a,1))
  LST.append((a+T,-1))
  
LST.sort()

prev = -1
s = 0
ans = 0
for x,y in LST:
  if y == 1:
    s += 1
    if s == 1:
      prev = x
  elif y == -1:
    s -= 1
    if s == 0:
      ans += (x - prev)
  
print(ans)



Measured memory_bytes: 54976
package main

import (
	"fmt"
	"math"
)

func main() {
	var (
		n int
	)
	fmt.Scan(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}
	ans := float64(math.Pow10(9))
	for _, v := range a {
		c := 0
		for v % 2 == 0 {
			v /= 2
			c++
		}
		ans = math.Min(float64(ans), float64(c))
	}
	fmt.Println(ans)
}


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

int main() {
    int a, b; cin >> a >> b;
    if (a > b) {
        for (int i = 0; i < a; i++) {
            cout << b << flush;
        }
    } else {
        for (int i = 0; i < b; i++) {
            cout << a << flush;
        }
    }
    cout << endl;
}


Measured memory_bytes: 256
import math
import string
import collections
from collections import Counter
from collections import deque


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
n = int(input())
h = readints()
#print('h', h)


def func(h):
    for i in range(len(h)):
        if h[i] == 0:
            return i
    return len(h)


ans = 0
for i in range(n):
    for j in range(h[i]):
        cnt = func(h[i:])
        ans += 1
        for k in range(0, cnt):
            h[i+k] = h[i+k]-1
print(ans)


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

struct start { start() {
cin.tie(0);
ios::sync_with_stdio(0);
cout << fixed << setprecision(10);
}; }start;

typedef long long ll;


int main(){
    int s;
    cin >> s;
    cout << s / 3600 << ":" << (s%3600)/60 << ":" << (s%3600)%60 << endl;
    return 0;
}


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

const int N = 2000 + 10 ;
const int inf = 2e9 ;

int dp[N][3] , arr[N] , n ;

int rec( int pos , int moves , int p1 , int p2 ) {
    if( pos > n ) return abs( p1 - p2 ) ;
    int &ret = dp[pos][moves] ;
    if( ret != -1 ) return ret ;
    if( moves & 1 ) ret = -inf ;
    else ret = inf ;
    if( moves&1 ) {
        for( int i = pos ; i <= n ; i++ ) {
            ret = max( ret , rec( i+1 , moves ^ 1 , arr[i] , p2 ) ) ;
        }
    }else {
        for( int i = pos ; i <= n ; i++ ) {
            ret = min( ret , rec( i+1 , moves ^ 1 , p1 , arr[i] ) ) ;
        }
    }
    return ret ;
}

int main() {
    int z , w ;
    scanf("%d %d %d" , &n , &z , &w ) ;
    for( int i = 1 ; i <= n ; i++ ) scanf("%d" , &arr[i] ) ;
    memset( dp , -1 , sizeof(dp) ) ;
    int ans = rec( 1 , 1 , z , w ) ;
    printf("%d\n" , ans ) ;
    return 0 ;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main() {
  int  n,d;
  cin>>n>>d;
  vector<vector<double> > v(n+1,vector<double>(d+1));
  for(int i=1;i<=n;i++)
  {
      for(int j=1;j<=d;j++)
      cin>>v[i][j];
  }
  int res=0;
  for(int i=1;i<=n;i++)
  {
      for(int j=i+1;j<=n;j++)
      {
          double val=0;
          for(int k=1;k<=d;k++)
          {
              val+=pow((v[i][k]-v[j][k]),2);
          }
           val=sqrt(val);
          if(floor(val)==val)
          res++;
      }
  }
  cout<<res<<endl;
}


Measured memory_bytes: 256
#include <iostream>

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

    int n, t; std::cin >> n >> t;
    int64_t r = 0;
    int tlast; std::cin >> tlast; n--;
    while (n--) {
        int tnow; std::cin >> tnow;
        r += std::min(t, tnow - tlast);
        tlast = tnow;
    }
    r += t;
    std::cout << r << std::endl;
}



Measured memory_bytes: 256
def main():
    N = int(input())
    freq = {}
    for i in range(1, N+1):
        pair = str(i)[0] + str(i)[-1]
        freq.setdefault(pair, 0)
        freq[pair] += 1
    
    ans = 0
    for i in range(1, N+1):
        pair_rev = str(i)[-1] + str(i)[0]
        if pair_rev in freq.keys():
            ans += freq[pair_rev]
    
    print(ans)
     
      
if __name__ == "__main__":
    main()

Measured memory_bytes: 3064
n,m=map(int,input().split())
a=[1]*n
ans=set([1])
for i in range(m):
  x,y=map(int,input().split())
  if a[x-1]==0:continue
  else:
    a[x-1]-=1
    a[y-1]+=1
    if x in ans:
      ans.add(y)
      if a[x-1]==0:ans.remove(x)
print(len(ans))

Measured memory_bytes: 12652
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <vector>
#include <string>

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

int main()
{
    int N;
    cin >> N;

    int maxLength = 0;
    int total = 0;
    for ( int i = 0; i < N; ++i )
    {
        int l;
        cin >> l;
        maxLength = max( maxLength, l );
        total += l;
    }

    cout << ( total - maxLength > maxLength ? "Yes" : "No" ) << endl;

    return 0;
}

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

typedef ostringstream OSS; typedef istringstream ISS;
typedef long long LL;
typedef pair<int, int> PII;  typedef pair<LL, LL> PLL;
typedef vector<int>    VI;   typedef vector<VI>   VVI;   typedef vector<VVI>   VVVI;
typedef vector<LL>     VLL;  typedef vector<VLL>  VVLL;  typedef vector<VVLL>  VVVLL;
typedef vector<double> VD;   typedef vector<VD>   VVD;   typedef vector<VVD>   VVVD;
typedef vector<string> VS;   typedef vector<VS>   VVS;   typedef vector<VVS>   VVVS;
typedef vector<bool>   VB;   typedef vector<VB>   VVB;   typedef vector<VVB>   VVVB;
typedef vector<PII>    VPII; typedef vector<VPII> VVPII; typedef vector<VVPII> VVVPII;
typedef vector<PLL>    VPLL; typedef vector<VPLL> VVPLL; typedef vector<VVPLL> VVVPLL;

typedef unsigned int  UI;
typedef vector<UI>    VUI;
typedef vector<VUI>   VVUI;

#define fst first
#define snd second
// #define Y first
// #define X second
#define MP make_pair
#define PB push_back
#define EB emplace_back 
#define ALL(x)  (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define RANGEBOX(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))
#define RANGE(x, l, r) ((l) <= (x) && (x) <= (r))
#define rep(i, N)  for (int i = 0; i < (int)(N); i++)
#define rrep(i, N) for (int i = N - 1; i >= 0; i--)
#define REP(i, init, N)  for (int i = (init); i < (int)(N); i++)
#define RREP(i, N, last) for (int i = (init - 1); i >= last; i--)
#define MAXUD(orig, target) orig = max(orig, target)
#define MINUD(orig, target) orig = min(orig, target)
#define DUMP(x) cerr << #x << " = " << (x) << endl

template < typename T > inline T fromString(const string &s) { T res; ISS iss(s); iss >> res; return res; };
template < typename T > inline string toString(const T &a)   { OSS oss; oss << a; return oss.str(); };

template<typename T=int> inline void dump(vector<T> vs, bool ent=false) { rep(i, vs.size()) cout << vs[i] << (i+1==vs.size() ? '\n' : ' '); if (ent) cout << endl; }
template<typename T = int> inline void dump(vector<vector<T>> vs, bool ent=false) { rep(i, vs.size()) dump<T>(vs[i]); if (ent) cout << endl; }

const int    INF  = 0x3f3f3f3f;
const LL     INFL = 0x3f3f3f3f3f3f3f3fLL;
const double DINF = 0x3f3f3f3f;
const int    DX[] = {1,  0, -1, 0};
const int    DY[] = {0, -1,  0, 1};
const double EPS  = 1e-12;
// const double PI   = acos(-1.0);

template<typename T = int> inline T in() { T x; cin >> x; return x; }
template<typename T = int> inline vector<T> in(int n) { vector<T> xs(n); rep(i, n) cin >> xs[i]; return xs; }
template<typename T = int> inline vector<vector<T>> in(int n, int m) { vector<vector<T>> xs(n, vector<T>(m)); rep(i, n) rep(j, m) cin >> xs[i][j]; return xs; }

int main(void) {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int w = abs(a - c);
	int h = abs(b - d);
	int ans = w + h - __gcd(w, h);
	cout << ans << endl;

    return 0;
}



Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,d,ret,a[200005],dpl[200005],dpr[200005];
signed main()
{
	cin>>n>>d;
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
		ret+=a[i];
	}
	ret+=(n-1)*d;
	dpr[0]=a[0];
	for(int i=1;i<n;i++)
		dpr[i]=min(a[i],dpr[i-1]+d);
	dpl[n-1]=a[n-1];
	for(int i=n-2;i>=0;i--)
		dpl[i]=min(a[i],dpl[i+1]+d);
	for(int i=1;i<n-1;i++)
		ret+=min(dpl[i],dpr[i]);
	cout<<ret<<endl;
	return 0;
}


Measured memory_bytes: 4992
using System;
class Program
{
    static void Main(string[] args)
    {
        int n = int.Parse(Console.ReadLine());
        string[] x = Console.ReadLine().Split(' ');
        string[] y = Console.ReadLine().Split(' ');
        double D1 = 0;
        double D2 = 0;
        double D3 = 0;
        double D4 = 0;
        for (int i = 0; i < n; i++)
        {
            double tmp = Math.Abs(double.Parse(x[i]) - double.Parse(y[i]));
            D1 += tmp;
            D2 += tmp * tmp;
            D3 += tmp * tmp * tmp;
            D4 = D4 > tmp ? D4 : tmp;
        }
        Console.WriteLine("{0:f6}",D1);
        Console.WriteLine("{0:f6}", Math.Sqrt(D2));
        Console.WriteLine("{0:f6}", Math.Pow(D3,1/3.0));
        Console.WriteLine("{0:f6}", D4);
    }
}

Measured memory_bytes: 5756
#include<iostream>
#include<string>
#include <algorithm>

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

    std::sort(s.begin() ,s.end());

    if(s[0] == s[1] && s[1] != s[2] && s[2] == s[3]){
        std::cout << "Yes\n" << std::endl;
    }else{
        std::cout << "No\n" << std::endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<assert.h>
#include<string>
#include<cstdlib>
#include<cctype>
#include<unordered_map>
#include<sstream>
#include<numeric>
#include<stack>
// #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 9e18;
constexpr int inf = 1e9;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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;
};

// intやllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ----------------------------------------------------------------------------

int main(){
  bool can = true;
  int N;
  cin >> N;
  for(int i=0; i<N; i++){
    int a;
    cin >> a;
    if(a%2==0){
      if(!(a%3==0 || a%5==0)) can = false;
    }
  }
  if(can){
    cout << "APPROVED" << endl;
  }else{
    cout << "DENIED" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define replrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) replrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) a.begin(),a.end()
#define mp make_pair
#define mt make_tuple
#define INF 2000000000
#define INFL 1000000000000000000LL
#define EPS 1e-9
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<P> vP;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<double> > vvd;
typedef vector<vector<P> > vvP;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<P, vector<P>, greater<P> > pqlP;
typedef pair<int, pair<int, int> > Edge;
typedef vector<Edge> vE;
typedef priority_queue<Edge, vector<Edge>, greater<Edge> > pqlE;

int main() {
	while (true) {
		int N;
		cin >> N;
		if (N == 0)break;
		int n;
		vP L[4];
		cin >> n;
		rep(i, 4) {
			L[i] = vP(n);
		}
		rep(i, n) {
			int x, y;
			cin >> x >> y;
			L[0][i] = mp(x, y);
		}
		rep(i, n) {
			repl(j, 1, 4) {
				// [0 -1][x]
				// [1  0][y]
				L[j][i] = mp(L[j-1][i].second, -L[j-1][i].first);
			}
		}
		rep(i, N) {
			cin >> n;
			vP l(n);
			rep(i, n) {
				int x, y;
				cin >> x >> y;
				l[i] = mp(x, y);
			}
			if (n != L[0].size())continue;
			rep(j, 4) {
				bool flag = true;
				rep(i, n - 1) {
					if (L[j][i + 1].first - L[j][i].first != l[i + 1].first - l[i].first
						|| L[j][i + 1].second - L[j][i].second != l[i + 1].second - l[i].second) {
						flag = false;
						break;
					}
				}
				if (flag) {
					cout << i + 1 << endl;
					break;
				}
				flag = true;
				rep(i, n - 1) {
					if (L[j][n - 2 - i].first - L[j][n - 1 - i].first != l[i + 1].first - l[i].first
						|| L[j][n - 2 - i].second - L[j][n - 1 - i].second != l[i + 1].second - l[i].second) {
						flag = false;
						break;
					}
				}
				if (flag) {
					cout << i + 1 << endl;
					break;
				}
			}
		}
		cout << "+++++" << endl;
	}

	return 0;
}

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

int main() {
	int N;	// 駐車時間.
	int A;	// 1時間の料金.
	int B;	// 上限.
	cin >> N;
	cin >> A;
	cin >> B;
	if ((N * A) > B) {
		cout << B << endl;
	}
	else {
		cout << N * A << endl;
	}
}

Measured memory_bytes: 256
N, K = (int(i) for i in input().split(' '))
h=[]
for i in range(N):
    h.append(int(input()))

h.sort()

m = -1
for i in range(N-K+1):
    d = h[i+K-1] - h[i]
    if d < m or m == -1:
        m = d
        
print(m)

    

Measured memory_bytes: 7444
swap' :: [a] -> [a]
swap' [] = []
swap' (x:xs) = swap' xs ++ [x]

equiv :: Eq a => [a] -> [a] -> Bool
equiv [] [] = True
equiv _ [] = False
equiv [] _ = False
equiv (x:xs) (y:ys) = (x == y) && equiv xs ys

main :: IO()
main = do
  fstLine <- getLine
  sndLine <- getLine
  if equiv fstLine (swap' sndLine)
    then putStr "YES\n"
    else putStr "NO\n"


Measured memory_bytes: 380
#include <bits/stdc++.h>
#include <algorithm>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define stdi(in) freopen(in, "r", stdin)
#define stdo(out) freopen(out, "w", stdout)
#define stdio(in, out) stdi(in); stdo(out)
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define MAX 100007
#define MOD 1000000007
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

using namespace std;
using namespace __gnu_pbds;
typedef long long ll;
#define ordered_set tree<pair<int, int> , null_type, less<pair<int, int> >, rb_tree_tag, tree_order_statistics_node_update>

//const ll modd = 998244353;
const ll inf = 1e18;

ll h,w,n;
ll dp[2*MAX];
vector<pair<ll, ll> > arr;
ll fact[2*MAX];


void init(){
	fact[0] = 1;

	for(ll i = 1;i<=h+w; i++){
		fact[i] = (fact[i-1]*i)%MOD;
	}
}


ll power(ll a, ll n, ll mod){
	ll res = 1;

	while(n>0){
		if(n&1){
			res = (res*a)%mod;
		}

		a = (a*a)%mod;
		n>>=1;
	}

	return res;
}

ll get_inv(ll a){
	return power(a, MOD-2, MOD);
}


ll get_ncr(ll n, ll r){
	ll ans = fact[n];
    ans = (ans*get_inv(fact[r]))%MOD;
	ans = (ans*get_inv(fact[n-r]))%MOD;
	return ans;
}

int main(){
	/*#ifndef ONLINE_JUDGE
        stdio("in", "out");
    #endif*/
    fast;
    cin>>h>>w>>n;
    init();
    ll r,c;
    for(int i=0;i<n;i++){
    	cin>>r>>c;
    	arr.pb(mp(r,c));
    }

    sort(arr.begin(), arr.end());
    ll ans = get_ncr(h+w-2, h-1);
    //cerr<<"ans initial == "<<ans<<'\n';
	ll aux, tmp, a, b;
	for(int i=n-1;i>=0;i--){
		//cerr<<"for i == "<<i<<"\n";
		r = h-arr[i].F+1;
		c = w-arr[i].S+1;
		aux = get_ncr(r+c-2, c-1);
		r = arr[i].F;
		c = arr[i].S;

		for(int j = n-1; j>i; j--){
			
			if(arr[j].F>=r && arr[j].S>=c){

				a = arr[j].F-r+1;
				b = arr[j].S-c+1;

				tmp = get_ncr(a+b-2, b-1);
				tmp = (tmp*dp[j])%MOD;
				//cerr<<"tmp == "<<tmp<<'\n';
				aux = (aux-tmp+MOD)%MOD;
			}

		}

		dp[i] = aux;
		//cerr<<"aux == "<<aux<<'\n';
		//cerr<<"r, c == "<<r<<", "<<c<<'\n';
		aux = (aux*get_ncr(r+c-2, c-1))%MOD;

		ans = (ans - aux + MOD)%MOD;

		//cerr<<"ans "<<ans<<'\n';

	}

	cout<<ans<<'\n';


	return 0;
}



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

int main() {
        string s ;
        cin>>s;
    for (int i = 0; i <s.size() ; ++i) {
        if(s[i]==','){
        s.erase(i,1);
        s.insert(i," ");
        }else{
            continue;
        }
    }cout<<s;
    return 0;
    }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

class UnionFind{
public:
    //親の番号を格納する。親だった場合はー（その集合のサイズ）
    vector<int> parents;

    //作る時はparentsを-1で初期化する
    //こうすることで全部ばらばらになる
    UnionFind(int n){
        parents = vector<int>(n, -1);
    }

    //Aがどのグループにいるか調べる
    int root(int A){
        if(parents[A]<0) return A;
        return parents[A] = root(parents[A]);
    }

    //自分のいるグループの大きさを調べる
    int size(int A){
        return -parents[root(A)];
    }

    //AとBをくっつける
    bool connect(int A, int B){
        //AとBを直接ではなく親同士をくっつける
        A=root(A);
        B=root(B);
        if(A==B){
            return false;
        }

        //大きい方（A)に小さい方（B)をくっつけたい
        if(size(A)<size(B)) swap(A, B);

        parents[A]+=parents[B];
        parents[B]=A;

        return true;
    }
};

int main(){
    int N, M; cin >> N >> M;
    int p[N];
    for(int i=0; i<N; i++){
        int a; cin >> a;
        p[i] = a-1;
    }

    UnionFind uni(N);

    for(int i=0; i<M; i++){
        int x, y; cin >> x >> y;
        uni.connect(x-1, y-1);
    }

    int ans = 0;
    for(int i=0; i<N; i++){
        if(uni.root(i) == uni.root(p[i])) ans++;
    }

    cout << ans << endl;
}

Measured memory_bytes: 1024
/**************************************
*Coded By: BadduCoder (Sumit Badsara) *
***************************************/
#include<bits/stdc++.h>
using namespace std;

//All the Loops and defines required
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define IN(A, B, C) assert( B <= A && A <= C)
#define MP make_pair
#define PB push_back
#define ff first
#define ss second
#define _cin ios_base::sync_with_stdio(0);  cin.tie(0); cout.tie(0);
#define INF (int)1e9
#define EPS 1e-9
#define PI 3.1415926535897932384626433832795
#define MOD 1000000007

//All the declarations using typedef

typedef long long int ll;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef map<int,int> MII;
typedef set<int> SETI;
typedef multiset<int> MSETI;
typedef long int l;

int main()
{
    _cin;
    ll n;
    cin>>n;
    ll dp[n][3],ans[3]={0,0,0};
    
    REP(i,n)
        REP(j,3)
            cin>>dp[i][j];
    
    FOR(i,1,n,1)
    {
        REP(j,3)
        {
            ll maxx=-1;
            REP(k,3)
            {
                if(j!=k)
                    maxx = max(maxx,dp[i-1][k]);
            }
            dp[i][j] += maxx;
        }
    }

    cout<<max({dp[n-1][0],dp[n-1][1],dp[n-1][2]});

    return 0;
}

Measured memory_bytes: 2560