akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#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>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);
 
#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

int main(){
    int sx, sy, tx, ty;
    cin >> sx >> sy >> tx >> ty;
    int x_axis_diff = tx - sx;
    int y_axis_diff = ty - sy;
    string ans = "";
    string ans2 = "";
    char RL[2]={'R', 'L'};
    char UD[2]={'U', 'D'};
    int rl_index = 0, ud_index = 0;

    if(x_axis_diff>0)
        rl_index = 0;
    else
        rl_index = 1;
    if(y_axis_diff>0)
        ud_index = 0;
    else
        ud_index = 1;
    for(int i=0;i<abs(x_axis_diff);i++)
        ans += RL[rl_index];
    for(int i=0;i<abs(y_axis_diff);i++)
        ans += UD[ud_index];
    for(int i=0;i<abs(x_axis_diff);i++)
        ans += RL[(rl_index+1)%2];
    for(int i=0;i<abs(y_axis_diff);i++)
        ans += UD[(ud_index+1)%2];
    ans2 += UD[(ud_index+1)%2];
    for(int i=0;i<abs(x_axis_diff)+1;i++)
        ans2 += RL[rl_index];
    for(int i=0;i<abs(y_axis_diff)+1;i++)
        ans2 += UD[ud_index];
    ans2 += RL[(ud_index+1)%2];
    ans2 += UD[ud_index];
    for(int i=0;i<abs(x_axis_diff)+1;i++)
        ans2 += RL[(rl_index+1)%2];
    for(int i=0;i<abs(y_axis_diff)+1;i++)
        ans2 += UD[(ud_index+1)%2];
    ans2 += RL[rl_index];
    cout << ans+ans2 << endl;
}


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

int n;
vector<int> h;

int solve() {
  int ans = 1;
  for (int i = 1; i < n; ++i) {
    if (h[i - 1] > h[i])
      continue;
    bool flg = true;
    for (int k = 0; k < i; ++k) {
      if (h[k] > h[i]) {
        flg = false;
      }
    }
    if (flg)
      ++ans;
  }
  return ans;
}

int main() {
  cin >> n;
  REP(i, n) {
    int a;
    cin >> a;
    h.push_back(a);
  }
  cout << solve() << endl;
}


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



int main(){
   cin.tie(0);
   ios::sync_with_stdio(false);
   cout << fixed << setprecision(20);
   
   int n,h[21],ans=0,maxh=0; cin >> n;
   rep(i,0,n) {
   	cin >> h[i];
   	maxh=max(maxh,h[i]);
   	if(h[i]>=maxh) ans++;
   }
   cout << ans << endl;
   
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
 struct fruit {
  string name;  // 名前
  int price; // 価格
};

int main() {

    int i,j,k=0;
    int n,m;
    string s,s2;
    int b,c;
    int flag=0;
    std::cin >> n;
    
    vector<fruit> fruits(n);
    vector<fruit> fruits2(n);
    for (i=0;i<n;i++){
        std::cin >> fruits.at(i).name>>fruits.at(i).price;
        fruits2.at(i).name=fruits.at(i).name;
        fruits2.at(i).price=fruits.at(i).price;
    }
    
    sort(fruits.begin(), fruits.end(), 
     [](const fruit& x, const fruit& y) {if(x.name==y.name){return x.price > y.price;}
     else return x.name < y.name;});
    
    for(i=0;i<n;i++){
        s=fruits.at(i).name;
        c=fruits.at(i).price;
        for(j=0;j<n;j++){
            s2=fruits2.at(j).name;
            b=fruits2.at(j).price;
            if(s2==s&&b==c){std::cout << j+1 << std::endl; break;}
        }
    }
}


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

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a>=b && a>=c) cout << a*10 + b + c << endl;
    else if(b>=a && b>=c) cout << b*10 + a + c << endl;
    else cout << c*10 + a + b << endl;
    return 0;
}

Measured memory_bytes: 256
import math

def checkDestance(x0,y0,x,y):
    destance = math.sqrt((x0 - x) ** 2 + (y0 - y) ** 2)
    return destance

baseData = [int(i) for i in input().split(" ")]

N = baseData[0]
D = baseData[1]
cnt = 0

for i in range(N):
    pointData = [int(j) for j in input().split(" ")]
    destance = checkDestance(0, 0, pointData[0], pointData[1])
    if destance <= D:
        cnt += 1

print(cnt)

Measured memory_bytes: 9208
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int x = 0;
        int i = 1;
        while (true) {
            x = Integer.parseInt(br.readLine());
            if (x != 0) {
                System.out.println("Case " + i++ + ": " + x);
            } else {
                break;
            }
        }
    }
}

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

void convert(int x, int b){
    if ( x == 0 ) return;
    int p, l = x%10;
    if ( l < 0 ) l *= -1;
    if ( l == 0 ){
	p = 0;
    } else if ( x*b < 0 ){
	p = 10-l;
	x -= b*10;
    } else {
	p = l;
    }
    convert(x/10, b*(-1));
    cout << p;
}

main(){
    int x;
    while(1){
      cin >> x;
      if ( x== 0 ) break;
	convert(x, 1);
	cout << endl;
    }
}

Measured memory_bytes: 1160
#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 pair<int,int> P;
constexpr ll mod = 998244353;

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

  vector<vector<ll>> dp(s+1, vector<ll>(3,0));

  dp[0][0] = 1;
  
  for (int i = 0; i < n; i++) {
    vector<vector<ll>> ndp(s+1, vector<ll>(3,0));
    for (int j = 0; j <= s; j++) {
      //選ばない
      (ndp[j][1] += dp[j][0]) %= mod;
      (ndp[j][1] += dp[j][1]) %= mod;
      (ndp[j][2] += dp[j][1]) %= mod;
      (ndp[j][2] += dp[j][2]) %= mod;
      (ndp[j][2] += dp[j][0]) %= mod;
      (ndp[j][0] += dp[j][0]) %= mod;
      //選ぶ
      if (j + a[i] <= s) (ndp[j + a[i]][1] += dp[j][0] + dp[j][1]) %= mod;
      if (j + a[i] <= s) (ndp[j + a[i]][2] += dp[j][0] + dp[j][1]) %= mod;
    }
    swap(dp, ndp);
  }

  cout << dp[s][2] << endl;
  return 0;
} 

