akhauriyash/Code-Regression huggingface dataset:
N = list(input().split())
flag = False
count_5 = 0
count_7 = 0
for n in N:
  a = int(n)
  if a == 5:
    count_5 = count_5 + 1
  elif a == 7:
    count_7 = count_7 + 1
  else:
    flag = True
    break
  if flag:
    break
if (count_5 == 2) and (count_7 == 1):
  print('YES')
else:
  print('NO')

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

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(){
    const long long INF = 0;


    long long N;
    cin >> N;

    vector<int> A(N);

    for(int i = 0; i < N; i++){
        cin >> A.at(i);
    }

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

    long long Amax = A.back();

    // DP テーブル
    bool dp[Amax+1];

    // DP テーブル全体を初期化
    for (int i = 0; i < Amax + 1; ++i){
        dp[i] = false;
    }
    
    //数列に存在する項をすべてカウント

    for(int i = 0; i < N; ++i){
            dp[A.at(i)] = true;
    }

    //条件を満たさないものを除外

    for(int i = 0; i < N; ++i){
        if(dp[A.at(i)] == true){
            int j = 2;
            while(A.at(i) * j <= Amax + 1){
                dp[A.at(i) * j] = false;
                j++;
            }
        }
    }


    //同じ整数を除外

    for(int i = 0; i < N-1; ++i){
        if(A.at(i) == A.at(i+1)){
            dp[A.at(i)] = false;
        }
    }

    int ans = 0;

    for(int i = 0; i < Amax + 1; ++i){
        if(dp[i])ans++;
    }

    cout << ans << endl;

}


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

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, n, m) for (int i = n; i < m; i++)
#define ll long long int

using namespace std;

int main()
{
  int n, k;
  cin >> n >> k;
  vector<pair<ll, ll> > pairs(n);
  REP(i, n)
  {
    ll a, b;
    cin >> a >> b;
    pairs[i] = make_pair(b, a);
  }
  sort(pairs.begin(), pairs.end(), greater<pair<ll,ll> >());

  int t[100001] = {};
  ll tn = 0LL;
  ll sum = 0LL;
  priority_queue<pair<ll, ll>, vector<pair<ll,ll> >, greater<pair<ll,ll> > > queue;
  REP(i, k)
  {
    sum += pairs[i].first;
    queue.push(pairs[i]);
    if (t[pairs[i].second] == 0)
    {
      tn++;
    }
    t[pairs[i].second]++;
  }

  ll result;
  result = sum + tn * tn;

  FOR(i, k, n)
  {
    pair<ll, ll> maxp = pairs[i];
    if (t[maxp.second] > 0) continue;

    pair<ll, ll> min;
    while (!queue.empty())
    {
      min = queue.top();
      queue.pop();
      if (t[min.second] <= 1) continue;

      tn++;
      sum = sum - min.first + maxp.first;
      result = max(sum + tn*tn, result);

      t[maxp.second]++;
      t[min.second]--;
      break;
    }
    if(queue.empty()) break;
  }

  cout << result << endl;
}


