akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <unistd.h>
#include <random>

using namespace std;
typedef long long int LL;
typedef long long int LLint;
typedef pair<int,int> intpair;
typedef pair<bool,bool> boolpair;
typedef pair<string,string> strpair;
typedef pair<LL,LL> LLpair;
typedef pair<double,double> doublepair;
typedef pair<float,float> floatpair;
typedef vector<int> intvector;
typedef vector<bool> boolvector;
typedef vector<string> strvector;
typedef vector<LL> LLvector;
typedef vector<double> doublevector;
typedef vector<float> floatvector;
#define wait(sec) usleep((sec) * 1000000)
#define ED return 0;
#define TEST cout << "OK" << endl;
#define UP(a,b) ((a+(b-1))/b)
#define SORT(vec) sort(vec.begin(),vec.end());
#define DOUBLECHANGE(count) cout << setprecision(count);
#define REV(vec) reverse(vec.begin(),vec.end());
#define ipow(x,y) LL(pow(x,y))
#define INF 999999999
const long long mod = 1000000007;

int main(){
//    random_device rnd;
//    mt19937 mt(rnd());
      cin.tie(0);
      ios::sync_with_stdio(false);
      int N;
      cin >> N;
      vector<int> H (N);
      for(int i = 0;i < N;i++){
          cin >> H[i];
      }

      vector<int> dp (N,INF);
      for(int i = 0;i < N;i++){
          if(i == 0)dp[i] = 0;
          else{
              if(i == 1)dp[i] = dp[i-1]+abs(H[i-1]-H[i]);
              else dp[i] = min(dp[i-2]+abs(H[i-2]-H[i]),dp[i-1]+abs(H[i-1]-H[i]));
          }
      }
      cout << dp[N-1] << endl;
}


Measured memory_bytes: 1024
N, A, B = map(int, input().split())
def solve():
    if A + B - 1 <= N and N <= A * B:
        if A == 1:
            return [i for i in range(N, 0, -1)]
        s = []
        q = (N - B) // (A - 1)
        r = (N - B) % (A - 1)
        if r == 0:
            q -= 1
            r = A - 1
        for i in range(B - q - 1):
            s.append(N - i)
        for i in range(r + 1):
            s.append(A * q + 1 + i)
        for i in range(q - 1, -1, -1):
            for j in range(A):
                s.append(A * i + j + 1)
        return s
    else:
        return [-1]
print(" ".join(map(str, solve())))


Measured memory_bytes: 33944
package main

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

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	inputArr := strings.Split(stdin.Text(), " ")
	numbers := make([]int, 3, 3)
	for i, v := range inputArr {
		numbers[i], _ = strconv.Atoi(v)
	}
	remainder := numbers[2] - (numbers[0] - numbers[1])
	if remainder >= 0 {
		fmt.Println(remainder)
	} else {
		fmt.Println(0)
	}
}


Measured memory_bytes: 640
import sys
def main():
    x, y = map(int, input().split())
    
    for i in range(0, x+1):
        for j in range(0, x-i+1):
            res = i * 2 + j * 4
            if y == res and i + j == x:
                print('Yes')
                sys.exit()
                
    print('No')

if __name__ == '__main__':
    main()
    

Measured memory_bytes: 9184
#include <cstdio>
#include <algorithm>
#include <utility>
#include <vector>
using namespace std;

typedef pair<int, int> P;
vector<P> t;

bool comp(P a,P b){
	if(a.first > b.first) return true;
	else if(a.first == b.first && a.second < b.second) return true;
	return false;
}

int main(){
	int n,h,m,s,ar,check;
	while(scanf("%d",&n),n){
		t.clear();
		ar = check = 0;
		for(int i = 0;i < n;++i){
			for(int j = 0;j < 2;++j){
				scanf("%d:%d:%d",&h,&m,&s);
				t.push_back(make_pair(h * 3600 + m * 60 + s, j));
			}
		}
		sort(t.begin(),t.end(),comp);
		reverse(t.begin(),t.end());
		vector<P>::iterator vit = t.begin();
		for(;vit != t.end();++vit){
			if((*vit).second == 0){
				if(ar == 0) ++check;
				else --ar;
			}
			else ++ar;
		}
		printf("%d\n",check);
	}
}

Measured memory_bytes: 1284
N, K = map(int, input().split())
A = list(map(int, input().split()))

Tin = 0
for i in range(len(A)):
  temp = A[i]
  for j in range(i+1, len(A)):
    if temp > A[j]:
      Tin += 1

Tinter = 0
B = [l for l in A]
B.extend(B)
for i in range(len(A)):
  temp = A[i]
  for j in range(len(A), len(A)*2):
    if temp > B[j]:
      Tinter += 1

ans = Tin * K + Tinter * K * (K - 1) // 2
print(ans % (10**9 + 7))

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n; cin>>n;
	map<int, int> M;
	rep(i, n){
		int temp; cin>>temp;
		M[temp] = i+1;
	}
	for(auto e:M){
		cout << e.se << " ";
	}
	cout << "\n";
	return 0;
}

Measured memory_bytes: 5504
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p){os<<"("<<p.first<<","<< p.second<<")";return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v){os<<"{";REP(i,(int)v.size()){if(i)os<<",";os<<v[i];}os<<"}";return os;}
template <typename T, size_t S> void printArray(const T (&array)[S]){for(auto val : array)std::cout << val << ", ";std::cout << "\n";}
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
//const int dx[4] = {1, 0, -1, 0};
//const int dy[4] = {0, 1, 0, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve(){
    ll a, b, c, x;
    cin >> a >> b >> c >> x;
    ll res = 0;
    for(ll i=0; i<=a; i++){
        for(ll j=0; j<=b; j++){
            for(ll k=0; k<=c; k++){
                ll yen = 500*i + 100*j + 50*k;
                if(yen == x) res++;
            }
        }
    }
    cout << res << endl;
}

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

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