Measured memory_bytes: 640
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

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

ans = 0
if N > K:
    ans = min(N % K, abs(K - N % K))
else:
    ans = min(N, abs(N-K))

print(ans)


Measured memory_bytes: 66028
#pragma GCC optimize ("O3")
#include<bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <queue>
#include <set>
#include <string>
#include <stdbool.h>
#include<ctime>
 
#include <cstring>
 
#define pb push_back
#define p push
 
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define ll long long
 
#define getI(a) scanf("%d",&a)
#define getII(a, b) scanf("%d%d",&a,&b)
#define getIII(a, b, c) scanf("%d%d%d",&a,&b,&c)
#define getL(a) scanf("%lld",&a)
#define getLL(a, b) scanf("%lld%lld",&a,&b)
#define getLLL(a, b, c) scanf("%lld%lld%lld",&a,&b,&c)
#define BEND(c) (c).begin(),(c).end()
#define BEND2(c) (c).rbegin(),(c).rend()
#define fi first
#define se second
#define pi 3.1415926535897932384626
#define getS(a) scanf("%s",a)
#define pfb(a) printf("%.10lf\n",a);
#define pfi(a) printf("%d",a);
#define pfii(a, b) printf("%d%d",a,b);
#define pfl(a) printf("%lld",a);
#define pfll(a, b) printf("%lld%lld",a,b);
#define pfd(a) printf("%.12lf ",a);
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);
#define endl "\n"
 
#define MOD  ( int)(1e9 + 7)
#define MAXN (ll) ((1e6+5))
#define K 25
#define  ALPHABET_SIZE  26
//#define N (int)(1e5+10)
#define sag (sol|1)
#define sol (root<<1)
#define ort (bas+son)/2
#define INF (ll )1e18
#define int ll
using namespace std;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<pair<int, int>>> vvpi;
typedef vector<long long> vl;
typedef vector<pair<int, int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int, int> pii;
typedef pair <ll, ll> pll;
typedef vector<vi> graph;
 
 
 
 
signed main(){
	IOS;
 
	ll n, m; 
	cin >> n >> m; 
	ll sum = 0;
	vi vec;
	for (int a , i = 0; i < n; i++){
		cin >> a;
		vec.pb(a);
		sum += a;
 
	}
    sort(vec.rbegin(),vec.rend());
	
	ll res = 0;
	for (int a , i = 0; i < m; i++){
		if(vec[i] * 4 * m >=sum  )res++;
	}
	if (res >= m)cout << "Yes";
	else cout << "No";
 
	getchar();
	getchar();
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<long long> dp(N+1);
  dp.at(0)=0;
  for(int i=1; i<N+1; i++){
    long long a;
    cin >> a;
    dp.at(i)=dp.at(i-1)+a;
  }
  long long ans=1000000001;
  ans*=200000;
  for(int i=1; i<N; i++){
    ans=min(abs(dp.at(i)*2-dp.at(N)),ans);
  }
  cout << ans << endl;
}

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

int main(void){

  int n, m, i, j;
  int *A, *b, *c;

  scanf("%d %d", &n, &m);

  A = (int *)malloc(sizeof(int) * n*m);
  b = (int *)malloc(sizeof(int) * m);
  c = (int *)malloc(sizeof(int) * n);

  for(i=0;i<n*m;i++){
    A[i] = 0;
    b[i/n] = 0;
    c[i/m] = 0;
  }

  for(i=0;i<n*m;i++){
    scanf("%d", &A[i]);
  }
  for(i=0;i<m;i++){
    scanf("%d", &b[i]);
  }

  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      c[i] += A[i*m + j] * b[j];
    }
    printf("%d\n", c[i]);
  }
  return 0;

}



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

using namespace std;
using ll = long long;

#define FOR(i,m,n) for(ll (i)=(m); (i)<(ll)(n); ++(i))
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin,(a).end

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  ll n, m; cin >> n >> m;
  vector<ll> h(n);
  REP(i,n) cin >> h[i];
  vector<vector<ll>> p(n, vector<ll>(0));
  REP(i,m){
    ll a, b; cin >> a >> b;
    p[a-1].push_back(b-1);
    p[b-1].push_back(a-1);
  }
  ll cnt = 0;
  REP(i,n){
    sort(p[i].begin(), p[i].end());
    p[i].erase(unique(p[i].begin(), p[i].end()), p[i].end());
    bool isTop = true;
    for(auto&& x : p[i]){
      if(h[i] <= h[x]){
        isTop = false;
        break;
      }
    }
    if(isTop) ++cnt;
  }
  cout << cnt << "\n";
  
  return 0;
}

Measured memory_bytes: 9796
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <sstream>
#include <set>
#include <map>
#include <vector>
#include <list>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <string>
#include <queue>
#include <bitset>		//UWAGA - w czasie kompilacji musi byc znany rozmiar wektora - nie mozna go zmienic
#include <cassert>
#include <iomanip>		//do setprecision
#include <ctime>
#include <complex>
using namespace std;

#define FOR(i,b,e) for(int i=(b);i<(e);++i)
#define FORQ(i,b,e) for(int i=(b);i<=(e);++i)
#define FORD(i,b,e) for(int i=(b)-1;i>=(e);--i)
#define REP(x, n) for(int x = 0; x < (n); ++x)
#define ALL(u) (u).begin(),(u).end()

#define ST first
#define ND second
#define PB push_back
#define MP make_pair
#define LL long long
#define ULL unsigned LL
#define LD long double

