akhauriyash/Code-Regression huggingface dataset:
N = int(input())
A_list = list()
for i in range(N):
    A_list.append(int(input()))

ans = 0
#print(ans,A_list)  

#まず奇数を両端のどちらかに奇数があれば、それで打ち消す
if N > 1:
    if A_list[0]%2 == 1:
        if A_list[1] > 0:
            ans += 1
            A_list[0] -= 1
            A_list[1] -= 1

    #print(ans,A_list)  

    for i in range(1,N-1):
        if A_list[i]%2 == 1:
            if A_list[i-1]%2 == 1:
                ans += 1
                A_list[i] -= 1
                A_list[i-1] -= 1
            elif A_list[i+1] > 0:
                ans += 1
                A_list[i] -= 1
                A_list[i+1] -= 1
            elif A_list[i-1] > 0:
                ans += 1
                A_list[i] -= 1
                A_list[i-1] -= 1

        #print(ans,A_list)  
            
    if N >= 2:
        if A_list[N-1]%2 == 1:
            if A_list[N-2] > 0:
                ans += 1
                A_list[N-1] -= 1
                A_list[N-2] -= 1

    #print(ans,A_list)

#残ったのを自分同士で消す
for i in range(N):
    ans += A_list[i]//2
    A_list[i] = A_list[i]%2
    #print(ans,A_list)  
    
print(ans)
#print(A_list)

Measured memory_bytes: 12908
#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<ll,ll>;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const ll infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;
void YesNo(bool j){cout << (j ? "Yes" : "No") << endl; return;}
void yesno(bool j){cout << (j ? "yes" : "no") << endl; return;}
template<class Head> void pt(Head&& head){cout << head << endl; return;}


int main() {
  int k,a,b;
  cin >> k >> a >> b;
  bool ok=false;
  for(int i=a; i<=b; i++) {
      if(i%k==0) ok=true;
  }
  if(ok) cout << "OK" << endl;
  else cout << "NG" << endl;
  return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int t = sc.nextInt();
        int sum = 0;
        for (int i = 1; ;i++) {
            sum = i * a;
            if(sum > t) {
                System.out.println((i - 1) * b);
                return;
            }
        }
    }
}

Measured memory_bytes: 35620
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
using ll = int64_t;
using ld = double;
using ull = uint64_t;
using namespace std;
using namespace __gnu_pbds;     

const int MAXN = 6228;
int l[MAXN];
int r[MAXN];
int la[MAXN];
int ra[MAXN];
string f[MAXN];
int n;

void pt(int x) {
    int cur = 0;
    while (r[cur] < x) {
        ++cur;
    }

    while (cur < n) {
        cout << "ab";
        int cb = l[cur];
        while (r[cur] < cb) {
            ++cur;
        }
    }

    cout << "\n";
    exit(0);
}

int main() {
#ifdef BZ
    freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cout.setf(ios::fixed); cout.precision(20);

    string s;
    cin >> n >> s;
    int lc = 0, rc = 0;

    for (int i = 0; i < s.length(); ++i) {
        if (s[i] == 'b') {
            l[lc++] = i;
        } else {
            r[rc++] = i;
        }
    }

    l[n] = r[n] = MAXN;

    int ac = 0;

    for (int i = 0; i < n; ++i) {
        if (l[i] < r[i]) {
            la[ac] = l[i];
            ra[ac] = r[i];
            ++ac;
        }
    }

    la[ac] = ra[ac] = MAXN;

    if (!ac) {
        pt(0);
    }


    f[ac] = "";
    for (int i = ac - 1; i >= 0; --i) {
        int lp = i, rp = i;
        string cur;
        do {
            if (la[lp] < ra[rp]) {
                cur += 'b';
                ++lp;
            } else {
                cur += 'a';
                ++rp;
            }
        } while (lp != rp);

        cur += f[lp];
        f[i] = max(f[i + 1], cur);
    }

    cout << f[0];
    pt(ra[ac - 1] + 1);
}

Measured memory_bytes: 14720
#include <algorithm>
#include <cassert>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <list>

using std::list;
using std::max;
using std::min;
using std::vector;

class Item {
  public:
    long long index;
    long long year;
    long long id;
    long long pref;
    Item() = default;
    Item(long long _index, long long _year, long long _pref) { index = _index; year = _year; pref = _pref; }
};

bool smaller_pref(const Item& a, const Item& b)
{
  return a.pref < b.pref;
}

bool smaller_index(const Item& a, const Item& b)
{
  return a.index < b.index;
}

bool smaller_year(const Item& a, const Item& b)
{
  return a.year < b.year;
}

int main()
{
  int n, m;
  scanf("%d%d", &n, &m);
  vector<Item> table(m);
  for(int i = 0; i < m; i++) {
    long long pref, year;
    scanf("%lld%lld", &pref, &year);
    table[i].index = i;
    table[i].year = year;
    table[i].pref = pref;
  }
  std::sort(table.begin(), table.end(), smaller_year);
  std::stable_sort(table.begin(), table.end(), smaller_pref);
  long long current_pref = 0;
  long long nth;
  for(int i = 0; i < m; i++) {
    if(current_pref != table[i].pref) {
      current_pref = table[i].pref;
      nth = 1;
    }
    table[i].id = current_pref * 1000000LL + nth;
    nth++;
  }
  std::sort(table.begin(), table.end(), smaller_index);
  for(const auto& x : table) {
    printf("%012lld\n", x.id);
  }
  return 0;
}


Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1E9
#define EPS 1E-9
#define MOD (1E9+7)
#define PI 3.1415926535897932384

std::ostream &operator<<(std::ostream &out, const vector<int> &tgt)
{
	string s;
	for (int i = 0; i<tgt.size(); i++) {
		s += (to_string(tgt[i]) + ((i != tgt.size() - 1) ? " " : ""));
	}
	out << s;
	return out;
}

