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

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const int MAX_N = 100000;
int n;
vi g[MAX_N];
int col[MAX_N];

int main() {
    fastio();

    cin >> n;
    forn(i, n - 1) {
        int a, b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    fill_n(col, n, 2);
    col[0] = 0, col[n - 1] = 1;
    set<int> s1({ 0 }), s2({ n - 1 });

    while (!s1.empty() || !s2.empty()) {
        set<int> t1, t2;
        for (int x : s1) {
            for (int y : g[x]) {
                if (col[y] != 2) continue;
                col[y] = 0;
                t1.insert(y);
            }
        }
        s1 = t1;

        for (int x : s2) {
            for (int y : g[x]) {
                if (col[y] != 2) continue;
                col[y] = 1;
                t2.insert(y);
            }
        }
        s2 = t2;
    }

    int fc = count(col, col + n, 0);

    if (fc > n - fc) {
        cout << "Fennec\n";
    } else {
        cout << "Snuke\n";
    }

    return 0;
}

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

using namespace std;
#define ull unsigned long long
#define ll long long

/*-----------------------------------------------------MATH------------------------------------------------*/
inline ll gcd(ll a, ll b) {
    while (b) {
        a %= b;
        swap(a, b);
    }
    return a;
}
inline ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
inline int pwm(ll xx, ll pow, int MD) {
    if (pow < 0) { pow = pow % (MD - 1) + MD - 1; }
    ll mlt = 1;
    while (pow) {
        if (pow & 1) {
            mlt *= xx;
            mlt %= MD;
        }
        xx *= xx;
        pow >>= 1;
        xx %= MD;
    }
    return (int) mlt;
}
inline ll gcdex(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll xx, yy;
    ll gc = gcdex(b, a % b, yy, xx);
    x = xx;
    y = yy - (a / b) * xx;
    return gc;
}
inline int inv(ll r, int _mod) { return pwm(r % _mod, _mod - 2, _mod); }
/*-----------------------------------------------------MATH------------------------------------------------*/

const int inf = 1e6;
const int MAXN = 2e5 + 10;
ll mod = 1e9;
void solve(){
    ull n,a,b;
    cin>>n>>a>>b;
    if(a>b) swap(a,b);
    if((b-a)%2==0){
        cout<<(b-a)/2;
    }
    else{
        cout<<min(n-b+1 +(b-a-1)/2, a+(b-a-1)/2);
    }
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n=1;
    for (int i = 0; i < n; i++) solve();
    return 0;
}

Measured memory_bytes: 256
import itertools

N,K=map(int,input().split())

m2=(N-1)*(N-2)//2 - K

if m2>=0:
    M=N-1+m2
    print(M)
    for i in range(1,N):
        print(1,i+1)
    i=0
    for a,b in  itertools.combinations(range(1,N), 2):
        if i==m2:
            break
        print(a+1,b+1)
        i+=1
        
else:
    print(-1)

Measured memory_bytes: 45552
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define FOR(i,start,end) for(int i=start;i<=end;i++)
const int INF = 1001001001;
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
typedef long long ll;
const ll MOD=1000000007;
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
//---------------------------------------------------------------------------------------------------
typedef pair<int,int> P;

int main(void){
    // Your code here!
    double d,t,s; cin >> d >> t >> s;
    if (d/s <= t) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3708
N, M = map(int,input().split())
A = [i for i in map(int,input().split())]
BC = [[i for i in map(int,input().split())] for j in range(M)]
A.sort()
BC.sort(reverse=True, key=lambda x:x[1])

ans_arr = [0 for i in range(N)]

j = 0
for i in range(N):
  if j < M:
    if A[i] < BC[j][1]:
      ans_arr[i] = BC[j][1]
      BC[j][0] -= 1
      if BC[j][0] == 0:
        j+=1
    else:
      ans_arr[i] = A[i]
  else:
    ans_arr[i] = A[i]
      
print(sum(ans_arr))

Measured memory_bytes: 26692
#include <stdio.h>
#include <set>
#include <algorithm>

using namespace std;

main(){
  int n;
  set<int> students;
  for(int i=0;i<30;i++) students.insert(i+1);

  for(int i=0;i<28;i++){
    scanf("%d", &n);
    students.erase(students.find(n));
  }

  int a=0,b;

  set<int>::iterator it;
  for(it=students.begin();it!=students.end();it++){
    if(a==0) a = *it;
    else b = *it;
  }
  
  if(a>b){
    swap(a,b);
  }

  printf("%d\n%d\n", a, b);
}

Measured memory_bytes: 0
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	scanInit()

	n := nextInt()
	al := make([]int, n)
	m := map[int]int{}

	for i := 0; i < n; i++ {
		al[i] = nextInt()
		m[min(al[i]/400, 8)]++
	}

	cmin, cmax := len(m), len(m)

	over := m[8]
	if over > 0 {
		cmin--
		cmin = max(cmin, 1)
		cmax--
		cmax = cmax + over
	}

	fmt.Println(cmin, cmax)

}
func min(a, b int) int {
	if a > b {
		return b
	}
	return a
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

// ---- readfunc
var sc = bufio.NewScanner(os.Stdin)

func scanInit() {
	const cap = 200 * 1024 // default=64*1024
	var buf = make([]byte, cap)
	sc.Buffer(buf, cap)
	sc.Split(bufio.ScanWords)
	return
}
func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
func nextStr() string {
	sc.Scan()
	return sc.Text()
}


Measured memory_bytes: 1796
#include <iostream>
#include <fstream>
#include <iomanip>

#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <deque>
#include <string>

#include <algorithm>
#include <numeric>
#include <random>

#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>

using namespace std;

#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define sz(a) static_cast<int>((a).size())
#define endl '\n'

using ll = long long;

const ll INF = static_cast<ll>(1e9) + 7;
const int MAXN = static_cast<int>(1e6) + 17;

int n;

bool read() {
    if (!(cin >> n))
        return false;

    return true;
}

void solve() {
    int ans = 0;

    for (int i = 1; i <= n; ++++i) {
        int cnt = 0;

        for (int d = 1; d * d <= i; ++d)
            if (i % d == 0) {
                ++cnt;
                cnt += (i / d != d);
            }

        if (cnt == 8)
            ++ans;
    }

    cout << ans << endl;
}

int main() {
    cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::mt19937 rand('S' + 'E' + 'R' + 'E' + 'Z' + 'H' + 'K' + 'A');

    while (read())
        solve();

    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
char word[1000];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	int n;cin >> n;
	if(n%2 != 0){
		cout << "No";
		return 0;
	}
	for(int i = 0;i < n/2;i++){
		cin >> word[i];
	}
	for(int i = 0;i < n/2;i++){
		char temp;cin >> temp;
		if(temp != word[i]){
			cout << "No";
			return 0;
		}
	}
	cout << "Yes";
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#define int long long
#define mod(int)(1000000007)
using namespace std;
int test[213456][2];
int ok[213456];
signed main() {
	int n, m, a, b, c = 0, d = 0, ans = 1; cin >> n >> m;
	vector<vector<long long>>aa(m, vector<long long>(2));
	for (int h = 0; h < m; h++) {
		cin >> aa[h][0] >> aa[h][1];
	}
	sort(aa.begin(), aa.end());
	for (int h = 0; h < m; h++) {
		if (h == 0) { c = aa[h][0]; d = aa[h][1]; continue; }
		if (c >= aa[h][1] || d <= aa[h][0]) { c = aa[h][0]; d = aa[h][1]; ans++; }
		else { c = max(aa[h][0], c); d = min(aa[h][1], d); }
	}
	cout << ans << endl;
}

Measured memory_bytes: 5760
import sys
N = int(input())
Hs = list(map(int, input().split()))

prev_h = -1
downflg = False
for h in Hs:
    # 増加中
    if not downflg:
        if  h - prev_h >= 0:
            prev_h = h
        elif h - prev_h == -1:
            downflg = True
            prev_h = h
        else:
            print("No")
            sys.exit()
    # 減少中
    else:
        if h - prev_h > 0:
            downflg = False
            prev_h = h
        if h - prev_h == 0:
            prev_h = h
        else:
            print("No")
            sys.exit()
    # print(h,prev_h,downflg)
    prev_h = h
print("Yes")

Measured memory_bytes: 15020
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
# import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

A,B,C,D = MI()

x = -(-A//D)
y = -(-C//B)

if x >= y:
    print("Yes")
else:
    print("No")

# for i in range(100):
#     a -= B
#     if a <= 0:
#         print("Yes")
#         exit()
    
#     t -= D
#     if t <= 0:
#         print("No")
#         exit()


Measured memory_bytes: 9556
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 1e5 + 5;
const int INF = 0x3f3f3f3f;
const ll p = 998244353;
#define DEBUG(x) cout << x << '\n'


void run(){
    int sum = 0, t;
    for(int i = 1; i <= 5; i++)
        cin >> t, sum += t;
    cout << 15 - sum;
}
int main(){
#ifdef Irene
    freopen("in.txt", "r", stdin);
#endif // Irene
    ios::sync_with_stdio(false);

    run();
}


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


int graph[8][8]; 

int dfs(vector<bool> &vis, int j ,int n)
{
	bool all_visit=true; 
	for(int i=0;i<n;i++)
		if(vis[i]==false) all_visit=false; 

	if(all_visit) return 1 ;
	
	int ret=0; 

	for(int i=0;i<n;i++)
	{
		if(graph[j][i]==false ) continue; 
		if(vis[i]) continue; 

		vis[i]=true; 
		ret+=dfs(vis,i,n);
		vis[i]=false; 
	}	 
	

	return ret; 
}



int main(){

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


for(int i=0;i<m;i++)
{	int x, y; 
	cin>>x>>y; 
	graph[x-1][y-1]=graph[y-1][x-1]=true; 
}
vector<bool> vis(n,false);
vis[0]=true;  
cout<<dfs(vis,0,n)<<endl; 
return 0; 
}








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

using namespace std;

bool bridge[50][50];
bool checked[50];
int n, m;

void dfs(int p,int l,int c) {
	checked[p] = true;
	for (int i = 0; i < n;i++) {
		if (!bridge[p][i])continue;
		if (p == l && i == c || p == c && i == l)continue;
		if (checked[i])continue;
		dfs(i, l, c);
	}
}
void clear() {
	for (int i = 0; i < n;i++) {
		checked[i] = false;
	}
}
bool check() {
	for (int i = 0; i < n; i++) {
		if (!checked[i])return false;
	}
	return true;
}
int main() {
	cin >> n >> m;
	int count = 0;
	for (int i = 0; i < m;i++) {
		int a, b;
		cin >> a >> b;
		bridge[a-1][b-1] = bridge[b-1][a-1] = true;
	}
	for (int i = 0; i < n;i++) {
		for (int j = i + 1; j < n; j++) {
			if (bridge[i][j]) {
				clear();
				dfs(0, i, j);
				if (!check()) {
					count++;
				}
			}
		}
	}
	cout << count;
}

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

using namespace std;

typedef long long ll;

static const int INTINF = (2147483647);
static const ll LLINF = (9223372036854775807);
static const int MAX = 100001;
static const ll MOD = 1000000007;

//--global--//



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

int main(int argc, const char * argv[]) {
    //提出時、消す----//
    //--------------//

    string s;
    ll k;
    cin >> s >> k;

    ll ones = 0;
    ll other = -1;
    char val = 'a';
    rep(i, s.size()){
        if(s[i] == '1'){
            ones++;
        }
        else{
            other = i+1;
            val = s[i];
            break;
        }
    }
    if(k >= other && other != -1){
        cout << val << endl;
        return 0;
    }
    else{
        cout << '1' << endl;
    }
    
    return 0;
}


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

int main(void){
  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;
  string s = "";
  for(int i = sx; i < tx; i++) s += "R";
  for(int i = sy; i < ty; i++) s += "U";
  for(int i = sx; i < tx; i++) s += "L";
  for(int i = sy; i < ty; i++) s += "D";
  s += "D";
  for(int i = sx; i <= tx; i++) s += "R";
  for(int i = sy; i <= ty; i++) s += "U";
  s += "L";
  s += "U";
  for(int i = sx; i <= tx; i++) s += "L";
  for(int i = sy; i <= ty; i++) s += "D";
  s += "R";
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int k;
	scanf("%d", &k);
	int i;
	int c = 7;
	for (i = 0; i < k; i++)
	{
		c %= k;
		if (c == 0)
		{
			printf("%d\n", i + 1);
			return 0;
		}
		c = 10 * c + 7;
	}
	printf("-1\n");
	return 0;
}

Measured memory_bytes: 1732
from collections import deque

H, W = map(int,input().split())
maze = list(list(input()) for i in range(H))



def bfs(maze,maze_s,sy,sx):
  maze_s[sy][sx] = 0
  queue = deque([[sy,sx]])
  while queue:
    y,x = queue.popleft()
    if maze[y][x] == "g":
      return maze_s[y][x]
    else:
      for j,k in [(0,1),(0,-1),(1,0),(-1,0)]:
        new_y,new_x = y+j, x+k
        if 0 <= new_y <= H-1 and 0 <= new_x <= W-1:
          if maze[new_y][new_x] != "#" and maze_s[new_y][new_x] == -1:
            maze_s[new_y][new_x] = maze_s[y][x] + 1
            queue.append([new_y,new_x])
  else:
    print(-1)
    exit()

maze_s = list([-1] * W for i in range(H))
count = 0
for row in maze:
  count += row.count(".")

maze[H-1][W-1] = "g"

ans = count - bfs(maze,maze_s,0,0) -1
print(ans)

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

int main(){
  ll n;
  cin >> n;
  vector<ll> a(n, 0);
  rep(i, n) cin >> a.at(i);
  ll nf = 0, nt = 0;
  int check = 0;
  rep(i, n){
    if(a.at(i)%4==0) nf++;
    else if(a.at(i)%2==0) nt++;
  }
  if(nf >= n/2 || nf >= (n-nt+1)/2) check = 1;
  
  if(check) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 4036
#include <iostream>
#include <vector>
#include <utility>
using namespace std;
using P = pair<int, int>;

int main() {
    int n;
    while(cin >> n, n) {
        vector<vector<P>> target(4);
        vector<vector<P>> lines(n);
        for(int i=0; i<=n; ++i) {
            int m;
            cin >> m;
            int prev_x = 0, prev_y = 0;
            for(int j=0; j<m; ++j) {
                int x, y;
                cin >> x >> y;
                if(j != 0) {
                    if(i == 0) {
                        target[0].push_back(make_pair(x - prev_x, y - prev_y));
                    } else {
                        lines[i-1].push_back(make_pair(x - prev_x, y - prev_y));
                    }
                }
                prev_x = x;
                prev_y = y;
            }
        }
        for(int i=0; i<target[0].size(); ++i) {
            int x1 = -target[0][i].first, y1 = -target[0][i].second;
            target[1].push_back(make_pair(x1, y1));

            int x2 = target[0][i].second, y2 = -target[0][i].first;
            target[2].push_back(make_pair(x2, y2));

            int x3 = -target[0][i].second, y3 = target[0][i].first;
            target[3].push_back(make_pair(x3, y3));
        }

        vector<int> ret;
        for(int i=0; i<n; ++i) {
            bool ok = false;
            for(int j=0; j<4; ++j) {
                if(target[j].size() != lines[i].size()) {
                    break;
                }

                for(int k=0; k<lines[i].size(); ++k) {
                    if(lines[i][k] != target[j][k]) {
                        break;
                    }
                    if(k == lines[i].size()-1) {
                        ok = true;
                    }
                }
                for(int k=0; k<lines[i].size(); ++k) {
                    if(lines[i][k] != target[j][lines[i].size()-k-1]) {
                        break;
                    }
                    if(k == lines[i].size()-1) {
                        ok = true;
                    }
                }
            }
            if(ok) {
                ret.push_back(i+1);
            }
        }
        for(auto x : ret) {
            cout << x << endl;
        }
        cout << "+++++" << endl;
    }
}


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

int main(){
    ll n;
    cin >> n;
    ll run;
    run = pow(n,0.5);
    ll x = 0;
    for(ll i = run;i > 0;i--){
        if(n % i == 0){
            x = i;
            break;
        }
    }
    ll y;
    y = n / x;
    cout << x + y - 2 << endl;
    return 0;
}

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


#define ll long long int 
#define all(v) v.begin(),v.end()
#define MOD 1000000007
#define PB push_back
#define F first
#define S second


int main(){
     
     ll x,k,d;
     cin>>x>>k>>d;
     
     x =  abs(x);

     ll moves = abs(x-0)/d;
     if(moves>=k){
        cout<<x-k*d<<endl;
        
        return 0;
     }
     
     x = x -moves*d;
     k-=moves;

     if(k%2){
        x -= d;
     }else{
        x = x;
     }
      

     cout<<abs(x)<<endl;


    return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<stdlib.h>
#include<string.h>


int func(int n, int ans){
	if(n % 2 == 0)
		func(n/2, ++ans);
	else
		return ans;
}

int main(int argc, char *argv[]){

	int in;
	int ans;
	int i;

	scanf("%d", &in);

	ans = 1;
	for(i=1;i<=in;i++){
		if(func(i, 0) > func(ans, 0))
			ans = i;
	}

	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 128
f = []
for i in range(3):
    f.append(list(map(int, input().split())))
"""
a1+a2+a3+b1+b2+b3が3通りで合うか
"""
s1 = f[0][0] + f[1][1] + f[2][2]
s2 = f[0][1] + f[1][2] + f[2][0]
s3 = f[0][2] + f[1][0] + f[2][1]

if s1==s2==s3:
    print("Yes")
else:
    print("No")


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

int main() {
  int A, B, C, D, E, F;
  E = A + B;
  F = C + D;
  cin >> A >> B >> C >> D;
  if (A + B == C + D) {
    cout << "Balanced" << endl;
  }
  else if (A + B > C + D) {
    cout << "Left" << endl;
  }
  else if (A + B < C + D) {
    cout << "Right" << endl;
  }
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#define LL long long
#define maxn 15
char s[maxn];
LL ans;
int len;
LL calc(int x)
{
	LL res=0,cnt=0;
	for(int i=0;i<=len+1;i++)
	{
		if((i==len+1)||(x&(1<<(i-1)))) res+=cnt,cnt=0;
		cnt=10ll*cnt+s[i]-'0';
	}
	return res;
}
int main()
{
	scanf("%s",s);
	len=strlen(s)-1;
	for(int i=0;i<(1<<len);i++) ans+=calc(i);
	printf("%lld\n",ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;


int main(){
  vector<int> a(3);
  for(auto &i:a) cin >> i;
  sort(a.begin(),a.end());
  auto check = [&](){
    bool flag = false;
    if(a[0]==a[1]&&a[1]==a[2]) flag = true;
    return flag;
  };
  int k = a[0];
  rep(i,3) a[i]-=k;
  int i=0;
  int ans = 0;
  while(1){
    if(!(i&1)&&check()) break;
    i++;
    a[0]++;
    sort(a.begin(),a.end());
    if(i%2==0) ans++;
  }

  cout << ans << endl;
}


Measured memory_bytes: 256
S = input()
alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
for i in alphabet:
    if i not in S:
        print(S + i)
        break
else:
    output = False
    while len(S) > 0 and not output:
        last = alphabet.index(S[-1])
        for i in alphabet[last + 1:]:
            if i not in S[:-1]:
                print(S[:-1] + i)
                output = not(output)
                break
        else:
            S = S[:-1]
    if not output:
        print(-1)


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

#define F                   first
#define S                   second
#define int                 long long int
#define pb                  push_back
#define mp                  make_pair
#define pii                 pair<int,int>
#define vi                  vector<int>
#define mii                 map<int,int>
#define pqb                 priority_queue<int>
#define pqs                 priority_queue<int,vi,greater<int> >
#define mod                 1000000007
#define endl                '\n'
#define rep(i,a,b)            for(int i=a;i<b;i++)
void c_p_c()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}
int power(int n, int p) {
    if (p == 1) {
        return n % mod;
    }
    if (p == 0) {
        return (int)1;
    }
    if (p & 1) {
        return (n % mod * (power(n, (p - 1) / 2) % mod * power(n, (p - 1) / 2) % mod) % mod) % mod;
    }
    else {
        return (power(n, (p) / 2) % mod * power(n, (p) / 2) % mod) % mod;

    }

}
void solve() {
    int n;
    cin >> n;
    int ans = (2 * (power(9, n))) % mod;
    ans = (ans - power(8, n) )%mod;
    ans = (power(10, n) - ans ) % mod;
    cout << (ans+mod) % mod << endl;
}
int32_t main()
{
    c_p_c();
    solve();


    return 0;
}

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

#define DEBUG 0
#define lli long long int
#define REP(i,n) for(int i=0;i<n;i++)

using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;

#define RIGHT 0
#define LEFT  1
#define DOWN  2

lli a[600][600];

int main(){
	lli h,w;
	cin>>h>>w;
	REP(i,600)REP(j,600)a[i][j]=-1;
	REP(i,h)REP(j,w)cin>>a[i+1][j+1];

	lli nowI = 1;
	lli nowJ = 1;
	lli d    = RIGHT;
	lli dx[3]={1,-1,0},dy[3]={0,0,1};

	vector<pair<lli,lli>> before,next;
	lli flag=0;
	
	while(1){
		if(DEBUG)cout<<"nowI = "<<nowI<<" nowJ = "<<nowJ<<" d= "<<d<<endl;
		if(nowI==h){
			if(nowI%2==0 && nowJ == 1)break;
			else if(nowI%2 == 1 && nowJ == w)break;
		}
		lli nextI = nowI+dy[d];
		lli nextJ = nowJ+dx[d];
		if(flag==1){
			if(nowJ==1)d=RIGHT;
			else d = LEFT;
			nextI = nowI+dy[d];
			nextJ = nowJ+dx[d];
			flag=0;
		}
		if(flag==0){
			if(a[nextI][nextJ]==-1){
				d=DOWN;
				nextI = nowI+dy[d];
				nextJ = nowJ+dx[d];
				flag=1;
			}
		}
		if(a[nowI][nowJ]%2){
			a[nextI][nextJ] ++;
			a[nowI][nowJ]--;
			before.push_back(make_pair(nowI,nowJ));
			next.push_back(make_pair(nextI,nextJ));
		}
		nowI = nextI;
		nowJ = nextJ;
	}
	cout<<next.size()<<endl;
	REP(i,next.size()){
		cout<<before[i].first<<" "<<before[i].second<<" ";
		cout<<next[i].first<<" "<<next[i].second<<endl;
	}
	return 0;

}

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

const ll INF = 1LL << 60;
const int MOD = 1000000007;

ll N, M;
ll dp[100100];
set<ll> st;

int main() {
    cin >> N >> M;
    rep(i, M) {
        ll tmp; cin >> tmp;
        st.insert(tmp);
    }
    dp[0] = 1;
    if (!st.count(1)) dp[1] = 1;

    for (int i = 2; i <= N; i++) {
        if (st.count(i)) {
            continue;
        }
        dp[i] = dp[i - 1] + dp[i - 2];
        dp[i] %= MOD;
    }

    cout << dp[N] << endl;
}

Measured memory_bytes: 4992
#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>;
#define chmax(x,y) x = max(x,y);
#define chmin(x,y) x = min(x,y);
const int di[] = {-1, 0, 1, 0};
const int dj[] = {0, -1, 0, 1};
const int INF = 1001001001;



int main() {
    double t, x;
    cin >> t >> x;
    double ans = t/x;
    printf("%.10f\n", ans);
    return 0;
}

Measured memory_bytes: 3752
N = int(input())
B = list(map(int, input().split()))

tot_sum = 2 * B[0]
prev = B[0]
for i in range(1, N - 1):
    if prev >= B[i]:
        tot_sum -= prev
        tot_sum += 2 * B[i]
    else:
        tot_sum += B[i]
    prev = B[i]
print(tot_sum)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define mid (l+r)/2
#define L (x<<1)
#define R (L+1)
pair<int,int> tree[1000000];
string s;
void build(int x,int l,int r)
{
    if (l==r){
        tree[x]={1e9,l};
    } else {
        build(L,l,mid);
        build(R,mid+1,r);
        tree[x]=min(tree[L],tree[R]);
    }
}
void upd(int x,int l,int r,int v,int val){
    if (v>r || v<l)return;
    if (l==r){
        tree[x] = {val, l};
    } else {
        upd(L,l,mid,v,val);
        upd(R,mid+1,r,v,val);
        tree[x]=min(tree[L],tree[R]);
    }
}
pair<int,int> query(int x,int l,int r,int s,int e) {
    if (l>e || r<s)return {1e9,0};
    if (l>=s && r<=e)return tree[x];
    return min(query(L,l,mid,s,e),query(R,mid+1,r,s,e));
}
int dp[1000000];
int back[1000000];
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n,m;
    cin>>n>>m;
    cin>>s;
    if (s[n]=='1'){
        cout<<-1<<endl;
        return 0;
    }
    build(1,0,n);
    dp[n]=0;
    upd(1,0,n,n,0);
    for (int i=n-1;i>=0;i--) {
        dp[i]=1e9;
        if (s[i]=='1')continue;
        int r = min(n,i+m);
        auto q = query(1,0,n,i+1,r);
        dp[i] = q.first+1;
        back[i] = q.second;
        upd(1,0,n,i,dp[i]);
    }
    if (dp[0]>=1e9){
        cout<<-1<<endl;
    } else {
        int v = 0;
        vector<int> path;
        while(v!=n) {
            path.push_back(back[v]-v);
            v= back[v];
        }
        for (auto x:path)cout<<x<<' ';
        cout<<endl;
    }
}

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

/* // Ordered Set
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
typedef tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> ordered_set;
#define os_find(k) find_by_order(k)
#define os_order(k) order_of_key(k)
*/

typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
typedef vector<int> vi;
#define f0(i,a,b) for(int i=a;i<b;i++)
#define f1(i,a,b) for(int i=a;i<=b;i++)
#define f2(i,a,b) for(int i=a;i>b;i--)
#define f3(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define int long long
#define fi first
#define se second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define make_graph(k) int x,y; f0(i,0,k){cin>>x>>y; adj[x].pb(y); adj[y].pb(x);}
#define test int t;cin>>t;while(t--)
// int ncr(int n,int r) {return (fact[n]*modInv(fact[r]))%mod*modInv(fact[n-r])%mod;}
// int modInv(int i) {return binExp(i,mod-2);}

signed main()
{
    fast

    #ifndef ONLINE_JUDGE
        freopen("inputf.in","r",stdin);
        freopen("outputf.in","w",stdout);
    #endif

    int n;
    cin>>n;

    int cur = 0;
    bool f = 0;

    int a,b;
    f0(i,0,n)
    {
        cin>>a>>b;
        if(a==b) cur++;
        else cur = 0;
        if(cur == 3) f = 1;
    }
    cout<<(f?"Yes":"No");
}

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

int main() {
  string s;
  cin >> s;
  if (s[s.size() - 1] == 's')
    cout << s + "es" << endl;

  else
    cout << s + 's' << endl;
  return 0;
}


Measured memory_bytes: 3624
import java.util.*;


public class Main {
	public static void main (String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int R = sc.nextInt();
		if(N < 10) {
			R += 100 * (10 - N);
		}
		System.out.println(R);
	}
}

Measured memory_bytes: 22612
N ,A,B = map(int,input().split())
ii = 0
for i in range(1,N+1):
    si = str(i)
    lss = list(si)
    lss = [int(i) for i in lss]
    sum1 = sum(lss)
    if A<=sum1 and B>=sum1:
        ii += i
print(ii)

Measured memory_bytes: 9052
#include <iostream>
#include <algorithm>

using ll = long long;

const int maxn = 1e5+7;

int n, m, x, y;
int ball[maxn], red[maxn];

int main(int argc, char *argv[]) {  
	std::ios::sync_with_stdio(false);
	std::cin.tie(0); 
	std::fill(red, red+maxn, 0);
	std::fill(ball, ball+maxn, 1);
	red[1] = 1;
	std::cin >> n >> m;
	for (int i = 0; i < m; i++) {
		std::cin >> x >> y;
//		std::cout << red[x] << ' ' << ball[x] << '\n';
		if (red[x] == 1 && ball[x] > 1) {
			red[y] = 1;
			ball[x]--;
			ball[y]++;
		} else if (red[x] == 1 && ball[x] == 1) {
			red[x] = 0;
			red[y] = 1;
			ball[x]--;
			ball[y]++;
		} else {
			ball[x]--;
			ball[y]++;
		}
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		ans += red[i];
	}
	std::cout << ans << '\n';
}

Measured memory_bytes: 1400
N = gets.to_i
S = Array.new(N + 1, 0)
gets.split.map(&:to_i).each_with_index{|v,i| S[i + 1] = S[i] + v }
ans = S.group_by(&:itself).inject(0) do |s, (k, v)|
  z = v.size
  z >= 2 ? s + z * (z - 1) / 2 : s 
end
puts ans


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

using namespace std;

int main() {
	string S;
	cin >> S;
	if (S == "SUN") cout << 7 << endl;
	if (S == "MON") cout << 6 << endl;
	if (S == "TUE") cout << 5 << endl;
	if (S == "WED") cout << 4 << endl;
	if (S == "THU") cout << 3 << endl;
	if (S == "FRI") cout << 2 << endl;
	if (S == "SAT") cout << 1 << endl;
	return 0;
}

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

#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG false

int main()
{
   int a;
   set<int> data;
   rep(i,3){
       cin>>a;
       data.insert(a);
   }
   cout<<data.size()<<endl;
   return 0;
}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%d %d", $n, $k);
fscanf(STDIN, "%d %d %d", $r, $s, $p);
fscanf(STDIN, "%s", $t);
$t=str_split($t);
$sum=0;
for ($i = 0; $i < $n; $i++) {
    if($t[$i]=="") continue;
    if($i+$k<$n && $t[$i]==$t[$i+$k]){
        $t[$i+$k]="";
    }
    switch ($t[$i]) {
        case 'r':
            $sum+=$p;
            break;
        case 's':
            $sum+=$r;
            break;
        case 'p':
            $sum+=$s;
            break;
    }
}
echo $sum."\n";
?>


Measured memory_bytes: 23180
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100000;

int main() {
	ll n;
	cin >> n;
	ll a = INFL;
	rep(i, 5) {
		ll b;
		cin >> b;
		a = min(a, b);
	}
	ll ans = n / a + 5;
	if (n % a == 0) ans--;
	cout << ans << endl;
}


Measured memory_bytes: 256
<?php
  $n = trim(fgets(STDIN));
  $s = trim(fgets(STDIN));
  $e = 0;
  for($i=0; $i<$n; $i++){
      if($s[$i] == "E"){
          $e++;
      }
  }
  
  $right = $e;
  $left = 0;
  $min = PHP_INT_MAX;
  for($i=0; $i<$n; $i++){
      if($s[$i] == "E"){
          $right--;
      }
      $ans = $right+$left;
      $min = min($min, $ans);
      if($s[$i] == "W"){
          $left++;
      }
  }
  echo $min;

Measured memory_bytes: 4604
#include <iostream>
#include <climits>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <deque>
#define INF_INT (INT_MAX / 2)
#define INF_LONG (LONG_MAX / 2)
//#define DEBUG true
#define DEBUG false
using namespace std;

typedef long long ll;
typedef pair< int, int > pii;
typedef pair< ll, ll > pll;
typedef pair< ll, int > pli;
typedef pair< int, ll > pil;

int ceil(int x, int y){
  return (x % y == 0) ? x / y : x / y + 1;
}

int gcd(int x, int y){
  return y ? gcd(y, x % y) : x;
}

int lcm(int x, int y){
  return x / gcd(x, y) * y;
}

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

  int n;
  cin >> n;
  int p[n];
  for(int i = 0; i < n; i++) cin >> p[i];

  int a[n + 1];
  for(int i = 0; i < n; i++){
    a[p[i]] = i;
  }

  int mx = 1, c = 1;
  for(int i = 1; i + 1 <= n; i++){
    if(a[i] < a[i + 1]) ++c;
    else c = 1;
    mx = max(mx, c);
  }

  int ans = n - mx;

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1792
mod = 10**9+7
n = int(input())
if n < 3:
    print(4**n)
    exit()

ind = 0
d = {}
# A:0, G:1, C:2, T:3とする
from itertools import product
for i, j, k in product(range(4), repeat=3):
    if any(a==0 and b==1 and c==2 for a,b,c in [[i,j,k], [j,i,k], [i,k,j]]):
        continue
    d[(i,j,k)] = ind
    d[ind] = (i,j,k)
    ind += 1

# 使える文字列→使える文字列への写像
edge = [[] for i in range(ind)]
for i, j, k in product(range(4), repeat=3):
    if any((a,b,c)==(0,1,2) for a,b,c in [(i,j,k), (j,i,k), (i,k,j)]):
        continue
    for l in range(4):
        if (j,k,l) in d and (i,k,l) != (0,1,2) and (i,j,l) != (0,1,2):
            edge[d[i,j,k]].append(d[j,k,l])

dp = [1]*ind
for i in range(n-3):
    dp_next = [0]*ind
    for from_ in range(ind):
        for to in edge[from_]:
            dp_next[to] += dp[from_]
            dp_next[to] %= mod
    dp = dp_next
print(sum(dp)%mod)

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

using namespace std;

int solve(int d)
{
    double x,y;
    cin >> x >> y;
    double ans = sqrt(x*x+y*y);
    if(ans<=d) return 1;
    return 0;
}

int main()
{
    int n,d,br=0;
    cin >> n >> d;
    while(n--)
    {
       br+=solve(d);
    }
    cout << br;
}


Measured memory_bytes: 3708
main(){
	int n;
	while(~scanf("%d",&n)){
		int a,b,c,d,cnt=0;
		for(a=0;a<=9;a++)
			for(b=0;b<=9;b++)
				for(c=0;c<=9;c++)
					for(d=0;d<=9;d++)
						if(a+b+c+d==n)
							cnt++;
		printf("%d\n",cnt);
	}
	exit(0);
}

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

string lowen(string str)
{
	for(int i=0; i<str.size(); i++)
	{
		if('A'<=str[i] && 'Z'>=str[i])
			str[i] += 'a'-'A';
	}
	return str;
}

int main(void)
{
	
	string str;
	int mode = 0;
	string modest = "";
	string longest = "";
	map<string,int> dic;

	while(cin >> str)
	{
		str = lowen(str);
		if(dic.count(str))
		{
			dic[str]++;
			if(mode < dic[str])
			{
				mode = dic[str];
				modest = str;
			}
		}
		else
		{
			dic.insert( map<string,int>::value_type(str,1) );
			if(longest.size() < str.size())
				longest = str;
		}
	}
	cout << modest << " " << longest << endl;
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define mem(dp,a) memset(dp,a,sizeof dp);
#define all(a) a.begin(),a.end()
#define sall(a) sort(all(a))
#define X first
#define Y second
typedef long long int ll;
typedef pair<ll,ll> pp;

#define debug(x) cout << #x << " :: "<< x <<"\n";
#define debug2(x,y) cout << #x << " :: "<< x << "\t" << #y << " :: " << y << "\n";
#define debug3(x,y,z) cout << #x << " :: "<< x << "\t" << #y << " :: " << y << "\t" << #z << " :: " << z << "\n";
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree< pp , null_type,less< pp >, rb_tree_tag,tree_order_statistics_node_update>

ll power(ll b, ll exp){
    ll res = 1;
    while(exp > 0){
        if(exp % 2){
            res = 1LL * res * b % mod;
        }
        b = 1LL * b * b % mod;
        exp /= 2;
    }
    return res;
}

int main()
{
    boost
    ll x,n;
    cin >> x;
    if( x>=400 && x<600 )   {
        cout << "8";
    }
    else if( x>=600 && x<800 )   {
        cout << "7";
    }
    else if( x>=800 && x<1000 )   {
        cout << "6";
    }
    else if( x>=1000 && x<1200 )   {
        cout << "5";
    }
    else if( x>=1200 && x<1400 )   {
        cout << "4";
    }
    else if( x>=1400 && x<1600 )   {
        cout << "3";
    }
    else if( x>=1600 && x<1800 )   {
        cout << "2";
    }
    else if( x>=1800 && x<2000 )   {
        cout << "1";
    }
    return 0;
}


Measured memory_bytes: 3648
N = int(input())
max_div = [1, 0]
for n in range(1, N + 1):
    div = [n, 0]
    while n % 2 == 0:
        n //= 2
        div[1] += 1
    if div[1] > max_div[1]:
        max_div = div
print(max_div[0])


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

int main() {
  int N; 
  cin >> N;
  int data[N];
  for (int i = 0; i < N; i++) {
    cin >> data[i];
  }
  bool result = true;
  for (int i = 0; i < N; i++) {
      if (data[i] % 2 == 0) {
          if(data[i] % 3 == 0 || data[i] % 5 == 0) {
            // 処理なし
          } else {
            result = false;
            break;
          }
      }
  }
  string resultText = result  ?  "APPROVED" : "DENIED";
    cout <<  resultText << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<int,int>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(int a,int b,int c){
        from = a;
        to = b;
        value = c;
    }
    Edge(int a,int b){
        from = a;
        to = b;
    }
};
int N,M;
void calc(int i);
LL moke();
LL ans= -LINF;
int mass[3];
V<V<LL>> vec(3);
int main(){
    CIN(A);CIN(B);
    if(A<=8&&B<=8){
        COUT("Yay!");
    }else{
        COUT(":(");
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define UP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define UU(a,b,c) for(ll (a)=(b);(a)<=(c);(a)++)
#define DN(a,b,c) for(ll (a)=(b);(a)>(c);(a)--)
#define DU(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)

ll n, arr[105];

void reset()
{
}

void input()
{
	ll total =0 ;
	cin>>n;
	UU(i,1,n) cin>>arr[i];
	sort(arr + 1, arr + 1 + n);
	
	UU(i,1, n)
	{
		UU(j,i + 1,n)
		{
			UU(k, j + 1, n)
			{
				total += (arr[k] < arr[i] + arr[j] && (arr[i] != arr[j] && arr[j] != arr[k] && arr[i] != arr[k]));
			}
		}
	}
	cout<<total<<endl;
}

void solve()
{
}

void LetsRock()
{
	solve();	
}

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

	input();
	reset();
	LetsRock();
	
	return 0;
}


Measured memory_bytes: 3652
N = int(input())
M = [input() for i in range(N)]
 
M_sorted = [''.join(sorted(m)) for m in M]
d = {}
ans = 0
 
for m in M_sorted :
    d.setdefault(m,0)
    ans += d[m]
    d[m] += 1
 
print(ans)

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

int main(void){
	int N,K;
	cin >> N >> K;
	int p[N];
	for(int i = 0; i < N; ++i){
		cin >> p[i];
	}
	unsigned long long max = 0;
	unsigned long long sum = 0;
	int pos = 0;
	for(int i = 0; i < K; ++i){
		sum += p[i];
	}
	max = sum;
	pos = 0;
	for(int i = 1;i <= N - K; ++i){
		sum -= p[i-1];
		sum += p[i + K - 1];
		if(sum >= max){
			max = sum;
		}
	}
	//cout << "pos= " << pos << endl;
	//cout << "sum= " << sum << endl;
	long double ans = 0;
	/*for(int i = pos; i < pos + K; ++i){
		ans += double(p[i] + 1);
	}*/
	ans = (long double)(max + K) / 2;
	cout << fixed << setprecision(12) << ans << '\n';
}



Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const ll INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int n,a,b;
	cin>>n>>a>>b;
	cout<<min(n*a,b)<<endl;
	return 0;
}


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

int main(void){
    int a, b;
  	scanf("%d %d", &a, &b);
  	if (a == 1) a = a + 13;
  	if (b == 1) b = b + 13;
  	if (a > b) printf("Alice");
  	else if (a == b) printf("Draw");
  	else printf("Bob");
  return 0;
}



Measured memory_bytes: 128
import bisect

N = int(input())
As = sorted(list(map(int, input().split())))
Bs = sorted(list(map(int, input().split())))
Cs = sorted(list(map(int, input().split())))

cnt = 0
for b in Bs:
    a_b = bisect.bisect_left(As,b)
    b_c = N - bisect.bisect_right(Cs, b)
    
    cnt += a_b * b_c
print(cnt)

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

int main() {
	// your code goes here
	
	    ll n ,w;
	    cin>>n>>w;
	    ll dp[n+1][w+1] , arr[n+1][2];
	    for(int i=1 ;i<=n ; i++){
	        cin>>arr[i][0]>>arr[i][1];
	    }
	    memset(dp , 0 , sizeof(dp));
	    for(int i=arr[1][0] ; i<=w; i++){
	        dp[1][i] = arr[1][1];
	    }
	    for(int i=2 ;i<=n ; i++){
	        for(int j=1; j<=w ; j++){
	            dp[i][j]= dp[i-1][j];
	            if(j-arr[i][0] >=0)
	            dp[i][j]= max(dp[i][j] , arr[i][1] + dp[i-1][j - arr[i][0]]);
	        }
	    }
	    cout<<dp[n][w]<<endl;
	
	return 0;
}


Measured memory_bytes: 82424
#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 INF = 1000000000;
const int MOD = 1000000007;

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

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

  if(b == 1){
    cout << 0 << endl;
    return 0;
  }

  ll x;
  if(n < b){
    x = n;
  }
  else{
    x = n / b * b - 1;
  }
  cout << (a * x) / b - (x / b) * a << endl;
  return 0;
}


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

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node treeMinimum(Node x){
  while(x->left!=NIL) x = x->left;
  return x;

}

Node treeSearch(Node u, int k){
  while(u != NIL && k != u->key){
	  if(k<u->key) u=u->left;
	  else u=u->right;
	  }
	  return u;
}

Node treeSuccessor(Node x){
  Node y;
  
  if(x->right != NIL) return treeMinimum(x->right);
  y=x->parent;
  while(y!=NIL && x==y->right){
	  x=y;
	  y=y->parent;
	  }
  return y;
}

void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y

  if(z->left==NIL || z->right==NIL) y=z;
  else y= treeSuccessor(z);
  if(y->left != NIL) x=y->left;
  else x=y->right;
  
  if(x!=NIL) x->parent = y->parent;
  if(y->parent==NIL) root=x;
  else if(y==y->parent->left) y->parent->left=x;
  else y->parent->right=x;
  
  if(y!=z) z->key=y->key;

}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
  while(x!=NIL){
	  y=x;
	  if(z->key < x->key) x=x->left;
	  else x=x->right;
	  }
  z->parent=y;
  if(y==NIL) root=z;
  else if(z->key < y->key) y->left=z;
  else y->right = z;
}

void inorder(Node u){
  if(u!=NIL){
	  inorder(u->left);
	  printf(" %d",u->key);
	  inorder(u->right);
	  }
}
void preorder(Node u){
  if(u!=NIL){
	  printf(" %d",u->key);
	  preorder(u->left);
	  preorder(u->right);
	  }
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }

  return 0;
}

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

int main(){
  int x; cin >> x;
  int ans = 1;
  for(int i = 2; i <= sqrt(x); i++){
  	int a = i;
  	while(a <= x) a *= i;
  	ans = max(ans, a/i);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    
    int N, ans=0;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    sort(A.begin(), A.end());
    for(int i=0; i<N-1; i++){
        if(A[i]==A[i+1]){
            ans++;
        }
    }
    if(ans==0){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    
}

Measured memory_bytes: 1024
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int x = sc.nextInt();

        int threshold = a * a * b / 2;
        double degree;
        if (x <= threshold) {
            double z = ((double) x) * 2 / a / b;
            degree = 90 - Math.toDegrees(Math.atan(z / b));
        }
        else {
            int space = a * a * b - x;
            double z = (double) space * 2 / a / a;
            degree = Math.toDegrees(Math.atan(z / a));
        }
        System.out.println(degree);
    }
}


Measured memory_bytes: 23892