akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    double prob[n];
    for(int i=0;i<n;i++)
    cin>>prob[i];
    double dp[n+1][n+1];//exactly i heads in j tosses
    dp[0][0]=1;
    dp[0][1]=1-prob[0];
    for(int i=2;i<=n;i++)
    dp[0][i]=dp[0][i-1]*(1-prob[i-1]);
    for(int i=1;i<=n;i++)
    dp[i][0]=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=n;j++)
        {
            dp[i][j]=dp[i-1][j-1]*prob[j-1]+(1-prob[j-1])*dp[i][j-1];
        }
    }
    double ans=0.0;
    for(int i=n/2+1;i<=n;i++)
    {
        ans+=dp[i][n];
    }
    cout<<setprecision(9)<<ans<<"\n";
    return 0;
}

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);
int DX[8] = { 0, 0, 1, -1, 1, 1, -1, -1 };    int DY[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };

/* -----  2019/03/03  Problem: ABC 120 C / Link: http://abc120.contest.atcoder.jp/tasks/abc120_c  ----- */


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


	string s; cin >> s;
	LL ans = 0LL;
	LL onecnt = 0, zerocnt = 0;
	for (auto c : s) {
		if (c == '1') {
			if (zerocnt) {
				ans += 2;
				zerocnt--;
			}
			else {
				onecnt++;
			}
		}
		else {
			if (onecnt) {
				ans += 2;
				onecnt--;
			}
			else {
				zerocnt++;
			}
		}
	}
	
	
	cout << (ans) << "\n";

	return 0;
}


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

char S[1000009];
long long D[1000009];

int main() {
    int N; scanf("%d %s",&N,S+1);
    int Q; scanf("%d",&Q);
    while(Q--) {
        int k; scanf("%d",&k);
        long long v = 0, d = 0, m = 0;
        for(int i=1; i<k; i++) {
            if(S[i] == 'D') ++d;
            if(S[i] == 'M') {
                v += d;
                ++m;
            }
            D[i] = v;
        }
        for(int i=k; i<=N; i++) {
            if(S[i-k+1] == 'D') {
                v -= m;
                --d;
            }
            if(S[i-k+1] == 'M') --m;
            if(S[i] == 'D') ++d;
            if(S[i] == 'M') {
                v += d;
                ++m;
            }
            D[i] = v;
        }
        long long ans = 0;
        for(int i=1; i<=N; i++) if(S[i] == 'C') ans += D[i-1];
        printf("%lld\n",ans);
    }
    return 0;
}


Measured memory_bytes: 9088
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <queue>
#include <bitset>
using namespace std;

#ifdef LOCAL
	#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
	#define eprintf(...) 42
#endif

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef long double ld;
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll MOD = 998244353;
ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}
ll mult(ll x, ll y) {
	return (x * y) % MOD;
}

const int N = 200200;
char s[N];
int n;
ll a[N];

ll solve(int k) {
	k = n / k;
	ll ans = 0;
	for (int i = 0; i < k; i++) {
		ans = add(ans, ans);
		if (s[i] == '1')
			ans = add(ans, 1);
	}
	for (int i = 0; i <= n; i++) {
		if (i == n) {
			ans = add(ans, 1);
			break;
		}
		char c1 = s[i];
		char c2;
		int p = i % (2 * k);
		if (p < k)
			c2 = s[p];
		else
			c2 = s[p - k] ^ 1;
		if (c1 == c2) continue;
		if (c1 < c2) break;
		ans = add(ans, 1);
		break;
	}
	return ans;
}

int main()
{
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);

	scanf("%d %s", &n, s);
	for (int k = 1; k <= n; k++) {
		if (n % k != 0 || k % 2 == 0) continue;
		a[k] = solve(k);
//		eprintf("%lld ", a[k]);
	}
	for (int i = n; i > 0; i--)
		for (int j = 2 * i; j <= n; j += i)
			a[i] = sub(a[i], a[j]);
	ll ans = 0;
	for (int i = 1; i <= n; i++)
		ans = add(ans, mult(a[i], 2 * n / i));
	printf("%lld\n", ans);

	return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
#define dd double
#define ll long long

using namespace std;

int main()
{
    char T[1001],p[1001];
    int k = 1,l;
    cin >> T;
    cin >> p;
    for(int i=0; i<strlen(T); i++){
            k = 1;
        if(T[i] == p[0]){
            l=i+1;
            for(int j = 1;j<strlen(p);l++,j++){
                if(T[l] != p[j]){
                    k = 0;
                    break;
                }
            }
            if(k){
                cout << i << endl;
            }
        }
    }

    return 0;
}



Measured memory_bytes: 3116
#include <stdio.h>
#define N 1000000

int main(){
int n,i,j;
int a[N];
a[0]=0;
a[1]=0;
a[2]=1;
for(i=3;i<N;i++){
a[i]=i%2;
}
for(i=2;i<N;i++){
if(a[i]==1){
for(j=i*2;j<N;j+=i){
a[j]=0;
}
}
}
for(i=1;i<N;i++){
a[i]+=a[i-1];
}
while(1){
if(scanf("%d",&n) != 1)break;
printf("%d\n",a[n]);
}
return 0;
}

Measured memory_bytes: 4500
#include<bits/stdc++.h>
using namespace std;
int main()
{int x;
 cin>>x;
if(x>=400 && x<=599)
  cout<<8;
 else if(x>=600 && x<=799)
   cout<<7;
 else if(x>=800 && x<=999)
   cout<<6;
 else if(x>=1000 && x<=1199)
  cout<<5;
 else if(x>=1200 && x<=1399)
   cout<<4;
 else if(x>=1400 && x<=1599)
   cout<<3;
 else if(x>=1600 && x<=1799)
  cout<<2;
 else if(x>=1800 && x<=1999)
   cout<<1;
  return 0;
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            String str = Console.ReadLine();
            Char[] strchar = str.ToCharArray();
            strchar[5] = ' ';
            strchar[13] = ' ';
            Console.WriteLine(strchar);
        }
    }
}


