akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
long long n, s, x, mn, a[200005];
int main() {
	int i;
	scanf("%lld", &n);
	for(i=0; i<n; i++) scanf("%lld", &a[i]), s += a[i];
	x = a[0];
	mn = abs(s-2*x);
	for(i=1; i<n-1; i++) {
		x += a[i];
		mn = min(mn, (long long)abs(s-2*x));
	}
	printf("%lld", mn);
	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#include <map>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
typedef long long ll;

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

bool is_prime(int k, int i) {
    if(k == 2) return true;
    if(k <= i) return true;
    else {
        if(k % i == 0) return false;
        else return is_prime(k, i + 1);
    }
}


int main() {
    int n;
    cin >> n;
    int counter = 0;
    int number = 2;
    while(counter != n) {
        if(number % 5 == 1 and is_prime(number, 2)){
            cout << number << ' ';
            counter ++;
        }
        number ++;
        
    }


}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
#define el '\n'
typedef long long ll;
int N, K, ans;
int main(){
	cin.tie(0);
	cin.sync_with_stdio(0);
	cin >> N >> K;
	while(N>=1){
		ans++;
		N/=K;
	}
	cout << ans << el;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int n;
void xz(char a[])
{
	char d;
	d=a[0];
	for(int i=0;i<n-1;i++)
	{
		a[i]=a[i+1];
	}
	a[n-1]=d;
}
int main()
{
	char a[200],b[200];
	scanf("%s %s",a,b);
	n=strlen(a);
	int f=0;
	for(int i=0;i<n;i++)
	{
		if(!strcmp(a,b))
		{
			f=1;
			break;
		}
		xz(a);
	}
	if(f)
	printf("Yes\n");
	else
	printf("No\n");
	return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python3
import sys
from collections import Counter

MOD = 1000000007  # type: int

def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False

    for i in range(2, n+1):
        if is_prime[i-1]:
            j = 2 * i
            while j <= n:
                is_prime[j-1] = False
                j += i
    table = {i:0 for i in range(1, n+1) if is_prime[i-1]}
    # return is_prime, table
    return table

def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table

def solve(N: int, A: "List[int]"):
    table = dict()

    for i in range(N):
        decom = Counter(prime_decomposition(A[i]))

        for d,number in decom.items():
            if table.get(d) == None:
                table[d] = number
                continue

            if table[d] < number:
                table[d] = number
    LCM = 1
    for key,value in table.items():
        LCM *= pow(key,value,MOD)

    print(sum([LCM*pow(a,MOD-2,MOD) for a in A])%MOD)

    return


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
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


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

using namespace std;
int a[105],ans,n,m;
int main()
{
	cin>>n>>m;
	for(int i=1;i<=n;i++) cin>>a[i];
	sort(a+1,a+1+n);
	for(int i=n;i>=n-m+1;i--)
		ans+=a[i];
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] flowerInfo = new int[n+1];
		for(int i=1;i <= n;i++) {
			flowerInfo[i] = sc.nextInt();
		}
		int answer = 0;
		while(!isEnd(flowerInfo)) {
			for(int i =1;i < flowerInfo.length;i++) {
				if(flowerInfo[i] != 0) {
					int left = i;
					int right = i;
					int mizuyari = 0;
					for(int j = left;j < flowerInfo.length;j++) {
						if(flowerInfo[left] > flowerInfo[j]) {
							right = j-1;
							mizuyari = flowerInfo[left] - flowerInfo[j];
							break;
						}
						if(j == n) {
							right = j;
							mizuyari = flowerInfo[left];
						}
					}
					for(int k = left;k <=right;k++) {
						flowerInfo[k] -= mizuyari;
					}
					answer += mizuyari;
					break;
				}
			}
		}
		System.out.println(answer);
	}

	private static boolean isEnd(int[] flowerInfo) {
		boolean endFlg = true;
		for(int i =1;i < flowerInfo.length;i++) {
			if(flowerInfo[i] != 0) {
				return false;
			}
		}
		return true;
	}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007
#define rep(i, n) for (int i = 0; i < n; ++i)
using Graph = vector<vector<int>>;
#define grepq  priority_queue<double, std::vector<double>, std::greater<double>>

int lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}

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




int main(){
    int N, D, X;
    cin >> N >> D >> X;
    vector<int> A(N);
    ll ans = X;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
        for (int j = 1; j <= D;j++)
        {
            j--;
            j += A[i];
            ans++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
constexpr int mod=1e9+7;
signed main(){
    string s;
    int k;
    cin>>s>>k;
    vector<pair<char,int>>rle;
    rle.emplace_back(s[0],1);
    for(int i=1;i<s.size();i++)
        if(rle.back().first==s[i])
            rle.back().second++;
        else
            rle.emplace_back(s[i],1);
    if(rle.size()==1){
        cout<<s.size()*k/2<<endl;
        return 0;
    }
    int sum=0;
    for(int i=1;i<rle.size()-1;i++)
        sum+=rle[i].second/2;
    if(rle[0].first!=rle.back().first){
        cout<<(sum+rle[0].second/2+rle.back().second/2)*k<<endl;
        return 0;
    }
    cout<<sum*k+rle[0].second/2+rle.back().second/2+(rle[0].second+rle.back().second)/2*(k-1)<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <map>

#define rep(i, N) for (int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
const ll LLINF = 9223372036854775807;
const int MOD = 1000000007;

int main() {
  int N, M; cin >> N >> M;
  int P[M], Y[M]; rep(i, M) cin >> P[i] >> Y[i];
  vector<int> C[N+1]; rep(i, M) C[P[i]].push_back(Y[i]);
  rep(i, N+1) sort(C[i].begin(), C[i].end());

  rep(i, M) {
    cout << setfill('0') << setw(6) << P[i];
    int id = lower_bound(C[P[i]].begin(), C[P[i]].end(), Y[i]) - C[P[i]].begin()+1;
    cout << setfill('0') << setw(6) << id << endl;
  } 
  return 0;
}

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

int pri[10000+1];
bool is_prime[10000+1];
int prime(int n){
	int p=0;
	for(int i=0;i<n+1;i++){
		is_prime[i] = true;
	}
	is_prime[0] = is_prime[1] = false;
	for(int i=2;i<n+1;i++){
		if(is_prime[i]==true){
			pri[p++] = i;
			for(int j=i+i;j<n+1;j+=i){
				is_prime[j] = false;
			}
		}
	}
	return p;
}

int main()
{
	int n;
	while(cin >> n){
		if(n==0)
			break;
		int p = prime(n);
		for(int i=p-1;i>=0;i--){
			if(pri[i] == pri[i-1]+2){
				cout << pri[i-1] << " " << pri[i] << endl;
				break;
			}
		}
	}	
	return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
#define fo(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
#define MT make_tuple
#define PB push_back
typedef long long ll;

int b, n;
string s;

int main () {
        cin >> s;
        for (char i : s) {
                if (i == 'p') {
                        if (b) b--;
                        else b++, n--;
                } else {
                        if (b) b--, n++;
                        else b++;
                }
        }
        printf("%d\n", n);
        return 0;
}



Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <vector>
#include <bitset>

std::bitset<2000 * 2000 + 1> mask;

int n, a[2000];

int main()
{
    scanf("%d", &n);
    mask[0] = 1;
    int s = 0;
    for (int i = 0; i < n; ++ i) {
        scanf("%d", &a[i]);
        mask = mask | mask << a[i];
        s += a[i];
    }
    int result = 0;
    for (int i = 2000 * 2000; i >= 0; -- i) {
        if (mask[i] == 1 && i * 2 >= s)
            result = i;
    }
    printf("%d\n", result);
}


Measured memory_bytes: 2176
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
)

func main() {
	N := getInt()
	K := getInt()
	H := make([]int, N)
	for i := 0; i < N; i++ {
		H[i] = getInt()
	}

	costs := make([]int, N)
	costs[0] = 0
	for i := 1; i < N; i++ {
		costs[i] = mod
		for j := 1; j <= K; j++ {
			if i - j < 0 {
				break
			}

			cost := abs(H[i-j] - H[i])
			costs[i] = min(costs[i], costs[i-j] + cost)
		}
	}

	fmt.Println(costs[N - 1])
}

type Graph struct {
	n     int
	edges [][]int
}

func NewGraph(n int) *Graph {
	g := &Graph{
		n:     n,
		edges: make([][]int, n),
	}
	return g
}

func (g *Graph) AddEdge(u, v int) {
	g.edges[v] = append(g.edges[v], u)
	g.edges[u] = append(g.edges[u], v)
}

func dfs(c int, edges [][]int, visited map[int]struct{}) {
	visited[c] = struct{}{}

	for _, v := range edges[c] {
		_, flag := visited[v]
		if flag {
			continue
		}
		dfs(v, edges, visited)
	}
}

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func powMod(n, p int) int {
	if p == 0 {
		return 1
	} else if p%2 == 0 {
		t := powMod(n, p/2)
		return calcMod(t * t)
	} else {
		return n * powMod(n, p-1)
	}
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray)-1])
}

func calcMod(x int) int {
	return x % mod
}


Measured memory_bytes: 2816
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int n,k,q;
main()
{
	cin>>n>>k>>q;
	vector<int>a(n);
	for(int i=0;i<n;i++)
	{
		cin>>a[i];
	}
	int ans=1e9;
	vector<int>b;
	b.push_back(n);
	while(1)
	{
		int f=0;
		int mina=2e9,mini=-1;
		vector<int>now;
		for(int i=0;i<b.size();i++)
		{
			vector<pair<int,int> >tmp;
			for(int j=f;j<b[i];j++)
			{
				tmp.push_back(make_pair(a[j],j));
			}
			sort(tmp.begin(),tmp.end());
			for(int j=0;b[i]-f-j>=k;j++)
			{
				now.push_back(tmp[j].first);
			}
			if(!tmp.empty()&&tmp[0].first<mina)
			{
				mina=tmp[0].first;
				mini=tmp[0].second;
			}
			f=b[i]+1;
		}
		if(now.size()<q)break;
		sort(now.begin(),now.end());
		ans=min(ans,now[q-1]-now[0]);
		b.push_back(mini);
		sort(b.begin(),b.end());
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)

using namespace std;

int i,j,k;

int main(){
    int n,a,b;
    int ans[3];
    cin>>n>>a>>b;
    ans[0]=b;
    ans[1]=n;
    ans[2]=a;

    cout<<b<<" "<<n<<" "<<a<<endl;
    return 0;
}



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


int main(){
  int a,b;
  cin>>a>>b;
  for(int i=b-a+1;i<b+a;i++){
    if(i-b+a-1)cout<<" ";
    cout<<i;
  }
  cout<<endl;
}


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

typedef long long ll;
// #define int ll
#define pb push_back
// const int INF = 1e18;
const int inf = 1e9;

signed main(){

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


	#ifndef ONLINE_JUDGE
		time_t t1 = clock(), t2;
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
		// freopen("err.txt", "w", stderr);
	#endif


	int a,b,c,k;
	cin>>a>>b>>c>>k;
	if (k<=a+b)
		cout<<min(k,a);
	else
		cout<<a-(k-a-b);
	

	return 0;
}

Measured memory_bytes: 3652
int main() {
    long a;
    long b;
    long c;
    long d;
    long x;
    long y;
    long m;
    long n;
    long max;
    scanf("%ld %ld %ld %ld", &a, &b, &c, &d);
    x = a*c;
    y = a*d;
    m = b*c;
    n = b*d;
    max = x;
    if(max < y) max = y;
    if(max < m) max = m;
    if(max < n) max = n;
    printf("%ld", max);

    
    
    return 0;
}

Measured memory_bytes: 1728
n = int(input())
a=[]
for i in range(1,10):
  for j in range(1,10):
    a.append(i*j)
c=0
b = 0
for i in range(81):
  if a[i]==n:
    c=1
    print("Yes")
    break
  else:
    b = 1

if b==1 and c!=1:
  print("No")

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 1000000000
#define MOD 1000000007

typedef  long long ll;

using namespace std;

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

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

double euclid_distance(double a,double b){
    return sqrt(a*a+b*b);
}

ll gcd(ll  a,ll b){
    ll r;
    if(a < b){
        ll tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return b;
}

void Integer_factorization(long long int b,long long int n){
    long long int a = 2;
    long long int count = 0;
    long long int ans = 1;
    long long int ndash = n;
    if(b == 1) cout << n << endl;
    else{
    while(ndash >= a*a){
        if(n % a  == 0){
            count++;
            n/=a;

        if(count % b == 0){
            ans *= a;
        }
        }else{a++;count = 0;}
    }

    cout<<  ans << endl;
    }
}

ll r_fuct[2000];
ll fuct[2000];

//MOD逆元
void conb(ll n,ll k){
    fuct[0] = 1;
    for(int i = 1;i < k+1;i++){
        fuct[i] *= fuct[i-1]%MOD;
        
        ll b = MOD, u = 1, v = 0;
        ll value = fuct[i];
        while (b) {
            ll t = value / b;
            value -= t * b;
            swap(value, b);
            u -= t * v;
            swap(u, v);
        }
        u %= MOD;
        if (u < 0) u += MOD;
        r_fuct[i] = u;
    }
}

ll factrial(ll n){
    if(n == 0) return 1;
    ll p = factrial(n-1)*n%MOD;
    return p;
}

//MOD逆元
ll farmat(ll n,ll p){    
    if(p == 0) return 1;
    else if(p == 1) return n%MOD;
    ll d = farmat(n,p/2);
    if(p%2 == 0){
        return (d*d)%MOD;
    }else{
        return ((n*d)%MOD*d)%MOD;
    }
}

ll conbination(ll n,ll k){
    ll a = factrial(n);
    ll b = factrial(k);
    ll c = factrial(n-k);
    return (a*farmat(b,MOD-2)%MOD*farmat(c,MOD-2))%MOD;
}

int n;
int memo[10000000];

int fib(int i){
    if(i <= 1) return i;
    if(memo[i] != 0) return memo[i];
    return memo[i] = fib(i-1)+fib(i-2);
}

ll dig(ll n){
    ll d = 0;
    while(n != 0){
        n/=10;
        d++;
    }
    return d;
}
map<char,int> a;
void solve() {
   ll n,k,q;
   cin >> n >> k >> q;
   vector<ll> a(q);
   for(int i = 0;i < q;i++){
       cin >> a[i];
       a[i]--;
   }

   vector<ll>point(n);
   for(int i = 0;i < n;i++){
       point[i] = 0;
   }
   
   for(int i = 0;i < q;i++){
       point[a[i]]++;
   }
   
   for(int i = 0;i < n;i++){
       if(k - (q - point[i]) > 0){
           cout << "Yes" << endl;
       }else{
           cout << "No" << endl;
       }
   }

   


}


int main() {

	cin.tie(0);
	ios::sync_with_stdio(false);
	solve();
	return 0;
}



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

int main() {
  int N,f=0,g=0;
  cin >> N;
  int a=N;
  for(int i=0;i<8;i++){
    f=a%10;
    a=(a-f)/10;
    g+=f;
    if (a<10) {
      g+=a;
      break;
    }
  }
  if (N%g==0)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REP(i,b) FOR(i,0,b)
#define RFOR(i,a,b) for (int i = a-1; i >= b; i--)
#define RREP(i,a) RFOR(i,a,0)
#define REPALL(i,v) for (int i = 0; i < v.size(); i++)
#define RREPALL(i,v) for (int i = v.size()-1; i >= 0; i--)
#define SORT(v) sort(v.begin(), v.end())
#define MIN_ELEMENT(v) min_element(v.begin(), v.end())
#define MAX_ELEMENT(v) max_element(v.begin(), v.end())
#define COUNT(v,n) count(v.begin(), v.end(), n);
void YES(bool flag) {cout<<(flag ? "YES" : "NO")<<endl;}
void Yes(bool flag) {cout<<(flag ? "Yes" : "No")<<endl;}
void yes(bool flag) {cout<<(flag ? "yes" : "no")<<endl;}
typedef long long ll;
typedef unsigned long long ull;
const int INF = 1e7;
const ll MOD = 1e9 + 7;

string s1, s2;
vector<string> ans;
vector<string> o1, o2, e1, e2;

bool close()
{
    o1.clear(); o2.clear(); e1.clear(); e2.clear();
    bool tflag = true;
    string tmp;
    REPALL(i,s1) {
        if (s1[i] == '\"' || i == s1.size() - 1) {
            if (tflag) {
                o1.push_back(tmp);
            } else {
                e1.push_back(tmp);
            }
            tflag = !tflag;
            tmp.clear();
        } else {
            tmp += s1[i];
        }
    }
    tflag = true;
    REPALL(i,s2) {
        if (s2[i] == '\"' || i == s2.size() - 1) {
            if (tflag) {
                o2.push_back(tmp);
            } else {
                e2.push_back(tmp);
            }
            tflag = !tflag;
            tmp.clear();
        } else {
            tmp += s2[i];
        }
    }

    if (o1.size() != o2.size()) {
        return false;
    } else {
        REP(i,o1.size()) {
            if (o1[i] != o2[i])
                return false;
        }
    }

    if (e1.size() != e2.size()) {
        return false;
    } else {
        int cnt = 0;
        REP(i,e1.size()) {
            if (e1[i] != e2[i])
                cnt++;
        }
        return cnt <= 1;
    }
}

int main()
{
    while (cin>>s1, s1 != ".") {
        cin>>s2;
        //s1 = "read\"B1input\";solve;output;";
        //s2 = "read\"B2\";solve;output;";
        if (s1 == s2)
            ans.push_back("IDENTICAL");
        else if (close())
            ans.push_back("CLOSE");
        else
            ans.push_back("DIFFERENT");
    }
    REPALL(i,ans) cout<<ans[i]<<endl;
}


Measured memory_bytes: 3176
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <cstring>
#include <utility>
#include <vector>
#include <complex>
#include <valarray>
#include <fstream>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <random>

#define _overload(a, b, c, d, ...) d
#define _rep1(X, A, Y) for (int (X) = (A);(X) <= (Y);++(X))
#define _rep2(X, Y) for (int (X) = 0;(X) < (Y);++(X))
#define rep(...) _overload(__VA_ARGS__, _rep1, _rep2)(__VA_ARGS__)
#define rrep(X,Y) for (int (X) = Y-1;(X) >= 0;--(X))
#define all(X) (X).begin(),(X).end()
#define _size(X) (int)((X).size())
#define mod(n, m) (((n)%(m)+(m))%m)
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
const int INFINT = 1 << 30;                          // 1.07x10^ 9
const ll INFLL = 1LL << 60;                          // 1.15x10^18
const double EPS = 1e-10;
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

int A[3];

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

  rep(i, 3) cin >> A[i];
  sort(A, A+3);

  if ((A[2]-A[0])%2 == (A[2]-A[1])%2) {
      cout << ((A[2]-A[0])+(A[2]-A[1]))/2 << endl;
  } else {
      ++A[2];
      ++A[1];
      cout << ((A[2]-A[0])+(A[2]-A[1]))/2 + 1 << endl;
  }

  return 0;
}


Measured memory_bytes: 888
//Rain Flows into Dams

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, string>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

signed main (){
    nvarep(n,a);
    int c = a[0];
    rep(i,1,n){
        if(i%2)c-=a[i];
        else c+=a[i];
    }
    cout<<c<<spa;
    rep(i,0,n-1){
        c=a[i]*2-c;
        cout<<c<<spa;
    }
    cout<<nnn;
    return 0;
}

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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    string s, t;
    cin >> s >> t;
    cout << t << s << endl;

    return 0;
}


Measured memory_bytes: 764
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;

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

    cout << 1110 - n;
    
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
	int w[10], k[10];
	int i, j, tmp;
	int W = 0, K = 0;
	
	for (i = 0; i < 10; i++){
		scanf("%d", &w[i]);
	}
	
	for (i = 0; i < 10; i++){
		scanf("%d", &k[i]);
	}
	
	for (i = 0; i < 9; i++){
		for (j = 9; j > i; j--){
			if (w[j-1] < w[j]){
				tmp = w[j];
				w[j] = w[j-1];
				w[j-1] = tmp;
			}
			if (k[j-1] < k[j]){
				tmp = k[j];
				k[j] = k[j-1];
				k[j-1] = tmp;
			}
		}
	}
	
	for (i = 0; i < 3; i++){
		W += w[i];
		K += k[i];
	}
	
	printf("%d %d\n", W, K);
	
	return 0;
}

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

using namespace std;
typedef long long ll;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    string a,b;
    cin >> a >> b;
    int n=a.size();
    int m=b.size();
    a="$"+a;
    b="$"+b;
    vector<int> sa(n+1,0);
    for(int i=1;i<=n;i++) sa[i]=sa[i-1]+(a[i]=='A');
    vector<int> sb(m+1,0);
    for(int i=1;i<=m;i++) sb[i]=sb[i-1]+(b[i]=='A');
    int q;
    cin >> q;
    while(q--)
    {
        int c,d,e,f;
        cin >> c >> d >> e >> f;
        int onea=sa[d]-sa[c-1];
        int oneb=(d-c+1)-onea;
        int twoa=sb[f]-sb[e-1];
        int twob=(f-e+1)-twoa;
        if((onea+2*oneb)%3==(twoa+2*twob)%3) cout << "YES\n";
        else cout << "NO\n";
    }
    return 0;
}