int main() {
	ll n, in;
	ll sum, ans,su;
	cin >> n;
	vector<ll> v;
	rep(i, n) {
		cin >> in;
		v.push_back(in);
		sum += in;
	}
	ans = 999999999999999999;
	su = 0;
	rep(i, n-1) {
		su += v[i];
		ans = min(abs(sum - su * 2), ans);
	}
	cout << ans << endl;
}

Measured memory_bytes: 2420
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
#include <vector> 
#include <numeric>
#include <cmath>
#include <queue>
#include <iomanip>
#include <functional>

#define CHMAX(a,b) a = std::max(a,b)
#define CHMIN(a,b) a = std::min(a,b)
#define MAXMIN(a,b,c) std::max(a,min(b,c))
#define CHABS(a) a = std::abs(a) 
#define COUT(a) std::cout << a << std::endl
#define CERR(a) std::cerr << a << std::endl
#define FOR(n) for(lli i = 0; i < n; i++)

using namespace std;
using lli = long long int;
using pll = pair<lli, lli>;
using tlll = tuple<lli, lli, lli>;
using vll = vector<lli>;

lli mod197 = 1000000007LL;
lli INF = 10000000000000;

// ax + by = gcd(a,b) 最大公約数
template< typename T >
T extgcd(T a, T b, T& x, T& y) {
	T d = a;
	if (b != 0) {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	else {
		x = 1;
		y = 0;
	}
	return d;
}


int main(void) {

	double a, b;
	cin >> a >> b;

	b--;
	a--;

	COUT(ceil(b / a));

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
using ll = long long;
 
 
int main()
{
    int n; cin >> n; vector<int> a(n); for(int i = 0; i < n; i++)cin >> a[i]; sort(a.begin(), a.end());
 
    int cur = a.front();
    vector<pair<int,int>> rs;
 
    for(int i = 1; i < n - 1; i++) {
        if(a[i] >= 0) {
            rs.emplace_back(cur, a[i]);
            cur -= a[i];
        }
    }
    rs.emplace_back(a.back(), cur);
    cur = a.back() - cur;
 
    for(int i = 1; i < n - 1; i++) {
        if(a[i] < 0) {
            rs.emplace_back(cur, a[i]);
            cur -= a[i];
        }
    }
    cout << cur << endl;
    for(auto i : rs)cout << i.first << " " << i.second << endl;
}

Measured memory_bytes: 4636
require 'pp'

def gets; ARGF.gets; end

class Solver

  def initialize
  end

  def main
    a, b = gets.split.map(&:to_i)

    ans = 0
    if b == 1
      ans = 0
    else
      b -= 1
      ans = (b + (a - 1 - 1)) / (a - 1)
    end

    puts ans
  end
end

if __FILE__ == $0
  Solver.new.main
end


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

const int N = 2010, mod = 924844033;
long long dp[N][N][3], fact[N], p[N], n, K;

int main() { 
	ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n >> K;
	fact[0] = 1;
	for (int i = 1; i < N; i++)
		fact[i] = 1LL * fact[i - 1] * i % mod;
	int last = 1;
	for (int i = 1; i <= K * 2; i++) 
		for (int j = i; j <= n; j += K * 2)
			p[last++] = j;
	dp[0][0][0] = 1;
	for (int i = 1; i <= n; i++) {
		dp[i][0][0] = 1;
		for (int j = 1; j <= i; j++) {
			dp[i][j][0] = (dp[i - 1][j][0] + dp[i - 1][j][1] + dp[i - 1][j][2]) % mod;
			if (p[i] - K >= 1) {
				dp[i][j][1] = (dp[i - 1][j - 1][0] + dp[i - 1][j - 1][1]) % mod;
				if (p[i] - K != p[i - 1] + K)
					(dp[i][j][1] += dp[i - 1][j - 1][2]) %= mod;
			}
			if (p[i] + K <= n) {
				dp[i][j][2] = (dp[i - 1][j - 1][0] + dp[i - 1][j - 1][2]) % mod;
				if (p[i] + K != p[i - 1] - K)
					(dp[i][j][2] += dp[i - 1][j - 1][1]) %= mod;
			}
		}
	}
	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		int x = (dp[n][i][0] + dp[n][i][1] + dp[n][i][2]) % mod;
		if (i & 1)
			(ans += 1LL * (x) * fact[n - i] % mod) %= mod;
		else {
			ans = ((ans - (1LL * x * fact[n - i]) % mod) % mod + mod) % mod;
		}
	}
	cout << ((fact[n] - ans) % mod + mod) % mod << '\n';
	return 0;
}


Measured memory_bytes: 58180
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pl;
typedef vector<ll> vl;

int main (void) {
  ios::sync_with_stdio(false);cin.tie(0);
  cout << fixed << setprecision(15);
  string s,t;
  cin >> s >> t;
  t.pop_back();
  if (s == t) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}



Measured memory_bytes: 3656
//       ###
//      #---##
//  ####-0----##
// ####--------#
//     #--------#
//     ##-------#
//      #-------#
//      #-------#
//     ##--------#
//     #---------# ##### 
//     #-------##-------#######           																																									Ya katala
//     #------#----------------#
//    #------##-----------------#
//    #------##------------------#
//    #-----#---------------------#
//    #-----##---------------------#
//     #------##--------------------#
//      #-------##-------------------#
//       #--------##------------------#
//        ############################ #
//             ||           ||
//             ||           ||
//             ||           ||
//             ||           ||
//          ####|        ####|




#include <bits/stdc++.h>
#include <iostream>

#define for0(i , v) for (int i = 0 ; i < v.size() ; i++)
#define for1(i , n) for (int i = 1 ; i <= n ; i++)
#define AIDS ios_base::sync_with_stdio(0)
#define pb push_back
#define pp pop_back
#define sz(a) a.size()
#define all(x) x.begin() , x.end()
#define F first
#define S second
#define mp make_pair
#define ld long double
#define ll long long
#define pii pair<int, int>
#define in insert
#define vi vector <int>
#define vvi vector <vi>
#define Case "Case " << num << ": "

const int N = 1e6 + 3;
const ll INF = 1e18 + 100;
const int inf = 1e9 + 123;
const int MOD = 1e9 + 7;
const int dx[] = {0 , 1 , 0 , -1 , 0};
const int dy[] = {0 , 0 , 1 , 0 , -1};
const char dd[] = {' ' , 'D' , 'R' , 'U' , 'L'};

using namespace std;



int main () {
//  freopen("input.in", "r", stdin);
//  freopen("output.out", "w", stdout);
	AIDS;
	int a , b;
	cin >> a >> b;
	cout << a + b / 2;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long N,M ;
    cin >> N >> M;
    vector<vector<long>> L(N,vector<long>(2));
    for (int i=0;i<N;i++){
        cin >> L[i][0] >> L[i][1];
    }
    sort(L.begin(),L.end());
    long cntM=0;
    long long ans =0;
    for (int i=0;i<N;i++){
        long long buyM = min(M-cntM,L[i][1]);
        ans += buyM*L[i][0];
        ///cout << buyM << ans << buyM*L[i][0] << L[i][0];
        cntM+= buyM;
        if (cntM>=M){
            break;
        }
    }
    cout << ans;
}


Measured memory_bytes: 5760
object Main extends App {
  val scan = new java.util.Scanner(System.in)
  val n, c = scan.next.toInt
  val ds = Array.fill(c,c)(0)
  val cs = Array.fill(n,n)(0)
  for(i <- 0 until c; l <- 0 until c) ds(i)(l) = scan.next().toInt
  for(i <- 0 until n; l <- 0 until n) cs(i)(l) = scan.next().toInt - 1

  val c0 = Array.fill(c)(0)
  for(i <- 1 to n; l <- 1 to n; if (i+l) % 3 == 0) c0(cs(i-1)(l-1)) += 1
  val c1 = Array.fill(c)(0)
  for(i <- 1 to n; l <- 1 to n; if (i+l) % 3 == 1) c1(cs(i-1)(l-1)) += 1
  val c2 = Array.fill(c)(0)
  for(i <- 1 to n; l <- 1 to n; if (i+l) % 3 == 2) c2(cs(i-1)(l-1)) += 1

  val ns = for (
    i <- 0 until c;
    j <- 0 until c; if i != j; 
    k <- 0 until c; if i != k && j != k
  ) yield (c0.zip(0 to c).map(t => t._1 * ds(t._2)(i)).sum
          + c1.zip(0 to c).map(t => t._1 * ds(t._2)(j)).sum
          + c2.zip(0 to c).map(t => t._1 * ds(t._2)(k)).sum)

  println(ns.min)
}

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

#define TRACE(x) cerr << #x << " :: " << x << endl
#define _ << " " <<
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(),(x).end()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for (int i=(a);i>=(b);--i)

const int mxN = 2e5+5;
int N, K, A[mxN];
int ft[mxN];

void u(int i, int x) {
    for (; i <= N; i += i&-i) ft[i] += x;
}
void update(int i, int j, int x) {
    u(i,x);
    u(j+1,-x);
}
int query(int i) {
    int r = 0;
    for (; i; i -= i&-i) r += ft[i];
    return r;
}

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

    cin >> N >> K;
    FOR(i,1,N){
        cin >> A[i];
        update(max(1,i-A[i]),min(N,i+A[i]),1);
    }

    FOR(i,1,K){
        bool brk = 1;
        FOR(j,1,N){
            A[j] = query(j);
            brk &= A[j] == N;
        }
        if (brk) break;
        memset(ft,0,sizeof ft);
        FOR(j,1,N){
            update(max(1,j-A[j]),min(N,j+A[j]),1);
        }
    }
    FOR(i,1,N){
        cout << A[i] << ' ';
    }
    cout << '\n';
}



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