typedef pair<int, int> PII;

const double pi = 3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342;

const int MR = 310;

int d[MR][MR];

bool bad[MR][MR];

int main()
{
	int N;
	scanf("%d", &N);
	REP(i, N)REP(j, N)
		scanf("%d", &d[i][j]);

	LL res = 0;

	REP(k, N)REP(i, N)FOR(j, i + 1, N)
	{
		if (d[i][j] == d[i][k] + d[k][j] && k != i && k != j)
			bad[i][j] = 1;
		else if (d[i][j] > d[i][k] + d[k][j])
			res = -1;

	}

	if (res != -1)
		REP(i, N)FOR(j, i + 1, N)
		if (!bad[i][j])
			res += d[i][j];

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

	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define reg register

using namespace std;

typedef long long ll;
const int maxn = 102;
const ll mod = 1e9 + 7;

inline ll read() {
    reg ll s = 0, t = 0; reg char ch = getchar();
    while (!isdigit(ch)) t |= ch == '-', ch = getchar();
    while (isdigit(ch)) s = (s << 1) + (s << 3) + (ch ^ 48), ch = getchar();
    return t ? -s : s;
}

int h, w, k;
ll fib[12], f[maxn][9];

int main() {
    ios::sync_with_stdio(false);
    h = read(), w = read(), k = read();
    fib[0] = fib[1] = 1LL;
    for (reg int i = 2; i <= 10; i++) fib[i] = (fib[i - 1] + fib[i - 2]) % mod;
    f[0][1] = 1;
    for (reg int i = 1; i <= h; i++)
        for (reg int j = 1; j <= w; j++)
            f[i][j] = ((j == 1 ? 0 : (f[i - 1][j - 1] * fib[j - 2] % mod * fib[w - j] % mod)) + (j == w ? 0 : (f[i - 1][j + 1] * fib[j - 1] % mod * fib[w - j - 1] % mod)) + f[i - 1][j] * fib[j - 1]%mod * fib[w - j] % mod) % mod;
    cout << f[h][k] << endl;
    return 0;
}


Measured memory_bytes: 256
use std::io;
fn main() {
    let mut l1 = String::new();
    let stdin = io::stdin();
    stdin.read_line(&mut l1).unwrap();
    let mut iter = l1.split_whitespace();
    let v1: i32 = iter.next().unwrap().parse().unwrap();
    let a = v1 / 100;
    let b = (v1 - a * 100) / 10;
    let c = (v1 - (a * 100 + b * 10));
    if a == 7 || b == 7 || c == 7 {
        println!("Yes");
    } else {
        println!("No");
    }
}


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

int main() {
    ll N, M; cin >> N >> M;
    vector<bool> ac(N + 1);
    ac.assign(N + 1, false);
    vector<ll> submit(N + 1);
    ll correct = 0;
    ll penalty = 0;
    for (int i = 0; i < M; ++i) {
        ll p; string s; cin >> p >> s;
        if (s == "AC") {
            if (ac[p] == false) {
                ac[p] = true;
                penalty += submit[p];
                correct += 1;
            }
        }
        else {
            submit[p] += 1;
        }
    }
    cout << correct << " " << penalty << endl;
}


Measured memory_bytes: 1024
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <cstring>
#include <cstdlib>
#include <iostream>
#include <algorithm>

using namespace std;

#define mp make_pair
#define pb push_back
#define x first
#define y second

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

int main()
{
	ll n,x;
	cin>>n>>x;
	ll ans=n,y=n-x;
	if (x<y) swap(x,y);
	while (y)
	{
		if (x%y==0) {ans+=((x/y)*2-1)*y;break;}
		ans=ans+y*(x/y*2);
		ll r=x%y;x=y;y=r;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define sorta(V) sort(V.begin(), V.end())
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end() 

using namespace std;

int main(){

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

    vector<vector<int>> v;

    rep(i,n + 1){
        vector<int> tmpv;
        v.pback(tmpv);
    }

    rep(i,m){
        int a,b;
        cin >> a >> b;

        v[a].pback(b);
        v[b].pback(a);
    }

    queue<pair<int, set<int>>> q;
    set<int> s;

    q.push(mpair(1, s));
    int ans = 0;

    while(!q.empty()){
        int tmpn = q.front().first;
        set<int> tmps = q.front().second;

        if(tmps.size() == n - 1){

            ans++;

        }else{

            tmps.insert(tmpn);

            rep(i,v[tmpn].size()){
                int tmpto = v[tmpn][i];
                if(tmps.find(tmpto) == tmps.end()){
                    q.push(mpair(tmpto, tmps));
                }
            }

        }

        q.pop();

    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2176
''' بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ '''
#codeforces680B
gi = lambda : list(map(int,input().split()))
n, = gi()
l = gi()
l[0] -= 1
for k in range(1, n):
	if l[k] > l[k - 1]:
		l[k] -= 1
	if l[k] < l[k - 1]:
		print("No")
		exit()
print("Yes")

Measured memory_bytes: 14396
#include <iostream>
#include <string>
#include <cctype>
#include <algorithm>
#include <cassert>

using namespace std;

typedef string::const_iterator Iter;

// -X == 2 - X
// X * Y == min(X, Y)
// X + Y == max(X, Y)

int express(Iter &p);

int express(Iter &p) {
	if(*p == '-') {
		p++;
		int r = express(p);
		return 2 - r;
	}
	else if(*p == '(') {
		p++; // skip '('
		int r = express(p);
		if(*p == '*') {
			p++;
			int rs = express(p);
			r = min(r, rs);
		}
		else if(*p == '+') {
			p++;
			int rs = express(p);
			r = max(r, rs);
		}
		else {
			assert(false);
		}

		p++; // skip ')'
		return r;
	}
	else if(isdigit(*p)) {
		int r = (*p) - '0';
		p++;
		return r;
	}
	else
		assert(false);
}

int main() {
	for(;;) {
		string line;
		getline(cin, line);

		if(line == ".") break;

		int ans = 0;
		int var[3];
		for(int i = 0; i < 3; i++) {
			for(int j = 0; j < 3; j++) {
				for(int k = 0; k < 3; k++) {
					var[0] = i;
					var[1] = j;
					var[2] = k;

					string s = line;
					for(string::iterator it = s.begin(); it != s.end(); ++it) {
						if(isalpha(*it)) {
							*it = var[(*it) - 'P'] + '0';
						}
					}
					Iter begin = s.begin();
					int r = express(begin);
					if(r == 2) ans++;
				}
			}
		}
		cout << ans << endl;
	}
}

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

int main(){
  int x,chal = 0;
  int min_diff = 10000000;
  string s = "";
  cin >> s;
  int len = s.length();
  for(int i=0;i<len-2;++i){
    chal = stoi(s.substr(i,3));
    //cout << i << "回目は" << chal << "で" << abs(754-chal) << endl;
    if(abs(754-chal) < min_diff){
      x = i;
      min_diff = abs(753-chal);
    }
  }
  cout << min_diff << endl;
}

Measured memory_bytes: 256
# 解説を見た

k, t = map(int, input().split())
*a, = (int(x) for x in input().split())

ma = max(a)
rest = k - ma
print(max(0, ma - rest - 1))

# 最大の個数のケーキを並べる
# 間にほかのケーキを挟んでいく
# aaaaaa bbbb ccc d
# a[bc]a[bc]a[bc]a[b]a[d]a
# 間に1個ずつ入れたときの、aが連続する回数-1が答え
# 間に複数入ることはあるが、同じケーキが入ることはない（最大のケーキの間の数は、ほかのどのケーキの個数よりも多いから）


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;

#define LEN(x) (int)x.size()
#define ALL(x) x.begin(), x.end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int,int>;
using vpii = vector<pii>;

template<typename T, typename M = __gnu_pbds::null_type>
using ordered_set = __gnu_pbds::tree<T, M, less<T>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

template<typename T>
const T INF = (is_same<T, int>::value ? 1e9 : 1e18);
const int MOD = 1e9 + 7;
const double EPS = 1e-9;

inline int fcmp(double x, double y)
{ return (x < y + EPS ? (x < y - EPS ? -1 : 0) : 1);}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(10);
    
    ll ans = 0;
    int n; cin >> n;
    map<int, ll> mp;
    for(int i = 0; i < n; i++)
    {
        int h; cin >> h;
        ans += mp[i - h];
        mp[h + i]++;
    }

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

Measured memory_bytes: 26292
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) throws IOException {
		new Main().solve();
	}

	private void solve() throws IOException {
		try {
			solveA();
			// solveB();
			// solveC();
			// solveD();
			// solveE();
			// solveF();
		} finally {
			if (in != null) {
				in.close();
			}
			if (out != null) {
				out.flush();
				out.close();
			}
		}

	}

	private void solveA() {
		int numN = Integer.parseInt(next());

		switch (numN) {
		case 7:
		case 5:
		case 3:
			out.print("YES");
			break;
		default:
			out.print("NO");
			break;
		}

		out.println("");
	}

	private void solveB() {
		int numN = Integer.parseInt(next());

		out.println("");
	}

	private void solveC() {
		int numN = Integer.parseInt(next());

		out.println("");
	}

	private void solveD() {
		int numN = Integer.parseInt(next());

		out.println("");
	}

	private void solveE() {
		int numN = Integer.parseInt(next());

		out.println("");
	}

	private void solveF() {
		int numN = Integer.parseInt(next());

		out.println("");
	}

	private final PrintWriter out = new PrintWriter(System.out);
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}
}

Measured memory_bytes: 22740
#[allow(dead_code)]
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}
#[allow(dead_code)]
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}
#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
#[allow(dead_code)]
fn yn(result: bool) {
    if result {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn divisor1(x: u64) -> (u64, u64, u64, u64) {
    let j = (x as f64).sqrt().ceil() as u64;
    let x1 = j;
    let y2 = j;
    let x2 = j * j - x;

    if x2 == 0 {
        return (j, 0, 0, j);
    }

    let mut i = (x2 as f64).sqrt().floor() as u64;
    while i > 0 {
        if x2 % i == 0 && i <= 1000000000 {
            let y = x2 / i;
            if y <= 1000000000 {
                return (x1, y, i, y2);
            }
        }
        i -= 1;
    }
    (0, 0, 0, 0)
}

fn main() {
    let s = read::<u64>();
    let xys = divisor1(s);

    println!("{} {} {} {} 0 0", xys.0, xys.1, xys.2, xys.3);
}


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

using namespace std;

static const int INF = 1e9 + 7;

using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ll = long long;
using ull = unsigned long long;

void hawawa()
{
  int n, a, b;
  cin >> n >> a >> b;
  if (!(abs(a - b) % 2)) {
    cout << "Alice\n";
  } else {
    cout << "Borys\n";
  }
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  hawawa();
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,m,x;
  std::cin >> n>>m>>x;
  std::vector<int> a(m+1);
  std::vector<int> ryo(n+1,0);
  for (int i = 1; i <= m; i++) {
    std::cin >> a.at(i);
    ryo.at(a.at(i))=1;
  }
  int up=0,down=0;
  for (int i = x; i <= n; i++) {
    /* code */
    if(ryo.at(i)==1)up++;
  }
  for (int i = x; i >=0; i--) {
    /* code */
    if(ryo.at(i)==1)down++;
  }
  std::cout << min(up,down) << std::endl;
}

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

int main() {
  int h,n;
  cin >> h >> n;
  vector<pair<int,int>> vec(n);
  rep(i,n) cin >> vec[i].first >> vec[i].second;
  sort(vec.begin(),vec.end());
  vector<int64_t> cost(1000000,INF);
  cost[0]=0;
  int64_t ans=INF;
  rep(i,100000){
    if(cost[i]!=INF){
      for(pair<int,int> pp:vec){
        cost[i+pp.first]=min(cost[i+pp.first],cost[i]+pp.second);
        if(i+pp.first>=h) ans=min(ans,cost[i+pp.first]);
      }
    }
  }
  cout << ans << endl;
}

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

#define mp make_pair
#define eb emplace_back
#define ff first
#define ss second

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#ifdef ONPC
mt19937 rnd(228);
#else
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#endif

const int MAXN = 100;
//#define int long long
const int INF = 1e9;

void solve(){
	int d, t, s;
	cin >> d >>t  >> s;
	if (t * s >= d) cout << "Yes\n";
	else cout << "No\n";
}

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

		solve();

    return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
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; }
using ll = long long;
const ll MOD = 1e9+7; int INF=INT_MAX; ll LLINF = 1LL << 60;
const vector<int> d8x = {1, 0, -1, 0, 1, -1, -1, 1}; vector<int> d8y = {0, 1, 0, -1, 1, 1, -1, -1};
const vector<int> d4x = {1, 0, -1, 0}; vector<int> d4y = {0, 1, 0, -1};

//

int main(){
    int n; cin>>n;
    vector<string> s(n);
    rep(i,n) cin>>s[i];
    sort(all(s));
    vector<pair<int,string>> result(200002);
    int pair_count=-1;
    rep(i,n){
        if(i==0 || s[i]!=s[i-1]){
            pair_count++;
            result[pair_count] = make_pair(1,s[i]);
        }else{
            result[pair_count].first++;
        }
    }
    sort(all(result));
    reverse(all(result));
    int max_vote=result[0].first;
    vector<string> ans;
    for(int i=0; result[i].first==max_vote; i++){
        ans.push_back(result[i].second);
    }
    reverse(all(ans));
    rep(i,(int)ans.size()) cout<<ans[i]<<endl;
}

Measured memory_bytes: 19060
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
const ll mod=1000000007;
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)

