akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>

using namespace std;
typedef long long int ll;
const int MOD = 1000000007;
void sayYes() { cout << "Yes" << endl; };
void sayNo() { cout << "No" << endl; };
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }                   // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };                      // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }                         // 桁数
ll digitSum(ll n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; } // 各桁の和
#define rep(i, n) for (ll i = 0; i < n; i++)

void Main()
{
    // int n;
    // cin >> n;
    // vector<int> a(n);
    // rep(i, n)
    // {
    //     cin >> a[i];
    // }
    int n;
    cin >> n;
    cout << n * 2 * M_PI;
    return;
}

signed main(void)
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

Measured memory_bytes: 3828
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define yes "Yes\n"
#define no "No\n"
//int m,n;
//int i,j,k,l;
int a,b,c,d,e,f,g;
//int sum,total;
//long long int ;
//float ;
//double ;
//char a[101],b[101],s[101],t[101],u[101];
int main(void){
    scanf("%d %d",&a,&b);
    if (b * 2 >= a)
    {
        printf("0\n");
    } else
    {
        printf("%d\n", a - (b * 2));
    }
    
    
    return 0;
}

Measured memory_bytes: 128
#include <map>
#include <stack>
#include <queue>
#include <math.h>
#include <vector>
#include <string>
#include <fstream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
using namespace std;
int n;
long long l,r;
int main () {
    //freopen("input.txt", "r", stdin);
    while(scanf("%d", &n) != EOF) {
        l = r = 0;
        char str[10];
        for(int i = 1; i <= n; i++) {
            int pos = 0, num = 0;
            scanf("%d%s%d", &pos, str, &num);
            if(str[0] =='(') {
                l += num;
            } else {
                r += num;
            }
            if(l == r) {
                puts("Yes");
            } else {
                puts("No");
            }
        }
    }
}

Measured memory_bytes: 1172
N = int(input())
 
L = []
for i in range(1, N+1):
    if i % 15 == 0:
        continue
    elif i % 3 == 0:
        continue
        L.append(i)
    elif i % 5 == 0:
        continue
    else:
        L.append(i)
 
print(sum(L))

Measured memory_bytes: 104164
#include <iostream>
#include <string>

int main() {
  int N;
  std::string stones;
  std::cin >> N >> stones;
  int count = 0;
  for (int l = 0, r = N - 1; l < r; ++l, --r) {
    while (l < r && stones[l] == 'R') ++l;
    while (l < r && stones[r] == 'W') --r;
    count += l < r;
  }
  std::cout << count << std::endl;
  return 0;
}


Measured memory_bytes: 3752
#include <iostream>

using namespace std;

long long power_mod(long long x, long long power, long long mod)
{
    long long result = 1;

    while(power)
    {
        if(power%2)
            result = (result*x)%mod;

        x = (x*x)%mod;
        power = power >> 1;
    }

    return result;
}

long long inverse(long long x, long long mod)
{
    return power_mod(x, mod - 2, mod);
}

long long combinations(long long n, long long r, long long mod)
{
    long long numerator = 1, denominator = 1;

    for(int i = 0; i <= (r - 1); i++)
    {
        numerator = (numerator*(n - i))%mod;
        denominator = (denominator*(r - i))%mod;
    }

    long long answer = (numerator*inverse(denominator, mod))%mod;

    return answer;
}

int main()
{
    int X, Y;
    cin >> X >> Y;

    if( (X + Y)%3 != 0)
    {
        cout << "0\n";

        return 0;
    }

    long long D = (2*Y - X)/3;
    long long L = (2*X - Y)/3;

    const int MOD = 1e9 + 7;
    cout << ( (D < 0 || L < 0) ? 0 : combinations(D + L, D, MOD) );

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long double PI =3.14159265358979323846;
typedef long long ll;
int main(){
  double a,b,h,m;
  cin>>a>>b>>h>>m;
  double hh=h*5;
  double angle=0;
  if(hh>m)
    angle+=m/2;
  else
    angle-=m/2;
    if(m==0)
        m=60;
  angle+=abs(hh-m)*6;
    cout<<fixed<<setprecision(12)<<sqrt(pow(a,2)+pow(b,2)-2*a*b*cos(angle * PI / 180.0))<<endl;
}
    
    


Measured memory_bytes: 4124
import java.util.*;

public class Main {
	// public static void printArray(int[] a) {
	// 	for (int i = 0; i < a.length; i++) {
	// 		System.out.print(a[i] + ", ");
	// 	}
	// 	System.out.println();
	// }

	// public static<T> void printArrayT(T[] a) {
	// 	for (int i = 0; i < a.length; i++) {
	// 		System.out.print(a[i] + ", ");
	// 	}
	// 	System.out.println();
	// }

	// public static class Triple implements Comparable<Triple> {
	// 	public int A, B, C;
	// 	Triple(int A, int B, int C) {
	// 		this.A = A;
	// 		this.B = B;
	// 		this.C = C;
	// 	}

	// 	@Override
	// 	public String toString() {
	// 		return String.format("(%d, %d, %d)", A, B, C);
	// 	}

	// 	@Override
	// 	public int compareTo(Triple o) {
	// 		int a = this.A - o.A;
	// 		if (a != 0) return a;
	// 		int b = this.B - o.B;
	// 		if (b != 0) return b;
	// 		return this.C - o.C;
	// 	}
	// }

	// static boolean[] sieve(int max) {
	// 	boolean[] ret = new boolean[max+1];
	// 	Arrays.fill(ret, true);
	// 	ret[0] = false;
	// 	ret[1] = false;
	// 	int lim = (int)Math.sqrt(max + 1) + 1;
	// 	for (int i = 2; i < lim; i++) {
	// 		if (ret[i]) {
	// 			for (int j = i * i; j < ret.length; j++) {
	// 				ret[j] = false;
	// 			}
	// 		}
	// 	}
	// 	return ret;
	// }

	static boolean solve(int N, int K, int[] A, int max) {
		int[] B = new int[N];
		for (int j = 0; j < N; j++) {
			B[j] = A[j] % max;
		}
		int k = 0;
		Arrays.sort(B);
		int l = 0;
		int r = N - 1;
		while (l < r) {
			int v1 = B[l];
			int v2 = max - B[r];
			if (v1 <= v2) {
				k += v1;
				B[l] -= v1;
				B[r] += v1;
				l++;
			} else {
				k += v2;
				B[l] -= v2;
				B[r] += v2;
				r--;
			}
		}
		if (k <= K) {
			System.out.println(max);
			return true;
		}
		return false;
	}

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		int[] A = intArray(sc, N);
		int sum = 0;
		for (int i = 0; i < N; i++) {
			sum += A[i];
		}
		int lim = (int)Math.sqrt(sum) + 1;
		boolean ok = false;
		for (int i = 1; i < lim; i++) {
			if (sum % i != 0) continue;

			int max = sum / i;
			// System.out.println("candidate = " + max);

			ok = solve(N, K, A, max);
			if (ok) break;
		}
		if (!ok) {
			for (int i = lim; i >= 1; i--) {
				if (sum % i != 0) continue;
				ok = solve(N, K, A, i);
				if (ok) break;
			}
		}
	}

	static int[] intArray(Scanner sc, int N) {
		int[] arr = new int[N];
		for (int i = 0; i < N; i++) {
			arr[i] = sc.nextInt();
		}
		return arr;
	}
}