int main() {
  int n;
  cin>>n;
  int a[25],b[25],c[25];
  rep(i,n) cin>>a[i];
  rep(i,n) cin>>b[i];
  rep(i,n-1) cin>>c[i];
  int ans=0;
  rep(i,n) {
    ans+=b[a[i]-1];
    if (i>0&&a[i]==a[i-1]+1) {
      ans+=c[a[i-1]-1];
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

int main() {
  int h1,m1,h2,m2,k;
  cin >> h1 >> m1 >> h2 >> m2 >> k;
  
  int time;
  time = (h2-h1)*60+m2-m1-k;
  
  
 cout << time <<endl;
}

Measured memory_bytes: 3632
import java.util.*;

public class Main {
public static void main(String[] args) {
		
		Scanner keyboard = new Scanner(System.in); 
		
		String S  = keyboard.next();
		
		S = S.replace('A', '#');
		S = S.replace('T', '#');
		S = S.replace('G', '#');
		S = S.replace('C', '#');
		S = S + "?"; 
		String[] Y = S.split("");
		
		int count = 0;
		int ans = 0;
		
		for(int i = 0; i<S.length(); i++){
			if(Y[i].equals("#")){
				count++;
			}else{
				ans = (count > ans) ? count : ans;
				count = 0;
					}
			}

		System.out.println(ans);
		keyboard.close();	
	}
}

Measured memory_bytes: 21716
package main

import (
	"fmt"
)

func main() {
	contest_abc := "ABC"
	contest_arc := "ARC"

	var s string

	fmt.Scan(&s)

	if contest_abc == s {
		fmt.Println(contest_arc)
	} else if contest_arc == s {
		fmt.Println(contest_abc)
	}
}

Measured memory_bytes: 1752
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    // 入力
    int N, Q;
    cin >> N >> Q;
    string S;
    cin >> S;
    
    //累積和用の配列を作る
    vector<int> AC_count(S.size() + 1);
    
    //配列に値を代入する
    for(int i = 0; i < S.size(); i++){
        int AC = 0;
        if (S[i] == 'A' && S[i + 1] == 'C') AC++;
        AC_count[i + 1] = AC_count[i] + AC; 
    }
    
    //答えを出力する
    for(int i = 0; i < Q; i++){
        int l, r;
        cin >> l >> r;
        cout << AC_count[r - 1] - AC_count[l - 1] << endl;
    }
}

Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
const int maxn = 2e5+5;
typedef long long ll;

int main(){
	ll n; cin >> n;
	ll sum = 0;
	if(n & 1) cout << sum;
	else{
		n /= 2;
		while(n){
			n /= 5;
			sum += n;
		}
		cout << sum;
	}
}


Measured memory_bytes: 256
A, B, K = map(int, input().split())

if K*2 > (B-A+1):
    for i in range(A, B+1):
        print(i)
else:
    for j in range(A, A+K):
        print(j)
    for j in range(B-K+1, B+1):
        print(j)

Measured memory_bytes: 3060
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>
#include <map>
#include <unordered_map>
#include <bitset>
#include <numeric>
#include <unordered_set>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <numeric>
#include <cstdlib>
#include <random>


using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;

const ll mod = 1000000007ll;
const ll inf = 1000000000000000ll;

int main() {
	ll L, R;
	cin >> L >> R;
	ll ans = inf;
	if (R - L >= 2018) {
		cout << 0 << endl;
		return 0;
	}
	L %= 2019;
	R %= 2019;
	for (ll i = L; i < R; i++) {
		for (ll j = L+1; j <= R; j++) {
			ll tmp = (i * j) % 2019;
			ans = min(ans, tmp);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
import java.util.Scanner;

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

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] u = new int[M];
        int[] v = new int[M];
        for (int i = 0; i < M; ++i) {
            u[i] = sc.nextInt() - 1;
            v[i] = sc.nextInt() - 1;
        }
        int S = sc.nextInt() - 1;
        int T = sc.nextInt() - 1;

        System.out.println(solve(N, u, v, S, T));

        sc.close();
    }

    static int solve(int N, int[] u, int[] v, int S, int T) {
        @SuppressWarnings("unchecked")
        List<Integer>[] adjLists = new List[N];
        for (int i = 0; i < adjLists.length; ++i) {
            adjLists[i] = new ArrayList<>();
        }

        for (int i = 0; i < u.length; ++i) {
            adjLists[u[i]].add(v[i]);
        }

        int[][] distances = new int[N][3];
        for (int i = 0; i < distances.length; ++i) {
            Arrays.fill(distances[i], -1);
        }
        distances[S][0] = 0;

        Queue<Element> queue = new LinkedList<>();
        queue.offer(new Element(S, 0));

        while (!queue.isEmpty()) {
            Element head = queue.poll();
            if (head.node == T && head.seq == 0) {
                return distances[T][0];
            }

            int nextSeq = (head.seq + 1) % 3;
            int nextDistance = distances[head.node][head.seq] + ((nextSeq == 0) ? 1 : 0);
            for (int adj : adjLists[head.node]) {
                if (distances[adj][nextSeq] == -1) {
                    distances[adj][nextSeq] = nextDistance;
                    queue.offer(new Element(adj, nextSeq));
                }
            }
        }

        return -1;
    }
}

class Element {
    int node;
    int seq;

    Element(int node, int seq) {
        this.node = node;
        this.seq = seq;
    }
}

Measured memory_bytes: 74276
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep2(i, a, n) for(ll i = a; i < (ll)(n); i++)
#define memi cout << endl
#define kono(n) cout << fixed << setprecision(n)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define hina cout << ' '
#define in(n) cin >> n
#define in2(n, m) cin >> n >> m
#define in3(n, m, l) cin >> n >> m >> l
#define out(n) cout << n
const ll mei = (ll)1e9 + 7;

int main(){
  ll a, b, c, n;
  bool k = true;
  in(n);
  vector<ll> t(n + 1), x(n + 1), y(n + 1);
  rep(i, n)
    in3(t[i + 1], x[i + 1], y[i + 1]);
  rep(i, n){
    if(t[i + 1] - t[i] < abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i]))
      k = false;
    if((t[i + 1] - t[i]) % 2 != (abs(x[i + 1] - x[i]) + abs(y[i + 1] - y[i])) % 2)
      k = false;
  }
  if(k)
    out("Yes");
  else
    out("No");
  memi;
}