Measured memory_bytes: 11092
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<map>
#include<cmath>
#define ll long long
using namespace std;
ll h,w,ans;
int main()
{
    ll a,b,c;
    scanf("%lld%lld%lld",&a,&b,&c);
    if((c-a-b)*(c-a-b)>4*a*b&&c>a+b)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,v,b,w,t;
    cin>>a>>v>>b>>w>>t;
    if(v<=w)cout<<"NO"<<endl;
    else{
        if((abs(a-b)-1)/(v-w)<t)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3640
import sys
from math import factorial
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

n = INT()

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

while True:
    if is_prime(n):
        print(n)
        break
    n += 1

Measured memory_bytes: 66156
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <array>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <cassert>
#include <utility>
#include <functional>

using namespace std;
using lli = long long int;


int main() {

    lli N;
    cin >> N;

    lli counter = 0;
    for (int i = 1; i <= N; ++i) {
        string str = to_string(i);
        if (str.size() % 2 != 0) {
            ++counter;
        }
    }

    cout << counter << endl;
    return 0;
}

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

int main() {
  ll N, K;
  cin >> N >> K;

  vector<pair<int, int>> v;
  rep(i, N) {
    int a, b;
    cin >> a >> b;
    v.emplace_back(a, b);
  }

  sort(v.begin(), v.end());

  ll cnt = 0;
  rep(i, N) {
    cnt += v[i].second;
    if (cnt >= K) {
      cout << v[i].first << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 1400
n = int(input())

words = ['AC', 'WA', 'TLE', 'RE']
ls = [0]*4

for i in range(n) :
    s = input()
    if s in words :
        ls[words.index(s)] += 1

for j in range(4) :
    print(words[j]+' x '+str(ls[j]))


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

int main()
{
     long long int n;
     cin>>n;
     int u=0;
     long long int y=n;
     long long int sum=0;
     while(y){
	sum+=y%10;
     	y=y/10;u++;}
     u--;
     //cout<<u;
     
     long long int r=n/(pow(10,u));
    cout<<max(sum,(u)*9+(r-1));return 0;
   
}   

Measured memory_bytes: 256
import itertools

def fibonacci(n):
    if (n == 0):
        f_n = 1
    elif (n == 1):
        f_n = 1
    else:
        f_n = fibonacci(n-1) + fibonacci(n-2)

    return f_n

def X_amida_number(W, W_i):
    x_amida = "0" * (W - 1)
    left_x_amida = x_amida[:(W_i-2)] if(W_i-2 >= 0) else ""
    right_x_amida = x_amida[(W_i+1):]

    return fibonacci(len(left_x_amida) + 1) * fibonacci(len(right_x_amida) + 1)

def Y_amida_number(W, W_i):
    y_amida = "0" * (W - 1)
    left_y_amida = y_amida[:W_i-1] if(W_i-1 >= 0) else ""
    right_y_amida = y_amida[W_i+1:]

    return fibonacci(len(left_y_amida) + 1) * fibonacci(len(right_y_amida) + 1)

def Z_amida_number(W, W_i):
    z_amida = "0" * (W - 1)
    left_z_amida = z_amida[:W_i-1] if(W_i-1 >= 0) else ""
    right_z_amida = z_amida[W_i+2:]

    return fibonacci(len(left_z_amida) + 1) * fibonacci(len(right_z_amida) + 1)

def amida_all(amida_list, W):
    for i, j in itertools.product(range(W), range(3)):
        if(j == 0):
            amida_list[i][j] = X_amida_number(W, i)
        elif(j == 1):
            amida_list[i][j] = Y_amida_number(W, i)
        else:
            amida_list[i][j] = Z_amida_number(W, i)

    return amida_list

H, W, K = map(int, input().split())
amida_list = [[0]*3 for i in range(W)]
amida_list = amida_all(amida_list, W)

seed_dp_array = [0 for i in range(W)]
dp_array = [list(seed_dp_array) for i in range(H + 1)]
dp_array[0][0] = 1

for H_i, W_i in itertools.product(range(1, H + 1), range(W)):
    if (W_i == 0):
        if(W == 1):
            dp_array[H_i][0] = dp_array[H_i - 1][W_i] * amida_list[W_i][1]
        else:
            dp_array[H_i][0] = dp_array[H_i - 1][W_i] * amida_list[W_i][1] + dp_array[H_i - 1][W_i + 1] * amida_list[W_i][2]
    elif (W_i == (W - 1)):
        dp_array[H_i][W - 1] = dp_array[H_i - 1][W_i - 1] * amida_list[W_i][0] + dp_array[H_i - 1][W_i] * amida_list[W_i][1]
    else:
        dp_array[H_i][W_i] = dp_array[H_i - 1][W_i - 1] * amida_list[W_i][0] + dp_array[H_i - 1][W_i] * amida_list[W_i][1] + dp_array[H_i - 1][W_i + 1] * amida_list[W_i][2]

print(dp_array[H][K - 1] % 1000000007)

Measured memory_bytes: 3192
n, a, b = gets.chomp.split(" ").map(&:to_i)
count = 0
1.upto (n) do |i|
    if i.to_i.size >= 2
        i = i.to_s.split("").map(&:to_i)
    end
    ans = i.inject(:+)
    if ans >= a && ans <= b
        count += i.join("").to_i
    end
end
puts count

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

#define pout(n)  printf ("%d\n", n)

#define rep(i,a,n) for (int i = a;i < n;i++)
#define per(i,n,a) for (int i = n-1;i >= a;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());

const int d4x[4] = {1, 0, -1, 0};
const int d4y[4] = {0, 1, 0, -1};
const int d8x[8] = { 1,1,0,-1,-1,-1,0,1 };
const int d8y[8] = { 0,1,1,1,0,-1,-1,-1 };

#define MAX_N (int)2e5+20
#define INF 1e12+20

typedef long long ll;
using namespace std;

string s;
int main() {
	cin >> s;

	bool ans = false;
	rep(i,0,s.size()-1){
		if(s[i] == 'A'){
			if(s[i+1] == 'C'){
					ans = true;
				}
				
			}	
	}
	if(ans == true) printf("Yes\n");
	else printf("No\n");
	return 0;
}

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

typedef long long ll;
#define ALL(a) a, a+sizeof(a)/sizeof(a[0])
#define all(a) a.begin(),a.end()
#define MOD 1000000007
using namespace std;
ll gcd(ll n, ll m) {
	if (m == 0) return n;
	return gcd(m, n % m);
}
ll lcm(ll n, ll m) {return m / gcd(n, m) * n;}

int main(void) {
	ll w, h, c;
	cin >> w >> h >> c;
	cout << (w/gcd(w, h))*(h/gcd(w,h)) * c << endl;
	return 0;
}


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

int main() {
    int n;
    cin>>n;
    int a[n][3];
    for(int i=0;i<n;i++){
        for(int j=0; j<3; j++){
            cin>>a[i][j];
        }
    }
    for(int i=1;i<n;i++){
        a[i][0] = a[i][0] + max(a[i-1][1], a[i-1][2]);
        a[i][1] = a[i][1] + max(a[i-1][0], a[i-1][2]);
        a[i][2] = a[i][2] + max(a[i-1][0], a[i-1][1]);
    }
    cout<<max(a[n-1][0], max(a[n-1][1], a[n-1][2]));
}


Measured memory_bytes: 1408
#define _GLIBCXX_DEBUG//実行時、何も出なかったらこれを使う
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<queue>
#include<stack>
#include<map>
#include<numeric>
#include<climits>
#include<limits>//
#include <stdio.h>//
#include<cmath>
#include<iomanip>

using namespace std;

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

typedef long long ll;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

int dy[] = {1,0}; //次に行くところ
int dx[] = {0,1}; //上に同じ

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

  //l1,q9,0o,b6
  int d,t,s;
  cin >> d >> t >> s;
  if (s*t >= d){
    cout << "Yes\n";
  }else{
    cout << "No\n";
  }
  
  

  return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll n,k;
	cin>>n>>k;
	map<ll,ll > map;
	std::map<ll,ll> ::iterator it;
	for(ll i=1;i<=n;i++){
		map[i]=1;
	}
	
	for(ll i=1;i<=k;i++){
		ll d;
		cin>>d;
		for(ll i=0;i<d;i++){
			ll x;
			cin>>x;
			it=map.find(x);
			if(it!=map.end()){
				map.erase(x);
			}
		}
	}
	cout<<map.size()<<endl;
}


Measured memory_bytes: 3592
<?php
fscanf(STDIN, '%d', $K);
fscanf(STDIN, '%d %d', $A, $B);

for ($i=$A; $i <= $B; $i++) {
    if ($i % $K === 0) {
        echo 'OK';
        exit();
    }
}
echo 'NG';
echo PHP_EOL;


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

int main(void){
 int H, W;
  cin >> H >> W;
  vector<vector<char>> v(H, vector<char>(W));
  vector<int> H_s, W_s;
  for(int i = 0; i < H; i++){
    int flag = 0;
    for(int j = 0; j < W; j++){
      cin >> v[i][j];
      if(v[i][j] == '#') flag = 1; 
    }
    if(flag == 1) H_s.push_back(i);
  }
  for(int j = 0; j < W; j++){
    int flag = 0;
    for(int i = 0; i < H; i++){
      if(v[i][j] == '#') flag = 1; 
    }
    if(flag == 1) W_s.push_back(j);
  }
  for(int i = 0; i < H_s.size(); i++){
    for(int j = 0; j < W_s.size(); j++){
      cout << v[H_s[i]][W_s[j]];
    }
    cout << endl;
  }

  return 0;
}

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

int main(int argc, char** argv)
{
	int a, b, c, x;

	scanf("%d %d %d %d", &a, &b, &c, &x);

	int cnt = 0;

	for (int ia = 0; ia <= a; ++ia)
	{
		for (int ib = 0; ib <= b && 500 * ia + 100 * ib <= x; ++ib)
		{
			if (0 <= (x - (500 * ia + 100 * ib)) / 50 && (x - (500 * ia + 100 * ib)) / 50 <= c) ++cnt;
		}
	}

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

	return 0;
}


Measured memory_bytes: 128
# 高橋君は500円玉をK枚持っています。 これらの総額がX円以上である場合は Yes を、そうでない場合は No を出力してください。
# コマンドライン引数 K X
# 制約　1≤K≤100　1≤X≤10^5

import sys

inp_word = input()

# コマンドライン引数を変数に入れる
K,X = inp_word.split()

# 総額の保持
sum = 500 * int(K)

# 出力文の作成
if sum >= int(X):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 2940
S = [input() for _ in range(3)]
t = 0
while S[t] != "":
    f = S[t][0]
    S[t] = S[t][1:]
    if f == "a":
        t = 0
    elif f == "b":
        t = 1
    elif f == "c":
        t = 2
if t == 0:
    print("A")
elif t == 1:
    print("B")
elif t == 2:
    print("C")

Measured memory_bytes: 3064
using System;
using System.Collections;

class Class01
{
    public static void Main(string[] args)
    {
        string s;
       
        ArrayList arr = new ArrayList();
        while (true)
        {
            s = Console.ReadLine();
            if (s == null) break;
            arr.Add(int.Parse(s));
        }

        int count;

        for (int j = 0; j < arr.Count; j++)
        {
            count = 0;
            for (int a = 0; a <= 9; a++)
            {
                for (int b = 0; b <= 9; b++)
                {
                    for (int c = 0; c <= 9; c++)
                    {
                        for (int d = 0; d <= 9; d++)
                        {
                            if (a + b + c + d == int.Parse(arr[j].ToString())) count++;
                        }
                    }
                }
            }
            Console.WriteLine(count);
        }
    }
}

Measured memory_bytes: 9420
#include<bits/stdc++.h>
using namespace std;
#define int ll
#define ll long long
signed main(){
  int n;
  cin>>n;
  vector<int> a(n),b;
  for(auto &i:a)cin>>i;
  sort(a.begin(),a.end());
  b=a;
  for(int i=1;i<n;++i)b[i]+=b[i-1];
  for(int i=0;i<n;++i){
    if(a[n-i-1]<=b[n-i-2]*2)continue;
    else return cout<<i+1,0;
  }
  cout<<n;
}

Measured memory_bytes: 1792
#include<iostream>

int main(){
  int a, b, c;
  int count = 0;
  std::cin >> a >> b >> c;
  for(int i = a; i <= b; i++){
    if(c%i == 0){
      count++;
    }
  }
  std::cout << count << std::endl;
  return 0;
}

Measured memory_bytes: 3092
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define int long long
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=1e9+7;
const ll mod=1e9+7;
signed main(){
    ll n,m;cin>>n>>m;
    vector<ll>cnt(n+1);
    rep(i,m){
        ll a,b;cin>>a>>b;
        cnt[a]++;
        cnt[b]++;
    }
    bool f=1;
    REP(i,1,n+1){
        if(cnt[i]%2)f=0;
    }
    cout<<(f?"YES":"NO")<<endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<cstring>
#include<string>
#include<iomanip>
#include<map>
#include<fstream>
#include<queue>
#include<set>
#include<deque>

using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;
	double sum = 0;

	sum = (1900 * m + 100 * (n - m)) * pow(2, m);
	cout << (int)sum << endl;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <algorithm>

int main(int argc, char const *argv[]) {
	char str[1001];
	int N, T, A;
	int h[1001];
	int ans;
	int i;

	fgets(str, 100, stdin);
	sscanf(str, "%d", &N);

	fgets(str, 100, stdin);
	sscanf(str, "%d %d", &T, &A);

	for (i = 0; i < N; i++) {
		scanf("%d", &h[i]);
	}

	double t = A - (T - h[0] * 0.006);
	t = t > 0 ? t : -t;
	double min = t;
	ans = 0;

	for (i = 0; i < N; i++) {
		t = A - (T - h[i] * 0.006);
		// printf("%d %.3f < %.3f\n", i, t, min);
		t = t > 0 ? t : -t;
		if (t < min) {
			ans = i;
		}
		min = t < min ? t : min;
	}

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

	return 0;
}


Measured memory_bytes: 128
using System;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var str = Console.ReadLine();
            var strs = str.Split(' ');
            var N = int.Parse(strs[0]);
            var M = int.Parse(strs[1]);
            var C = int.Parse(strs[2]);

            str = Console.ReadLine();
            strs = str.Split(' ');
            var Bs = new int[M];
            for (int i = 0; i < Bs.Length; i++)
            {
                Bs[i] = int.Parse(strs[i]);
            }

            var count = 0;
            for (int i = 0; i < N; i++)
            {
                str = Console.ReadLine();
                strs = str.Split(' ');
                var As = new int[M];
                for (int j = 0; j < M; j++)
                {
                    As[j] = int.Parse(strs[j]);
                }

                var ans = 0;
                for (int k = 0; k < M; k++)
                {
                    ans += As[k] * Bs[k];
                }

                if (ans + C > 0)
                {
                    count++;
                }
            }

            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair

int main()
{
	int n,k;
	scanf("%i %i",&n,&k);
	if((n+1)/2>=k) printf("YES\n");
	else printf("NO\n");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
typedef long long ll;
const int MAX = 2*1e5;
const ll mod = 1e9+7;

ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i-1] * (ll)i % mod;
        inv[i] = mod - inv[mod%i] * (mod/(ll)i) % mod;
        finv[i] = finv[i-1] * inv[i] % mod;
    }
}

ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n-k] % mod) % mod;
}