Measured memory_bytes: 25732
import sys
n, y = map(int,input().split())
# print(n, y)
for i in range(0, n+1):
    for j in range(0,n-i+1):
        if i*10000+j*5000+(n-i-j)*1000 == y:
            print(str(i)+" "+str(j)+" "+str(n-i-j))
            sys.exit()
print(str("-1")+" "+str("-1")+" "+str("-1"))


Measured memory_bytes: 3060
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

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

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

#define int ll

//get vector of prime numbers which is lower than or equal n
vector<int> get_primes(int n)
{
    vector<bool> is_prime(n + 1, true);
    vector<int> res;
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= n; i++)
    {
        if (is_prime[i])
        {
            res.push_back(i);
            for (int j = 2 * i; j < is_prime.size(); j = j + i)
            {
                is_prime[j] = false;
            }
        }
    }
    return res;
}

vector<pair<int, int>> factorize(int n)
{
    vector<pair<int, int>> res;
    for (int i = 2; i * i <= n; i++)
    {
        int tmp = 0;
        while (n % i == 0)
        {
            tmp++;
            n /= i;
        }
        res.push_back(make_pair(i, tmp));
    }
    if (n != 1)
    {
        res.push_back(make_pair(n, 1));
    }
    return res;
}

int mpow(int x, int n)
{
    int res = 1;
    while (n != 0)
    {
        if (n & 1)
            res = res * x % INF;
        x = x * x % INF;
        n = n >> 1;
    }
    return res;
}

//mod frac
vector<int> mfrac;
void set_mfrac(int n)
{
    if (mfrac.size() == 0)
    {
        mfrac.push_back(1);
    }
    for (int i = mfrac.size(); i <= n; i++)
    {
        mfrac.push_back((i * mfrac[i - 1]) % INF);
    }
}

//get nCm mod INF
int mcomb(int n, int m)
{
    if (mfrac.size() <= n)
    {
        set_mfrac(n);
    }
    int res = mfrac[n];
    res = res * mpow(mfrac[m], INF - 2) % INF;
    res = res * mpow(mfrac[n - m], INF - 2) % INF;
    return res;
}

vector<int> get_gcd(int n){
    vector<int> res;
    for(int i=1;i*i<=n;i++){
        if(n%i==0){
            if(i*i==n)
            {res.push_back(i);}
            else
            {res.push_back(i);
            res.push_back(n/i);}
        }
    }
    return res;
}

signed main()
{
    int A, B;
    cin >> A >> B;
    if(A<=9 && B<=9){
        cout << A*B<<endl;
    }else{
        cout << -1 <<endl;
    }
    return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
s = input()

s += 'X'

i = 0
j = 0
zero = 1 if s[0] == '0' else 0
ans = 0
while j < n:
    if zero <= k:
        ans = max(ans, j - i + 1)
        if s[j] == '1' and s[j + 1] == '0':
            zero += 1
        j += 1
    else:
        if s[i] == '0' and s[i + 1] == '1':
            zero -= 1
        i += 1

print(ans)

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

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

    vector<uint64_t> a(n), cnt(n + 1);
    for(auto i = 0; i < n; i++) {
        cin >> a[i];
        cnt[a[i]]++;
    }

    uint64_t max = 0;
    for(auto i = 0; i <= n; i++) {
        max += ((cnt[i] * (cnt[i] - 1)) / 2);
    }

    for(auto i = 0; i < n; i++) {
        if(cnt[a[i]] == 0) cout << max << endl;
        else cout << (max - (cnt[a[i]] - 1)) << endl;
    }

    return 0;
}

