akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main()
{
    string a, b, c;
    cin >> a >> b >> c;
    if(a[a.size()-1]==b[0] and b[b.size()-1]==c[0]) cout << "YES";
    else cout << "NO";
}



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

#define READ freopen("alu.txt", "r", stdin);
#define WRITE freopen("vorta.txt", "w", stdout);
#define INFLOOP puts("lup");getchar()

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<int>::iterator vi_i;
typedef pair<int, int> pii;

const int MAX = 5e5 + 10;

int arr[4];

int main()
{
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; i++){
		int temp;
		scanf("%d", &temp);
		arr[temp % 4]++;
	}
	if(arr[0] >= arr[1] + arr[3]) printf("Yes");
	else if(arr[0] >= arr[1] + arr[3] - 1 && arr[2] == 0) printf("Yes");
	else printf("No"); 

    return 0;
}


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

using namespace std;

long long x, ans;

int main()
{
    scanf("%lld", &x);
    x--;
    ans += 2 * (x / 11); x %= 11;
    if (x <= 5) ans++; else ans += 2;

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

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define idfc ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define ll long long
#define pb emplace_back
#define mp make_pair
#define nt _int128
#define ld long double
long double PI =3.14159265358979323846;


const ll modo=1e9+7;
const ll inf=1e16;
const ll ms=(2e5) +5;



int main()
{
    idfc;
   ld a,b,c;
   cin>>a>>b>>c;
   c-=a;
   c-=b;
   if(c<=0)cout<<"No";
   else{
       c/=2;
       ll mul=a*b;
       c*=c;
       if(c>mul)cout<<"Yes";
       else cout<<"No";
   }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>

using namespace std;

int main() {

    int N = 0;
    cin >> N;

    int num = 0;
    int lastHeight = 0;
    int currentHeight = 0;
    int step = 0;
    int maxStep = 0;

    while (num < N) {
        cin >> currentHeight;
        if (lastHeight >= currentHeight) {
            step++;
        } else {
            maxStep = max(step, maxStep);
            step = 0;
        }
        lastHeight = currentHeight;
        num++;
    }
    maxStep = max(step, maxStep);

    cout << maxStep << endl;
    return 0;
}


Measured memory_bytes: 256
/*#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <array>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
*/

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())

typedef long long ll;
const ll inf = 2e9 + 7;
const int MAX_N = 5e5 + 5;
int dx[] = { -1,0,1,0 }, dy[] = { 0,1,0,-1 };
vector<ll> prime;

ll inv[MAX_N], fac[MAX_N];

template <class T = int> T in() { T x; cin >> x; return (x); }
inline ll GCD(ll a, ll b) { ll c; while (b != 0) { c = a % b; a = b; b = c; }return a; }
inline ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
inline ll POW(ll a, ll b) { ll c = 1; while (b > 0) { if (b & 1) { c = a * c%inf; }a = a * a%inf; b >>= 1; }return c; }
inline void _nCr() { fac[0] = 1; for (int i = 1; i < MAX_N; i++) { fac[i] = fac[i - 1] * i%inf; }for (int i = 0; i < MAX_N; i++) { inv[i] = POW(fac[i], inf - 2); } }
inline ll nCr(ll n, ll r) { return (fac[n] * inv[r] % inf)*inv[n - r] % inf; }
inline void PRI(ll n) { bool a[n + 1]; for (int i = 0; i < n + 1; i++) { a[i] = 1; }for (int i = 2; i < n + 1; i++) { if (a[i]) { prime.pb(i); ll b = i; while (b <= n) { a[b] = 0; b += i; } } } }

typedef pair<int, pair<int, int>> edge;

class UnionFind {
private:
	vector<int> par;
public:
	UnionFind(int N) { par = vector<int>(N, -1); }
	int find(int x);
	ll size(int x);
	void unite(int x, int y);
	bool same(int x, int y);
};



class Kruskal {
private:
	UnionFind *uf;
	vector<edge> e;
public:
	vector<edge> mst;
	Kruskal(int N) { uf = new UnionFind(N); }
	void add(int x, int y, ll z);
	void run();
};



//----UnionFind-------------------------------
int UnionFind::find(int x) {
	if (par[x] < 0) return x;
	else return par[x] = find(par[x]);
}

ll UnionFind::size(int x) {
	return -par[find(x)];
}

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

	//大きい方に小さい方をくっ付ける
	if (size(x) < size(y)) swap(x, y);
	par[x] += par[y];
	par[y] = x;
}

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



//----Kruskal-------------------------------
void Kruskal::add(int x, int y, ll z) {
	//x < y
	if (x > y) swap(x, y);
	e.push_back({ z,{x,y} });
}

void Kruskal::run() {
	sort(e.begin(), e.end());
	e.erase(unique(e.begin(), e.end()), e.end());
	for (auto x : e) {
		if (uf->same(x.second.first, x.second.second)) {
			continue;
		}
		else {
			mst.push_back(x);
			uf->unite(x.second.first, x.second.second);
		}
	}
}

signed main() {
	int h=in(),w=in();
	int hh=in(),ww=in();
	cout << (h-hh) * (w-ww) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int ans[1<<10][1<<10];
int main()
{
	int k;
	scanf("%d",&k);
	if(k==1){
		printf("1\n1");
		exit(0);
	}
	int n=(k+3)/4*2;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++){
			ans[i][j]=(i+j)%n;
			if(i&1)ans[i][j]+=n;
		}
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			if(ans[i][j]>=k)ans[i][j]-=n;
	printf("%d\n",n);
	for(int i=1;i<=n;i++,puts(""))
		for(int j=1;j<=n;j++)
			printf("%d ",ans[i][j]+1);
	return 0;
}

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

#define lp(i,n) for(int i=0;i<n;i++)
#define lpin(a,i,n) for(int i=0;i<n;i++){cin>>a[i];}
using namespace std;