int main(){
    COMinit();
    int h, w, a, b;
    cin >> h >> w >> a >> b;
    ll ans = 0;
    for(int i = 0; i < h - a; i++) ans = (ans + COM(b+i-1,i)*COM(h+w-b-2-i,h-1-i)) % mod;
    cout << ans << endl;
    return 0;
}


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

signed main(){
 lint A, B, C, K; cin >> A >> B >> C>> K;
 lint ans;
 if(A >= K) ans = K;
 else if(A + B >= K) ans = A;
 else ans = A - (K - A - B);
 cout << ans << endl;
}

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

int main(){
	int n;

	cin >> n;
	int* l = new int[n];

	for(int i = 0; i < n; i++){
		cin >> l[i];
	}

	for(int i = 0; i < n; i++){
		cout << l[n-i-1] << flush;
		if(i == n-1){
			cout << endl;
			break;
		}
		cout << ' ' << flush;
	}

	return(0);
}

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

int main() {
    string s;
    cin >> s;
    int a[s.size() + 1] = {};
    for (int i = 0; i < s.size(); i++) {
        if (s[i] == '<') {
            a[i + 1] = max(a[i + 1], a[i] + 1);
        }
    }
    for (int i = s.size() - 1; i >= 0; i--) {
        if (s[i] == '>') {
            a[i] = max(a[i], a[i + 1] + 1);
        }
    }
    long long result = 0;
    for (int num : a) {
        result += num;
    }
    cout << result;
    return 0;
}