Measured memory_bytes: 4524
'use strict';

function Main(input) {
    let [D, C, ...S] = input.trim().split('\n');
    D = Number(D);
    C = C.split(' ').map((v) => Number(v));
    S = S.map((v) => v.split(' ').map((v) => Number(v)));

    let last = Array(26).fill(0); // コンテストの最終開催日
    let drop = Array(26).fill(0); // 不満度の累計

    // 各日において、満足度 - 不満度 が最大になる日程
    // let total = 0;
    for (let i = 0; i < D; i++) {
        drop = drop.map((_v, index) => C[index] * (i + 1 - last[index]));
        const s = S[i];
        let tmp = Array(26).fill(0);
        for (let j = 0; j < 26; j++) {
            const lebel =
                s[j] - (drop.reduce((acc, cur) => acc + cur) - drop[j]);
            tmp[j] = lebel;
        }
        const max = tmp.reduce((a, b) => Math.max(a, b));
        const index = tmp.indexOf(max);
        // total += max;
        // console.log(total);
        console.log(index + 1);
        last[index] = i + 1;
    }

    return;
}
Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 35196
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

int main()
{
    fast;
    ll n,ans=0,i,j,k,l;
    cin>>n;
    for(i=1;i<=n-1;i++)
    {
        if(n%i==0)
        {
            j=(n/i)-1;
        }
        else j=n/i;
        ans+=j;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3684
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define INF 1000000007
#define int long long

typedef pair<int, int> pint;
typedef long long ll;

int N;
int data[300][300];
int d[300];

bool bellman(int start)
{
    fill(d, d + N, INF);
    d[start] = 0;
    priority_queue<pint, vector<pint>, greater<pint>> q;
    q.push(pint(0, start));
    while (q.size())
    {
        pint p = q.top();
        q.pop();
        int v = p.second;
        if (d[v] < p.first)
            continue;
        rep(i, N)
        {
            if (d[i] > d[v] + data[v][i])
            {
                d[i] = d[v] + data[v][i];
                q.push(pint(d[i], i));
            }
        }
    }
    rep(j, N)
    {
        if (data[start][j] != d[j])
        {
            return false;
        }
    }
    return true;
}

signed main()
{
    cin >> N;
    rep(i, N)
    {
        rep(j, N)
        {
            cin >> data[i][j];
        }
    }

    rep(i, N)
    {
        if (!bellman(i))
        {
            cout << -1 << endl;
            return 0;
        }
    }

    bool has_road[N][N];
    rep(i, N)
    {
        fill(has_road[i], has_road[i] + N, true);
    }
    rep(i, N)
    {
        rep(j, N)
        {
            rep(k, N)
            {
                if (i != j && j != k && k != i)
                {
                    bool nec = true;
                    if (data[i][j] >= data[i][k] + data[k][j])
                    {
                        nec = false;
                    }
                    if (!nec)
                    {
                        has_road[i][j] = false;
                        has_road[j][i] = false;
                    }
                }
            }
        }
    }

    int ans = 0;
    rep(i, N)
    {
        for (int j = i + 1; j < N; j++)
        {
            if (has_road[i][j])
            {
                ans += data[i][j];
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(a){return a?cin[cid++]:+cin[cid++];}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(myOut);

function main(){
  var n = next();
  var k = BigInt(next(1));
  var a = nexts(n);
  var map = xArray(-1,n);
  var x = 0;
  map[0] = 0;
  for(var i = 1; i <= k; i++){
    x = a[x]-1;
    if(map[x] >= 0){
      var r = i - map[x];
      k -= BigInt(i);
      k %= BigInt(r);
      for(var i = 1; i <= k; i++)x = a[x]-1;
    }
    map[x] = i;
  }
  return x+1;
}

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

int main(){
  int a,b,c,d,e,f,g,h,h2,h3,show,cnt = 0;

  for(int i=0; i<3; i++){
    cin >> a >> b >> c;
    cin >> d >> e >> f;

    h = a*3600;
    h += b*60;
    h += c;

    // cout << h << endl;

    h2 = d*3600;
    h2 += e*60;
    h2 += f;

    // cout << h2 << endl; 

    h3 = h2-h;

    
    
    // cout << h3 << endl;

    while(h3 >= 3600){
      h3 -= 3600;
      cnt++;
    }
    cout << cnt << " ";

    cnt = 0;

    while(h3 >= 60){
      h3 -= 60;
      cnt++;
    }

    cout << cnt << " " << h3 << endl;
  }
}

Measured memory_bytes: 1160
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]

for i in range(3):
    for j in range(3):
        for k in range(n):
            if a[i][j] == b[k]:
                a[i][j] = 0

ans = "No"

for i in range(3):
    if a[i][0] + a[i][1] + a[i][2] == 0:
        ans = "Yes"
    if a[0][i] + a[1][i] + a[2][i] == 0:
        ans = "Yes"
if a[0][0] + a[1][1] + a[2][2] == 0:
    ans = "Yes"
if a[0][2] + a[1][1] + a[2][0] == 0:
    ans = "Yes"

print(ans)

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

int main(){
    ll H,W; cin >> H >> W;
    vector<vector<char> > s(100,vector<char>(100,'.'));
    for(int i=1;i<H+1;++i){
        for(int j=1;j<W+1;++j){
            cin >> s[i][j];
        }
    }
    
    for(int i=1;i<H+1;++i){
        for(int j=1;j<W+1;++j){
            if(s[i][j] == '#' && s[i-1][j] == '.' && s[i][j-1] == '.' && s[i+1][j] == '.' && s[i][j+1] == '.'){
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 256
//#pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>

using namespace std;

typedef pair<long long, long long> pl;

long long N, M, k, a, b, c, d, e, H, W,X;
long long A[200001] = {};
long long B[200002] = {};
long long tt[20000] = {};
bool f;
bool ff;
string S, SS;
set <long long>sll;
pl buf;
vector <long long>vpl;



int main() {
	cin >> S;
	d = 0;
	a = 0;
	b = 0;
	for (long i = 0; i < S.size(); i++) {
		if (S[i] == '1') {
			a++;
		}
		else {
			b++;
		}
	}

	cout << (min(a, b)) * 2 << endl;

	return 0;
}

Measured memory_bytes: 512
use std::io;

fn main() {
    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();

    let mut buf = String::new();
    io::stdin().read_line(&mut buf).unwrap();

    let mut hn = [false; 4];
    for s in buf.trim().split(' ') {
        match s {
            "P" => hn[0] = true,
            "W" => hn[1] = true,
            "G" => hn[2] = true,
            "Y" => hn[3] = true,
            _ => (),
        }
    }

    if hn.iter().all(|&x| x) {
        println!("Four");
        return;
    }
    println!("Three");
}


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


#define FOR(i, start, end) for(uint64_t i=start; i<end; i++)
#define REP(i, n) FOR(i, 0, n)

// 最大公約数gcd
// 最小公倍数lcm=m*n/gcd
uint64_t gcd(uint64_t m, uint64_t n) {
  uint64_t temp;
  while (m % n != 0){
    temp = n;
    n = m % n;
    m = temp;
  }
  return n;
}

uint64_t lcm(uint64_t m, uint64_t n) {
  return (m*n)/gcd(m,n);
}

void comb(vector<vector <uint64_t> > &v){
  for(uint64_t i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(uint64_t k = 1;k <v.size();k++){
    for(uint64_t j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}

// 掛け算オーバーフロー判定
bool is_product_overflow(uint64_t a, uint64_t b) {

	uint64_t prod = a * b;
	
	return (prod / b != a);
}

//素因数分解
void primeFactorization(uint64_t a, list<uint64_t> &factors){ //素因数分解を出力するプログラム
  long i,sq;
  if(a%2==0){ //偶数の場合
    factors.push_back(2);
    primeFactorization(a/2,factors); //2で割った値で再帰
    return;
  }
  sq = sqrt(a);
  for(i=3;i<=sq;i+=2){ //3以上√a以下の奇数の場合
	if(a%i==0){
	  factors.push_back(i);
      primeFactorization(a/i,factors); //割れた値で再帰
      return;
	}
  }
  //偶数でも3以上√a以下の奇数の場合でも割り切れない場合
  if(a!=1){ //aが1でないなら、a自身は素数
    factors.push_back(a);
  }
}

// 円周率
// M_PI

// #include <iomanip> // setprecisionを使用するのに必要
// cout << std::fixed << std::setprecision(15) << y << endl;

// 昇順
// priority_queue<int, vector<int>, greater<int> > queue;

signed main() {
  int64_t n,m,k;  
  cin >> n >> m >> k;
  int64_t a[n] = {};
  int64_t b[m] = {};


  int64_t aCount =0;
  int64_t bCount = 0;
  for(int i=0;i<n;i++){
    cin >> a[i];
    if(i>0) a[i] += a[i-1];
    if(a[i]<=k) aCount = i+1;
  }
  for(int i=0;i<m;i++){
    cin >> b[i];
    if(i>0) b[i] += b[i-1];
    if(b[i]<=k) bCount = i+1;
  }
  
  int64_t countMax = aCount;
  int64_t j = 0;
  bool isUpdated = false;
  for(int64_t i=0; i<=aCount;i++){
    bool jMoved = false;
    while(k-a[aCount-i-1]>=b[j]&&j<m){
      j++;
      jMoved = true;
    }
    if(!jMoved) continue;
    if(countMax<aCount-i+j){
      countMax = aCount-i+j;
      isUpdated = true;
    }
  }
  if(bCount>countMax) countMax = bCount;
  cout << countMax << endl;
  return 0;
}

Measured memory_bytes: 6772
#include<stdio.h>
int main() {
	int a[3],count=0;
	for (int i = 0; i < 3; i++) {
		scanf("%d", &a[i]);
	}
	for (int n = 0; n < 3; n++) {
		for (int l = n+1; l < 3; l++) {
			if (a[n] == a[l]) {
				count++;
			}
		}
	}
	if (count == 1) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
}

Measured memory_bytes: 128
import re
s = input()
t = input()

p = ""
for i in range(len(t)):
    p += "[" + t[i] + "?]"

ans = []
for i in range(len(s)-len(t)+1):
    a = re.match(p, s[i:])
    if a is None:
        continue
    tmp = s[:i] + t + s[i+len(t):]
    ans.append(tmp.replace("?", "a"))

if ans == []:
    print('UNRESTORABLE')
else:
    ans.sort()
    print(ans[0])


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

signed main() {
  int N;
  cin >>N;
  vector<long long> A(N);
  for(int i=0; i<N; i++) cin >> A[i];

  for(int i=0; i<N; i++) {
    if(A[i] == 0) {
      puts("0");
      return 0;
    }
  }

  long long ans = 1;

  for(int i=0; i<N; i++) {
    if((long double)ans * (long double)A[i] > 1e18) {
      puts("-1");
      return 0;
    }
    ans *= A[i];
  }
  cout << ans << endl;
}



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

int main(){
  string S,T;
  cin>>S>>T;
  for(int i = 0; i < S.size(); i++)
  {
      cout<<S[i];
      if(i<T.size()){
          cout<<T[i];
      }
  }
  
  cout<<endl;
}

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

class Main{
  public static void main(String[] args){
    int x,a;
    Scanner sc=new Scanner(System.in);
    x=sc.nextInt();
    a=sc.nextInt();
    if(x<a)
      System.out.println(0);
    else{
      System.out.println(10);
    }
  }
}

Measured memory_bytes: 21844
import math

aa = 0

while True:
    n = int(input())
    
    if n == 0:
        break
    
    data = list(map(int, input().split()))
    
    m = float(sum(data) / n)
    
    for i in data:
        aa +=  float(((i - m) ** 2) / n)
        
    a = math.sqrt(aa)
    print(a)
    
    aa = 0
        


Measured memory_bytes: 5700
# c-Rally
N = int(input())
X = list(map(int,input().split()))
sum = 0
stamina = 0
xmin = min(X)
xmax = max(X)
for i in range(xmin,xmax+1):
    for j in range(N):
        sum += (X[j]-i)**2
    if i == xmin:
        stamina = sum
    if stamina > sum:
        stamina = sum
    sum = 0
print(stamina)

Measured memory_bytes: 9176
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>

using namespace std;
#define int  long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
#define MOD 1000000007
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(),(x).end()


template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solve(void)
{
  int N;
  cin>>N;
  int K = -1;

  for (int i = 0; i < 10e3; i++)
  {
    if(i*(i-1) == 2*N)K = i;
  }
  if(K == -1)
  {
    cout<<"No"<<endl;
    return;
  }
  cout<<"Yes"<<endl;
  vector<vector<int> > S (K);
  int v = 1;
  for (int i = 0; i < K; i++)
  {
    for (int j = i+1; j < K; j++)
    {
      S[i].push_back(v);
      S[j].push_back(v);
          v++;
    }

  }
  cout<<S.size()<<endl;
  for (int i = 0; i < S.size(); i++)
  {
    cout<<S[i].size();
    for (int j = 0; j < S[i].size(); j++)
    {
      cout<<" "<<S[i][j];
    }
   cout<<endl; 
  }
  
  
  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
std::ios::sync_with_stdio(false);
std::cin.tie(0);

std::cout << std::fixed;
std::cout << std::setprecision(9);
solve();

return 0;
}

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

struct Benri { Benri() { std::cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(12);}} benri;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using ull = unsigned long long;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

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

constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
//constexpr int INF = 1001001001;
constexpr ll INF = 1001001001001001001ll;
constexpr double EPS = 1e-10;
using number = long long;



number modpow(number a, number n, number mod) {
    number res = 1;
    while (n > 0) {
        if (n & 1) res = (res * a) % mod;
        a = (a * a) % mod;
        n >>= 1;
    }
    return res % mod;
}

int main(){
    ll m,n; cin >> m >> n;
    cout << modpow(m,n,MOD) << endl;
}


Measured memory_bytes: 3192
#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;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;

void test_case(){
	int n , k; cin >> n >> k;
	vector<int> hash(n);
	for(auto &x : hash)
		cin >> x;
	vector<int> value;
	for(int i = 0 ; i < n-k ; i++){
		if(hash[i] < hash[i+k])
			cout<<"Yes\n";
		else
			cout<<"No\n";
	}
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
	return 0;
}


Measured memory_bytes: 3984
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;

int main() {
  ll n, d;
  cin >> n >> d;
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    ll x, y;
    cin >> x >> y;
    if (x * x + y * y <= d * d) ans++;
  }
  cout << ans << endl;
  return 0;
}

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  double l, r;
  int cnt[4][2] = {};
  while (cin >> l >> r) {
    auto check = [&](double x) { return x >= 1.1 ? 0 : x >= 0.6 ? 1 : x >= 0.2 ? 2 : 3; };
    cnt[check(l)][0]++;
    cnt[check(r)][1]++;
  }
  for (int i = 0; i < 4; i++) {
    cout << cnt[i][0] << " " << cnt[i][1] << endl;
  }

  return 0;
}


Measured memory_bytes: 3232
// by adiforluls
#pragma GCC optimize ("-O2")
#include<bits/stdc++.h>
using namespace std;
#define FAST   ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define ll          long long
#define ld          long double
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define mii         map<int,int>
#define vi          vector<int>
#define vll         vector<long long>
#define all(a)      (a).begin(),(a).end()
#define clz(a)      __builtin_clz(a) // count leading zeroes
#define ctz(a)      __builtin_ctz(a) // count trailing zeroes
#define popc(a)     __builtin_popcount(a) // count set bits (for ints only diff for ll)
#define lul         1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
#define SIZE        1000005
#define F           first
#define S           second
#define debug(x)    cerr << #x << " = " << x << endl;
#define mod         998244353

#define TRACE

#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " = " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " = " << arg1<<" |";__f(comma+1, args...);
}
#else
#define trace(...)
#endif

#define endl        '\n'
const ld PI = acos(-1.0);
const int INF = 0x3f3f3f3f;

void solve()
{
   ll n; cin>>n;
   vll fact;
   for(ll i=1; i*i<=n; i++)
   {
     if(n%i==0)
     {
        fact.pb(i);
        if(i!=n/i) fact.pb(n/i);
     }
   }
   ll ans=0;
   for(auto i:fact)
   {
     if(i==1) continue;
     ll check=i-1;
     if(n/check==n%check) ans+=check;
   }   
   cout<<ans;
} 
int main()
{   
   FAST;
   //  #ifndef ONLINE_JUDGE
     // freopen("input.txt", "r", stdin);
     // freopen("output.txt", "w", stdout);
   //  #endif
    int t; t=1;
    while(t--){
       solve();
    }
    return 0;
}

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

int main(){
  int n,k;
  string s;
  cin >> n >> k >> s;
  int a[100002];
  for(int i=0;i<100002;i++){
    a[i]=0;
  }
  a[1]=1;
  int m=1;
  for(int i=1;i<n;i++){
    if(s.at(i)!=s.at(i-1)){
      m++;
    }
    a[m]++;
  }
  int ans=0;
  int c=2*k+1;
  int b[100002];
  for(int i=0;i<100002;i++){
    b[i]=0;
  }
  for(int i=0;i<c;i++){
    b[0]+=a[i];
  }
  for(int i=1;i+c<100002;i++){
    b[i]=b[i-1]+a[i-1+c]-a[i-1];
  }
  if(s.at(0)=='0'){
    for(int i=0;i<100002;i+=2){
      ans=max(ans,b[i]);
    }
  }
  else{
    for(int i=1;i<100002;i+=2){
      ans=max(ans,b[i]);
    }
  }
  cout << ans << endl;
}

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

using namespace std;

typedef long long int li;
typedef long double ld;
typedef vector<li> vi;
typedef pair<li,li> pi;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define B begin()
#define E end()
#define f(i,l,r) for(li i=l;i<=r;++i)
#define fr(i,l,r) for(li i=l;i>=r;--i)
#define u_map unordered_map
#define endl "\n"

li fastpow(li base,li exp,li M) 
{
    li res=1;
    while(exp>0) {
        if(exp&1)
            res=(res*base)%M;

        base=(base*base)%M;
        exp>>=1;
    }
    return res;
}

int main()
{    
    

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    li n;

    cin>>n;

    map<string,li> m;

    f(i,0,n-1)
    {
        string s;

        cin>>s;

        m[s]++;
    }

    cout<<m.size();

    return 0;
}

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

int main (){
  int A, B, count = 0;
  cin >> A >> B;
  for (int i = A; i < B + 1; i++){
    if ( i / 10000 == i % 10 && i % 10000 / 1000 == i % 100 / 10){
      count += 1;
    }     
  }
  cout << count << endl;
}

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

using namespace std;

#define ll long long 
#define Fastest ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl "\n"

int main()
{
	int a,b;
	cin >> a >> b;
	
	int ans = 1,coun = 0;
	
	while(1)
	{
		if(ans >= b) break;
		else
		{   
			ans += (a-1); 
			coun++;
	    } 
	}
	
	
	cout << coun << endl;
	return 0;
}


Measured memory_bytes: 256
N = int(input())
A = []
for i in range(1, N+1):
    A.append((i, int(input())))
A.sort(reverse=True, key=lambda x:x[1])

max_ind = A[0][0]
max_value = A[0][1]

for i in range(1, N+1):
    if i == max_ind:
        print(A[1][1])
    else:
        print(max_value)

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

using namespace std;

typedef long long ll;

const ll MOD = 1000000007;

const int MAXN = 1000000;

vector<ll> primes;
bool is_prime[MAXN + 1];

// eratosthenesの篩 O(nloglogn)
// n以下の素数を列挙して、n以下の素数の数を返す
void sieve(){
    for(int i=0;i<=MAXN;i++) is_prime[i] = true;
    is_prime[0] = is_prime[1] = false;
    for(int i=2;i<=MAXN;i++){
        if(is_prime[i]){
            primes.push_back(i);
            for(int j=2*i;j<=MAXN;j+=i) is_prime[j] = false;
        }
    }
}

ll solve(ll n, ll target){
    ll ans = 1;
    for(ll p: primes){
        ll cnt = 0;
        while(target %p == 0){
            cnt++;
            if(cnt == n){
                ans *= p;
                cnt = 0;
            }
            target /= p;
        }
    }
    return ans;
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    ll n, p; cin >> n >> p;
    if(n == 1){
        cout << p << endl;
        return 0;
    }
    sieve();
    cout << solve(n, p) << endl;
}

Measured memory_bytes: 2424