akhauriyash/Code-Regression huggingface dataset:
n = int(input())
s = list(str(input()))


c = 0
for i in range(n):
    for j in range(i+1, n):
        k = 2*j-i
        if k<n and s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            c = c+1
            
        

R = 0
G = 0
B = 0

for i in range(n):
    if s[i] == 'R':
        R = R+1
    elif s[i] == 'G':
        G = G+1
    elif s[i] == 'B':
        B = B+1

print(R*G*B-c)



Measured memory_bytes: 9044
#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 ll long long
#define uint unsigned int
#define ull  unsigned long long
#define pb push_back
#define mk make_pair
#define ins insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define X first
#define Y second
#define umap unordered_map
#define speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define setvalue(d,s,e,n) for(int qwe = s; qwe < e; ++qwe) d[qwe] = n
#define mset multiset
#define pqueue priority_queue
   
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
        
const int  N = 2e5 + 314;
const int INF = 1e9;
const double PI = acos(-1);
const int MOD = 1e9 + 7;
const double eps = 1e-9; 
double n, m;

void solve(){
    int a, b, c;
    cin >> a >> b >> c;
    swap(a, b);
    swap(a, c);
    cout << a << ' ' << b << " " << c;
}
 
int main(){
    speed();
    int t = 1;
    // cin >> t;
    while(t--)solve();
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var a = ReadInt();
            var s = Read();
            if (a >= 3200) Println(s);
            else Println("red");
        }

        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static void YESOrNO(bool e) => Println(e ? "YES" : "NO");

        static void YesOrNo(bool e) => Println(e ? "Yes" : "No");

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


Measured memory_bytes: 11092
#include<stdio.h>
#include<cstdio>
#include<algorithm>
using namespace std;

int main() {
  int N, T;
  scanf("%d%d", &N, &T);
  int res = 10000;
  for (int i=0 ; i<N ; i++) {
    int c, t;
    scanf("%d%d", &c, &t);
    if (t <= T) res = min(res, c);
  }
  if (res == 10000) printf("TLE\n");
  else printf("%d\n", res);
}

Measured memory_bytes: 128
open System.Collections.Generic