#define ll long long

int main() {
	int n;
	cin >> n;
	int ans;
	for (int i = 1; i < 12; i++) {
		ans = 1000 * i - n;
		if (ans >= 0)break;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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 T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;


signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int x,k,d;
    cin>>x>>k>>d;
    x=abs(x);
    if(abs(x) /d > k ){
        cout<<x - k*d<<endl;
    }
    else{
        int cnt=abs(x)/d;
        if(cnt%2 == k%2){
            cout<<x%d<<endl;
        }
        else{
            cout<<d - x%d<<endl;
        }
    }
    
    return 0;
}

Measured memory_bytes: 3644
#include<stdio.h>
  
 #define N 101
  
 int G[N][N], X[N], Y[N], n;
  
 void find(int x, int y){
   int i;
   X[x] = y;
   for(i = 1; i <= Y[x]; i++)
     if(y + 1 < X[G[x][i]]) find(G[x][i], y + 1);
 }
  
 int main(){
   int i, j, m;
  
   scanf("%d", &n);
  
   for(i = 1; i <= n; i++){
     X[i] = 100000000;
     scanf("%d", &m);
     scanf("%d", &Y[m]);
  
     for(j = 1; j <= Y[m]; j++) scanf("%d", &G[m][j]);
   }
  
   find(1, 0);
  
   for(i = 1; i <= n; i++)
     if(X[i] == 100000000) X[i] = -1;
  
   for(i = 1; i <= n; i++) printf("%d %d\n", i, X[i]);
  
   return 0;
  }

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

const int N = 2005;

int n, sum;
bitset<2000005> bs;

int main() {
	cin >> n;
	bs[0] = 1;
	for (int i = 0; i < n; ++i) {
		int x; cin >> x;
		bs |= bs << x, sum += x;
	} 
	for (int i = (sum + 1) / 2; i <= sum; ++i) {
		if (bs[i]) {
			cout << i; return 0;
		}
	}
}

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

namespace AtCoder {
    class Program {
        static void Main(string[] args) {

            var input1 = Console.ReadLine().Split(' ').Select(n => int.Parse(n)).ToArray();
            var a = input1[0];
            var b = input1[1];
            var k = input1[2];

            var m = Math.Min(a, b);
            var count = 0;
            while (m >= 1) {
                if (a % m == 0 && b % m == 0) {
                    count++;
                    if(count == k) {
                        Console.WriteLine(m);
                        return;
                    }
                }
                m--;
            }
        }
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int n; cin >> n;
  V<> d(n); for (auto&& e : d) cin >> e;
  int s = accumulate(begin(d), end(d), 0);
  int res = s * s;
  for (int e : d) { 
    res -= e * e;
  }
  res /= 2;
  cout << res << '\n';
}

Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;
const int maxx = 100010;
int n, m, order = 0;
int low[maxx], dfn[maxx], father[maxx], son[maxx];
//father:父结点 son:子结点个数 
vector<int> cutpoint, edge[maxx];
vector< pair<int, int> > cutedge;

void tarjan(int u)
{
    dfn[u] = low[u] = ++order;
    bool flag = false;
    for (int i = 0; i<edge[u].size(); i++)
    {
        int v = edge[u][i];
        if (!dfn[v])
        {
            son[u]++;
            father[v] = u;
            tarjan(v);
            if (low[v] >= dfn[u]) flag = true;
            //点u为割点 
            if (low[v]>dfn[u]) cutedge.push_back(make_pair(min(v, u), max(v, u)));
            //边v-u为割边 
            low[u] = min(low[u], low[v]);
        }
        else if (v != father[u]) low[u] = min(low[u], dfn[v]);
    }
    //根节点若有两棵或两棵以上的子树则该为割点
    //非根节点若所有子树节点均没有指向u的祖先节点的回边则为割点
    if ((father[u] == 0 && son[u]>1) || (father[u] && flag)) cutpoint.push_back(u);
}

int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= m; i++)
    {
        int u, v;
        scanf("%d%d", &u, &v);
        edge[u+1].push_back(v+1), edge[v+1].push_back(u+1);
    }
    tarjan(1);
    sort(cutedge.begin(), cutedge.end());
    sort(cutpoint.begin(), cutpoint.end());

    int len = cutpoint.size();
    for (int i = 0; i< len; i++) 
        printf("%d\n", cutpoint[i]-1);
    return 0;
}