int main(){
  int n,m;
  cin>>n>>m;
  int a[1000],b[1000];
  lpin(a,i,n);
  lpin(b,i,m);
  int c[1000];
  lp(i,1000){
    c[i]=0;
  }
  int x;
  lp(i,m){
    x=0;
    lp(j,n){
      if(a[j]<=b[i]){
	c[j]+=1;
	x+=1;
      }
      if(x==1) break;
    }
  }
  int max=0;
  x=0;
  lp(i,n){
    if(max<c[i]){
      max=c[i];
      x=i;
    }
  }
  cout<<x+1<<endl;
  return 0;
}



Measured memory_bytes: 3112
abcd=[int(i) for i in input()]
a=abcd[0]
b=abcd[1]
c=abcd[2]
d=abcd[3]

if a+b+c+d == 7:
  print('{}+{}+{}+{}=7'.format(a,b,c,d))
elif a+b+c-d == 7:
  print('{}+{}+{}-{}=7'.format(a,b,c,d))
elif a+b-c+d == 7:
  print('{}+{}-{}+{}=7'.format(a,b,c,d))
elif a-b+c+d == 7:
  print('{}-{}+{}+{}=7'.format(a,b,c,d))
elif a+b-c-d == 7:
  print('{}+{}-{}-{}=7'.format(a,b,c,d))
elif a-b-c+d == 7:
  print('{}-{}-{}+{}=7'.format(a,b,c,d))
elif a-b+c-d == 7:
  print('{}-{}+{}-{}=7'.format(a,b,c,d))
elif a-b-c-d == 7:
  print('{}-{}-{}-{}=7'.format(a,b,c,d))
else:
  pass

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

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


using namespace std;

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

int main() {
	int N, x, i, X, ans = 0;
	cin >> N >> X >> x;
	//N=1のとき
	if (N == 1) {
		cout << abs(x - X) << endl;
		return 0;
	}
	ans = abs(x-X);
	FOR(i, 1, N) {
		cin >> x;
		ans = GCD(ans, abs(x - X));
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
H,W = map(int,input().split())
A = [None for _ in range(H)]
for i in range(H):
  A[i] = input()

count = 0

for i in range(H):
  for j in range(W):
    if A[i][j] == '#':
      count += 1

if count == H+W-1:
  print('Possible')
else:
  print('Impossible')

Measured memory_bytes: 3060
n = int(input())
l = list(map(int, input().split()))

ans = 0
tmp = 0
for i in range(1, n):
    if l[i] <= l[i-1]:
        tmp += 1
        if i == n-1:
            ans = max(ans, tmp)
    else:
        ans = max(ans, tmp)
        tmp = 0

print(ans)


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

int main(){
    int N;
    cin >> N;
    int an = 0;
    if(N%10 == 7){an=1;}
    else if(N%100 - N%10 == 70){an=1;}
    else if(N-N%100 == 700){an=1;}
    

    if(an==1){cout << "Yes" <<endl;}
    else {cout << "No" << endl;}
}

Measured memory_bytes: 3564
#include<bits/stdc++.h>
 
#define mp make_pair
#define pb push_back
#define f first
#define s second 
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()
#define forn(i, x, y) for(int i = x; i <= y; i++)
#define forev(i, y, x) for(int i = y; i >= x; i--)
 
using namespace std;
 
const int maxn = (int)2e5 + 100;
const int mod = (int)1e9 + 7;
const int P = (int)1e6 + 7;
const int inf = (int)1e9 + 7;
 
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef long double ld;
 
int n, m, p, bad[maxn];
vi g[maxn], gr[maxn];
struct edge {
	int a, b, cost;
};
 
vector<edge> e;
const int INF = 1000000000;
 
int check() {
	vector<int> d (n);
	vector<int> p (n, -1);
	int x;
	for (int i=0; i<n; ++i) {
		x = -1;
		for (int j=0; j<m; ++j){
			if(bad[e[j].b] || bad[e[j].a]) continue;
			if (d[e[j].b] > d[e[j].a] - e[j].cost) {
				d[e[j].b] = max (-INF, d[e[j].a] - e[j].cost);
				p[e[j].b] = e[j].a;
				x = e[j].b;
			}
		}
	}
	return (x == -1);
}
int dfs(int v) {
	vector<int> d (n, -INF);
	d[v] = 0;
	for (int i=0; i<n-1; ++i)
		for (int j=0; j<m; ++j){
		
			if(bad[e[j].b] || bad[e[j].a]) continue;
			if (d[e[j].a] > -INF)
				d[e[j].b] = max(d[e[j].b], d[e[j].a] + e[j].cost);
			}
	return d[n - 1];
}
int used1[maxn], used2[maxn];
void dfs1(int v){
	used1[v] = 1;
	for(auto to : g[v])
		if(!used1[to])
			dfs1(to);
}
void dfs2(int v){
	used2[v] = 1;
	for(auto to : gr[v])
		if(!used2[to])
			dfs2(to);
}
int main () {
    cin >> n >> m >> p;
    forn(i, 1, m){
        int u, v, w;
        cin >> u >> v >> w;
        edge cur; 
        g[u].pb(v);
        gr[v].pb(u);
        cur.a = u - 1, cur.b = v - 1, cur.cost = w - p;
        e.pb(cur);
    }
    dfs1(1);
    dfs2(n);
    forn(i, 1, n){
    	if(!(used1[i] & used2[i]))
    		bad[i - 1] = 1;
    }
    if(!check()){
    	cout << -1;
    	return 0;
	}
    cout << max(0, dfs(0));
}


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

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

	vector<int> a(N);

	int an;

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

	for (int i = 0; i < N; i++)
	{
		cout << a[i] << endl;
	}
}

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

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

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <utility>

using namespace std;

typedef pair<int, int> Pii;

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

  int N;
  cin >> N;
  vector<int> A;
  for (int i = 0; i < N; i++) {
    int buf;
    cin >> buf;
    A.push_back(buf);
  }
  map<int, int> cardCount;
  for (int i = 0; i < N; i++) {
    if (cardCount.find(A[i]) != cardCount.end()) cardCount[A[i]] += 1;
    else cardCount[A[i]] = 1;
  }
  auto left = cardCount.begin();
  auto right = cardCount.rbegin();
  while (left != cardCount.end() || right != cardCount.rend()) {
    while (left != cardCount.end()) {
      if (left->second <= 1)  left++;
      else break;
    }
    while (right != cardCount.rend()) {
      if (right->second <= 1)  right++;
      else break;
    }
    if (left == cardCount.end() || right == cardCount.rend()) break;
    left->second -= 1;
    right->second -= 1;
  }
  int cardLeft = 0;
  for (const auto& x : cardCount) cardLeft += x.second;
  cout << cardLeft << endl;
  return 0;
}


