akhauriyash/Code-Regression huggingface dataset:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {
static int min = Integer.MAX_VALUE;
	
	static int[][] cache;
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] S = br.readLine().split(" ");
		int N = Integer.parseInt(S[0]);
		int K = Integer.parseInt(S[1]);
		
		int[] A = new int[N];
		
		S = br.readLine().split(" ");
		for(int i = 0; i < N ; i++) {
			A[i] = Integer.parseInt(S[i]);
			min = Math.min(min, A[i]);
		}
		
		cache = new int[2][K+1];
		Arrays.fill(cache[0], -1);
		Arrays.fill(cache[1], -1);
		
		String winner = winner(A, K) ? "First" : "Second";
		System.out.println(winner);
	}
	
	public static boolean winner(int[] A, int K) {
		int n = A.length;
		
		for(int i = 0; i < min; i++) {
			cache[0][i] = 1;
			cache[1][i] = 0;
		}
		
		for(int k = min; k <= K; k++) {
			for(int i = 0; i < n ; i++) {
				if(k-A[i] >=0 && cache[1][k-A[i]] == 0) {
					cache[0][k] = 0;
					break;
				}
			}
			
			if(cache[0][k] == -1) {
				cache[0][k] = 1;
			}
			for(int i = 0; i < n ; i++) {
				if(k-A[i] >=0 && cache[0][k-A[i]] == 1) {
					cache[1][k] = 1;
					break;
				}
			}
			
			if(cache[1][k] == -1) {
				cache[1][k] = 0;
			}
		}
		
		return cache[0][K] == 0;
	}
}


Measured memory_bytes: 27396
#include <cstdio>           // printf(), scanf()
#include <cmath>            // fabs()

#define equals(a, b) (fabs((a) - (b)) < EPS)

static const double EPS = 1e-10;

class Point
{
public:
	double x, y;

	Point(double x = 0, double y = 0): x(x), y(y) {}
	Point operator + (Point p) { return Point(x + p.x, y + p.y); }
	Point operator - (Point p) { return Point(x - p.x, y - p.y); }
};

struct Segment
{
	Point p1, p2;
};

typedef Point Vector;

double
dot(Vector a, Vector b)
{
	return a.x * b.x + a.y * b.y;
}

double
cross(Vector a, Vector b)
{
	return a.x * b.y - a.y * b.x;
}

bool
isParallel(Vector a, Vector b)
{
	return equals(cross(a, b), 0.0);
}

bool
isParallel(Point a1, Point a2, Point b1, Point b2)
{
	return isParallel(a1 - a2, b1 - b2);
}

