akhauriyash/Code-Regression huggingface dataset:
//
//  ROIGold.cpp
//  Main calisma
//
//  Created by Rakhman on 05/02/2019.
//  Copyright © 2019 Rakhman. All rights reserved.
//

#include <cstring>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
#include <iterator>

#define ios ios_base::sync_with_stdio(0), cout.tie(0), cin.tie(0);
#define S second
#define F first
#define pb push_back
#define nl '\n'
#define NL cout << '\n';
#define EX exit(0)
#define all(s) s.begin(), s.end()
#define no_answer return cout << "NO", 0;
#define FOR(i, start, finish, k) for(int i = start; i <= finish; i += k)

const int MXN = 1e5 + 200;
const long long MNN = 3e3 + 200;
const long long MOD = 1e9 + 7;
const long long INF = 1e13;
const int OO = 1e9 + 500;

typedef long long llong;
typedef unsigned long long ullong;

using namespace std;

llong n, k;
vector<int> g[MXN];

pair<llong, llong> dfs(int x, int p){
    llong all_white = 1;
    llong maybe_black = 0;
    for(int i = 0; i < g[x].size(); i++){
        int to = g[x][i];
        if(to != p){
            pair<llong, llong> p = dfs(to, x);
            llong lol_white = all_white;
            all_white = (all_white * p.F) % MOD;
            maybe_black = ((lol_white * p.S) % MOD + (maybe_black * (p.S + p.F)) % MOD) % MOD;
        }
    }
    return {(maybe_black + all_white) % MOD, all_white % MOD};
}

int main () {
    ios;
    cin >> n;
    for(int i = 1; i < n; i++){
        int a, b;
        cin >> a >> b;
        g[a].pb(b);
        g[b].pb(a);
    }
    pair<llong, llong> a = dfs(1, 0);
    cout << (a.F + a.S) % MOD;
}


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

int main()
{
  int n;
  int judge=0;

  scanf("%d",&n);
  char s[n];
  scanf("%s",s);

  if(n%2==0)
  {
    int i;
    judge=1;

    for(i=0;i<n/2;i++)
    {
      if(s[i]!=s[i+(n/2)])
      {
        judge=0;
      }
    }
  }

  if(judge==1)
  {
    printf("Yes");
  }else{
    printf("No");
  }

  return 0;
}


Measured memory_bytes: 128
# include <bits/stdc++.h>
typedef long long lint;
using namespace std;

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

lint lcm(lint x, lint y) { return abs(x-y)/gcd(x,y); }


int main() {
  lint n,p; cin >> n >> p;

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

  lint ans=1, p_sqrt=sqrt(p);
  vector<lint> c(p_sqrt,0);

  for(lint i=2;i<=p_sqrt;i++) {
    while(p > 1) {
      if(p%i == 0) {
        p /= i;
        c[i]++;
      } else { break; }
    }
  }

  for(lint i=2;i<=p_sqrt;i++) {
    if(c[i]/n >= 1) { ans *= pow(i, (c[i]/n) ); }
  }

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

Measured memory_bytes: 8064
#include<stdio.h>
#include <stdlib.h>
#include<limits.h>

// int min(int a, int b){
//     return (a > b) ? b : a;
// }

int main(){
    int n, h[100007], cost[100007],i,temp,j,k;
    scanf("%d %d",&n, &k);
    for(i=0;i<n;i++){
        scanf("%d",&h[i]);
    }
    cost[n-1] = 0;
    // cost[n-2] = abs(h[n-2]-h[n-1]);
    for(i=n-2;i>=0;i--){
        cost[i] = INT_MAX; 
        for(j=1;j<=k && (i+j)<n;j++){
            temp = cost[i+j]+abs(h[i]-h[i+j]);
            if(temp < cost[i])
                cost[i] = temp;
        }
    }
    printf("%d\n", cost[0]);
    return 0;
}

Measured memory_bytes: 896
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<'\n';
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
//#define int long long
//#define int unsigned long long
#define all(x) (x).begin(), (x).end()
//#define double long double

using namespace std;

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

const int MOD = 1e9 + 7;
const ll INF = 1e9;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 200020;



signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int A, B; cin >> A >> B;
	print((A + B) % 24);
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
#include<vector>
#include<stack>
#include<math.h>
#include<queue>
#include<complex>
using namespace std;

int main() {
	long long int n,m,a,b,c,d,e;
	string str;
	char ch;
	long long int x[130]={};
	cout << fixed << setprecision(10);
	cin>>a>>b>>c;
	cout<<min(c,b/a);



	cout<<endl;
} 


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

char v[1000];
int fr1[26],fr2[26];

int main()
{
    int n;
    cin>>n;
    int x,v[n];
    for(int i=0; i<n; i++){
        cin>>v[i];
    }
    sort(v,v+n);
    int ex=v[n-1]/2;
    int sum=ex;
    for(int i=0; i<n-1; i++){
        sum+=v[i];
    }
    cout<<sum;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int N,K,ans=1,M=1e9+7,a,b;
vector<int>G[100050];
void dfs(int n,int p,int d){
	ans=1L*ans*max(K-d,0)%M;
	int c=1+!!p;
	for(auto e:G[n])if(e!=p)dfs(e,n,c++);
}
int main(){
	cin>>N>>K;
	N--;
	while(N--){
		cin>>a>>b;
		G[a].push_back(b);
		G[b].push_back(a);
	}
	dfs(1,0,0);
	cout<<ans;
}


Measured memory_bytes: 9216
N, K, Q = map(int, input().split())
A = [int(input()) for i in range(Q)]

victory_cnt = [0] * N 

for i in range(Q):
    victory_cnt[A[i]-1] += 1

for v in victory_cnt:
    if (Q-v) >= K:
        print('No')
    else:
        print('Yes')


Measured memory_bytes: 8640
#include<stdio.h>

int main(){
    int a;
    scanf("%d", &a);
    int b[a];
    for (int i=0;i<a;i++){
        scanf("%d", &b[i]);
    }
    int sum=0;
    for (int i=0;i<a;i++){
        sum=sum+b[i];
    }
    printf("%d\n", sum-a);
    return 0;
}






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

int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  rep(i,n) cin >> a[i] >> b[i];

  sort(a.begin(), a.end());
  sort(b.begin(), b.end());

  if (n & 1) {
    cout << b[n / 2] - a[n / 2] + 1 << endl;
  } else {
    cout << (b[n / 2] + b[n / 2 - 1]) - (a[n / 2] + a[n / 2 - 1]) + 1 << endl;
  }
  return 0;
} 

Measured memory_bytes: 4816
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		if(a<1200) {
			System.out.println("ABC");
		}else if(a<2800) {
			System.out.println("ARC");
		}else {
			System.out.println("AGC");
		}
	}

}