Measured memory_bytes: 5368
package main

import (
	"fmt"
	"strconv"
)

func main() {
	var n string
	fmt.Scan(&n)

	ns := split(n)
	sum := 0
	for i := 0 ;i < len(ns); i++ {
		a, _ := strconv.Atoi(ns[i])
		sum +=  a
	}

	if sum % 9 == 0 {
		fmt.Println("Yes")
		return

	}
	fmt.Println("No")
}


func Sum(arr ...int) (sum int) {
	for _, x := range arr {
		sum += x
	}
	return
}
func split(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}


Measured memory_bytes: 7344
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <array>
#include <vector>
#include <utility>
#include <bitset>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <numeric>

using namespace std;

using ll = long long;
using p = pair<ll, ll>;

constexpr ll INF = 1LL << 62;
constexpr ll MOD = 1e9 + 7;

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

    string S;
    cin >> S;

    vector<ll> C(26, 0);
    for (auto s : S) {
        C[s - 'a']++;
    }

    ll spicies = 0;
    for (auto c : C) {
        if (c) {
            spicies++;
        }
    }

    ll h[2] = {-1, -1};
    for (ll len = 0; len < S.size(); len++) {
        ll ma = 0;
        ll idx = -1;
        for (ll i = 0; i < 26; i++) {
            if (C[i] > ma && i != h[0] && i != h[1]) {
                ma = C[i];
                idx = i;
            }
        }

        if (idx == -1) {
            cout << "NO" << endl;
            return 0;
        }

        C[idx]--;
        h[0] = h[1];
        h[1] = idx;
    }

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



Measured memory_bytes: 512
package main

import (
	"fmt"
	"io/ioutil"
	"os"
	"strings"
)