Measured memory_bytes: 5760
import math

n = int(input())
a = 1
b = 1
tmp_ans = 0
ans = 10**12

for i in range(1, int(math.sqrt(n))+1):
    j = n // i
    if n == i*j:
        tmp_ans = (i-a) + (j-b)
        if tmp_ans < ans:
            ans = tmp_ans
print(ans)


Measured memory_bytes: 9056
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int,int> P;
const int INF=(int)1e9;
const int MOD=(int)1e9+7;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20);
    };
};

//Ｏ(log n)
//x^nの高速計算
lint mod_pow(lint x,lint n,lint MOD){
  if(n==0)return 1;
  lint res=mod_pow(x*x%MOD,n/2,MOD);
  if(n%2==1)res=res*x%MOD;
  return res;
}


int main(){
  int n;
  cin>>n;
  string s;
  while(n){
    if(n%-2!=0){
      n--;
      s="1"+s;
    }else{
      s="0"+s;
    }
    n/=-2;
  }
  if(s==""){
    s="0";
  }

  cout<<s<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
 
int main(){
    long long n, maxi = 0, ans = 0;
    cin >> n;
    vector <long long>v;
    for(long long i = 0; i < n; ++i){
        long long tmp; cin >> tmp;
        v.push_back(tmp);
    }
    for(long long i = 0; i < n - 1; ++i){
        if(v[i] >= v[i + 1]){
            ans += 1;
          maxi = max(maxi, ans);
        }
        else ans = 0;
    }
    cout << maxi;
    return 0;
 
}


Measured memory_bytes: 1400
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
typedef long long ll;



int main()
{
    int n,k;
    scanf("%d %d",&n,&k);
    ll a[n];
    for(int i=0;i<n;i++)
    {
        scanf("%lld",&a[i]);
    }

    int flag=0;

    for(int i=0;i<n-k;i++)
    {
        if(a[i]>=a[k+i])
        {
            printf("No\n");
        }
        else
        {
            printf("Yes\n");
        }
        
    }
    
    return 0;
}

Measured memory_bytes: 3204
#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 <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <complex>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;

typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef vector<LL> VLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(t,c) for(typeof((c).begin()) t=(c).begin(); t!=(c).end(); ++t)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(t,a,b) for(int t=(a);t<(b);++t)
#define REP(t,n)  FOR(t,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << '=' << (x) << endl;
#define debug(x) cerr << #x << '=' << (x) << '('<<'L' << __LINE__ << ')' << ' ' << __FILE__ << endl;



const LL mod = 1000000007;

LL gcd(LL a, LL b) { if (a%b == 0) { return b; } else return gcd(b, a%b); }
LL lcm(LL a, LL b) { return a / gcd(a, b)*b; }

#define Yes_ cout<<"Yes"<<endl; return 0;
#define No_ cout<<"No"<<endl; return 0;


#define YES_ cout<<"YES"<<endl; return 0;
#define NO_ cout<<"NO"<<endl; return 0;

#define POSSIBLE cout<<"POSSIBLE"<<endl; return 0;
#define IMPOSSIBLE cout<<"IMPOSSIBLE"<<endl; return 0;

int main() {

	int a, b, c;
	string s;
	cin >> a >> b>>c;
	int K;
	cin >> K;
	cout << min(a,min(b,c))+max(a,min(b,c)) + max(a,max(b,c))*pow(2,K) << endl;


}


Measured memory_bytes: 512
package main

import "fmt"

func main() {
    var s, t string
    fmt.Scanln(&s)
    if s == "Sunny" {
        t = "Cloudy"
    } else if s == "Cloudy" {
        t = "Rainy"
    } else {
        t = "Sunny"
    }
    fmt.Println(t)
}


Measured memory_bytes: 512
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors

input = [int(item) for item in input().split()]
a, b, k = input
divisors = make_divisors(a)

th = 0
for i, item in enumerate(divisors[::-1]):
  if b % item == 0:
    th += 1
  if th == k:
    print(item)
    break


Measured memory_bytes: 3060
from collections import Counter, defaultdict
import sys

sys.setrecursionlimit(10 ** 5 + 10)
input = sys.stdin.readline
from math import factorial
import heapq, bisect
import math
import itertools
from copy import deepcopy
import queue
from collections import deque


def maxload(data_copy, i, j, high, width):
    data = deepcopy(data_copy)
    count = 0
    now_point = set()
    now_point.add((i, j))
    next_point = set()

    move = [[1, 0], [0, 1], [-1, 0], [0, -1]]

    while len(now_point):
        for now_i, now_j in now_point:
            data[now_i][now_j] = count
            for move_i, move_j in move:
                next_i, next_j = now_i + move_i, now_j + move_j
                if next_i < 0 or next_i >= high or next_j < 0 or next_j >= width:
                    continue
                if data[next_i][next_j] != ".":
                    continue
                next_point.add((next_i, next_j))

        now_point = next_point
        next_point = set()
        count += 1

    return count - 1



def main():
    high, width = map(int, input().split())
    data = [list(input()) for i in range(high)]

    ans = 0

    for i in range(high):
        for j in range(width):
            if data[i][j] == "#":
                continue
            ans = max(ans, maxload(data, i, j, high, width))

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 77164
// https://atcoder.jp/contests/diverta2019-2/tasks/diverta2019_2_b
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define ALLR(obj) (obj).rbegin(), (obj).rend()

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N;
    cin >> N;
    vector<pii> v(N);
    REP(i, N) cin >> v[i].first >> v[i].second;
    sort(ALL(v));

    map<pii, int> dist;
    int ans = N;
    for (int k = 0; k < N; k++) {
        for (int l = k + 1; l < N; l++) {
            dist[{v[k].first - v[l].first, v[k].second - v[l].second}]++;
        }
    }
    for (auto &x : dist) {
        ans = min(ans, N - x.second);
    }
    cout << ans << endl;
    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    map<string,int> memo;
    for(int i=0;i<n;i++) {
        string s;
        cin >> s;

        memo[s] += 1;
    }

    int maxv = 0;
    for(const auto& x : memo) {
        int v = x.second;
        if(v>maxv) maxv = v;
    }
    for(auto it=memo.begin();it!=memo.end();it++) {
        if(it->second == maxv) {
            cout << it->first << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 25216
#include<bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.141592653589793238462643383279502884L
#define make_unique(vec) vec.resize(distance(vec.begin(),unique(vec.begin(),vec.end())))
#define Sort(vec) sort(vec.begin(),vec.end())
#define RSort(vec) sort(vec.rbegin(),vec.rend())
#define endl "\n"
#define tr1(i) cout<<i<<endl;
#define tr2(i,j) cout<<i<<" "<<j<<endl;
#define tr3(i,j,k) cout<<i<<" "<<j<<" "<<k<<endl;
#define vvi vector<vector<int> > 
#define vvl vector<vector<ll> >
#define all(st) st.begin(),st.end()
#define vpl vector<pair<ll,ll> >
#define vpi vector<pair<int,int> >
#define pi pair<int,int>
#define pl pair<ll,ll>
#define al vector<list<int> >
#define vs vector<string>
#define vi vector<int>
#define vb vector<bool>
#define vl vector<ll>
#define vc vector<char>
#define rep(i,l,r) for(int i=l;i<r;i++)
#define repit(st) for(auto it=st.begin();it!=st.end();it++)
#define ull unsigned long long int
#define eb emplace_back
#define pb push_back
#define ll long long int
#define minf -(1e18)
#define inf 1e18
#define f first
#define se second
#define mod 1000000007
#define mx 500001
using namespace std;
ll mi(ll n,ll m){ll pw=n;ll ex=m-2;ll ans=1;while(ex){if(ex&1) ans = ans*pw%m;pw = pw*pw%m;ex>>=1;}return ans;}
ll pw(ll a,ll n){ll pw=a;ll ex=n;ll ans=1;while(ex){if(ex&1) ans = ans*pw;pw = pw*pw;ex>>=1;}return ans;}
template<typename T>istream &operator>>(istream &is, vector<T> &v) { for (T &t : v) is >> t; return is; }
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v) { for (const T &t : v) {os << t <<" ";} os << '\n'; return os; }
void show(ll x){cout<<x<<" ";}
ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
ll max(ll a,ll b){return a>b?a:b;}
ll min(ll a,ll b){return a<b?a:b;}
ll Abs(ll x){return x>0?x:(-x);}
ll Ceil(ll a,ll b){return a/b+(a%b!=0);}
#define bs binary_search
#define lb lower_bound
#define mkp make_pair
//#define d double
void solve(){
int a[3];
cin>>a[0]>>a[1]>>a[2];
sort(a,a+3);
if(a[0]==5 && a[1]==5 && a[2]==7) cout<<"YES";
else cout<<"NO";
}
int32_t main(){
FIO;
int t=1;
//cin>>t;
while(t--){
	solve();
}
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map>
#include<set>
#include<iomanip>

using namespace std;
using ll = long long;

const int MOD = 1e9 + 7;
const int INF = numeric_limits<int>::max();
const ll LLINF = numeric_limits<ll>::max();
const double PI = acos(-1.0);

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

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

    if (X == 7 || X == 5 || X == 3) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lli long long int
#define mod 1000000007
#define pb push_back
#define pf push_front
#define ulli unsigned long long int
#define what_is(x) cerr << #x << " is " << x << endl;
#define pi 2*acos(0.0)
#define F  first
#define S  second
//#define endl '\n'
#define all(x) x.begin(),x.end()
using namespace std;
const lli INF = 1e18L+5;
/*
lli power(lli x,lli y)
{
	lli res=1;
	while(y>0)
	{
		if(y%2==1)
			res=(res*x)%mod;
		x=(x*x)%mod;
		y=y/2;
	}
	return res;
}
*/
int main()
{
	//cout.precision(10);
	//cout.setf(ios::fixed,ios::floatfield);
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	lli T=1;
	//cin>>T;
	while(T--)
	{
		lli i,n,cunt=0,c,j,z;
		cin>>n;
		vector<lli> v;
		for(i=0;i<n;i++)
		{
			cin>>z;
			v.pb(z);
		}
		sort(v.begin(),v.end());
		for(i=0;i<n-1;i++)
		{
			for(j=i+1;j<n;j++)
			{
				c=v[i]+v[j];
				lli d=lower_bound(v.begin(),v.end(),c)-v.begin();
				cunt+=(d-j-1);
			}
		}
		cout<<cunt<<endl;
	}
}


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

int main(){
    typedef long long ll;
    ll n, k, ans = 10000000000, check;
    cin >> n >> k;
    vector<long> H(n);

    for(int i=0;i<n;i++){
        cin >> H[i];
    }
    sort(H.begin(), H.end());
    for(int i=0;i<n-k+1;i++){
        check = H[i+k-1]-H[i];
        if(ans>check){
            ans=check;
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 1024
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {

    // input
    nums := inputLineAsNumArray(3)
    A := nums[0]
    B := nums[1]
    K := nums[2]
    
    // print
    for i:=A; i<=B; i++ {
        if i < A+K || i > B-K {
            fmt.Println(i)
        }
        if i > A+K && i < B-K && A+K < B-K {
            i = B-K
        }
    }
}

func inputLineAsNumArray(length int) []int {

    line := strings.Split(readLine(), " ")
    var nums []int
    for i := 0; i < length; i++ {
        num, _ := strconv.Atoi(line[i])
        nums = append(nums, num)
    }
    return nums
}

func readLine() string {

	sc.Scan()
	return sc.Text()
}

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

#define fast ios::sync_with_stdio(false);cin.tie(0); cout.tie(0);
#define sz(s) (int)s.size()
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i,n) for(int i=0;i<(int)n;i++)
#define for1(i,n) for(int i=1;i<=(int)n;i++)
#define ford(i, b, a) for (int i = (int)(b); i >= a; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vl;
const ll N = (ll)1e5+77;
const ll inf = (ll) 1e16+7;
const ll mod = (ll) 1e8;
const ld pi = acos(-1);

ll n, m, k, a[N];

int main() {
    fast;
    cin >> n >> k;
    forn(i, n) {
        cin >> a[i];
    }
    sort(a, a + n);

    m = inf;
    fore(i, k - 1, n - 1) {
        m = min(m, a[i] - a[i - k + 1]);
    }
    cout << m << endl;
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
using ll=long long;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define MOD  1000000007
const ll INF=1e18;
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<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; }



int main(int argc, char const *argv[]) {
  string s;
  int n;
  cin >> n >> s;
  if (sz(s) > n) {
    s = s.substr(0, n) + "...";
  }
  cout << s << endl;
  return 0;
}

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

int main(){
  int n;
  cin>>n;
  vector<int>x(n);
  for(int i=0;i<n;i++){
    cin>>x[i];
  }
  long long y=0,z=0;
  for(int j=0;j<n;j++){
    y+=x[j];
    z+=x[j]*x[j];
  }
  long long m=round(pow(10,9))+7,t=0;
  for(int k=0;k<n;k++){
    t+=((y-x[k])%m)*x[k]%m;
    t=t%m;
  }
  for(int l=0;l<m/10;l++){
    t=t*1024%m;
  }
  
  cout<<t*32%m<<endl;
}


Measured memory_bytes: 4036
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
    //cout.precision(10);
    string s;
    cin >> s;
    int ans = 4;
    for(int i = 0; i < 4; i++){
        if(s[i] == '-'){
            ans -= 2;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
using ll = long long;
using P = pair<int, int>;
const int inf = 1000000000; //10^9
const ll MOD = 1e9 + 7;
//加算代入演算子は+=！！！！！
//int 2^31 10^9まで
//intは10桁、long longは18桁、doubleは308桁、long double は4932桁
int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    bool ans = false;
    rep(i, b)
    {
        if (a * i % b == c)
        {
            ans = true;
            break;
        }
    }
    if(ans) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		long a = nl();
		long v = nl();

		long b = nl();
		long w = nl();

		long t = nl();

		long ab = Math.abs(b - a);

		long vw = v - w;

		if (t * vw >= ab) {
			out("YES");
		} else {
			out("NO");
		}
	}

	/*
	 * 以下メソッド集
	 */

	static int ketasuu(int n) {
		String str = "" + n;
		return str.length();
	}

	static int abcount(String str) {
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if ("AB".equals(str.substring(i, i + "AB".length()))) {
				count++;
			}
		}
		return count;
	}

	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static double nd() {
		return sc.nextDouble();
	}

	static String n() {
		return sc.next();
	}

	static char[] nc() {
		return sc.next().toCharArray();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

	static long gcd(long a, long b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static int gcd(int a, int b) {
		return (b == 0) ? a : gcd(b, a % b);
	}

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}

	static void out(char info) {
		System.out.println(info);
	}

	static void out(Object obj) {
		System.out.println(obj.toString());
	}

	static void outn(String info) {
		System.out.print(info);
	}

	static void outn(int info) {
		System.out.print(info);
	}

	static void outn(double info) {
		System.out.print(info);
	}

	static void outn(long info) {
		System.out.print(info);
	}

	static void outn(char info) {
		System.out.print(info);
	}

	static double max(double d, double e) {
		return Math.max(d, e);
	}

	static long max(long a, long b) {
		return Math.max(a, b);
	}

	static double min(double d, double e) {
		return Math.min(d, e);
	}

	static long min(long a, long b) {
		return Math.min(a, b);
	}
}

class XY {
	int h;
	int c;

	XY(int h, int c) {
		this.h = h;
		this.c = c;
	}
}


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

using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ll long long
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());
void c_p_c()
{
#ifndef  ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int binaryExponentiation(int base, int power, int modular)
{
	int res = 1;
	while (power)
	{
		if (power % 2 == 0)
		{
			power /= 2;
			base = (base * base) % modular;
		}
		else
		{
			res = (res * base) % modular;
			power--;
		}
	}
	return res;
}

bool prime[1000001];
int pp[1000001];
void sieve()
{
	memset(prime, true, sizeof(prime));
	int i, j;
	prime[1] = false;
	prime[0] = false;
	for (i = 2; i * i <= 1000000; i++)
	{
		if (prime[i])
		{
			for (j = i * i; j <= 1000000; j += i)
			{
				prime[j] = false;
			}
		}
	}

	int count = 0;
	for (i = 1; i <= 1000000; i++) {
		if (prime[i]) {
			count++;
		}
		if (prime[count])
			pp[i] = 1;
		else
			pp[i] = 0;
	}


}
int FindLCM(int a, int b)
{
	return (a * b) / __gcd(a, b);
}
int rangeDivisor(int m, int n, int a, int b)
{

	int lcm = FindLCM(a, b);

	int a_divisor = n / a - (m - 1) / a;
	int b_divisor = n / b - (m - 1) / b;

	// Find common divisor by using LCM
	int common_divisor = n / lcm - (m - 1) / lcm;

	int ans = a_divisor + b_divisor - common_divisor;
	return ans;
}
int32_t main()
{
		int a, b;
	cin >> a >> b;
	cout << max((a + b), max(a + a - 1, b + b - 1));
}


Measured memory_bytes: 3612
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		double a = 0;
		for(int i = 0;i < n;i++){
			a += 1/saori.Hayamin();
		}
		System.out.println(1/a);
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

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

#define ll long long
#define pb push_back
#define iter std::vector<int>::iterator

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

	int n;
	cin >> n;

	vector<int> value(n+1), cost(n+1);

	for (int i=1; i<=n; i++) {
		cin >> value[i];
	}
	for (int i=1; i<=n; i++) {
		cin >> cost[i];
	}


	int res = 0; 
	for (int i = 1; i <= n; i++) {
		if (value[i] - cost[i] > 0) {
			res += value[i]-cost[i];
		}
	}
	
	cout << res;



	return 0;	
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) throws Exception{
		int num = 998244353;

		// TODO Auto-generated method stub
 		BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
 		PrintWriter out = new PrintWriter(System.out);
 		int n = Integer.parseInt(bf.readLine());
 		StringTokenizer st = new StringTokenizer(bf.readLine());
 		long[] array = new long[n+1];
 		
 		ArrayList<Pair5> pairs = new ArrayList<Pair5>();
 		pairs.add(new Pair5(0, 0));
 		for(int i = 0;i<n;i++){
 			array[i+1] = Long.parseLong(st.nextToken());
 			pairs.add(new Pair5(array[i+1], i+1));
 		}
 		Collections.sort(pairs);
 		long[][] dp = new long[n+1][n+1];
 		for(int i = 1;i<=n;i++){
 			dp[i][i] = (long)(Math.abs(i - pairs.get(1).getIndex())) * pairs.get(1).getNumber();
 		}
 		for(int len = 1;len<n;len++){
 			for(int start = 1;start+len <=n;start++){
 				dp[start][start+len] = Math.max(dp[start+1][start+len] + (long)(Math.abs(pairs.get(len+1).getIndex() - start)) * pairs.get(len+1).getNumber(), dp[start][start+len-1] + (long)(Math.abs(pairs.get(len+1).getIndex() - (start+len))) * pairs.get(len+1).getNumber());
 			}
 		}
 		
 		out.println(dp[1][n]);
	 		
 		out.close();
 		
 		
 		
 	}
}
 	
class Pair5 implements Comparable<Pair5> {
	private long number;
	private int index;
	public Pair5(long number, int index){
		this.number = number;
		this.index = index;
	}
	public long getNumber() {
		return number;
	}
	public void setNumber(long number) {
		this.number = number;
	}
	public int getIndex() {
		return index;
	}
	public void setIndex(int index) {
		this.index = index;
	}
	public int compareTo(Pair5 other){
		if (number > other.number){
			return 1;
		}
		else if (other.number > number){
			return -1;
		}
		else{
			return index - other.index;
		}
	}
}
//StringJoiner sj = new StringJoiner(" "); 
//sj.add(strings)
//sj.toString() gives string of those stuff w spaces or whatever that sequence is

 		
 		
 		
 		
	




Measured memory_bytes: 75668
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){
    let a=read::<i32>();
    let b=read::<i32>();
    let c=read::<i32>();
    println!("{}",c/a*b);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using VI = vector<int>;
using VL = vector<ll>;
using VS = vector<string>;
template<class T> using PQ = priority_queue<T, vector<T>, greater<T>>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);++(i))
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);++(i))
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);--(i))
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);--(i))
#define each(i, a) for(auto &i : a)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
#define out(y,x) ((y) < 0 || h <= (y) || (x) < 0 || w <= (x))
#define line cout << "-----------------------------\n" 
#define ENDL(i,n) ((i) == (n) - 1 ? "\n" : " ")
#define stop system("pause")
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
constexpr ld eps = 1e-10;
constexpr ld pi = 3.1415926535897932;
template<class T>inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; }return false; }
template<class T>inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; }return false; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }
template<class T>inline istream& operator>>(istream& is, vector<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T>inline istream& operator>>(istream& is, deque<T>& v) { for (auto& elemnt : v)is >> elemnt; return is; }
template<class T, class U>inline istream& operator>>(istream& is, pair<T, U>& p) { is >> p.first >> p.second; return is; }
template<class T>inline vector<T> vec(size_t a) { return vector<T>(a); }
template<class T>inline vector<T> defvec(T def, size_t a) { return vector<T>(a, def); }
template<class T, class... Ts>inline auto vec(size_t a, Ts... ts) { return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...)); }
template<class T, class... Ts>inline auto defvec(T def, size_t a, Ts... ts) { return vector<decltype(defvec<T>(def, ts...))>(a, defvec<T>(def, ts...)); }

