akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

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

string S;
bool l=0,r=0;

int main(){
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    cin>>S;
    int A[4];
    rep(i,S.length()){
        A[i] = S[i] - '0';
    }
    if(A[0]==0&&A[1]==0)l=1;
    else if(A[0]==1&&A[1]>=3)l=1;
    else if(A[0]>1)l=1;
    else l=0;
    if(A[2]==0&&A[3]==0)r=1;
    else if(A[2]==1&&A[2]>=3)r=1;
    else if(A[2]>1)r=1;
    else r=0;

    // out(l);
    // out(r);
    if(l&&r)out("NA");
    else if(l&&!r)out("YYMM");
    else if(!l&&r)out("MMYY");
    else out("AMBIGUOUS");
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();
        int sum = 0;

        for (int i = 1; i <= n; i++) {
            int d = i;
            int x = 0;
            while (d > 0) {
                x += d % 10;
                d /= 10;
            }

            if (x >= a && x <= b) {
                sum += i;
            }
        }
        // 出力
        System.out.println(sum);
    }
}


Measured memory_bytes: 23892
#include <iostream>
using namespace std;
int main(void){
    int a;
    int b;
    int c;
 std::cin >>a; cin >>b;cin >>c;
 
 if(a<b&&b<c){
     cout << "Yes" << endl;
 }else{
     cout << "No" << endl;
 }

}

Measured memory_bytes: 3092
N = int(input())

for n in range(1, 3501):
    for w in range(n, 3501):
        t = 4 * n * w - N * w - N * n
        if t > 0:
            h = N * n * w / t
            if h.is_integer() and h > 0:
                print(int(h), n, w)
                exit()


Measured memory_bytes: 3064
import java.util.Scanner

fun main(args: Array<String>){
    val sc = Scanner(System.`in`)
    val x:Int = sc.nextInt()
    val a:Int = sc.nextInt()
    val b:Int = sc.nextInt()

    val ans:String = if(a-b>=0) "delicious"
                     else if(x+a-b>=0) "safe"
                     else "dangerous"

    println(ans)
}


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

int main(){
  int64_t N, ans;
  cin >> N;
  for (int64_t i = 1; i * i <= N; i++) if (N % i == 0) ans = i;
  double a = log10(N/ans);
  int b = a + 1;
  cout << b << endl;
  
}

Measured memory_bytes: 512
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

	string s;
	cin >> s;

	int cnt = 0;
	int max = 0;
	REP(i,s.size()){
		if(s.substr(i,1) == "A" || s.substr(i,1) == "C" || s.substr(i,1) == "G" || s.substr(i,1) == "T"){
			cnt ++;
		}
		else{
			if(max < cnt){
				max = cnt;
			}
			cnt = 0;
		}
	}

	if(max < cnt){
		max = cnt;
	}
  
  cout << max << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A, B; cin>>A>>B;
  if (A >= 10 || B >= 10) {
    cout << -1 << endl;
    return 0;
  } else {
    cout << A*B << endl;
 	return 0;
  }
}

Measured memory_bytes: 256
a=[i**5 for i in range(100001)]
b=[i**5 for i in range(50001)]
x=int(input())
k=0
for i in a:
  for j in b:
    if i - j == x:
      k = 1
      print(a.index(i),b.index(j))
      break
    if i + j ==x:
      k=1
      print(a.index(i),-b.index(j))
  if k==1:
    break

Measured memory_bytes: 17308
#include <vector>
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;

int main(){
    vector<ll> T,A;
    int N;
    cin >> N;

    ll ans=1;
    for(int i=0;i<N;i++){
        ll in;
        cin >> in;
        T.push_back(in);
    }
    for(int i=0;i<N;i++){
        ll in;
        cin >> in;
        A.push_back(in);
    }
    
    if(N==1){
        if(A.at(0)==T.at(0)){
            cout << "1" << endl;
        }else{
            cout << "0" << endl;
        }
        return 0;
    }

    if((A.at(0)!=A.at(1)&&A.at(0)!=T.at(0))||T.at(0)>A.at(0)){
        cout << "0" << endl;
        return 0;
    }

    for(int i=1;i<N-1;i++){
        if(T.at(i-1)!=T.at(i)&&A.at(i)!=A.at(i+1)){
            if(T.at(i)!=A.at(i)){
                cout << "0" << endl;
                return 0;
            }
        }else if(T.at(i-1)==T.at(i)&&A.at(i)!=A.at(i+1)){
            if(T.at(i)<A.at(i)){
                cout << "0" <<endl;
                return 0;
            }
        }else if(T.at(i-1)!=T.at(i)&&A.at(i)==A.at(i+1)){
            if(T.at(i)>A.at(i)){
                cout <<"0" <<endl;
                return 0;
            }
        }else{
            if(T.at(i)<A.at(i)){
                ans*=T.at(i);
                ans%=1000000007;
            }else{
                ans*=A.at(i);
                ans%=1000000007;
            }
        }
    }

    if((T.at(N-2)!=T.at(N-1)&&T.at(N-1)!=A.at(N-1))||T.at(N-1)<A.at(N-1)){
        cout <<"0" << endl;
        return 0;
    }
    
    cout << ans << endl;

}

Measured memory_bytes: 2548
"use strict";
    
const main = arg => {
    arg = arg.split("\n");
    const r = parseInt(arg[0].split(" ")[0]);
    const D = parseInt(arg[0].split(" ")[1]);
    let X = parseInt(arg[0].split(" ")[2]);
    
    for(let i=0; i<10; i++) {
        let temp = (r * X) - D;
        console.log(temp);
        
        X = temp;
    }
    
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7628
#include <iostream>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
if(a==b){cout<<"a == b"<<"\n";}
else if(a>b){cout<<"a > b"<<"\n";}
else if(a<b){cout<<"a < b"<<"\n";}
return 0;
}

