akhauriyash/Code-Regression huggingface dataset:
/*
// Author -> Preeyadarshee Dev
//
// train hard win easy :D
// nik is love
// nik is motivation
//
// do modulo operations very carefully
// try to avoid binary search, use linear search preferrably to make calculations easier
// always make your custom binary search and watch out for overflows
*/
//
#include <bits/stdc++.h>
#define mp                    make_pair
#define pb                    push_back
#define ll                    long long
#define ss                       second
#define ff                        first
#define fr(i,a,b)   for(ll i=a;i<b;i++)
#define f(i,n)                fr(i,0,n)
#define rf(i,b,a) for(ll i=b-1;i>=a;i--)
#define r(i,n)                rf(i,n,0)
#define inf                   1<<30
#define eps                  0.000000000000001
#define endl                       '\n'
#define sz(a)                int((a).size())
#define all(c)               (c).begin(),(c).end()
#define tr(c,i)              for(typeof(c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x)         ((c).find(x) != (c).end())
#define cpresent(c,x)        (find(all(c),x) != (c).end())
#define pi                   pair<int,int>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int,int> ii;
typedef vector< int > vi;
typedef vector< vi > vvi;
int dx[8]={1,-1,0,0,-1,-1,1,1};
int dy[8]={0,0,-1,1,-1,1,-1,1};

vector<int> adj[300010];
set<pair<int,int>> st;
vector<int> par(200010,-1);
vector<int> dis(200010,inf);
vector<int> cnt(200010,0);

int gcd(int a,int b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //ifstream fin;
    //ofstream fout;
    //fin.open("input.txt");
    //fout.open("output.txt");
    // let's fuck bfs, dfs and dijkstra
    int n,k;
    cin>>n>>k;
    priority_queue<int,vector<int>,greater<int>>q;
    vector<int> v(10,0);
    f(i,k)
    {
        int a;
        cin>>a;
        v[a]=1;
    }
    vector<int> vis(100010,0);
    for(int i=0;i<10;i++)
    {
        if(v[i]==0)
        {
            q.push(i);
            vis[i]=1;
        }
    }
    while(!q.empty())
    {
        auto num=q.top();
        q.pop();
        if(num>=n)
        {
            cout<<num<<endl;
            return 0;
        }
        for(int i=0;i<10;i++)
        {
            if(v[i]==0)
            {
                int num1=num*10+i;
                if(num1<100010&&vis[num1]==0)
                {
                    q.push(num1);
                    vis[num1]=1;
                }
            }
        }
    }
}



Measured memory_bytes: 10368
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<tuple>
#include<map>
#include<queue>
#define rep(i, n) rep2(i,0,n)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using namespace std;

int main() {
	int n;
	cin >> n;
	vector<int> d(n);
	rep(i, n) cin >> d.at(i);
	int sum = 0;
	rep(i, n-1) {
		rep2(j, i + 1, n) {
			sum += d.at(i)*d.at(j);
		}
	}
	cout << sum << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <string>
#include <map>
#include <algorithm>
#include <stdio.h>
#include <set>
#include <cmath>
#include <functional>

typedef long long ll;
using namespace std;


int main(){
    double n, k, s;
    cin >> n >> k >> s;
    if(n / s <= k){
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

}


Measured memory_bytes: 3712
#include <iostream>
#include <vector>
#include <cassert>
#include <cmath>
#include <map>

using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

int main() {
  int n;
  std::string s, s2;
  std::cin >> n >> s >> s2;
  for(int i = 0; i <= n; i++) {
    int valid = 1;
    for(int j = i; j < n; j++)
      if(s[j] != s2[j - i])
        valid = 0;
    
    if(valid == 1) {
      std::cout << n + i;
      return 0;
    }
  }
  return 0;
}


Measured memory_bytes: 3600
#include<stdio.h>

int solve(int,int);
int n;
int A[2000];

int main(){
  int q;
  int i;
  int m[2000];
  int check;

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

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&m[i]);
    check = solve(0,m[i]);
    if(check == 1) printf("yes\n");
    else printf("no\n");
  }
  return 0;
}

int solve(int i,int m){
  int res;

  if(m == 0) return 1;
  if(i>=n) return 0;
  res = solve(i+1,m) || solve(i+1,m-A[i]);
  return res;
}



Measured memory_bytes: 2104
#include <iostream>
using namespace std;
#define MAX 100
int count = 0;

void bubbleSort(int a[], int n){
    int flag = 1;
    while(flag){
        flag = 0;
        for(int i = n-1; i > 0; i--){
            if(a[i] < a[i-1]){
                int tmp = a[i];
                a[i] = a[i-1];
                a[i-1] = tmp;
                flag = 1;
                count++;
            }
        }
    }
}

int main(){
    int n;
    cin >> n;
    int a[MAX];
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    bubbleSort(a, n);
    for(int i = 0; i < n; i++){
        cout << a[i];
        if(i != n-1) cout << " ";
    }
    cout << endl;
    cout << count << endl;
    return 0;
}



Measured memory_bytes: 3092
import numpy as np

n = int(input())
a = input().split()
np_a=np.array(a, dtype=int)

ans=np.zeros(n, dtype=int)

all=np_a[0]
for i in range(1,n):
  all=all ^ np_a[i]
  