int main() {
    init();

    int n; cin >> n;
    VI idx(n);
    FOR(i, 0, n) {
        int a; cin >> a;
        idx[a - 1] = i;
    }

    ll ans = 0;
    set<int> s = { -1,n };
    FOR(i, 0, n) {
        auto itr = s.lower_bound(idx[i]);
        int r = *itr, l = *--itr;
        ans += ll(idx[i] - l) * (r - idx[i]) * (i + 1);
        s.insert(idx[i]);
    }

    cout << ans << "\n";
}


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

using namespace std;

main(){
	int a[4] = {0};
  
  	scanf("%d %d %d" , &a[0] , &a[1] , &a[2]);
  	sort(a , a + 3);
  	if((a[0] == a[1]) && (a[0] == 5) && (a[2] == 7)){
    	cout << "YES\n";
    }
  	else {
      	cout << "NO\n";
    }
  
  	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int i,j,N;
  int flag=0;
  scanf("%d",&N);
  
  int p[N];
  for(i=0; i<N; i++){
    scanf("%d",&p[i]);
  }

  for(i=0; i<N; i++){
    j=i+1;
    if(p[i] != j){
      flag++;
    }
  }
  
  if(flag==0 || flag==2) printf("YES\n");
  else printf("NO\n");
  
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#define rep(i, n) for(int i = 0; i < n; ++i)
#define repi(i, n) for(int i = 1; i <= n; ++i)

int main(void) {
  int n, m, t;
  scanf("%d%d", &n, &m);
  int a[n];
  rep(i, n) scanf("%d", &a[i]);
  repi(i, m) {
    rep(j, n - 1) if(a[j] % i > a[j + 1] % i) t = a[j], a[j] = a[j + 1], a[j + 1] = t;
    /*rep(j, n) printf("%d ", a[j]);
    printf("\n");*/
  }
  rep(i, n) printf("%d\n", a[i]);
  return 0;
}


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

#define int long long

#define For(i,a,b) for (int i = a; i <= (b); ++i)
#define For2(i,a,b) for (int i = a; i >= (b); --i)

#define test int _t; cin >> _t; while (_t--)

#define pii pair<int, int>
#define mpii map<int, int>
#define all(a) a.begin(), a.end()
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define sz(a) (int)a.size()

#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define INF 2147483647
#define EPS 1e-9

//#define FILEOPEN

using namespace std;

const int MAXN = (1 << 18) + 5;

int a[MAXN], ans[MAXN];
multiset<int, greater<int> > s[MAXN];

multiset<int, greater<int> > two_last(multiset<int, greater<int> > f) {
	int p = 0;
	if (sz(f) <= 2) return f;
	multiset<int, greater<int> > res;
	for (int i: f) {
		if (++p == 3) break;
		res.insert(i);
	}
	return res;
}

signed main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	#ifdef FILEOPEN
		freopen("input.in", "r", stdin);
		freopen("input.out", "w", stdout);
	#endif
	int n;
	cin >> n;
	For(i,0,(1 << n) - 1) cin >> a[i];
	// cerr << 1;
	For(i,0,(1 << n) - 1) {
		// cerr << a[i] << endl;
		s[i].insert(a[i]);
	}
	For(bit,0,n - 1) {
		For(x,0,(1 << n) - 1) {
			if (!(x & (1 << (bit)))) {
				int f = (x | (1 << bit));
				for (auto i: s[x]) s[f].insert(i);
				s[f] = two_last(s[f]); 
			}
		}
	}
	ans[0] = -INF;
	For(k,1,(1 << n) - 1) {
		int sum = 0;
		for (int i: s[k]) sum += i;
		ans[k] = max(ans[k - 1], sum);
		cout << ans[k] << endl;
	}
}