type Scanner() = class
    let mutable hold = [||]
    let mutable index = 0
    member public this.Next() =
        if hold.Length > index
        then 
            index <- index + 1
            hold.[index - 1]
        else
            let mutable st = stdin.ReadLine()
            while st = "" do st <- stdin.ReadLine()
            hold <- st.Split(' ')
            if hold.Length = 0
            then
                this.Next()
            else
                index <- 1
                hold.[index - 1]
            
    member public this.NextI32() =
        this.Next() |> int

    member public this.ArrayI32(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextI32()|]

    member public this.NextI64() =
        this.Next() |> int64
    
    member public this.ArrayI64(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextI64()|]

    member public this.NextF32() =
        this.Next() |> float32
    
    member public this.ArrayF32(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextF32()|]

    member public this.NextF64() =
        this.Next() |> double
    
    member public this.ArrayF64(n: int) =
        [|for _ in 0 .. n - 1 -> this.NextF64()|]

    member public __.Tuple2Array n (f : int -> 'a list) =
        [|for _ in 0 .. n - 1 -> f 2 |> fun x -> x.[0], x.[1]|]
    
    member public __.Tuple3Array n (f : int -> 'a list) =
        [|for _ in 0 .. n - 1 -> f 3 |> fun x -> x.[0], x.[1], x.[2]|]

    member public __.CountDic n (f : unit -> 'a) =
        let seqs = seq {for _ in 0 .. n - 1 -> f()}
        let dic = new Dictionary<'a, int64>();
        for i in seqs do
            if dic.ContainsKey(i)
            then dic.[i] <- dic.[i] + 1L
            else dic.Add(i, 1L)
        dic

end

[<EntryPoint>]
let main _ =
    let scanner = Scanner()
    let x = scanner.NextI64()
    let rec f x i s =
        if i + s >= x
        then i
        else f x (i + 1L) (i + s)

    f x 1L 0L
    |> printfn "%i"

    0


Measured memory_bytes: 13916
#include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <math.h>
#include <cstdlib>
#include <istream>
#include <sstream>
#include <cctype>
using namespace std;

int main()
{
	int N, count = 0;
	vector<int> A;
	cin >> N;

	for (int i = 0; i < N; i++)
	{
		int T;
		cin >> T;
		A.push_back(T);
	}
	for (int i = 0; i < N-2; i++)
	{
		vector<int> B;
		B.push_back(A[i]);
		B.push_back(A[i+1]);
		B.push_back(A[i+2]);
		sort(B.begin(),B.end());
		if (A[i + 1] == B[1]) { count++; }
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")    
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 9999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 998244353
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> A >> B >> C >> D >> N;
  A*=4;
  B*=2;
  chmin(C,min(A,B));
  chmin(D,2*C);
  if(N&1)sum+=C;
  Out(N/2*D+sum);
}

Measured memory_bytes: 256
/*                         _
                        _ooOoo_
                       o8888888o
                       88" . "88
                       (| -_- |)
                       O\  =  /O
                    ____/`---'\____
                  .'  \\|     |//  `.
                 /  \\|||  :  |||//  \
                /  _||||| -:- |||||_  \
                |   | \\\  -  /'| |   |
                | \_|  `\`---'//  |_/ |
                \  .-\__ `-. -'__/-.  /
              ___`. .'  /--.--\  `. .'___
           ."" '<  `.___\_<|>_/___.' _> \"".
          | | :  `- \`. ;`. _/; .'/ /  .' ; |
          \  \ `-.   \_\_`. _.'_/_/  -' _.' /
===========`-.`___`-.__\ \___  /__.-'_.'_.-'================

                  Please give me AC.
*/

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <complex>
#include <bitset>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <chrono>
#include <random>

using namespace std;

using int64 = long long;
using uint64 = unsigned long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define print2(x, y) cout << (x) << ' ' << (y) << '\n'
#define print3(x, y, z) cout << (x) << ' ' << (y) << ' ' << (z) << '\n'
#define printn(v) rep(i, (v).size() - 1) cout << (v)[i] << ' '; cout << (v)[n - 1] << '\n';
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define debug2(x, y) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << '\n'
#define debug3(x, y, z) cerr << #x << ": " << (x) << ", " << #y << ": " << (y) << ", " << #z << ": " << (z) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;

template<typename T> T gcd(T a, T b) {
    if (a < b) return gcd(b, a);
    T r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}

template<typename T> T lcm(const T a, const T b) {
    return a / gcd(a, b) * b;
}

template<typename T> bool chmin(T& a, const T& b) {
    if (a > b) return a = b, true; else return false;
}

template<typename T> bool chmax(T& a, const T& b) {
    if (a < b) return a = b, true; else return false;
}

// End of template.

int main() {
    cout << fixed << setprecision(15);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    // cin.read(buf, sizeof buf); // 注意: ./a.out < in か pbp | ./a.out で入力すること

    int k, a, b;
    cin >> k >> a >> b;
    for (int i = a; i <= b; ++i) {
        if (i % k == 0) {
            print("OK");
            return 0;
        }
    }
    print("NG");

    return 0;
}



Measured memory_bytes: 3640
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

int main()
{
	int N, H, W;
	cin >> N >> H >> W;
	cout << (N - H + 1) * (N - W + 1) << endl;
}


Measured memory_bytes: 3596
import java.io.*;
import java.util.ArrayList;
import java.util.Arrays;
public class Main {
	
	public static int sum = 0;
	
	public static int calc (int target) {
		
		boolean[] isPrime = new boolean[target + 1];
		Arrays.fill(isPrime, true);
		
		int lim = (int)Math.sqrt(target);
		for (int i = 4; i < isPrime.length; i += 2) isPrime[i] = false;
		for (int i = 3; i <= lim; i += 2) {
			for (int j = 3; i * j < isPrime.length; j += 2)
				isPrime[i * j] = false;
		}
		for (int i = 2; i < isPrime.length; i++) 
			if (isPrime[i]) sum++;
		
		return sum;
	}
	
	public static void main(String[] args) throws IOException {
		
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		ArrayList<Integer> ans = new ArrayList<Integer>();
		
		while (true) {
			
			String s = br.readLine();
			if (s == null) break;
			int n = Integer.parseInt(s);
			ans.add(calc(n));
			sum = 0;
			
		}
		
		for (int a : ans) {
			System.out.println(a);
		}
		
	}

}

Measured memory_bytes: 13000
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		var chk = true;
		chk &= S[2] == S[3];
		chk &= S[4] == S[5];
		Console.WriteLine(chk ? "Yes" : "No");
		
	}
	String S;
	public Sol(){
		S = rs();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

 
int main()
{
  string s,t;
  cin>>s>>t;
  int n=s.length();
  bool flag=true;
  for(int i=0;i<n;i++){
      if(s[i]!=t[i]){
          cout<<"No"<<endl;
          flag=false;
          break;
      }
  }
    if(flag==true){
        cout<<"Yes"<<endl;
    }
   return 0;
}



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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define per(i,n) for(int i = n-1; i >= 0; i--)
#define PER(i,n) for(int i = n; i >= 1; i--)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
using vP = vector<P>;
using vPl = vector<Pl>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



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

  int n, k;
  cin >> n >> k;
  vi a(n);
  rep(i,n) cin >> a[i];
  int ans = ceil(n-1, k-1);
  cout << ans << endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#pragma GCC optimize ("O2")
#pragma GCC optimize ("unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod = 1000000007;
const int MAXN = 100010, LOG=20;

int n, m, k, u, v, x, y, t, a, b, ans;
int A[MAXN];

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n;
	for (int i=0; i<2*n; i++) cin>>A[i];
	sort(A, A+2*n);
	for (int i=0; i<2*n; i+=2) ans+=A[i];
	cout<<ans<<'\n';
	
	return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

/**
 * Main
 */

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a[] = new int[n];
        int b[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        for (int i = 0; i < n; i++) {
            b[i] = sc.nextInt();
        }
        long remain = 0;
        long need = 0;
        for (int i = 0; i < n; i++) {
            if (a[i] > b[i]) {
                need += (a[i] - b[i]);
            } else {
                remain += ((b[i] - a[i]) / 2);
            }
        }
        if (remain >= need) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

        sc.close();
    }
}


Measured memory_bytes: 42448
#include "bits/stdc++.h"
// Custom Header {{{
#define ALL(x) x.begin(), x.end()
#define rep(i, s, n)      for(int i(s); i < int(n); ++i)
#define endl '\n'
#ifndef YDK
#define eprintf(...)
#endif
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr const int INF  = 0x3f3f3f3f;
constexpr const i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr const int MOD  = int(1e9) + 7;
// }}}

// Library {{{
// }}}


signed main()
{
    string s;
    cin >> s;

    if (s[0] == s[1] || s[1] == s[2] || s[2] == s[3]) {
        cout << "Bad" << endl;
    } else {
        cout << ("Good") << endl;
    }
    return 0;
}


Measured memory_bytes: 256
N, M = map(int, input().strip().split())

a_b = []
for i in range(N):
    array = list(map(int, input().strip().split()))
    a_b.append(array)

c_d = []
for i in range(M):
    array = list(map(int, input().strip().split()))
    c_d.append(array)

for n in range(N):
    mind = 1000000007
    for m in range(M):
        dist = abs(a_b[n][0] - c_d[m][0]) + abs(a_b[n][1] - c_d[m][1])
        if dist < mind:
            mind = dist
            checkpoint = m + 1
    print(checkpoint)


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

int main() {
  int N;
  cin >> N;
  
  vector<int> H(N);
  for (int i = 0; i < N; i++) {
    cin >> H.at(i);
  }
  
  for (int i = N - 1; i >= 1; i--) {
    if (H.at(i) >= H.at(i - 1)) continue;
    if (H.at(i) + 1 >= H.at(i - 1)) {
      H.at(i - 1)--;
      continue;
    }
    cout << "No" << endl;
    return 0;
  }
  
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 640
#include <stdio.h>
#include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<complex>
#include<vector>

using namespace std;

int nx[]={0,1,0,-1};
int ny[]={0,1,0,-1};
//*****************************************
int N,T;
int X=0;


int main(void){
    
    cin >> N >> T;
    vector<int> times(N+100,0);

    for(int i=0;i<N;i++) cin >> times[i] ;

    for(int i=0;i<N-1;i++){

        if(times[i+1]-times[i]>T)
        {
            X+=T;
        } 
        else
        {
            //cout << (times[i+1]-times[i]) << endl;
            X+=(times[i+1]-times[i]);
        }
    }


    X+=T;


    cout << X;
    return 0;
}





Measured memory_bytes: 1024
N=int(input())
mod=10**9+7
acgt=['A','C','G','T']
bef=dict()
from collections import defaultdict
banc=['AGC','GAC','ACG']
for x in acgt:
    for y in acgt:
        for z in acgt:
            if x+y+z not in banc:
                bef[x+y+z]=1
ban=[]
for w in acgt:
    for v in banc:
        ban.append(w+v)
    ban.append('A'+w+'GC')
    ban.append('AG'+w+'C')
for i in range(3,N):
    befc=bef.copy()
    bef=defaultdict(int)
    for b in befc.keys():
        for nex in acgt:
            if b+nex not in ban:
                bef[b[1:]+nex]=(bef[b[1:]+nex]+befc[b])%mod
ans=0
for cnt in bef.values():
    ans=(ans+cnt)%mod
print(ans)

Measured memory_bytes: 3436
var readline = require('readline')
var reader = readline.createInterface({
  input: process.stdin,
  output: process.stdout
});

var lines = [];
reader.on('line', function(line) {
  lines.push(line);
});

reader.on('close', function() {
  var ans = 0;
  for(var i=0; i<3; ++i) if(lines[0][i]==lines[1][i]) ++ans;
  console.log(ans);
});

Measured memory_bytes: 7628
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
//変数デバッグ
#define DEB(variable) cout << #variable << '=' << variable << endl

//for簡易表記(引数ミス防止)
#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    long long int a,b;
    cin>>a>>b;
    long long int result=0;
    if(b-a<10){
        result = a;
        FOR(i,a+1,b+1){
            result^=i;
        }
    }else{
        if(a%2){
            result^=a;
            a++;
        }
        if(b%2==0){
            result^=b;
            b--;
        }
        result^=((b-a+1)/2)%2;


    }
    cout<<result<<endl;
    return 0;
}


Measured memory_bytes: 888
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
const int INF = 1001001001;
const ll LINF = 1e18;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    T r;
    while((r=a%b)) {
        a = b; b = r;
    }
    return b;
}

int main() {
    int D, G, p, c, idx = 1; cin >> D >> G;
    vi ps(11, 0), cs(11, 0);
    while(cin >> p >> c){
        ps[idx] = p;
        cs[idx] = c;
        idx++;
    }
    
    int m = INF;
    for (int i = 1; i <= 1 << (D + 1); i ++) {
        int count = 0;
        int score = 0;
        int nfi = 0; // not_filled_index
        for(int j = 1; j <= D; j++){
            if(i >> j & 1){
                count += ps[j];
                score += j * 100 * ps[j] + cs[j];
            }
            else nfi = max(nfi, j);
        }
        if(score >= G){
            m = min(m, count);
        }
        else if(score + 100 * nfi * ps[nfi] >= G){
            m = min(m, count + (int)((G - score + (100 * nfi - 1)) / (100 * nfi)));
        }
    }
    cout << m << endl;
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
#define INF 1000000009
#define INFL 1000000000000000018
#define mod 10007
#define pb push_back
#define MAXN 505
#define ff first
#define sf second.first
#define ss second.second
using namespace std;
typedef pair<int, int> PA;
typedef priority_queue<int> PQ;
typedef vector<int> VE;
typedef map<int, int> MAP;

int n, c, x[100100], v[100100];
int calr[100100], call[100100], retr[100100], retl[100100];
int sumr[100100], suml[100100];

signed main()
{
    cin >> n >> c;
    for(int i = 0; i < n; i++){
        cin >> x[i] >> v[i];
        if(i == 0){
            sumr[i] = v[i];
            continue;
        }
        sumr[i] = sumr[i - 1] + v[i];
    }
    //printf("1 : %lld\n", sumr[n - 1]);
    for(int i = n - 1; i >= 0; i--){
        if(i == n - 1){
            suml[i] = v[i];
            continue;
        }
        suml[i] = suml[i + 1] + v[i];
    }
    //printf("2 : %lld\n", suml[0]);
    for(int i = 0; i < n; i++){
        if(calr[i] < sumr[i] - x[i]){
            calr[i] = sumr[i] - x[i];
        }
        if(retr[i] < sumr[i] - 2 * x[i]){
            retr[i] = sumr[i] - 2 * x[i];
        }
        calr[i + 1] = calr[i];
        retr[i + 1] = retr[i];
        //printf("calr[%lld] : %lld  retr[%lld] : %lld\n", i, calr[i], i, retr[i]);
    }
    //printf("3 : %lld\n", sumr[n - 1]);
    //printf("\n");
    for(int i = n - 1; i >= 0; i--){
        if(call[i] < suml[i] - (c - x[i])){
            call[i] = suml[i] - (c - x[i]);
        }
        if(retl[i] < suml[i] - 2 * (c - x[i])){
            retl[i] = suml[i] - 2 * (c - x[i]);
        }
        if(i == 0)break;
        call[i - 1] = call[i];
        retl[i - 1] = retl[i];
        //printf("call[%lld] : %lld  retl[%lld] : %lld\n", i, call[i], i, retl[i]);
    }
    //printf("4 : %lld\n", sumr[n - 1]);
    int ans = 0;
    for(int i = 0; i < n; i++){
        ans = max(ans, calr[i]);
        ans = max(ans, call[i]);
        if(i != n - 1){
            ans = max(ans, retr[i] + call[i + 1]);
        }
        if(i != 0){
            ans = max(ans, retl[i] + calr[i - 1]);
        }
    }
    //printf("!E!\n");
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 6528
#include "bits/stdc++.h"
typedef long long ll;
using namespace std;

int main() {
    string abcd;
    cin >> abcd;
    int a = abcd[0] - '0';
    int b = abcd[1] - '0';
    int c = abcd[2] - '0';
    int d = abcd[3] - '0';

    int i;
    for (i = 0; i < (1 << 3); ++i) {
        int v = a;
        v += (i & 1 << 2) ? b : -b;
        v += (i & 1 << 1) ? c : -c;
        v += (i & 1 << 0) ? d : -d;
        if (v == 7) break;
    }

    auto symbol = [](bool plus) {
        return plus ? "+" : "-";
    };

    cout << a << symbol(i & 1 << 2) << b << symbol(i & 1 << 1) << c << symbol(i & 1 << 0) << d << "=7";
    return 0;
}


Measured memory_bytes: 384
import copy
n,m = map(int,input().split())
a = set(list(map(int,input().split())))
a = list(a)
a_div2 = [0]*len(a)
a2 = copy.deepcopy(a)
for i in range(len(a)):
    if a[i] % 2 == 1:
        print(0)
        exit()
for i in range(len(a)):
    while a2[i] % 2 == 0:
        a2[i] //= 2
        a_div2[i] += 1
if len(set(a_div2)) != 1:
    print(0)
    exit()


def gcd(a,b):
    while b != 0:
        a, b = b, a % b
    return a


def lcm(a,b):
    return a // gcd(a,b) * b


if len(a) == 1:
    if m < a[0]//2:
        print(0)
    else:
        print((m-a[0]//2)//a[0] + 1)
else:
    cnt = 1
    for i in range(len(a)):
        a[i] //= 2
        cnt = lcm(cnt,a[i])
    if m < cnt:
        print(0)
    else:
        print((m-cnt)//(cnt*2)+1)




Measured memory_bytes: 14804
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
const int maxn=1e5+100;
int main()
{
	ll n,k,q;
	ll x;
	ll a[maxn];
	memset(a,0,sizeof(a));
	scanf("%lld%lld%lld",&n,&k,&q);
	for(int i=0;i<q;i++)
	{
		scanf("%d",&x);
		a[x]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(a[i]+k-q>0)
			printf("Yes");
		else
			printf("No");
		if(i!=n)
			printf("\n");
//		printf("%d ",a[i]+k-q);
	}
	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<double, double> pdd;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
//const int mod = ;

const int N = 200000;
bitset<N> v, odd, pref;
ll X = 0;

void inc() {
  X += (v & odd).count();
}

const int DEBUG = 0;

ll stupid(string s) {
  int n = s.size();
  vi ord(n);
  for (int i = 0; i < n; ++i) ord[i] = i;
  int ma = 0;
  do {
    vi used(n);
    int sum = 0;
    for (int x : ord) {
      used[x] = 1;
      int c = 0, l = 0;
      for (int i = 0; i < n; ++i) if (used[i]) {
        ++l;
        if (l % 2 && s[i] == '1') ++c;
      }
      sum += c;
    }
    ma = max(ma, sum);
  } while (next_permutation(ord.begin(), ord.end()));
  return ma;
}

void solve(string s) {
  X = 0;
  int n = s.size();
  int c = 0;
  vi used(n);
  for (int i = 0; i < n; ++i) if (s[i] == '1') {
    ++c;
    used[i] = 1;
  }
  int cur = 0;
  for (int i = 0; i < c; ++i) {
    v[i] = 1;
    if (i % 2 == 0) ++cur;
    X += cur;
  }
  int p = 0;
  for (int i = 0; i < n; ++i) {
    if (s[i] == '0') {
      if (p % 2) {
        used[i] = 1;
        ++c;
        if (c % 2) ++cur;
        X += cur;
        ++p;
      }
    } else {
      ++p;
    }
  }
  vi x(2);
  int l = 0;
  for (int i = n - 1; i >= 0; --i) {
    if (!used[i]) {
      vi nx = x;
      swap(nx[0], nx[1]);
      cur += nx[0] - x[0];
      x = nx;
      X += cur;
      ++c;
      ++l;
    } else {
      int j = c - l - 1;
      if (s[i] == '1') x[j % 2]++;
      ++l;
    }
  }
/*  for (int i = 0; i < n; i += 2) odd[i] = 1;
  for (int i = 0; i < c; ++i) {
    pref[i] = v[i] = 1;
    inc();
  }
  int pc = c;
  for (int i = n - 1; i >= 0; --i) if (s[i] == '0') {
    int l = n - i - 1;
    while (pc > c - l) {
      --pc;
      pref[pc] = 0;
    }
    auto prefv = v & pref;
    v = prefv | ((v ^ prefv) << 1);
    ++c;
    inc();
  }*/
  cout << X << endl;
  if (DEBUG) {
    ll res = stupid(s);
    if (res != X) {
      cerr << s << ' ' << res << ' ' << X << endl;
      assert(0);
    }
  }
}

int main() {
  std::ios::sync_with_stdio(false); std::cin.tie(0);
  string s(N, '0');
  if (!DEBUG) {
    cin >> s;
    solve(s);
  } else {
    for (int n = 1; n <= 10; ++n) {
      s.resize(n);
      for (int mask = 0; mask < (1 << n); ++mask) {
        for (int i = 0; i < n; ++i) {
          if (mask & (1 << i)) s[i] = '1';
          else s[i] = '0';
        }
        solve(s);
      }
    }
  }
  return 0;
}


Measured memory_bytes: 4520
//#pragma warning(disable:4996)
//#include <Windows.h>
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>
//#include <stdio.h>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
//typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<int, int> PI;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef unsigned long long ULL;

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

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

void input();
void solve();

void daminput();

int main() {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	input();
	//daminput();
	solve();
	return 0;
}

//////////////////////////////////////////////////
//////////////////////////////////////////////////

int N, M;
VI A, B;
VLL C;

void input() {
	cin >> N >> M;
	A.resize(M);
	B.resize(M);
	C.resize(M);
	for (int n = 0; n < M; n++)
	{
		cin >> A[n] >> B[n] >> C[n];
	}
}

void daminput() {
}

template<class T>
struct Gedge {
	int src, to;
	T cost;
	int id;
	Gedge(int s, int t, T c, int i = -1) :src(s), to(t), cost(c), id(i) {}
	Gedge(int t, T c) :src(-1), to(t), cost(c), id(-1) {}
};

template<class T>
using WeightedGraph = vector<vector<Gedge<T>>>;
using UnweightedGraph = vector<vector<LL>>;
template<class T>
using Gedges = vector<Gedge<T>>;

template<class T>
struct TNode {
	int parent;
	VI childs;
	T cost;
	int id;
	TNode() :parent(-1), cost(0), id(-1) {};
};
template<class T>
using Tree = vector<TNode<T>>;

//負経路が存在->return false
template<class T>
bool BellmanFord(WeightedGraph<T>& G, LL start, vector<T>& res) {
	res.resize(G.size(), INF);
	res[start] = 0;
	for (LL t = 0; t < G.size() - 1; t++) {
		for (LL n = 0; n < G.size(); n++) {
			if (res[n] == INF)continue;
			for (Gedge<T>& e : G[n]) {
				res[e.to] = min(res[e.to], res[n] + e.cost);
			}
		}
	}
	//negative loop check
	for (int n = 0; n < G.size(); n++)
	{
		if (res[n] == INF)continue;
		for (Gedge<T>& e : G[n]) {
			if (res[n] == -INF) {
				res[e.to] = -INF;
			}
			else if (res[e.to] > res[n] + e.cost) {
				res[e.to] = -INF;
			}
		}
	}
	return true;
}

void solve() {
	WeightedGraph<LL> G(N);
	for (int m = 0; m < M; m++)
	{
		G[A[m] - 1].push_back({ B[m] - 1,-C[m] });
	}
	VLL res;
	bool loop = BellmanFord(G, 0, res);
	if (res.back() == -INF) {
		cout << "inf\n";
		return;
	}
	else {
		cout << -res.back() << "\n";
		return;
	}
}

Measured memory_bytes: 3256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX 5000
#define MOD 1000000007

int main(){
  int N,K;
  string S;
  cin>>N>>K>>S;
  bool flag=false;
  vector<pair<int,int>> lr;
  lr.push_back(make_pair(0,0));
  int l,r;
  for(int i=0;i<N;i++){
    if(!flag&&S.at(i)=='1'){
      flag=true;
      l=i;
    }
    if(S.at(i)=='0'&&flag){
      r=i;
      lr.push_back(make_pair(l,r));
      flag=false;
    }
    if(S.at(i)=='1'&&i==N-1){
      r=i+1;
      lr.push_back(make_pair(l,r));
    }
  }
  lr.push_back(make_pair(N,N));
  int n=lr.size();
  int ans=0;
  if(K>=n-1){
    cout<<N<<endl;
  }else{
    for(int i=0;i<n-K;i++){
      ans=max(ans,lr.at(i+K).second-lr.at(i).first);
    }
    cout<<ans<<endl;
  }
}


Measured memory_bytes: 1020
N = int(input())
S = [int(zz) for zz in input().split()]

ans = set()
p = 0
for i in S:
    q = i // 400
    if q < 8:
        ans.add(q)
    else:
        p += 1

if N == 1:
    print(1, 1)
else:
    print(max(1,len(ans)), len(ans) + p)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
main()
{
    int a, b, c, x, y, z, p, q, r, n, m;
	string s;
	cin >> s;
	bool flag = false;
	for (int i = 0; i < s.size(); i++)
	{
		if (s[i] == '7')
		{
			flag = true;
			break;
		}
	}
	cout << ((flag == true) ? "Yes" : "No") << endl;
}


Measured memory_bytes: 3624
#!/usr/bin/env python3
import sys


def solve(N: int, K: int):
    print(min(N%K, abs(N%K - K)))
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#include <functional>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define REP(i, n) for (int i = 1; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) (int)(x).size()
using namespace std;
using ll = long long;
constexpr int inf = 1000000000;
constexpr ll INF = 5000000000000000000;

struct Edge {int to; double cost;};

int main() {
    ll xs, ys, xg, yg;
    cin >> xs >> ys >> xg >> yg;
    int N;
    cin >> N;
    vector<ll> x(N), y(N), r(N);
    rep(i, N) cin >> x[i] >> y[i] >> r[i];
    
    vector<vector<Edge>> G(N + 2);
    rep(i, N) {
        G[0].push_back(Edge{i + 1, max(sqrt((xs - x[i]) * (xs - x[i]) + (ys - y[i]) * (ys - y[i])) - r[i], 0.0)});
        G[i + 1].push_back(Edge{0, max(sqrt((xs - x[i]) * (xs - x[i]) + (ys - y[i]) * (ys - y[i])) - r[i], 0.0)});
        G[N + 1].push_back(Edge{i + 1, max(sqrt((xg - x[i]) * (xg - x[i]) + (yg - y[i]) * (yg - y[i])) - r[i], 0.0)});
        G[i + 1].push_back(Edge{N + 1, max(sqrt((xg - x[i]) * (xg - x[i]) + (yg - y[i]) * (yg - y[i])) - r[i], 0.0)});
    }
    rep(i, N) rep(j, N) {
        if (i == j) continue;
        G[i + 1].push_back(Edge{j + 1, max(sqrt((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j])) - r[i] - r[j], 0.0)});
    }
    G[0].push_back(Edge{N + 1, sqrt((xs - xg) * (xs - xg) + (ys - yg) * (ys - yg))});
    G[N + 1].push_back(Edge{N, sqrt((xs - xg) * (xs - xg) + (ys - yg) * (ys - yg))});
    
    vector<double> dist(N + 2, 3000000000000000000.0);
    dist[0] = 0;
    vector<int> used(N + 2, 0);
    priority_queue<pair<double, int>> pq;
    pq.push(pair<double, int>{0, 0});
    while (!pq.empty()) {
        int v = pq.top().second;
        pq.pop();
        if (used[v]) continue;
        for (auto e : G[v]) {
            double alt = dist[v] + e.cost;
            if (alt < dist[e.to]) {
                dist[e.to] = alt;
                pq.push(pair<double, int>{-alt, e.to});
            }
        }
        used[v] = 1;
    }
    cout << fixed << setprecision(15) << dist[N + 1] << "\n";
    return 0;
}


Measured memory_bytes: 23424
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
using P = pair<int, int>;
int mod = (int) 1e9 + 7;

int main(){
    
    int x, y;
    cin >> x >> y;
    
    if (y % 2 > 0){
        cout << "No" << "\n";
        return 0;
    }
    
    int z = y / 2 - x;
    
    if (z >= 0 && z <= x){
        cout << "Yes" << "\n";
        return 0;
    }

    cout << "No" << "\n";
    return 0;

    return 0;
}



Measured memory_bytes: 3068
#include<bits/stdc++.h>
using namespace std;
int ar[105];
int main(){
	int sum=0;int n;cin>>n;
  	for(int i=1;i<=n;i++){cin>>ar[i];sum+=ar[i];ar[i]*=n;}
  	int mn=abs(sum-ar[1]),mni=1;
  	for(int i=2;i<=n;i++){
    	if(abs(sum-ar[i])<mn){
        	mn = abs(sum-ar[i]);mni=i;
        }
    }
  	cout<<mni-1;
}

Measured memory_bytes: 256
#include <string>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
/* contest template */

int main()
{
	int n;
	cin >> n;
	vector<vector<int>> F;
	F.resize(n);
	for (int i = 0; i < n; i++) {
		F[i].resize(10);
		for (int j = 0; j < 10; j++) {
			cin >> F[i][j];
		}
	}
	vector<vector<int>> P;
	P.resize(n);
	for (int i = 0; i < n; i++) {
		P[i].resize(11);
		for (int j = 0; j < 11; j++) {
			cin >> P[i][j];
		}
	}
	
	int p, time;
	int ans = -1000000000;
	vector<int> ar;
	ar.resize(n);
	for (int k = 1; k <= 1023; k++ ) {
		p = 0;
		time = 0;
		int j = k;
		for (int i = 0; i < n; i++) {
			ar[i] = 0;
		}
		while (j != 0) {
			if (j % 2== 1) {
				for (int i = 0; i < n; i++) {
					if (F[i][time] == 1) {
						ar[i]++;
					}
				}
				
				
			}
			j = j / 2;
			time++;
			
			
			
		}
		for (int i = 0; i < n; i++) {
			p += P[i][ar[i]];
		}
		if (p > ans) {
			ans = p;
		}
	}
	cout << ans <<endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

namespace Algorithm
{
    class Program
    {
        static void Main(string[] args)
        {
            var x = int.Parse(Console.ReadLine());
            while (x != 0)
            {
                var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
                var ave = a.Average();
                var sqrt = Math.Sqrt(a.Sum(z => Math.Pow(z - ave, 2)) / x);
                Console.WriteLine(sqrt);
                x = int.Parse(Console.ReadLine());
            }
        }
    }
}



Measured memory_bytes: 18396
#include <stdio.h>

int main(){
	
	int K;

	scanf("%d",&K);

	int i;


	int one=0;
	int two=0;
	for(i=1;i<=K;i++){
		if(i%2==0){two++;}
		else{one++;}
	}

	printf("%d\n",one*two);

return 0;
}

Measured memory_bytes: 128
// Created by abhay
#include <bits/stdc++.h>
#define ll long long
#define mq 1000000007
using namespace std;
const int INF = 1e9 + 5;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin >> n;
	ll h[n];
	for (ll i = 0; i < n; i++)
		cin >> h[i];
	vector<ll> dp(n, INF);
	dp[0] = 0;
	for (ll i = 0; i < n; i++)
	{
		for (ll j = i + 1; j <= i + 2; j++)
		{
			dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
		}
	}
	cout << dp[n - 1] << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<string, int>;
int main()
{
    ll k;
    cin >> k;
    if(k == 0)
    {
        cout << 2 << endl;
        cout << "1 1" << endl;
    }
    else if(k == 1)
    {
      cout << 2 << endl;
      cout << "2 0" << endl;
    }
    else if(k <= 50)
    {
        cout << k << endl;
        for(int i = k; i > 0; i--)
        {
            cout << i << " ";
        }
    }
    else
    {
        cout << 50 << endl;
        ll x = k / 50;
        ll y = k % 50;
        x--;
        vector<ll> ans(50);
        for(int i = 0; i < 50; i++)
        {
            ans[i] = 50 + x - i;
        }
        for(int i = 0; i < y; i++)
        {
            ans[i]++;
        }
        for(int i = 0; i < 50; i++)
        {
            cout << ans[i] << " ";
        }
    }
}



Measured memory_bytes: 256
import Data.List

divisorsLeq :: Int -> Int -> [Int]
divisorsLeq m n
  | m == 0    = [n, n-1 .. 0]
  | sqrtM > n = divsIn [n, n-1 .. 1]
  | otherwise = reverse (takeWhile (<= n) $ map snd divPairs)
                ++ (if sqrtM * sqrtM == m' then [sqrtM] else [])
                ++ map fst divPairs
  where
    m' = abs m
    sqrtM = ceiling (sqrt $ fromIntegral m' :: Double)
    divsIn xs = [x | x <- xs, m' `mod` x == 0]
    divPairsIn xs = [(x,y) | x <- xs, let (y,r) = m' `divMod` x, r == 0]
    divPairs = divPairsIn [sqrtM-1, sqrtM-2 .. 1]

main :: IO ()
main = do
  [n,m] <- map read . words <$> getLine :: IO [Int]
  let mdn = m `div` n
  putStrLn $ show $ head $ divisorsLeq m mdn


Measured memory_bytes: 1020
import java.io.*;
  
public class Main {
    public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String input = br.readLine();
        String[] cut = input.split(" ");
        int width = Integer.parseInt(cut[0]);
        int height = Integer.parseInt(cut[1]);
        int x = Integer.parseInt(cut[2]);
        int y = Integer.parseInt(cut[3]);
        int r = Integer.parseInt(cut[4]);
         
         
        if(x + r <= width && y + r <= height && x - r >= 0 && y - r >= 0)
            System.out.println("Yes");
        else
            System.out.println("No");    
    }
}


Measured memory_bytes: 24296
#include <iostream>
#include <vector>
#include <deque>
#include <cmath>
#include <map>
#include <set>
#include <unordered_set>
#include <algorithm>
#include "iomanip"
#include <cstdio>
#include <cstring>
#include <set>
#include <vector>
#include <fstream>
#include <algorithm>
#include <queue>
#include <cassert>
#include <stack>

using namespace std;


void print(vector<int> &b) {
    for (auto i : b) {
        cout << i << " ";
    }
}


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

    int n;
    cin >> n;
    vector<int> v(n);
    for (auto &i : v) {
        cin >> i;
    }
    for (int j = v.size() - 1; j > 0; --j) {
        if (v[j] < v[j - 1]) {
            v[j - 1]--;
            if (v[j] < v[j - 1]) {
                cout << "No";
                return 0;
            }
        }
    }
    cout << "Yes";
    return 0;
}




Measured memory_bytes: 640
#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>;
#define INF 100000000
const int MOD = 1000000007;


int main(){

    int n;
    cin>>n;
    map <string,int> mp;
    mp["AC"]=0;
    mp["WA"]=0;
    mp["TLE"]=0;
    mp["RE"]=0;
    for(int i=0;i<n;i++)
    {
        string x;
        cin>>x;
        mp.at(x)++;
    }

    cout<<"AC"<<" "<<"x "<<mp["AC"]<<endl;
    cout<<"WA"<<" "<<"x "<<mp["WA"]<<endl;
    cout<<"TLE"<<" "<<"x "<<mp["TLE"]<<endl;
    cout<<"RE"<<" "<<"x "<<mp["RE"]<<endl;
    return 0;
}

Measured memory_bytes: 3576
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;


int main() {
	int n;
	int o = 0;
	
	while (cin >> n, n != 0) {
		o = 100;
		vector<int> a(10000, 0);
		vector<int> b(10000, 0);
		for (int i = 0; i < n; i++) {
			cin >> a[i];
		}
		sort(a.rbegin(), a.rend());

		for (int i = 0; i < n - 1; i++) {
			b[i] = a[i] - a[i + 1];
		}
		for (int i = 0; i < n - 1; i++) {
			if (i == 0) {
				o = b[0];
			}
			else {
				if (b[i] < o) {
					o = b[i];
				}
			}
		}
		cout << o << endl;
	}
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n , y;
    cin >> n >> y;

    int cntS = 0;
    int cntG = 0;
    int cntM = 0;

    bool flg = false;
    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 * 10000) + (j * 5000) + (k * 1000) == y && i + j + k == n){
                    flg = true;
                    cntM = i;
                    cntG = j;
                    cntS = k;
                }
                if(flg == true) break;
            }
        }
    }
    

    if (flg == true){
        cout << cntM << " " << cntG << " " << cntS << endl;
    } else{
        cout << -1 << " " << -1 << " " << -1 << endl;
    }
    
}
 

Measured memory_bytes: 256
import sys

input = lambda: sys.stdin.readline()


def cin_int_list():
    return [int(x) for x in input().split()]


def cin_int_iter():
    return (int(x) for x in input().split())


def cin_int():
    return int(input())


def cout_int_iter(a):
    print(' '.join(map(str, a)))


def iota(n, start=0):
    return list(range(start, n))


def cin_digits_list():
    return [ord(x) - ord('0') for x in input()]


def main():
    n, k = cin_int_iter()

    g = {}

    for u, x in enumerate(cin_int_list()):
        v = x - 1
        g[u] = v

    visited = set()

    u = 0
    while u not in visited:
        visited.add(u)
        u = g[u]

    cycle_starts = u

    u = cycle_starts
    cycle = []
    while True:
        cycle.append(u)
        u = g[u]

        if u == cycle_starts:
            break

    before_cycle = []
    u = 0

    while u != cycle_starts:
        before_cycle.append(u)
        u = g[u]

    if k < len(before_cycle):
        print(before_cycle[k] + 1)
        return

    if before_cycle:
        k -= len(before_cycle)

    print(cycle[k % len(cycle)] + 1)




main()


"""
6 1
6 5 2 5 3 2

6 2
6 5 2 5 3 2

6 3
6 5 2 5 3 2

6 4
6 5 2 5 3 2

6 6
6 5 2 5 3 2

6 5
6 5 2 5 3 2


no cycle

4 1
2 3 4 5

4 111111111111111111
2 3 4 1

1 111111111111111111
1

2 1999999999999999999
2 1

3 99999999999999999999
2 3 2

3 99999999999999999999
2 3 4
"""

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

int main(){
    int n; cin >> n;
    int ans = 0;
    string S; cin >> S;
    for(int i = 0;i<1000;i++){
        int pos = 0;
        int number[3] = {i / 100,(i/10) % 10,i % 10};

        for(int j = 0;j < S.size();j++){
            if (('0' + number[pos]) == S[j]) pos ++;
            if (pos == 3) break;
        }

        if (pos == 3) ans ++;
    }

    cout << ans << endl;
}

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

const int maxn = 100010;
int a[maxn];
int color[maxn];

int getcolor(int num)
{
	return num / 400 + 1;
}

int main()
{
	//freopen("C.in","r",stdin);
	int n;
	scanf("%d",&n);
	int cnt = 0;
	for (int i=1;i<=n;i++) 
	{
		scanf("%d",&a[i]);
		if (a[i] < 3200) color[getcolor(a[i])]++;
		else cnt++;
	}
	int cnt2 = 0;
	for (int i=1;i<=8;i++)
	{
		if (color[i] == 0) cnt2++;
	}
	int minans = (cnt2 != 8) ? (8 - cnt2) : 1;
	int maxans = (cnt > cnt2) ? (8 + cnt - cnt2) : (8-cnt2+cnt);
	printf("%d %d",minans,maxans);
	return 0;
}


Measured memory_bytes: 256