int main() {
  int k,t;cin >> k>>t;
  vector<int> a(t);
  repi(i,0,t) cin >> a[i];
  sort(all(a), greater<int>());
  int day = a[0];
  repi(i,1,t){
    day -= a[i];
  }
  --day;
  cout << max(day,0) << endl;
  return 0;
}


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

#pragma region Macro
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define SORT(v) sort(v.begin(), v.end())
#define pb(a) push_back(a)
#define eb(a) emplace_back(a)
#define vi vector<int>
#define vvi vector<vector<int>>
#define chmax(x,y) (x = max(x,y))
#define chmin(x,y) (x = min(x,y))

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#pragma endregion

void solve(){
	// ここに処理を記述
	// コンパイル時はコマンド「gpp」--> c++17でコンパイル
	int N, K;
	cin >> N >> K;

	if(K >= N){
		cout << "0" << endl;
		return;
	}

	vector<ll> H;
	ll temp = 0;
	for(int i=0; i<N; i++){
			cin >> temp;
			H.emplace_back(temp);
	}

	sort(H.begin(), H.end(), greater<ll>());
	rep(i,K){
		H[i] = 0;
	}
	ll sum=0;
	rep(i,H.size()){
		sum += H[i];
	}
	cout << sum << endl;
}

int main(){
	#define int ll
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	
	solve();
	return 0;
}