Measured memory_bytes: 25172
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;

public class Main {
	public static void main(final String[] args){
    
        Scanner sc = new Scanner(System.in);

        int r = sc.nextInt();
        System.out.println((double)r * 2.0 * 3.14);

        

            
                


    }
}

Measured memory_bytes: 35924
while True :
    m, f, r = map(int, input().split())
    if m == -1 and f == -1 and r == -1 :
        break
    if m == -1 or f == -1 :
        print("F")
    elif (m + f) >= 80 :
        print("A")
    elif (m + f) >= 65 :
        print("B")
    elif (m + f) >= 50 :
        print("C")
    elif (m + f) >= 30 and r >= 50 :
        print("C")
    elif (m + f) >= 30 :
        print("D")
    else :
        print("F")



















Measured memory_bytes: 5592
//157 A - Duplex Printing 2020/03/01
#include <bits/stdc++.h>
#define rep(i ,n) for(int i=0;i<(int)(n);++i)
using namespace std;
typedef long long int int64;
typedef unsigned long long uint64;

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

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

int a;
int b;

int main(){
	cin >> a;
	cin >> b;
	if ( a<b ) {
		cout << "a < b" << endl;
	} else if ( a==b ) {
		cout << "a == b" << endl;
	} else {
		cout << "a > b" << endl;
	}
    return 0;
}