Measured memory_bytes: 6556
label = input().split()
rot = input()

dice = {
        "top":1,
        "front":2,
        "right":3,
        "left":4,
        "back":5,
        "bottom":6
        }

for r in rot:
    if r == 'E':
        t = dice["top"]
        dice["top"] = dice["left"]
        dice["left"] = dice["bottom"]
        dice["bottom"] = dice["right"]
        dice["right"] = t
    elif r == 'N':
        t = dice["top"]
        dice["top"] = dice["front"]
        dice["front"] = dice["bottom"]
        dice["bottom"] = dice["back"]
        dice["back"] = t
    elif r == 'S':
        t = dice["top"]
        dice["top"] = dice["back"]
        dice["back"] = dice["bottom"]
        dice["bottom"] = dice["front"]
        dice["front"] = t
    elif r == 'W':
        t = dice["top"]
        dice["top"] = dice["right"]
        dice["right"] = dice["bottom"]
        dice["bottom"] = dice["left"]
        dice["left"] = t
print(label[dice["top"]-1])

Measured memory_bytes: 7492
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k;
	scanf("%d%d",&n,&k);
	int p;
	for (register int i=1;i<=n;++i)
	  scanf("%d",&p);
	if ((n-1)%(k-1)==0) printf("%d\n",(n-1)/(k-1)); else printf("%d\n",(n-1)/(k-1)+1);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#define rep0(i,n) for (int i = 0; i <= (n); ++i)
#define rep1(i,n) for (int i = 1; i <= (n); ++i)
using namespace std;
int main(){
	string a; cin >> a;
	int count = 0;
	rep0(i, 2) {
		if (a[i] == '1')++count;
	}
	cout << count << endl;
	return 0;
}

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


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int sum = 0;

        for(int i = 0 ; i <= N ;i ++){
            sum = sum + i;
        }
        System.out.println(sum);
    }
}

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

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


Measured memory_bytes: 3132
import os
import heapq
import sys,threading
import math
import operator
from collections import defaultdict,deque
from io import BytesIO, IOBase
import math as mt
sys.setrecursionlimit(10 ** 5)
threading.stack_size(2**27)


def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)


"""def pw(a,b):
    result=1
    while(b>0):
        if(b%2==1): result*=a
        a*=a
        b//=2
    return result"""


def inpt():
    return [int(k) for k in input().split()]

def main():
    MAXN=1000001
    prime=[0]*MAXN
    prime[1] = 1
    for i in range(2, MAXN):
        prime[i] = i

    for i in range(4, MAXN, 2):
        prime[i] = 2

    for i in range(3, mt.ceil(mt.sqrt(MAXN))):
        if (prime[i] == i):
            for j in range(i * i, MAXN, i):
                if (prime[j] == j):
                    prime[j] = i
    n=int(input())
    ar=inpt()
    d=defaultdict(int)
    ok=True
    for i in range(n):
        x=ar[i]
        while(x!=1):
            tp=prime[x]
            x=x//prime[x]
            if(tp in d and d[tp]!=(ar[i],i)):
                ok=False
                break
            d[tp]=(ar[i],i)

    if(ok):
        print('pairwise coprime')
    else:
        gcd=ar[0]
        for i in range(1,n):
            gcd=mt.gcd(gcd,ar[i])

        if(gcd==1):
            print('setwise coprime')
        else:
            print('not coprime')




BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    #main()
    threading.Thread(target=main).start()


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

#define rep(i, n)    for(ll i = 0; i < (n); ++i)
#define repA(i, a, n)  for(ll i = a; i <= (n); ++i)
#define repD(i, a, n)  for(ll i = a; i >= (n); --i)
#define pb push_back
#define X first
#define Y second

typedef long long int ll;
typedef long double ld;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vii;
const ll INF = 1e18+1;
const ll MOD = 998244353L;

#ifdef umang99m
    #include "/home/umang/.templates/header.h"
#else
    #define dbg(args...)
    #define timer()
#endif

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

    ll n,s;
    cin>>n>>s;
    vi a(n+1);
    repA(i,1,n) cin>>a[i];

    ll dp[n+1][s+1];
    ll dp1[n+1][s+1];
    memset(dp, 0, sizeof dp);
    memset(dp1, 0, sizeof dp);
    /*
     * dp[i][j] = dp[i-1][j] for all j;
     * dp[i][A[i]] += i;
     * for j > A[i], dp[i][j] += dp[i-1][j-A[i]];
    */

    repA(i,1,n){
        repA(j,1,s){
            if(j > a[i])
                dp[i][j] = dp1[i-1][j-a[i]];
            else if(j == a[i]){
                dp[i][j] = i;
            }
            dp[i][j] %= MOD;
            dp1[i][j] = dp1[i-1][j] + dp[i][j];
            dp1[i][j] %= MOD;
        }
    }


    ll ans = 0;
    repA(i,1,n){
        ans+=((n-i+1)*dp[i][s])%MOD;
        ans %= MOD;
    }

    cout<<ans<<endl;

    timer();
    return 0;
}


Measured memory_bytes: 141056
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))


using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };


ll m = 1000000007;

const int MOD = 1000000007;

ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}



long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}

std::vector<ll> enum_div(ll n)//nの約数を列挙
{
	std::vector<ll> ret;
	for (int i = 1; i*i <= n; ++i)
	{
		if (n%i == 0)
		{
			ret.push_back(i);
			if (i != 1 && i*i != n)
			{
				ret.push_back(n / i);
			}
		}
	}
	ret.pb(n);
	return ret;
}