Measured memory_bytes: 44600
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
	static class UF{
		int[] par;
		UF(int N){
			par = new int[N];
			for(int i = 0 ; i < N ; ++i){
				par[i] = i;
			}
		}
		int root(int x){
			if(par[x] == x){
				return x;				
			}
			return par[x] = root(par[x]);
		}
		void unite(int x , int y){
			int rx = root(x);
			int ry = root(y);
			if(rx != ry){
				par[rx] = ry;
			}
		}
	}
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		UF uf = new UF(N);
		for(int i = 0 ; i < M ; ++i){
			int X = sc.nextInt() - 1;
			int Y = sc.nextInt() - 1;
			int Z = sc.nextInt() - 1;
			uf.unite(X, Y);
		}
		Set<Integer> s = new HashSet<Integer>();
		for(int i = 0 ; i < N ; ++i){
			s.add(uf.root(i));
		}
		System.out.println(s.size());
	}
}


Measured memory_bytes: 90096
N = int(input())
jisyo = {}
for i in range(N):
  AA = input().split()
  jisyo[AA[0]] = AA[1]
SS = input()
count = 0
total = 0
for i,j in jisyo.items():
  if count == 1:
    total += int(j)
  if i == SS:
    count = 1
print(total)

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

using namespace std;
int main(){
    int n,T,A;
    int a[1000+5];
    float b[1000+5];
    cin>>n>>T>>A;
    int flag = 0;
    for(int i = 1;i <= n;i++){
        cin>>a[i];
        b[i] = T-a[i]*0.006;
    }
    float minx = 0x3f3f3f3f;
    for(int i = 1;i <=n ;i++){
        if(minx > fabs(A-b[i])){
            minx = fabs(A-b[i]);
                flag = i;
        }
    }
    cout<<flag;
}