func main() {
	b, _ := ioutil.ReadAll(os.Stdin)
	s := strings.TrimSpace(string(b))

	words := []string{"dream", "dreamer", "erase", "eraser"}
	i := len(s)
	for j := 0; j < 4; j++ {
		if strings.HasSuffix(s[:i], words[j]) {
			i -= len(words[j])
			j = -1
		}
	}
	if i == 0 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 896
while True:
    N=int(input())
    if N==0:break
        
    D=[0]*(N+1)
    D[0]=1

    for i in range(1,N+1):
     D[i]=(D[i-1]+D[i-2]+D[i-3])
    print( int(-((-D[-1]/10)//365))) 


Measured memory_bytes: 5612
#include <iostream>
#include <fstream>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <algorithm>

#define MOD_BIG 1000000007
#define MOD_BIG2 998244353
using std::string;
using std::cin;
using std::cout;
using std::cerr;
using std::endl;
using ll = long long;
using std::vector;

template<typename T> void ndarray(vector<T> &vec, int len) { vec.resize(len); }
template<typename T, typename... Args> void ndarray(vector<T> &vec, int len, Args... args) {
    vec.resize(len);
    for (auto &v : vec) ndarray(v, args...);
}

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


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

int main() {
    
    int N;
    string S;
    
    cin >> N >> S;
    for (int i = 0; i < S.length(); i++) {
        if (S[i]+N > 'Z') {
            char c = S[i] + N - 26;
            cout << c;
        } else {
            char c = S[i] + N;
            cout << c;

        }
    }
    cout << endl;
    
    return 0;
}


Measured memory_bytes: 256
n = gets.chomp.to_i
L = gets.chomp.split().map(&:to_i)

cnt = 0
L.combination(3).to_a.each do |edges|
  e1 = edges[0] < edges[1] + edges[2]
  e2 = edges[1] < edges[0] + edges[2]
  e3 = edges[2] < edges[0] + edges[1]
  eq = edges.uniq.length == 3

  cnt += 1 if e1 && e2 && e3 && eq
end

puts cnt


Measured memory_bytes: 29608
#include<iostream>
#include<stdio.h>
#include<vector>
using namespace std;
vector<int> v[100001];
int dl[100001]={1};//队列 
int fj,td;//房间，通道 
int lj[100001];//路径 
int head,tail;
int main()
{
	cin>>fj>>td;
	int a,b;
	for(int i=0;i<td;i++)
	{
		cin>>a>>b;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	while(head<=tail)
	{
		for(int i=0;i<v[dl[head]].size();i++)
		{
			if(lj[v[dl[head]][i]]==0)
			{
				lj[v[dl[head]][i]]=dl[head];
				tail++;
				dl[tail]=v[dl[head]][i];
//				cout<<dl[tail]<<endl;
			}
		}
		head++;
	}
	int pd=0;
	for(int i=2;i<=fj;i++)
	{
		if(lj[i]==0)
			pd++;
	}
	if(!pd)
	{
		cout<<"Yes\n";
		for(int i=2;i<=fj;i++)
		{
			cout<<lj[i]<<endl;
		}
	}
	else
		cout<<"No";
	return 0;
}

Measured memory_bytes: 10716
i=map;n,m=i(int,input().split());a,b=set(i(int,input().split())),set(i(int,input().split()));c=1;N=M=0
for k in range(m*n,0,-1):
 A=k in a;B=k in b
 if A and B:N+=1;M+=1
 elif A:c*=M;N+=1
 elif B:c*=N;M+=1
 else:c*=M*N-m*n+k
 c%=10**9+7
print(c)

Measured memory_bytes: 3188
n = int(input())
list_HP = list(map(int, input().split()))

while len(list_HP)!=1:
	new_list = []
	smallest = min(list_HP)

	for i in range(len(list_HP)):
		temp = int(list_HP[i]/smallest)
		list_HP[i] = list_HP[i] - (smallest*temp)
		if list_HP[i] != 0:
				new_list.append(list_HP[i])
	list_HP = new_list
	list_HP.append(smallest)

print(list_HP[0])



Measured memory_bytes: 14224
/*Author SHUBH AGRAWAL  */

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pu push  //  adds the value to the last of the queue 
#define lld long long int
#define ins insert /// used in set to insert the values 
#define adv advance  /// used to increment the iterator
#define mp make_pair
#define fi first
#define se second
#define all(c) c.begin(),c.end()
#define PI 3.1415926
#define INF (lld)1e18
#define vl  vector<long long int >
#define vpl vector< pair<lld ,lld> >
#define vvl vector<vector<lld> > 
#define pll pair <lld,lld>
long long int modp(lld a,lld p,lld n)
{
    int d[100];
    int i,j,k,l;
    if(n==0) return 1;
    for(i=0;n>=1;i++)
    {
        d[i]=n%2;
        n/=2;
    }
    l=i;
    long long int e=1;
    if(d[0]==1) e*=(a%p);
    for(i=1;i<l;i++)
    {
        a*=a;
        a=a%p;
        if(d[i]==1) 
        {
            e*=a;
            e=e%p;
        }
    }
    return e%p;
}
lld modInverse(lld n, lld p) 
{ 
    return modp(n, p, p-2); 
}

long long int nCrModPFermat(lld n, lld r,lld p) 
{ 
   // Base case 
   if (r==0) 
      return 1; 
    
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r 
    
    lld fac[n+1]; 
    fac[0] = 1; 
    for (lld i=1 ; i<=n; i++) 
    fac[i] = fac[i-1]*i%p; 
     
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
}


long long int gcd(lld b,lld a)
{
    if(a<b) return gcd(a,b);
    if(a%b==0) return b;
    return gcd(a%b , b);
}

lld p1=1000000007,p2=998244353;
lld l,r,mid,ans;
lld n,m,i,j,k;
lld x,y,n1,n2,h,z;
lld w,u;

lld d,p=1000000000;
void solve()
{
    cin>>n>>m;
    cout<<n*(n-1)/2+m*(m-1)/2;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t=1;
   //cin>>t;
   for(int i=0;i<t;i++)
    {
     //   cout<<"Case #"<<i+1<<": ";
        solve();
        cout<<"\n";
    }
    return 0;
}

/*void dfs()
{
    if(q.empty()) return;
    p=q.top();

    if(visited[p.se]==true) return;
    visited[p.se]=true;
    q.pop();
    lld l=v[p.se].size();
    for(i=0;i<l;i++)
    {
        if()
    }
}*/

Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

vector<int> a;

void swap_a(int i1, int i2) {
  int tmp = a.at(i1);
  a.at(i1) = a.at(i2);
  a.at(i2) = tmp;
}

void print_a() {
  for(int i = 0; i < a.size(); i++) {
    cout << a.at(i);
    if(i < a.size() - 1) {
      cout << " ";
    }
  }
  cout << endl;
}

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

  a.resize(n);
  for(int i = 0; i < a.size(); i++) {
    cin >> a.at(i);
  }

  int swcnt = 0;
  int mini;
  for(int i = 0; i < n; i++) {
    mini = i;
    for(int j = i + 1; j < n; j++) {
      if(a.at(j) < a.at(mini)) {
	mini = j;
      }
    }
    if(i != mini) {
      swcnt++;
      swap_a(i, mini);
    }
  }

  print_a();
  cout << swcnt << endl;
}



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

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

const int INF=1e9;
const int MOD=1e9+7;

vector<ll> prime_table(ll n){ //素数全列挙
    vector<ll> prime(n+1);
    for(int i=0;i<=n;i++){
        prime[i]=i;
    }  
    for(int i=2;i*i<=n;i++){
        if(prime[i]!=i) continue;
        for(int j=2*i;j<=n;j+=i){
            if(prime[j]/i==1) continue;
            prime[j]/=i;
        }
    }
    return prime; //i番目の要素が素数の場合trueを返す
}

int main(){
    int N; cin >> N;
    ll a[N];
    for(int i=0;i<N;i++){
        cin >> a[i];
    }
    sort(a,a+N);
    vector<ll> prime=prime_table(a[N-1]);
    ll used[a[N-1]+1]={};
    bool flag=true;
    for(int i=0;i<N;i++){
        set<ll> s;
        ll tmp=a[i];
        while(tmp>1){
            s.insert(prime[tmp]);
            tmp/=prime[tmp];
        }
        for(auto res:s){
            if(used[res]){
                //cout << res << endl;
                flag=false;
            }
            used[res]=true;
        }
    }
    ll ans=a[0];
    for(int i=1;i<N;i++){
        ans=__gcd(ans,a[i]);
    }
    if(flag){
        cout << "pairwise coprime" << endl;
    }else if(ans==1){
        cout << "setwise coprime" << endl;
    }else{
        cout << "not coprime" << endl;
    }
}

Measured memory_bytes: 26756
#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
#include<algorithm>
#include<math.h>
#include<map>
#include<queue>

int main() {
	int n;
	cin >> n;
	vector<int>a(n);
	int count(0);
	rep(i, n) {
		int buffer;
		cin >> buffer;
		if (i + 1 != buffer) {
			++count;
		}
	}
	if (count <= 2) {
		cout << "YES";
	}
	else {
		cout << "NO";
	}
	return 0;
}

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

#define int long long
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rep1(i,n) for(int i=1;i<=(int)(n);++i)
#define rep11(i,n) for(int i=1;i<(int)(n);++i)
#define repo(i,o,n) for(int i=o;i<(int)(n);++i)
#define repm(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define pb(n) push_back(n)
#define mp make_pair
#define INF LONG_LONG_MAX
#define MOD 1000000007
#define Yes cout << "Yes" << endl;
#define No cout << "No" << endl;

int n;
string s;
set<string> st;

signed main() {
    cin >> n;
    rep(i,n) cin >> s, st.insert(s);
    cout << st.size() << endl;
}




Measured memory_bytes: 19256
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<unordered_set>
#include<unordered_map>
using namespace std;
int ans=0;
int main(){
	int n,m;
	cin>>n>>m;
	vector<vector<char>> grid(n,vector<char>(m));
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>grid[i][j];
		}
	}
	vector<vector<int>> dp(n,vector<int>(m));
	dp[n-1][m-1] = 1;
    for(int i=n-1;i>=0;i--){
    	for(int j=m-1;j>=0;j--){
    		if(i==n-1&&j==m-1)
    		    continue;
    		if(grid[i][j]=='#')
    		    dp[i][j] = 0;
    		else
    		    dp[i][j] = ((i==n-1?0:dp[i+1][j])+(j==m-1?0:dp[i][j+1]))%(1000000007);
		}
	}
	cout<<dp[0][0];
	return 0;
}



Measured memory_bytes: 8536
class Dice():
    def __init__(self, spots):
        self.spots = [spots[i] for i in range(6)]
    
    def roll(self, direction):
        if direction == 0:
            self.spots = [self.spots[i] for i in [1, 5, 2, 3, 0, 4]]
        elif direction == 1:
            self.spots = [self.spots[i] for i in [3, 1, 0, 5, 4, 2]]
        elif direction == 2:
            self.spots = [self.spots[i] for i in [4, 0, 2, 3, 5, 1]]
        elif direction == 3:
            self.spots = [self.spots[i] for i in [2, 1, 5, 0, 4, 3]]
            
dice_a = list(map(int, input().split()))
dice_b = list(map(int, input().split()))

my_dice = Dice(dice_a)

a, b = dice_b[0], dice_b[1]

if b == my_dice.spots[0]:
    my_dice.roll(2)
elif b == my_dice.spots[1]:
    pass
elif b == my_dice.spots[2]:
    my_dice.roll(3)
    my_dice.roll(2)
elif b == my_dice.spots[3]:
    my_dice.roll(1)
    my_dice.roll(2)
elif b == my_dice.spots[4]:
    my_dice.roll(2)
    my_dice.roll(2)
elif b == my_dice.spots[5]:
    my_dice.roll(0)

if a == my_dice.spots[0]:
    pass
elif a == my_dice.spots[2]:
    my_dice.roll(3)
elif a == my_dice.spots[3]:
    my_dice.roll(1)
elif a == my_dice.spots[5]:
    my_dice.roll(1)
    my_dice.roll(1)
    
if my_dice.spots == dice_b:
    print('Yes')
else:
    print('No')


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

using namespace std;
long long int a[202000],b[202000],c=0,n,D;
int main()
{
    scanf("%lld%lld",&n,&D);
    D=D*D;
    for(int i=0;i<n;i++)
        scanf("%lld%lld",&a[i],&b[i]);
    for(int i=0;i<n;i++)
        if(a[i]*a[i]+b[i]*b[i]<=D)
        {
            //printf("%lld %lld %lld\n",a[i]*a[i],b[i]*b[i]);
            c++;
        }

    printf("%lld",c);
    //printf("\n%d",D);
    return 0;
}


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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
#define PI 3.14159265358979
#define MOD 1000000007 // = 10^9 + 7

using namespace std;
using ll = long long;

using P = pair<int, int>;

void solve()
{
	int n, m;
	cin >> n >> m;
	vector<P> job(n);

	for(int i = 0; i < n; ++i)
	{
		int a, b;
		cin >> a >> b;
		job[i] = P(a, b);
	}

	sort(job.begin(), job.end());
	priority_queue<int> job_score;

	ll ans = 0;
	int job_index = 0;
	for(int i = 1; i <= m; ++i)
	{
		while(job_index < n && job[job_index].first <= i)
		{
			job_score.push(job[job_index].second);
			job_index++;
		}
		if (!job_score.empty())
		{
			ans += job_score.top();
			job_score.pop();
		}
	}
	cout << ans;
}

int main()
{
	fastio;
	solve();

	return 0;
}

Measured memory_bytes: 4652
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#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) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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; }

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}


int main(int argc, char const *argv[]) {
    ll a,b; cin>>a>>b;
    map<int64_t, int> A,B;
    A = prime_factor(a);
    B = prime_factor(b);

    map<ll, ll> ans;
    for (auto &&e: A) ans[e.first]++;
    for (auto &&e: B) ans[e.first]++;
    ll cnt = 0;
    for (auto &&e: ans) if (e.second==2) cnt++;
    cout << cnt+1 << '\n';
    return 0;
}

Measured memory_bytes: 384
n, m = [int(x) for x in input().split()]
a = [[int(x) for x in input().split()] for y in range(n)]
b = [[int(x) for x in input().split()] for y in range(m)]

for ai in a:
    n = [abs(ai[0] - bi[0]) + abs(ai[1] - bi[1]) for bi in b]
    print(n.index(min(n)) + 1)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	long double p[n+1],al[n+1],prod,ans,sum;
	prod=1;
	sum=0;
	for(int i=1; i<=n; i++)
	{
		cin>>p[i];
		prod = prod*p[i];
		//al[i] = (long double)(1-p[i])/p[i];
		//cout<<"al["<<i<<"] : "<<al[i]<<endl;
	}
	long double v[n+1]={0};
	v[0] = 1;
	for(int i=1; i<=n; i++)
	{
		for(int j=i; j>=1; j--)
		{
			v[j] = v[j] + v[j-1]*((1-p[i])/p[i]);
		}
	}
	for(int i=0; i<=n/2; i++)
	{
		sum+=v[i];
		//cout<<"v["<<i<<"] : "<<v[i]<<endl;
	}
	cout.precision(18);
	cout<<fixed<<sum*prod<<endl;
}