int main() {
	ll N, M; cin >> N >> M;
	vector<ll>r = enum_div(M);
	ll ans = 0;
	for (auto i : r) {
		if (M >= (ll) i * N) {
			ans = max(ans, (ll)i);
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<map>

using std::map;
using std::max;
using std::min;
int a[100005];
map<int, int> s;

int main(void)
{
	int N, T,profit = 0,jiujimin = 0x7fffffff;
	scanf("%d%d", &N, &T);
	for (int i = 0; i < N; ++i)
		scanf("%d", &a[i]);
	for (int i = 0; i < N; ++i)
	{
		if (a[i] < jiujimin)
			jiujimin = a[i];
		else
		{
			if (a[i] - jiujimin > profit)
			{
				profit = a[i] - jiujimin;
				++s[profit];
			}
			else if (a[i] - jiujimin == profit)
				++s[profit];
		}

	}
	if (!profit)
		printf("%d", N);
	else
		printf("%d",s[profit]);
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(ll i = 0; i<(ll)(n); i++)
#define REPS(i,n) for (ll i = 1; i<=(ll)(n); i++)
#define REPD(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=(a);i<=(b);i++)
#define FORD(i,a,b) for(ll i=(a);i>=(b);i--)
#define pb push_back
#define MOD 1000000007
#define MOD2 998244353
#define PI 3.141592653
#define INF 100000000000000 //14

int main(){
    ll q, t, a, b; cin >> q;
    ll cnter = 0;
    ll mid = 0;
    ll ans = 0;
    priority_queue<ll, vector<ll>, greater<ll>> qr;
    priority_queue<ll, vector<ll>, less<ll>> ql;
    ll rsum = 0;
    ll lsum = 0;
    vector<ll> sta;
    REP(i,q){
        cin >> t;
        if (t==1){
            cin >> a >> b;
            ans+=b;
            if (cnter==0){
                mid = a;
                sta.pb(a);
            }
            else if (cnter==1){
                sta.pb(a);
                sort(sta.begin(),sta.end());
                ql.push(sta[0]);
                qr.push(sta[1]);
                lsum = sta[0];
                rsum = sta[1];
            }
            else if (cnter==2){
                sta.pb(a);
                sort(sta.begin(),sta.end());
                mid = sta[1];
                ql.pop(); qr.pop();
                ql.push(sta[0]); qr.push(sta[2]);
                lsum = sta[0];
                rsum = sta[2];
            }
            else if (cnter%2){
                ll x = ql.top();
                ll y = qr.top();
                if (a<mid){
                    ql.push(a);
                    qr.push(mid);
                    lsum+=a;
                    rsum+=mid;
                }
                else{
                    ql.push(mid);
                    qr.push(a);
                    lsum+=mid;
                    rsum+=a;
                }
            }
            else{
                ll x = ql.top();
                ll y = qr.top();
                if (a<x){
                    mid = x;
                    ql.pop();
                    ql.push(a);
                    lsum+=a-x;
                }
                else if (y<a){
                    mid = y;
                    qr.pop();
                    qr.push(a);
                    rsum+=a-y;
                }
                else{
                    mid = a;
                }
            }
            cnter++;
        }
        else{
            if (cnter%2){
                ll y = ans+(rsum-lsum)+(ql.size()-qr.size())*mid;
                cout << mid << " " << y << endl;
            }
            else{
                ll x = ql.top();
                //cout << ans << " " << rsum << " " << qr.size() << " " << ql.size() << " " << x << endl;
                ll y = ans+(rsum-lsum)+(ql.size()-qr.size())*x;
                //cout << ans << " " << rsum-lsum << " " << ql.size()-qr.size() << " " << x << endl;
                cout << x << " " << y << endl;
            }
        }
    }
}

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

long long n,k;

int main(){
    ios_base::sync_with_stdio(0);
    //freopen("input.txt","r",stdin);

    cin>>n>>k;
    long long best=1e18+1;
    best=abs(n-k);
    if(n>k) n = (n%k)+k;
    best=min(best, n);
    n = abs(n-k);
    best=min(best, n);
    n = abs(n-k);
    best=min(best, n);
    cout<<best;
}


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

using namespace std;

typedef long long ll;

int main(){
	int n;
	cin >> n;
	if(n%2==1){
		cout << ((n-2)*n+1)/2 << endl;
		for(int i = 1; i < n; i++){
			for(int j = i+1; j <= n; j++){
				if(i+j == n)continue;
				cout << i << ' ' << j << endl;
			}
		}
	}
	else{
		cout << (n-2)*n/2 << endl;
		for(int i = 1; i < n; i++){
			for(int j = i+1; j <= n; j++){
				if(i+j == n+1)continue;
				cout << i << ' ' << j << endl;
			}
		}
	}

    return 0;
}

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

int main(){
	int H,W;
  	cin >> H >> W;
  	string a;
  	string pre = "";
  	string lat = "";
  	for(int i = 0;i<W+2;i++){
    	pre += '#';
    }
  	cout << pre << endl;
  	for(int i = 0;i<H;i++){
    	cin >> a;
      	cout << "#" << a << "#" << endl;
    }
  	for(int i = 0;i<W+2;i++){
    	lat += '#';
    }
  	cout << lat << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const long double EPS=1e-9;
const long double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
long double ABS(long double a){return max(a,-a);}
 
int S[210000];
int T[210000];
int X[210000];
int z[410000];
int segtree[1<<20];
void update(int a,int b,int c,int d,int e,int f){
	if(d<a||b<c)return;
	if(c<=a&&b<=d){
		segtree[e]=min(segtree[e],f);return ;
	}
	update(a,(a+b)/2,c,d,e*2,f);
	update((a+b)/2+1,b,c,d,e*2+1,f);
}
int query(int a){
	a+=524288;
	int ret=mod;
	while(a){
		ret=min(segtree[a],ret);
		a/=2;
	}
	return ret;
}
int main(){
	int a,b;scanf("%d%d",&a,&b);
	for(int i=0;i<a;i++){
		scanf("%d%d%d",S+i,T+i,X+i);
		z[i*2]=S[i]-X[i];
		z[i*2+1]=T[i]-X[i];
	}
	z[a*2]=-mod;
	std::sort(z,z+a*2+1);
	for(int i=0;i<(1<<20);i++)segtree[i]=mod;
 
	for(int i=0;i<a;i++){
		int L=lower_bound(z,z+a*2+1,S[i]-X[i])-z;
		int R=lower_bound(z,z+a*2+1,T[i]-X[i])-z-1;
		update(0,524287,L,R,1,X[i]);
	//	printf("%d %d %d\n",L,R,X[i]);
	}
	for(int i=0;i<b;i++){
		int t;scanf("%d",&t);
		int at=upper_bound(z,z+a*2+1,t)-z-1;
	//	printf("%d\n",at);
		int ret=query(at);
		if(ret==mod)ret=-1;
		printf("%d\n",ret);
	}
}

Measured memory_bytes: 9856
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string.h>
#include <utility> 
#include <tuple>
#include <iterator>
#include <functional>
#include <numeric>
using namespace std;
#define rep(i,n) for(long i=0; i<n; i++)


void solve(){
  int n,a,b;
  cin >> n >> a >> b;
  cout << min(b, n*a) << endl;
}

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


Measured memory_bytes: 256
#include<cstdio>
void rotatez(int *dice) {
	int tmp = dice[1];
	dice[1] = dice[2];
	dice[2] = dice[4];
	dice[4] = dice[3];
	dice[3] = tmp;
}
void rotatex(int *dice) {
	int tmp = dice[0];
	dice[0] = dice[2];
	dice[2] = dice[5];
	dice[5] = dice[3];
	dice[3] = tmp;
}
void rotatey(int *dice) {
	int tmp = dice[0];
	dice[0] = dice[1];
	dice[1] = dice[5];
	dice[5] = dice[4];
	dice[4] = tmp;
}
bool equaldice(int *dice1, int *dice2) {
	for (int i = 0; i < 6; i++) {
		if (dice1[i] != dice2[i])return false;
	}
	return true;
}
bool samedice(int *dice1, int *dice2) {
	int i,j;
	for (i = 0; i < 4; i++) {
		if (equaldice(dice1, dice2))return true;
		rotatez(dice2);
	}
	rotatex(dice2);
	for (j = 0; j < 4; j++) {
		for (i = 0; i < 4; i++) {
			if (equaldice(dice1, dice2))return true;
			rotatez(dice2);
		}
		rotatey(dice2);
	}
	rotatex(dice2);
	for (i = 0; i < 4; i++) {
		if (equaldice(dice1, dice2))return true;
		rotatez(dice2);
	}
	return false;	
}
int main() {
	int n, dice[100][6], i, j;
	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		for (j = 0; j < 6; j++) {
			scanf("%d", &dice[i][j]);
		}
	}
	for (i = 0; i < n; i++) {
		for (j = i + 1; j < n; j++) {
			if (samedice(dice[i], dice[j])) {
				printf("No\n");
				return 0;
			}
		}
	}
	printf("Yes\n");
	return 0;
}


Measured memory_bytes: 2688
<?php
$N = (int)trim(fgets(STDIN));
//$S = trim(fgets(STDIN));
//list($N,$X,$T) = array_map('intval',explode(" ",trim(fgets(STDIN))));
$A = array_map('intval',explode(" ",trim(fgets(STDIN))));

$sum = 0;
for($i=1;$i<$N;$i++) {
  if ($A[$i-1]>$A[$i]) {
    $dai =  $A[$i-1]-$A[$i];
    $A[$i]+=$dai;
    $sum+=$dai;

  }
}
printf("%d\n",$sum);


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

int n, a[1<<20];
long long ans;

int main() {
    cin >> n;
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n - 1; i++) {
        ans += 1LL*(a[i] / 2);
        if (a[i+1] != 0) a[i+1] += a[i] % 2;
    }
    ans += 1LL*a[n-1]/2;
    cout << ans;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<numeric>
using namespace std;
#define ll  long long
#define mp make_pair
#define fi first
#define se second
#define pii pair<ll,ll>
#define pb push_back
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define what_is(x) cerr << #x << " is " << x << endl;
#define mod 1000000007
#define max INT_MAX
int main()
{
    ll int n,total=0,i=1;
    cin >> n;
    while(total<n)
    {
        total += i;
        i++;
    }
    cout << i-1;
}

Measured memory_bytes: 256
x, n = input().split()

if (int(n)>0):
  add = 1
  count = 3
  p = list(map(int,input().split()))

  if (int(x) not in p):
    print(int(x))
    count=1


  while (count==3):
    count = 0
    for i in range(int(n)):
      if (abs(int(p[i])-int(x)) == add):
        count = count+1
    if (count==2):
        add = add+1
        count=3
    if (count==1):
      if (int(x)-add in p):
        print(int(x)+add)
      else:
        print(int(x)-add)
    if (count==0):
      print(int(x)-add)
else:
  print(int(x))

Measured memory_bytes: 9268
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

for i in range(1, 4):
    nums = [(abs(a - b)) ** i for a, b in zip(A,B)]
    print(sum(nums) ** (1/i))
    if i == 1:
        ans = max(nums)
print(ans)


Measured memory_bytes: 5648
/*
	Failure is not the reason for you to stop trying 
	   it is actually a remainder that you should 
			KEEP GOING 
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back 
#define eb emplace_back
#define fn for(int i =0 ;i <n;i++)
#define fn1 for( int i =1;i<=n;i++)
#define fm for(int j =0 ;j <m;j++)
#define fm1 for(int j =1;j<=m;j++)
#define fi first
#define se second
#define E endl
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
const int N = 1e6+5;
const int INF = 1e18L;
#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...);
}
int ar[N];
int dp[N];
signed main(){
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	IOS;
	int T=1;
	// cin >> T;
	while(T--){
		int n ,a;
		cin>>n>>a;
		int ans=0;
		fn1{
			cin >> ar[i];
			dp[i] = dp[i-1] + ar[i];
			if(dp[i]<=a)ans++;
		}
		cout<<ans+1;
	
	
	}
	
	cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
	return 0;
}

Measured memory_bytes: 2304
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		   Scanner scan = new Scanner(System.in);
		   int a = scan.nextInt();
		   int b = scan.nextInt();

		   int d = a/b;
		   int r = a%b;
		   double f = (a*1.0)/b;
		   
		   System.out.printf("%d %d %.5f\n",d,r,f);
	}

}






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

int INF = 1001001001;

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

  int n, k;
  cin >> n >> k;

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

  vector<int> dp(n, INF);

  dp[0] = 0;

  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= k && i + j < n; j++) {
      dp[i + j] = min(dp[i] + abs(h[i + j] - h[i]), dp[i + j]);
    }
  }

  cout << dp[n - 1] << endl;

  return 0;
}

Measured memory_bytes: 1024
//#pragma GCC optimize("Ofast")
//#pragma GCC target ("avx2")
//#pragma GCC optimization ("O3")
//#pragma GCC optimization ("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//typedef tree < int , null_type, less <int>, rb_tree_tag, tree_order_statistics_node_update> TREE;
#define ll long long
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define pss pair<short,short>
#define pld pair<long double,long double >
#define ld long double
#define piii  pair<pii,int>
#define vii vector<pair<int,int> >
#define st first
#define nd second
#define pll pair<ll,ll>
#define speed ios::sync_with_stdio(false);cin.tie();cout.tie();
#define M_PI 3.14159265358979323846
//#define int long long
const int mod=1000000007;
//const int mod=1009;
//const int mod=998244353;
const int inf=1000000009;
const long long INF=1000000000000000009;
const long long big=1000000000000000;
const long double eps=0.000000000000000000001;
using namespace std;
int T[200005];
int main()
{
    speed
    int n,k;
    cin>>n>>k;
    for(int i=1; i<=n; i++)
    {
        cin>>T[i];
        T[i]++;
    }
    ll suma=0;
    for(int i=1; i<=k; i++)
        suma+=T[i];
    ll aktual=suma;
    for(int i=k+1; i<=n; i++)
    {
        aktual+=T[i];
        aktual-=T[i-k];
        suma=max(suma,aktual);
    }
    cout.precision(6);
    cout<<fixed<<(ld)suma/2.0;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <fstream>
#include <cstdlib>
#include <math.h>
#include <utility>
#include <algorithm>
#include <functional>
#include <vector>
#include <numeric>
#include <bits/stdc++.h>
// #include <atcoder/all>

#define int long long

struct edge {
    int to;
    int cost;
};

using namespace std;
// using namespace atcoder;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vb = vector<bool>;
using qi = queue<int>;
using P = pair<int, int>;
using graph = vector<vector<edge>>;
// using graph = vector<vector<int>>;
// using mint = modint1000000007;


#define FOR(i, a, b) for (int i = a; i < (b); i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define delim(i, n) cout << (i == n-1 ? "\n" : " ")
#define print1(v) cout << fixed << setprecision(10) << v << "\n"
#define print2(v1, v2) cout << fixed << setprecision(10) << v1 << " " << v2 << "\n"
#define print3(v1, v2, v3) cout << fixed << setprecision(10) << v1 << " " << v2 << " " << v3 << "\n"
#define printvi(v, n) REP(iiii, n) { cout << v[iiii]; delim(iiii, n); }
#define printvii(v, h, w) REP(iiiii, h) { printvi(v[iiiii], w); }

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

const int inf = 1LL << 60;
// const int inf = 100000000;
const int mod = 1000000007;

const int maxn = 1e5+5;
int n, m;
vi color(3);

vi dx = {-1, 0, 0, 1};
vi dy = {0, -1, 1, 0};

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

    cin >> n;

    int ret = 1;
    REP(i, n) {
        int a; cin >> a;
        int cnt = 0;
        REP(j, 3) {
            if (color[j] == a) {
                if (cnt == 0) color[j]++;
                cnt++;
            }
        }
        ret *= cnt;
        ret %= mod;
    }
    
    print1(ret);
}

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

using namespace std;

const char en = '\n';
using  ll =          long long;
using ull = unsigned long long;

const int psumsize=1001;
int
psum_J[psumsize][psumsize],
psum_O[psumsize][psumsize],
psum_I[psumsize][psumsize];

int main(){
	ios::sync_with_stdio(false);cin.tie();
	
	int m,n,k;
	cin>>m>>n>>k;
	{
		for(int i=0;i<psumsize;i++){
			psum_J[i][0]=0;
			psum_J[0][i]=0;
			psum_O[i][0]=0;
			psum_O[0][i]=0;
			psum_I[i][0]=0;
			psum_I[0][i]=0;
		}

		string s;
		for(int i=1;i<=m;i++){
			cin>>s;
			for(int j=1;j<=n;j++){
				switch(s[j-1]){
					case 'J':
						psum_J[i][j]=1;
						break;
					case 'O':
						psum_O[i][j]=1;
						break;
					case 'I':
						psum_I[i][j]=1;
						break;
				}
				psum_J[i][j]+=psum_J[i][j-1];
				psum_O[i][j]+=psum_O[i][j-1];
				psum_I[i][j]+=psum_I[i][j-1];
			}
		}
		for(int i=1;i<=m;i++){
			for(int j=1;j<=n;j++){
				psum_J[i][j]+=psum_J[i-1][j];
				psum_O[i][j]+=psum_O[i-1][j];
				psum_I[i][j]+=psum_I[i-1][j];
			}
		}
	}

	int a,b,c,d;

	for(int i=0;i<k;i++){
		cin>>a>>b>>c>>d;
		a--;b--;
		cout
			<<psum_J[c][d]-psum_J[a][d]-psum_J[c][b]+psum_J[a][b]
			<<' '
			<<psum_O[c][d]-psum_O[a][d]-psum_O[c][b]+psum_O[a][b]
			<<' '
			<<psum_I[c][d]-psum_I[a][d]-psum_I[c][b]+psum_I[a][b]
			<<en;
	}


	return 0;
}

Measured memory_bytes: 14936
//Ace
#include<bits/stdc++.h>
using namespace std;
using in = long long;
using str = string;
using pi = pair<in,in>;
using vi = vector<in>;
#define F first
#define S second
#define pb push_back
#define rep(i,k,n) for (in i = k; i < n; ++i)
#define repr(i,k,n) for (in i = k; i >= n; --i)
#define sz(x) (in)x.size()
#define all(x) begin(x), end(x)
const int MOD = 1e9 + 7;

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

    in n,k,t;
    cin>>n>>k>>t;
    in temp = ceil((n*1.0)/k);
    cout<<temp*t;

    return 0 ;
}

Measured memory_bytes: 3760
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vec<T>>;

int main(){
    int W,D,N;
    cin >> W >> D >> N;
    vvec<int> ma(W,vec<int>(D,1000)),mi(W,vec<int>(D,-1000)),exist(W,vec<int>(D,0));
    vec<int> X(N),Y(N),Z(N);
    for(int i=0;i<N;i++){
        cin >> X[i] >> Y[i] >> Z[i];
        X[i]--; Y[i]--;
        exist[X[i]][Y[i]] = Z[i];
        for(int x=0;x<W;x++) for(int y=0;y<D;y++){
            int diff = abs(X[i]-x)+abs(Y[i]-y);
            ma[x][y] = min(ma[x][y],Z[i]+diff);
            mi[x][y] = max(mi[x][y],Z[i]-diff);
        }
    }
    bool ok = true;
    for(int x=0;x<W;x++) for(int y=0;y<D;y++) if(ma[x][y]<mi[x][y]) ok = false;
    for(int i=0;i<N;i++){
        if(Z[i]<mi[X[i]][Y[i]] || ma[X[i]][Y[i]]<Z[i]) ok = false;
    }
    if(!ok) cout << "No" << endl;
    else{
        int ans = 0;
        for(int x=0;x<W;x++) for(int y=0;y<D;y++){
            ans += (exist[x][y]? exist[x][y]:mi[x][y]);
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3176