Measured memory_bytes: 2820
c = {"N": (1, 5, 2, 3, 0, 4), "S": (4, 0, 2, 3, 5, 1), "E": (3, 1, 0, 5, 4, 2), "W": (2, 1, 5, 0, 4, 3)}
d = list(map(int, input().split()))
for x in input():
  d = [d[y] for y in c[x]]
print(d[0])


Measured memory_bytes: 5604
import sys
import re
import math
import collections
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal
import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))
nb = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))


# ===CODE===


def main():
    n, k = ns()
    ans = []

    tmp = (n - 1) * (n - 2) // 2
    if k > tmp:
        print(-1)
        exit(0)

    for i in range(n - 1):
        ans.append([i, n - 1])

    breakflg = False
    for i in range(n - 1):
        for j in range(i + 1, n - 1):
            if tmp == k:
                breakflg = True
                break

            tmp -= 1
            ans.append([i, j])

        if breakflg:
            break

    print(len(ans))
    for a, b in ans:
        print(a + 1, b + 1)


if __name__ == '__main__':
    main()


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

int main(){
    int N, K;  cin >> N >> K;
    vector<int> a(N+1);
    for(int i=1; i<=N; i++) cin >> a[i];

    ll mod = 1e9+7;
    vector<vector<ll>> dp(N+1, vector<ll>(K+1,0));
    for(int i=0; i<=N; i++) dp[i][0] = 1;
    for(int i=1; i<=N; i++) for(int j=1; j<=K; j++){
        dp[i][j] = dp[i-1][j];
        if(j>0) dp[i][j] = (dp[i][j] + dp[i][j-1])%mod;
        if(j>=a[i]+1) dp[i][j] = (dp[i][j] - dp[i-1][j-a[i]-1] + mod)%mod;
    }
    cout << dp[N][K] << endl;
}