Measured memory_bytes: 2560
#include<stdio.h>
#define MAX 10000
#define NIL -1

typedef struct{
  int parent;
  int left;
  int right;
}Node;

Node T[MAX];
int n,D[MAX],H[MAX];

void setDepth(int i,int c){
  if(i==NIL)return;
  D[i]=c;
  setDepth(T[i].left,c+1);
  setDepth(T[i].right,c+1);
}

int setHeight(int i){
  int h1=0,h2=0;
  if(T[i].left!=NIL)h1=setHeight(T[i].left)+1;
  if(T[i].right!=NIL)h2=setHeight(T[i].right)+1;
  return H[i]=(h1>h2?h1:h2);
}

int getSibling(int i){
  if(T[i].parent==NIL)return NIL;
  if(T[T[i].parent].left!=i && T[T[i].parent].left!=NIL)
    return T[T[i].parent].left;
  if(T[T[i].parent].right!=i && T[T[i].parent].right!=NIL)
    return T[T[i].parent].right;
  return NIL;
}

void display(int i){
  printf("node %d: ",i);
  printf("parent = %d, ",T[i].parent);
  printf("sibling = %d, ",getSibling(i));
  int deg=0;
  if(T[i].left != NIL)deg++;
  if(T[i].right != NIL)deg++;
  printf("degree = %d, ",deg);
  printf("depth = %d, ",D[i]);
  printf("height = %d, ",H[i]);

  if(T[i].parent==NIL)printf("root\n");
  else if(T[i].left==NIL && T[i].right==NIL)printf("leaf\n");
  else {printf("internal node\n");}
}

int main(){
  int v,l,r,i,root=0;
  scanf("%d",&n);

  for(i=0;i<n;i++)T[i].parent=NIL;

  for(i=0;i<n;i++){
    scanf("%d %d %d",&v,&l,&r);
    T[v].left=l;
    T[v].right=r;
    if(l!=NIL)T[l].parent=v;
    if(r!=NIL)T[r].parent=v;
  }

  for(i=0;i<n;i++)if(T[i].parent==NIL)root=i;

  setDepth(root,0);
  setHeight(root);

  for(i=0;i<n;i++)display(i);

  return 0;

}


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

// iterator
#define REP(i,from, to) for(lli i=from;i<to;i++)
#define REPE(i,from, to) for(lli i=from;i<=to;i++)
#define REP_R(i,from, to) for(lli i=from;i>to;i--)
#define REPE_R(i,from, to) for(lli i=from;i>=to;i--)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;
typedef vector<lli> vlli;

int main() {
    lli n, k;
    cin2(n,k);
    lli x[n];
    ncin1(n,x);
    lli pos_start=n;
    REP(i,0,n) {
        if (x[i] >= 0) {
            pos_start = i;
            break;
        }
    }

    lli ans = LLONG_MAX;
    REPE(i,0,n-k) {
        if (i < pos_start && pos_start <= i+k-1) {
            lli a = -x[i];
            lli b = x[i+k-1];
            //cout3(i,i+k-1, a+b+min(a,b));
            ans = min(ans, a+b+min(a,b));
        }
        else if (pos_start <= i) {
            //cout3(i,i+k-1, x[i+k-1]);
            ans = min(ans,x[i+k-1]);
        }
        else {
            //cout3(i,i+k-1, -x[i]);
            ans = min(ans,-x[i]);

        }

    }
    cout << ans << endl;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
//using namespace __gnu_pbds; 

#define rep(i,a,b) for(ll i = (ll)(a); i < (ll)(b); i++)
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define trace(x) cout << #x << ": " << x << endl
#define all(x) (x).begin(), (x).end()
#define sz(x) (x).size()
#define fill(x,v) memset(x, v, sizeof(x))
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;

int main(){
  int n;
  cin >> n;
  int yes =  n/2;
  double rpta = 1.0 - (yes*1.0)/(n*1.0);
  cout << rpta << endl;
} 

Measured memory_bytes: 3696
#include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<(int64_t)N;i++)
typedef int64_t LL;
int main()
{
  int NG,OK,BASE;
  LL N,K,M,L=numeric_limits<LL>::min()/3,R=LLONG_MAX/3,count;
  bool minus;
  cin>>N>>K;
  vector<LL> A(N,0);
  rep(i,N)cin>>A.at(i);
  sort(A.begin(),A.end());
  while(R-L>1)
  {
    M=(L+R)/2,count=0;
    rep(i,N)
    {
      NG=i,OK=N;
      minus=(A.at(i)<0)?true:false;
      while(OK-NG>1)
      {
        BASE=(NG+OK)/2;
        if(A.at(i)*A.at(BASE)<=M)(minus)?OK=BASE:NG=BASE;
        else(minus)?NG=BASE:OK=BASE;
      }
      count+=(minus)?N-OK:NG-i;
    }
    (count<K)?L=M:R=M;
  }
  cout<<R<<endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <map>

using namespace std;

#define repd(i,a,b) for (int i=(a);i<(b);++i)
#define rep(i,n) repd(i,0,n)
typedef long long ll;


int main(){
  int x;
  cin >> x;
  int min_x = 0;
  int max_x = 0;
  while(min_x <= x){
    if(min_x <= x && x <= max_x){
      cout << 1 << endl;
      return 0;
    }
    min_x += 100;
    max_x += 105;
  }
  cout << 0 << endl;
  return 0;
}

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

typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define pi pair<int,int>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pair<int,int> >
#define vll vector<pair<int,int> >
#define pb push_back
#define mp make_pair
#define qi queue<int>

const ll mod=1e9+7;
#define MAX 100000

template<typename T> void max_self(T &x,T y) { x = max(x,y); }
template<typename T> void min_self(T &x,T y) { x = min(x,y); }

ll solve(ll a,ll b,ll c){

    if(b==0) return 1;
    else if(b%2==0) return solve(((a%c)*(a%c))%c,b/2,c)%c;
    else return ((a%c)*(solve(((a%c)*(a%c))%c,b/2,c)%c))%c;
}

int main(){

    std::ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n;
    cin>>n;

    int arr[n];
    FOR(i,0,n) cin>>arr[i];

    ll dp[n][n];

    for(int l = n-1;l>=0;l--){
        for(int r = l;r<n;r++){
            if(l == r) dp[l][r] = arr[l];
            else dp[l][r] = max(arr[l] - dp[l+1][r], arr[r] - dp[l][r-1]);
        }
    }

    cout<<dp[0][n-1];
    return 0;
}


Measured memory_bytes: 46464
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int range = Integer.parseInt(in.readLine());
		if (range < 0 || Math.pow(10, 4) < range)
			throw new RuntimeException("error:range");
		String[] nums = new String[range];
		nums = in.readLine().split(" ");
		int min = Integer.parseInt(nums[0]), max = Integer.parseInt(nums[0]);
		long sum = 0;
		for (int i = 0; i < range; i += 1) {
			max = Math.max(max, Integer.parseInt(nums[i]));
			min = Math.min(min, Integer.parseInt(nums[i]));
			if (Integer.parseInt(nums[i]) < -Math.pow(10, 6)
					|| Math.pow(10, 6) < Integer.parseInt(nums[i]))
				throw new RuntimeException("error:nums");
			sum = sum + Integer.parseInt(nums[i]);
		}
		System.out.println(min + " " + max + " " + sum);
	}
}

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

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

    int H = 0, H_prev = 0;
    bool flag = false;
    for (int i = 0; i < N; ++i) {
        if (i == 0) {
            std::cin >> H_prev;
            continue;
        }

        std::cin >> H;

        if (H < H_prev - 1) {
            std::cout << "No\n";
            return 0;
        } else if (H < H_prev) {
            if (flag) {
                std::cout << "No\n";
                return 0;
            } else {
                flag = true;
            }
        } else if (H_prev < H) {
            flag = false;
        }

        H_prev = H;
    }

    std::cout << "Yes\n";

    return 0;
}


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