Measured memory_bytes: 256
n = int(input())
joy = []

for i in range(n):
    cur = [int(i) for i in input().split()]
    joy.append(cur)

dp = [[0 for i in range(n+5)] for j in range(3)]
import sys
sys.setrecursionlimit(10000000)
def brute(curday, prvmove):
    if curday>=n:
        return 0
    if dp[prvmove][curday]!=0:
        return dp[prvmove][curday]
    ans = 0
    
    for i in range(3):
        if prvmove == i:
            continue
        ans = max(ans, brute(curday+1, i) + joy[curday][i])

    #print('with', daysleft)
    #print('returning', ans)
    dp[prvmove][curday] = ans
    return ans

ans = 0

for i in range(3):
    ans = max(ans, brute(0, i))
print(ans)


Measured memory_bytes: 117564
def main():

    n = int(input())
    a = [0] * n
    x = [[0] * n for i in range(n)]
    y = [[0] * n for i in range(n)]
    for i in range(n):
        a[i]=int(input())
        for j in range(a[i]):
            x[i][j],y[i][j] = map(int,input().split())
            x[i][j]-=1
    temp=[-1]*n
    ans=0
    for i in range(2**n):
        flg = 'OK'
        case = fill0(i)
        for j in range(n):
            if case[j] == 0:continue
            for k in range(a[j]):
                if case[x[j][k]]==0 and y[j][k]==1:
                    flg='NG'
                    break
                if case[x[j][k]]==1 and y[j][k]==0:
                    flg='NG'
                    break

        if flg == 'OK':
            ans=max(ans,sum(case))
    print(ans)