Measured memory_bytes: 1156
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {

  int A,B;

  cin >> A >> B;

  if (A == 1) {
    if (B == 2) {
      cout << 3 << endl;
    }else if(B == 3){
      cout << 2 << endl;
    }
  }else if(A == 2) {
    if (B == 1) {
      cout << 3 << endl;
    }else if(B == 3){
      cout << 1 << endl;
    }
  }else if(A == 3) {
    if (B == 2) {
      cout << 1 << endl;
    }else if(B == 1){
      cout << 2 << endl;
    }

  }


  
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <functional>
#include <algorithm>
#include <vector>
#include <limits>
#include <numeric>
#include <type_traits>
#include <iostream>
#include <queue>
#include <math.h>
#include <bits/stdc++.h>
#include <queue>
#include <map>

using namespace std;

#define INF (1ll<<60)
#define INFint (1<<30)
#define MOD 1000000007
#define BOUND 27182818284

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

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

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

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

// gcd
template<typename T>
T gcd(T a, T b){
    if(a==0)
        return b;
    return gcd(b%a,a);
}

// gcd array
int findGCD(int arr[], int n){
    int result = arr[0];
    for (int i=1; i < n; i++)
        result = gcd(arr[i], result);
    return result;
}

template<typename T>
T lcm( T m, T n ){
    // 引数に0がある場合は0を返す
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    return ((m/gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill( (T*)array, (T*)(array+N), val );
}


int dx[5]={1,0,-1,0};
int dy[5]={0,1,0,-1};
// v.front() = -BOUND;
// v.back() = BOUND;

//struct edge{
//    int cost, to;
//
//    edge(int in_cost, int in_to){
//        cost=in_cost;
//        to=in_to;
//    }
//    bool operator<(const edge &a) const
//    {
//        return cost > a.cost;
//    }
//};

// warshall_floyd
int N;
int d[110][110];
void warshall_floyd(){
    for(int k=0; k<N; k++) {
        for (int i = 0; i < N; ++i) {
            for (int j = 0; j < N; ++j) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

int main() {
    int M; cin>>N>>M;
    vector<int>A(1000),B(1000),C(1000);
    rep(i,M){
        cin >> A[i] >> B[i] >> C[i];
        A[i]--, B[i]--;
    }
    
    for(int i=0; i<N; i++){
        for(int j=0; j<N; j++) {
            if(i==j) d[i][i] = 0;
            else d[i][j]=100000;
        }
    }

    for(int i=0; i<M; i++){
        d[A[i]][B[i]]=min(d[A[i]][B[i]],C[i]);
        d[B[i]][A[i]]=min(d[B[i]][A[i]],C[i]);
    }

    warshall_floyd();
    int ans=M;
    for(int i=0; i<M; i++){
        bool flag=false;
        for(int j=0; j<N; j++){
            if(d[j][A[i]]+C[i]==d[j][B[i]])
                flag=true;
        }
        if(flag){
            ans--;
        }
    }

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


Measured memory_bytes: 256
program sample
    implicit none
    character(100)::s,t,ans
    integer(8) :: i,j,k,m,n
    integer(8)::a,b,c,d
    integer(8),allocatable::x(:),y(:)
  
    read(*,*) s
    read(*,*)t
    n=len_trim(s)
    m=len_trim(t)
    if(m>n)then
        write(*,*)'UNRESTORABLE'
        stop
    end if
    a=-1
    do i=n,m,-1
        do j=m,1,-1
            if(s(i-m+j:i-m+j) .ne. t(j:j) .and. s(i-m+j:i-m+j) .ne. '?')then
                exit
            elseif(j==1)then
                a=i-m
                s(i-m+1:i)=t
            end if
        end do
        if(a>=0)then
            exit
        elseif(a==-1 .and. i==m)then
            write(*,*)'UNRESTORABLE'
            stop
        end if
    end do
    do i=1,n
        if(s(i:i) .eq. '?')then
            s(i:i)='a'
        end if
    end do
    write(*,*)s
    stop
end program sample
  



Measured memory_bytes: 2828
n, m = gets.split.map(&:to_i)
b = m.times.map {gets.split.map(&:to_i)}.reverse

@par = Array.new(n+1) {|i| i}
num = Array.new(n+1, 1)

sum = n * (n-1) / 2
ans = []

calc = ->a{a == @par[a] ? a : @par[a] = calc[@par[a]]}

b.each do |a, b|
    a = calc[a]
    b = calc[b]
    ans << sum

    if a != b
        sum -= num[a] * num[b]
        a, b = b, a if num[a] > num[b]
        @par[a] = b
        num[b] += num[a]
    end
    #p [@par, num, sum]
end

puts ans.reverse

Measured memory_bytes: 14644
#include<bits/stdc++.h>
#define SIZE 100005
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int A,B,C,D,E,ans;

int main(){
	cin >> A >> B >> C >> D >> E;

	if(A<0){
		ans = -A*C+D+B*E;
	}else{
		ans = E*(B-A);
	}
	
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int M; 
  cin >> M;
  if ((N ==1 && M ==2) || (N ==2 && M ==1)) {
    cout << 3 << endl; 
  }
  else if  ((N ==1 && M ==3) || (N ==3 && M ==1)) {
    cout << 2 << endl; 
}
  else {
    cout << 1 << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
int N,i,a,b;
vector<int> A,B;
cin>>N;
for(i=0;i<N;i++){
cin>>a>>b;
A.push_back(a);
B.push_back(b);
}
sort(A.begin(), A.end());
sort(B.begin(), B.end());
cout<<B[0]+A[N-1];
return 0;
}

Measured memory_bytes: 1276
#include<bits/stdc++.h>
using namespace std;
string a[101];
int main(){
    int n,i;
    scanf("%d%*d",&n);
    for(i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    for(i=0;i<n;i++)
        cout<<a[i];
    return 0;
}

Measured memory_bytes: 256
N = int(input())
S = [input() for i in range(N)]
M = int(input())
T = [input() for i in range(M)]

Z = []
for si in S:
    Z.append(S.count(si) - T.count(si))
    
if max(Z) < 0:
    print("0")
else:
    print(max(Z))


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
using namespace std;
int main(void) {
    long n,a,b;
    cin >> n >> a >> b;
    if ((b-a)%2==0) {
        cout << (b-a)/2;
    } else {
        cout << min({a-1,n-b})+ 1 + (b-a-1)/2;
    }
    return 0;
}


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

using ll = long long;

int main() {
    int s;
    cin >> s;
    map<int, bool> m;
    int pre, now;
    pre = s;
    m[pre] = true;
    rep(i, 1000001) {
        if(pre % 2 == 0)
            now = pre / 2;
        else
            now = 3 * pre + 1;
        if(m.find(now) == m.end()) {
            m[now] = true;
        } else {
            cout << i + 2 << endl;
            return 0;
        }
        pre = now;
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
if n == 1: print(0); exit()

def is_prime(x):
    if x == 2: return True
    if x == 1 or not x % 2: return False
    for i in range(3, int(x**0.5)+1, 2):
        if not x % i: return False
    else: return True
if is_prime(n): print(1); exit()

def get_primes(lim):
    table = [True] * (lim+1)
    table[0:2] = False, False
    for i in range(2, int(lim**0.5)+1):
        if not table[i]: continue
        for j in range(i*2, lim+1, i):
            table[j] = False
    return [i for i in range(lim+1) if table[i]]

def factorize(x, primes):
    res = []
    for p in primes:
        if p ** 2 > x: break
        cnt = 0
        while not x % p:
            x //= p
            cnt += 1
        if cnt: res.append(cnt)
    if x > 1: res.append(1)
    return res

p = get_primes(10**6*2)
f = factorize(n, p)
ans = 0
for x in f:
    for i in range(1, 100):
        if i <= x:
            x -= i
            ans += 1
        else: break

print(ans)


Measured memory_bytes: 30632
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        int f = Integer.parseInt(n.substring(0,1));
        char[] cl = n.substring(1,n.length()).toCharArray();
        boolean chk9 = true;
        for(char c : cl){
            if(c != '9'){ 
                chk9 = false;
                break;
            }
        }
        System.out.println(chk9 ? (f+(n.length()-1)*9) : (f-1+(n.length()-1)*9));
    }
}


Measured memory_bytes: 22996
#include <stdio.h>

int main(void)
{
    int i, j, n, tmp;
    char s;
    int card[4][13];
    for(i=0; i<4; i++){
        for(j=0; j<13; j++)
            card[i][j] = 0;
    }
    
    scanf("%d", &n);
    for(i=0; i<n; i++){
        scanf("%s%d", &s, &tmp);
        //printf("%c %d\n",s,  tmp);
        
        if(s == 'S')
            card[0][tmp-1] = 1;
        else if(s == 'H')
            card[1][tmp-1] = 1;
        else if(s == 'C')
            card[2][tmp-1] = 1;
        else
            card[3][tmp-1] = 1;
        
    }
    for(i=0; i<4; i++){
        for(j=0; j<13; j++){
            if(card[i][j] == 0){
                if(i==0)
                    printf("S %d\n", j+1);
                else if(i==1)
                    printf("H %d\n", j+1);
                else if(i==2)
                    printf("C %d\n", j+1);
                else
                    printf("D %d\n", j+1);
                }
        }
    }
    return 0;
}

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

int main(){
    int n, m;
    cin >> n>> m;
    
    cout << n*m<<endl;
    
}


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

typedef long long ll;

int n;
ll F[505][505], A[505][505], B[505][505];

void upd(ll &x, ll y) {
	if (x > y) x = y;
}

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= n; ++j)
			if (j != i) {
				if (i < j) scanf("%lld", A[i] + j);
				else scanf("%lld", B[j] + i);
			}
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= n; ++j) {
			A[i][j] += A[i - 1][j];
			B[i][j] += B[i - 1][j];
		}
	for (int i = 1; i <= n; ++i)
		for (int j = 1; j <= n; ++j) {
			A[i][j] += A[i][j - 1];
			B[i][j] += B[i][j - 1];
		}
	memset(F, 0x3f, sizeof F);
	F[0][0] = 0;
	for (int i = 0; i <= n; ++i)
		for (int j = i; j <= n; ++j) {
			for (int k = j + 1; k <= n; ++k)
				upd(F[j][k], F[i][j] + A[n][k] - A[j][k] + B[j][n] - B[j][k] - B[i][n] + B[i][k]);
			F[n + 1][0] = min(F[n + 1][0], F[i][j] + A[n][n] - A[j][n]);
		}
	printf("%lld\n", F[n + 1][0]);
	return 0;
}


Measured memory_bytes: 6144
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#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())
#define MATHPI acos(-1)
#define itn int
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const ll MOD = 1000000007;
const double EPS = 1e-9;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;



int main(void) {
    
    int n,h;
    cin>>n>>h;
    vpii v;

    rep(i,n){
        int a,b;
        cin>>a>>b;
        v.push_back(mp(a,0));
        v.push_back(mp(b,1));
    }
    Rort(v);
    int ans=0;
    int pos=0;
    while(h>0){
        if(v[pos].second==0){
            int tata=ceil(h/(double)v[pos].first);
            ans+=tata;
            h=0;
            continue;
        } else {
            ans++;
            h-=v[pos].first;
            pos++;
        }
    }
    fin(ans);

}


Measured memory_bytes: 2420
W, H, x, y, r =map(int, input().split())
if x>=r and y>=r:
    if W>=2*r and H>=2*r:
        if x<=W-r and y<=H-r:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")


Measured memory_bytes: 5596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main() {
  int h, w, k;
  cin >> h >> w >> k;
  bool graph[h][w];
  int ans[h][w] = {};
  rep(i, h) {
    string s;
    cin >> s;
    rep(j, w) {
      if (s[j] == '#')
        graph[i][j] = true;
      else
        graph[i][j] = false;
    }
  }
  int x = 1, null = 0;
  rep(i, h) {
    int cnt = 0;
    rep(j, w) {
      if (graph[i][j] && cnt >= 1) {
        cnt++;
        x++;
        ans[i][j] = x;
      } else if (graph[i][j]) {
        cnt++;
        ans[i][j] = x;
      } else {
        ans[i][j] = x;
      }
    }
    if (cnt == 0) {
      null++;
    } else {
      int s = i;
      while (null > 0) {
        rep(k, w) ans[s - null][k] = ans[s][k];
        null--;
      }
      x++;
    }
  }
  while (null > 0) {
    rep(i, w) ans[h - 1 - null + 1][i] = ans[h - 1 - null][i];
    null--;
  }
  rep(i, h) {
    rep(j, w) cout << ans[i][j] << " ";
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 1280
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.IO;

namespace AtCoder.XXX.B
{ 
    public class Program
    {
        public static void Main(string[] args)
        {
            var datas = cr(); // 3 8
            for(var i = 0;i < datas[0]+1;i++)
			{
                for(var j = 0;j < datas[0]+1;j++)
				{
                    if((i*4) + (j* 2) == datas[1])
					{
                   if(i + j == datas[0])
						{
                            P("Yes");
                            return;

                        }
					}
				}
			}
            P("No");

        }

        private static StreamReader sr;
        public static int[] Ecr()
        {
            if (sr == null)
            {
                sr = new StreamReader("input.txt", Encoding.GetEncoding("UTF-8"));
            }
            return sr.ReadLine().Split().Select(int.Parse).ToArray();
        }
        public static string Er()
        {
            if (sr == null)
            {
                sr = new StreamReader("input.txt", Encoding.GetEncoding("UTF-8"));
            }
            return sr.ReadLine();
        }
        public static string r()
        {
            return Console.ReadLine();
        }
        public static  int[] cr()
        {
            return Console.ReadLine().Split().Select(int.Parse).ToArray();
        }
        public static int cri()
        {
            return int.Parse(Console.ReadLine());
        }
        public static void P(string str)
        {
            Console.WriteLine(str);
        }
        public static void P(int num)
        {
            P(num.ToString());
        }
    }
}


Measured memory_bytes: 28304
/*
String[]の初期化、整数の型がlongになっているか
関数（splitとかcontainsとか）内では"+"とかは正規表現となされるので"\\+"とする
配列のコピーはarr1=arr.clone()
HashSet<>[]はおのおの初期化した？？？？？
 */
import java.util.*;
import java.awt.*;
import java.awt.geom.*;
import static java.lang.System.*;
import static java.lang.Math.*;
public class Main {
    public static void main(String[] $) {
        Scanner sc = new Scanner(in);
        int[] a=new int[10];
        for (int i = 0; i < 4; i++) {
            a[sc.nextInt()]=1;
        }
        if(a[1]+a[9]+a[7]+a[4]==4)out.println("YES");
        else out.println("NO");
    }
}

Measured memory_bytes: 23764
from math import sqrt
def sieve(n):
    if n <= 4:
        return list(range(2, n))
    def _sieve_of_eratosthenes(n):
        limit = int(sqrt(n))+1
        *table, = [1] * n
        table[0] = table[1] = 0
        for i in range(2, limit):
            if table[i]:
                for j in range(i**2, n, i):
                    table[j] = 0
        return [i for i in range(2, n) if table[i]]
    return _sieve_of_eratosthenes(n)

def factorint(n):
    d = {}
    for i in range(2, int(sqrt(n))+1):
        c = 0
        q, r = divmod(n, i)
        while not r:
            c += 1
            n = q
            q, r = divmod(n, i)
        if c:
            d[i] = c
    if n != 1:
        d[n] = 1
    return d

n = int(input())
P = sieve(n+1)
d = {p:i for i, p in enumerate(P)}
X = [1] * len(P)
for i in range(2, n+1):
    for k, v in factorint(i).items():
        X[d[k]] += v
nb_3 = len([x for x in X if x >= 3])
nb_5 = len([x for x in X if x >= 5])
nb_15 = len([x for x in X if x >= 15])
nb_25 = len([x for x in X if x >= 25])
nb_75 = len([x for x in X if x >= 75])
print(nb_75 + nb_25*(nb_3-1) + nb_15*(nb_5-1) + nb_5*(nb_5-1)*(nb_3-2)//2)

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n,m;
  cin>>n>>m;
  vll a(n);
  rep(i,n) cin>>a[i];
  vll b(n+1);
  for(int i=1;i<n+1;i++){
    b[i]=b[i-1]+a[i-1];
  }
  map<ll,ll> p;
  rep(i,n+1){
    p[b[i]%m]++;
  }
  ll ans=0;
  for(auto pp:p){
    ans+=pp.S*(pp.S-1)/2;
  }
  COUT(ans);
}


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

int N=100;

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

  for(int i=1;i<=n;i++)m[i][i] = 0;

  for(int l=2;l<=n;l++){
    for(int i=1;i<=n-l+1;i++){
      int j = i+l-1;
      m[i][j] = (1 << 21);
      for(int k = i;k < j;k++){
	m[i][j] = min(m[i][j],m[i][k] + m[k+1][j] + p[i-1]*p[k]*p[j]);
      }
    }
  }
  
  cout << m[1][n] << endl;
    
  return 0;
}



Measured memory_bytes: 3140
class EdmondsKarp
  def initialize(n)
    @n = n
    @flow = Array.new(n) { Array.new(n, 0) }
    @cap = Array.new(n) { Array.new(n, 0) }
  end

  def add_edge(s, t, w)
    @cap[s][t] = w
  end

  def max_flow(start, goal)
    inf = 2 ** 30
    sum = 0
    while true
      que = [start]
      prev = Array.new(@n, -1)
      prev[start] = start
      while !que.empty? && prev[goal] == -1
        u = que.shift
        @n.times do |i|
          if prev[i] == -1 && @cap[u][i] - @flow[u][i] > 0
            prev[i] = u
            que.push(i)
          end
        end
      end
      return sum if (prev[goal] == -1)
      inc = inf
      c = goal
      while c != start
        inc = [inc, @cap[prev[c]][c] - @flow[prev[c]][c]].min
        c = prev[c]
      end
      c = goal
      while c != start
        @flow[prev[c]][c] += inc
        @flow[c][prev[c]] -= inc
        c = prev[c]
      end
      sum += inc
    end
  end
end


N = gets.to_i
g = EdmondsKarp.new(2*N+2)
s = 2*N
t = s + 1

red = {}
blue = {}

N.times do |i|
  g.add_edge(s, i, 1)
  red[i] = gets.split.map(&:to_i)
end
N.times do |i|
  g.add_edge(N+i, t, 1)
  blue[N+i] = gets.split.map(&:to_i)
end
N.times do |i|
  N.times do |j|
    if red[i][0] < blue[N+j][0] && red[i][1] < blue[N+j][1]
      g.add_edge(i, N+j, 1)
    end
  end
end

puts g.max_flow(s, t)

Measured memory_bytes: 2684
#ifdef _DEBUG
#include ".vscode/debug_print.hpp"
#else
#define debug(...)
#endif
#include <bits/stdc++.h>

using ll = long long;
using ld = long double;
using namespace std;
constexpr int INF32       = 1050000000;
constexpr long long INF64 = 4000000000000000000;
constexpr int MOD7        = 1000000007;
constexpr int MOD53       = 998244353;
constexpr long double PI  = 3.14159265358979323846;
template <class T> inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
void print() { std::cout << '\n'; }
template <class H, class... T> void print(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << ' ';
    print(std::forward<T>(args)...);
}
template <class T> void print(std::vector<T> &v) {
    for (int i = 0; i < v.size(); i++) {
        std::cout << v[i];
        i == v.size() - 1 ? std::cout << '\n' : std::cout << ' ';
    }
}
template <class T> void print(std::vector<std::vector<T>> &v) {
    for (int i = 0; i < v.size(); i++) {
        for (int j = 0; j < v[i].size(); j++) {
            std::cout << v[i][j];
            j == v[i].size() - 1 ? std::cout << '\n' : std::cout << ' ';
        }
    }
}
void scan() {}
template <class H, class... T> void scan(H &&head, T &&... args) {
    std::cin >> head;
    scan(std::forward<T>(args)...);
}
template <class T> void scan(std::vector<T> &v) {
    for (auto &&i : v) {
        scan(i);
    }
}

void vprint() { std::cout << '\n'; }
template <class H, class... T> void vprint(H &&head, T &&... args) {
    std::cout << head;
    sizeof...(args) == 0 ? std::cout << "" : std::cout << '\n';
    vprint(std::forward<T>(args)...);
}
template <class T> void vprint(std::vector<T> &v) {
    for (auto &&i : v) {
        std::cout << i << '\n';
    }
}

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

    int N, M;
    scan(N, M);
    vector<int> a(M);
    scan(a);

    ll sum = accumulate(a.begin(), a.end(), 0);
    print(max(-1LL, N - sum));

    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <cstdint>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <algorithm>

int main(void)
{
    std::vector<int64_t> numbers(10);

    for (int64_t i = 0; i < 3; ++i) {
        int64_t v;
        std::cin >> v;
        numbers.at(v) += 1;
    }

    for (auto&& num : numbers) {
        if (num == 2) {
            std::cout << "Yes" << std::endl;
            return 0;
        }
    }

    std::cout << "No" << std::endl;

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStreamReader
import java.util.*

val MOD = 1000000007L

fun main(omkar: Array<String>) {
    val jin = BufferedReader(InputStreamReader(System.`in`))
    val n = jin.readLine().toInt()
    val adj = Array(n + 1) { mutableSetOf<Int>() }
    for (j in 2..n) {
        val tokenizer = StringTokenizer(jin.readLine())
        val a = tokenizer.nextToken().toInt()
        val b = tokenizer.nextToken().toInt()
        adj[a].add(b)
        adj[b].add(a)
    }
    val factorial = LongArray(n + 1) { it.toLong() }
    factorial[0] = 1
    for (j in 1..n) {
        factorial[j] *= factorial[j - 1]
        factorial[j] %= MOD
    }
    val factorialInv = LongArray(n + 1) { it.toLong() pow -1 }
    factorialInv[0] = 1
    for (j in 1..n) {
        factorialInv[j] *= factorialInv[j - 1]
        factorialInv[j] %= MOD
    }
    val parent = IntArray(n + 1)
    val subTree = IntArray(n + 1) { 1 }
    val dp1 = LongArray(n + 1) { 1L }
    val stack = Stack<Int>()
    stack.push(-1)
    while (stack.isNotEmpty()) {
        var a = stack.pop()
        if (a < 0) {
            a *= -1
            stack.push(a)
            for (b in adj[a]) {
                adj[b].remove(a)
                parent[b] = a
                stack.push(-b)
            }
        } else {
            for (b in adj[a]) {
                subTree[a] += subTree[b]
                dp1[a] *= (dp1[b] * factorialInv[subTree[b]]) % MOD
                dp1[a] %= MOD
            }
            dp1[a] *= factorial[subTree[a] - 1]
            dp1[a] %= MOD
        }
    }
    val answer = LongArray(n + 1) { 1L }
    stack.push(1)
    while (stack.isNotEmpty()) {
        val a = stack.pop()
        for (b in adj[a]) {
            stack.push(b)
        }
        if (a == 1) {
            answer[a] = (dp1[a] * factorialInv[n - 1]) % MOD
        } else {
            answer[a] = answer[parent[a]]
            answer[a] *= factorial[subTree[a]]
            answer[a] %= MOD
            answer[a] *= factorialInv[subTree[a] - 1]
            answer[a] %= MOD
            answer[a] *= factorialInv[n - subTree[a]]
            answer[a] %= MOD
            answer[a] *= factorial[n - subTree[a] - 1]
            answer[a] %= MOD
        }
    }
    for (a in 1..n) {
        answer[a] *= factorial[n - 1]
        answer[a] %= MOD
    }
    println(answer.joinToString("\n").substring(2))
}

val MOD_TOTIENT = (MOD - 1).toInt()

infix fun Long.pow(power: Int): Long {
    var e = power
    e %= MOD_TOTIENT
    if (e < 0) {
        e += MOD_TOTIENT
    }
    if (e == 0 && this == 0L) {
        return this
    }
    var b = this % MOD
    var res = 1L
    while (e > 0) {
        if (e and 1 != 0) {
            res *= b
            res %= MOD
        }
        b *= b
        b %= MOD
        e = e shr 1
    }
    return res
}

Measured memory_bytes: 154852
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
#define fi first
#define se second

signed main(){
  int a,b,c,n;
  cin>>a>>b>>c;
  cout<<min(c,b/a)<<endl;
}


Measured memory_bytes: 256
S = list(input())
if (S[0]==S[1] and S[2]==S[3]) or (S[0]==S[2] and S[1]==S[3]) or (S[0]==S[3] and S[1]==S[2]):
    if not (S[0]==S[1] and S[1]==S[2]):
        print('Yes')
    else:
        print('No')
else:
    print('No')

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm(a, b) (a)/__gcd((a),(b))*(b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> LP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector<int> Div(int n) {
    vector<int> ret;
    for(int i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);

            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    LL n, a, b, c, d, e;
    cin >> n >> a >> b >> c >> d >> e;

    cout << 5 + (CEIL(n, min({a, b, c, d, e}))) - 1 << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
#include <map>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(name,num) vector<ll> name((num),0);
#define op(i) cout<<(i)<<endl;
#define ip(i) cin>>(i);
#define opN cout<<"No"<<endl;
#define opY cout<<"Yes"<<endl;
#define opP cout<<"Possible"<<endl;
#define opI cout<<"Impossible"<<endl;
#define mat(name,fnum,snum); vector<vector<ll>> name((fnum),vector<ll>((snum),0));
#define debugP int debug_point; cin>>debug_point;
const ll MOD= 1e9 + 7;
template <typename T>
void putv(vector<T>& V){
	// cout << "The elements in the vector are: " << endl;
	for(auto x: V)
		cout << x << " ";
	cout << endl;
}
template <class T>
vector<T> getv(ll n){
	vector<T> Vector_temp;
	rep(i,n){
		T input;
		cin >> input;
		Vector_temp.emplace_back(input);
	}
	return Vector_temp;
}
ll gcd(ll c,ll b){
    while(1){
        if(c%b!=0){
        ll tmp=b;
        b=c%b;
        c=tmp;
        }else{
            return b;
        }
    }
}
/* <3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3<3*/


int main(){
    ll n;
    cin>>n;
    vec(a,n);
    a=getv<ll>(n);
    ll sum=0;
    sum=0;
    int b=-1;

    
    ll ans=0;
    rep(i,n){
        sum+=a[i];
        if(b>0){
            if(sum>=0){
                ans+=sum+1;
                //op(sum+1);
                sum=-1;
            }
            b=-1;
        }else{
            if(sum<=0){
                ans+=((-sum)+1);
                //op((-sum)+1)
                sum=1;
            }
            b=1;
        }
    }
    ll ans2=0;
    sum=0;
    b=1;
    rep(i,n){
        sum+=a[i];
        if(b>0){
            if(sum>=0){
                ans2+=sum+1;
                //op(sum+1);
                sum=-1;
            }
            b=-1;
        }else{
            if(sum<=0){
                ans2+=((-sum)+1);
                //op((-sum)+1)
                sum=1;
            }
            b=1;
        }
    }
    op(min(ans,ans2));
    return 0;
}

Measured memory_bytes: 2168
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
using namespace std;

typedef pair <int, int> pii;

int a[200010], b[200010];
int n;

struct Segment_tree {
	struct Node{
		long long sum;
		pii maxj;
	}T[800010];
	void pushup(int now) {
		T[now].sum = T[now << 1].sum + T[now << 1 | 1].sum;
		T[now].maxj = max(T[now << 1].maxj, T[now << 1 | 1].maxj);
	}
	void Build(int now, int l, int r) {
		if (l == r) {
			T[now].maxj = mp((b[l] - a[r]) / (b[(l + 1) % n] + b[(l - 1 + n) % n]), l);
			T[now].sum = b[l] - a[l];
			return ;
		}
		int mid = l + r >> 1;
		Build(now << 1, l, mid), Build(now << 1 | 1, mid + 1, r);
		pushup(now);
	}
	void Update(int now, int l, int r, int pos) {
		if (l == r) {
			T[now].maxj = mp((b[l] - a[r]) / (b[(l + 1) % n] + b[(l - 1 + n) % n]), l);
			T[now].sum = b[l] - a[l];
			return ;
		}
		int mid = l + r >> 1;
		if (pos <= mid) Update(now << 1, l, mid, pos);
		else Update(now << 1 | 1, mid + 1, r, pos);
		pushup(now);
	}
}seg;

int main(){
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	for (int i = 0; i < n; i++) {
		scanf("%d", &b[i]);
	}
	seg.Build(1, 0, n - 1);
	long long ans = 0;
	int last = -1;
	while (seg.T[1].sum) {
		int pos = seg.T[1].maxj.se;
		if (pos == last) {
			printf("-1\n");
			return 0;
		}
		int modd = b[(pos - 1 + n) % n] + b[(pos + 1) % n];
		int cnt = (b[pos] - a[pos]) / modd;
		ans += cnt;
		b[pos] -= cnt * modd;
		last = pos;
		seg.Update(1, 0, n - 1, pos);
		seg.Update(1, 0, n - 1, (pos - 1 + n) % n), seg.Update(1, 0, n - 1, (pos + 1) % n);
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 14336
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    n=II()
    aa=LI()
    s=sum(aa)
    if n%2:
        if s%2:ans="First"
        else:ans="Second"
    else:
        mn=min(aa)
        if s%2==0 and mn%2==0:ans="Second"
        else:ans="First"
    print(ans)

main()


Measured memory_bytes: 28156
from collections import Counter
N=int(input())
A=Counter(list(map(int,input().split())))
m=[]
for key,value in A.items():
    if value>=2:
        m.append(key)
    if value>=4:
        m.append(key)
print(sorted(m)[-1]*sorted(m)[-2] if len(m)>=2 else 0)

Measured memory_bytes: 18600
#include <iostream>
#include <map>

int main(void){
    std::string w, ans="Yes";
    std::cin >> w;
    std::map<char, int> mp;

    for (char c: w){
        if (mp.find(c) == mp.end()){
            mp[c] = 1;
        } else {
            ++mp[c];
        }
    }

    for (auto& x: mp){
        if (x.second % 2 == 1){
            ans = "No";
            break;
        }
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 3568
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define FOR(i,a,b) for(int (i)=(a);(i)<=(b);(i)++)
#define rep(i,n) FOR(i,0,n-1)
#define int long long

int keta_sum(int n)
{
	int ans = 0;
	while(n)
	{
		ans += n%10;
		n /= 10;
	}
	return ans;	
}

signed main(){
	
	int n;cin >> n;
	int ans = 12345678901234;
	FOR(i,1,n-1)
	{
		int a=i,b=n-i;
		ans = min(ans,keta_sum(a)+keta_sum(b));
	}
	
	cout << ans << endl;
}

//cout << ans << endl;

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std;
#define rep(i, N) for(int i=0; i<N; i++)
typedef long long ll;
#define dump(x) cerr<<#x<<"="<<x<<endl
using P = pair<int, int>;

int main() {
   int a; cin >> a;
   cout << (int)pow(a,2) + (int)pow(a, 3) + a << endl;
   return 0;
}


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

#define ll long long
#define INF 99999999
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

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

    vector<int> d(N);
    rep(i,N) cin >> d[i];

    sort(all(d));
    cout << d[d.size()/2] - d[d.size()/2-1] << endl;
}


Measured memory_bytes: 640
import itertools,sys,collections,math,random,fractions,bisect;sys.setrecursionlimit(10**7)
sr = sys.stdin.readline; P = print; P2 = lambda x: print(*x, sep="\n")
def I(i=0): t = [int(x)-i for x in sr().split()];return t
def S(): t = sr().split(); return t if len(t) > 1 else t[0]
L1,L2,L3,L4, = [],[],[],[]

L, = I()
print((L/3)**3)

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

int main()
{
    int N;
    long long K;
    cin>>N>>K;
    vector<long long> A(N);
    for (long long &a: A)
        cin>>a;

    vector<long long> pos;
    vector<long long> neg;
    long long zero = 0;
    for (long long a: A)
        if (a<0)
            neg.push_back(-a);
        else if (a>0)
            pos.push_back(a);
        else
            zero++;
    sort(pos.begin(), pos.end());
    sort(neg.begin(), neg.end());

    //  return #AiAj<=x
    auto count = [&](long long x)
    {
        long long c = 0;
        if (x<0)
        {
            for (long long p: pos)
                c += neg.end() - lower_bound(neg.begin(), neg.end(), (-x+p-1)/p);
        }
        else if (x==0)
        {
            c += neg.size()*pos.size();
            c += zero*(pos.size()+neg.size()) + zero*(zero-1)/2;
        }
        else
        {
            c += neg.size()*pos.size();
            c += zero*(pos.size()+neg.size()) + zero*(zero-1)/2;
            for (int i=0; i<(int)pos.size(); i++)
                c += max(0LL, (long long)(lower_bound(pos.begin(), pos.end(), x/pos[i]+1)-pos.begin())-i-1);
            for (int i=0; i<(int)neg.size(); i++)
                c += max(0LL, (long long)(lower_bound(neg.begin(), neg.end(), x/neg[i]+1)-neg.begin())-i-1);
        }
        return c;
    };

    long long ans = -0x2000'0000'0000'0000LL;
    for (long long b = 0x4000'0000'0000'0000LL; b>0; b/=2)
        if (count(ans+b)<K)
            ans += b;
    cout<<ans+1<<endl;
}


Measured memory_bytes: 3956
#include <iostream>
#include <string>
#include <vector>

int a,b,c,d,e,f;
int x;
int i,j;

using namespace std;

int findMinimum(int *p, int size){
	int a = p[0],b = p[1], c = p[2];
	int tmp;	
	if(a > b){
		tmp = a; a = b; b = tmp;
	}
	if(a > c){
		tmp = a; a = c; c = tmp;
	}
	if(b > c){
		tmp = b; b = c; c = tmp;
	}
	return b;
}

int main(void){
	int n;
	
	cin >> n;
	
	int p[n];
	for(i = 0; i < n; ++i){
		cin >> p[i];
	}
	
	int cnt = 0;
	for(j = 1; j < n-1; ++j){
		if(findMinimum(&p[j-1], 3) == p[j]){
			cnt++;
		}
	}
	
	cout << cnt << endl;
	return 0;
}

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

using namespace std;

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

  int a, b;
  cin >> a >> b;

  int c = b;
  while (b != 0) {
    a *= 10;
    b /= 10;
  }
  c += a;
  int rt = sqrt(c);
  if (rt * rt == c) {
    cout << "Yes" << '\n';
  } else {
    cout << "No" << '\n';
  }

  return 0;
}


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

using namespace std;
typedef long long ll;
typedef long int lt;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define per(i,a,b) for(int i=a;i>=b;--i)
#define endl "\n"
#define fst ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)

void solve()
{
	ll k,n;
	cin>>k>>n;
	priority_queue<ll> mx;
	vector<ll> v(n);
	for(auto &i:v) cin>>i;

	sort(v.begin(),v.end());
	v.push_back(k+v[0]);
	for(int i=0;i<n;++i)
	{
		mx.push(v[i+1]-v[i]);
	}
	cout<<k-mx.top()<<endl;

}

int main()
{
	fst;
	solve();
}

Measured memory_bytes: 7012
#include <iostream>
using namespace std;
int main()
{
	ios_base::sync_with_stdio(false);
	long long X,Y;
	cin>>X>>Y;
	if(X==Y)
	{
		cout<<-1<<"\n";
	}
	else if(X<Y)
	{
		cout<<X<<"\n";
	}
	else if(X>Y&&X%Y==0)
	{
		cout<<"-1\n";
	}
	else
	{
		cout<<X<<"\n";
	}
	return 0;
}


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

using namespace std;

int main() {
    vector<bool> prime(55556, true);
    for (int i = 2; i < static_cast<int>(prime.size()); i++) {
        if (prime[i]) {
            for (int j = 2 * i; j < static_cast<int>(prime.size()); j += i) {
                prime[j] = false;
            }
        }
    }

    int n;
    cin >> n;

    for (int i = 0, pi = 2; i < n; i++) {
        for (pi++; !prime[pi] || pi % 5 != 1; pi++) {}
        cout << (i == 0 ? "" : " ") << pi;
    }
    cout << endl;
}


Measured memory_bytes: 256
from collections import defaultdict
from itertools import permutations

N, M = map(int, input().split(' '))
graph = defaultdict(set)
for _ in range(M):
    a, b = map(int, input().split(' '))
    graph[a].add(b)
    graph[b].add(a)

count = 0
for path in permutations(range(2, N + 1)):
    if path[0] not in graph[1]:
        continue

    for n1, n2 in zip(path, path[1:]):
        if n2 not in graph[n1]:
            break
    else:
        count += 1

print(count)


Measured memory_bytes: 3316