using ll=long long;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#define REACH cerr<<"reached line "<<__LINE__<<endl
#define DBG(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl

using pii=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"[";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"]";
	return os;
}

int read(){
	int i;
	scanf("%lld",&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(int x,int suc=1){
	printf("%lld",x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341919];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341919];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(a>b)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

signed main(){
	int n=read();
	vi t;
	int s=0;
	REP(i,n){
		int x=read();
		t.PB(x);
		s+=x;
	}
	int m=read();
	REP(i,m){
		int p=read()-1,x=read();
		print(s-t[p]+x);
	}
}


Measured memory_bytes: 256
<?php
  declare(strict_types=1);

  $s = str_split(fgets(STDIN), 1);
  $idx_a = 110110110;
  $idx_z = 110110110;
  $i = 0;
  foreach ($s as $c)
  {
      if ($idx_a === 110110110 && $c == 'A')
      {
          $idx_a = $i;
      }
      else if ($c == 'Z')
      {
          $idx_z = $i;
      }

      $i++;
  }
  echo ($idx_z - $idx_a + 1).PHP_EOL;
?>


Measured memory_bytes: 15480
#include<iostream>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;
#define MAXN 10000+2
int topo[MAXN],n,m,t;
int c[MAXN];
vector<int> map1[MAXN];
void input(){
	cin>>n>>m;
	int xx,yy;
	for(int i=0;i<m;++i){
	    cin>>xx>>yy;
	    map1[xx].push_back(yy);
	}
}
void dfs(int u){
	c[u]=-1;
	for(int i=0;i<map1[u].size();++i){
		if(!c[map1[u][i]]) dfs(map1[u][i]);
	}
	c[u]=1;
	topo[--t]=u;
}
void jl(){
	t=n;
	for(int i=n-1;i>=0;--i){
		if(!c[i]) dfs(i);
	}
	for(int i=0;i<n-1;++i){
		cout<<topo[i]<<" ";
	}
	cout<<topo[n-1]<<endl;
}
int main(){
	input();
	jl();
	return 0;
}

Measured memory_bytes: 3680
#include <stdio.h>
#include <iostream>
#include <cstdio>
#include <algorithm>
#define swap(type, x, y) do{type temp = x; x = y; y = temp;}while(0);
using namespace std;

typedef struct {
    long long int num;
    int min[4];
    int sec[4];
    int sum;
}team;

void quick_sort(team x[], int left, int right);

int main(void) {
    int n;
    
    while(1) {
        scanf("%d", &n);
        if(n == 0) break;
        int i, j;
        team *p;
        p = (team *)calloc(n, sizeof(team));
        if(p == NULL) exit(0);
        
        for(i = 0; i < n; i++) {
            scanf("%lld", &p[i].num);
            for(j = 0; j < 4; j++)
                scanf("%d %d", &p[i].min[j] , &p[i].sec[j]);
        }
        for(i = 0; i < n; i++) {
            p[i].sum = 0;
            for(j = 0; j < 4; j++) {
                p[i].sum += (p[i].min[j] * 60) + p[i].sec[j];
            }
        }
        quick_sort(p, 0, n - 1);
        
        cout << p[0].num << endl << p[1].num << endl << p[n - 2].num << endl;
        free(p);
    }
    
    return(0);
}

void quick_sort(team x[], int left, int right) {
    int i, j;
    team pivot;
    i = left;
    j = right;
    
    pivot.sum = 0;
    pivot.sum += x[(left + right) / 2].sum;

    while(1) {
        while(x[i].sum < pivot.sum) i++;
        while(x[j].sum > pivot.sum) j--;
        
        if(i >= j) break;
        
        swap(team, x[i], x[j]);
        i++;
        j--;
        // DEBUG cout << "OK" << endl;     ここの時点では出力に”OK”と沢山表示される
    }
    
    if(i - 1 > left) quick_sort(x, left, i - 1);
    if(j + 1 < right) quick_sort(x, j + 1, right);
}

Measured memory_bytes: 1532
def main():
  N, K = (int(_) for _ in input().split())
  D = set(input().split())
  ret = 10 ** 10
  for a in range(10):
    for b in range(10):
      for c in range(10):
        for d in range(10):
          for e in range(10):
            cc = str(int(str(a) + str(b) + str(c) + str(d) + str(e)))
            for s in cc:
              if s in D:
                break
            else:
              if int(cc) >= N:
                ret = min(ret, int(cc))
  print(ret)
  return

if __name__ == '__main__':
  main()
    

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <stdio.h>
using namespace std;
 int main()
{
	string str;
	int count1 = 0;//1start
	int count2 = 0;//0start
	getline(cin,str);
	for (int i = 0; i < str.length(); ++i)
	{
		int color = str[i] - '0';
		if (color == (i % 2))
		{
			++count2;
		} else
		{
			++count1;
		}

	}

		if (count2 >= count1)
		{
			cout << count1 << endl;
		} else if ( count2 < count1)
		{
			cout << count2 << endl;
		}
	return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    int n,d,ans=0;
	cin>>n>>d;
	for(int i=0;i<n;i++){
		int a,b;
		cin>>a>>b;
		if(sqrt(a*a+b*b)<=d) ans++; 
	}
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3648
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int putint(char *string, int *ary){
    char *tp;
    int cnt = 0;
    tp = strtok(string, " ");
    
    ary[cnt] = atoi(tp);
    while (tp != NULL){
         tp = strtok(NULL, " ");
	  if (tp != NULL){
             cnt++;
             ary[cnt] = atoi(tp);  
          }
    }
    return cnt;
}

void print_ary(int *ary, int len){
    int i;
    for (i = 0; i < len; i++){
        printf("%d", ary[i]);
        if (i < len - 1) printf(" ");
    }
    printf("\n");
}

void sort(int *ary, int len, int n){
    int scope, i, buf;
    for (scope = 0; scope < len; scope++){
        buf = ary[scope];
        for (i = 0; i < scope; i++){
             if (ary[i] > buf){
                 buf = ary[i];
                 ary[i] = ary[scope];
                 ary[scope] = buf; 
               }
         }
        if (scope < n){
            print_ary(ary, len);
         }
    } 
}

int main(void){
    int ary[100];
    int n;
    scanf("%d", &n);
    for (int i=0;i<n;i++)scanf("%d",&ary[i]);
    sort(ary, n, n);
    return 0;
}


Measured memory_bytes: 2036
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#define MAXN 18
int n, a[1 << MAXN], f[1 << MAXN][2];
inline void upMax(int x, int v) {
	if (v >= f[x][0])
		f[x][1] = f[x][0], f[x][0] = v;
	else if (v >= f[x][1])
		f[x][1] = v;
}
inline void up(int x, int y) {
	upMax(y, f[x][0]);
	upMax(y, f[x][1]);
}
int main() {
	scanf("%d", &n);
	for (int i = 0; i < (1 << n); i++) scanf("%d", &a[i]), f[i][0] = a[i];
	for (int i = 0; i < n; i++) {
		for (int d = 0; d < (1 << n); d++)
			if (!((d >> i) & 1)) up(d, d | (1 << i));
	}
	for (int i = 1, max = 0; i < (1 << n); i++) {
		max = std::max(max, f[i][0] + f[i][1]);
		printf("%d\n", max);
	}
	return 0;
}

Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define repp(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define repm(i,n) for(int (i)=(n);(i)>=0;(i)--)
typedef long long lint;

int main(){
  lint N,M,s;
  cin >>N>>M;
  s=((N-M)*100+M*1900)*pow(2,M);
  cout <<s;

 }



  


Measured memory_bytes: 256
#include<cstdio>
using namespace std;
#define R for(i=0;i++<n;)
#define S(s) scanf("%d",&s);
#define P(x) R printf("%d%c",x[i-1],i<n?32:10);
#define N 20000
int a[N],b[N],n,i,p;int main(void){S(n)R a[i-1]=b[n-i]=i*N;R{S(p)a[--p]+=i,b[p]+=i;}P(a)P(b)}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define repr(i,k,n) for(int i = (k); i < (n); i++)
#define rep(i,n) repr(i,0,n)
#define ALL(a) begin(a),end(a)
const int INF = 114514810;
const int MOD = 1000000007;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
  }
}
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N,i;
	cin >> N >> i;
	cout << N-i+1 << endl;
}

Measured memory_bytes: 256
from fractions import gcd
import math
import sys
N = int(input())
T = []
A = []
for n in range(N):
    t, a = map(int, input().split())
    T.append(t)
    A.append(a)

if N == 1:
    ans = T[N - 1] + A[N - 1]
    print(ans)
    sys.exit()

for n in range(1, N):
    tmp_a = -(-A[n - 1] // A[n])
    tmp_t = -(-T[n - 1] // T[n])
    if A[n - 1] <= A[n] and T[n - 1] <= T[n]:
        continue
    elif A[n - 1] > A[n] and T[n - 1] <= T[n]:
        A[n] = tmp_a * A[n]
        T[n] = tmp_a * T[n]
    elif A[n - 1] <= A[n] and T[n - 1] > T[n]:
        A[n] = tmp_t * A[n]
        T[n] = tmp_t * T[n]
    elif A[n - 1] > A[n] and T[n - 1] > T[n]:
        if tmp_a * T[n] >= T[n - 1]:
            T[n] = tmp_a * T[n]
            A[n] = tmp_a * A[n]
        elif tmp_t * A[n] >= A[n - 1]:
            T[n] = tmp_t * T[n]
            A[n] = tmp_t * A[n]
print(T[N - 1] + A[N - 1])




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

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] d = new int[n];
        for(int i = 0;i<n;i++){
            d[i] = sc.nextInt();
        }
        int result = 0;
        for(int i = 0;i<(n-1);i++){
            for(int j = (i+1);j<n;j++){
                result += (d[i]*d[j]);
            }
        }
        System.out.println(result);
        sc.close();
    }
}

