akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void) {
	int i, j, k, temp;
	int hill[10];
	temp=0;
	
	for(i=0;i<10;i++){
		scanf("%d",&hill[i]);
	}
	
	for(j=0;j<i;j++){
		for(k=i-1;k>j;k--){
			if(hill[k]>hill[k-1]){
				temp=hill[k];
				hill[k]=hill[k-1];
				hill[k-1]=temp;
			}
		}
	}
	for(j=0;j<3;j++){
		printf("%d\n",hill[j]);
	}
	
	return 0;
}

Measured memory_bytes: 600
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int a[110];
int main()
{
	int n,cnt=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		if((i&1)&&(a[i]&1))
			cnt++; 
	 } 
	 printf("%d",cnt);
	return 0;
}


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

a = [[0 for i in range(10)] for i in range(10)]

for i in range(1, n + 1):
    mln = i % 10   # Most Left Num.
    mrn = int(str(i)[0])  # Most Right Num
    a[mln][mrn] += 1

ans = 0
for i in range(1, 10):
    for j in range(1, 10):
        ans += a[i][j] * a[j][i]

print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define pb push_back
const double PI = acos(-1);
const int mod = 1e9+7;
const long long INF = (1LL << 60);
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(const ll a, const ll b){return ((a)+(b)-1)/b;}

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

  string s;
  cin >> s;
  for(auto i : {"", "A"}){
    for(auto j : {"", "A"}){
      for(auto k : {"", "A"}){
        for(auto l : {"", "A"}){
          if(s == i + (string)"KIH" + j + (string)"B" + k + (string)"R" + l){
            cout << "YES" << endl;
            return 0;
          }
        }
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}

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

int n;
int h[100010];

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

    cin >> n;

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

    for(int i=n-1; i>=1; i--) {
        if(h[i] > h[i+1]) {
            h[i]--;
        }
    }

    for(int i=1; i<n; i++) {
        if(h[i] > h[i+1]) {
            cout << "No";
            return 0;
        }
    }

    cout << "Yes";
}


Measured memory_bytes: 640
N,M=map(int,input().split())
A=list(map(int,input().split()))

total_vote=sum(A)/(4*M)
sele=0

for i in A:
  if i >= total_vote:
    sele+=1
  else:
    pass

if M<=sele:
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
/// Rustで競技プログラミングの入力をスッキリ記述するマクロ
///
/// https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
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)*}
    };
}

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

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, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

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

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

#[inline]
#[allow(dead_code)]
fn gcd(mut m: u64, mut n: u64) -> u64 {
    if m < n {
        std::mem::swap(&mut m, &mut n);
    }

    loop {
        let k = m % n;
        if k == 0 {
            return n;
        }

        m = n;
        n = k;
    }
}

#[inline]
#[allow(dead_code)]
fn lcm(m: u64, n: u64) -> u64 {
    m / gcd(m, n) * n
}