Measured memory_bytes: 80256
#include <stdio.h>
#include <string.h>

#define M 1000000
#define L 14

long long getKey( char str[] );
int getChar( char );
int find( char c[] );
int insert( char c[] );
int h1( int );
int h2( int );

char H[M][L];

int main( void ){
	int i, n;
	char str[L], ord[10];
	
	for( i = 0; i < M; i++ ){
		H[i][0] = '\0';
	}
	
	scanf("%d", &n );
	
	for( i = 0; i < n; i++ ){
		scanf("%s %s", ord, str );
		
		if( ord[0] == 'i'){
			insert(str);
		}
		else{
			if( find(str) ){
				printf("yes\n");
			}
			else{
				printf("no\n");
			}
		}
	}
	
	return 0;
}

long long getKey( char str[] ){
	long long ret, p;
	int i;
	
	ret = 0;
	p = 1;
	for( i = 0; str[i] != '\0'; i++ ){
		ret += p * getChar(str[i]);
		p *= 5;
	}
	
	return ret;
}

int getChar( char c ){
	if( c == 'A' ){
		return 1;
	}
	else if( c == 'C' ){
		return 2;
	}
	else if( c == 'G' ){
		return 3;
	}
	else if( c == 'T' ){
		return 4;
	}
	else{
		return 0;
	}
}

int find( char c[] ){
	long long key, i, h;
	
	key = getKey(c);
	for( i = 0; ; i++ ){
		h = (h1(key) + i * h2(key)) % M;
		if(strlen(H[h]) == 0){
			return 0;
		} 
		else if(strcmp(H[h], c) == 0){
			return 1;
		}
	}
	
	return 0;
}

int insert( char c[] ){
	long long key, h, i;
	
	key = getKey(c);
	for(i = 0; ; i++) {
		h = (h1(key) + i * h2(key)) % M;
		if(strlen(H[h]) == 0){
			strcpy(H[h], c);
			return 0;
		} 
		else if(strcmp(H[h], c) == 0){
			return 1;
		}
	}
	
	return 0;
}

int h1( int key ){
	return key % M;
}

int h2( int key ){
	return ( key % (M-1))+1;
}


Measured memory_bytes: 15336
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1111111111;
constexpr lint LINF = 1LL << 60;

template <class T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
	for (const auto &e : vec) os << e << (&e == &vec.back() ? "" : " ");
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T &&h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head &&h, Tail &&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

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

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;

	struct data { lint x, y, h; };
	vector<data> d(N);
	for (int i = 0; i < N; i++) cin >> d[i].x >> d[i].y >> d[i].h;

	for (int x = 0; x <= 100; x++) {
		for (int y = 0; y <= 100; y++) {
			
			data md = *min_element(d.begin(), d.end(),
				[&](data l, data r) {
				return l.h + abs(l.x - x) + abs(l.y - y) < r.h + abs(r.x - x) + abs(r.y - y);
			});
			lint ref = md.h + abs(md.x - x) + abs(md.y - y);

			if (all_of(d.begin(), d.end(), 
				[&](data d) { return max(ref - abs(d.x - x) - abs(d.y - y), 0LL) == d.h; })) {

				cout << x << " " << y << " " << ref << "\n";
				return 0;
			}

		}
	}

	return -1;
}

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