bool
isParallel(Segment s1, Segment s2)
{
	return equals(cross(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);
}

bool
isOrthogonal(Vector a, Vector b)
{
	return equals(dot(a, b), 0.0);
}

bool
isOrthogonal(Point a1, Point a2, Point b1, Point b2)
{
	return isOrthogonal(a1 - a2, b1 - b2);
}

bool
isOrthogonal(Segment s1, Segment s2)
{
	return equals(dot(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);
}

int
main(int argc, char** argv)
{
	Segment s1, s2;
	int q, i;

	scanf("%d", &q);
	for (i = 0; i < q; ++i)
	{
		int x0, y0, x1, y1, x2, y2, x3, y3;
		int res = -1;

		scanf("%d %d %d %d %d %d %d %d", &x0, &y0, &x1, &y1, &x2, &y2, &x3, &y3);
		s1.p1.x = x0, s1.p1.y = y0;
		s1.p2.x = x1, s1.p2.y = y1;
		s2.p1.x = x2, s2.p1.y = y2;
		s2.p2.x = x3, s2.p2.y = y3;

		if (isParallel(s1, s2))
			res = 2;
		else if (isOrthogonal(s1, s2))
			res = 1;
		else
			res = 0;

		printf("%d\n", res);
	}

	return 0;
}

Measured memory_bytes: 1032
N=int(input())
a = list(map(int, input().split()))

x = 0

wa_list = []


for i in range(0,N):
    wa_list.append(x)
    x = a[i]-x


x = x//2

# print(x,wa_list)

for i in range(0,N):
    print(2*(x+wa_list[i]),'',end='')
    x *= -1


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

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
ll MOD = 1000000007;

void solve(){
	string s;
	cin >> s;
	s[3] = '8';
	P(s);
}

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


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

const int MAXN = 3e3+5;
#define ll long long
#define pb push_back

ll dp[MAXN][MAXN];
ll vis[MAXN][MAXN];

vector<ll> T;

ll result(int left, int right) {
	if(vis[left][right])
		return dp[left][right];
	vis[left][right] = true;
	if(left == right) {	 
		dp[left][right] = T[left];
		return dp[left][right];
	}
	dp[left][right] = max(T[left] - result(left+1, right), T[right] - result(left, right-1));
	return dp[left][right];
}

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

	int n;	cin >> n;
	for(int i=0; i<n; i++) {
		ll x;	cin >> x;
		T.pb(x);
	}
	cout << result(0, n-1);	
}


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

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

int main() {
	int n = ri();
	for (int i = 1; i <= 9; i++) {
		int sho = n / i;
		if (n % i == 0 && 1 <= sho && sho <= 9) {
			puts("Yes");
			return 0;
		}
	}
	puts("No");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vll vector<ll>
#define vvvl vector<vvl>
#define vvl vector<vector<ll>>
#define VV(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define VVV(a, b, c, d) vector<vvl>(a, vvl(b, vll (c, d)));
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

vll color(100001, -1);
vvl G = VV(100001, 0, 0, ll);

ll root;
bool nibu;
bool zero;
ll z = 0;
void dfs(ll now, ll from, ll b){
  if(color[now]!=-1){
    if(color[now]!=b) nibu = false;
    return;
  }
  color[now] = b;
  if(root==now&&G[now].size()==0) zero = true;
  for(auto to:G[now]){
    if(to==from) continue;
    dfs(to, now, b^1);
  }
}

int main(int argc, char const *argv[]) {
  ll n, m;std::cin >> n >> m;
  for(int i=0;i<m;i++){
    ll a, b;scanf("%lld %lld", &a, &b);a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
  }
  vll dat(2, 0);
  for(int i=0;i<n;i++){
    if(color[i]!=-1) continue;
    nibu = true;
    zero = false;
    root = i;
    dfs(i, -1, 0);
    if(zero) z++;
    else dat[nibu]++;
  }
  //std::cout << dat[0] << " " << dat[1] << " " << z << '\n';
  ll ans = 0;
  for(ll i=0;i<z;i++) ans += 2*(n-i)-1;
  ans += dat[0]+2*dat[1];
  ans += 2*dat[1]*dat[0];
  ans += 1*dat[0]*(dat[0]-1);
  ans += 2*dat[1]*(dat[1]-1);

  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 12416
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
using namespace std;
typedef pair<int, int>P;
typedef long long ll;

int main() {
	int n, m; cin >> n >> m;
	int l, r;
	int count[100010];
	fill(count, count + 100010, 0);
	for (int i = 0; i < m; i++) {
		cin >> l >> r;
		count[l]++;
		count[r + 1]--;
	}
	for (int i = 1; i <= n; i++) {
		count[i] += count[i - 1];
	}
	int ans = 0;
	for (int i = 1; i <= n; i++) {
		if (count[i] == m) {
			ans++;
		}
	}
	cout <<ans<< endl;
	return 0;
}

Measured memory_bytes: 640
'use strict';
const fs = require('fs');

function main(arg) {
    let input = arg.split(/\s/);
    let N = parseInt(input[0], 10);
    let S = input[1];
    if(N % 2 == 0) {
        let T = S.substr(Math.ceil(N / 2));
        if(S === T + T) {
            console.log('Yes');
            return;
        }
    }
    console.log('No');
}

main(fs.readFileSync('/dev/stdin', 'utf8'));


Measured memory_bytes: 7372
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;
import java.util.Arrays;

public class Main {
	public static void main(final String[] args){
    
    Scanner sc = new Scanner(System.in);
    int k = sc.nextInt();
    int x = sc.nextInt();
    List<Integer> list = new ArrayList<>();
    int minas = 0;
    int plus = 0;

    minas = x - k + 1;
    plus = x + k - 1;

    for(int i = minas; i <= plus ; i++){
        System.out.print(i + " ");
    }
    


    


    

    
    
    



    





}
}

Measured memory_bytes: 38588
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

class DisjointSet{
    public:
        vector<ll> rank,p,siz;

        DisjointSet(){}
        DisjointSet(ll size){
            rank.resize(size,0);
            p.resize(size,0);
            siz.resize(size,1);
            rep(i,size) makeSet(i);
        }

        void makeSet(ll x){
            p[x] = x;
            rank[x] = 0;
        }

        bool same(ll x, ll y){
            return root(x) == root(y);
        }

    
        void unite(ll x, ll y){
            x = root(x);
            y = root(y);
            if(rank[x] > rank[y]){
                siz[x] += siz[y];
                p[y] = x;
            }
            else{
                siz[y] += siz[x];
                p[x] = y;
                if(rank[x] == rank[y]) rank[y]++;
            } 
        }
        ll root(ll x){
            if(x != p[x]){
                p[x] = root(p[x]);
            }
            return p[x];
        }

        ll size(ll x){
            return siz[root(x)];
        }

};


int main(){
	int N,M; cin >> N >> M;
	vector<int> p(N);
	rep(i,N){
		cin >> p[i];
		p[i]--;
	}
	DisjointSet uf(N);
	rep(i,M){
		int x,y; cin >> x >> y;
		x--; y--;
		uf.unite(x,y);
	}
	int ans = 0;
	rep(i,N){
		if(p[i] == i) ans++;
		else{
			if(uf.same(p[i],i)) ans++;
		}
	}
	cout << ans << endl;

}



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

#define mp(x, y) make_pair((x), (y))

typedef long long ll;

int n, k;

struct point {
	ll a, b;
	bool operator<(const point &p) {
		ll y1, y2;
		y1=a*k+b;
		y2=p.a*k+p.b;
		if(y1<y2) return 1;
		else if(y1==y2) {
			return a>p.a;
		} else return 0;
	}
} pts[200005];

int t[200005];
int sum(int w) {
	int r=0;
	while(w) {
		r+=t[w];
		w-=(w&(-w));
	}
	return r;
}

void add(int w) {
	while(w<=n+1) {
		t[w]++;
		w+=(w&(-w));
	}
}


int main()
{
	scanf("%d%d", &n, &k);
	for(int i=1; i<=n; i++) {
		int a;
		scanf("%d", &a);
		pts[i].a=i;
		pts[i].b=pts[i-1].b+a;
	}
	for(int i=1; i<=n; i++) pts[i].b*=-1;
	sort(pts, pts+n+1);
	ll inv=0;
	for(int i=n; i>=0; i--) {
		inv+=sum(pts[i].a+1);
		add(pts[i].a+1);
	}
	printf("%lld\n", inv);

	return 0;
}

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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

    int N; cin >> N;
    int s[1000];
    int t = INT_MAX;
    int sum = 0;

    for (int i = 0;i < N;i++){
        cin >> s[i];
        if(s[i]%10 != 0 && s[i] < t) t = s[i];
        sum += s[i];
    }

    if(sum%10 != 0) cout << sum << endl;
    else cout << max(0,sum-t) << endl;

    return 0;

}

Measured memory_bytes: 256
<?php
fscanf(STDIN, "%f %f %f", $a, $b, $C);

$h  = $b * sin(deg2rad($C));
$da = $a - ($b * cos(deg2rad($C)));

$c = sqrt(pow($da, 2) + pow($h, 2));

$S = $a * $h / 2.0;
$L = $a + $b + $c;

echo "$S $L $h\n";

Measured memory_bytes: 6612
s=input()
if s=='MON':
  print(6)
elif s=='TUE':
  print(5)
elif s=='WED':
  print(4)
elif s=='THU':
  print(3)
elif s=='FRI':
  print(2)
elif s=='SAT':
  print(1)
else:
  print(7)


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

class node{
  public:
    int x;
    int y;
    int d;
    node(int x, int y, int d): x(x), y(y), d(d) {}
};

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

int main(){
  int h,w;
  cin >> h >> w;
  char a[h][w];
  bool f[h][w] = {};
  for(int x=0;x<h;x++)
    for(int y=0;y<w;y++)
      cin >> a[x][y];

  queue<node> q;
  for(int x=0;x<h;x++)
    for(int y=0;y<w;y++)
      if(a[x][y] == '#')
        q.push(node(x,y,0));
  int ans = 0;
  while(!q.empty()){
    node cur = q.front();q.pop();
    if(f[cur.x][cur.y]) continue;
    ans = max(ans, cur.d);
    f[cur.x][cur.y] = true;
    for(int i=0;i<4;i++){
      int nx = cur.x + dx[i], ny = cur.y + dy[i];
      if(f[nx][ny] || nx < 0 || ny < 0 || nx >= h || ny >= w) continue;
      q.push(node(nx, ny, cur.d + 1));
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 26420
# coding: utf-8
# Your code here!

INF = 2000000000



class Node:
    def __init__(self, num):
        self.num = num
        self.parent = self
        self.rank = 0
    
def findSet(node):
    tmp = []
    while node.parent != node:
        tmp.append(node)
        node = node.parent
    
    while tmp:
        tmp.pop().parent = node
    return node

def unite(x, y):
    node1 = findSet(nodes[x])
    node2 = findSet(nodes[y])
    if node1.rank == node2.rank:
        node2.parent = node1
        node1.rank += 1
    elif node1.rank > node2.rank:
        node2.parent = node1
    else:
        node1.parent = node2

def same(x, y):
    node1 = findSet(nodes[x])
    node2 = findSet(nodes[y])
    return node1.parent == node2.parent





class Edge:
    def __init__(self, source, target, cost):
        self.source = source
        self.target = target
        self.cost = cost
    
def kruskal():
    edges.sort(key = lambda u:u.cost)
    
    for i in range(e):
        if findSet(edges[i].source) != findSet(edges[i].target):
            unite(edges[i].source.num, edges[i].target.num)
            K.append(edges[i])
    
    total = 0
    for tmp in K:
        total += tmp.cost
    print(total)


nums=list(map(int,input().split()))
n = nums[0]
e = nums[1]

edges = []
nodes = []
for i in range(n):
    nodes.append(Node(i))

for i in range(e):
    nums=list(map(int,input().split()))
    tmp = Edge(nodes[nums[0]], nodes[nums[1]], nums[2])
    edges.append(tmp)




K = []

kruskal()






Measured memory_bytes: 29632
count = {}
count["A"] = 0
count["B"] = 0
count["C"] = 0
a = b = c = 0
N,A,B,C = map(int,input().split())
L = []
for _ in range(N):
    L.append(int(input()))
# print(a,b,c)
def score():
    joinNum = 0
    joinNum += max(0,count["A"]-1)
    joinNum += max(0,count["B"]-1)
    joinNum += max(0,count["C"]-1)
    scoreValue = 10 * joinNum + abs(A-a) + abs(B-b) + abs(C-c)
    return(scoreValue)
answer = 1000*3
for i in range(pow(4,N)):
    count["A"] = 0
    count["B"] = 0
    count["C"] = 0
    a = b = c = 0
    digits=[]
    for j in range(N):
        digit = (i%pow(4,j+1))//pow(4,j)
        digits.append(digit)
        if digit == 0:
            a += L[j]
            count["A"] += 1
        elif digit == 1:
            b += L[j]
            count["B"] += 1
        else:
            if digit == 2:
                c += L[j]
                count["C"] += 1
    if count["A"]*count["B"]*count["C"] == 0: continue
    candidate = score()
    if candidate < answer:
        # print("".join(map(str,digits)),a,b,c,abs(A-a),abs(B-b),abs(C-c),candidate)
        answer = candidate
print(answer)

Measured memory_bytes: 3064
//
//  main.cpp
//  CoderTest
//
//  Created by yuya on 2019/07/25.
//  Copyright © 2019 yuya. All rights reserved.
//

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


int main()
{
    int N;
    cin >> N;
    vector<int> A(N+1),B(N+1),C(N+1);
    for(int i=1;i<=N;i++)
    {
        cin >> A[i];
    }
    for(int i=1;i<=N;i++)
    {
        cin >> B[i];
    }
    for(int i=1;i<=N-1;i++)
    {
        cin >> C[i];
    }
    
    int sati = accumulate(B.begin(), B.end(), 0);
    
    for(int i=1;i<=N-1;i++)
    {
        if(A[i+1] - A[i] == 1)
        {
            sati += C[A[i]];
        }
    }
    
    cout << sati << endl;
    
    return 0;
}


Measured memory_bytes: 256
//“Make it work, make it right, make it fast.” – Kent Beck
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double dd;
const int siz = 1e6 + 5;
const int MOD = 1e9 + 7;
#define endl '\n'
#define deb(x) cout << #x << " = " << x << endl;
void solve(){
	int n;
	cin >> n;
	bool flag = false;
	for(int i = 1; i <= 9; i++){
		for(int j = 1; j<=9; j++)
		{
			if(i*j == n)
				{
					flag = true;
					break;
				}
		}
	}
	(flag) ? cout << "Yes\n" :cout << "No\n";
}

int main(){
	#ifndef RAY
		//freopen("input.txt", "r", stdin);
	#endif
		ios::sync_with_stdio(false);
		cin.tie(nullptr);
		int t = 1;
		//cin >> t;
		while(t--){
			solve();
		}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

ll D(P a,P b){
  return abs(a.F-b.F)+abs(a.S-b.S);
}

void Main() {
  int n,m,t;
  cin >> n >> m >> t;
  int a[n][m];
  P p[n*m+1];
  rep(i,n)rep(j,m) {
    R a[i][j];
    p[a[i][j]]=P(i,j);
  }
  ll dp[n*m+1];
  fill(dp,dp+n*m+1,MAXL);
  REP(i,1,n*m+1) {
    if(i-t<=0) dp[i]=0;
    else dp[i]=dp[i-t]+D(p[i],p[i-t]);
  }
  int T;
  R T;
  while(T--) {
    int x,y;
    cin >> x >> y;
    pr(dp[y]-dp[x]);
  }
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair< ll, ll > Pi;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<=(n);i++)
#define rep3(i,i0,n) for(int i=i0;i<(n);i++)
#define pb push_back
#define mod 1000000007
const ll INF = 1LL << 60;
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; }
ll gcd(ll a, ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) {return a/gcd(a,b)*b;}
#define all(x) x.begin(), x.end()
#define mp make_pair
bool compare(Pi a, Pi b) {
    if(a.first != b.first){
        return a.first < b.first;
        
    }else{
        return a.second < b.second;
    }
}


bool In_map(ll y,ll x,ll h,ll w){
    if(y<0 || x<0 || y>=h || x>=w){
        return 0;
    }else{
        return 1;
    }
}
const vector<ll> dx{1,0,-1,0};
const vector<ll> dy{0,1,0,-1};


int main() {
    ll N;
    string S;
    cin >>S;
    N=S.size();
    if(N==2){
        if(S[0]==S[1]){
            cout<<1<<" "<<2<<endl;
            return 0;
        }
    }
    rep(i,N-2){
        if(S[i]==S[i+1]||S[i]==S[i+2]||S[i+1]==S[i+2]){
            cout<<i+1<<" "<<i+3<<endl;
            return 0;
        }
    }
    
    cout<<-1<<" "<<-1<<endl;


    return 0;
    

}

Measured memory_bytes: 3704
n = int(input())

if n >= 1000:
  siharai = n % 1000
  if siharai == 0:
    print(0)
  else:
    otsuri = 1000 - siharai
    print(otsuri)
  
else:
  otsuri = 1000 - n
  print(otsuri)

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

class Program{

    static void Main(string[] args){
        int[,] AdjMatrix = new int[10,10];
        string[] hw = Console.ReadLine().Split(' ');
        int h = int.Parse(hw[0]);
        int w = int.Parse(hw[1]);
        for(var i = 0; i < 10; ++i){
            string[] line = Console.ReadLine().Split(' ');
            for(var j = 0; j < 10; ++j){
                AdjMatrix[i, j] = int.Parse(line[j]);
            }
        }
        var cost = Warshall_Floyd(AdjMatrix);
        long ans = 0;
        for(var i = 0; i < h; ++i){
            string[] line = Console.ReadLine().Split(' ');
            for(var j = 0; j < w; ++j){
                var cur = int.Parse(line[j]);
                if(cur != 1 && cur != -1){
                    ans += cost[cur];
                }
            }
        }
        Console.WriteLine(ans);
    }

    static int[] Warshall_Floyd(int[,] mat){
        int[,] dist = new int[10,10];
        for(var i = 0; i < 10; ++i){
            for(var j = 0; j < 10; ++j){
                dist[i,j] = (mat[i,j] == 0) ? 99999 : mat[i,j];
            }
        }

        for(var i = 0; i < 10; ++i){
            for(var j = 0; j < 10; ++j){
                for(var k = 0; k < 10; ++k){
                    if(dist[j,k] > dist[j,i] + dist[i,k]){
                        dist[j,k] = dist[j,i] + dist[i,k];
                    }
                }
            }
        }

        int[] ans = new int[10];
        for(var i = 0; i < 10; ++i){
            ans[i] = dist[i, 1];
        }
        return ans;
    }
}


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

typedef long long ll;
#define all(x) (x).begin(),(x).end()

template<typename T>
T mod(T a, T b){
    return (a + b) % b;
}

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

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

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

// 文字列に "hoge" が含まれているか
// string str = "hogepiyo";
// if (str.find("hoge") != string::npos) {
//     cout << "文字列が含まれています" << endl;
// }

// char to string
// char c = 'a';
// string str = {c};

void solve(){
    ll A, B, K;
    cin >> A >> B >> K;

    if (A <= K) {
        cout << 0 << " ";
        K -= A;
        if (B <= K) cout << 0 << endl;
        else cout << B - K << endl;
    } else {
        cout << A - K << " " << B << endl;
    }

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
def main():
    from itertools import accumulate
    n = int(input())
    f = lambda x: 1 if x == "W" else 0
    *s, = map(f, list(input()))
    t = list(accumulate(s))
    u = t[-1]
    ans = n

    for i, (j, k) in enumerate(zip(s, t)):
        m = (k - j) + (n - 1 - i) - (u - k)
        ans = min(ans, m)
    print(ans)


if __name__ == '__main__':
    main()


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

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) i64((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

const i64 NUM = 1000000007LL;

i64 modpow(i64 a, i64 b) {
  i64 ans = 1;
  //cout << a << " " << b << endl;
  while(b != 0) {
    if(b % 2 == 1) {
      ans *= a;
      ans %= NUM;
    }
    a = a * a;
    a %= NUM;
    b /= 2;
  }
  return ans;
}

i64 modinv(i64 a) {
  return modpow(a, NUM-2);
}


int main(int argc, char *argv[]) {
  i64 N, K, i;
  cin >> N >> K;
  vi A(N);
  i64 n_neg = 0;
  REP(0, N, i) {
    cin >> A[i];
    if(A[i] <= 0) {
      n_neg++;
    }
  }
  
  if(n_neg == N) {
    i64 ans = 1;
    if(K % 2 == 0) {
      sort(all(A), less<i64>());
    }
    else {
      sort(all(A), greater<i64>());
    }
    REP(0, K, i) {
      ans *= (A[i] + NUM) % NUM;
      ans %= NUM;
    }
    cout << ans << endl;
    return 0;
  }

  sort(all(A), [](i64 a, i64 b) {
      return abs(a) > abs(b);
    });

  i64 last_pos = -1, last_neg = -1;
  i64 ans = 1, c_neg = 0;
  REP(0, K, i) {
    if(A[i] > 0) {
      last_pos = i;
    }
    else {
      last_neg = i;
      c_neg ++;
    }
    ans *= (A[i] + NUM) % NUM;
    ans %= NUM;
  }
  if(c_neg % 2 == 1 && K < N) {
    i64 next_pos = -1, next_neg = -1;
    REP(K, N, i) {
      if(next_pos == -1 && A[i] > 0) {
	next_pos = i;
      }
      if(next_neg == -1 && A[i] <= 0) {
	next_neg = i;
      }
    }

    if(next_neg == -1) { // only pos
      ans *= modinv((A[last_neg] + NUM) % NUM);
      ans %= NUM;
      ans *= A[next_pos];
      ans %= NUM;
    }
    else if(next_pos == -1 && last_pos != -1) { // only neg
      ans *= modinv((A[last_pos] + NUM) % NUM);
      ans %= NUM;
      ans *= (A[next_neg] + NUM) % NUM;
      ans %= NUM;
    }
    else {
      if(last_pos == -1) {
	ans *= modinv((A[last_neg] + NUM) % NUM);
	ans %= NUM;
	ans *= A[next_pos];
	ans %= NUM;
      }
      else {
	if(A[last_pos] * A[next_pos] > A[last_neg] * A[next_neg]) {
	  ans *= modinv((A[last_neg] + NUM) % NUM);
	  ans %= NUM;
	  ans *= A[next_pos];
	  ans %= NUM;
	}
	else {
	  ans *= modinv((A[last_pos] + NUM) % NUM);
	  ans %= NUM;
	  ans *= (A[next_neg] + NUM) % NUM;
	  ans %= NUM;
	}
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 4792
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class Main{
	
	public static void main(String[] args)
	{
		new Main().run();
	}
	
	public void run()
	{
		Scanner file = new Scanner(System.in);
		long K = file.nextLong();
		long A = file.nextLong();
		long B = file.nextLong();
		long opt1 = K+1;
		long L = K-A+1;
		long opt2 = L/2*(B-A)+A+(L%2);
		System.out.println(Math.max(opt1, opt2));
	}
	
}


Measured memory_bytes: 22868
#include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <limits>
#include <cmath>
#include <iomanip>
#include <functional>
#include <random>
#include <boost/multiprecision/cpp_int.hpp>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
ll BASE_NUM = 1000000007;


int main()
{
  // 整数の入力

  ll N, M, X;
  cin >> N >> M >> X;
  vector<ll> C(N);
  vector<vector<ll>> A(N,vector<ll>(M,0));
  for(int i = 0;i < N;i++){
    cin >> C[i];
    for(int j = 0; j < M;j++){
      cin >> A[i][j];
    }
  }

  ll min_cost = BASE_NUM;
  for(int i = 0;i< (1<<N);i++){
    vector<ll> understands(M,0);
    ll cost = 0;
    for(int j = 0;j < N;j++){
      if(i & (1<<j)){
        cost += C[j];
        for(int k = 0;k < M;k++){
          understands[k] += A[j][k];
        }
      }
    }

    bool understood = true;
    for(int k = 0;k < M;k++){
      if (understands[k] < X){
        understood = false;
      }
    }
    if (understood){
      min_cost = min(min_cost,cost);
    }

  }
  if (min_cost == BASE_NUM){
    cout << -1 << endl;
  }else{
    cout << min_cost << endl;
  }
  return 0;
}

Measured memory_bytes: 3628
N,K,*A = map(int, open(0).read().split())
Ap = []
An = []
Az = []
for c in A:
  if c>0:
    Ap.append(c)
  elif c<0:
    An.append(c)
  else:
    Az.append(c)
l = -10**20
r = 10**20
Ap.sort(reverse=True)
An.sort()
while l+1<r:
  s = (l+r)//2
  cnt = 0
  j = len(Ap)-1
  for i in range(len(Ap)):
    while j>-1 and Ap[i]*Ap[j]<s:
      j -= 1
    cnt += len(Ap)-1-j
  for i in range(len(Ap)):
    if Ap[i]*Ap[i]<s:
      cnt -= 1
  j = len(An)-1
  for i in range(len(An)):
    while j>-1 and An[i]*An[j]<s:
      j -= 1
    cnt += len(An)-1-j
  for i in range(len(An)):
    if An[i]*An[i]<s:
      cnt -= 1
  cnt //= 2
  if s>0:
    cnt += len(Az)*(len(Az)-1)//2 + len(Az)*(len(Ap)+len(An)) + len(Ap)*len(An)
  else:
    j = 0
    for i in range(len(Ap)-1,-1,-1):
      while j<len(An) and Ap[i]*An[j]<s:
        j += 1
      cnt += j
  if cnt>=K:
    r = s
  else:
    l = s
print(l)


Measured memory_bytes: 97800
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author CodeMonk
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int a = in.nextInt(), b = in.nextInt(), c = in.nextInt(), d = in.nextInt(), e = in.nextInt(), f = in.nextInt();
            int[] ok = new int[50];
            ok[0] = 1;
            for (int i = 1; i < 50; i++) {
                if (i - a >= 0) ok[i] |= ok[i - a];
                if (i - b >= 0) ok[i] |= ok[i - b];
            }
            int[] ok2 = new int[4000];
            ok2[0] = 1;
            for (int i = 1; i < 4000; i++) {
                if (i - c >= 0) ok2[i] |= ok2[i - c];
                if (i - d >= 0) ok2[i] |= ok2[i - d];
            }
            long mw = 1, ms = -1;
            for (int i = 1; 100 * i <= f && i < 50; i++) {
                for (int j = 0; 100 * i + j <= f && j < 4000; j++) {
                    if (j > i * e) continue;
                    if (ok[i] == 0) continue;
                    if (ok2[j] == 0) continue;                  
                    if (ms * (100 * i + j) < (100 * mw + ms) * j) {
                        mw = i;
                        ms = j;
                    }
                }
            }
            out.println(mw * 100 + ms + " " + ms);
        }

    }
}



Measured memory_bytes: 22740
/*BISMILLAH
THE WHITE WOLF
NO DREAM IS TOO BIG AND NO DREAMER IS TOO SMALL*/

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<long long> vll;
typedef vector<int> vi;

#define io ios_base::sync_with_stdio(false)
#define pb push_back

#define eb emplace_back
#define mod   1000000007
#define PI 2*acos(0.0)
#define all(r)(r).begin(),(r).end()
#define dbg(a) cout<<#a<<" ->->->-> "<<a<<"\n"
#define inf 1000000000000000000
#define N 200000
int dirx[] = {1, -1,0, 0}, diry[] = {0, 0, 1, -1};


//=============================================ASIFAZAD==============================================//

int32_t main()
{
    io;
    int n;
    cin>>n;
    vi inp(n);
    for(auto& x: inp) cin>>x;
    ll ans = 0;
    for(int i = 1; i<n; i++)
    {
        if(inp[i-1] > inp[i])
        {
            ans += (inp[i-1] - inp[i]);
            inp[i] = inp[i-1];
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 4044
#include "stdio.h"

int main(void){
  int N;
  if(scanf("%d", &N)==EOF)
    return 0;
  int a[N];
  int max, sum;
  for(int i=0; i <N; i++){
  	if(scanf("%d", &a[i])==EOF) return 0;
    if(a[i] >= max)
      max = a[i];
  }
  int flag =1;
  for(int i=0; i < N; i++){
    if(a[i]==max && flag ==1){
      sum += a[i] / 2;
      flag = 0;
    }
    else
      sum += a[i];
  }
  printf("%d", sum);

}


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

int main(){
    int H, W;
    cin >> H >> W;
    char a[100][100];
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            cin >> a[i][j];
        }
    }
    //行の圧縮
    int flag = 0;
    int comp[100][100] = {};
    char first;
    for(int i=0;i<H;i++){
        first = a[i][0];
        if(first == '.'){
            for(int j=1;j<W;j++){
                if(a[i][j] != first)
                    flag = 1;
            }
            if(flag == 0){ //圧縮
                for(int j=0;j<W;j++)
                    comp[i][j] = 1;
            }
        }
        flag = 0;
    }
    //列の圧縮
    for(int j=0;j<W;j++){
        first = a[0][j];
        if(first == '.'){
            for(int i=1;i<H;i++){
                if(a[i][j] != first)
                    flag = 1;
            }
            if(flag == 0){ //圧縮
                for(int i=0;i<H;i++)
                    comp[i][j] = 1;
            }
        }
        flag = 0;
    }
    //出力
    char last = 0;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if(comp[i][j] == 0){
                cout << a[i][j];
                last = 1;
            }
        }
        if(last == 1)
            cout << endl;
        last = 0;
    }
    return 0;
}

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

using namespace std;

typedef long double ld;
typedef long long ll;
typedef complex<ld> P;

#define EPS (1e-10)
#define rep(i, n) for(int i = 0; i < n; i++)

ld dist(P c1, P c2){
    return sqrt((c1.real()-c2.real())*(c1.real()-c2.real()) + (c1.imag()-c2.imag())*(c1.imag()-c2.imag()));
}

ld dot(P c1, P c2){
    return c1.real()*c2.real() + c1.imag()*c2.imag();
}

ld product(P c1, P c2){
    return c1.real()*c2.imag() - c1.imag()*c2.real();
}

ld norm(P c){
    return sqrt(dot(c, c));
}

P intersection(P a1, P a2, P b1, P b2){
    P a = a2-a1, b = b2-b1;
    return a1 + a * (product(b, b1-a1) / product(b, a));
}

bool is_intersected(P a1, P a2, P b1, P b2){
    return ( product(a2-a1, b1-a1) * product(a2-a1, b2-a1) < EPS) && (product(b2-b1, a1-b1) * product(b2-b1, a2-b1) < EPS);
}

P circum_coordinate(P a1, P a2, P a3){
    ld px, py;
    ld x1, y1, x2, y2, x3, y3;
    x1 = a1.real(); y1 = a1.imag();
    x2 = a2.real(); y2 = a2.imag();
    x3 = a3.real(); y3 = a3.imag();

    py = ((x3-x1)*(x1*x1 + y1*y1 - x2*x2 - y2*y2) - (x2-x1)*(x1*x1 + y1*y1 - x3*x3 - y3*y3))/((x3-x1)*(y1-y2)*2.0 - (x2-x1)*(y1-y3)*2.0);
    if(x2-x1 < EPS) px = ((y1-y3)*2.0*py - x1*x1 - y1*y1 + x3*x3 + y3*y3)/((x3-x1)*2.0);
    else px = ((y1-y2)*2.0*py - x1*x1 - y1*y1 + x2*x2 + y2*y2)/((x2-x1)*2.0);
    return P(px, py);
}

int main(void){
    int N; cin >> N;
    ld ans = 2000.0;
    P CO[N];
    rep(i, N){
        ld x, y; cin >> x >> y;
        CO[i] = P(x, y);
    }
    for(int i = 0; i < N; i++){
        P p1 = CO[i];
        for(int j = i+1; j < N; j++){
            P p2 = CO[j];
            P center = P((p1.real()+p2.real())/2, (p1.imag()+p2.imag())/2);
            ld range = dist(p1, p2)/2;
            bool ok = true;

            for(int k = 0; k < N; k++){
                if(k == i || k == j) continue;
                if(dist(CO[k], center) > range + EPS) ok = false;
            }
            if(ok){
                ans = min(ans, range);
            }
        }
    }

    for(int i = 0; i < N; i++){
        P p1 = CO[i];
        for(int j = i+1; j < N; j++){
            P p2 = CO[j];
            for(int k = j+1; k < N; k++){
                P p3 = CO[k];
                //p1, p2, p3が同一直線上(すなわち外積0) -> continue
                if(abs(product(p2-p1, p3-p1)) < EPS){
                    continue;
                }
                P center = circum_coordinate(p1, p2, p3); //外接円の中心座標
                ld range = dist(center, p3); //外接円の半径
                bool ok = true;
                for(int l = 0; l < N; l++){
                    if(l == i || l == j || l == k) continue;
                    if(dist(CO[l], center) > range) ok = false;
                }
                if(ok) ans = min(ans, range);
            }
        }
    }
    double res = ans;
    printf("%.10f\n", res);
}

Measured memory_bytes: 256
//Keep Working hard
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr);cout.precision(10);

const int N = 1e5+5;
int a[N];

void solve()
{
    string s;
    cin >> s;
    map<int,int> mp;
    for(int i = 0; i < 4; i++)
    {
        mp[s[i]-'A']++;
    }
    for(auto i : mp)
    {
        if(i.second != 2)
        {
            cout <<"No";
            exit(0);
        }
    }
    cout <<"Yes";

}

void fileIO()
{
    #ifndef ONLINE_JUDGE
    freopen("int.txt","r",stdin);
    freopen("out.txt","w",stdout);
    #endif
}

int32_t main()
{
    IOS;
 //   fileIO();
    int t = 1;
    while(t--)
    {
        solve();
    }
    return 0;
}


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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<ll> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int MOD2 = MOD + 2; //1007681537;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define db(x) cerr << #x << " = " << (x) << " ";
#define endln cerr << "\n";

int main() 
{
  string s,t;
  cin>>s>>t;
  int len=s.length();
  if(len>=t.length() || s!=t.substr(0,len))
  {
    cout<<"No"<<endl;
  }
  else 
    cout<<"Yes"<<endl;
  return 0;
}























Measured memory_bytes: 3628
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#define _USE_MATH_DEFINES
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007; // 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
/*-------------------------------------------------*/
int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int n; cin >> n;
  map<string, long long> mp;
  REP(i, n) {
    string s; cin >> s;
    sort(ALL(s));
    ++mp[s];
  }
  long long ans = 0;
  for (auto pr : mp) ans += pr.second * (pr.second - 1) / 2;
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 11264
#include<bits/stdc++.h>
using namespace std ;
int main()
{
     int a[200010] , b , n , k ;
     cin >> n >> k ;
     for(int i = 1 ; i <= n ; i++)
     {
          cin >> a[i] ;
     }
     for(int i = k+1 ; i <= n ; i++)
     {
          if(a[i] > a[i-k])
          {
               cout << "Yes\n" ;
          }
          else
          {
               cout << "No\n" ;
          }
     }
}


Measured memory_bytes: 4400
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
 
#define MAXX 10005
 
#define PI 3.14159265358979323846264338327950
 
#define F first
#define S second
 
#define ll 	 long long int
 
#define mod  1000000007



int main()
{
	FAST;
	ll n, k;
	cin >> n >> k;
	if(n % k){
		cout << 1;
	}
	else{
		cout << 0;
	}

	return 0;
}

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

#define GET_MACRO(_1,_2,_3,_4,NAME,...) NAME
#define REP2(i,n) for(int i=0;i<(int)(n);i++)
#define REP3(i,m,n) for(int i=m;i<(int)(n);i++)
#define REP4(i,m,n,s) for(int i=m;(s>0 and i<(int)(n)) or (s<0 and i>(int)(n));i+=s)
#define REP(...) GET_MACRO(__VA_ARGS__, REP4, REP3, REP2)(__VA_ARGS__)
#define REPIT(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define PIS(x) printf("%d ",x)
#define PN() putchar('\n')
#define PRINTARR(a,b) for(int i=0;(a+i)!=(b);i++){cout << *(a+i) << " ";}PN();
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define MT make_tuple

typedef pair<int, int> PII;
typedef tuple<int, int, int> T3I;
typedef long long LL;
typedef unsigned long long ULL;

void RI() {}
template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d", &head);
    RI(tail...);
}
void RLL() {}
template<typename... T>
void RLL( LL& head, T&... tail ) {
    scanf("%lld", &head);
    RLL(tail...);
}
void print() {putchar('\n');}
template<typename T, typename... U>
void print(T head, U... tail) {
    cout << head << " ";
    print(tail...);
}

const int MOD = 1000000007;
#define MAX_N 105
int cnt[26];

int main()
{
    int H, W;
    RI(H, W);
    REP(i, H) {
        char s[MAX_N];
        scanf("%s",s);
        REP(j, W) {
            cnt[(int)s[j] - 'a'] += 1;
        }
    }
    int cnt1 = 0, cnt2 = 0;
    REP(i, 26) {
        int r = cnt[i] % 4;
        if(r == 3) {
            cnt1 += 1;
            cnt2 += 1;
        } else if(r == 2) {
            cnt2 += 1;
        } else if(r == 1) {
            cnt1 += 1;
        }
    }
    int ok1 = 0, ok2 = 0;
    if(H % 2 == 1 and W % 2 == 1) {
        ok1 = 1;
    }
    if(H % 2 == 1) {
        ok2 += W / 2;
    }
    if(W % 2 == 1) {
        ok2 += H / 2;
    }
    if(cnt1 == ok1 and cnt2 <= ok2) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String [] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Map<Integer,Map<Integer,Integer>> L = new HashMap<>();
        Map<Integer,Integer> OPT = new HashMap<>();
        for(int i=0;i<n;i++){
            int v = sc.nextInt();
            int k = sc.nextInt();
            OPT.put(v,999999999);
            Map<Integer,Integer> C = new HashMap<>();
            for(int j=0;j<k;j++){
                int u = sc.nextInt();
                int c = sc.nextInt();
                C.put(u,c);
            }
            L.put(v,C);
        }
        OPT.replace(0,0);
        Dijkstra(L,OPT);
        for(int i:OPT.keySet()) System.out.println(i+" "+OPT.get(i));
    }
    public static void Dijkstra(Map<Integer,Map<Integer,Integer>> L,Map<Integer,Integer> OPT){
        Deque<Integer> Q = new ArrayDeque<>();
        Q.add(0);
        while(Q.size()!=0){
            int now = Q.poll();
            for(int i:L.get(now).keySet()){
                if(OPT.get(now)+L.get(now).get(i)<OPT.get(i)) {
                    Q.add(i);
                    OPT.replace(i,L.get(now).get(i)+OPT.get(now));
                }
            }
        }
    }
}


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

int N;
const int MAX_N = 10000;
int a[MAX_N];
int b[MAX_N];

int main()
{
	cin >> N;
	while(N){
		int geta=0,getb=0;
		for(int i=0;i<N;i++){
			cin >> a[i] >> b[i];
			if(a[i] > b[i])
				geta += a[i] + b[i];
			else if(a[i] < b[i])
				getb += a[i] + b[i];
			else{
				geta += a[i];
				getb += b[i];
			}
		}
		cout << geta << " " << getb << endl;
		cin >> N;
	}
	return 0;
}

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

#define fast                     ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int                      long long 
#define pb                       push_back
#define pii                      pair<int,int>
#define vi                       vector<int>
#define vii                      vector<pii>
#define mi                       map<int,int>
#define mii                      map<pii,int>
#define all(a)                   (a).begin(),(a).end()
#define F                        first
#define S                        second
#define sz(x)                    (int)x.size()
#define endl                     '\n'
#define MOD                      1000000007
#define loop(i,a,b)              for(int (i)=(a);(i)<(b);(i)++)
#define rloop(i,a,b)             for(int (i)=(a);(i)>=(b);(i)--)
#define Unique(A)                (A).resize(distance((A).begin(),unique(all((A)))))
#define MXe(A)                   *max_element(all(A))
#define MNe(A)                   *min_element(all(A))
#define SP(val,precision)        fixed << setprecision((precision)) << (val)
#define setBits(x)               __builtin_popcountll(x)
#define zroBits(x)               __builtin_ctzll(x)
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
#define mem(name,val)            memset(name,val,sizeof(name))
#define traceA(A,x)              cerr<<#A<<": ";loop(i,0,x)cerr<<A[i]<<' ';cerr<<endl
#define traceV(A)                cerr<<#A<<": ";for(auto i:A)cerr<<i<<' ';cerr<<endl
#define traceM(A,n,m)            cerr<<#A<<": "<<endl;loop(i,0,n){loop(j,0,m) cerr << A[i][j] << ' ';cerr << endl;}
#define maxheap                  priority_queue<int>
#define minheap                  priority_queue<int,vector<int>,greater<int>>

template<typename T> T pow(T a,T b, int m){T ans=1; while(b>0){ if(b%2==1) ans=(ans*a)%m; b/=2; a=(a*a)%m; } return ans%m; }

using namespace std;

const int N = 2e5+77;
int A[N];
string a,b;

void sol(){
    cin >> a;
    int ans = 0 , c= 0;
    loop(i,0,sz(a)){
        if(a[i]=='R')c++;
        else c = 0;
        ans = max(ans,c);
    }
    cout << ans << endl;
}

int32_t main(){
    int t = 1;  while(t--) sol();
    return 0;
}

Measured memory_bytes: 3632
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int K = sc.nextInt();
		
		int[] A = new int[N];
		
		for(int i = 0; i < N; i++) {
			A[i] = sc.nextInt();
		}
		
		Arrays.sort(A);
		int x = 1;
		int count = 0;
		
		for(int i = 1; i < N; i++) {
			x += K - 1;
			count++;
			if(x >= N) {
				break;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 50916
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
using ll=long long;
#define rep(i,a,b) for(ll i=a;i<ll(b);i++)
#define repr(i,a,b) for(ll i=a;i>=ll(b);i--)
#define endl "\n"
#define ALL(x) x.begin(),x.end()
#define ALLR(x) x.rbegin(),x.rend()
#define INF 1e9
#define DEBUG(x) cout<<"debug: "<<x<<endl
using namespace std;

int n, m;
int main() {
	cin >> n >> m;
	rep(i, 0, m){
		int t; cin >> t;
		n -= t;
	}
	cout << max(-1, n) << endl;
	return 0;
}


Measured memory_bytes: 3132