Measured memory_bytes: 22868
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main(){
    int n, m; cin >> n >> m;
    vector<int> a(m);
    vector<ll> dp(n+1, -1);  
    for(int i=0; i<m; ++i){
        cin >> a[i]; dp[a[i]] = 0;
    }
    for(int i=0; i<m-1; ++i){
        for(int j=i+1; j<m; ++j){
            if(abs(a[i]-a[j])==1){
                cout << 0 << endl; return 0;
            }
        }
    }
    dp[0] = 1; dp[1] = 1;
    for(int i=0; i<m; ++i){
        if(a[i]==1){dp[1]=0;}
    }
    for(int i=0; i<n-1; ++i){
        if(dp[i+2]==0){continue;}
        dp[i+2] = (dp[i+1] + dp[i])%mod;
    }
    cout << dp[n] << endl;
    return 0;
}

Measured memory_bytes: 4320
package main

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

func StdInInt() int {
	var N int
	fmt.Scan(&N)
	return N
}

func SliceAtoi(sa []string) ([]int, error) {
	si := make([]int, 0, len(sa))
	for _, a := range sa {
		i, err := strconv.Atoi(a)
		if err != nil {
			return si, err
		}
		si = append(si, i)
	}
	return si, nil
}

func StdInNumSlice() []int {
	scanner := bufio.NewScanner(os.Stdin)
	buf := make([]byte, 10000)
	scanner.Buffer(buf, 10000000)
	scanner.Scan()
	stringInput := scanner.Text()
	A, _ := SliceAtoi(strings.Split(stringInput, " "))
	return A
}