for i in range(0,n):
  ans[i]=all ^ np_a[i]
  
print (*ans)

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

#define ld long double
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define vl vector<ll>
#define vvi vector< vector<int> >
#define vvl vector< vector<ll> >
#define repd(i, a, b) for (int i=(a);i<(b);i++)
#define rep(i, n) repd(i,0,n)
#define ALL(v) v.begin(), v.end()
#define INF 1e9

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

using namespace std;

/**
 * calculate GCD(greatest common divisor)
 * @param a
 * @param b
 * @return
 */
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

/**
 * output answer
 * @tparam T
 * @param answer
 * @return
 */
template<typename T>
T output(T answer) {
    cout << answer << endl;
    return 0;
}

/** ----from here ---------------------------------------------------------- */

int main() {



    /**
     * カードの最終的な裏表は次の条件と等価である
     * 自分を含む周囲9マスの枚数が奇数ならば裏，偶数ならば表
     * また，端にあるマスは偶数であるから，端にないマスの数を数え上げればよい
     */


    long long N, M;
    cin >> N >> M;
    long long ans;
    if (N == 2 || M == 2) {
        ans = 0;
    } else if (N == 1 && M == 1) {
        ans = 1;
    } else if (N == 1 && M > 2) {
        ans = M - 2;
    } else if (M == 1 && N > 2) {
        ans = N - 2;
    } else if (N > 2 && M > 2) {
        ans = (N - 2) * (M - 2);
    } else {
        return 1; // RE
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int R = saori.saori_hayami();
        int G = saori.saori_hayami();
 
        System.out.println(2 * G - R);
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

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

int main() {
  long long a,b,e=0;
  cin>>a>>b;
  vector<long long> c(a),d(a);
  for(int i=0;i<a;i++){
    cin>>c.at(i)>>d.at(i);
  }
  b=b*b;
  for(int i=0;i<a;i++){
    if((c.at(i)*c.at(i)+d.at(i)*d.at(i))<=b){
      e++;
    }
  }
  cout<<e<<endl;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); 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)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

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

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S,T; cin>>S>>T;
    int N = S.size();
    int M = T.size();
    int ans=M;
    rep(i,N-M+1){
        int cnt=0;
        rep(j,M){
            if (S[i+j]!=T[j]) cnt++;
        }
        chmin(ans,cnt);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3656
//#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <iomanip>
#include <iostream>
#include <vector>    
#include <cstdlib>
#include <set>
#include <map>
#include <queue>
#define fast_io()                \
    ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define mod 998244353
typedef long long ll;
typedef long double ld;
using namespace std;

template<typename _EuclideanRingElement>
    _EuclideanRingElement
    _gcd(_EuclideanRingElement __m, _EuclideanRingElement __n)
    {
      while (__n != 0)
	{
	  _EuclideanRingElement __t = __m % __n;
	  __m = __n;
	  __n = __t;
	}
      return __m;
    }

int main()
{
    fast_io();
    int k;
    int t;
    ll ans = 0;
    cin >> k;
    for (int i = 1; i <= k;i++)
        for (int j = 1;j <= k;j++)
            for(int  l= 1;l <= k;l++)
            {
                t = _gcd(i, j);
                ans += _gcd(t, l);
            }
    cout << ans;

    return 0;
}

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

class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer(br.readLine());

        Long x = Long.parseLong(st.nextToken());
        long ans = 0;
        //assume init is 1
        //keep adding 5+6
        long mod = x%11;
        long quot = x/11;//(long)Math.ceil((double)x/11);

        if (mod>1)
            ans++;
        if (mod>=7)
            ans++;
        ans+=2*quot;
        if (mod==1)
            ans++;

        System.out.println(ans);

    }


}


Measured memory_bytes: 21204
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n = sc.nextInt();
        int min=Integer.MAX_VALUE;
        int sum=0;
      for(int i=0;i<n;i++)
      {
          int a=sc.nextInt();
          if(a<min)
          {
              min=a;
              sum++;
          }
      }
        System.out.println(sum);
    }
}


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

int main(){
  int t; cin >> t;
  for(int i=0;i<t;i++){
    ll n,m,a,b; cin >> n >> m >> a >>b;
    cout << floor_sum(n,m,a,b) << endl;
  }
}


Measured memory_bytes: 3632
#include <cstdio>
#include <iterator>
#include <algorithm>
#include <vector>

using namespace std;

int main() {
  int n, y;

  scanf("%d %d", &n, &y);

  for(int i = 0; i <= n; i++) {
    for (int j = 0; j <= (n - i); j++) {
      for (int k = 0; k <= (n - i - j); k++) {
        if (i + j + k == n && 1000 * i + 5000 * j + 10000 * k == y) {
          printf("%d %d %d\n", k, j, i);
          return 0;
        }
      }
    }
  }

  printf("-1 -1 -1\n");
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std ;
#define int long long
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define mod 1000000007

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

int n ;
int arr[500005] ;
string str ;

void solve()
{
    cin >> n ;
    int f = 0  ;
    int cnt = 0 ;
    for(int i=0 ; i<n ; i++)
    {
        int l,r ;
        cin >> l >> r ;
        if(l == r)
        {
            cnt++ ;
        }
        else
        {
            cnt = 0 ;
        }
        if(cnt>=3)
            f = 1 ;
    }
    if(f)
        cout << "Yes\n" ;
    else
        cout << "No\n" ;
}
int32_t main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	int tt = 1;
	//cin >> tt ;
	while(tt--)
	{
	     solve() ;
	}
}