Measured memory_bytes: 1124
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
#define Nmax 200010
#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define RFOR(i,a,b) for(long long i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<P> Graph;

int main() {
	int N;
	cin >> N;
	ll ans=1;
	FOR(i,1,N+1){
		ans = (ans*i)%MOD;
	}
	cout << fixed << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <cctype>

using namespace std;

inline int gi()
{
    int f = 1, x = 0;
    char c = getchar();
    while (c < '0' || c > '9')
    {
        if (c == '-') f = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9')
    {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return f * x;
}

int a, p;

int main()
{
	a = gi(), p = gi();
	int ans = a * 3 + p;
	printf("%d\n", ans >> 1);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9 + 7;
#define N 100

int n, m;
char a[N], b[N];

int main() {
	scanf("%d%s%s", &m, a + 1, b + 1);
	for(int i = 1; i <= m; ++i) {
		if(a[i] != a[i + 1]) {
			a[++n] = a[i];
			b[n] = b[i];
		}
	}
	ll ans = a[1] == b[1] ? 3 : 6;
	for(int i = 2; i <= n; ++i) {
		if(a[i] == b[i]) {
			if(a[i - 1] == b[i - 1]) {
				ans = ans * 2ll % mod;
			}
		} else {
			if(a[i - 1] == b[i - 1]) {
				ans = ans * 2ll % mod;
			} else {
				ans = ans * 3ll % mod;
			}
		}
	}
	printf("%lld\n", ans % mod);
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

class Main {
	public static void main(String... args) {
		int L = IN.nextInt();
		
		List<Integer> nums = new ArrayList<>();
		int i = 18;
		int a = L;
		while (a > 0) {
			int b = (int) Math.pow(2, i);
			if (b <= a) {
				nums.add(i + 1);
				a -= b;
			} else {
				i -= 1;
			}
		}
		
		int N = nums.get(0) + 1;
		
		List<int[]> G = new ArrayList<>();
		for (int n = 1; n <= N - 2; n++) {
			G.add(new int[] {n, n + 1, 0});
			G.add(new int[] {n, n + 1, (int) Math.pow(2, n - 1)});
		}
		
		int base = 0;
		Collections.reverse(nums);
		for (int j: nums) {
			G.add(new int[] {j, N, base});
			base += (int) Math.pow(2, j -1);
		}

		puts(N + " " + G.size());
		for (int[] x: G) {
			puts(x[0] + " " + x[1] + " " + x[2]);
		}
		flush();
	}

	static final Scanner IN = new Scanner(System.in);
	static final PrintWriter OUT = new PrintWriter(System.out);
	static <T> void puts(T arg) { OUT.println(arg); }
	static void flush() { OUT.flush(); }
}


Measured memory_bytes: 22996
#include<iostream>
using namespace std;
#define ll long long

ll ctd(ll u ,ll v){
    if(u%v==0){
        return v;
    }
    return ctd(v,u%v);
}

int main(){
    int N;
    cin >> N;
    ll T[101];
    ll ans=1;
    for(int i=0;i<N;i++){
        cin >> T[i];
    }
    for(int n=0;n<N;n++){
        ans=ans/ctd(ans,T[n])*T[n];
    }
    cout << ans << "\n";
    return 0;
}

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

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

long long a[100010][3];
long long dp[100010][3];

int main() {
    int n;
    cin >> n;
    for(int i = 0; i < n;++i) {
        for(int j = 0;j < 3;++j) {
            cin >>a[i][j];
        }
    }

    for(int i = 0; i < n;++i) {
        for(int k = 0;k<3;k++) {
            for(int j = 0;j < 3;j++) {
                if(j != k) chmax(dp[i+1][k],dp[i][j]+a[i][k]);
            }
        }
    }
    long long ans = 0;
    for(int i = 0;i<n;i++) {
        chmax(ans,dp[n][i]);
    }
    cout << ans << endl;
}

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

int main()
{
    int N, M, T;
    cin >> N >> M;
    vector<int> A(N, -1);
    A[0] = 1, A[1] = 2;
    while(M--)
    {
        cin >> T;
        A[T-1] = 0;
    }
    if(A[0] == 0 && A[1] != 0) A[1] = 1;
    for(int i = 2; i < N; i++)
    {
        if(A[i] != 0)
            A[i] = (A[i-1] + A[i-2]) % 1000000007;
    }
    cout << A[N-1] << endl;
}   

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

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

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int a,b,h; cin>>a>>b>>h;
	cout << (a+b) * (h/2) << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
namespace mp = boost::multiprecision;
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = 1; i <= n; i++)
#define drep(i, n) for(int i = n-1; i >= 0; i--)
#define srep(i, s, t) for (int i = s; i < t; i++)
#define vi vector<int>
#define P pair<ll, ll>
int mod = 1'000'000'000 + 7;
struct edge {
    int to;
    ll cost;
};

void COME_LET_THE_GAMES_BEGIN() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(20);
}

vector<int> a(100010, 1), b(100010, 0);
int Q;

int main() {
    COME_LET_THE_GAMES_BEGIN();
    a[0] = a[1] = 0;
    for (int i = 2; i <= 100000; i++) {
        if (a[i]) {
            for (int j = i + i; j <= 100000; j += i) {
                a[j] = 0;
            }
        }
    }
    for (int i = 1; i <= 100000; i++) {
        if ((i & 1) && a[i] && a[(i + 1) / 2]) {
            b[i]++;
        }
        b[i] += b[i - 1];
    }
    cin >> Q;
    rep(i, Q) {
        int l, r;
        cin >> l >> r;
        cout << b[r] - b[l - 1] << endl;
    }
}

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

#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define ALL(x) (x).begin(), (x).end()

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll INF = 1e15;
const ll MOD = 1e9 + 7;

int main() {
  string s;
  cin >> s;
  ll n = s.size();

  ll ans = 0;
  REP(i, (n + 1) / 2) {
    if (s[i] != s[n - 1 - i]) ++ans;
  }

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

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

using namespace std;

int32_t main() {

    ios_base::sync_with_stdio(false);

    cin.tie(0);

    long long a;

    cin >> a;

    long long b;

    cin >> b;

    if(a==b) {

        cout << "Yes" <<'\n';

    } else {

        cout << "No" <<'\n';

    }

    return 0;

}



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

using namespace std;
typedef long long ll;
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fr first
#define sc second
#define close(x){cout<<x<<endl;return 0;}
#define pb push_back
#define mp make_pair
#define forr(i,a,b) for(ll i=a;i<b;i++)
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);char n[101];ll k;
cin>>n>>k;if(strlen(n)==1)close(n[0]);
forr(i,0,strlen(n))
{if(n[i]=='1')k--;
else close(n[i])
if(!k)close(n[i]);}
return 0;}


Measured memory_bytes: 256
//Arayi
//#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <vector>
#include <cstring>
#include <ctime>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <ctime>
#include <climits>
#include <cassert>
#include <chrono>
#include <random>
#include <complex>

#define fr first
#define sc second
#define MP make_pair
#define ad push_back
#define PB push_back
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);
#define lli long long int
#define y1 arayikhalatyan
#define j1 jigglypuff
#define ld long double
#define itn int
#define pir pair<int, int> 
#define all(x) (x).begin(), (x).end()
#define str string
#define enl endl
#define en endl
#define cd complex<long double>
#define vcd vector<cd>
#define vii vector<int>
#define vlli vector<lli>
using namespace std;

lli gcd(lli a, lli b) { return (b == 0LL ? a : gcd(b, a % b)); }
ld dist(ld x, ld y1, ld x2, ld y2)
{
    return sqrt((x - x2) * (x - x2) + (y1 - y2) * (y1 - y2));
}
lli S(lli a)
{
    return (a * (a + 1LL)) / 2;
}
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
char vow[] = { 'a', 'e', 'i', 'o', 'u' };
int dx[] = { 1, -1, 0, 0, -1, -1, 1, 1, 0 };
int dy[] = { 0, 0, 1, -1, -1, 1, -1, 1, 0 };


const int N = 1e5 + 230;
const lli mod = 998244353;
const ld pi = acos(-1);
const int T = 238;
const ld e = 1e-13;

lli bp(lli a, lli b = mod - 2LL)
{
    lli ret = 1;
    while (b)
    {
        if (b & 1) ret *= a, ret %= mod;
        a *= a;
        a %= mod;
        b >>= 1;
    }
    return ret;
}
ostream& operator<<(ostream& c, pir a)
{
    c << a.fr << " " << a.sc;
    return c;
}
struct pt
{
    lli x, y;
    int ind;
    int bl;
    bool operator==(const pt& a)
    {
        return ind == a.ind;
    }
    bool operator<(const pt& b)
    {
        if (x == b.x) return y < b.y;
        return x < b.x;
    }
};


int n;
int a[N], pat;
int main()
{
    fastio;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    sort(a, a + n);
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            if (a[i] == a[j]) continue;
            for (int k = j + 1; k < n; k++)
            {
                if (a[i] == a[k]) continue;
                if (a[k] == a[j]) continue;
                if (a[k] < a[i] + a[j]) pat++;
            }
        }
    }
    cout << pat << endl;
    return 0;
}