Measured memory_bytes: 384
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            String a = in.next();
            String b = in.next();
            String c = in.next();
            out.println(a.substring(0, 1) + b.substring(1, 2) + c.substring(2, 3));
        }

    }
}



Measured memory_bytes: 24276
// Goods things are coming, just keep believing 
 
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
 
#define FOR(i, x, n) for(ll i = x; i < n; i++) 
#define pb push_back
#define pf push_front
#define ll long long
#define hii cout << "hii" << endl
#define okay cout << "okay" << endl
// #define hey cout << "hey" << endl
#define pii pair<int, int>
#define pll pair<ll, ll>
// #define mpp make_pair
#define endl '\n'
#define ff first 
#define int long long
#define ss second
#define vi vector<int>
#define all(s) s.begin(), s.end()
#define si size()
 #define ld long double
#define INF 1000000000;
 
template <class T> ostream& operator << (ostream &os, const vector<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T> ostream& operator << (ostream &os, const set<T> &v) { for (T i : v) os << i << ' '; return os; }
template <class T, class S> ostream& operator << (ostream &os, const pair<T, S> &v) { os << v.first << ' ' << v.second; return os; }
template <class T, class S> ostream& operator << (ostream &os, const unordered_map<T, S> &v) { for (auto i : v) os << '(' << i.first << "=>" << i.second << ')' << ' '; return os; } 
 
 
 
#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <class Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 << endl; }
    template <class Arg1, class... Args>
    void __f(const char* names, Arg1&& arg1, Args&&... args) {
        const char* sep = strchr(names + 1, ',');
        cerr.write(names, sep - names) << " : " << arg1 << "  ";
        __f(sep + 1, args...);
    }
#else
#define trace(...) 0
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("avx2,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define _CRT_SECURE_NO_WARNINGS
#endif // ifndef ONLINE_JUDGE
 
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
 
 
 
const int N = 2e5 + 5;
const int LG = 20;
const int mod = 1e9 + 7;

int arr[N];
int pos[N];
vector<int> v[N];

int n;

void solve()
{
	int n;
	cin >> n;
	std::vector<int> P;
	std::vector<int> Q;
	std::vector<int> v;
	int a = 0;
	int b = 0;
	for(int i = 0; i < n; i++)
	{
		v.push_back(i + 1);
		int data;
		cin >> data;
		P.push_back(data);
	}
	for(int i = 0; i < n; i++)
	{
		int data;
		cin >> data;
		Q.push_back(data);
	}
	int idx = 0;
	do
	{
		if(v == P)
		{
			a = idx;
		}
		if(v == Q)
		{
			b = idx;
		}
		idx++;
	}while(next_permutation(all(v)));
	cout << abs(a - b) << endl;
	// do { 
 //        cout << arr[0] << " " << arr[1] << " " << arr[2] << "\n"; 
 //    } while (next_permutation(arr, arr + 3)); 
}
 
int32_t main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int t = 1;
	// cin >> t;
	while(t--)
	{
		solve();
	}
}

Measured memory_bytes: 6400
n=int(input())
m=[]
for i in range(n):
    m.append(int(input()))
m.sort()
m=m[:4]
ans=[]
for i in m:
    for j in m:
        if i==j:continue
        ans.append(int(str(i)+str(j)))
ans.sort()
print(ans[2])


Measured memory_bytes: 5928
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    if(s.size() % 2 == 1) {
        cout << "No" << endl;
        return 0;
    }
    for(int i=0;i<s.size();i++){
        if(i%2 == 0 && s[i] == 'h')
            continue;
        if(i%2 == 1 && s[i] == 'i')
            continue;
        cout << "No" << endl;
        return 0;        
    }
    cout << "Yes" << endl;
    return 0;
}

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