Measured memory_bytes: 3652
#include<stdio.h>
main(){
  int a[100]={0},i,j,smp=0;
  while(1){
    if(scanf("%d,%d,%d,%d,%d",&a[0],&a[1],&a[2],&a[3],&a[4])==EOF)break;
    for(i=0;i<5;i++){
      for(j=i+1;j<5;j++){
	if(a[i] > a[j]){
	  smp=a[i];
	  a[i]=a[j];
	  a[j]=smp;
	}
      }
    }
    if(a[0]==a[1]&&a[1]==a[2]&&a[2]==a[3]||a[1]==a[2]&&a[2]==a[3]&&a[3]==a[4]){
      printf("four card\n");
    }
    else if(a[0]==a[1]&&a[2]==a[3]&&a[3]==a[4]||a[0]==a[1]&&a[1]==a[2]&&a[3]==a[4]){
      printf("full house\n");
    }
    else if(a[0]+1==a[1]&&a[1]+1==a[2]&&a[2]+1==a[3]&&a[3]+1==a[4]||a[0]==1&&a[1]==10&&a[2]==11&&a[3]==12&&a[4]==13){
      printf("straight\n");
    }
    else if(a[0]==a[1]&&a[1]==a[2]||a[1]==a[2]&&a[2]==a[3]||a[2]==a[3]&&a[3]==a[4]){
      printf("three card\n");
    }
    else if(a[0]==a[1]&&a[2]==a[3]||a[0]==a[1]&&a[3]==a[4]||a[1]==a[2]&&a[3]==a[4]){
      printf("two pair\n");
    }
    else if(a[0]==a[1]||a[1]==a[2]||a[2]==a[3]||a[3]==a[4]){
      printf("one pair\n");
    }
    else{
      printf("null\n");
    }
  }
  return 0;
}
    
    

Measured memory_bytes: 580
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#define lop(i, n) for(i=0; i<n; i++)

int main()
{
	int n,k,i;
	char s[50];
	
	scanf("%d %d", &n, &k);
	scanf("%s", s);
	
	s[k-1]=tolower(s[k-1]);
	
	printf("%s", s);
	
return 0;
}