using namespace std;

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

int n, p;
int arr[100];

int main() {
	int i, cnt[2] = {0,0};

	scanf("%d%d",&n,&p);
	for (i=0;i<n;i++) {
		scanf("%d",&arr[i]);
		if (arr[i]&1) cnt[1]++;
		else cnt[0]++;
	}
	if (p==0) {
		printf("%lld\n",1LL<<(n-(cnt[1]>0)));
	}
	else {
		if (cnt[1]) printf("%lld\n",1LL<<(n-1));
		else printf("0\n");
	}

    return 0;
}


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


#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int,int>
#define ll long long
#define el '\n'

using namespace std;

long double tot = 0;
int n;

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

    cin >> n;
    for (int i=1;i<=n;i++){
        long double temp;
        cin >> temp;
        tot += (long double)1 / temp;
    }

    cout << fixed << setprecision(10) << (long double)1 / tot << el;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define double long double
#define x first
#define y second
#define long long long
#define int long 



           //       |----|       /\      |    |   -----   |
           //       |   /       /  \     |    |     |     |
           //       |--/       /----\    |----|     |     |
           //       |   \     /      \   |    |     |     |
           //       |    \   /        \  |    |   -----   -------

int n;
int arr[300006];
int cache[300005];
int dp(int i)
{
	if(i==n-1)
		return 0;
	if(cache[i]!=-1)
		return cache[i];
	if(i==n-2)
		return cache[i]=abs(arr[i]-arr[i+1]);
	return cache[i]=min(abs(arr[i]-arr[i+1])+dp(i+1),abs(arr[i]-arr[i+2])+dp(i+2));
}
int32_t main()
{
    IOS
    cin>>n;
    for(int i=0;i<n;i++)
    	cin>>arr[i];
    memset(cache,-1,sizeof(cache));
    cout<<dp(0);
}

Measured memory_bytes: 5888
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int ans = 0;
		for (int i = A; i <= B; i++) {
			StringBuilder num = new StringBuilder();
			num.append(i);
			StringBuilder revNum = new StringBuilder();
			revNum.append(i).reverse();
			if (num.toString().equals(revNum.toString())) {
				ans++;
			}
		}
		System.out.println(ans);
		sc.close();
	}
}

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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9+7;

const i64 INF = 1e18+7;


signed main(){
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    vector<vector<int>> ch(n);
    for(int i = 0; i < n; ++i){
        cin >> a[i];
        if(i)
            ch[--a[i]].emplace_back(i);
    }
    i64 ans = (a[0] != 1);
    a[0] = -1;
    // dp[i]: i番目の頂点を根とする部分木の深さの最大値
    // 根でない場合は、これをk-1以内に抑える(0-indexed)
    queue<int> que;
    vector<int> c(n, 0);
    for(auto& x : a)
        if(x != -1)
            ++c[x];
    for(int i = 0; i < n; ++i)
        if(!c[i])
            que.emplace(i);

    vector<int> dp(n, 0);

    while(!que.empty()){
        int x = que.front();
        que.pop();
        if(!x)
            continue;
        if(--c[a[x]] == 0)
            que.emplace(a[x]);
        for(auto& e : ch[x]){
            if(dp[e] + 1 == k)
                ++ans;
            else
                dp[x] = max(dp[x], dp[e] + 1);
        }
    }
    cout << ans << endl;
}


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

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

using ll = long long;

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

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

int main() {
  int N;
  cin>>N;
  map<int,int> m;
  for(int i = 0; i < N; i++) {
    int x;
    cin>>x;
    m[x]++;
  }
  int cnt = 0;
  for(auto x:m){
    if(x.second%2==0) cnt++;
  }
  int a;
  if(cnt%2==0) a=0;
  if(cnt%2!=0) a=1;
  cout<<(int)m.size()-a<<endl;
}

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

#define INF (1<<30)

int main(){
	int n;	cin>>n;
	vector<int> x(n);	for(int i=0;i<n;i++)cin>>x[i];

	int ans=INF;
	for(int P=1; P<=100; P++){
		int tmp=0;
		for(int i=0;i<n;i++){
			tmp+=(x[i]-P)*(x[i]-P);
		}
		ans=min(ans,tmp);
	}
	cout<<ans<<endl;

	return 0;
}


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

int main() {
    int N;
    cin >> N;
    for (int n = 0; n != N; ++n) {
        double a, b, c, x1, y1, x2, y2, x3, y3, xp, yp, d, radius;
        while (cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3) {
            a = sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
            b = sqrt((x3 - x1)*(x3 - x1) + (y3 - y1)*(y3 - y1));
            c = sqrt((x3 - x2)*(x3 - x2) + (y3 - y2)*(y3 - y2));
            radius = (a*b*c) / (sqrt((a+b+c)*(b+c-a)*(c+a-b)*(a+b-c)));
            d = 2*(x1*(y2-y3) + x2*(y3-y1) + x3*(y1-y2));
            xp = ((x1*x1 + y1*y1)*(y2-y3) + (x2*x2 + y2*y2)*(y3-y1) + (x3*x3 + y3*y3)*(y1-y2))/d;
            yp = ((x1*x1 + y1*y1)*(x3-x2) + (x2*x2 + y2*y2)*(x1-x3) + (x3*x3 + y3*y3)*(x2-x1))/d;
            cout << fixed << setprecision(3) << xp << " " << yp << " " << radius << endl;
        }
    }
	return 0;
}