Measured memory_bytes: 2420
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;

vector<int> adj[100001];
int n,os[100001],chs[100001],sum[100001];
char str[100010];

int ans,cost;

void get_sum(int cur,int p) {
	sum[cur] = os[cur];
	for(auto &it:adj[cur]) if(it!=p) {
		get_sum(it,cur);
		sum[cur] += sum[it];
	}
}
void dfs(int cur,int p) {
	int cnt=0;
	for(auto &it:adj[cur]) {
		if(it==p) cnt++;
		else if(sum[it]) {
			dfs(it,cur);
			cnt++;
		}
	}
	cost += cnt + (cnt%2 ^ os[cur]);
	chs[cur] = cnt%2 ^ os[cur];
}
int get_ans(int cur,int p) {
	int d1=0,d2=0;
	for(auto &it:adj[cur]) if(it!=p) {
		if(!sum[it]) continue;

		int val = get_ans(it,cur);
		if(val > d1) {
			d2=d1; d1=val;
		} else if(val > d2) {
			d2=val;
		}
	}
	ans = min(ans,cost-d1-d2-1-chs[cur]+(chs[cur]^1));
	return d1 + 1+chs[cur]-(chs[cur]^1);
}

int main() {
	scanf("%d",&n);
	for(int i=1;i<n;i++) {
		int u,v;
		scanf("%d%d",&u,&v);
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	scanf("%s",&str[1]);
	for(int i=1;i<=n;i++){
		if(str[i]=='W') os[i]=1;
	}

	int root=0;
	for(int i=1;i<=n;i++) if(os[i]) {
		root=i;
		break;
	}

	if(!root) {
		puts("0");
		return 0;
	}

	get_sum(root,0);
	dfs(root,0);
	ans = cost;
	if(sum[root]!=1) 
		get_ans(root,0);
	
	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 12800
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
int main() {
    ll n;
    std::cin >> n;

    vector<double> v(n);
    
    for (int i = 0; i < n; i++) {
        std::cin >> v[i];
    }
    sort(v.begin(),v.end());
    double sum = v[0];
    
    for (int i = 1; i < n; i++) {
        sum += v[i]*pow(2,i-1);
    }
    
    std::cout<<setprecision(10) << sum/pow(2,n-1) << std::endl;
    
}


Measured memory_bytes: 384
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD1 1000000007



int main() {
  int N, Y;
  cin >> N >> Y;
  bool f = false;


  for (int i = 0 ; i <= N; i++) {
    if (Y - i * 10000 < 0) {
      break;
    }
    for (int j = 0 ; j <= N - i ; j++) {
      if (Y == i * 10000 + j * 5000 + (N - i - j) * 1000) {
        cout << i << " " << j << " " << N - i - j << endl;
        f = true;
        break;
      }
    }
    if (f) break;
  }

  if (!f) cout << "-1 -1 -1" << endl;

}


Measured memory_bytes: 256
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
      Dim S As String = Console.ReadLine()
      Dim T As String = Console.ReadLine()

      Dim Ans As String = "YES" 
      For c As Integer = 0 To 2
          If Not S.Substring(c,1)=T.Substring(2-c,1) Then
              Ans = "NO"
          End If
      Next c
      Console.WriteLine(Ans)
    End Sub
End Module


Measured memory_bytes: 20432
L = list(map(int,input().split()))
L = sorted(L)
answer = 0
answer += L[2]-L[1]
if (L[1]-L[0]) % 2 == 0 :
    answer += (L[1]-L[0])//2 
else :
    answer += (L[1]-L[0])//2 + 2
print(answer)



Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;

class Abc155b
{
    static int n;
    static List<int> a;

    static void Solve()
    {
        var r = true;
        foreach(var i in a) {
            if(i % 2 == 0 && (i % 3 != 0 && i % 5 != 0)) {
                r = false;
                break;
            }
        }
        Console.WriteLine(r ? "APPROVED" : "DENIED");
    }

    static void Scan()
    {
        n = int.Parse(Console.ReadLine());
        a = Console.ReadLine().Split().ToList().ConvertAll(int.Parse);
    }

    static void Main()
    {
        Scan();
        Solve();
    }
}

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

using ll = long long;
const int sz = 1e5 + 10;

int n, m, q, h;
int ar[10005];
int mp[105][105];

int main() {
    #ifdef CLown1331
        freopen( "in.txt","r",stdin );
    #endif /// CLown1331
    while( cin >> n >> m >> q )  {
        for( int i=0; i<q; i++ ) cin >> ar[i];
        h = 0;
        for( int i=0; i<n; i++ ) {
            if( i & 1 ) {
                for( int j=m-1; j>=0; j-- ) {
                    mp[i][j] = h+1;
                    ar[h]--;
                    if( !ar[h] ) {
                        h++;
                    }
                }
            }
            else {
                for( int j=0; j<m; j++ ) {
                    mp[i][j] = h+1;
                    ar[h]--;
                    if( !ar[h] ) {
                        h++;
                    }
                }
            }
        }
        for( int i=0; i<n; i++ ) {
            for( int j=0; j<m; j++ ) {
                cout << mp[i][j] << " ";
            }
            cout << "\n";
        }
        cerr << "---------\n";
    }
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll ans = 0;
    for(ll i=1;i<=n;i++){
        if(!(i%5==0 && i%3==0) && i%3!=0 && i%5!=0){
            ans+=i;
        }
    }
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 3652
#include<iostream>
#include<vector>
#include<queue>

using namespace std;

struct pos{
    int x;
    int y;
};
pos dir[] = {
    {1, 0},
    {-1, 0},
    {0, 1},
    {0, -1}
};

int main(){
    int H, W;
    int depth_max = 0;
    vector<vector<int>> depth;
    queue<pos> dest;
    cin >> H >> W;
    depth.resize(H, vector<int>(W, -1));
    for (int i = 0; i < H; i++){
        string str;
        cin >> str;
        for (int j = 0; j < W; j++){
            char c = str[j];
            if(c == '#'){
                dest.push({i, j});
                depth[i][j] = 0;
            }
        }
    }

    while(dest.size() != 0){
        pos now = dest.front();
        dest.pop();
        for (int i = 0; i < 4; i++){
            pos next = {now.x + dir[i].x, now.y + dir[i].y};
            if(next.x < 0 || H <= next.x || next.y < 0 || W <= next.y){
                continue;
            }
            if(depth[next.x][next.y] != -1){
                if(depth[next.x][next.y] > depth[now.x][now.y] + 1){
                    depth[next.x][next.y] = depth[now.x][now.y] + 1;
                    dest.push(next);
                }
                continue;
            }
            depth[next.x][next.y] = depth[now.x][now.y] + 1;
            dest.push(next);
        }
    }

    for (int i = 0; i < H; i++){
        for (int j = 0; j < W; j++){
            if(depth[i][j] > depth_max){
                depth_max = depth[i][j];
            }
        }
    }
    cout << depth_max << endl;
}

Measured memory_bytes: 12432
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
using P = pair<int,int>;
using ll = long long;
using namespace std;
int main(void){
    char s;
    cin >> s;
    if(isupper(s)){
        cout << "A" << endl;
    }
    else{ cout << "a" << endl;}
    return 0;
}


Measured memory_bytes: 3580
import sys
import copy
sys.setrecursionlimit(10**7)
dx = [1,0,-1,0,1,1,-1,-1]
dy = [0,1,0,-1,1,-1,1,-1]
def dfs(MAP,w,h,x,y):
    MAP[y][x] = 0
    for dir in range(8):
        nx = x + dx[dir]
        ny = y + dy[dir]
        if nx < 0 or nx >= w or ny < 0 or ny >= h:
            continue
        if MAP[ny][nx] == 0:
            continue
        dfs(MAP,w,h,nx,ny)
ans = []
bool = True
while(bool):
    w,h = map(int,input().split())
    if w == 0 and h == 0:
        bool = False
        break
    c = [list(map(int,input().split())) for _ in range(h)]
    cnt = 0
    for i in range(h):
        for j in range(w):
            if c[i][j] == 1:
                cnt += 1
                dfs(c,w,h,j,i)
    ans.append(str(cnt))
for i in range(len(ans)):
    print(ans[i])



Measured memory_bytes: 8608
#include <bits/stdc++.h>
#define mp make_pair
#define eb emplace_back
#define fi first
#define se second
using namespace std;
using cd = complex <double>;
 
typedef pair <int, int> pii;
 
const int Inf = 1000000007;
const long long mod = 1000000007;//998244353;
const double Pi = acos(-1);
 
void Fastio()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

int n, m; 
int Dist[100005], par[100005];
vector <int> Adj[100005];
 
int main()
{
	cin >> n >> m;
	for(int i = 1; i <= m; i++)
	{
		int u, v;
		cin >> u >> v;
		Adj[u].eb(v);
		Adj[v].eb(u);
	}	
	for(int i = 1; i <= n; i++)
	{
		Dist[i] = Inf;
	}
	priority_queue <pair <int, int>, vector <pii>, greater <pii> > pq;
	pq.push(mp(0, 1));
	Dist[1] = 0;
	while(pq.empty() == false)
	{
		int node = pq.top().se, d = pq.top().fi;
		pq.pop();
		if(d == Dist[node])
		{
			for(auto x : Adj[node])
			{
				if(Dist[x] > d + 1)
				{
					Dist[x] = d + 1;
					par[x] = node;
					pq.push(mp(Dist[x], x));
				}
			}
		}
	}
	for(int i = 2; i <= n; i++)
	{
		if(Dist[i] == Inf)
		{
			cout << "No";
			return 0;
		}
	}
	cout << "Yes\n";
	for(int i = 2; i <= n; i++)
	{
		cout << par[i] << '\n';
	}
}

Measured memory_bytes: 11208
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <cstring>

using namespace std;

int main(){
   long long N;
   cin >> N;
   for( int h = 1; h <=3500; h++ ){
      for( int n = h; n <= 3500; n++ ){
         long long bunshi = 4*h*n;
         long long bunbo = N*h*n;
         bunshi -= N*h;
         bunshi -= N*n;
         if( bunshi <= 0 ) continue;
         if( bunbo % bunshi == 0 ){
          cout << h << " " << n << " " << bunbo/bunshi << endl;
          return 0;
         }
      }
   }
   return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
 
int main (){
 
 
int a,b,c,i;
 
 
int count=0;
 
 
scanf("%d %d %d",&a,&b,&c);
 
 
for(i=a;i<=b;i++){
 
 
if(c%i==0) count++;
 
 
}
 
 
printf("%d\n",count);
 
 
return 0;
 
 
}
 

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<ll,ll> P;

void Main() {
  int a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
  ll k;
  R k;
  pr(a[k-1]);
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mst(a,b) memset(a,b,sizeof(a))
#define ALL(x) x.begin(),x.end()
#define pii pair<int,int>
#define eps 1e-3
inline int lowbit(int x){ return x & -x; }
const int N = 2e6 + 10;
const int mod = (int) 1e9 +7;
const int INF = 0x3f3f3f3f;
const long long LINF = (1LL << 62);
typedef long long LL;
typedef unsigned long long ULL;
const double PI = acos(-1.0);
using namespace std;

char buf[100000],*p1=buf,*p2=buf;
inline char nc(){
  return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
inline bool read(int & x){
  char c=nc();x=0;
  if(c==EOF) return false;
  bool flag = false;
  for(;!isdigit(c);c=nc()) flag = true;
  for(;isdigit(c);x=x*10+c-'0',c=nc());
  if(flag) x *= -1;
  return true;
}
inline bool readL(LL & x){
  char c=nc();x=0;
  if(c==EOF) return false;
  bool flag = false;
  for(;!isdigit(c);c=nc()) flag = true;
  for(;isdigit(c);x=x*10+c-'0',c=nc());
  if(flag) x *= -1;
  return true;
}

LL n, k;

int main(){
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
//    freopen("out.txt","w",stdout);
#endif
  readL(n);
  readL(k);
  LL tag = n / k;
  LL ans = tag * tag * tag;
  if(!(k & 1)){
//    tag = 0;
//    int temp = k / 2;
////    printf("%d\n", temp);
//    for(int i = 1; i <= n; i++) if(i % k == temp) tag++;
    tag = (n + k / 2) / k;
    ans += tag * tag * tag;
  }
  printf("%lld\n", ans);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define sz size
#define pb push_back
#define er erase
#define in insert
#define fr first
#define sc second
#define mp make_pair
#define pi pair
#define _ ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
#define rc(s) return cout<<s,0
const int mod=1e9+7;
const int inf=1e5;
using namespace std;
 
int h,w,black,val[55][55];
char a[55][55];
pair<int,int>lo[10000];
 
bool ver(int x,int y){
      if(a[x][y]!='#' && x>=1 && x<=h && y>=1 && y<=w && val[x][y]==0) return true;
      else return false;
}
 
void lee(){
    int st=1;
    int dr=1;
    lo[st].fr=1;
    lo[st].sc=1;
    val[st][dr]=1;
    while(st<=dr){
        if(ver(lo[st].fr+1,lo[st].sc)){val[lo[st].fr+1][lo[st].sc]=val[lo[st].fr][lo[st].sc]+1; dr++; lo[dr].fr=lo[st].fr+1; lo[dr].sc=lo[st].sc;}
        if(ver(lo[st].fr-1,lo[st].sc)){val[lo[st].fr-1][lo[st].sc]=val[lo[st].fr][lo[st].sc]+1; dr++; lo[dr].fr=lo[st].fr-1; lo[dr].sc=lo[st].sc;}
        if(ver(lo[st].fr,lo[st].sc+1)){val[lo[st].fr][lo[st].sc+1]=val[lo[st].fr][lo[st].sc]+1; dr++; lo[dr].fr=lo[st].fr; lo[dr].sc=lo[st].sc+1;}
        if(ver(lo[st].fr,lo[st].sc-1)){val[lo[st].fr][lo[st].sc-1]=val[lo[st].fr][lo[st].sc]+1; dr++; lo[dr].fr=lo[st].fr; lo[dr].sc=lo[st].sc-1;}
 
 
 
 
        st++;
    }
 
}
 
 
int main(){
    cin >> h >> w;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            cin >> a[i][j];
            if(a[i][j]=='#') black++;
        }
    }
 
    lee();
  if(val[h][w]==0) rc(-1);
    cout<<h*w-val[h][w]-black;
    
    
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int n,x,y;
int d[2005]={};
int main()
{
    cin >>n>>x>>y;
    for(int i=1;i<=n;i++)
        for(int j=i+1;j<=n;j++)
            {
                //cout <<i<<' '<<j<<endl;
                if(i<=x&&j>=y)
                    d[x-i+j-y+1]++;
                else if(j<=x||i>=y)
                    d[j-i]++;
                else if(i<=x&&j>=x&&j<=y)
                    d[min(j-x,y-j+1)+x-i]++;
                else if(i>=x&&i<=y&&j>=y)
                    d[min(i-x+1,y-i)+j-y]++;
                else if(i>=x&&j<=y)
                    d[min(j-i,i-x+y-j+1)]++;
            }
    for(int i=1;i<=n-1;i++)
        cout <<d[i]<<'\n';
    //cout <<endl;
    return 0;
}


Measured memory_bytes: 3644
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr int INFI = 1000000007;
const int mod = 1000000007;

int main(){
int n;
cin>>n;
vector<int>a(n);
int min=0;
int cnt=1;
cin>>a.at(0);
min=a.at(0);
for(int i=1;i<n;i++){
    cin>>a.at(i);
    if(a.at(i)<=min){
        cnt++;
        min=a.at(i);
    }
}
cout<<cnt<<endl;
}







Measured memory_bytes: 1024
a, b = map(int, input().split())
l=[0,0,0,0,0]
cnt=0
for i in range(a,b+1):
    x=i
    d=0
    while x>0:
        l[4-d]=x%10
        x=int(x/10)
        d+=1

    if l[0]==l[4] and l[1]==l[3]:
        cnt+=1

print(cnt)


Measured memory_bytes: 3060
H,W = map(int, input().split())

edge = [["." for _ in range(W+2)]]
center = [["."] + list(input()) + ["."] for i in range(H)]
A_array = edge + center + edge

def is_there_OK_move(before_i,before_j,before_move):
    if before_move == "right":
        i = before_i
        j = before_j + 1
    elif before_move == "down":
        i = before_i + 1
        j = before_j

    up = A_array[i-1][j]
    down = A_array[i+1][j]
    right = A_array[i][j+1]
    left = A_array[i][j-1]
    
    if i == H and j == W:
        if up == left == "#":
            return -1
        else:
            return 1
    elif (down == right == "#") or (before_move == "right" and up == "#") or (before_move == "down" and left == "#"):
        return -1
    else:
        if down == "#":
            return is_there_OK_move(i,j,"down")
        elif right == "#":
            return is_there_OK_move(i,j,"right")


ans = is_there_OK_move(0,1,"down")

if ans == 1:
    print("Possible")
else:
    print("Impossible")

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
using namespace std;
int main() {
	int i;
	char str[10010];
	while (scanf("%s", str)!=EOF) {
		int cnt_j = 0, cnt_i = 0;
		for (i = 0; str[i + 2] != '\0'; i++) {
			if (str[i + 1] == 'O'&&str[i + 2] == 'I') {
				if (str[i] == 'J')cnt_j++;
				else if (str[i] == 'I')cnt_i++;
			}
		}
		printf("%d\n%d\n", cnt_j, cnt_i);
		
	}

	return 0;
}


Measured memory_bytes: 3108
from itertools import accumulate

def init(As):
    numPow2 = 2 ** (len(As)-1).bit_length()
    data = [0] * (numPow2+1)
    return data, numPow2

def addValue(iA, A):
    iA += 1
    while iA <= numPow2:
        data[iA] += A
        iA += iA & -iA

def getSum(iA):
    iA += 1
    ans = 0
    while iA > 0:
        ans += data[iA]
        iA -= iA & -iA
    return ans


N, K = map(int, input().split())
As = [int(input()) for _ in range(N)]

Bs = list(accumulate([0]+[A-K for A in As]))
iBs = list(range(N+1))
iBs.sort(key=lambda iB: Bs[iB])

data, numPow2 = init([0]*(N+1))

ans = 0
for iB in iBs:
    addValue(iB, 1)
    ans += getSum(iB-1)

print(ans)


Measured memory_bytes: 33280
#include <iostream>
#include <vector>
using namespace std;
int partition2(vector<int> &a, int l, int r) {
    int x = a[l];
    int j = l;
    for (int i = l + 1; i <= r; i++) {
        if (a[i] <= x) {
            j++;
            swap(a[i], a[j]);
        }
    }
    swap(a[l], a[j]);
    return j;
}

void randomized_quick_sort(vector<int> &a, int l, int r) {
    if (l >= r) {
        return;
    }
    int k = l + rand() % (r - l + 1);
    swap(a[l], a[k]);
    int m = partition2(a, l, r);

    randomized_quick_sort(a, l, m - 1);
    randomized_quick_sort(a, m + 1, r);
}
int min(int n,int k,vector<int>&p)
{
    int ans=0;
    randomized_quick_sort(p,0,n-1);
    for (int i = 0; i <k ; ++i) {
        ans+=p[i];
    }
    return ans;
}
int main() {
    int n,k;
    cin>>n>>k;
    vector<int> p(n);
    for (int i = 0; i <n ; ++i) {
        cin>>p[i];
    }
    cout<<min(n,k,p)<<endl;
}


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

int main() {
  int ans = 700;
  rep(i,3){
    char c;
    cin>>c;
    if(c=='o') ans+=100;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256