/*

  __
*(><)*
  \/ /
  ||/
--||
  ||
  /\
 /  \
/    \
*/

Measured memory_bytes: 3704
(defun main ()
  (let ((N (read))
        (Time (read))
        (lst (list nil)))
    (dotimes (x N)
      (let ((a (read))
            (b (read)))
        (when (<= b Time)
          (push a lst))))
    (setq lst (sort (cdr (reverse lst)) #'<))
    (let ((ans (nth 0 lst)))
      (if (null ans)
          (princ "TLE")
          (princ ans)))))

(main)

Measured memory_bytes: 12132
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
	int a =  sc.nextInt();
	int b =  sc.nextInt();
    int x = -1;
    boolean flag = true;
	for(int i=0;i<10000;i++) {
		if(a==(8*i)/100&&b==(10*i)/100) {
			x = i;
			break;
		}
	}
    System.out.println(x) ;
  }
}

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

int main()
{
	int N, K, l;
	vector<int> v;

	cin >> N >> K;

	for(int i = 1; i <= N; i++)
    {
        cin >> l;
        v.push_back(l);
    }

    sort(v.begin(), v.end(), greater<int>());

    int maxLength = 0;
    int len = v.size();
    for(int i = 0; i < K; i++)
        maxLength = maxLength + v[i];

    cout << maxLength << endl;

	return 0;
}


Measured memory_bytes: 256
use std::io;