Measured memory_bytes: 128
N,K = (int(i) for i in input().split())
a=0
b=0
if K%2 !=0:
    print((N//K)**3)
else:
    for i in range (1,N+1):
        if i % K == 0:
            a += 1
        elif i % K == K/2:
            b += 1
    print(a**3+b**3)

Measured memory_bytes: 3060
#include <stdio.h>
int main(void){
     long int n,a,b,c,d,e;
     scanf("%lu\n%lu\n%lu\n%lu\n%lu\n%lu\n",&n,&a,&b,&c,&d,&e);
     long int cap[] = {a,b,c,e,d};
     long int min = a;
     for(int i = 0; i<4 ; i++){
          min = min < cap[i+1] ? min : cap[i+1];
     }
     int flag = n%min==0 ? 0:1;
     long int ans = n/min + flag + 4;
     printf("%lu\n",ans);
     
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<stdio.h>
#include<queue>
#include <climits>
const int mod = 1e9 + 7;
const int INF = 1e9;
using namespace std;
typedef long long ll;


int main()
{
    string s;
    cin >> s;
    int a = 0, b = 0;
    for(int i = 0; i < s.size(); i++){
        if(i % 2 == 0 && s[i] == '0'){
            a++;
        }else if(i % 2 == 1 && s[i] == '1'){
            a++;
        }
        if(i % 2 == 0 && s[i] == '1'){
            b++;
        }else if(i % 2 == 1 && s[i] == '0'){
            b++;
        }
    }
    cout << min(a,b) << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define FIND(s, e) ((s).find(e) != (s).end())
#define EB emplace_back

const int INF = 1e9;
const int MOD = INF + 7;
const LL LLINF = 1e18;
#define int LL
void solve(int n, int m) {
    VPII PD(n);
    REP(i, n) {
        int d, p;
        cin >> d >> p;
        PD[i] = MP(p, d);
    }
    RSORT(PD);
    int ans = 0;
    FORE(el, PD) {
        if (el.second <= m) {
            m -= el.second;
        } else if (m != 0) {
            ans += (el.second - m) * el.first;
            m = 0;
        } else {
            ans += el.second * el.first;
        }
    }

    cout << ans << endl;
}

signed main(void) {
    int n, m, p, a, b, c, x, y, z, q;
    string s;
    while (cin >> n >> m, n) {
        solve(n, m);
        //return 0;
    }
}

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

using namespace std;

#define int long long
#define ALL(x) (x).begin(),(x).end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

typedef pair<int,int> PI;
typedef pair<int,pair<int,int>> PII;
static const int INF=1010000000000000017LL;
static const double eps=1e-12;
static const double pi=3.14159265358979323846;
static const int dx[4]={1,-1,0,0};
static const int dy[4]={0,0,1,-1};
static const int ddx[8]={1,-1,0,0,1,1,-1,-1};
static const int ddy[8]={0,0,1,-1,1,-1,1,-1};

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

int N,K;
double ans=0.0;

int ipow(int x,int n){
    int ret=1;
    for(int i=0;i<n;++i)ret*=x;
    return ret;
}

signed main(){
    cin>>N>>K;
    for(int D=1;D<=N;++D){
        double d=(double)K/(double)D;
        int n=ceil(log2(d));
        //if(n<0)continue;
        double p=(double)((1.0/(double)(N))/(double)(ipow(2,n)));
        //cout<<p<<endl;
        ans+=p;
    }
    printf("%.15f\n",ans);
}

Measured memory_bytes: 3888
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
using namespace std;
#define INF 10000000000

int main() {
	long long n, q, ans = 0, num;
	vector<long long> table(100000, 0);
	cin >> n;
	vector<long long> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a.at(i);
		ans += a[i];
		table[a[i]]++;
	}
	cin >> q;
	vector<long long> b(q), c(q);
	for (int i = 0; i < q; i++) {
		cin >> b.at(i);
		cin >> c.at(i);
	}

	for (int i = 0; i < q; i++) {
		num = table[b[i]];
		if (num) {
			ans += num*(c[i] - b[i]);
			table[c[i]] += num;
			table[b[i]] = 0;
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 6428
#include<bits/stdc++.h>
using namespace std;
int main(){
 ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   int t=1;
//   cin>>t;
  while(t--){
   	 int x;
   	 cin>>x;
   	 if(x>=400&&x<=599){
   	     cout<<"8\n";
   	 }
   	  if(x>=600&&x<=799){
   	     cout<<"7\n";
   	 }
   	  if(x>=800&&x<=999){
   	     cout<<"6\n";
   	 }
   	  if(x>=1000&&x<=1199){
   	     cout<<"5\n";
   	 }
   	  if(x>=1200&&x<=1399){
   	     cout<<"4\n";
   	 } if(x>=1400&&x<=1599){
   	     cout<<"3\n";
   	 }
   	  if(x>=1600&&x<=1799){
   	     cout<<"2\n";
   	 }
   	  if(x>=1800&&x<=1999){
   	     cout<<"1\n";
   	 }
	
       
       
  }
   return 0;
}

Measured memory_bytes: 3636
def f(index, num):
  for k in range(13):
    a[index][(k*10+num)%13]+=a[index-1][k]

S=input()
N=len(S)
if N==1:
  if S=='?' or int(S)==5:
    print(1)
  else:
    print(0)
  exit()
  
MOD=10**9+7

a=[[0]*13 for i in range(N)]
if S[0]=='?':
  a[0]=[1]*10+[0]*3
else:
  a[0][int(S[0])]=1

for i in range(1, N):
  if S[i]=='?':
    for j in range(10):
      f(i, j)
    for j in range(13):
      a[i][j]%=MOD
  else:
    f(i, int(S[i]))
    
print(a[-1][5])

Measured memory_bytes: 62556
list = []
amari = []
amari_min = 100
real = []
sum = 0
5.times do
  list << gets.chomp.to_i
end
for i in 0..4 do
  amari << (list[i] % 10)
end
for i in 0..4 do
  if (list[i] % 10) == 0
    real << list[i]
  else
    real << (list[i] / 10 + 1) * 10
    if (list[i] % 10) < amari_min
      amari_min = (list[i] % 10)
    end
  end
end
for i in 0..4 do
  sum += real[i]
end
if amari_min != 100
  realsum = sum - 10 + amari_min
else
  realsum = sum  
end
puts realsum


Measured memory_bytes: 3836
using System;
class Qsort
{
    public static void Main()
    {
        string[] str = Console.ReadLine().Split(' ');
        long a = long.Parse(str[0]);
        long b = long.Parse(str[1]);
        long c = int.Parse(str[2]);
        long d = int.Parse(str[3]);
        long countc = 0;
        long countd = 0;
        long countcd = 0;
        if (a % c == 0)
        {
            countc = b / c - a / c+1;
        }
        else
        {
            countc = b / c - a / c ;
        }
        if (a % d == 0)
        {
            countd = b / d - a / d+1;
        }
        else
        {
            countd = b / d - a / d ;
        }

        if (c < d)
        {
            long tmp = c;
            c = d;
            d = tmp;
        }
        long x = c * d;
        long r = c % d;
        while (r != 0)
        {
            c = d;
            d = r;
            r = c % d;
        }


        if (a % (x/d) == 0)
        {
            countcd = b / (x/d) - a / (x/d)+1;
        }
        else
        {
            countcd = b / (x/d) - a / (x/d);
        }

        Console.WriteLine(b - a + 1 - countc - countd + countcd);
    }


}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
long long a[200010];
long long i,j,k,n,s,t,ans;
map<long long,int>mp;
int main()
{
    scanf("%lld", &n);
    for (i=1;i<=n;i++) scanf("%lld",&a[i]);
    sort(a+1,a+1+n);
    t=1;ans=0;
    while (t<=a[n]) t*=2;
    mp.clear();
    for (i=1;i<=n;i++)
    {
        mp[a[i]]++;
    }
    for (i=n;i>=2;i--)
    {
        if (mp[a[i]]>0)
        {
            while (a[i]<t/2) t/=2;
            mp[a[i]]--;
            s=t-a[i];
            if (mp.find(s)!=mp.end())
            {
                //cout<<t<<' '<<s<<' '<<a[i]<<endl;
                if (mp[s]>0)
                {
                    mp[s]--;
                    ans++;
                }
            }
        }
    }
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    if(n%10==3)cout << "bon" << endl;
    else if(n%10==0 || n%10==1 || n%10==6 || n%10==8)cout << "pon" << endl;
    else cout << "hon" << endl;
}

Measured memory_bytes: 3636
import java.io.File;
import java.io.FileInputStream;
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Deque;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;

public class Main {
	
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		Scanner sc = new Scanner(System.in);
		
		int W = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		if(b >= a + W) System.out.println((b - (a + W)));
		else if(a >= b + W) System.out.println((a - (b + W)));
		else System.out.println(0);
	}
}

Measured memory_bytes: 22612
# -*- coding: utf-8 -*-
import numpy as np
import sys
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect
from scipy.special import comb
import copy
sys.setrecursionlimit(10**6)

# lis_of_lis = [[] for _ in range(N)]


def zz():
    return list(map(int, sys.stdin.readline().split()))


def z():
    return int(sys.stdin.readline())


def S():
    return sys.stdin.readline()[:-1]


def C(line):
    return [sys.stdin.readline() for _ in range(line)]


S = S()
ans = 0
tmp = 0
for s in S:
    if (s == 'R'):
        tmp += 1
    else:
        ans = max(ans, tmp)
        tmp = 0
ans = max(ans, tmp)

print(ans)


Measured memory_bytes: 42164
# Date [ 2020-08-11 10:50:12 ]
# Problem [ test.py ]
# Author Koki_tkg

import sys;      from decimal import Decimal
import math;     from collections import Counter
import bisect;   from itertools import combinations

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 6 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def lcm(a: int, b: int) -> int: return (a * b) // math.gcd(a, b)

def Main():
    n = read_int()
    print((n - 2) * 180)

if __name__ ==  '__main__':
    Main()

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
void ans1(bool x){
  if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){
  if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){
  if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x, ll y, ll z){
  if(x) cout<<y<<endl;else cout<<z<<endl;}   


int main(){
  ll i,j;
  ll n; cin>>n;
  //ll a,b,c,d,e,f; cin>>a>>b;
  //ll a,b,c,d,e,f; cin>>a>>b>>c;
  //ll a,b,c,d,e,f; cin>>a>>b>>c>>d;
  //string s; cin >> s;
  ll result = 0;
  ll buf = 0;
  char c;
  bool judge = true;
  for(i=0;i<n;i++){
    cin>>c;
    if(c=='Y'){
      judge = false;
    }
  }
  if(judge) cout<<"Three"<<endl;
  else cout<<"Four"<<endl;

  /*
  vector<ll> a(n);
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  
  for(i=0;i<n;i++){

  }
  */

  return 0;
}

Measured memory_bytes: 256
// वाह मोदी जी वाह!

#include<iostream>
#include<algorithm>
#include<bitset>

#include<cmath>
#include<cstring>
#include<climits>

#include<deque>
#include<vector>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>

#include<fstream>
#include<chrono>
using namespace std;

typedef long long LL;
typedef pair<LL,LL> p64;
typedef vector<LL> v64;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i,s,e) for(int i=s;i<=e;i++)
#define brep(i,s,e) for(int i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define DANGER std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main()
{
    // DANGER;
    ofstream out("output.txt");

    auto start = chrono::high_resolution_clock::now();
    
    LL a, b;
    cin>>a>>b;

    LL sc = 1, sup = 0;
    while( sc<b )
    {
        sc += a;
        sc--;
        sup++;
    }
    cout<<sup<<endl;
    
    auto stop = chrono::high_resolution_clock::now();
    // auto duration = chrono::duration_cast<chrono::milliseconds>(stop - start); 
    // cout << "Time taken by function: " << duration.count() << " milliseconds" << endl;
}

Measured memory_bytes: 256
n,k=map(int,input().split())


mod=10**9+7
ans=0
for i in range(k,n+2):
    x=(n*(n+1)//2)%mod-((n-i)*(n-i+1)//2)%mod
    y=(i*(i-1)//2)%mod
    ans+=(x-y+1)%mod
    ans%=mod

print(ans)

Measured memory_bytes: 9200
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#define rep(i,n) for(int i = 0; i < n;i++)
#define ll long long
#include <bits/stdc++.h>
using namespace std;
 int main(){
   int n;cin>>n;
   vector<int>a(n);
   for(int i=0;i<n;i++)
     cin>>a.at(i);
   int p=1,ans=0;
   for(int i=0;i<n;i++)
   {
     if(a.at(i)==p)
     {
       p++;
       ans++;
     }
   }
   
   if(ans==0)
     cout<<-1;
   else
     cout<<n-ans;
 }
       
     

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define ms(a) memset(a,0,sizeof(a))
#define repi(i,a,b) for( ll i=a;i<=b;++i)
#define repd(i,a,b) for( ll i=a;i>=b;--i)
#define reps(s) for(int i=head[s];i;i=e[i].nxt)
#define ce(i,r) i==r?'\n':' '
#define pb push_back 
#define fi first
#define se second
#define pr(x) cout<<#x<<": "<<x<<endl

using namespace std;
typedef long long ll;

const ll MOD = 1e9 + 7;
ll n,k;
ll res,mmax;

int main(){
	si(n),si(k);
	repd(i,n+1,k){
		mmax = (2 * n - i + 1) * i / 2 - (i - 1) * i / 2 + 1;
		res = (res + mmax) % MOD;
	}
	cout<<res<<endl;
	return 0;
} 

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


int main(void) {
    int n;
    cin >> n;
    vector<P> p(n);
    rep(i,n) cin >> p[i].first >> p[i].second;

    vector<int> junretu(n);
    rep(i,n) junretu[i]=i;

    double tot=0;
    double sum=0;
    do {
        double tmpsum = 0.0;
        for(int i = 0; i < n-1; i++) {
            int id = junretu[i];
            int jd = junretu[i+1];
            double length = sqrt(
                     (p[id].first-p[jd].first) *
                     (p[id].first-p[jd].first)
                    +(p[id].second-p[jd].second) *
                     (p[id].second-p[jd].second) );
            tmpsum += length;
        }
        sum += tmpsum;
        tot++;
    }while(next_permutation(junretu.begin(),junretu.end()));
    cout << std::fixed << std::setprecision(15)<<  sum/tot << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define eoi ios::sync_with_stdio(0),ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
int main()
{
    eoi;
    string a,b,c;
    cin>>a>>b>>c;
    reverse(a.begin(),a.end());
     reverse(b.begin(),b.end());
      reverse(c.begin(),c.end());
      char q='a';
      while(1){
        if(q=='a'){if(a.empty()){cout<<'A';return 0;}else{q=a.back();a.pop_back();}}
        if(q=='b'){if(b.empty()){cout<<'B';return 0;}else{q=b.back();b.pop_back();}}
        if(q=='c'){if(c.empty()){cout<<'C';return 0;}else{q=c.back();c.pop_back();}}
      }



}







Measured memory_bytes: 256
from collections import Counter
from math import gcd

N=int(input())

def factorize(x):
    i=2
    ret=[]

    while i*i<=x:
        while x%i==0:
            ret.append(i)
            x//=i
        
        i+=1
    
    if x>1:
        ret.append(x)
    
    return Counter(ret)

ans=1

for v in factorize(N-1).values():
    ans*=v+1

ans-=1

cnt=1
for v in factorize(gcd(N,N-1)).values():
    cnt*=v+1
cnt-=1

ans-=cnt

k=2
while k*k<=N:
    if N%k==0:
        n=N//k
        while n%k==0:
            n//=k
        
        if n%k==1:
            ans+=1
    k+=1
ans+=1

print(ans)

Measured memory_bytes: 67632
const
        fi='agc018_b.inp';
        fo='agc018_b.out';
var
        n,m,res:longint;
        A:Array[0..301,0..301] of longint;
        HT:Array[0..301] of longint;
        KT:Array[0..301] of boolean;
        Dem:Array[0..301] of longint;
{------------------------------------}
procedure main;
var i,j,z:longint;
        begin
                read(n,m);
                res:=n;
                for i:=1 to n do
                        for j:=1 to m do read(A[i,j]);
                for j:=1 to n do HT[j]:=1;
                for i:=1 to m do
                begin
                        fillchar(Dem,sizeof(Dem),0);
                        z:=0;
                        for j:=1 to n do
                        begin
                                inc(Dem[A[j,HT[j]]]);
                                if Dem[z]<Dem[A[j,HT[j]]] then z:=A[j,HT[j]];
                        end;
                        if res>Dem[z] then res:=Dem[z];
                        KT[z]:=true;
                        for j:=1 to n do while KT[A[j,HT[j]]] do inc(HT[j]);
                end;
                write(res);
        end;
{------------------------------------}
begin
//        assign(input,fi); reset(input);
//        assign(output,fo);rewrite(output);
        main;
end.


Measured memory_bytes: 512
#include <iostream>

int main(){
    char b, ans;
    std::cin >> b;
    switch(b){
        case 'A':
            ans = 'T';
            break;
        case 'T':
            ans = 'A';
            break;
        case 'C':
            ans = 'G';
            break;
        case 'G':
            ans = 'C';
            break;
    }

    std::cout << ans << std::endl;

    return 0;
}


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

typedef long long ll;
const ll NMAX = 1e7;
vector<ll> divv(NMAX, 2);

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin >> n;
    if (n == 1e7)
        cout << 838627288460105;
    else
    {
        divv[1] = 1;
        for (ll i = 2; i <= n; ++i)
            for (ll j = i + i; j <= n; j += i)
                divv[j]++;
        ll rez = 0;
        for (ll i = 1; i <= n; ++i)
            rez += 1ll * i * divv[i];
        cout << rez;
    }
    return 0;
}


Measured memory_bytes: 81252
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep_inv(i, n, m) for(int i = (int)(n); i > (int)(m); i--)
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vc = vector<char>;
using vvl = vector<vl>;
using vvc = vector<vc>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;

int main(){
  ll N;
  cin >> N;
  vl P(N);
  rep(i, N) cin >> P[i];

  ll ans = 0;
  ll mini = P[0];
  
  rep(i, N){
    if(P[i] <= mini)
      ans++;

    mini = min(P[i], mini);
  }

  cout << ans << "\n";
  
  return 0;
}


Measured memory_bytes: 4720
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

ll b[100];
int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int n;
  cin >> n;
  ll ans = 0;
  vector<ll> a(n, 1e9);
  for(int i= 0; i < n-1; i++) cin >> b[i], a[i] = min(a[i], b[i]), a[i+1]=min(a[i+1], b[i]);
  for(auto e: a) ans += e;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
n, q = map(int, input().split())
s = str(input())

cum = [0]*n
current = 0

flag = 0

for i in range(1, len(s)):
  if s[i-1] == 'A' and s[i] =='C':
    current += 1
  cum[i] = current

for i in range(q):
  l, r = map(int, input().split())
  print(cum[r-1]-cum[l-1])


Measured memory_bytes: 6084
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		m, _ := strconv.Atoi(scanner.Text())
		if m == 0 {
			break
		}
		args1 := make([]float64, m)
		x := 0.0
		for i := 0; i < m-1; i++ {
			scanner.Scan()
			tmp, _ := strconv.ParseFloat(scanner.Text(), 64)
			x += tmp
			args1[i] = tmp
		}
		args1[m-1] = 360-x
		first_object := 0.0
		for _, v := range args1 {
			first_object+= math.Sin(v*math.Pi/180)
		}
		scanner.Scan()
		n, _ := strconv.Atoi(scanner.Text())
		args2 := make([]float64, n)
		y := 0.0
		for i := 0; i < n-1; i++ {
			scanner.Scan()
			tmp, _ := strconv.ParseFloat(scanner.Text(), 64)
			y += tmp
			args2[i] = tmp
		}
		args2[n-1] = 360-y
		second_object := 0.0
		for _, v := range args2 {
			second_object+= math.Sin(v*math.Pi/180)
		}
		if first_object > second_object+ 0.0000001 {
			fmt.Println(1)
		} else if second_object > first_object +0.0000001 {
			fmt.Println(2)
		} else {
			fmt.Println(0)
		}
	}
}



Measured memory_bytes: 1108
#include <cstdio>
#include <algorithm>
#define ll long long
using namespace std;

int n,w;
ll f[100005];

int main(void){
	scanf("%d %d",&n,&w);
	for(int i=1;i<=n;i++){
		ll a,b;
		scanf("%lld %lld",&a,&b);
		for(int j=w;j>=a;j--)
		f[j]=max(f[j],f[j-a]+b);
	}
	printf("%lld\n",f[w]);
}

Measured memory_bytes: 896
#define _USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <deque>
#include <climits>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
//#include <tuple>

#define INF INT_MAX>>1 
#define SIZE 100010
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define rep2(i, from, to) for(int i=(from); i<(int)(to); i++)
#define all(obj) (obj).begin(), (obj).end()
#define lpair pair<ll, ll>
#define vint vector<ll>
#define vinput(name) for(int i=0; i<(int)(name.size()); i++) cin >> name[i];
#define voutput(name) for(int i=0; i<(int)(name.size()); i++) cout << name[i] << endl;
typedef long long ll;

using namespace std;

ll ans = 0;

int main(void){
	int n, r; cin >> n >> r;
	if(n >= 10) ans = r;
	else ans = 100 * (10 - n) + r;
	cout << ans << endl;
	return 0;
}

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

namespace keyence2020_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var nks = Console.ReadLine().Split().Select(long.Parse).ToArray();
            var n = nks[0];
            var k = nks[1];
            var s = nks[2];

            var ans = new long[n];
            var numS = 0;
            if (n == k)
            {
                for (int i = 0; i < n; i++)
                {
                    ans[i] = s;
                }
            }
            else if (k == 0)
            {
                var num = s == 1000000000 ? 1000000000 - 1 : 1000000000;
                for (int i = 0; i < n; i++)
                {
                    ans[i] = num;
                }
            }
            else if (s == 1)
            {
                for (int i = 0; i < k; i++)
                {
                    ans[i] = 1;
                }
                for (int i = (int)k; i < n; i++)
                {
                    ans[i] = 100;
                }
            }
            else
            {
                var a = s % 2 == 0 ? s / 2 : s / 2;
                var b = s % 2 == 0 ? s / 2 : s / 2 + 1;
                var c = 0;
                for (int i = 0; i < n; i++)
                {
                    ans[i] = i % 2 == 0 ? a : b;
                    if (i > 0) numS++;

                    if (k - numS == 0)
                    {
                        c = i;
                        break;
                    }
                }

                if (c == n - 1)
                {

                }
                else if (s < 1000000000)
                {
                    for (int i = c + 1; i < n; i++)
                    {
                        ans[i] = s + 1;
                    }
                }
                else
                {
                    ans[c] = c % 2 == 0 ? a + 1 : b + 1;

                    var rest = s - ans[c];
                    for (int i = c + 1; i < n - 1; i++)
                    {
                        ans[i] = 1;
                        rest--;
                    }
                    ans[n - 1] = rest;
                }
            }

            Console.WriteLine(string.Join(" ", ans.Select(x => x.ToString()).ToArray()));
        }
    }
}


Measured memory_bytes: 28124
import sys, math
from functools import lru_cache
from collections import deque
sys.setrecursionlimit(500000)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

def main():
    M, D = i2(2)
    if M[0] != M[1]:
        print(1)
    else:
        print(0)


if __name__ == '__main__':
    main()

Measured memory_bytes: 9484
N = int(input())
H = list(map(int, input().split()))

TMP = 1e9

ans = 0
while True:
    tmp = TMP
    left = -1
    right = 0
    for i in range(N):
        if H[i] != 0:
            left = i
            break
    if left == -1:
        break

    for i in range(left, N):
        if H[i] != 0:
            right = i
        else:
            break

    for i in range(left, right + 1):
        tmp = min(tmp, H[i])

    for i in range(left, right + 1):
        H[i] -= tmp

    ans += tmp
print(ans)


Measured memory_bytes: 3064
#include <cmath>
#include <iomanip>
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
  int D, N; cin >> D >> N;

  cout << setprecision(10) << pow(100, D)*((N < 100) ? N : N+1) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) cout << (x) << endl;
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}
 
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};