func CountingSort(A []int, B []int, k int, n int) {
	// 0以上k以下の値を格納する配列を作成
	var C []int = make([]int, k+1)
	// 各要素の数を数える
	for i := 0; i < n; i++ {
		C[A[i]]++
	}
	// C[i]にi以下の出現数を記録する
	for i := 1; i < k; i++ {
		C[i] = C[i] + C[i-1]
	}
	// Cが指すindexにAを挿入していく
	for i := n - 1; i >= 0; i-- {
		B[C[A[i]]-1] = A[i]
		C[A[i]]--
	}
}

func StdOutList(list *[]int) {
	str := fmt.Sprintf("%v", *list)
	str = strings.Trim(str, "[]")
	fmt.Println(str)
}

var MaxNum = 10000

func main() {
	N := StdInInt()
	A := StdInNumSlice()
	var B []int = make([]int, N)
	CountingSort(A, B, MaxNum, N)
	StdOutList(&B)
}



Measured memory_bytes: 111364
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n,W;
    cin>>n>>W;
    long long v[n],w[n];
    for(int i=0;i<n;i++){
        cin>>w[i]>>v[i];
    }
    long long dp[n+1][W+1];
    for(int i=0;i<n+1;i++){
        for(int j=0;j<W+1;j++){
            dp[i][j] = 0;
        }
    }
    for(int i=1;i<n+1;i++){
        for(int j=1;j<W+1;j++){
            //cout<<dp[i][j]<<" "<<i<<" "<<"i"<<" "<<j<<"j before"<<endl;
            //cout<<w[i]<<" weight "<<v[i]<<" value "<<endl;
            if(j-w[i-1]>=0){
            dp[i][j] = max(dp[i][j],max(dp[i-1][j-w[i-1]]+v[i-1],dp[i][j-1]));
                dp[i][j] = max(dp[i][j],dp[i-1][j]);
            }
            else{
                dp[i][j]=max(dp[i][j],dp[i][j-1]);
                dp[i][j]=max(dp[i][j],dp[i-1][j]);
            }
            //cout<<dp[i][j]<<" "<<i<<" "<<"i"<<" "<<j<<"j"<<endl;
        }
    }
    /*for(int i=0;i<n+1;i++){
        for(int j=0;j<W+1;j++){
            cout<<dp[i][j]<<" ";
        }
        cout<<endl;
    }*/
    cout<<dp[n][W]<<'\n';
    return 0;
}


Measured memory_bytes: 79232
#include <iostream>
#include <fstream>
#include <cstdio>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <iomanip>
#include <cassert>
#include <random>
using namespace std;

#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define pb push_back
#define FOR(i, n) for(int i = 0; i < (n); i++)
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

const int mod = 1e9 + 7;
const int mod2 = 998244353;

void fact_init(int n);
ll exp(ll taban, ll us, ll md);
ll ebob(ll a, ll b);
ll ekok(ll a, ll b);
ll komb(ll a, ll b);

vector<ll> fact;
vector<ll> inv_fact;
void fact_init(int n){
    fact.resize(n+5);
    inv_fact.resize(n+5);
    fact[0] = inv_fact[0] = 1;
    for(int i = 1; i <= n; i++){
        fact[i] = (fact[i-1] * i) % mod;
        inv_fact[i] = exp(fact[i], mod-2, mod);
    }
}
ll exp(ll taban, ll us, ll md) {
    ll carpan = taban % md;
    if(carpan == 0) return 0;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % md;
        temp /= 2;
        carpan = (carpan*carpan) % md;
    }
    return res;
}
 
ll ebob(ll a, ll b){
    if(!a)return b;
    return ebob(b%a, a);
}

ll ekok(ll a, ll b){
    return (a*b)/ebob(a, b);
}

ll komb(ll a, ll b){
    if(a < b) return 0;
    return fact[a] * (inv_fact[a-b] * inv_fact[b] % mod) % mod;
}
const int N = 3e5 + 5;

int main(){
    ios::sync_with_stdio(false); cin.tie(NULL);
	int x; cin>>x;
	cout<<(!x)<<"\n";
}

Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i--)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  ll a,b,n;
  cin>>a>>b>>n;
  ll m = min(b-1,n);
  ll ans = a*m/b;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
typedef long long int LL;
typedef unsigned long long int ULL;
using namespace std;

// 插入此處

int a[100005];

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    sort(a, a + n);
    if (a[n - 1] - a[0] > 1) {
        printf("No\n");
    } else if (a[n - 1] == a[0]) {
        if (n >= a[0] * 2 || n == a[0] + 1) {
            printf("Yes\n");
        } else {
            printf("No\n");
        }
    } else if (a[n - 1] == a[0] + 1) {
        int sin = lower_bound(a, a + n, a[n - 1]) - a;
        int multi = a[n - 1] - sin;
        if (multi > 0 && sin + multi * 2 <= n) {
            printf("Yes\n");
        } else {
            printf("No\n");
        }
    }
}


Measured memory_bytes: 3948
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(auto i = (a); i < (b); i++)
#define pb push_back
#define fs first
#define sc second
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> vvii;

const double EPS = 1e-9;