// Binary Indexed Tree (Fenwick Tree)
// https://youtu.be/lyHk98daDJo?t=7960
template<typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n=0):n(n),d(n+1) {}
  void add(int i, T x=1) {
    for (i++; i <= n; i += i&-i) {
      d[i] += x;
    }
  }
  T sum(int i) {
    T x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
  T sum(int l, int r) {
    return sum(r-1) - sum(l-1);
  }
};

int main(){
  int n, Q; cin >> n >> Q;
  int ans[Q];
  vector<int> c(n), prev(n + 1, -1);
  vector<vector<int>> p(n);
  vector<vector<P>> q(n);
  rep(i, n){
    cin >> c[i];
    if(prev[c[i]] != -1){
      p[prev[c[i]]].push_back(i);
    }
    prev[c[i]] = i;
  }

  rep(i, Q){
    int l, r; cin >> l >> r;
    l--; r--;
    q[l].emplace_back(r, i);
  }

  BIT<int> bit(n);
  for(int i = n - 1; i >= 0; i--){
    for(int y : p[i]){
      bit.add(y);
    }
    for(P query : q[i]){

      ans[query.second] = query.first - i + 1 - bit.sum(query.first);
    }
  }

  rep(i, Q){
    cout << ans[i] << endl;
  }

  /*rep(i, p.size()){
    cout << p[i].first << " " << p[i].second << endl;
  }*/

  return 0;
}


Measured memory_bytes: 59920
#include<iostream>
#include<algorithm>
#include<stdbool.h>
#include<math.h>
#include<vector>上
#include<map>
using namespace std;
typedef long long ll;

int main(void) {
	int w, a, b;
	cin >> w >> a >> b;
	if (a + w <= b) {
		cout << b - a - w << endl;
		return 0;
	}
	if (b + w <= a) {
		cout << a - b - w << endl;
		return 0;
	}
	if (a + w >= b) {
		cout << 0 << endl;
		return 0;
	}
	if (a + w >= b) {
		cout << 0 << endl;
		return 0;
	}
	//データ構造をpairについて勉強する
	/*
	ABC041
	keyとvalueを考え、身長の高さについて管理しソート後リバース
	これにより前をイテレータで管理し、前から順番の値を出力
	*/
	return 0;
}

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

typedef pair<int, int> P;

int main() {
	std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    
	int n, w;
	while(cin >> n >> w && (n || w)){
		int v[128], cnt[128] = {0}, maxc = 0, maxv = 0;
		for(int i = 0; i < n; ++i){
			cin >> v[i];
			cnt[v[i] / w]++;
			maxv = max(maxv, v[i]);
		}
		for(int i = 0; i <= 100; ++i){
			maxc = max(maxc, cnt[i]);
		}
			
		int cw = maxv / w + 1;
		double ans = 0.01;
		for(int i = 0; i < cw; ++i){
			ans += cnt[i] * (double)(cw - i - 1) / (cw - 1) / (double)maxc;
		}
		printf("%f\n", ans);
	}
	return 0;
}