macro_rules! eprint(
    ($($arg:tt)*) => { {
        use std::io::Write;
        let r = write!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

macro_rules! eprintln(
    ($($arg:tt)*) => { {
        use std::io::Write;
        let r = writeln!(&mut ::std::io::stderr(), $($arg)*);
        r.expect("failed printing to stderr");
    } }
);

macro_rules! dbg {
    ($val:expr) => {
        // Use of `match` here is intentional because it affects the lifetimes
        // of temporaries - https://stackoverflow.com/a/48732525/1063961
        match $val {
            tmp => {
                eprintln!("[{}:{}] {} = {:#?}",
                          file!(), line!(), stringify!($val), &tmp);
                tmp
            }
        }
    }
}

fn main() {
    input!{
        s: chars,
    }

    let mut prev: char = s[0];
    let mut answer: u64 = 0;
    for &c in s.iter().skip(1) {
        if c != prev {
            prev = c;
            answer += 1;
        }
    }

    println!("{}", answer);
}


Measured memory_bytes: 4352
# 2019/08/18
# AtCoder Beginner Contest 138 - B

# Input
n = int(input())
a = list(map(int,input().split()))

sum = 0
# Calc
for i in range(n):
    sum = sum + (1 / a[i])

ans = 1 / sum

# Output
print(ans)

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


int main(){
	int x, ans=0;
	cin >> x;

	if(x==1){
		cout << 1 << endl;
		return 0;
	}
	for(int b=2; b<=sqrt(x); b++){
		for(int p=2; pow(b,p)<=x; p++){
			if(pow(b,p)>ans) ans = pow(b,p);
		}
	}
	cout << ans << endl;
}

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

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

    int ans = 0;
    for (int i=1; i<=N; i+=2){
        int divisor=0;
        for (int j=1; j<200; j++){
            if (i%j == 0){
                divisor++;
            }
        }
        if (divisor == 8){
            ans++;
        }
    }
    cout << ans << endl;
}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using pi = pair<int, int>;
const ll INF = 1LL << 60;

int main() {
    int n,maxim=0,s;
    ll sum=0, maxsum=0;
    ll up;
    cin >> n;
    vector<int>a(n);
    rep(i, n) {
        cin >> s;
        sum += s - 1;
    }
   
    cout << sum << endl;


    return 0;
}

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

int main () {
  long N, A, B;
  cin >> N >> A >> B;
  if (A > B) cout << 0 << endl;
  else if (A != B && N == 1) cout << 0 << endl;
  else {
    long a = A*(N-1)+B, b = A+B*(N-1);
    cout << b-a+1 << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define all(v) (v).begin(), (v).end()
#define resort(v) sort((v).rbegin(), (v).rend())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
using ll = long long;
using P = pair<int, int>;
/* ----------------よく使う数字や配列----------------- */
int dx[] = {1,0,-1,0};
int dy[] = {0,1,0,-1};
constexpr ll mod = 1e9+7;
constexpr ll inf = LLONG_MAX;
constexpr long double eps = DBL_EPSILON;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */

/* --------------------ライブラリ-------------------- */
ll fact(int i) {       //階乗
    if (i == 0) return 1;
    return (fact(i - 1)) * i;
}
ll gcd(ll a, ll b) {        //最大公約数
    if(b == 0) return a;
    return gcd(b, a % b); 
}
ll lcm(ll a, ll b) {      //最小公倍数
    return a * b / gcd(a, b);
}
int keta(ll n) {        //桁数を求める
    if(n == 0) return 1;
    int count = 0;
    while(n != 0) {
        n /= 10;
        count++;
    }
    return count;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while(n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */


int main() {
    int a,b,c;
    cin >> a >> b >> c;
    if((b*10+c)%4==0)puts("YES");
    else puts("NO");
    return 0;
}

Measured memory_bytes: 3492
x,y,z,k = map(int,input().split())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]

a.sort(reverse=True),b.sort(reverse=True),c.sort(reverse=True)
abc = []

for i in range(x):
  
  for j in range(y):
   
    for l in range(z):
      if (i+1)*(j+1)*(l+1)>k:
        break
      abc.append(a[i]+b[j]+c[l])
abc.sort(reverse=True)
abc = abc[0:k]
for i in abc:
  print(i)


Measured memory_bytes: 8712
#include<stdio.h>
int main(void)
{
	int h,n,a,i;
	scanf("%d%d",&h,&n);
	for(i=0;i<n;i++){
		scanf("%d",&a);
		h-=a;
	}
	if(h<=0){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}
	return 0;
}

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

int main(void) {
    i64 n, k, ans = -1145141919;
    cin >> n >> k;
    vector<i64> v(n), s(n + 1);
    for (i64 i = 0; i < n; i++) cin >> v[i];
    for (i64 i = 1; i <= n; i++) s[i] = s[i - 1] + v[i - 1];
    for (i64 l = 0; l <= min(n, k); l++) {
        for (i64 r = 0; r <= min(n, k) - l; r++) {
            i64 b = k - l - r;
            i64 lc = s[l] - s[0], rc = s[n] - s[n - r], tc = 0;
            vector<i64> t;
            for (i64 i = 0; i < l; i++) {
                if (v[i] < 0) t.push_back(v[i]);
            }
            for (i64 i = n - r; i < n; i++) {
                if (v[i] < 0) t.push_back(v[i]);
            }
            sort(t.begin(), t.end());
            for (i64 i = 0; i < min((i64)t.size(), b); i++) {
                tc += t[i];
            }
            /*if (ans < lc + rc - tc) {
                cout << l << ' ' << r << ": ";
                cout << lc << ' ' << rc << ' ' << tc << endl;
            }*/
            ans = max(ans, lc + rc - tc);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<queue>
#include<map>

using namespace std;
typedef pair<string, int> P;
map<string, int> m;
int d[] = { 1,-1,4,-4 };

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

	queue<P> q;
	q.push(P("01234567", 0));
	m["01234567"] = 0;
	while (!q.empty()) {
		P p = q.front();
		q.pop();
		string s = p.first;

		for (int i = 0; i < 8; i++) {
			if (s[i] != '0') continue;
			for (int j = 0; j < 4; j++) {
				if (i + d[j] < 0 || 8 <= i + d[j]) continue;
				if (i == 3 && d[j] == 1 || i == 4 && d[j] == -1) continue;

				swap(s[i], s[i + d[j]]);
				if (m.find(s) == m.end()) {
					m[s] = p.second + 1;
					q.push(P(s, p.second + 1));
				}
				swap(s[i], s[i + d[j]]);
			}

		}
	}
	string s;
	while (getline(cin, s)) {
		string ss;
		for (int i = 0; i < 8; i++) {
			ss += s[2 * i];
		}
		cout << m[ss] << endl;
	}

}

Measured memory_bytes: 3448
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define size(a) int((a).size())
#define present(c, x) (c.find(x) != c.end()) 
#define printVerdict(verdict) cout << (verdict ? "Yes": "No") << '\n'
#define printDecimal(d) printf("%.9f\n", d)
#define inrange(val, start, end) (val >= start && val <= end)
 
const int mod = 1e9 + 7; 
 
template <class T1, class T2, class T3> 
void printTuple(tuple<T1, T2, T3> t) { cout << get<0>(t) << " " << get<1>(t) << " " << get<2>(t) << '\n'; }
template <class T1, class T2>
void printPair(pair<T1, T2> p) { cout << p.first << " " << p.second  << '\n'; }
template <class T>
void printArray(vector<T> arr) { for (int i = 0; i<size(arr); i++) {cout << arr[i] << " ";} cout << '\n'; } 

void dfs (int curr, int &curr_size, vector<bool> &visited, vector<vector<int>> &graph) {
	visited[curr] = true;
	curr_size++;
	for (int neighbor : graph[curr]) {
		if (!visited[neighbor]) dfs(neighbor, curr_size, visited, graph);
	}
} 

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n,m; cin >> n >> m;
	vector<bool> visited(n+1, false);
	vector<vector<int>> graph(n+1, vector<int>());
	for (int i = 0; i<m; i++) {
		int u,v; cin >> u >> v;
		graph[u].push_back(v);
		graph[v].push_back(u);
	}
	
	int curr_size = 0, ret = -1;
	
	for (int i = 1; i<=n; i++) {
		if (!visited[i]) {
			curr_size = 0;
			dfs(i, curr_size, visited, graph);
		}
		ret = max(ret, curr_size);
	}
	
	cout << ret << '\n';
}


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

int main(){
    string s;
    cin>>s;
    int cnt=0;
    rep(i,s.size()){
        if(i==0 || i==s.size()-1)continue;
        cnt++;
    }
    char f=s[0];
    char l=s[s.size()-1];
    cout<<f<<cnt<<l<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <cstdlib>
#include <cmath>
#include <functional>

#define INF 1000000000000000000
using namespace std;
typedef long long ll;


int main() {
	ll a[100010];
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	ll ans1 = 0, ans2 = 0;
	ll sum = 0;
	for (int i = 0; i < n; i++) {
		sum += a[i];
		if (i % 2==0) {
			ll temp;
			temp = max(0LL, -sum + 1);
			sum += temp;
			ans1 += temp;
		}
		else {
			ll temp;
			temp = max(0LL, sum + 1);
			sum -= temp;
			ans1 += temp;
		}
	}
	sum = 0LL;
	for (int i = 0; i < n; i++) {
		sum += a[i];
		if (i % 2 != 0) {
			ll temp;
			temp = max(0LL, -sum + 1);
			sum += temp;
			ans2 += temp;
		}
		else {
			ll temp;
			temp = max(0LL, sum + 1);
			sum -= temp;
			ans2 += temp;
		}
	}
	cout << min(ans1, ans2) << endl;

	return 0;
}

Measured memory_bytes: 1024
# -*- coding: utf-8 -*-
# Input of 3 stations
stations = input() # i.e. ABA

def needBus(s):
  '''<str> s: 3 stations'''
  if ((s[0] != s[1]) or (s[1] != s[2])):
    return 'Yes'
  else:
    return 'No'
  
# Output
print(needBus(stations))


Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const int INT_INF = 2147483647;
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; }
typedef pair<int,int> P;

int main(){
  string s;
  cin >> s;
  int n = s.size();
  bool ok = 1;
  rep(i,n){
    if(i%2==0&&s[i]=='L')ok=0;
    else if(i%2==1&&s[i]=='R')ok=0;
  }
  if(ok)cout <<"Yes" << endl;
  else cout <<"No"<< endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,m;
  int d;
  int a,b,i,j;
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    int id[4000]={0};
    unsigned long long int p[4000]={0};
    for(i=0;i<n;i++){
      scanf("%d %d %d",&d,&a,&b);
      for(j=0;id[j]!=0;j++){
	if(id[j]==d)break;
      }
      id[j]=d;
      p[j]+=a*b;
    }
    m=0;
    for(j=0;id[j]!=0;j++){
      if(p[j]>=1000000){
	printf("%d\n",id[j]);
	m=1;
      }
    }
    if(m==0)printf("NA\n");
  }
  return 0;
}

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

int main() {
    int n, c, k, t;
    cin >> n >> c >> k;
    priority_queue<int, vector<int>, greater<int>> come, go;
    
    for (int i = 0; i < n; i++) {
        cin >> t;
        come.push(t);
        go.push(t + k);
    }
    
    int cnt = 0;
    while (1) {
        if (go.empty()) {
            break;
        }
        int g = go.top();
        for (int i = 0; i < c; i++) {
            if (come.empty()) {
                cnt++;
                goto ret;
            }
            if (come.top() <= g) {
                come.pop();
                go.pop();
            } else {
                break;
            }
        }
        cnt++;
    }
ret:
    cout << cnt << endl;
}


Measured memory_bytes: 1276
N, W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]

dp = [[0 for _ in range(W+10)] for _ in range(N+5)]

for w in range(1, W+1):
    for n in range(N):
        Wi = wv[n][0]
        Vi = wv[n][1]
        if Wi <= w:
            dp[n+1][w] = max(dp[n][w], dp[n][w-Wi] + Vi)
        dp[n+1][w] = max(dp[n][w], dp[n+1][w])

print(dp[N][W])

Measured memory_bytes: 171656
import sys
from itertools import starmap
readline = sys.stdin.readline
class Segment(object):
    __slots__ = ('fi', 'se')
    def __init__(self, fi, se):
        self.fi = fi
        self.se = se
def cross(a, b):
    return a.real * b.imag - a.imag * b.real
def dot(a, b):
    return a.real * b.real + a.imag * b.imag
def norm(base):
    return abs(base) ** 2
def project(s, p2):
    base = s.fi - s.se
    r = dot(p2 - s.fi, base) / norm(base)
    return s.fi + base * r
s = Segment(*list(starmap(complex, zip(*[map(int, readline().split())] * 2))))
n = int(readline())
for _ in [0] * n:
    p2 = complex(*[int(i) for i in readline().split()])
    ap = project(s, p2)
    print(ap.real, ap.imag)

Measured memory_bytes: 7968
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define all(a) a.begin(),a.end()
#define P pair<long long,long long>
#define double long double
using namespace std;
int keta(int a){
  double b=a;
  b=log10(b);
  int c=b;
  return c+1;
 }
 int souwa(int a){
  return a*(a+1)/2;
 }
 int lcm(int a,int b){
  int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return d*e/f;
    }
  int gcm(int a,int b){
      int d=a,e=b,f;
  if(a<b)
    swap(a,b);
  int c,m=1;
  while(m){
    c=a%b;
    if(c==0){
       f=b;
      m--;
    }
    else{
      a=b;
      b=c;
 }
  }
  return f;
  }
signed main(){
  int a;
  cin>>a;
  vector< double> b(a);
  rep(i,a)
    cin>>b.at(i);
   double d=0;
  rep(i,a)
    d+=1/b.at(i);
  
  cout<<1/d;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i,n) for(int i = 0; i < ((int)(n)); i++)   // 0-indexed昇順

int main() {
    int H, N; cin >> H >> N;
    rep(i, N) {
        int A; cin >> A;
        H -= A;
        if (H <= 0) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<iomanip>
#include<math.h>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
#define LINF (long long)4e18

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int N; cin >> N;
    vector<int> p(N);
    int cnt = 0;
    rep(i,N){
        cin >> p[i];
        if(p[i] != i+1) cnt++;
    }
    if(cnt == 0 || cnt == 2){
        cout << "YES" << endl;
    }
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<math.h>
using namespace std;
 
int main(){
    int N,D,x=0;
    cin>>N>>D;
    int X[N][D];
    for(int i=0;i<N;i++){
        for(int j=0;j<D;j++)
            cin>>X[i][j];
    }
 
    for(int i=0;i<N-1;i++){
        for(int j=i+1;j<N;j++){
            double Y=0;
            for(int d=0;d<D;d++){
                Y+=pow(X[i][d]-X[j][d],2);
            }
            Y=(double)sqrt(Y);
            int y=Y/1;
            if((double)Y-y==0)x++;
        }
    }
cout<<x<<endl;
return 0;
}

Measured memory_bytes: 256
l = list(map(int, input().split()))
count_5 = 0
count_7 = 0
for r in l:
  if r == 5:
    count_5 += 1
  if r == 7:
    count_7 += 1
if count_5 == 2 and count_7 == 1:
  print('YES')
else:
  print('NO')


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

using namespace std;

int main() {
    int n;
     cin >> n;
      long long sum = 0;
      vector<long long> v(n);
      for (int i = 0; i < n; i++) {
          cin >> v[i];
          sum+=v[i];
      }
      sort(v.begin(), v.end());
      
     reverse(v.begin(), v.end());
      int len = n;
     if(len == 1) {
         cout << 0;
         return 0;
     } else if(len == 2) {
         cout << v[0];
     }
     sum = v[0];
     int count = 2;
     for(int i = 1; i < n; i++){
             for(int j = 1 ; j <= 2; j++) {
                 sum += v[i];
                 count++;
                 if(count == len) {
                     cout << sum;
                     return 0;
                    //  break;
                 }
             }
     }
    return 0;
}

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

int main()
{
	while (true) {
		string s1;
		cin >> s1;

		if (s1 == ".") {
			break;
		}

		string s2;
		cin >> s2;

		if (s1 == s2) {
			cout << "IDENTICAL" << endl;
			continue;
		}

		string t1 = s1;
		string t2 = s2;
		
		while (true) {
			size_t d1b = t1.find('\"');	// t1 start position
			if (d1b == string::npos)
				break;
			t1.replace(d1b, 1, "@");

			size_t d1e = t1.find('\"'); // t1 end position
			t1.replace(d1e, 1, "@");

			size_t d2b = t2.find('\"');	// t2 start position
			if (d2b == string::npos)
				break;
			t2.replace(d2b, 1, "@");

			size_t d2e = t2.find('\"'); // t2 end position
			t2.replace(d2e, 1, "@");

			string u1 = s1;
			u1.replace(d1b + 1, d1e - d1b - 1, "");
			string u2 = s2;
			u2.replace(d2b + 1, d2e - d2b - 1, "");

			if (u1 == u2) {
				t1 = u1;
				t2 = u2;
				break;
			}
		}

		if (t1 == t2) {
			cout << "CLOSE" << endl;
		}
		else {
			cout << "DIFFERENT" << endl;
		}
	}

	return 0;
}


Measured memory_bytes: 3156
#include <iostream>
#define ERA_MAX	1000000
#define ROO_MAX 1000
using namespace std;


bool Eratos[ERA_MAX];

int main()
{
	Eratos[0] = Eratos[1] = false;
	for (int i = 2; i < ERA_MAX; i++)
		Eratos[i] = true;
	for (int i = 2; i < ROO_MAX; i++) {
		if (Eratos[i]) {
			for (int j = i * 2; j < ERA_MAX; j += i) {
				if(Eratos[j])
					Eratos[j] = false;
			}
		}
	}
	int a, d, n;
	while (cin >> a >> d >> n, a || d || n) {
		int ite = 0, res = a;
		while ( 1 ) {
			if (Eratos[res])
				ite++;
			if (ite == n)
				break;
			res += d;
		}
		cout << res << endl;
	}
	return 0;
}

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

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

int main(int argc, char const *argv[])
{
    int D,G; cin >> D >> G;
    int ans = 1e9;
    int p[10];
    int c[10];
    REP(i, D){
        cin >> p[i] >> c[i];
    }

    for (int mask = 0; mask < (1 << D); mask++){
        int s = 0, num = 0, rest_max = -1;
        REP(i, D){
            if (mask >> i & 1){
                s += (i + 1) * 100 * p[i] + c[i];
                num += p[i];
            }
            else {
                rest_max = i;
            }
        }
        if (s < G){
            int s_m = 100 * (rest_max + 1);
            if (G - s <= s_m * (p[rest_max] - 1)) {
                num += (G - s + s_m - 1)/ s_m;
            } 
            else continue;
        }
        ans = min(ans, num);
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <stdlib.h>
#include <algorithm>



int main()
{
    int l, r;
    scanf("%d%d", &l, &r);
    if(r-l >= 2019)
        printf("0\n");
    else
    {
        long long  minv = 3e9;
        for(int i=l; i < r; i++)
            for(int j=i+1; j <=r; j++)
                minv = std::min((long long)((i%2019)*(j%2019))%2019, minv);
        printf("%lld\n", minv);
    }


    return 0;
}


Measured memory_bytes: 1736
#include<iostream>
#include<unordered_map>
#include<algorithm>
#include<vector>
#include<string>
#include<string.h>
#include<unordered_set>
#include<set>
#include<map>
#include<queue>
#include<iomanip>
#include<tgmath.h>
#include<stdlib.h>
#include<assert.h>
#include<stdio.h>



#define ll long long
#define MAX_N 300001

/*
_
_._ _..._ . - ',     _.._(`))
'-. `     ' / -._. - '    ', /
)         \            '.
/ _    _ | \
| a    a    /              |
\   . - .;
'-('' ).-', '       ;
'-;           |      .'
\           \    /
| 7.__  _. - \   \
| |  |  ``/ / `  /
/, _|  |   /, _/   /
/, _ / '`-'
*/
using namespace std;





int main()
{
	
	int n, m;
	cin >> n >> m;
	int i;
	vector<int> arr(m);
	ll sum = 0;
	for (i = 0; i < m; ++i) {
		cin >> arr[i];
		sum += arr[i];
	}
	if (sum > n) {
		cout << "-1";
	}
	else {
		cout << n - sum;
	}


}


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int n;
    cin >> n;
    vector<ll> a(3), b(3);
    for(int i = 0; i < 3; i++){
        cin >> a[i];
    }
    for(int i = 0; i < 3; i++){
        cin >> b[i];
    }
    vector<ll> dp(n + 1);
    for(int i = 0; i < 3; i++){
        if(a[i] >= b[i]) continue;
        for(int j = a[i]; j <= n; j++){
            dp[j] = max(dp[j], dp[j - a[i]] + b[i]); 
        }
    }
    ll m = 0;
    for(int i = 0; i <= n; i++){
            m = max(m, dp[i] + n - i);
    }
    vector<ll> dp2(m + 1);
    for(int i = 0; i < 3; i++){
        if(a[i] <= b[i]) continue;
        for(int j = b[i]; j <= m; j++){
            dp2[j] = max(dp2[j], dp2[j - b[i]] + a[i]);
        }
    }
    ll ans = 0;
    for(int i = 0; i <= m; i++){
        ans = max(ans, dp2[i] + m - i);
    }
    cout << ans << endl;
    return 0;
}


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

int int_x(char x) //char xの数字文字を対応する数字（int）として返す
{
    return x - '0';
}

int sum_str(char str1[]) //配列に格納された数字を全て足した数を返す
{
    int sum = 0;
    int len = strlen(str1);
    for (int i = 0; i < len; i++)
    {
        sum += int_x(str1[i]);
    }
    return sum;
}

int main(void)
{
    char x[1000];

    while (1)
    {
        scanf("%s", x);
        if (x[0] == '0')
        {
            break;
        }
        printf("%d\n", sum_str(x));
    }

    return 0;
}


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

int main(){
  ll n;
  cin >> n;
  vector<ll> a(n+1);
  vector<ll> b(n);
  
  rep(i,n+1) cin >> a[i];
  rep(i,n) cin >> b[i];
  
  ll ans = 0;
  
  rep(i,n){
    int left = min(a[i],b[i]);
    ans += left;
    a[i] -= left;
    b[i] -= left;
    
    int right = min(a[i+1],b[i]);
    ans += right;
    a[i+1] -=right;
  }
  
  cout << ans << endl;
}
    


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

int main(){
  int n;
  cin >> n;
  int b[n];
  float a[n];
  for(int i = 0;i<n;i++){
    cin >> b[i];
    a[i] = 1.0f / b[i];
  }
    float sum = 0;
    for(int i = 0;i<n;i++){
      sum += a[i];
    }
    double ans = 1.0 / sum;
   cout << setprecision(10) << ans << endl;

}


Measured memory_bytes: 256
#pragma GCC optimize ("O2")
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma GCC diagnostic ignored "-Wunused-result"
#pragma GCC diagnostic ignored "-Wunused-label"

#define DEBUG 0
#define dd if (DEBUG)

#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(a, A) for (auto & a : A)
#define all(a) (a).begin (), (a).end ()
#define rall(a) (a).rbegin (), (a).rend ()
#define sz(a) (int) (a).size ()
#define szl(a) (int) (a).length ()
#define FASTIO cin.sync_with_stdio (0); cin.tie (0); cin.exceptions (cin.failbit);

typedef long long ll;
typedef pair <int, int> pii;
#define f first
#define s second
#define mp(a, b) make_pair((a), (b))
typedef vector <int> vi;
typedef vector <vi> mi;
typedef vector <ll> vll;
typedef vector <vll> mll;
#define pb(a) push_back ((a))

const ll MOD = 1e+9+7;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int INFi = 0x3f3f3f3f;
const ll MAXN = 1e+6+7;

int main ()
{
    FASTIO;
    int i, j, n;
    string s;
    cin >> n;
    vector <string> S (n);
    vi T (n);
    for (i = 0; i < n; ++i)
        cin >> S[i] >> T[i];
    cin >> s;
    dd trav (a, S)
        cout << a << ' ';
    dd cout << '\n';
    dd trav (a, T)
        cout << a << ' ';
    dd cout << '\n' << s << '\n';
    for (i = j = n = 0; i < sz (S); ++i)
    {
        if (!j && S[i] == s) j = 1;
        else if (j) n += T[i];
    }
    cout << n << '\n';

    return 0;
}




Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
struct point {
	int x, y;
}w[101000];
vector<int>U[101000];
int A[101000], B[101000], X[101000], Y[101000];
int n, m, M;
int BIT[201000], Mod = 1000000007;
void Add(int a, int b) {
	while (a <= M) {
		BIT[a] = (BIT[a] + b)%Mod;
		a += (a&-a);
	}
}
int Sum(int a) {
	int r = 0;
	while (a) {
		r = (r + BIT[a]) % Mod;
		a -= (a&-a);
	}
	return r;
}
int main() {
	int i, c = 0;
	scanf("%d%d", &n, &m);
	for (i = 0; i < n; i++)scanf("%d", &A[i]);
	for (i = 0; i < m; i++)scanf("%d", &B[i]);
	int pv = 0;
	for (i = 0; i < n; i++) {
		if (A[i] < B[0] || A[i] > B[m - 1])continue;
		while (pv < m - 1 && B[pv + 1] < A[i])pv++;
		X[c] = A[i] - B[pv];
		Y[c] = B[pv + 1] - A[i];
		w[c] = { X[c], Y[c] };
		c++;
	}
	if (!c) {
		printf("1\n");
		return 0;
	}
	sort(X, X + c);
	sort(Y, Y + c);
	n = c;
	for (i = 0; i < n; i++) {
		w[i].x = lower_bound(X, X + n, w[i].x) - X;
		w[i].y = lower_bound(Y, Y + n, w[i].y) - Y;
		U[w[i].x+1].push_back(w[i].y * 2+2);
	}
	M = 2 * n + 1;
	Add(1, 1);
	for (i = 1; i <= n; i++) {
		if (U[i].empty())continue;
		sort(U[i].begin(), U[i].end());
		U[i].resize(unique(U[i].begin(), U[i].end()) - U[i].begin());
		for (int j = U[i].size() - 1; j >= 0; j--) {
			int y = U[i][j];
			Add(y + 1, Sum(y - 1));
		}
	}
	printf("%d\n",Sum(M));
}

Measured memory_bytes: 8448
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#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>
#include <random>

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

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout << fixed << setprecision(20);

	string s, t; cin >> s >> t;

	int ans = INT_MAX;
	FOR_LT(i, 0, s.size()) {
		int cur = 0;
		bool ok = true;
		FOR_LT(j, 0, t.size()) {
			if (i + j >= s.size()) {
				ok = false;
				break;
			}
			if (t[j] != s[i + j]) cur++;
		}
		if (ok) {
			ans = min(cur, ans);
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }



const int MAX_V = 21000;
struct Graph {
    int V;
    vector<int> list[MAX_V];
    
    Graph(int n = 0) : V(n) {}
    void init(int n = 0) {V = n; for (int i = 0; i < MAX_V; ++i) list[i].clear();}
    inline vector<int>& operator [] (int i) {return list[i];}
    
    void direct(int f, int t) {
        list[f].push_back(t);
    }
    
    friend ostream& operator << (ostream& s, const Graph& G) {
        for (int i = 0; i < G.V; ++i) {s << i << " : " << G.list[i];} return s;
    }
};

Graph G;


int n, m, a, b;



vint comp;
bool seen[MAX_V];

void dfs(int v) {
    seen[v] = true;
    for (int i = 0; i < G[v].size(); ++i) {
        int to = G[v][i];
        if (seen[to]) continue;
        dfs(to);
    }
    comp.PB(v);
}


int dp[MAX_V];

int main() {
    while (cin >> n >> m) {
        G.init(n);
        for (int i = 0; i < m; ++i) {
            cin >> a >> b;
            --a; --b;
            G.direct(a, b);
        }
        memset(seen, 0, sizeof(seen));
        comp.clear();
        
        for (int i = 0; i < n; ++i) {
            if (!seen[i]) {
                dfs(i);
            }
        }
        reverse(ALL(comp));
        
        //COUT(comp);
        
        memset(dp, -1, sizeof(dp));
        dp[comp[0]] = 0;
        
        for (int i = 0; i < comp.size(); ++i) {
            int v = comp[i];
            for (int j = 0; j < G[v].size(); ++j) {
                int to = G[v][j];
                chmax(dp[to], dp[v] + 1);
            }
        }
        
        for (int i = 0; i < comp.size(); ++i) cout << comp[i]+1 << endl;
        
        if (dp[comp.back()] == n-1) cout << 0 << endl;
        else cout << 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 2588
fun main(args: Array<String>) = abc156d()

fun abc156d() {
    val (n, a, b) = readLine()!!.split(' ').map { it.toInt() }

    var answer = Mint(2).modPow(n.toLong())
    answer -= 1
    answer -= comb(n, a)
    answer -= comb(n, b)

    println(answer)
}

private const val MOD = (1e9 + 7).toLong()

private fun modPow(n: Long, p: Long, m: Long = MOD): Long {
    var x = n
    var y = p
    var result = 1L

    x %= m
    while (y > 0) {
        if (y % 2 == 1L)
            result = (result * x) % m
        y = y shr 1
        x = (x * x) % m
    }

    return result
}

// useful for big N, and small K
private fun comb(n: Int, k: Int, m: Long = MOD): Long {
    if (n < k) return 0

    val min = Math.min(k, n - k)
    var value = 1L

    for (i in 1L..min) {
        value *= n - i + 1
        value %= m
        value *= modPow(i, m - 2, m)
        value %= m
    }
    return value
}

private class Mint(value: Long = 0L, val mod: Long = MOD) {
    constructor(other: Mint) : this(other.value)

    private val value = if (value < 0) (value % mod) + mod else value % mod
    operator fun unaryPlus() = this
    operator fun unaryMinus() = Mint(mod - this.value)
    operator fun inc() = this.plus(1)
    operator fun dec() = this.minus(1)
    operator fun plus(other: Long) = Mint(this.value + other)
    operator fun plus(other: Mint) = this.plus(other.value)
    operator fun minus(other: Long) = Mint(this.value - other)
    operator fun minus(other: Mint) = this.plus(-other)
    operator fun times(other: Long) = Mint(this.value * other)
    operator fun times(other: Mint) = this.times(other.value)
    operator fun div(other: Long) = this.times(this.modPow(other))
    operator fun div(other: Mint) = this.div(other.value)
    fun modPow(other: Long) = Mint(modPow(this.value, other, mod))
    override fun toString() = this.value.toString()
    override fun hashCode() = value.hashCode()
    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (javaClass != other?.javaClass) return false
        other as Mint
        return value == other.value
    }
}


Measured memory_bytes: 38300
#include <bits/stdc++.h>
#define repp(i,l,r)for(long long i=(l);i<(r);i++)
#define rep(i,n) for (long long i = 0; i < (n); ++i)
#define per(i,n) for (long long i = (n); i >= 0; --i)
const int INF = 2147483647;//int max
const long long int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
//ミョ(-ω- ?)
int main() {
    int d;
    cin >> d;
    const int n = 26;
    vector<int> c(n,0);
    rep(i,n)cin >> c[i];
    vector<vector<int>> s(365,vector<int>(n,0));
    rep(i,d)rep(j,n)cin >> s[i][j];
    vector<int> recent(n,0);

    rep(i,d)cout << i%26 + 1 << endl;
    return 0;
}

Measured memory_bytes: 3672
import math
a, b, C = map(float, input().split())

S = a*b*math.sin(math.radians(C))/2
L = a+b+math.sqrt(a**2+b**2-2*a*b*math.cos(math.radians(C)))
h = b*math.sin(math.radians(C))

print(S)
print(L)
print(h)


Measured memory_bytes: 5696
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef vector< int > vi;
typedef vector< vi > vvi;
typedef vector< long long > vll;
typedef pair< int,int > ii;
typedef long long ll;
#define sz(a) int((a).size())
#define pb push_back
#define mp  make_pair
#define mod 1000000007
#define mod2 998244353
#define all(c) c.begin(),c.end()
#define tr(c,i) for(typeof(c).begin() i = c.begin(); i != c.end(); i++)
#define present(c,x) (c.find(x) != c.end())
#define cpresent(c,x) (find(all(c),x) != c.end())
#define rep(i, a, b) for (int i = (a); i <= int(b); i++)
#define fo(i,n) for(ll i=0;i<n;i++)
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define Yes cout<<"Yes\n"
#define No cout<<"No\n"
#define nl "\n"
ll gcd (ll a, ll b) {
    if (b == 0)
        return a;
    else
        return gcd (b, a % b);
}

unsigned long long factorial[1000004]; 
    /*factorial[0] = 1; 
    for (int i = 1; i <= n; i++) {
        factorial[i] = (factorial[i - 1] * i) % mod3; 
    }*/




unsigned long long power(unsigned long long x, 
                         int y, int p) 
{ 
    unsigned long long res = 1; // Initialize result 
  
    x = x % p; // Update x if it is more than or 
    // equal to p 
  
    while (y > 0) { 
        // If y is odd, multiply x with result 
        if (y & 1) 
            res = (res * x) % p; 
  
        // y must be even now 
        y = y >> 1; // y = y/2 
        x = (x * x) % p; 
    } 
    return res; 
} 



  
// Returns n^(-1) mod p 
unsigned long long modInverse(unsigned long long n, int p) 
{ 
    return power(n, p - 2, p); 
} 
unsigned long long nc(unsigned long long n, 
                                 int r, int p) 
{ 
    // Base case 
    if (r == 0) 
        return 1; 
  
    // Fill factorial array so that we 
    // can find all factorial of r, n 
    // and n-r 
 
  
    return (factorial[n]* modInverse(factorial[r], p) % p * modInverse(factorial[n - r], p) % p) % p; 
} 



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    vvi dp(3, vi(n+1));
    dp[0][0]=dp[1][0]=dp[2][0]=0;
    int a,b,c;
    for(int i=1;i<=n;i++){
        cin>>a>>b>>c;
        dp[0][i] = a+ max(dp[1][i-1],dp[2][i-1]);
        dp[1][i] = b+ max(dp[2][i-1],dp[0][i-1]);
        dp[2][i] = c+ max(dp[1][i-1],dp[0][i-1]);
    }
    cout<<max(dp[0][n],max(dp[1][n] ,dp[2][n]));
    


	return 0;
}


Measured memory_bytes: 4760
import java.util.Scanner;
import java.io.PrintWriter;

public class Main { //クラス名はMain
    public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      PrintWriter out = new PrintWriter(System.out);
      int k = Integer.parseInt(sc.next());
      int x = Integer.parseInt(sc.next());
      String ans = "";
      for(int i = x;i>=-100000 && i>x-k;i--){
        ans = i + " " + ans;
      }
      for(int i = x+1;i<=1000000 && i<x+k;i++){
        ans += (i+" ");
      }
      out.println(ans.substring(0,ans.length()));
      out.flush();
    }
}

Measured memory_bytes: 23124
#include <cmath>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <iomanip>
#include <map>
#include <stack>
#include <queue>

using namespace std;

typedef long long ll;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string s;
    cin>>s;
    
    int ans1=0;
    int ans2=0;
    for(int i=0;i<s.size();i++){
        if(i%2==0){
            if(s[i]=='1') ans1++;
            else ans2++;
        } else {
            if(s[i]=='0') ans1++;
            else ans2++;
        }
    }
    
    cout<<min(ans1,ans2)<<endl;
}

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

int main() {
  int N, K;
  string S;
  cin >> N >> K >> S;
  --K;
  S[K] = 'a' + (S[K] - 'A');
  cout << S << endl;
}

Measured memory_bytes: 256
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define divup(a,b) ( ( (a) + ( (b) - 1u) ) / (b) ) // a/b の余り切り上げ
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
ll mod = 1000000007;
ll mod9 = 1000000009;

signed main(){
    ll n,q;
    scanf("%lld",&n);
    vector<ll> a(n);
    rep(i,n) scanf("%lld",&a[i]);
    scanf("%lld",&q);
    vector<ll> m(q);
    rep(i,q) scanf("%lld",&m[i]);
    ll sum = 0;
    vector<bool> f(q);
    map<ll,ll> me;
    rep(i,(int)pow(2,n)){
        sum=0;
        rep(j,n){
            if(i & (1<<j)) sum += a[j];
        }
        me[sum]=1;
    }
    rep(i,q){
        if(me[m[i]]==1) printf("yes\n");
        else printf("no\n");
    }
}



Measured memory_bytes: 3360
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> pi;
 
 
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pi> vpi;
 
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
 
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define all(x) x.begin(), x.end()
 
const int MOD = 1000000007;
const ll INF = 1e18;
 
int main() 
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int H, N;
	cin >>H >>N;
	vl A(N);
	F0R(i,N) cin>>A[i];
	ll sum = accumulate(all(A),0);
	if (sum>=H) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}


Measured memory_bytes: 1024
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; i++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// K進数でのNの桁数
ll dig(ll N,ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

int main() {
	int a, b, c; cin >> a >> b >> c;
	if (a == b)cout << c << endl;
	else if (b == c) cout << a << endl;
	else cout << b << endl;
}

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

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

Measured memory_bytes: 256
#![allow(unused_imports)]

use proconio::{input, fastout};
use proconio::marker::*;

fn main() {
    input! {
    mut n: usize,
    }
    for i in n.. {
        if is_correct(i) {
            println!("{}", i);
            return
        }
    }
}

fn is_correct(n: usize) -> bool {
    let mut n = n;
    let d = n % 10;
    while n > 0 {
        if d != n % 10 {
            return false
        }
        n /= 10;
    }
    true
}


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

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char *name, Arg1 &&arg1) {
    cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char *names, Arg1 &&arg1, Args&&... args) {
    const char *comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#define pi 3.141592653589
#define MOD 1000000007
#define to() int t; cin>>t; while(t--)
#define pb push_back
#define in insert
#define mp make_pair
#define ff first
#define ss second
#define si(s) s.size()
#define fori(it,v) for(it=v.begin();it!=v.end(); it++) 
#define for1(low,high,k) for(int i=low;i<high;i+=k)
#define for11(low,high,k) for(int j=low;j<high;j+=k)
#define for2(low,high,k) for(int i=low;i<=high;i+=k)
#define rev(high,low,k)  for(int i=high;i>=low ;i-=k)
#define all(x) x.begin(), x.end()
#define fil(x,i) memset(x,i,sizeof(x));
#define setbits(x) __builtin_popcount(x)
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout) 
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
const int N=25+5;

int main()
{
	boost;
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin) ;
    freopen("output.txt", "w", stdout) ;
    #endif
    int n; cin>>n;
    vector<pair<int,int> >v(n);
    for1(0,n,1) cin>>v[i].ff>>v[i].ss;
    bool f=false;
    for1(0,n-2,1){
        if(v[i].ff==v[i].ss && v[i+1].ff==v[i+1].ss && v[i+2].ff==v[i+2].ss)
        {
            f=true;
            break;
        }
    }
     if(f)cout<<"Yes"<<endl;
     else cout<<"No"<<endl;
return 0;
}


Measured memory_bytes: 3648
export class Main {
  static main(input: string): string {
    const tmp: string[] = input.split("\n");
    const [k]: number[] = tmp.shift().split(" ").map(int => parseInt(int));
    const [s]: string[] = tmp.shift().split(" ");
    return `${s.length <= k ? s : s.slice(0, k) + "..."}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));


Measured memory_bytes: 29636