Measured memory_bytes: 1288
import java.util.Scanner;

public class Main{
    
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int d = a / b;
        int r = a % b;
        double f =(double) a / b;
        System.out.printf("%d %d %.5f\n",d,r,f);
    }
}


Measured memory_bytes: 26612
from __future__ import print_function

import sys
sys.setrecursionlimit(500000)

import re
import array
import copy
import functools
import operator

import math
import string
import fractions
from fractions import Fraction

import collections
import itertools
import bisect

import random
import time

import heapq
from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace
from queue import PriorityQueue as pq
from queue import Queue

from itertools import accumulate

from collections import deque
from collections import Counter

from operator import mul
from functools import reduce

input = sys.stdin.readline


def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# from fractions import gcd
# from math import gcd

# def lcm(n, m):
#     return int(n * m / gcd(n, m))


# def coprimize(p, q):
#     common = gcd(p, q)
#     return (p // common, q // common)


# def find_gcd(list_l):
#     x = reduce(gcd, list_l)
#     return x


def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom


mod=1000000007
def combinations_count_mod(n, r):
    r = min(r, n - r)
    numer = reduce(lambda x,y: x*y%mod, range(n, n - r, -1), 1)
    denom = pow( reduce(lambda x,y: x*y%mod, range(1, r + 1), 1) , mod-2, mod)
    return numer * denom % mod


def solve():
    pass

# def f_rec(g, h): # あとg個のグループに分けるとき，h番目に仕切りを入れると考えたとき
#     # i:[ 3*g , 2000 - 3*(g-1)]
#     for i in range():
        


def main():
    ans=0
    S = int(input().strip())
    if S<3:
        print(0)
        return
    group = S//3
    # amari = S%3

    ans+=1
    eprint(ans)
    for g in range(2,group+1): # gは何グループあるか
        配る数 = S - g*3
        temp=combinations_count(配る数+ g-1,g-1)
        eprint(temp)
        ans=temp+ans
    
    print(ans%mod)
    # # S//3個に分けるとき
    # if amari==0:
    #     ans+=1
    # elif amari == 1:
    #     ans += S//3
    # else:
    #     ans += combinations_count(S//3,2)

    # for i in range(S//3):   # iはS個の玉を何個のグループに分けるか
    #     ans += # 


if __name__ == '__main__':
    main()

Measured memory_bytes: 84176
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;
const int M = 1000000007;

vector<vector<int>> edge;
vector<vector<int>> tecomp;
vector<set<int>> nedge;
vector<int> uid, uuid;
vector<int> nw;



void visit(int v, int u,
        stack<int>& roots, stack<int>& S, vector<bool>& inS,
        vector<int>& num, int& tm) {
    num[v] = ++tm;
    S.push(v); inS[v] = true;
    roots.push(v);
    for (int w : edge[v]) {
        if (num[w] == 0)
            visit(w, v, roots, S, inS, num, tm);
        else if (u != w && inS[w])
            while (num[roots.top()] > num[w]) roots.pop();
    }
    if (v == roots.top()) {
        tecomp.push_back(vector<int>());
        while (1) {
            int w = S.top(); S.pop(); inS[w] = false;
            tecomp.back().push_back(w);
            if (v == w) break;
        }
        roots.pop();
    }
}