Measured memory_bytes: 1224
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int N = S.length();
        
        String A = S.substring(0,N/2);
        String B = S.substring((N+3)/2-1,N);
        
        if(A.equals(B)){
            System.out.println("Yes");   
        }else{
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 35568
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

const int MX = 3010;
ll dp[MX][MX][4];
ll items[MX][MX];

void solver(
  int R, int C, int K,
  vector<ll> r, vector<ll> c, vector<ll> v
) {

  // ll items[R][C];
  REP(i,R) REP(j,C) items[i][j] = 0;
  REP(i,K) {
    r[i]--; c[i]--;
    items[r[i]][c[i]] = v[i];
  }

  // ll dp[R+1][C+1][4]; // [行][列][行で拾ったitemの個数]
  REP(i,R+1) REP(j,C+1) REP(k,4) dp[i][j][k] = -LINF;
  dp[0][0][0] = 0;

  REP(i,R) REP(j,C) {
    for (int k = 2; k >= 0; k--) {
      if (dp[i][j][k] < 0) continue;
      dp[i][j][k+1] = max(dp[i][j][k+1], dp[i][j][k] + items[i][j]);
    }

    REP(k,4) {
      if (dp[i][j][k] < 0) continue;
      dp[i+1][j][0] = max(dp[i+1][j][0], dp[i][j][k]);
      dp[i][j+1][k] = max(dp[i][j+1][k], dp[i][j][k]);
    }
  }

  ll ans = -LINF;
  REP(k,4) chmax(ans, dp[R-1][C-1][k]);
  COUT(ans);
  return;
}

int main() {
  IOS;
  int R,C,K;
  cin >> R >> C >> K;
  vector<ll> r(K),c(K),v(K);
  REP(i,K) cin >> r[i] >> c[i] >> v[i];

  solver(R,C,K,r,c,v);

  return 0;
}

Measured memory_bytes: 365236
import scala.io.StdIn.{readLong, readInt}

object Main extends App {

  val n  = readInt()
  val a  = readLong()
  val b  = readLong()
  val xs = Iterator.fill(n - 2)(readLong())

  val (max, _) = xs.foldLeft((b - a, math.min(a, b))) {
    case ((maxDiff, min), x) => (math.max(maxDiff, x - min), math.min(min, x))
  }
  println(max)
}



Measured memory_bytes: 79564
#include <bits/stdc++.h>
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
#define rg register
using namespace std;
typedef long long LL;
const int MAXN = 100005;

template <typename T> inline void read(T &AKNOI) {
	T x = 0, flag = 1;
	char ch = getchar();
	while (!isdigit(ch)) {
		if (ch == '-') flag = -1;
		ch = getchar();
	}
	while (isdigit(ch)) {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	AKNOI = flag * x;
}

int n, a[MAXN];

inline bool cmp(int x, int y) {
	return x > y;
}

void init() {
	read(n);
	for (int i=1;i<=n;++i) {
		read(a[i]);
	}
	sort(a+1, a+n+1, cmp);
}

void solve() {
	int t = 0;
	while (a[t] >= t) ++t;
	--t;
	if (!((a[t] - t) & 1)) {
		int i = 0;
		while (a[t+i] >= t) ++i;
		if (i & 1) {
			puts("Second");
			return;
		}
	}
	puts("First");
}

int main() {
	init();
	solve();
	return 0;
}


Measured memory_bytes: 640
K = int(input())
i = 1
ret = -1
if K % 5 != 0 and K % 2 != 0:
  N = 10
  if K % 7 == 0:
    L = K * 9 // 7
  else:
    L = K * 9
  while True:
    if N % L == 1:
      ret = i
      break
    N = (N * 10 )% L
    i += 1
print(ret)


Measured memory_bytes: 9124
import java.util.Scanner;
public class Main {
	public static void main(String[]args) {
		Scanner s = new Scanner(System.in);
		double h = s.nextDouble();
		double a = s.nextDouble();
		double c = h/a;
		if(h%a!=0) {
			c++;
		}
		System.out.print((short)c);
	}
}

Measured memory_bytes: 25044
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i; i < (n); i++)
using ll = long long;
int main(){
  string a;
  cin >> a;
  if(a.at(0) == a.at(1) && a.at(1) == a.at(2)){
    cout << "No" << endl;
  }
  else{
    cout << "Yes" << endl;
  }
  return 0;
}


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

const int MAXSIZE = 100000;
const int END = -1;
struct StNod
{
  int m_nDept;
  int m_nParnt;
  int m_nLChd;
  int m_nRSib;

  StNod() :
    m_nDept(END), m_nParnt(END), m_nLChd(END), m_nRSib(END)
  { }
};

void fnInput(vector<StNod> &rvoNod)
{
  StNod oNod;
  rvoNod.resize(MAXSIZE, oNod);

  int nMaxSiz;
  cin >> nMaxSiz;

  for (int i = 0; i < nMaxSiz; i++)
  {
    int nParnt, nCCnt, nChd, nBChd = END;
    cin >> nParnt >> nCCnt;
    for (int j = 0; j < nCCnt; j++)
    {
      cin >> nChd;
      rvoNod[nChd].m_nParnt = nParnt;
      if (nBChd != END) rvoNod[nBChd].m_nRSib = nChd;
      if (!j)          rvoNod[nParnt].m_nLChd = nChd;
      nBChd = nChd;
    }
  }
}

void fnSetDepth(vector<StNod> &rvoNod, int nx, int nDept)
{
  rvoNod[nx].m_nDept = nDept;
  
  if (rvoNod[nx].m_nRSib != END)
    fnSetDepth(rvoNod, rvoNod[nx].m_nRSib, nDept);

  if (rvoNod[nx].m_nLChd != END)
    fnSetDepth(rvoNod, rvoNod[nx].m_nLChd, nDept + 1);
}

void fnRtdTree(vector<StNod> &rvoNod)
{
  int nx = 0, nDept = 0;
  while (rvoNod[nx].m_nParnt != END)
    nx = rvoNod[nx].m_nParnt;

  fnSetDepth(rvoNod, nx, nDept);
}

void fnResult(const vector<StNod> &cnrvoNod)
{
  for (int i = 0; i < cnrvoNod.size(); i++)
  {
    if (cnrvoNod[i].m_nDept == END)  break;
    cout << "node " << i << ": parent = " << cnrvoNod[i].m_nParnt << ", depth = " << cnrvoNod[i].m_nDept;

    if (!cnrvoNod[i].m_nDept)            cout << ", root, ";
    else if (cnrvoNod[i].m_nLChd == END) cout << ", leaf, ";
    else                                 cout << ", internal node, ";

    cout << "[";
    if (cnrvoNod[i].m_nLChd != END)
    {
      int nx = cnrvoNod[i].m_nLChd;
      cout << nx;
      while (cnrvoNod[nx].m_nRSib != END)
      {
        cout << ", " << cnrvoNod[nx].m_nRSib;
        nx = cnrvoNod[nx].m_nRSib;
      }
    }
    cout << "]" << endl;
  }
}

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

  vector<StNod> voNod;

  fnInput(voNod);
  fnRtdTree(voNod);
  fnResult(voNod);
  return 0;
}