Measured memory_bytes: 4340
#include<bits/stdc++.h>
using namespace std;
const int md=1e9+7;
int n,m,dp[2005][2005];
int main()
{
	scanf("%d%d",&n,&m);
	dp[1][1]=1;
	for(int i=2;i<=n;i++)for(int j=1;j<=i;j++)dp[i][j]=(dp[i-1][j]+dp[i][j-1])%md;
	int ans=dp[n][m];
	for(int i=1;i<n-m;i++)ans=ans*2%md;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 15104
use std::io::{BufRead, Write};
use std::io;

pub trait Gcd {
    /// Determine [greatest common divisor](https://en.wikipedia.org/wiki/Greatest_common_divisor)
    /// using the [Euclidean algorithm](https://en.wikipedia.org/wiki/Euclidean_algorithm)
    ///
    /// # Examples
    ///
    /// ```
    /// use gcd::Gcd;
    ///
    /// assert_eq!(0, 0u8.gcd(0));
    /// assert_eq!(10, 10u8.gcd(0));
    /// assert_eq!(10, 0u8.gcd(10));
    /// assert_eq!(10, 10u8.gcd(20));
    /// assert_eq!(44, 2024u32.gcd(748));
    /// ```
    fn gcd(self, other: Self) -> Self;
}

macro_rules! gcd_impl {
    ($($t:ty),*) => ($(
        impl Gcd for $t {
            fn gcd(self, other: Self) -> Self {
                // variable names based off Euclidean divison equation: a = b · q + r
                let (mut a, mut b) = if self > other {
                    (self, other)
                } else {
                    (other, self)
                };

                while b != 0 {
                    let r = a % b;
                    a = b;
                    b = r;
                }

                a
            }
        }
    )*)
}

gcd_impl! { u64 }

fn solve<R: BufRead, W: Write>(mut input: R, mut output: W) {
    let mut s = String::new();
    input.read_line(&mut s).unwrap();
    let mut split = s.split_whitespace();
    let _: usize = split.next().unwrap().parse().unwrap();
    let k: u64 = split.next().unwrap().parse().unwrap();
    let mut s = String::new();
    input.read_line(&mut s).unwrap();
    let mut a: Vec<u64> = s.split_whitespace().map(|s| s.parse().unwrap()).collect();
    a.sort();
    let min = *a.iter().next().unwrap();
    let max = *a.iter().last().unwrap();
    let gcd = a.into_iter().fold(min, Gcd::gcd);
    writeln!(
        output,
        "{}",
        if k >= min && k <= max && (k - min) % gcd == 0 {
            "POSSIBLE"
        } else {
            "IMPOSSIBLE"
        }
    ).unwrap();
}

fn main() {
    let stdin = io::stdin();
    let stdout = io::stdout();
    solve(stdin.lock(), stdout.lock());
}

#[cfg(test)]
mod tests {
    fn test(input: &str, output: &str) {
        let mut v: Vec<u8> = Vec::new();
        ::solve(input.as_bytes(), &mut v);
        assert_eq!(String::from_utf8(v).unwrap(), output);
    }
    #[test]
    fn case1() {
        test(
            "3 7
9 3 4\n",
            "POSSIBLE\n",
        );
    }
    #[test]
    fn case2() {
        test(
            "3 5
6 9 3\n",
            "IMPOSSIBLE\n",
        );
    }
    #[test]
    fn case3() {
        test(
            "4 11
11 3 7 15\n",
            "POSSIBLE\n",
        );
    }
    #[test]
    fn case4() {
        test(
            "5 12
10 2 8 6 4\n",
            "IMPOSSIBLE\n",
        );
    }
}


Measured memory_bytes: 6396
#include <cstdio>
int n, m, s, t, c, mx, v[35][100005];
int main() {
	int i, j;
	scanf("%d%d", &n, &m);
	while(n--) {
		scanf("%d%d%d", &s, &t, &c);
		for(i=s; i<=t; i++) v[c][i] = 1;
	}
	for(i=1; i<=100000; i++) {
		for(j=1, s=0; j<=m; j++) s += v[j][i];
		if(s>mx) mx = s;
	}
	printf("%d", mx);
	return 0;
}

Measured memory_bytes: 12032
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <limits.h>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>
#include <cstdio>
#include <iomanip>
#define ll long long
#define rep2(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define REP(e,v) for(auto e:v)
#define queint queue<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>//大きい順
#define pqg priority_queue<int,vec,greater<int>>//小さい順
#define pb push_back
#define vec vector<int>
#define vecvec vector<vector<int>>
#define vecll vector<ll>
#define vecvecll vector<vector<ll>>
#define bs binary_search
#define All(c) (c).begin(),(c).end()
#define mp make_pair
using namespace std;
int in(){int x;scanf("%d",&x);return x;}
string stin(){string s;cin>>s;return s;}
ll lin(){ll x;scanf("%lld",&x);return x;}
int main(){
    int n=in();
    vec a(n);
    rep(i,n)a[i]=in();
    sort(All(a));
    cout<<a[n/2]-a[n/2-1]<<endl;
}

Measured memory_bytes: 640
N = int(input())
H = list(map(int,input().split()))
# F = [0]*len(H)
ans = 'Yes'
flag = False
for i in range(len(H)-1):
    if H[i] - H[i+1] > 1:
        ans = 'No'
        break
    elif H[i] - H[i+1] > 0:
        if flag:
            ans  = 'No'
        flag = True

    elif H[i] - H[i+1] < 0:
            flag = False

print(ans)

Measured memory_bytes: 14396
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

#define rep(i, a, b) for(auto (i)=a;i<b;i++)
#define list(i, N) for(auto (i)=0;i<N;i++)

typedef long long ll;
typedef vector <ll> vi;
typedef pair <ll, ll> pi;
#define mp make_pair
#define pb push_back
#define eb emplace_back

#define int ll
#define INF 1e18+5
#define mod 1000000007

template<class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

int32_t main() {

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

    int n; cin >> n;
    int m; cin >> m;
    int marked[n]; list(i,n) marked[i] = -1;

    if(n==1 && m==0){
        cout << "0\n"; return 0;
    }

    list(i,m){
        int s; cin >> s; --s;
        int c; cin >> c;
        if(marked[s]!=-1 && marked[s]!=c){
            cout << "-1\n"; return 0;
        }
        if(s==0 && n>1 && c==0){
            cout << "-1\n"; return 0;
        }
        marked[s] = c;
    }

    list(i,n){
        if(marked[i]!=-1) cout << marked[i];
        else {
            if(i!=0) cout << "0";
            else cout << "1";
        }
    }
    cout << "\n";

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
int digsum(int n)
{
    int sum=0;
    while (n>0)
    {
        sum=sum+n%10;
        n=n/10;
    }
    return sum;
}
int main()
{
    fastio;
    int i,n,a,b,sum=0;
    cin>>n>>a>>b;
    for (i=1;i<=n;i++)
    {
        if (digsum(i)>=a && digsum(i)<=b)
            sum+=i;
    }
    cout<<sum<<endl;
}

Measured memory_bytes: 256
import java.math.BigInteger;
import java.util.*;

public class Main {
	
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(sc.hasNext()){
			long n = sc.nextLong();
			long p = sc.nextLong();
			
			HashMap<Long, Long>res = primeDecomposition(p);
			long ans = 1;
//			debug(res.keySet());
			for(Long key: res.keySet()){
				long value = res.get(key);
//				debug(key, value);
				if(value / n > 0){
					for(int i = 0; i < (value / n); i++){
						ans *= key;
					}
				}
			}
			System.out.println(ans);
		}
	}
	
	private HashMap<Long, Long> primeDecomposition(long n) {
		HashMap<Long, Long> map = new HashMap<>();
		for(long i=2; i * i <= n; i++){
			while(n % i == 0){
				if(map.containsKey(i)){
					map.put(i, map.get(i) + 1);
				}
				else{
					map.put(i, 1L);
				}
				n /= i;
			}
		}
		if(n != 1){
			if(map.containsKey(n)){
				map.put(n, map.get(n) + 1);
			}
			else{
				map.put(n, 1L);
			}
		}
		return map;
	}

	private void debug(Object... o) {
		System.out.println("debug = " + Arrays.deepToString(o));
	}

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

}


Measured memory_bytes: 21972
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <vector>

#define MAX_V 5000

using namespace std;

vector<int > G[MAX_V + 1];
bool visited[MAX_V + 1];

stack<int > L;
int ans[MAX_V];
int num;

int V,E;
bool single;

void init(){
	for(int i = 0;i <= MAX_V;i++) visited[i] = false;
	return ;
}

void count(int to,int cnt){
	//printf("###to = %d:cnt = %d\n",to,cnt);
	if(cnt == V - 1) single = true;
	for(int i = 0;i < G[to].size();i++){
		if(G[to][i] == ans[cnt + 1]) count(G[to][i],cnt + 1);
	}
	return ;
}

void visit(int to){
	//printf("###visited %d\n",to);
	if(!visited[to]){
		visited[to] = true;
		for(int i = 0;i < G[to].size();i++){
			int _to = G[to][i];
			visit(_to);
		}
		L.push(to);
		num++;
	}
	return ;
}

void solve(){
	init();
	for(int i = 1;i <= V;i++){
		visit(i);
	}
	single = false;
	for(int i = 0;i < V;i++){
		ans[i] = L.top();L.pop();
	}
	count(ans[0],0);
	return ;
}

int main(){

	scanf("%d%d",&V,&E);
	int _u,_v;
	for(int i = 0;i < E;i++){
		scanf("%d%d",&_u,&_v);
		G[_u].push_back(_v);
	}

	solve();
	
	for(int i = 0;i < V;i++){
		printf("%d\n",ans[i]);
	}
	if(single)puts("0");
	else puts("1");

	return 0;
}

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

int main(){
  int n;
  cin>>n;
  int a[n];
  for(int i=0;i<n;i++)
    cin>>a[i];
  int t[n];
  t[0] = 0;
  t[1] = abs(a[1] - a[0]);
  // t[1] = a[1];
  for(int i=2;i<n;i++){
    t[i] = min( t[i-1] + abs(a[i]-a[i-1]),t[i-2] + abs(a[i]-a[i-2]) );
  }
  cout<<t[n-1];
}

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

const int inf = 1e5;
int dp[101][101];

signed main () {
    int h, w;
    cin >> h >> w;
    vector < string > s(h);
    for (int i = 0; i < h; ++i) 
        cin >> s[i];
    for (int i = 0; i < h; ++i) {
        for (int j = 0; j < w; ++j) {
            if (i + j == 0) 
                dp[i][j] = int(s[i][j] == '#');
            else {
                dp[i][j] = inf;
                if (i)
                    dp[i][j] = min(dp[i][j], dp[i - 1][j] + int(s[i - 1][j] == '.' && s[i][j] == '#'));
                if (j)
                    dp[i][j] = min(dp[i][j], dp[i][j - 1] + int(s[i][j - 1] == '.' && s[i][j] == '#'));
            }
        }
    }
    cout << dp[h - 1][w - 1] << '\n';
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

int main() {
    int x, y;
    cin >> x >> y;
    bool ok = false;
    for(int i = 0; i <= x; i++){
        if(2*i+(x-i)*4 == y)ok = true;
    }
    cout << (ok ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3632
from fractions import gcd
import math


def inverse(a):
    return pow(a, mod - 2, mod)


def usearch(x, a):
    lft = 0
    rgt = len(a) + 1
    while rgt - lft > 1:
        mid = (rgt + lft) // 2
        if a[mid] <= x:
            lft = mid
        else:
            rgt = mid
    return lft


def main():
    n, d = map(int, input().split())
    d = 2 * d + 1
    print(n // d + (1 if n % d else 0))

main()


Measured memory_bytes: 5716
//#define _GLIBCXX_DEBUG
//#define _CRTDBG_MAP_ALLOC
//#pragma GCC push_options
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

typedef int64_t ll;
typedef uint64_t ull;

const ll LINF = 9187201950435737471;
const ll nLINF = -9187201950435737472;
const int INF = 2139062143;
const int nINF = -2139062144;
const ull ULINF = numeric_limits<ull>::max();
const int MAXN = 1e4 + 15;
const int MAXN2 = 1e3 + 15;
const ll MOD = 1e9 + 7;
int C = 700;
const double PI = acos(-1);
auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
mt19937 rnd;

#define all(_v) _v.begin(), _v.end()
#define rall(v) v.rbegin(), v.rend()
#define sz(v) (int)(v.size())
#define sqr(_v) (_v * _v)
#define vi vector <int>
#define vii vector <pair <int, int> >
#define eb emplace_back


inline void IO() {
#if(DEBUG_LEVEL > 0)
    freopen("../input.txt", "r", stdin);
    freopen("../out.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif
}

template <typename T>
istream& operator >> (istream& in, vector<T>& a) {
    for (auto& i : a)
        in >> i;
    return in;
}

template <typename T>
ostream& operator << (ostream& out, const vector<T>& a) {
    for (auto& i : a) {
        out << i << " ";
    }
    return out;
}

template <typename T, typename D>
istream& operator >> (istream& in, pair<T, D>& a) {
    in >> a.first >> a.second;
    return in;
}

template <typename T, typename D>
ostream& operator << (ostream& out, const pair<T, D>& a) {
    out << a.first << " " << a.second;
    return out;
}

#define int int64_t

inline void solve() {
    int n, d, a;
    cin >> n >> d >> a;
    vector <pair <int, int> > arr(n);
    cin >> arr;
    sort(all(arr));
    queue <pair <int, int>> bomb;
    int sum = 0;
    int ans = 0;
    for (auto u: arr) {
        int x = u.first, y = u.second;
        while (!bomb.empty() && bomb.front().first + d < x) {
            sum -= bomb.front().second;
            bomb.pop();
        }
        y -= sum;
        if (y <= 0) {continue;}
        int need = y / a;
        if (y % a) {need++;}
        sum += need * a;
        ans += need;
        bomb.push({x + d, need * a});
    }
    cout << ans;
}

signed main() {
    IO();
    int t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 4992
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<climits>//long long型の最大値(LLONG_MAX)など
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<iterator>//集合演算(積集合,和集合,差集合など)
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<unordered_map>//イテレータあるけど順序保持しないmap
#include<unordered_set>//イテレータあるけど順序保持しないset
#include<utility>//pair
#include<vector>//可変長配列

using namespace std;
typedef long long ll;
typedef long double lb;

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


int main() {
    ll A,B,M;
    cin >> A >> B >> M;
    vector<ll> a(A),b(B);
    rep(i,A){
        cin >> a[i];
    }
    rep(i,B){
        cin >> b[i];
    }

    vector<tuple<ll,ll,ll>> waribiki(M);
    rep(i,M){
        ll x,y,c;
        cin >> x >> y >> c;
        waribiki[i] = make_tuple(x,y,c);
    }
    
    ll ans = LLONG_MAX;

    rep(i,M){
        ll result = a[get<0>(waribiki[i])-1] + b[get<1>(waribiki[i])-1] - get<2>(waribiki[i]);
        ans = min(ans,result);
    }

    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    ans = min(ans,a[0]+b[0]);
    cout << ans << endl;

}


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

int n;

void warshall_floyd(vector<vector<int> > &d) {
    for(int k = 0; k < n; k++) {
        for(int i = 0; i < n; i++) {
            for(int j = 0; j < n; j++) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
}

int main() {
    int m,r; cin >> n >> m >> r;
    vector<int> R(r);
    vector<vector<int> > d(n,vector<int>(n));
    rep(i,n) rep(j,n) d[i][j] = INF;
    rep(i,r){
        cin >> R[i];
        R[i]--;
    } 
    rep(i,m){
        int a, b, c;
        cin >> a >> b >> c;
         --a,--b;
         d[a][b] = c;
         d[b][a] = c;
    }
    
    warshall_floyd(d);
    sort(R.begin(),R.end());
    ll ans = INF;
    do{
        ll res = 0;
        rep(i,r-1){
            res+=d[R[i]][R[i+1]];
        }
        ans = min(ans,res);
    } while(next_permutation(R.begin(),R.end()));
    cout << ans << endl;
}


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

int main(){
    ll k;
    cin >> k;
    ll r = k%50;
    vector<ll> a(50);
    cout << 50 << endl;
    for(int i = 0;i < 50;i ++){
        cout << 49 + k/50 + (i<r) - i << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 384
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"math"
)

func min(a,b int)int{
	if(a>b){
		return b
	}
	return a
}

func max(a,b int)int{
	if(a>b){
		return a
	}
	return b
}
func Abs(x int) int {
	if x < 0 {
		return -x
	}
	return x
}
var reader *bufio.Reader = bufio.NewReader(os.Stdin)
var writer *bufio.Writer = bufio.NewWriter(os.Stdout)

func printf(f string, a ...interface{}) { fmt.Fprintf(writer, f, a...) }
func scanf(f string, a ...interface{})  { fmt.Fscanf(reader, f, a...) }

func main() {
	// STDOUT MUST BE FLUSHED MANUALLY!!!
	defer writer.Flush()
	var N,M int;
	fmt.Scan(&N,&M);

	var total int;
	arr := make([]int, N)
		for i := range arr {
			fmt.Scan(&arr[i])
			total+=arr[i]
		}
	var threshold,count int;
	threshold = int(math.Ceil(float64(total)/float64((4*M))));
	sort.Ints(arr);
		for i:=0;i<N;i++{
			if(arr[i]>=threshold){
				count++
			}
		}
		if(count>=M){
			fmt.Println("Yes")
		}else{
			fmt.Println("No")
		}
	
}


Measured memory_bytes: 640
//all possible//
#include<bits/stdc++.h>
using namespace std;
unsigned long long a,b,c,n,i,j,k,l,m;
int main()
{
	deque <unsigned long long> v;
	cin>>n;
	if(n==1)
	{
		cin>>b;
		cout<<b;
		return 0;
		
	}
	if(n==2)
	{
		cin>>b>>c;
		cout<<c<<" "<<b;
		return 0;
		
	}
	if(n==3)
	{
		cin>>b>>c>>k;
		cout<<k<<" "<<b<<" "<<c;
		return 0;
	}
	else
	{
		for(i=0;i<n;i++)
	{
		cin>>a;
	     if(i%2==0)
	     v.push_back(a);
	     else
	     v.push_front(a);
	}
	if(n>3 && n%2==0)
	{
		for(i=0;i<v.size();i++)
	{
		cout<<v[i]<<" ";
		
	}
	}
	if(n>3 && n%2!=0)
	{
		reverse(v.begin(),v.end());
		for(i=0;i<v.size();i++)
	{
		cout<<v[i]<<" ";
		
	}
	}
	
	
	}
	
}

Measured memory_bytes: 3840
package main

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

func main() {
	var wtr = bufio.NewWriter(os.Stdout)
	var scanner = bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanLines)
	var N int
	if scanner.Scan() {
		str := scanner.Text()
		//cols := strings.Split(str, " ")
		N, _ = strconv.Atoi(str)
	}

	a := make([]int, N)
	if scanner.Scan() {
		str := scanner.Text()
		cols := strings.Split(str, " ")
		for i := 0; i < N; i++ {
			p, _ := strconv.Atoi(cols[i])
			a[i] = p
		}

	}
	sort.Sort(sort.Reverse(sort.IntSlice(a)))

	var asum int
	var bsum int
	f := true
	for i := 0; i < N; i++ {
		if f {
			asum += a[i]
			f = false
		} else {
			bsum += a[i]
			f = true
		}
	}

	fmt.Fprintln(wtr, asum-bsum)
	_ = wtr.Flush()
}

func max(a int, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func min(a int, b int) int {
	if a < b {
		return a
	} else {
		return b
	}
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
typedef long long int64;
typedef pair< int64, int64 > Pi;
struct edge
{
  int to, cost;
};
const int64 INF = 1LL << 60;

struct BinaryIndexedTree
{
  vector< int > data;
  BinaryIndexedTree(int sz)
  {
    data.assign(++sz, 0);
  }
  int Query(int k)
  {
    int ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return(ret);
  }
  void Add(int k, int x)
  {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};

int N, M;
vector< edge > graph[100000];

int64 Dijkstra(int s, vector< int64 >& min_cost)
{
  priority_queue< Pi, vector< Pi >, greater< Pi > > Que;
  min_cost.assign(N, INF);
  Que.push(Pi(0, s));
  min_cost[s] = 0;
  while(!Que.empty()) {
    Pi p = Que.top(); Que.pop();
    if(min_cost[p.second] < p.first) continue;
    for(auto e : graph[p.second]) {
      if(p.first + e.cost < min_cost[e.to]) {
        min_cost[e.to] = p.first + e.cost;
        Que.push(Pi(min_cost[e.to], e.to));
      }
    }
  }
  return(-1);
}


int main()
{
  scanf("%d %d", &N, &M);
  for(int i = 0; i < M; i++) {
    int A, B, C;
    scanf("%d %d %d", &A, &B, &C);
    graph[A].push_back((edge){B, C});
    graph[B].push_back((edge){A, C});
  }

  vector< int64 > toS, toG;
  Dijkstra(0    , toS);
  Dijkstra(N - 1, toG);

  vector< int > Start(N);
  for(int i = 0; i < N; i++) Start[i] = i;
  sort(Start.begin(), Start.end(), [&](const int& x, const int& y) {
    return(toS[x] < toS[y]);
  });

  vector< int64 > nums(toG);
  nums.push_back(-1);
  sort(nums.begin(), nums.end());
  nums.erase(unique(nums.begin(), nums.end()), nums.end());

  int Q;
  scanf("%d", &Q);
  vector< Pi > Query(Q);
  vector< int > Priority(Q);
  for(int i = 0; i < Q; i++) {
    scanf("%lld %lld", &Query[i].first, &Query[i].second);
    Priority[i] = i;
  }
  sort(Priority.begin(), Priority.end(), [&](const int& x, const int& y) {
    return(Query[x] < Query[y]);
  });

  int ptr = 0;
  vector< int > ret(Q);
  BinaryIndexedTree bit(nums.size());
  for(int i = 0; i < Q; i++) {
    const Pi& q = Query[Priority[i]];
    for(; ptr < N && q.first >= toS[Start[ptr]]; ++ptr) {
      bit.Add(lower_bound(nums.begin(), nums.end(), toG[Start[ptr]]) - nums.begin(), 1);
    }
    int tail = lower_bound(nums.begin(), nums.end(), q.second) - nums.begin();
    ret[Priority[i]] = bit.Query(nums.size() - 1) - bit.Query(tail - 1); 
  }

  for(int i = 0; i < Q; i++) {
    printf("%d\n", ret[i]);
  }
}

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

int main()
{
  int N;
  int l=0,r=0;
  int ninzuu=0;
  
  cin >> N;
  
  for(int i=0;i<N;i++)
  {
    cin >> l >> r;
    ninzuu += r-l+1;
  }
  cout << ninzuu << endl;
}

Measured memory_bytes: 256
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest072-B
#  https://beta.atcoder.jp/contests/abc072/tasks/abc072_b

def oddString(dataStr) :
	answerStrList = []
	rangeSelectStr = range(0,len(dataStr),2)
	for i in rangeSelectStr:
		answerStrList.append(dataStr[i])

	answerStr = ''.join(answerStrList)
	return answerStr


if __name__ == '__main__':
	inputLine = input()
	inputStr = inputLine
	ans=oddString(inputStr)
	print(ans)

Measured memory_bytes: 3572
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) cin >> a[i];
    sort(a.rbegin(), a.rend());
    ll ans = 0;
    ans = a[0];
    int idx = 1;
    int cnt = 1;
    while(1) {
        if (cnt == n - 1) break; 
        ans += a[idx];
        ++cnt;
        if (cnt&1) ++idx;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4780
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = (ll)1e9+7;
#define wall '#'

void fast(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);  cout.tie(0);
}

int main() {
    fast();
    ll H,W;
    cin >>H >>W;
    char matrix[H][W];
    for(ll i=0;i<H;i++){
        cin >>matrix[i];
    }
    
    ll dp[H][W];
    
    dp[0][0]=1;
    for(ll i=1;i<H;i++){
        if(matrix[i][0]==wall){
            dp[i][0]=0;
        }
        else dp[i][0] = dp[i-1][0];
    }
    for(ll j=1;j<W;j++){
        if(matrix[0][j]==wall){
            dp[0][j]=0;
        }
        else dp[0][j]=dp[0][j-1];
    }
    
    for(ll i=1;i<H;i++){
        for(ll j=1;j<W;j++){
            if(matrix[i][j]==wall){
                dp[i][j]=0;
            }
            else{
                dp[i][j] = dp[i-1][j]+dp[i][j-1];
            }
            dp[i][j] %= mod;
        }
    }
    
    cout<<dp[H-1][W-1];
    
    return 0;
}


Measured memory_bytes: 12360
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(" ").map(String::toInt)

    val rank = mutableMapOf(
            Pair(1, 1..399),
            Pair(2, 400..799),
            Pair(3, 800..1199),
            Pair(4, 1200..1599),
            Pair(5, 1600..1999),
            Pair(6, 2000..2399),
            Pair(7, 2400..2799),
            Pair(8, 2800..3199)
    )
    val rankCount = mutableMapOf(
            Pair(1, 0),
            Pair(2, 0),
            Pair(3, 0),
            Pair(4, 0),
            Pair(5, 0),
            Pair(6, 0),
            Pair(7, 0),
            Pair(8, 0)
    )

    var overRank = 0
    for (a in aList) {
        if (a >= 3200) {
            overRank++
            continue
        }
        val rankKey = rank.filter {
            a in it.value
        }.keys.first()
        rankCount[rankKey] = rankCount[rankKey]!! + 1
    }
    val rankNum = rankCount.filter { it.value != 0 }.size
    val max = rankNum + overRank
    val min = Math.max(rankNum,1)

    println("$min $max")
}




Measured memory_bytes: 36032
local n = io.read("*n")
local a = io.read("*n")
local ret = a - 1
local cur = 1
for i = 2, n do
  a = io.read("*n")
  if a <= cur then
    -- nothing
  elseif a == cur + 1 then
    cur = cur + 1
  else
    ret = ret + (a - 1) // (cur + 1)
  end
end
print(ret)


Measured memory_bytes: 760
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <cstring>
#include <climits>
#include <cmath>
#include <cfloat>

using namespace std;

double v, y, out, t;

int main()
{
	
	while( cin >> v, !cin.eof())
	{
		t = v/9.8;
		y = t*t*4.9;
		
		for( int i = 1; i < INT_MAX; i++)
		{
			int f = 0;
			double flr = (double)(i-1)*5.0;
			
			if( flr >= y )
			{
				cout << i << endl;
				f = 1;
				break;
			}
			
			if(f)
				break;
		}
		
	}
	
	return 0;
}

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

int main() {
    vector<vector<int>> vec(100, vector<int>(100, 0));
    cin >> vec.at(99).at(99);
    int num = vec.at(99).at(99);
    cout << (int) pow(num, 3) << endl;
}


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

using namespace std;

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

	vector<int> cnt(n + 1);

	for (int i = 0; i < k; i++) {
		int p;
		cin >> p;
		for (int j = 0; j < p; j++) {
			int m;
			cin >> m;
			cnt[m]++;
		}
	}

	int ans = 0;
	for (int i = 1; i <= n; i++) if (cnt[i] == 0) ans++;
	cout << ans;
}


Measured memory_bytes: 3584
#include <iostream>
#define N_MAX 100
#include <string>
#include <cmath>
using namespace std;

int K,S,N,B,i,j,k;
double A;
string Sa;
int x[N_MAX];
int y[N_MAX];
int num[N_MAX] = {0};
double ans=0;

int main(){
  cin >> N;
  S = 0;
  K = N;
  while (N > 0){
    S+=N%10;
    N/=10;
  }
  if (K%S==0) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
import itertools
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

N = I()

ans = [0 for _ in range(10050)]

for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
           v = (i+j+k)**2 - (i*j + j*k + k*i)
           if v < 10050:
            ans[v] += 1

for i in range(N):
    print(ans[i+1])


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

int main(){
  string find_word;
  cin>>find_word;
  for(char &c: find_word) c=toupper(c);

  string word;
  int num = 0;
  while(cin>>word){
    if(word=="END_OF_TEXT") break;
    for(char &c: word) c=toupper(c);
    if(word==find_word) num++;
  }
  cout<<num<<endl;
  return 0;
}

Measured memory_bytes: 3140
import collections
import sys
sys.setrecursionlimit(2000000)
# import math
# import itertools
# import statistics
# import numpy as np
n = int(input())
#a, b, c, d = list(map(int, input().split()))
#a = list(map(int, input().split()))
s = []
for i in range(n):
    s.append(input())

s_count = collections.Counter(s)

print(len(s_count))


Measured memory_bytes: 38784
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
#define MAX 6
#define NON -1
#define ROOT 0
#define TO_LEAF 0
#define TO_NODE 1

struct Node{
    int left, right;
    double weight;
};

class Tree{
    public:
    Node nodes[MAX*2];
    int size;
    vector<int> leaves, internals;

    Tree(){
	for ( int i = 0; i < MAX*2; i++ ){
	    nodes[i].left = nodes[i].right = NON;
	    nodes[i].weight = 0.0;
	}
    }

    double getWidth(){
	double maxx, minx;
	maxx = minx = 0.0;
	parse(0, 0.0, maxx, minx);
	return maxx - minx;
    }

    void parse(int u, double x, double &maxx, double &minx){
	maxx = max( maxx, x );
	minx = min( minx, x );
	double n, m;
	int left = nodes[u].left;
	int right = nodes[u].right;
	if ( left == NON ) return;
	n = nodes[left].weight;
	m = nodes[right].weight;
	parse(left, x - m/(n+m), maxx, minx);
	parse(right, x + n/(n+m), maxx, minx);
    }

    double getWeight(int u){
	if ( nodes[u].left == NON ) return nodes[u].weight;
	nodes[u].weight = getWeight(nodes[u].left) + getWeight(nodes[u].right);
	return nodes[u].weight;
    }
};

double R;
int stones[MAX];
int nstone;

double maxv;

void check(Tree u){
    sort( stones, stones + nstone );
    do {
	for ( int i = 0; i < nstone; i++ ){
	    u.nodes[u.leaves[i]].weight = stones[i];
	}
	u.getWeight(ROOT);
	double width = u.getWidth();
	if ( width < R ) maxv = max( maxv, width );
    } while ( next_permutation( stones, stones + nstone )) ;
}

void makeTree(Tree u){
    if ( u.leaves.size() == nstone && u.internals.size() == 0 ) check(u);
    if ( u.leaves.size() + u.internals.size()*2 > nstone ) return;

    Tree v;

    for ( int i = 0; i < u.internals.size(); i++ ){
	int parent = u.internals[i];
	for ( int a = 0; a < 2; a++ ){
	    for ( int b = 0; b < 2; b++ ){
		v = u;
		v.nodes[parent].left = v.size++;
		v.nodes[parent].right = v.size++;
		if ( a == TO_LEAF ) v.leaves.push_back(v.size-2);
		else v.internals.push_back(v.size-2);
		if ( b == TO_LEAF ) v.leaves.push_back(v.size-1);
		else v.internals.push_back(v.size-1);
		v.internals.erase( v.internals.begin() + i );
		makeTree(v);
	    }
	}
    }
}

void compute(){
    if ( nstone == 1 ) {
	printf("%.9lf\n", 0.0); return;
    }
    Tree root = Tree();
    root.internals.push_back(ROOT);
    root.size = 1;
    maxv = -1;
    makeTree(root);
    if ( maxv < 0.0 ) cout << "-1" << endl;
    else printf("%.9lf\n", maxv);
}

void input(){
    cin >> R >> nstone;
    for ( int i = 0; i < nstone; i++ ) cin >> stones[i];
}

main(){
    int tcase; cin >> tcase;
    for ( int i = 0; i < tcase; i++ ){
	input();
	compute();
    }
}

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

using namespace std;

int main(){
    int n, pointTaro = 0, pointHanako = 0;
    cin >> n;
    string strTaro, strHanako;
    for(int i = 0; i<n; i++){
        cin >> strTaro >> strHanako;
        //文字列を比較
        if(strTaro > strHanako){
            pointTaro += 3;
        }
        else if(strTaro == strHanako){
            pointTaro += 1;
            pointHanako += 1;
        }
        else if(strTaro < strHanako){
            pointHanako += 3;
        }
    }
    cout << pointTaro << " " << pointHanako << endl;
    
    return 0;
}



Measured memory_bytes: 3164
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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

int n;
vector<vector<int>> gr;
vector<vector<int>> edge;
map<pair<int, int>, int> ind;

int dfs(int curr, int par, int prev_col) {
	int col = 1, mx_col = 0;
	for (auto child : gr[curr]) {
		if (child == par) continue;

		if (col == prev_col) col++;
		edge[ind[ {child, curr}]][2] = col;
		mx_col = max(mx_col, dfs(child, curr, col));
		col++;
	}

	return max(mx_col, col - 1);
}

int main() {

	cin >> n;
	gr.resize(n + 1);
	for (int i = 0; i <= n - 2; i++) {
		int u, v; cin >> u >> v;
		edge.push_back({u, v, 0});
		ind[ {u, v}] = i;
		ind[ {v, u}] = i;
		gr[u].push_back(v);
		gr[v].push_back(u);
	}

	cout << dfs(1, 1, 0) << endl;
	for (auto i : edge) cout << i[2] << endl;


	return 0;
}

Measured memory_bytes: 26680
#include<iostream>
using namespace std;
int n,cnt,a[100005],j,f,i,k;
main(){
    cin>>n;
    for(k=0;k<n;k++)cin>>a[k];
    for(;cnt<=n;){
        f=a[i];
        if(a[i]==2){j=1;break;}
        i=f-1,cnt++;
    }
    cout<<(j?cnt+1:-1)<<endl;
}

Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main(){
	int A, B, K;
	cin >> A >> B >> K ;
	for (int i = 1; i < K + 1;i++)
		if (i % 2 == 1) 
		{
			if (A % 2 == 1)
				A -= 1;
			A = A / 2;
			B = B + A;
			
		}
		else
		{
			if (B % 2 == 1)
				B-= 1;
			B = B / 2;
			A = A + B;
		}
	cout << A << " "<< B << endl;


}

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

aa = collections.Counter(a)
sub = []
for i in aa:
    sub.append(aa[i])

sub.sort()
ans = 0
for i in range(len(sub) - k):
    ans += sub[i]

print(ans)

Measured memory_bytes: 32556
def main():
    N = int(input())
    A = [int(x) for x in input().split()]

    min = None
    max = None

    for a in A:
        if min is None or min > a:
            min = a
        if max is None or max < a:
            max = a

    print(max - min)


if __name__ == "__main__":
    main()


Measured memory_bytes: 2940
# ABC044C - 高橋君とカード / Tak and Cards (ARC060C)
def main():
    N, A = tuple(map(int, input().split()))
    X = tuple(map(int, input().split()))
    # dp[i][j][k] := patterns to make k with j cards from X1, X2, ..., Xi
    dp = [[[0] * (N * 50 + 1) for _ in range(N + 1)] for _ in range(N + 1)]
    dp[0][0][0] = 1
    for i in range(N):
        for j in range(N):
            for k in range(N * 50 + 1):
                if dp[i][j][k]:
                    dp[i + 1][j][k] += dp[i][j][k]
                    dp[i + 1][j + 1][k + X[i]] += dp[i][j][k]
    ans = sum(dp[N][i][i * A] for i in range(1, N + 1))
    print(ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 62960
q = int(input())
from collections import deque
A = deque()
for _ in range(q):
    L = list(map(int, input().split()))
    if L[0] == 0 and L[1] == 0:
        A.appendleft(L[2])
    elif L[0] == 0 and L[1] == 1:
        A.append(L[2])
    elif L[0] == 1:
        print(A[L[1]])
    else:
        if L[1] == 0:
            A.popleft()
        else:
            A.pop()


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

int N;
int Y;

int main() 
{
    cin >> N >> Y;
    int i, j, k;

    for( i=0 ; i<=N ; i++ )
    {
        for( j=0 ; (i+j)<=N ; j++ )
        {
            k = N - (i + j);
            if( ((i*10000) + (j*5000) + (k*1000)) == Y ) goto RESULT;
        }
    }

    cout << -1 << " " << -1 << " " << -1 << endl;
    return 0;

RESULT:
    cout << i << " " << j << " " << k << endl;
    return 0;
}

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

int main()
{
    int N;
    cin >> N;
    vector<int> p(N);
    for (int i = 0; i < N; i++)
        cin >> p[i];
    sort(p.begin(), p.end(), greater<int>());
    int ans = p[0] / 2;
    for (int i = 1; i < N; i++)
        ans += p[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
        int n = getInputInteger(sc);
		int a = getInputInteger(sc);
		int b = getInputInteger(sc);
 
        // programming
        int sum = 0;
        for (int i = 1; i <= n; i++) {
            int[] ds = toIntegerList(String.valueOf(i));
            int dsum = 0;
            for (int v : ds) {
                dsum += v;
            }
            if (a <= dsum && dsum <= b) {
                sum += i;
            }
        }
        output(String.valueOf(sum));
	}

	public static String getInputString(Scanner sc) {
		return sc.next();
	}

	public static int getInputInteger(Scanner sc) {
		return Integer.parseInt(sc.next());
	}

	public static void output(String... params) {
		boolean isInit = true;
		String str = "";
		for (String s : params) {
			if (!isInit) {
				str += " ";
			}
			str += s;
			isInit = false;
		}
		System.out.println(str);
	}

    public static int[] toIntegerList(String s) {
        int[] ret = new int[s.length()];
        for (int i = 0; i < s.length(); i++) {
            ret[i] = Integer.parseInt(String.valueOf(s.charAt(i)));
        }
        return ret;
    }
}

Measured memory_bytes: 25812
import java.util.*;
import java.lang.*;

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


Measured memory_bytes: 28260
#include<cstdio>
#include<algorithm>
using namespace std;
const int MAXN=200005;
int n;long long t;
struct node{int a,b;}s[MAXN];
bool cmp(node A,node B){return A.b<B.b;}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d%d",&s[i].a,&s[i].b);
	sort(s+1,s+n+1,cmp);
	for(int i=1;i<=n;i++){
		t+=s[i].a;
		if(t>s[i].b){
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>//復習必須
#include<iostream>
#include<vector>
#include <cmath>
#include <map>
#include <algorithm>
#include <string>
#define rep(i, n) for (int i = 0; i < n; ++i)
using ll = long long;
using namespace std;
#define P pair<int, int>
int main () {
    ll a ;
    cin >> a ;
    ll k = 100 ;
    ll now = 0 ;
    while(k < a){
        k*= 1.01 ;
        now++ ;
    }
    cout << now << endl;
    return 0 ;
}

 


Measured memory_bytes: 3636
for j in range(1000):
    
    a, b = map(int, input().split())
    
    if a == 0 and b == 0:
        break
    
    for i in range(a):
        if i == 0 or i == (a-1):
            print('#' * b)
        else:
            print('#' + '.' * (b-2) + '#')
        
    print('')





Measured memory_bytes: 5616
//  cd Desktop/Prog_Contest
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define rep(i,n) for(i=0;i<(n);i++)
#define ll long long
#define ull unsigned long long
#define MOD 1000000007

int keisan(int x,int y,int z){
    return (x+y)*(x+y)+(y+z)*(y+z)+(z+x)*(z+x);
}

int main(){
    int n,i,j,k,ans[10002]={};
    scanf("%d",&n);
    i=1;
    while(1){
        j=i;
        while(1){
            k=j;
            while(keisan(i,j,k)<=2*n){
                if(i==j&&j==k) ans[keisan(i,j,k)/2]+=1;
                else if(i==j&&j<k) ans[keisan(i,j,k)/2]+=3;
                else if(i<j&&j==k) ans[keisan(i,j,k)/2]+=3;
                else if(i<j&&j<k) ans[keisan(i,j,k)/2]+=6;
                k++;
            }
            if(j==k) break;
            j++;
        }
        if(i==j) break;
        i++;
    }
    for(i=1;i<=n;i++) printf("%d\n",ans[i]);
    return 0;
}

Measured memory_bytes: 1696
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
	ll n,w;
	cin>>n>>w;
	vector<vector<ll> > dp(n+1,vector<ll>((1000*100)+1,1000000001));
	dp[0][0] = 0;
	for(int i=1;i<=n;i++)
	{
		ll weight,value;
		cin>>weight>>value;
		dp[i][0] = 0;
		for(int j=1;j<=(1000*100);j++)
		{
			dp[i][j] = min(dp[i-1][j],(j-value>=0)?dp[i-1][j-value]+weight:1000000001);
		}
	}
	ll ans = 0;
	for(int i=(1000*100);i>=0;i--)
	{
		if(dp[n][i]<=w)
		{
			ans = i;
			break;
		}
	}
	cout<<ans<<endl;
}

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


int main() {
  int n, k, q;
  int num;
  cin >> n >> k >> q;
  vector<int> A(n, k - q);
  rep(i, q) {
    cin >> num;
    num--;
    A[num]++;
  }
  rep(i ,n) {
    if(A[i] > 0){
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}

Measured memory_bytes: 1024
#include <iostream> 
using namespace std;
struct points
{
	int towards[501];
} point[501];
int main()
{
	int n,m,q;
	int i,j,k,l,a,b;
	
	cin>>n>>m>>q;
	for(i=0;i<=n;i++)
		for(j=i;j<=n;j++)
			point[i].towards[j]=0;
			
	for(i=0;i<m;i++)
	{
		cin>>j>>k;
		for(l=k;l<=n;l++)
			point[j].towards[l]++;
	}
	for(i=0;i<q;i++)
	{
		a=0;
		cin>>j>>k;
		for(l=j;l<=k;l++)
			a+=point[l].towards[k];
		cout<<a<<endl;
	}
	return 0;
}

Measured memory_bytes: 1920
#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 n;
  vector<P> tasks;

  cin >> n;
  rep(i, n) {
    int a, b;
    cin >> a >> b;
    tasks.push_back(P(b,a));
  }
  sort(tasks.begin(), tasks.end());

  bool ans = true;
  int time = 0;
  rep(i,n) {
    time += tasks[i].second;
    if(time > tasks[i].first) {
      ans = false;
      break;
    }
  }
  cout << (ans? "Yes" : "No") << endl;
  return 0;

}

Measured memory_bytes: 2420
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.regex.Pattern;
import java.util.stream.Stream;;

public class Main {

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

  public void run() {
    
    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      String[] lines = br.readLine().split(" ");
      int  n = Integer.parseInt(lines[0]);
      long z = Long.parseLong(lines[1]);

      final Pattern delim = Pattern.compile(" ");
      long d = delim
        .splitAsStream(br.readLine())
        .parallel()
        .mapToLong(Long::parseLong)
        .map(l -> Math.abs(l-z))
        .reduce((e1,e2) -> gcd(e1, e2))
        .getAsLong();
      
      System.out.println(d);
    }
    catch(IOException e) {
      System.err.println(e);
    }
  }
  
  public long gcd(long x, long y) {
    if( x<y ) {
      long tmp = x; x = y; y = tmp;
    }
    if( (x%y) == 0 ) return y;
    else return gcd(y,x%y);
  }
}

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

typedef long long int ll;
typedef long int li;

const ll mod = 1000000007;
const ll inf = 1000000000000000000;

typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<vi> vvi;
typedef vector<vli> vvli;
typedef vector<vll> vvll;
typedef vector<vs> vvs;
typedef map<ll, ll> mll;
typedef map<ll, string> mls;
typedef map<string, ll> msl;

#pragma GCC optimize ("-O3")
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); 
#define PI 3.14159265358979323846
#define pb push_back
#define mp make_pair
#define fs first
#define sec second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define tol(s) transform(s.begin(), s.end(), s.begin(), ::tolower);
#define tou(s) transform(s.begin(), s.end(), s.begin(), ::toupper);
#define all(v) v.begin(), v.end()
#define FOR(i, j, k, in) for(li i=j; i<k; i+=in)
#define RFOR(i, j, k, de) for(li i=j; i>=k; i-=de)
#define rep(i,j,k) FOR(i, j, k, 1)
#define rrep(i,j,k) RFOR(i, j, k, 1)
#define repc(v) for(auto it=v.begin(); it!=v.end(); it++)
#define T ll t; cin>>t; while(t--)

int main(){
  FAST

    ll n,k;
  cin>>n>>k;
  
  if(n==k)
    cout<<0;
  
  else if(n<k){
  	if(abs(n-k)<n)
      cout<<abs(n-k);
    
    else
      cout<<n;
  }
  
  else{
  	n=n%k;
    if(abs(n-k)<n)
      cout<<abs(n-k);
    
    else
      cout<<n;
  }
  
  
  return 0;
}








Measured memory_bytes: 256