bool dfs(int now, int par, int zero) {
    bool ret = tecomp[now].size() > 1;
    for (int i : nedge[now]) {
        if (i == par) continue;
        ret |= dfs(i, now, zero);
    }
    if (ret) {
        uuid[now] = zero;
    }
    return ret;
}
int dfs(int now, int par) {
    int ret = 0;
    for (int i : nedge[now]) {
        if (i == par) continue;
        ret = max(ret, dfs(i, now));
    }
    return ret + nw[now];
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> w(n);
    for (int i = 0; i < n; ++i) {
        cin >> w[i];
    }
    edge.resize(n);
    for (int i = 0; i < m; ++i) {
        int a, b;
        cin >> a >> b;
        --a;
        --b;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    vector<int> num(n, 0);
    vector<bool> inS(n);
    stack<int> roots, S;
    int tm = 0;
    for (int u = 0; u < n; ++u)
        if (num[u] == 0)
            visit(u, n, roots, S, inS, num, tm);

    int nn = tecomp.size();
    uid.resize(n);
    for (int i = 0; i < nn; ++i) {
        for (int j : tecomp[i])
            uid[j] = i;
    }
    int zero = uid[0];
    nedge.resize(nn);
    for (int i = 0; i < n; ++i) {
        for (int j : edge[i]) {
            if (uid[i] != uid[j])
                nedge[uid[i]].insert(uid[j]);
        }
    }
    uuid.resize(n);
    for (int i = 0; i < n; ++i) {
        uuid[i] = i;
    }
    dfs(zero, -1, zero);
    nw.resize(nn, 0);
    for (int i = 0; i < n; ++i) {
        nw[uuid[uid[i]]] += w[i];
    }
    vector<int> useduid(nn, 0);
    vector<int> used(nn, 0);
    int ma = 0;
    for (int i = 0; i < n; ++i) {
        if (!useduid[uid[i]] && uuid[uid[i]] == zero) {
            useduid[uid[i]] = 1;
            for (int j : nedge[uid[i]]) {
                if (uuid[j] != zero && !used[j]) {
                    used[j] = 1;
                    ma = max(ma, dfs(j, uid[i]));
                }
            }
        }
    }
    cout << (nw[zero] + ma) << "\n";
    return 0;
}

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

using namespace std;

#define rep(i,x) for (int i = 0 ; i < x; ++i)
#define rrep(i,x) for (int i = x - 1; i >= 0; --i)
#define sz(x) int(x.size())
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define sqr(x) ((x) * (x))
#define re return

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;


void GO(){
#ifdef DOD
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

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






//Var
//
 void input() {
     int a; cin >> a;
     cout << a + a * a + a * a * a;
 }

void solve(){
     
}








///Я призер Всеросса
int main() {
    GO();
    int Q = 1;
    while(Q--){ input(); solve(); } re 0;
}
///Я Кондедат в мастера


Measured memory_bytes: 3696
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
//constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;
constexpr int MOD = 1'000'000'007;

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

void solve() {
    int n;
    cin >> n;
    if (n == 7 || n == 5 || n == 3) cout << "YES" << endl;
    else cout << "NO" << endl;
}

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

Measured memory_bytes: 256
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <numeric>
#include <vector>

int main() {
	int x = 0;
	int n = 0;
	std::cin >> x >> n;
	std::vector<decltype(x)> vect(n);
	bool vect_contains_x = false;
	for (auto& elem : vect) {
		std::cin >> elem;
		if (elem == x) {
			vect_contains_x = true;
		}
	}
	int num = 0;
	if (!vect_contains_x) {
		num = x;
	}
	else {
		std::sort(vect.begin(), vect.end());
		while (1) {
			static int i = 1;
			if (std::binary_search(vect.begin(), vect.end(), x - i) == false) {
				num = x - i;
				break;
			}
			else if (std::binary_search(vect.begin(), vect.end(), x + i) == false) {
				num = x + i;
				break;
			}
			else {
				i += 1;
			}
		}
	}
	std::cout << num << "\n";
	return 0;
}

Measured memory_bytes: 3624
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

dp = [float("inf") for i in range(n)]
dp[0] = 0
for i in range(n-1):
    for j in range(1, min(k+1, n-i)):
        dp[i+j] = min(dp[i+j], dp[i]+abs(a[i+j]-a[i]))

print(dp[-1])

Measured memory_bytes: 56928
num = int(input())

list = []
dic = {}
for i in range(num):
    k = input()
    dic[k] = dic.get(k,0) +1
for i in ["AC","WA","TLE","RE"]:
    if i in dic.keys():
        print(i,"x",dic[i])
    else:
        print(i,"x",0)


Measured memory_bytes: 9128
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<iomanip>
#include<list>
#include<deque>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define DEB2(X) cout<<X<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define DEB2(X) {}
#define END {}
#endif
typedef long long ll;
#define int ll
#define uset unordered_set
#define umap unordered_map
//typedef std::pair<int,int> P;
struct edge{int to,cost;};
const int INF=100000000000000000;
const int INF2=9223372036854775807;
const int MOD=1000000007;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define min(X,Y) (((int)(X)<(int)(Y))?(X):(Y))
#define max(X,Y) (((int)(X)>(int)(Y))?(X):(Y))
#define NP(X,Y) next_permutation(X,Y)
#define setdouble(X,Y) cout<<fixed<<setprecision(X)<<Y
int ceil2(int a,int b){if(a%b==0){return a/b;}else{return a/b+1;}}
int pow2(int a,int b){int r=1;for(int i=1;i<=b;i++){r*=a;}return r;}
int Log2(int a){int t=0;while(1){if(a==0||a==1){break;}a/=2;t++;}return t;}

int A,B,C;

signed main(){
	cin>>A>>B>>C;
	if(C-A-B<=0){
		cout<<"No"<<endl;
	}
	else if(4*A*B<pow2(C-A-B,2)){
		cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: usize,
        a: [usize; n],
        b: [usize; n],
        c: [usize; n - 1],
    }
    let mut result = b[a[0] - 1];
    for i in 1..n {
        result += b[a[i] - 1];
        if a[i - 1] + 1 == a[i] {
            result += c[a[i - 1] - 1];
        }
    }
    println!("{}", result);
}


Measured memory_bytes: 4352
def solve():
    N, M = [int(i) for i in input().split()]
    D = [[int(i) for i in input().split()] for _ in range(N)]
    D.sort(key=lambda x: x[0])
    ans = 0
    for d in D:
        a, b = d
        ans += a * min(M, b)
        M -= min(M, b)
        if M == 0:
            print(ans)
            exit()

if __name__ == "__main__":
    solve()

Measured memory_bytes: 93424
#include<bits/stdc++.h>
using namespace std;
#define LL long long int

int main() {
    
	string s;
	cin>>s;
	if(s[0]==s[1]&&s[1]==s[2]){
	    cout<<"No"<<endl;
	}
	else{
	    cout<<"Yes"<<endl;
	}
	
	return 0;
}

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

int main() {
    int r, c;
    cin >> r >> c;
    
    int out_array[r + 1][c + 1];
    
    for (int i = 0; i < r + 1; i++) {
        for (int j = 0; j < c + 1; j++) {
            out_array[i][j] = 0;
        }
    }
    
    int l;
    int y = 0;
    int z = 0;
    while (cin >> l) {
        out_array[y][z] = l;
        out_array[r][z] += l;
        out_array[y][c] += l;
        if (z == c - 1) {
            y++;
            z = 0;
        } else {
            z++;
        }
    }
    
    for (int i = 0; i < c; i++) {
        out_array[r][c] += out_array[r][i];
    }
    
    for (int i = 0; i < r + 1; i++) {
        for (int j = 0; j < c + 1; j++) {
            if (j != c) {
                cout << out_array[i][j] << " ";
            } else {
                cout << out_array[i][j];
            }
        }
        cout << endl;
    }
}


Measured memory_bytes: 3104