int main(void){
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    string s;
    ll n;
    cin >> n >> s;

    rep(i, s.size()){
        rep(j, n){
          if(s[i] == 'Z'){
            s[i] = 'A';
            continue;
          }
          s[i] += 1;
        }
    }
    print(s);
}

Measured memory_bytes: 256
import numpy as np
N = int(input())
X = np.array([x for x in map(int,input().split())])

P = int(X.sum()/N)

if ((X-P)**2).sum() < ((X-(P+1))**2).sum():
    ans = ((X-P)**2).sum()
else:
    ans = ((X-(P+1))**2).sum()

print(ans)


Measured memory_bytes: 12400
#define _USE_MATH_DEFINES
#include <iostream> 
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std; 
int main(){
	int a, b;
	while (cin >> a >> b){
		int k = log10(a+b) + 1;
		cout << k << endl;
	}
	return 0;
}


Measured memory_bytes: 3312
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>

using namespace std;

template <typename T> void read(T& x)
{
	x = 0; char c = getchar(); bool f = 0;
	while(!isdigit(c) && c!='-') c = getchar();
	if(c == '-') f = 1, c = getchar();
	while(isdigit(c)) x = x*10+c-'0', c = getchar();
	if(f) x = -x;
}

int sum[270], e[270][270];
int n;