fn main() {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("failed to read");
    // let n: i32 = s.trim().parse().unwrap();
    s = String::new();
    io::stdin().read_line(&mut s).expect("failed to read");
    let v: Vec<&str> = s.trim().split(" ").collect();
    let t: f32 = v[0].parse().unwrap();
    let a: f32 = v[1].parse().unwrap();
    let mut ss = String::new();
    io::stdin().read_line(&mut ss).expect("failed to read");
    let h: Vec<&str> = ss.trim().split(" ").collect();

    let mut temp: Vec<f32> = Vec::new();
    for i in h {
        let tmp: f32 = i.parse().unwrap();
        temp.push(t - tmp * 0.006);
    }

    let mut near: f32 = 10001.0;
    let mut ans = 0;
    for (i, v) in temp.into_iter().enumerate() {
        let sub = a - v;
        if near.abs() > sub.abs() {
            near = sub;
            ans = i + 1;
        }
    }

    println!("{}", ans);

}


Measured memory_bytes: 4352
# s = gets.chomp.codepoints
s = gets.chomp.split(//).map{|x| x.ord}
k = gets.to_i
a = "a".ord
z = "z".ord
s.size.times{|i|
  break if k.zero?
  if s[i] != a
    t = (z - s[i]).succ
    if t <= k
      k -= t 
      s[i] = 97
    end
  end
}
k = k % 26
s[-1] = s[-1] + k

puts s.map(&:chr).join



Measured memory_bytes: 12924
#include <iostream>
#include <stdio.h>
#include <string>

using namespace std;

int main() {
	int n,i,j,s;
	string c1,c2,c3;
	cin >> n;
	for (i=0;i<n;i++) {
		cin >> c1;
		c2=c3=c1;
		s=c1.size();
		if (s<6 || s % 2==1) { cout << "NA" << endl; continue; }
		for (j=0;j<s;j++) c2[j]=c3[j]='=';
        c2[0]=c3[0]='>'; c2[s-1]=c3[s-1]=c3[s-2]='~';
		c2[1]='\''; c2[s/2]='#'; c3[1]='^';
        for (j=2;j<s-2;j+=2) c3[j]='Q';
		if (c1==c2) cout << 'A'; else if (c1==c3) cout << 'B'; else cout << "NA";
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int64_t n,d;
  cin >> n >> d;
  int count = 0;
  int64_t a,b;
  vector<pair<int,int>>  v;
  for(int i = 0; i<n; i++){
    cin >> a >> b;
    if(d*d >= a*a + b*b) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
//typedef pair<long long,long long> P;
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n;
  cin>>n;
  vector<int> a;
  int amax = 55555;
  int cnt=0;
  REPP(i,amax){
    if(cnt==n)break;
    if(prime(i) && i%5==1){
      a.push_back(i);
      cnt++;
    }
  }
  
  REP(i,n){
    cout<<a[i]<<' ';
  }
  return 0; 
}


Measured memory_bytes: 256
import copy

import math
import fractions

def j(n):
    if n:print("Yes")
    else:print("No")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printrow(a):
    for i in a:
        print(i)

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

a,b = ips()

for i in range(1001):
    if int(i*0.08) == a and int(i*0.1) == b:
        print(i)
        exit(0)
print(-1)

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

int main(){
    int x;
    cin >>x;
    vector<int> prime;
    for(int i = 2; i<=1000000; i++){
        bool flag = true;
        for (int j = 2; j < prime.size(); j++){
            if (i%prime[j] == 0){
                flag = false;
                break;
            }
        }
        if (flag) {
            prime.push_back(i);
            if(i >= x){
                cout << i << endl;
                break;
            }
        }
    }
    return 0;
}

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

#define SZ(a) ((int)a.size())
#define ALL(a) a.begin(), a.end()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define fst first
#define snd second

void dout() { cerr << endl; }

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    vector<int> b(n);
    for (int i = n - 1; i > 0; i--)
    {
        if (a[i - 1] > a[i])
        {
            b[i - 1] += a[i - 1] - a[i];
            a[i - 1] -= b[i - 1];
        }
    }
    for (auto x : b)
    {
        if (x > 1)
        {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int ara[10000];
int main()
{
    int n;
    int i,j,k;
   int c=0;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>ara[i];
    }
    sort(ara,ara+n);
    for(i=0;i<n;i++)
    {

        for(j=i+1;j<n;j++)
        {
            for(k=j+1;k<n;k++)
            {
                if(ara[i]+ara[j]>ara[k])
                    c++;
            }
        }
    }
    cout<<c<<endl;
    return 0;
}


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

int main(){
  int N, M;
  cin >> N >> M;
  
  int x[M];
  for(int i=0;i<M;i++){
    cin >> x[i];
  }
  sort(x, x+M);
  
  int y[M-1];
  for(int i=0;i<M-1;i++){
    y[i]=x[i+1]-x[i];
  }
  sort(y, y+M-1);
  
  int ans=0;
  if(M<=N){cout << ans << endl;}
  else{
    for(int i=0;i<M-N;i++){
      ans += y[i];
    }
    cout << ans << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
using namespace std;
int main(){
    int n,i,j,s=0,f=0,t=0,a[200000];
    cin >> n;
    for (i=0;i<n;i++){
        cin >> a[i];
        if (s<a[i])
            s=a[i];
    }
    for (i=0;i<n;i++){
        if (s==a[i])
            f++;
    }
    if (f==1){
        for (i=0;i<n;i++){
            if (a[i]!=s&&a[i]>t)
                t=a[i];
        }
    }
    for (i=0;i<n;i++){
        if (a[i]<s)
            cout << s << endl;
        else{
            if (f==1)
                cout << t << endl;
            else
                cout << s << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 2432
#include <iostream>
#include <set>
#include <algorithm>

using namespace std;

#define forsn(i,s,n) for(int i=(s); i<(int)(n); i++)
#define forn(i,n) forsn(i,0,n)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define F first
#define S second

typedef long long int tint;
typedef pair<tint, tint> pti;

pti seq[50];

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

	int n; cin >> n;
	forn(i,n) cin >> seq[i].S;
	forn(i,n) seq[i] = {seq[i].S / n, seq[i].S % n};
	
	tint totalOperations = 0;
	while (max_element(seq, seq + n)->F) {
		tint sum = 0;
		forn(i,n) sum += seq[i].F;
		totalOperations += sum;
		forn(i,n) seq[i] = {(seq[i].S + (sum - seq[i].F)) / n, (seq[i].S + (sum - seq[i].F)) % n};
	}
	cout << totalOperations << "\n";
	
}


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

struct Bit
{
    int data[100005];

    Bit ()
    {
        fill(begin(data), end(data), 0);
    }

    void add ( int k, int x )
    {
        for ( k++; k < 100005; k += (k & -k) ) {
            data[k] += x;
        }
    }

    int sum ( int k )
    {
        int sum = 0;
        for ( k++; k > 0; k -= (k & -k) ) {
            sum += data[k];
        }
        return ( sum );
    }
};

int main()
{
    int N, M;
    int cnt = 0;
    Bit tree;
    pair < int , int > data[100005];

    cin >> N >> M;
    for ( int i = 0; i < M; i++ ) {
        cin >> data[i].second >> data[i].first;
    }
    sort(data, data + M);

    for ( int i = 0; i < M; i++ ) {
        if ( tree.sum(data[i].first) - tree.sum(data[i].second - 1) == 0 ) {
            tree.add(data[i].first - 1, 1);
            cnt++;
        }
    }
    cout << cnt << endl;
    return ( 0 );
}


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

int main(){
  int N,K,b=0;
  cin >> N >> K;
  vector<int> a(N);
  for(int i=0;i<N;i++){
    cin >> a[i];
    if(a[i]>=K){
      b++;
    }
  }
  cout << b << endl;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void)
{
  int n, a;
  double t;
  scanf("%d", &n);
  scanf("%lf %d", &t, &a);

  double h[n];

  int i, j, k;

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

  double ans[n];

  for(j=0;j<n;j++){
    ans[j] = t - (h[j] * 0.006);
  }
int win = 1;


  for(k=1;k<n;k++){
    double c, d;
    c = a - ans[k];
    d = a - ans[0];

    if(c<0)
      c = -c;
    if(d<0)
      d = -d;


    if(c<d){
      win = k + 1;
      ans[0] = ans[k];
    }
  }

  printf("%d", win);

  return 0;
}


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

void swap(int *x, int *y) {
	int fake;

	fake = *x;
	*x = *y;
	*y = fake;
}

void sort3num(int *a, int *b, int *c) {
	if (*a > *b) {
		swap(a, b);
	}
	if (*b > *c) {
		swap(b, c);
	}
	if (*a > *b) {
		swap(a, b);
	}
}

int main()
{
	int a, b, c;
	cin >> a >> b >> c;

	sort3num(&a, &b, &c);

	cout << a << " " << b << " " << c << "\n";
    return 0;
}




Measured memory_bytes: 3092
#define x(a)for(i=0;i<n;i++)scanf("%d",a+i);qsort(a,n,4,"\x8b\6+\7\xc3")
a[40000],b[40000];main(n,i){for(;scanf("%d",&n),n;){x(a);x(b);for(i=0;i<n/2;i++)if(a[i*2]>b[i]){printf("%d\n",i*2+1);break;}if(i==n/2)puts("NA");}exit(0);}

Measured memory_bytes: 1112
N = int(input())
MOD = 10**9 + 7
a1, a2, a3 = 1, 1, 1

for _ in range(N):
    a1 *= 10
    a1 %= MOD

for _ in range(N):
    a2 *= 9
    a2 %= MOD
a2 *= 2
a2 %= MOD

for _ in range(N):
    a3 *= 8
    a3 %= MOD

ans = a1 - a2 + a3
ans %= MOD
print(ans)


Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int A,B,X;
  cin >> A >> B;
  X = (A+B)/2;
  
  if(X*2 == A+B){
    cout << X << endl;
  }
  else{
    cout << "IMPOSSIBLE" << endl;
  }
}

Measured memory_bytes: 256
def main():
  n=int(input())
  num=[int(i) for i in input().split()] 
  from fractions import gcd
  
  def gcd2(num,n):
    if n==1:
      return num[0]
    else:
      return gcd2([gcd(num[i],num[-i-1]) for i in range((n+1)//2)],(n+1)//2)
    
  print(gcd2(num,n))

if __name__=='__main__':
  main()

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

const int MOD = 1e9 + 7;
const int MAX_N = 2e6 + 10;

long long fac[MAX_N], finv[MAX_N], inv[MAX_N];

void COMBinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX_N; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COMB(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;
}

long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}


int main() {
    COMBinit();
    int K; cin >> K;
    string S; cin >> S;
    int N = S.length();


    ll ans = 0;
    for (int i = N; i <= N+K; i++) {
        ans += COMB(N+K, i) * modpow(25,N+K-i);
        ans %= MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 52184
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> Q;

int n, ans, l, r, p;
string s[10010];

int main()
{
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> s[i];
		for (int j = 0; j < s[i].length() - 1; j++)
		{
			if (s[i][j] == 'A' && s[i][j + 1] == 'B')
			{
				ans++;
			}
		}
		if (s[i][0] == 'B' && s[i][s[i].length() - 1] == 'A')
		{
			p++;
		}
		else if (s[i][0] == 'B')
		{
			l++;
		}
		else if (s[i][s[i].length() - 1] == 'A')
		{
			r++;
		}
	}
	ans += max(p - 1, 0);
	if (p == 0)
	{
		ans += min(r, l);
	}
	else
	{
		if (r > 0)
		{
			r--;
			ans++;
		}
		if (l > 0)
		{
			l--;
			ans++;
		}
		ans += max(min(r, l), 0);
	}
	cout << ans << endl;
	cin >> n;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X,Y;
    cin >> X >> Y;
    for(int a=0;a<=X;a++){
        if(2*a+(X-a)*4==Y){
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
}

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

int main()
{
  int a, b;
  int res=0;
  cin >> a >> b;

  int east=0;
  for(int i=1; i<=(b-a); i++){
    east+=i;
  }
  int west = east-(b-a);
  res = west -a;

  cout << res << endl;
}


Measured memory_bytes: 256
#include <iostream> // cin, cout, cerr, clog
#include <algorithm> // minmax, sort, swap
#include <numeric> // iota, gcd, lcm 
#include <cstdio> // printf, scanf
#include <climits> // INT_MIN, LLONG_MIN
#include <cmath> // long, trig, pow
#include <string> // string
#include <vector> // vector
#include <queue> // queue
#include <stack> // stack
#include <map> // key-value pairs sorted by keys
#include <set> // set
#include <unordered_map> // hashed by keys
#include <unordered_set> // hashed by keys
#include <iomanip> // cout<<setprecision(n)

#define rep(i,n) for(int i = 0; i < n; i++)
#define ENDL "\n"
#define print(i) std::cout << (i) << "\n"

#define int long long // at least int64 > 9*10^18
#define all(v) v.begin(), v.end()
#define INF 10101010101010

signed main() {
  int a,b,q;
  std::cin >> a >> b >> q;
  std::vector<int> shrines(a);
  std::vector<int> temples(b);
  rep(i,a) std::cin >> shrines[i];
  rep(i,b) std::cin >> temples[i];
  rep(i,q) {
    int x;
    std::cin >> x;
    int sl,sr,tl,tr;
    auto slb = std::lower_bound(all(shrines),x);
    auto sub = std::upper_bound(all(shrines),x);
    auto tlb = std::lower_bound(all(temples),x);
    auto tub = std::upper_bound(all(temples),x);
    if(slb==shrines.end()) sr = INF;
    else sr = *slb-x;
    if(sub==shrines.begin()) sl = INF;
    else sl = x-*(sub-1);
    if(tlb==temples.end()) tr = INF;
    else tr = *tlb-x;
    if(tub==temples.begin()) tl = INF;
    else tl = x-*(tub-1);
    int ans = std::min({std::max(sl,tl),std::max(sr,tr),2*sl+tr,sl+2*tr,2*sr+tl,sr+2*tl});
    std::cout << ans << ENDL;
  }
  return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

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

    int N;
    cin >> N;
    int H;
    int prevH;
    int prevdownH;

    cin >> prevH;
    prevdownH = prevH;
    for (int i = 1; i < N; ++i)
    {
        cin >> H;
        if (H < prevdownH)
        {
            cout << "No\n";
            return 0;
        }
        else if (H == prevdownH)
        {
            prevH = H;
            prevdownH = H;
        }
        else if (H >= prevH)
        {
            prevH = H;
            prevdownH = H - 1;
        }
    }

    cout << "Yes\n";

    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
int main()
{
 int n;
 char a[60];
 char b[60];
 scanf("%d",&n);
 getchar();
 for(int i=0;i<n;i++)
 {
     scanf("%c",&a[i]);
 }
 getchar();
 for(int i=0;i<n;i++)
 {
     scanf("%c",&b[i]);
 }
 int flag=0;
 int p;
 long long int sum;
 if(a[0]==b[0])
 {
     sum=3;
     flag=1;
     p=1;
 }
 else
 {
     sum=6;
     flag=2;
     p=2;
 }
 while(p<n)
 {
    if(flag==1)
    {
        if(a[p]==b[p])
        {
            sum=sum*2%mod;
            p++;
            flag=1;
        }
        else
        {
            sum=sum*2%mod;
            p+=2;
            flag=2;
        }
    }
    if(flag==2)
    {
         if(a[p]==b[p])
        {
            sum=sum*1%mod;
            p++;
            flag=1;
        }
        else
        {
            sum=sum*3%mod;
            p+=2;
            flag=2;
        }
    }
 }
 printf("%lld\n",sum);
    return 0;
}


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

typedef std::pair <int, int> pr;
const int N = 200054;

int n, R;
int cnt = 0, r[N];
pr a[N];
std::priority_queue <int, std::vector <int>, std::greater <int> > pq;

int main() {
	int i, x, y, z = 0;
	scanf("%d%d", &n, &R);
	for (i = 0; i < n; ++i) scanf("%d%d", &x, &y), a[i] = pr(x, y);
	std::sort(a, a + n);
	for (x = 1, i = 0; i < n; ++i) {
		pq.emplace(a[i].second);
		if (x <= a[i].first) ++x;
		else r[cnt++] = pq.top(), pq.pop();
	}
	std::sort(r, r + cnt, std::greater <int> ());
	for (y = R, i = 0; i < cnt && x <= y; ++i) r[i] <= y ? --y : ++z;
	printf("%d\n", z + cnt - i);
	return 0;
}

Measured memory_bytes: 3192
#include <algorithm>
#include <iostream>
#include <vector>

#define REP(i, n) for(int i = 0; i < n; ++i)
using namespace std;

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

    vector<int> a(N);

    REP(i, N)
        cin >> a[i];
    sort(a.begin(), a.end());

    int cnt = 0;

    REP(i, N){
        x -= a[i];
        cnt++;
        if (x < 0)
            break;
    }

    if (x != 0)
        cnt--;
    
    cout << cnt << endl;
}

Measured memory_bytes: 256
import qualified Data.Set as Set

main = do
  s' <- getContents
  let s1 = Set.fromList $ map (read :: String -> Int) $ words $ (lines s') !! 1
  let s2 = Set.fromList $ map (read :: String -> Int) $ words $ (lines s') !! 3
  print $ Set.size $ Set.intersection s2 s1

Measured memory_bytes: 6000
#include<stdio.h>
int main(){

  int r,c;
  scanf("%d %d", &r, &c);

  int i,j,mat[r+1][c+1],sum;
  sum = 0;
  for ( i = 0 ; i < r ; i++ ){
    for ( j = 0 ; j < c ; j++ ){
      scanf("%d", &mat[i][j]);
      sum = sum + mat[i][j];
    }
  }

  mat[r][c] = sum;

  sum = 0;
  for ( i = 0 ; i < r ; i++ ){
    for ( j = 0 ; j < c ; j++ ){
      sum = sum + mat[i][j];
    }
    mat[i][c] = sum;
    sum = 0;
  }

  sum = 0;
  for ( j = 0 ; j < c ; j++ ){
    for ( i = 0 ; i < r ; i++ ){
      sum = sum + mat[i][j];
    }
    mat[r][j] = sum;
    sum = 0;
  }

  for ( i = 0 ; i <= r ; i++ ){
    for ( j = 0 ; j <= c ; j++ ){
      printf("%d", mat[i][j]);
      if ( j == c ) {
	printf("\n");
	break;
      }
      printf(" ");
    }
  }

  return 0;
  
}

Measured memory_bytes: 644
#include<iostream>

int main(){
    int h;
    int w;

    while(true){
        std::cin>>h;
        std::cin>>w;
        for(int i=0;i<h;i++){
            for(int j=0;j<w;j++){
                std::cout<<"#";
            }
            std::cout<<std::endl;
        }
        if(h==0&&w==0){
            break;
        }
        std::cout<<std::endl;
    }

    return 0;
}

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

#define rep(i, N) for (int i = 0; i < N; i++)
#define pb push_back

typedef long long ll;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<ll, ll> ll_ll;

const int MOD0 = 1e9 + 7;
const int MOD1 = 1e9 + 9;

ll INF = LLONG_MAX / 10;

int main() {
	vector<ll> a;
	for (int x = 1; x <= 1000; x++)
		for (ll y = x; y <= 1e16; y = y * 10 + 9)
			a.pb(y);
	sort(a.begin(), a.end());
	a.erase(unique(a.begin(), a.end()), a.end());
	int N = a.size();
	vector<int> S(N);
	rep(i, N) for (ll x = a[i]; x; x /= 10) S[i] += x % 10;
	vector<ll> ans;
	rep(i, N) {
		bool ok = true;
		for (int j = i + 1; j < N; j++)
			if (a[i] * S[j] > a[j] * S[i])
				ok = false;
		if (ok) ans.pb(a[i]);
	}
	// cout << ans.size() << endl;
	int K; cin >> K;
	rep(i, K) cout << ans[i] << endl;
}


Measured memory_bytes: 512
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
 
#include<bits/stdc++.h>
 
using namespace std;
#define ll long long 
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define ull unsigned long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define ff first
#define ss second
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0); 
#define nl "\n"
#define sz(a) (int)(a).size() 
#define all(a) (a).begin(),(a).end()
#define fl(a,x) memset(a,x,sizeof(a));
#define pt(a,x) cout << get<x>(a) << " " ;  
#define mt make_tuple 
#define vec vector
 
#define int long long 
 
const int mod = (int) 1e9 + 7 ;
const int MOD = (int) 998244353 ;
const int INF = (int) 1e18 ;
 
typedef vector<int> vii;
typedef pair<int,int> pii;
typedef vector<pii> vpi;
typedef vector<vector<int> > vv;
 
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
 
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

void solve(int test) {
	
	int d,t,s; cin >> d >> t >> s ;

	if(d <= s * t) cout << "Yes" ;
	else cout << "No" ;
}

int32_t main() {
 
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
#endif   

    fast;
	int t=1;
	// cin>>t;
	rep(i,1,t+1) {
		solve(i) ;
	}
 
	// cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
	return 0;
}

Measured memory_bytes: 3648
s = input()
idx = len(s)
ans = True
while idx > 0:
    if idx >= 7:
        if s[idx-7:idx] == "dreamer":
            idx -= 7
            continue
        elif idx == 7:
            ans = False
            break
    if idx >= 6:
        if s[idx-6:idx] == "eraser":
            idx -= 6
            continue
        elif idx == 6:
            ans = False
            break
    if idx >= 5:
        if s[idx-5:idx] in ["erase", "dream"]:
            idx -= 5
            continue
        elif idx == 5:
            ans = False
            break
    ans = False
    break
if ans: print("YES")
else: print("NO")

Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1000 + 5;

int main(){
	ll ans = 0;
	cin >> ans;
	string str = "";
	while(ans > 0){
		int m = ans % 26;
		if(m == 0)
			m = 26;
		str += (char)(m+'a'-1);
		ans = (ans-m)/26;
	}
	reverse(str.begin(),str.end());	
	cout << str << endl;
	return 0;
}

Measured memory_bytes: 3628
//ALDS1_10_C:Longest Common Subsequence
#include <bits/stdc++.h>
using namespace std;
#define LL_MIN -9223372036854775808
#define LL_MAX 9223372036854775807

int main(){
    int q;
    cin >> q;
    for(int i=0; i<q; i++){
        string X,Y;
        cin >> X >> Y;
        int lcs[1001][1001];
        for(int i=0; i<=X.size(); i++){
            for(int j=0; j<=Y.size(); j++){
                if(i == 0 || j == 0) lcs[i][j] = 0;
                else if(X[i-1] == Y[j-1]) lcs[i][j] = lcs[i-1][j-1] + 1;
                else lcs[i][j] = max(lcs[i][j-1], lcs[i-1][j]);
            }
        }
        cout << lcs[X.size()][Y.size()] << endl;
    }
}


Measured memory_bytes: 7092
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

// sqrt(n) までの素数を求める。 まで対応
void create_primes(int64_t n, bitset<1000001> & primes) {
	primes.flip();

	int64_t u_b = sqrt(n + 1);
	assert(u_b < 1000002);

	{
		for (int64_t j = 4; j <= u_b; j += 2) {
			primes.reset(j);
		}
	}
	for (int64_t i = 3; i <= u_b; i += 2) {
		if (!primes.test(i)) continue;

		for (int64_t j = i * 2; j <= u_b; j += i) {
			primes.reset(j);
		}
	}
}

struct FactorInfo {
	int64_t v;
	int64_t c;
};

// n の素因数分解を行う。 
bitset<1000001> primes;
vector<FactorInfo> make_factors(int64_t n)
{
	create_primes(n, primes);

	int64_t v = n;
	int64_t limit = sqrt(n + 1);

	vector<FactorInfo> ans;
	FOR_LE(i, 2, limit) {
		if (!primes.test(i)) continue;

		int64_t count = 0;
		while (v % i == 0) {
			v /= i;
			count++;
		}

		if (count != 0) {
			ans.push_back({ i, count });
		}
	}

	if (v != 1) {
		ans.push_back({ v , 1 });
	}

	return ans;
}

int64_t search(int64_t v, int64_t a, int i, vector<FactorInfo> fs) {
	if (i == fs.size()) {
		return v + (a / v);
	}

	int64_t ans = INT64_MAX;
	FOR_LE(j, 0, fs[i].c) {
		ans = min(ans, search(v, a, i + 1, fs));
		v *= fs[i].v;
	}
	
	return ans;
}

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

	int64_t a; cin >> a;
	vector<FactorInfo> factors = make_factors(a);

	uint64_t ans = search(1, a, 0, factors);

	cout << (ans - 2) << endl;

	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <stack>
#include <string>

using namespace std;

class Stack {
    int array[100];
    int top_idx;

   public:
    Stack() { top_idx = -1; }
    int top() { return array[top_idx]; }
    void push(int n) {
        ++top_idx;
        array[top_idx] = n;
    }
    void pop() { --top_idx; }
};

int main() {
    Stack stack;

    string s;
    getline(cin, s);

    stringstream ss(s);
    string buf;
    int n, n1, n2;
    while (getline(ss, buf, ' ')) {
        switch (buf[0]) {
            case '+':  // fallthrough
            case '-':  // fallthrough
            case '*':
                // stack is LIFO, so we need to store value to n2 first.
                n2 = stack.top();
                stack.pop();
                n1 = stack.top();
                stack.pop();

                switch (buf[0]) {
                    case '+':
                        n = n1 + n2;
                        stack.push(n);
                        break;
                    case '-':
                        n = n1 - n2;
                        stack.push(n);
                        break;
                    case '*':
                        n = n1 * n2;
                        stack.push(n);
                        break;
                }
                break;
            default:
                n = stoi(buf);
                stack.push(n);
                break;
        }
    }

    cout << stack.top() << '\n';
}



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

int main(){
  int a;
  cin>>a;
  string s;
  cin>>s;
  int ans=0;
  for(int i=0;i<s.size();i++){
    if(s[i]!=s[i+1]){
      ans++;
    }
  }cout<<ans<<endl;
}

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

int main(){
  
  int n,t,a;
  cin >>n >>t >>a;
  
  vector<int>h(n);
  for(int i=0; i<n; i++)cin >>h[i];
  
  double ans = 1e9;
  int anss = 0;
  
  for(int i=1; i<=n; i++){
    double w;
    w = abs(a-(t-h[i-1]*0.006));
    if(ans>w){
      ans = w;
      anss = i;
    }
  }
  
  cout <<anss <<endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define e "\n"
#define MaRiaMa { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
#define fix(n) cout << fixed << setprecision(n)
using namespace std;
int main()
{
	MaRiaMa;
	int a, b, k;
	set<int> p;
	cin >> a >> b >> k;
	int c = k, d = k;
	for (int i = a; i <= b; i++)
	{
		p.emplace(i);
		c--;
		if (c == 0)
			break;
	}
	for (int i = b; i >= a; i--)
	{
		p.emplace(i);
		d--;
		if (d == 0)
			break;
	}
	for (auto it = p.begin(); it != p.end(); it++)
	{
		cout << *it << e;
	}
}





Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int x,n;
	cin>>x>>n;
	if (n == 0){
		cout<<x<<endl;
		return 0;
	}
	vector<bool> vi(201,false);
	for (int i = 0; i < n; ++i){
		int j;
		cin>>j;
		vi[j] = true;
	}
	int res = 0;
	int best = 201;
	for (int i = 0; i <= 200; ++i){
		if (!vi[i] && abs(i-x) < best){
			best = abs(i-x);
			res = i;
		}
	}
	cout<<res<<endl;
}


Measured memory_bytes: 3616