struct union_find {
  vi p; union_find(int n) : p(n, -1) { }
  int find(int x) { return p[x] < 0 ? x : p[x] = find(p[x]); }
  bool unite(int x, int y) {
    int xp = find(x), yp = find(y);
    if (xp == yp) return false;
    if (p[xp] > p[yp]) swap(xp,yp);
    p[xp] += p[yp], p[yp] = xp;
    return true; }
  int size(int x) { return -p[find(x)]; } };



typedef vector<pair<ii,int>> viii;



int main() {
    cin.sync_with_stdio(false);
    int n;
    cin >> n;
    viii A(n);
    rep(i,0,n) {
        cin >> A[i].fs.fs >> A[i].fs.sc;
        A[i].fs.sc--;
        A[i].fs.fs--;
        A[i].sc = i;
    }
    sort(A.begin(), A.end());
    union_find un(n);
    priority_queue<ii,vector<ii>,greater<ii>> pq;
    rep(i,0,n) {
        int x = A[i].fs.fs;
        int y = A[i].fs.sc;
        int pos = A[i].sc;
        int min_y = y;
        while(!pq.empty()) {
            ii p = pq.top();
            if(p.fs < y) {
                min_y = min(min_y, p.fs);
                un.unite(pos, p.sc);
                pq.pop();
            } else break;
        }
        pq.push(ii(min_y, pos));
    }
    rep(i,0,n) {
        cout << un.size(i) << endl;
    }
}





Measured memory_bytes: 6604
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <cctype>
#define len length()
#define sz size()
#define rng(i, a, b) for(int i = a; i < b; i++)
#define rep(i, n) rng(i, 0, n)
#define srt(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define vi(a, n) vector<int> a(n)
#define vs(a, n) vector<string> a(n)
#define vc(a, n) vector<char> a(n)
#define psb(a) push_back(a)
#define ppb pop_back()
#define erc(S, i) S.erase(S.begin() + i)
#define ers(S, i, j) S.erase(S.begin() + i, S.begin() + j)
#define sp(n) cout << setprecision(n) << fixed
#define fst(s) s.at(0)
#define lst(s) s.at(s.len - 1)
typedef long long ll;
using namespace std;
int mod = 1000000007;

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    vector<ll> X(N);
    /*rep(i,N){
        int cnt = 0;
        rng(j,i,N+i){
            if(cnt % 2 == 0){
                X[i] += A[j % N];
            }
            else{
                X[i] -= A[j % N];
            }
            cnt++;
        }
    }*/
    int cnt = 0;
    rep(i,N){
        if(cnt % 2 == 0){
            X[0] += A[i % N];
        }
        else{
            X[0] -= A[i % N];
        }
        cnt++;
    }
    rng(i,1,N){
        X[i] = 2 * A[i-1] - X[i-1];
    }
    rep(i,N-1){
        cout << X[i] << " ";
    }
    cout << X[N-1] << endl;
    return 0;
}

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

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> a(n);
  int p;
  for(int i = 0; i < n; i++){
    cin >> a.at(i);
    if(a.at(i) == 1) p = i;
  }
  
  int ans = (n-2) / (k-1) + 1;
  
  cout << ans << endl;
}

Measured memory_bytes: 768
#B
N = int(input())
S = []
for i in range(N):
    S.append(input())
    
a=0
w=0
t=0
r=0

for i in S:
    if i=="AC":
        a+=1
    elif i=="WA":
        w+=1
    elif i=="TLE":
        t+=1
    elif i=="RE":
        r+=1
        
print(f"AC x {a}")
print(f"WA x {w}")
print(f"TLE x {t}")
print(f"RE x {r}")