def fill0(i):
    temp=format(i,'015b')
    a=[]
    for j in range(len(temp)):
        a.append(int(temp[len(temp)-j-1]))
    return a


if __name__=='__main__':
    main()


Measured memory_bytes: 3064
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 200000

for i in range(M):
    x, y, c = map(int, input().split())
    ans = min(ans, a[x-1] + b[y-1] - c)


ans = min(ans, min(a) + min(b))

print(ans)


Measured memory_bytes: 18612
#include<bits/stdc++.h>
using namespace std;
int sum[4];
int n,s;
int main()
{
  scanf("%d",&n);
  for (int i=1;i<=n;i++)
  {
    scanf("%d",&s);
    if ((s&1)==1)
    {
      sum[0]++;
    }else if (((s>>1)&1)==1)
    {
      sum[1]++;
    }else sum[2]++;
  }
  if ((sum[0]>sum[2]+1)||((sum[0]>sum[2])&&sum[1]>0))
  {
    printf("No");
  }else
  {
    printf("Yes");
  }
  return 0;
}


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

ang_h = H * 30 + M * 0.5
ang_m = M * 6
ang = min(abs(ang_h - ang_m), 360 - abs(ang_h - ang_m))
c = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(math.radians(ang)))
print(c)

Measured memory_bytes: 9500
#include<stdio.h>
#include<vector>
#include<algorithm>