Measured memory_bytes: 5748
/*
     ॐ त्र्यम्बकं यजामहे सुगन्धिं पुष्टिवर्धनम् |
     उर्वारुकमिव बन्धनान्मृत्योर्मुक्षीय माऽमृतात् ||
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define int            long long int
#define F              first
#define S              second
#define pb             push_back
#define si             set <int>
#define vi             vector <int>
#define pii            pair <int, int>
#define vpi            vector <pii>
#define vpp            vector <pair<int, pii>>
#define mii            map <int, int>
#define mpi            map <pii, int>
#define spi            set <pii>
#define endl           "\n"
#define sz(x)          ((int) x.size())
#define all(p)         p.begin(), p.end()
#define double         long double
#define que_max        priority_queue <int>
#define que_min        priority_queue <int, vi, greater<int>>
#define bug(...)       __f (#__VA_ARGS__, __VA_ARGS__)
#define print(a)       for(auto x : a) cout << x << " "; cout << endl
#define print1(a)      for(auto x : a) cout << x.F << " " << x.S << endl
#define print2(a,x,y)  for(int i = x; i < y; i++) cout<< a[i]<< " "; cout << endl

inline int power(int a, int b)
{
     int x = 1;
     while (b)
     {
          if (b & 1) x *= a;
          a *= a;
          b >>= 1;
     }
     return x;
}

typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> Set;

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

const int N = 2005;
int a[N], n, m, k;
vpi v;
int cache[N][N];

int dp(int i, int j)
{
     if (i > j)
          return 0;

     int &ans = cache[i][j];
     if (ans != -1)
          return ans;

     int pos = i + n - j - 1;

     ans = v[pos].F * abs(v[pos].S - i) + dp(i + 1, j);
     ans = max(ans, v[pos].F * abs(v[pos].S - j) + dp(i, j - 1));

     return ans;
}

void solve()
{
     cin >> n;
     for (int i = 0; i < n; i++)
          cin >> a[i];

     memset(cache, -1, sizeof cache);
     for (int i = 0; i < n; i++)
          v.pb({a[i], i});

     sort(v.rbegin(), v.rend());
     cout << dp(0, n - 1);

}

int32_t main()
{
     ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
     cout << setprecision(9) << fixed;
     clock_t z = clock();
     solve();
     cerr << "Run Time : " << ((double)(clock() - z) / CLOCKS_PER_SEC);

     return 0;
}

Measured memory_bytes: 35380
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(x) (int)(x).size()
#define endl '\n'
#define FOR(a, b, c) for (auto a = (b); (a) < (c); ++(a))
#define F0R(a, b) FOR (a, 0, (b))
#define CEIL(a, b) ((a) + (b)-1) / (b)
template <class T>
bool ckmin(T& a, const T& b) {
  return a > b ? a = b, true : false;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, true : false;
}
#ifndef DEBUG
#define DEBUG 0
#endif
#define dout \
  if (DEBUG) std::cerr
#define dvar(...) " [" << #__VA_ARGS__ ": " << mt(__VA_ARGS__) << "] "
template <typename T>
struct IsC {
  template <typename C>
  static char test(typename C::const_iterator*);
  template <typename C>
  static int test(...);
  static const bool value = sizeof(test<T>(0)) == sizeof(char);
};
template <>
struct IsC<string> {
  static const bool value = false;
};
template <typename C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(ostream&, const C&);
template <typename T1, typename T2>
ostream& operator<<(ostream&, const pair<T1, T2>&);
template <typename... T> using TS = tuple_size<tuple<T...>>;
template<size_t idx, typename... T>
typename enable_if<TS<T...>::value == idx + 1, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
  return o << ", " << get<idx>(t) << ')';
}
template<size_t idx, typename... T>
typename enable_if<0 < idx && idx + 1 < TS<T...>::value, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
  return operator<<<idx + 1>(o << ", " << get<idx>(t), t);
}
template<size_t idx = 0, typename... T>
typename enable_if<1 < TS<T...>::value && !idx, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
  return operator<<<idx + 1>(o << '(' << get<idx>(t), t);
}
template<typename T>
ostream& operator<<(ostream& o, const tuple<T>& t) {
  return o << get<0>(t);
}
template <typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2>& p) {
  return o << mt(p.fi, p.se);
}
template <typename C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(
    ostream& o, const C& c) {
  o << '[';
  for (auto it = c.cbegin(); it != c.cend(); ++it)
    o << *it << (next(it) != c.cend() ? ", " : "");
  return o << ']';
}
template <typename T>
void tprint(vector<vector<T>>& v, size_t width = 0, ostream& o = cerr) {
  if (!DEBUG) return;
  for (const auto& vv : v) {
    for (const auto& i : vv) o << setw(width) << i;
    o << endl;
  }
}

void solve() {
    int k;
    cin >> k;

    int x = 7 % k;
    F0R(i, 2*k) {
        if(!x) {
            cout << i + 1 << endl;
            return;
        }
        x = (10*x + 7) % k;
    }
    cout << -1 << endl;
}

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

    int tc = 1;
    FOR(i, 1, tc + 1) {
        //cout << "Case #" << i << ": ";
        solve();
    }
}



Measured memory_bytes: 3616