Measured memory_bytes: 16324
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<double,double> pdd;
#define SQ(i) ((i)*(i))
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, j, k, in) for (int i=j ; i<k ; i+=in)
#define RFOR(i, j, k, in) for (int i=j ; i>=k ; i-=in)
#define REP(i, j) FOR(i, 0, j, 1)
#define REP1(i,j) FOR(i, 1, j+1, 1)
#define RREP(i, j) RFOR(i, j, 0, 1)
#define ALL(_a) _a.begin(),_a.end()
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define X first
#define Y second
#ifdef tmd
#define TIME(i) Timer i(#i)
#define debug(...) do{\
    fprintf(stderr,"%s - %d (%s) = ",__PRETTY_FUNCTION__,__LINE__,#__VA_ARGS__);\
    _do(__VA_ARGS__);\
}while(0)
template<typename T>void _do(T &&_x){cerr<<_x<<endl;}
template<typename T,typename ...S> void _do(T &&_x,S &&..._t){cerr<<_x<<" ,";_do(_t...);}
template<typename _a,typename _b> ostream& operator << (ostream &_s,const pair<_a,_b> &_p){return _s<<"("<<_p.X<<","<<_p.Y<<")";}
template<typename It> ostream& _OUTC(ostream &_s,It _ita,It _itb)
{
    _s<<"{";
    for(It _it=_ita;_it!=_itb;_it++)
    {
        _s<<(_it==_ita?"":",")<<*_it;
    }
    _s<<"}";
    return _s;
}
template<typename _a> ostream &operator << (ostream &_s,vector<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,set<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a> ostream &operator << (ostream &_s,deque<_a> &_c){return _OUTC(_s,ALL(_c));}
template<typename _a,typename _b> ostream &operator << (ostream &_s,map<_a,_b> &_c){return _OUTC(_s,ALL(_c));}
template<typename _t> void pary(_t _a,_t _b){_OUTC(cerr,_a,_b);cerr<<endl;}
#define IOS()
#else
#define TIME(i)
#define debug(...)
#define pary(...)
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
#endif
class Timer {
private:
    string scope_name;
    chrono::high_resolution_clock::time_point start_time;
public:
    Timer (string name) : scope_name(name) {
        start_time = chrono::high_resolution_clock::now();
    }
    ~Timer () {
        auto stop_time = chrono::high_resolution_clock::now();
        auto length = chrono::duration_cast<chrono::microseconds>(stop_time - start_time).count();
        double mlength = double(length) * 0.001;
        debug(scope_name, mlength);
    }
};

const ll MOD = 1000000007;
const ll INF = 0x3f3f3f3f3f3f3f3f;
const int iNF = 0x3f3f3f3f;
// const ll MAXN = 

string s;
/********** Good Luck :) **********/
int main()
{
    TIME(main);
    IOS();
    cin >> s;
    int cnt = 0;
    REP1 (i, SZ(s) - 1) {
        if (s[i] != s[i-1]) {
            cnt++;
        }
    }

    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 512
#include<algorithm>
#include<iostream>
#include<vector>
#include<cstdio>
#include<cstring>
using namespace std;
#define ll long long
//{{{ read()
inline ll read(){
	register ll x=0,f=1;
	register char ch=getchar();
	while(ch<'0'||ch>'9'){
		if(ch=='-')	f=-1;
		ch=getchar();
	}
	while(ch>='0'&&ch<='9')	x=x*10+(ch^48),ch=getchar();
	return x*f;
}
//}}}
const int N=2005;
const int M=4e6+5;
const int P=1e9+7;
ll fsp(ll x,int y=P-2){
	ll ans=1;
	while(y){
		if(y&1)	ans=ans*x%P;
		x=x*x%P,y>>=1;
	}
	return ans;
}
int n,k,m,f[N];
ll fac[M],inv[M];
ll C(int n,int m){
	if(n>M)	return 0;
	return fac[n]*inv[m]%P*inv[n-m]%P;
}
int main(){
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	n=read(),k=read(),m=n*k,fac[0]=1;
	if(k==1){
		puts("1");
		return 0;
	}
	for(int i=1;i<=m;i++) fac[i]=fac[i-1]*i%P;
	inv[m]=fsp(fac[m]);
	for(int i=m;i;i--) inv[i-1]=inv[i]*i%P;

	f[0]=1;
	for(int i=1;i<=n;i++){
		for(int j=i;j;j--)
			f[j]=(f[j-1]+f[j+1]*C(m-i-(k-1)*(i-j-1)-1,k-2))%P;
		f[0]=f[1]*C(m-i-(k-1)*(i-1)-1,k-2)%P;
	}
	printf("%lld\n",f[0]*fac[n]%P);
	return 0;
}


Measured memory_bytes: 66140
import java.util.*;
public class Main{

     public static void main(String []args){
        Scanner sc=new Scanner(System.in);
        String s=sc.next();
        String ans="";
        for(int i=0;i<s.length();i++){
            char c=s.charAt(i);
            int x=2*((int)'5')-(int)c;
            ans+=((char)x);
            
            
        }
      
        System.out.println(ans);
     }
}

Measured memory_bytes: 23124
#include <iostream>
#include <algorithm>
#include <string>
#include <numeric>
#include <vector>
#include <unordered_map>
#include <map>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <sstream>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(x) (x).begin(),(x).end()
#define sort_key(struct_name,key_name) [](const struct_name &x, const struct_name &y){return x.key_name < y.key_name;}
#define pb(x) push_back(x)
typedef long long ll;
const ll MOD = 1e9 + 7;
using namespace std;

//main
int main(){
  int N,Q; cin >> N >> Q;
  string S; cin >> S;
  vector<int> L(Q);
  vector<int> R(Q);
  vector<int> C(N);
  C[0] = 0;
  rep(i,Q){
    cin >> L[i] >> R[i];
  }
  for(int i=1; i<N; i++){
    if(S[i]=='C' && S[i-1]=='A'){
      C[i] = C[i-1]+1;
    }else{
      C[i] = C[i-1];
    }
  }
  rep(i,Q){
    cout << C[R[i]-1]-C[L[i]-1] << endl;
  }
}



Measured memory_bytes: 2176
#include <cstdio>
#include <cstring>
#include <string>
#include <iostream>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <time.h>

using namespace std;
typedef long long int ll;

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

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
 
#define sl(x) scanf("%ld", &x)
#define ss(x) scanf("%s", x)
#define pl(x) printf("%ld\n", x)
#define pd(x) printf("%lf\n", x)
#define ps(x) printf("%s\n", x)
 
#define INF 1000000000000000000
#define MOD 1000000007
 
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))

int main() {
	long N;
	long a[100001];
	long i, j;
	long ans = 0;
	long idx = 0;
	
	sl(N);
	ans = N / 11 * 2;
	
	if(N % 11 > 6) ans += 2;
	else if(N % 11 > 0) ans++;
	
	pl(ans);
	
	return 0;
}

Measured memory_bytes: 128
#input of int(split by space)
def get_i()
  return gets.chomp.split(" ").map(&:to_i)
end
#input of float(split by space)
def get_f()
  return gets.chomp.split(" ").map(&:to_f)
end
#input of string(split by space)
def get()
  return gets.chomp.split(" ")
end
#input of string(split per one character)
def get_nsp()
  return gets.chomp.split("")
end
#yes or no decision
def yn_judge(bool,y="Yes",n="No")
  return bool ? y : n 
end
#create of array
def array(size1,init=nil,size2=-1)
  if size2==-1
      return Array.new(size1){init}
  else
      return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end

def min(a,b)
    return a>b ? b : a
end

INF=Float::INFINITY

class UnionFindTree
    attr_accessor:par,:rank,:size
    def initialize(n)
        @par=Array.new(n){|i| i}
        @rank=array(n,0)
        @size=array(n,1)
    end

    def find(x)
        return x if @par[x]==x
        @par[x]=find(@par[x])
        return @par[x]
    end

    def union(x,y)
        x=find(x)
        y=find(y)
        return if x==y
        if @rank[x]<@rank[y]
            @par[x]=y
            @size[y]+=@size[x]
        else
            @par[y]=x
            @size[x]+=@size[y]
            @rank[x]+=1 if @rank[x]==@rank[y]
        end
    end

    def same?(x,y)
        return find(x)==find(y)
    end

    def size(x)
        return @size[x]
    end
end

N,M=get_i
uft=UnionFindTree.new(N)
M.times do|i|
    a,b=get_i.map{|x| x-=1}
    uft.union(a,b)
end
ans=0
N.times do|i|
    ans=max(ans,uft.size(i))
end
puts ans

Measured memory_bytes: 19020