/*void dfs(int x, int y)
{
	if(x == n)
	{
		int t = sum[1], flg = 1;
		for(int i=1; i<=n; i++)
			if(sum[i] != t)
				flg = 0;
		if(flg)
		{
			cout<<t<<" : "<<endl;
			for(int i=1; i<=n; i++)
			{
				for(int j=1; j<=n; j++) cout<<e[i][j]<<" ";
				cout<<endl;
			}
		}
	}
	else if(y == n+1) dfs(x+1, x+2);
	else
	{
		dfs(x, y+1);
		sum[x] += y;
		sum[y] += x;
		e[x][y] = e[y][x] = 1;
		dfs(x, y+1);
		sum[x] -= y;
		sum[y] -= x;
		e[x][y] = e[y][x] = 0;
	}
}*/

int main()
{
	read(n);
	if(n & 1)
	{
		for(int i=1; i<=n; i++)
			for(int j=1; j<=n; j++)
				if(i+j==n || i==j) e[i][j] = 0;
				else e[i][j] = 1;
	}
	else
	{
		for(int i=1; i<=n; i++)
			for(int j=1; j<=n; j++)
				if(i+j==n+1 || i==j) e[i][j] = 0;
				else e[i][j] = 1;
	}
	int cnt = 0;
	for(int i=1; i<=n; i++)
		for(int j=i+1; j<=n; j++)
			if(e[i][j]) cnt++;
	printf("%d\n", cnt);
	for(int i=1; i<=n; i++)
		for(int j=i+1; j<=n; j++)
			if(e[i][j]) printf("%d %d\n", i, j);
	//dfs(1, 2);
	return 0;
}

Measured memory_bytes: 384
#include<stdio.h>
int selection(int A[100],int N)
{
	int i,j,d,minj,stock,c=0;
	for(i=0;i<N;i++)
	{
		minj=i;
		for(d=0,j=i;j<N;j++)
		{
			if(A[j]<A[minj]){minj=j;d=1;}
		}
		stock=A[i];
		A[i]=A[minj];
		A[minj]=stock;
		if(d)c++;
	}
	return c;
}
int main(void)
  {
	int i,n,x,a[100];
	scanf("%d",&n);
	for(i=0;i<n;i++){scanf("%d",&a[i]);}
	x=selection(a,n);
	for(i=0;i<n;i++)
  {
		printf("%d",a[i]);
		if(i<n-1){printf(" ");}
		else{printf("\n");}
  }
	printf("%d\n",x);
	return 0;
  }

Measured memory_bytes: 604
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

int main() {
	int n;
	cin >> n;
	if (n == 1)
	{
		printf("Hello World\n");
	}
	else
	{
		int a, b;
		cin >> a >> b;
		printf("%d", a+b);
	}
	return 0;
}

Measured memory_bytes: 256