struct Task {
	int time;
  	int limit;
};

int main()
{
    int n;
    scanf("%d", &n);
  
  	//struct Task tasks[n];
    std::vector<Task> tasks;
  
  	for(int i=0; i<n; i++){
      struct Task newtask;
      scanf("%d %d", &newtask.time, &newtask.limit);
      tasks.push_back(newtask);
    }
  
  std::sort(tasks.begin(), tasks.end(), [](const Task& x, const Task& y) { return x.limit < y.limit;});
  
  int nowtime = 0;
  for(int i=0; i<n; i++){
      nowtime += tasks[i].time;
    	if(nowtime > tasks[i].limit){
         printf("No\n");
          return 0;
        }
    }
  printf("Yes\n");
  return 0;
}

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

int const N = 100000, md = 1e9 + 7;
int fc[N + 1], inv[N + 1], x[N + 1];

void ad(int &x, int y) { if ((x += y) >= md)x -= md; }
void sb(int &x, int y) { if ((x -= y) <  0 )x += md; }
int sm(int l, int r){
	int an = x[r];
	sb(an, x[l - 1]);
	return an;
}

int main(){
	int n;
	scanf("%d", &n);
	
	fc[0] = 1;
	f(i, 1, n + 1)fc[i] = (ll)fc[i - 1] * i % md;
	inv[1] = 1;
	f(i, 2, n + 1)inv[i] = md - md / i * (ll)inv[md % i] % md;
	
	f(i, 1, n + 1)scanf("%d", x + i);
	
	int an = 0;
	f(i, 1, n)ad(an, (ll)(x[n] - x[i]) * fc[n - 1] % md * inv[n - i] % md);
	
	f(i, 1, n + 1)ad(x[i], x[i - 1]);
	
	--n;
	f(i, 0, n - 1){
		int s = sm(2 + i, n);
		sb(s, sm(1, n - 1 - i));
		ad(an, (ll)s * fc[n] % md * inv[i + 1] % md * inv[i + 2] % md);
	}
	
	printf("%d\n", an);
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <string>
int main(){
  std::string str,ans;
  std::cin>>str;
  std::sort(str.begin(),str.end());
  ans=((str[0]==str[1] && str[1]!=str[2] &&str[2]==str[3])?"Yes":"No");
  std::cout<<ans<<"\n";
}


Measured memory_bytes: 256