akhauriyash/Code-Regression huggingface dataset:
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>

//#define int long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(a) (signed)((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

using namespace std;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;

const int MOD = 1000000007;

#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"  << " " << __FILE__ << endl;

signed main(void) {
    ios::sync_with_stdio(false);
    cout.setf(ios::fixed, ios::floatfield);
    cout.precision(10);
    cin.tie(0);

    int a,b,c,d;
    cin >> a >> b >> c >> d;
    cout << max(a*b,c*d) << endl;
    
    return 0;
}


Measured memory_bytes: 888
/**
 *  author: mahfuzz
 *  created: 27.04.2020
**/
 
#include <bits/stdc++.h>
using namespace std;
#define all(a) (a).begin(), (a).end()
#define trace(x) cout << #x << ':' << x << "\n"
typedef long long ll;

int main(int argc, char* argv[]){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    
    int n; cin >> n;
    string s, t; cin >> s >> t;
    
    int mx = 0;
    for(int i = 0; i < n; i++){
        string x = s.substr(i, string::npos);
        string z = t.substr(0, n - i);
        
        if(x == z){
            mx = max(mx, n - i);
        }
    }
    
    cout << 2 * n - mx<< "\n";
    
    
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
using namespace std;
pair<int,int>st[2097152];
void add(int a,int b){
	a+=1048576;
	st[a].second+=b;a/=2;
	while(a){
		if(st[a*2].second<st[a*2+1].second)st[a]=st[a*2+1];
		else st[a]=st[a*2];
		a/=2;
	}
}
int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	for(int i=0;i<1048576;i++){
		st[1048576+i].first=i+1;
	}
	for(int i=1048575;i>=1;i--){
		st[i].first=st[i*2].first;
	}
	for(int i=0;i<b;i++){
		int c,d;
		scanf("%d%d",&c,&d);
		c--;
		add(c,d);
		printf("%d %d\n",st[1].first,st[1].second);
	}
}

Measured memory_bytes: 17408
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
 */
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);
    A solver = new A();
    solver.solve(1, in, out);
    out.close();
  }

  static class A {
    public void solve(int testNumber, Scanner in, PrintWriter out) {
      String N = in.next();

      if (N.contains("7")) {
        out.print("Yes");
      } else {
        out.print("No");
      }
    }

  }
}



Measured memory_bytes: 27064
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <math.h>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <utility>
#include <set>
#include <queue>
using namespace std;
typedef long long int ll;
typedef long double ld;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const long long INF = 1LL << 60;
typedef pair<ll,ll> pairs;
vector<pairs> p;
bool pairCompare(const pair<double,ll>& firstElof, const pair<double,ll>& secondElof){
    return firstElof.first < secondElof.first;
}
#define MAX_N 100100
bool x[MAX_N];
ll num[MAX_N];
ll fibl[MAX_N]={0};
// 四方向への移動ベクトル
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

ll fib(ll a){
    if (fibl[a]!=0)return fibl[a];
    if (a==0){
        return 0;
    }else if (a==1){
        return 1;
    }
    return fibl[a]=fib(a-1)+fib(a-2);
}
 
ll eratosthenes(ll n) {
    int p = 0;
    for (ll i=0; i<=n; ++i) x[i] = true;
    x[0] = x[1] = false;
    for(int i=2; i<=n; ++i) {
        if(x[i]) {
            p++;
            for(int j=2*i; j<=n; j+=i) x[j] = false;
        }
        
        num[i] = p;
    }
    return p;
}
 
ll gcd(ll a,ll b){
    if (a%b==0)return(b);
    else return(gcd(b,a%b));
}
 
ll keta(ll N){
    int tmp{};
    while( N > 0 ){
        tmp += ( N % 10 );
        N /= 10;
    }
    N = tmp;
    return N;
}

int main(){
    ll n,k;
    cin >> n >> k;
    n=n%k;
    cout << min(n,abs(k-n)) << endl;
    return 0;
}


Measured memory_bytes: 256
n, p = [int(i) for i in input().split()]
queue = []
for i in range(n):
    name, time = input().split()
    queue.append((name, int(time)))

moment = 0
while queue:
    name, time = queue.pop(0)
    remain = time - p
    if remain <= 0:
        moment += time
        print(name, moment)
    else:
        moment += p
        queue.append((name, remain))
        


Measured memory_bytes: 12240
#include <bits/stdc++.h>
#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 IMAX 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long llong;

int main() // 140-D
{
	int N, K;
	cin >> N >> K;
	string S;
	cin >> S;

	// 現在幸福な人を数える
	int happy = 0;
	char prev;
	REP(idx, N) {
		if (idx != 0) {
			if (prev == S[idx]) {
				++happy;
			}
		}
		prev = S[idx];
	}
	int result = happy + 2 * K;
	if (result > N - 1) {
		result = N - 1;
	}

	cout << result << endl;

	return 0;
}


Measured memory_bytes: 512
#include<cstdio>
#include<cstdlib>
#include<map>
#include<vector>
using namespace std;
typedef pair<int, int> P;

const int MAX_D = 9e4, MAX_Q = 1e5;
int h, w, d, q;
int l[MAX_Q], r[MAX_Q];
map<int, P> p[MAX_D];
vector<int> cost[MAX_D];

int main() {
    scanf("%d %d %d", &h, &w, &d);
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            int a;
            scanf("%d", &a);
            p[a % d].emplace(a, P(i, j));
        }
    }
    scanf("%d", &q);
    for (int i = 0; i < q; i++) scanf("%d %d", &l[i], &r[i]);

    for (int i = 0; i < d; i++) {
        cost[i].push_back(0);
        for (map<int, P>::iterator j = next(p[i].begin()), e = p[i].end(); j != e; j++) {
            cost[i].push_back(cost[i].back()
            + abs(j->second.first - prev(j)->second.first)
            + abs(j->second.second - prev(j)->second.second));
        }
    }

    for (int i = 0; i < q; i++) {
        int a = l[i] % d;
        printf("%d\n", cost[a][(a == 0) ? r[i] / d - 1 : r[i] / d] - cost[a][(a == 0) ? l[i] / d - 1 : l[i] / d]);
    }
    return 0;
}


Measured memory_bytes: 16000
#include<bits/stdc++.h>
using namespace std;
int main() {
// Time Complexity: O(N lg N)
// Space Complexity: O(N)
int n, mod(998244353);
cin >> n;
array<int, 2> robots[n];
long long dp[n+1];
for (int i = 0; i < n; ++i) cin >> robots[i][0] >> robots[i][1];
sort(robots, robots + n);
dp[n] = 1;
stack<pair<int, int>> st;
st.push({n, INT_MAX});
for (int i = n - 1; i >= 0; --i) {
while (st.top().second < robots[i][0] + robots[i][1]) st.pop();
dp[i] = (dp[st.top().first] + dp[i+1]) % mod;
st.push({i, robots[i][0]});
}
cout << dp[0] << '\n';
return 0;
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std; typedef long long ll;
const int MAXN = 10 + 1e6;
const ll oo = 1 + 1e18, mod = 7 + 1e9;

int main(){
    #define TASK "ABC"
    #ifndef ONLINE_JUDGE
    freopen(TASK".inp","r",stdin),freopen(TASK".out","w",stdout);
    #endif ONLINE_JUDGE
    ios_base::sync_with_stdio(0);
    cin.tie(0),cout.tie(0);

    int x; cin >> x;
    cout << (x == 1 ? 0 : 1);



    return 0;
}


Measured memory_bytes: 3628
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    double N = sc.nextDouble();
    double D = sc.nextDouble();
    double x = N / (2 * D + 1);
    System.out.println((int)Math.ceil(x));
  }
}

Measured memory_bytes: 23124
#include <algorithm>
#include <iostream>
int n, m, a[100010], b[100010], c[100010], ans;
int main() {
    std::cin >> n;
    for (int i = 1; i <= n; i++) std::cin >> a[i];
    std::sort(a + 1, a + n + 1);
    for (int i = 1; i <= n; i++)
        if (a[i] != c[m])
            c[++m] = a[i], b[m] = 1;
        else
            b[m]++;
    for (int i = 1; i <= m; i++)
        if (b[i] >= c[i])
            ans += b[i] - c[i];
        else
            ans += b[i];
    std::cout << ans << std::endl;
    return 0;
}

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
vector<int> dp[10005];
int N, M;
vector<int> A;
int match[10] = {100, 2, 5, 5, 4, 5, 6, 3, 7, 6};
bool comp(vector<int> a, vector<int> b) {
    if(a[0] != b[0]) return a[0] > b[0];
    for(int i = 9; i >= 1; i--) {
        if(a[i] != b[i]) return a[i] > b[i];
    }
    return true;
}
int main() {
    //cout.precision(10);
    cin >> N >> M;
    for(int i = 0; i < M; i++) {
        int in;
        cin >> in;
        A.push_back(in);
    }
    vector<int> ZERO(11);
    dp[0] = ZERO;
    for(int i = 1; i <= N; i++) {
        dp[i] = ZERO;
        dp[i][0] = -INF;
        for(int j = 0; j < M; j++) {
            int val = A[j];
            if(i - match[val] < 0) continue;
            vector<int> now = dp[i - match[val]];
            now[0]++;
            now[val]++;
            if(comp(now, dp[i])) {
                swap(now, dp[i]);
            }
        }
        //cout << endl << i << endl;
        for(int j = 1; j <= 9; j++) {
            //cout << j << " " << dp[i][j] << endl;
        }
    }
    for(int i = 9; i >= 1; i--) {
        for(int TIME = 0; TIME < dp[N][i]; TIME++) {
            cout << i;
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 1152
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<vector>
#define INF 999999
using namespace std;
int main(){
    string reg[300],num;
    int FLG=0,L,LL;
    cin>>L;
    for(int i=0;i<L;i++){
        cin>>reg[i];
    }
    cin>>LL;
    while(LL--){
        int uno=0;
        cin>>num;
        for(int i=0;i<L;i++){
            if(num==reg[i]){
                if(FLG==0){cout<<"Opened by "<<num<<endl;FLG=1;uno=1;break;}
                if(FLG==1){cout<<"Closed by "<<num<<endl;FLG=0;uno=1;break;}
            }
        }
    if(uno==0)cout<<"Unknown "<<num<<endl;
    }
    return 0;
}

Measured memory_bytes: 1220
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var N = cin.ReadInt;
            var B = cin.ReadIntArray(N-1);

            var A = new List<int>();
            A.Add(B[0]);
            for(var i=0; i<N-2; i++)
            {
                A.Add(Min(B[i],B[i+1]));
            }
            A.Add(B[N - 2]);

            WriteLine(A.Sum());
        }

        static long GcdArray(long[] array)
        {
            var ans = array[0];
            for(var i=1; i<array.Length; i++)
            {
                ans = Gcd(ans, array[i]);
            }
            return ans;
        }

        static long Gcd(long a, long b)
        {
            var v = new[] { a, b };
            while (v[1] != 0) { v = new[] { v[1], v[0] % v[1] }; }
            return v[0];
        }

        static long Lcm(long a, long b)
        {
            return a / Gcd(a, b) * b;
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 13396
def geta(n=0)
  return $stdin.gets.to_i if n==0
  ar = []
  n.times do 
    ar << $stdin.gets.chomp.split
  end
  return ar.flatten(1) if n<=1
  return ar
end

def exchange(i,sorted)
  cnt = 0
  0.step(sorted-1) do |j|
    if @ar[j] > @ar[j+1]
      @ar[j],@ar[j+1] = @ar[j+1],@ar[j]
      cnt += 1
    end
  end
  return cnt
end

n = geta(0)
@ar = geta(1).map(&:to_i)

sorted = n-1
cnt = 0
0.step(sorted,1) do |i|
  cnt += exchange(i,sorted)
  sorted -= 1
end

puts @ar.join(" ")
p cnt


Measured memory_bytes: 6872
#include <iostream>
#include <cstdlib>
#include <vector>
#include <cmath>
using namespace std;

struct info{int t,x,y;};

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

    vector<info> v;

    for(int i = 0; i < n; ++i){
        int t,x,y; cin >> t >> x >> y;
        v.push_back({t,x,y});
    }

    int pre_t = 0;
    int x = 0;
    int y = 0;
    bool is_ok = true;
    for(int i = 0; i < n; ++i){
        int min_d = abs(x - v[i].x) + abs(y - v[i].y); 

        // min_dとv[i].tより可否を決定する
        if(v[i].t - pre_t < min_d) {
            is_ok = false;
            break;
        }

        if((v[i].t - pre_t - min_d) & 1){
            is_ok = false;
            break;
        }

        pre_t = v[i].t;
        x = v[i].x;
        y = v[i].y;
    }

    if(is_ok) cout << "Yes\n";
    else cout << "No\n";

    return EXIT_SUCCESS;
}


Measured memory_bytes: 1912
#https://atcoder.jp/contests/dp/tasks/dp_e
#2019-01-13
import numpy as np
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]

DP = np.ones(N*1000+1, dtype=int) *(W+1)
DP[0] = 0
#総価値 i 円を得るために最低限必要な重量
for i in range(N):
    DP[v[i]:] = np.minimum(DP[:-v[i]]+ w[i], DP[v[i]:])
ans = 0
for k in range(N*1000+1):
    if DP[k] <= W:
        ans = k
        
print(ans)

Measured memory_bytes: 14804
<?php
	fscanf(STDIN, "%d", $N);
	$input=explode(' ',trim(fgets(STDIN)));

	$sum = $input[0];
	for ($i = 1; $i < $N; $i++) {
      $sum *= $input[$i];
    }

	$sum_m = 0;
	for ($i = 0; $i < $N; $i++) {
      $sum_m += $sum / $input[$i];
    }

	echo ($sum / $sum_m);
?>

Measured memory_bytes: 3828
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <string>
#include <stdio.h>
#include <sstream>

using namespace std;
void swap(int &a, int &b);

#define ALPHABET 26

int main()
{
	char alphabet[ALPHABET] = { 'a','b','c','d','e'
		,'f','g','h','i','j'
		,'k','l','m','n','o','p'
		,'q','r','s','t','u','v'
		,'w','x','y','z' };
	int countAlpha[ALPHABET] = {};

	string sstr;
	//while (true)
	while(getline(cin, sstr))
	{
		if (sstr[0] == NULL)
			break;
		//getline(cin, sstr);
		//cout << sstr.c_str() << endl;
		for (int i = 0; i < static_cast<int>(sstr.size()); ++i)
		{
			char ctemp;
			int num;
			if (isupper(sstr[i]))
				ctemp = tolower(sstr[i]);
			else
				ctemp = sstr[i];

			num = ctemp - 'a';
			countAlpha[num]++;
		}
	}

	for (int i = 0; i < ALPHABET; ++i)
	{
		cout << alphabet[i] << " : " << countAlpha[i] << endl;
	}

	return 0;
}




Measured memory_bytes: 3160
n = int(input())
w = list(map(int,input().split()))
s = (sum(w) // 2)
a = []

for i in range(n):
    a.append(w[i])
    if sum(a) > s:
        t = i-1
        if abs(sum(w[0:t+1]) - sum(w[t+1:])) < abs(sum(w[0:t+2]) - sum(w[t+2:])):
            print(abs(sum(w[0:t+1]) - sum(w[t+1:])))
            break
        else:
            print(abs(sum(w[0:t+2]) - sum(w[t+2:])))
            break

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define MAX_N 100001
int n;
double X[MAX_N],R[MAX_N];

bool check(double y){
  double l=-1e9;
  double r=1e9;
  for(int i=0;i<n;i++){
    double a=X[i]- sqrt(R[i]*R[i]-y*y);
    l=max(l,a);
    double b=X[i]+ sqrt(R[i]*R[i]-y*y);
    r=min(r,b);
  }
  return (l<r);
}

int main(){
  double left=0,right=1e9,mid;
  
  cin>>n;
  for(int i=0;i<n;i++){
    int x,r;
    cin>>x>>r;
    X[i]=x;
    R[i]=r;

    right=min(right,R[i]);
  }

  for(int i=0;i<100;i++){
    mid=(left+right)*0.5;
    if(check(mid))left=mid;
    else right=mid;
  }

  printf("%.10f\n",left);
  
  return 0;
}

Measured memory_bytes: 4732
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

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

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

	string s[3];
	rep (i, 3) cin >> s[i];

	string res = "";
	rep (i, 3) res += toupper(s[i][0]);

	cout << res << endl; 
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
const long long INF = 1e16;
typedef long long ll;

int main(){

  int N, M, S, T; cin >> N >> M >> S >> T;
  S--; T--;

  vector < vector < pair<ll, int> > > YEN(N), SNUKE(N);
  // (最短距離・次の頂点)のペアを保存
  for (int i = 0; i < M; i++){
    int u, v, a, b; cin >> u >> v >> a >> b;
    u--; v--;

    YEN[u].push_back(make_pair(a, v)); YEN[v].push_back(make_pair(a, u));
    SNUKE[u].push_back(make_pair(b, v)); SNUKE[v].push_back(make_pair(b, u));
  }

  for (int i = 0; i < N; i++){
    sort(YEN[i].begin(), YEN[i].end());
    sort(SNUKE[i].begin(), SNUKE[i].end());
  }
  
  vector <ll> min_YEN(N);
  fill(min_YEN.begin(), min_YEN.end(), 1e16);
  min_YEN[S] = 0;

  priority_queue < pair<ll, int>, vector < pair<ll, int> >, greater<pair<ll, int> > > que1;
  que1.push(make_pair(0, S));

  vector <bool> used(N);

  while (!que1.empty()){
    pair<ll, int> P = que1.top(); que1.pop();

    if (used[P.second] == false){
      used[P.second] = true;

      for (int i = 0; i < YEN[P.second].size(); i++){
        ll D = YEN[P.second][i].first;
        int next = YEN[P.second][i].second;

        if (used[next] == false){
          if (min_YEN[next] > min_YEN[P.second] + D){
            min_YEN[next] = min_YEN[P.second] + D;
            que1.push(make_pair(min_YEN[next], next));
          }
        }
      }
    }
  }

  vector <ll> min_SNUKE(N);
  fill(min_SNUKE.begin(), min_SNUKE.end(), 1e16);
  min_SNUKE[T] = 0;

  fill(used.begin(), used.end(), false);
  que1.push(make_pair(0, T));

  while (!que1.empty()){
    pair<ll, int> P = que1.top(); que1.pop();

    if (used[P.second] == false){
      used[P.second] = true;

      for (int i = 0; i < SNUKE[P.second].size(); i++){
        ll D = SNUKE[P.second][i].first;
        int next = SNUKE[P.second][i].second;

        if (used[next] == false){
          if (min_SNUKE[next] > min_SNUKE[P.second] + D){
            min_SNUKE[next] = min_SNUKE[P.second] + D;
            que1.push(make_pair(min_SNUKE[next], next));
          }
        }
      }
    }
  }

  vector <ll> cost(N);
  for (int i = N - 1; i >= 0; i--){
    if (i == N - 1) cost[i] = min_YEN[i] + min_SNUKE[i];
    else cost[i] = min(cost[i + 1], min_YEN[i] + min_SNUKE[i]);
  }
  
  for (int i = 0; i < N; i++){
    ll ans = 1e15 - cost[i];
    cout << ans << endl;
  }
  
  return 0;
}


Measured memory_bytes: 20344
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
    int N, M;
    cin >> N >> M;
    vector<int> dp(1<<N, 1'000'000'000);
    dp[0] = 0;

    while(M--) {
        int a, b;
        cin >> a >> b;
        int tmp = 0;
        while(b--) {
            int c;
            cin >> c;
            tmp += (1<<--c);
        }
        for(int i=0; i<(1<<N); i++) {
            dp[i|tmp] = min(dp[i|tmp], dp[i] + a);
        }
    }

    if(dp.back() == 1'000'000'000) {
        cout << -1 << endl;
    } else {
        cout << dp.back() << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
from fractions import gcd
def f(a,b,c,d):
    if a<b:
        return 0
    if b>d:
        return 0
    if b<=c:
        return 1
    x=a%b
    g=gcd(b,d)
    if c>=b-g+(x%g):
        return 1
    else:
        return 0
T=int(input())
X=[[int(i) for i in input().split()] for i in range(T)]
for a,b,c,d in X:
    s=f(a,b,c,d)
    if s:
        print('Yes')
    else:
        print('No')




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

class AtCoder{
  public static void Main(){

    string[] input = Console.ReadLine().Split();

    int n = int.Parse(input[0]);
    int m = int.Parse(input[1]);

    Console.WriteLine((n-1)*(m-1));

  }
}

Measured memory_bytes: 13140
package main

import(
    "fmt"
    "sort"
    "strings"
)



func main() {
    var n,d,x int
    fmt.Scan(&n,&d,&x)
    a := make([]int, n)
    for i:=0; i<n; i++{
        fmt.Scan(&a[i])
    }
    for i:=0; i<n; i++{
        for j:=1; j<=d; j+=a[i]{
            x++
        }
    }
    fmt.Println(x)
}





// Pairsort
type Pair struct {
    first,second int64
}

type By func(p1, p2 *Pair) bool

func (by By) Sort(pairs []Pair) {
    ps := &pairSorter{
            pairs : pairs,
            by: by,
    }
    sort.Sort(ps)
}

type pairSorter struct {
    pairs []Pair
    by func(p1, p2 *Pair) bool
}

func (s *pairSorter) Len() int {
    return len(s.pairs)
}

func (s *pairSorter) Swap(i, j int) {
    s.pairs[i], s.pairs[j] = s.pairs[j], s.pairs[i]
}

func (s *pairSorter) Less(i, j int) bool {
    return s.by(&s.pairs[i], &s.pairs[j])
}

func first (p1, p2 *Pair) bool {
        return p1.first < p2.first
}

func second (p1, p2 *Pair) bool {
        return p1.second < p2.second
}
// end



func abs32(a int) int {
    if a<0{
        return -a
    }
    return a
}

func abs64(a int64) int64 {
    if a<0{
        return -a
    }
    return a
}

func min32(a, b int) int {
    if a >= b {
        return b
    }
    return a
}

func max32(a, b int) int {
    if a >= b {
        return a
    }
    return b
}

func min64(a, b int64) int64 {
    if a >= b {
        return b
    }
    return a
}

func max64(a, b int64) int64 {
    if a >= b {
        return a
    }
    return b
}

func gcd(a, b int64) int64 {
    if a % b == 0 {
        return b
    } else {
        return gcd(b, a%b)
    }
}

func lcm(a, b int64) int64 {
    return a / gcd(a, b) * b
}

func scanNums(len int) (nums []int){
    var num int
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanNums64(len int) (nums []int64){
    var num int64
    for i:=0; i<len; i++{
        fmt.Scan(&num)
        nums = append(nums,num)
    }
    return
}

func scanString(len int) (str []string){
    var s string
    for i:=0; i<len; i++{
        fmt.Scan(&s)
        str = append(str,s)
    }
    return
}

func scanTwoNums(n,m int) ([][]int){
    Nums := make([][]int, n)
    for i:=0; i<n; i++{
        Nums[i] = make([]int, m)
    }
    return Nums
}

func SortString(s string) string{
    t := strings.Split(s, "")
    sort.Strings(t)
    return strings.Join(t, "")
}


Measured memory_bytes: 640
using System;
class aoj
{
    static void Main()
    {
        string[] z = new string[50];
        int y = 0;
        while (true)
        {
            string c = Console.ReadLine();
            if (string.IsNullOrEmpty(c)) break;
            string[] a = c.Split(' ');
            string[] b = Console.ReadLine().Split(' ');
            int H = 0, B = 0;
            bool[] d = new bool[4];
            for (int i = 0; i < 4; i++)
            {
                if (a[i] == b[i])
                {
                    H++;
                    d[i] = true;
                }
            }
            for (int i = 0; i < 4; i++)
            {
                if (d[i] == false)
                {
                    for (int j = 0; j < 4; j++)
                    {
                        if (d[i] == false)
                        {
                            if (a[i] == b[j])
                            {
                                B++;
                            }
                        }
                    }
                }
            }
            string A=H.ToString(),C=B.ToString();
            z[y] = A + " " + C;
            y++;
        }
        for(int i = 0; i < y; i++)
        {
            Console.WriteLine(z[i]);
        }
    }
}

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

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		int[] intArray = convertInt(br.readLine().split(" "));
		for (int i = n - 1; i >= 0; i--) {
			System.out.print(intArray[i]);
			if (i != 0) {
				System.out.print(" ");
			} else if (i == 0) {
				System.out.println("");
			}
		}
	}

	private static int[] convertInt(String[] strArray) {
		int len = strArray.length;
		int[] intArray = new int[len];
		for (int i = 0; i < len; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}
}

Measured memory_bytes: 24204
while True:
    H, W = map(int, input().split())

    if H == 0 and W == 0:
        break
    else:
        for h in range(H):
            for w in range(W):
                if h % 2 != 0:
                    if w % 2 != 0:
                        print("#", end="")
                    else:
                        print(".", end="")
                else:
                    if w % 2 != 0:
                        print(".", end="")
                    else:
                        print("#", end="")
            print()
        print()



Measured memory_bytes: 7004
import java.util.*;

public class Main {
	public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    Map<String, Integer> map = new HashMap<String, Integer>();

	 	int n = sc.nextInt();
    for (int i = 0; i < n; i++) {
      String s = sc.next();
      if (map.get(s) == null) {
        map.put(s, 1);
      } else {
        map.put(s, map.get(s) + 1);
      }
    }

    int m = sc.nextInt();
    for (int i = 0; i < m; i++) {
      String t = sc.next();
      if (map.get(t) == null) {
        map.put(t, -1);
      } else {
        map.put(t, map.get(t) - 1);
      }
    }

    int answer = 0;
		for (String key : map.keySet()) {
			int value = map.get(key);
			if (value > answer) {
				answer = value;
			}
		}

    System.out.println(answer);
  }
}


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

using namespace std;
int Main()
{
  string s;
  cin>>s;
  int mod =2019;
  
  long long ans=0;
  int suf =0;
  int pt= 1;
  int n = s.length();
  
   vector<int> sufar(3000);
  
   sufar[0]=1;
  
  for(int i=n-1;i>=0;i--){
    
    suf+= (s[i]-'0' )*pt;
    suf%=mod;
    pt*=10;
    pt%=mod;
    ans+= sufar[suf];
    sufar[suf]++;
       
     
  }
  
  cout<<ans;
  
  return 0;
}























// main function..
int main(){


    Main();
    
    
}


Measured memory_bytes: 3720
#include <iostream>
#include <vector>
#include <string>
using namespace std;
using ll = long long;
int main()
{
  string s;
  cin >> s;
  ll ans = 0;
  for(int i=0;i<s.size();i++){
    ans += s[i] - '0';
  }
  if(ans%9==0) cout << "Yes\n";
  else cout << "No\n";
}


Measured memory_bytes: 3716
//BISMILLAHIR RAHMANIR RAHEEM
                                      //ALLAH IS WATCHING ME

//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█▄█
//█─█─█▄─█▄─█─█─█─█


#include<bits/stdc++.h>

#define ull    unsigned long long
#define ll   long long
#define ses   "\n"

using namespace std;

//main function is here.... ....
int main(){
string s;
cin>>s;
ll cnt=0;
for(ll i=0,j=s.size()-1;i<(s.size()/2);i++,j--){
    if(s[i]!=s[j]){
        cnt++;
    }
}
cout<<cnt;
}

//Alhamdulillah


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
int main(void){
    double i,n,p,ans;
    scanf("%lf %lf",&n,&p);
    if(n==1)ans=p;
    else if(n>=40 || n>=p)ans=1;
    else for(i=1; i<=1000000; i++){
        if(fmod(p,pow(i,n))==0)ans=i;
    }
    printf("%.0lf",ans);
    return 0;
}


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

int main() {
  int N;
  cin >> N;
  int d[N];
  for(int i=0;i<N;i++){
    cin >> d[i];
  }
  sort(d,d+N,greater<int>());
  int j=0;
  for(int i=0;i<N-1;i++){
    if(d[i]==d[i+1]){
      continue;
    }
    j++;
  }
  cout << j+1 <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
int n, m, a, b, s, cant[1005], used[1005], w;
vector<int> G[1005];
bool dfs(int t){
	bool f = false;
	used[t] = true;
	for(int u: G[t]){
		cant[u]++;
		if(used[u]){
			if(u != s){
				used[t] = false;
				for(int u: G[t]) cant[u]--;
				return false;
			}else f = true;
		}
	}
	if(f) return true;
	for(int u: G[t]) if(cant[u] == 1 && dfs(u)) return true;
	for(int u: G[t]) cant[u]--;
	used[t] = false;
	return false;
}
int main(){
	scanf("%d%d", &n, &m);
	rep(i,m){
		scanf("%d%d", &a, &b);
		G[a-1].push_back(b-1);
	}
	rep(i,n){
		fill(cant, cant+n, 0);
		fill(used, used+n, false);
		if(dfs(s = i)){
			rep(j,n) if(used[j]) w++;
			printf("%d\n", w);
			rep(j,n) if(used[j]) printf("%d\n", j+1);
			return 0;
		}
	}
	printf("%d\n", -1);
}

Measured memory_bytes: 384
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;
typedef long long LL;
#define dd c=getchar()
inline int read(){
	int a=0,b=1,dd;
	while(!isdigit(c)){if(c=='-')b=-b;dd;}
	while(isdigit(c)){a=a*10+c-'0';dd;}
	return a*b;
}
inline void print(LL x){
	static int c[23];
	static int n;
	if(x==0){
		putchar('0');
		return;
	}
	if(x<0){
		putchar('-');
		x=-x;
	}
	n=0;
	while(x>0){
		c[n++]=x%10;
		x/=10;
	}
	while(n-->0){
		putchar(c[n]+'0');
	}
}
inline void printsp(LL x){
	print(x);
	putchar(' ');
}
inline void println(LL x){
	print(x);
	putchar('\n');
}
#undef dd
int n,m,x,y;
int tp[100003],fa[100003],li[100003],l,r;
vector<int>e[100003];
int main(){
	n=read();
	m=read();
	for(int i=1;i<=n-1+m;i++){
		x=read();
		y=read();
		e[x].push_back(y);
		tp[y]++;
	}
	l=1;
	r=0;
	for(int i=1;i<=n;i++){
		if(tp[i]==0){
			li[++r]=i;
			fa[i]=0;
		}
	}
	for(;l<=r;l++){
		int&u=li[l];
		int len=e[u].size();
		for(int i=0;i<len;i++){
			int&v=e[u][i];
			tp[v]--;
			if(tp[v]==0){
				li[++r]=v;
				fa[v]=u;
			}
		}
	}
	for(int i=1;i<=n;i++){
		println(fa[i]);
	}
	return 0;
}

Measured memory_bytes: 7424
import java.util.Scanner;

public class Main {
    static double S,L,h;
	public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      int a = sc.nextInt();
      int b = sc.nextInt();
      int C = sc.nextInt();
      double Crad = Math.toRadians(C);
      S = a * b * Math.sin(Crad) / 2;
      double cc = a * a + b * b - 2 * a * b * Math.cos(Crad);
      double c = Math.sqrt(cc);
      L = a + b + c;
      h = 2 * S / a;
      System.out.println(S + " " + L + " " + h);
    }
}


Measured memory_bytes: 26480
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000010;
const ll LINF=4000000000000000010LL;
const int MAX=310;
const double EPS=1e-9;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
    double b;
    while(cin>>b){
        double a[11];
        a[1]=b;
        double sum=b;
        for(int i=2;i<=10;i++){
            if(i%2){
                a[i]=a[i-1]/3;
            }else{
                a[i]=a[i-1]*2;
            }
            sum+=a[i];
        }
        printf("%.9lf\n",sum);
    }   
}



Measured memory_bytes: 3272
#include<iostream>
#include<algorithm>
#include<cmath>

using namespace std;

int N, K;
int h[100001];
int dp[100001];

int memo(int n) {
	if (dp[n] != -1)return dp[n];

	if (n == 1)return 0;

	int best = 1145141919;

	for (int i = 1; i <= K; i++) {
		if (n - i >= 1) {
			best = min(best, memo(n - i) + abs(h[n] - h[n - i]));
		}
	}
	return dp[n] = best;
}

int main() {

	cin >> N >> K;
	for (int i = 1; i <= N; i++)cin >> h[i];

	for (int i = 1; i <= N; i++)dp[i] = -1;

	//Frog1のサンプルソースのように、memo(N)をまず実行させてからdp[N]を出力してもよい
	cout << memo(N) << endl;

	return 0;
}

Measured memory_bytes: 5760
import sys
input = sys.stdin.readline


def bellman_ford(start: int, graph: list):
    """bellman-ford法: 始点startから各頂点への最短距離を求める(負辺OK)
    計算量: O(|E||V|)
    """
    INF = float("inf")
    n = len(graph)
    dist = [INF] * n
    dist[start] = 0
    if n == 1:
        return False, [0]
    for _ in range(n - 1):
        update = False
        for v, edges in enumerate(graph):
            for nxt_v, cost in edges:
                if dist[nxt_v] > dist[v] + cost:
                    dist[nxt_v] = dist[v] + cost
                    update = True
        if not update:
            break
    else:
        return True, dist  # 負閉路含む
    return False, dist  # 負閉路含まない

v, e, r = map(int, input().split())
info = [list(map(int, input().split())) for i in range(e)]
INF = 10 ** 18

graph = [[] for i in range(v)]
for a, b, cost in info:
    graph[a].append((b, cost))

is_negative, dist = bellman_ford(r, graph)

if is_negative:
    print("NEGATIVE CYCLE")
else:
    for num in dist:
        if num > 10 ** 12:
            print("INF")
        else:
            print(num)


Measured memory_bytes: 6408
#include <vector>
#include <iostream>

using Matrix = std::vector<std::vector<char>>;

int main(int argc, char *argv[]) {
	int height = 0;
	int width = 0;

	std::cin >> height >> width;

	//
	//  初期化間違いでえらい目に...
	//	wrong -> std::vector<char>('#', width)
	//
	Matrix matrix(height,
		std::vector<char>(width, '#')
	);

	// 消すべき行の位置を知る
	std::vector<bool> erase_y;
	char current_cell;
	for (int y = 0; y < height; y++) {
		bool all_white(true);
		for (int x = 0; x < width; x++) {
			std::cin >> current_cell;
			if (current_cell != '.') {
				all_white = false;
			}
			matrix[y][x] = current_cell;
		}
		erase_y.push_back(all_white);
	}

	//  消すべき列の位置を知る
	std::vector<bool> erase_x;
	for (int x = 0; x < width; x++) {
		bool all_white(true);
		for (int y = 0; y < height; y++) {
			if (matrix[y][x] != '.') {
				all_white = false;
			}
		}
		erase_x.push_back(all_white);
	}

	//  消すべき行および列を除いて全て出力
	for (int y = 0; y < height; y++) {
		if (erase_y[y] == false) {
			for (int x = 0; x < width; x++) {
				if (erase_x[x] == false) {
					std::cout << matrix[y][x];
				}
			}
			std::cout << std::endl;
		}
	}

	return 0;
}


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

bool is_uruu(int y, vector<int> &A){
  for(size_t i = 0; i < A.size(); ++i){
    if(y%A[i]) continue;
    return (i+1)%2;
  }
  return (A.size()%2 == 0);
}

int main(){
  int n, l, r;
  while(cin >> n >> l >> r, n){
    vector<int> A(n);
    for(int i = 0; i < n; ++i) cin >> A[i];
    int ans = 0;
    for(int i = l; i <= r; ++i){
      if(is_uruu(i,A)) ++ans;
    }
    cout << ans << endl;
  }
  return 0;
}



Measured memory_bytes: 3100
#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>

#define REP(i, n) for (int i = 0; i < n; i++)

using namespace std;

typedef long long unsigned int ll;

void println(string const str)
{
    printf("%s\n", str.c_str());
}

void print(string const str)
{
    printf("%s", str.c_str());
}

int main()
{
    string str;
    cin >> str;
    if (str.size() == 2) {
        cout << str << endl;
    } else {
        reverse(str.begin(), str.end());
        cout << str << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    new Main().run();
  }

  private void run() {
    int[] nums = new int[100];
    for(int i = 0; i < 100; i++) nums[i] = 0;

    while(sc.hasNext()) {
      nums[sc.nextInt() - 1]++;
    }

    int max = 0;
    for(int i = 0; i < 100; i++) {
      if(nums[i] > max) max = nums[i];
    }

    for(int i = 0; i < 100; i++) {
      if(nums[i] == max) System.out.println(i + 1);
    }
  }

  private final Scanner sc = new Scanner(System.in);
}

Measured memory_bytes: 12000
/* winners never quit and quitters never win.
      #swap                                 */
      
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
#pragma GCC optimize ("-O3")
using ll = long long;
using ld = long double;
const ll mod = 1000000007;
const ll inf = 1000000000000000000;
const ll rk = 256;
const ld PI = 3.141592653589793;

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

template <typename T>
void make_unique(vector<T>& vec) {
  sort(all(vec));
  vec.erase(unique(all(vec)), vec.end());
}

#define endl '\n'
#define pb push_back
#define mp make_pair
#define vc vector
#define fs first
#define sec second
#define pq priority_queue
#define lb lower_bound
#define ub upper_bound
#define pll pair<ll,ll> 
#define pls pair<ll,string>
#define psl pair<string,ll>
#define plc pair<ll,char>
#define pcl pair<char,ll>
#define pss pair<string,string>
#define all(x) (x).begin(), (x).end()
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define T ll t=0;cin>>t;for(ll test=0;test<t;test++)

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());


ll nxt() {
    ll TemporaryVariable;
    cin >> TemporaryVariable;
    return TemporaryVariable;
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

 
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
	//isprime();
	//coeff();
	/*freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/
    ll n=nxt();
    vc<ll> v(n);
    generate(all(v),nxt);
    ll ans=1000,last=v[0];
    rep(a,1,n)
    {
        if(v[a]<last)
            last=v[a];
        else
        {
            ans=(ans/last)*v[a]+(ans%last);
            last=v[a];
        }
    }
    cout<<ans<<endl;
	printclock;
	return 0;
}

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

#ifdef DEBUG
    #include "debug.h"
    #define dump(...)                                                              \
        DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
                << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
                << endl                                                            \
                << "    ",                                                         \
            dump_func(__VA_ARGS__)
#else
    #define dump(...)
#endif


// http://beet-aizu.hatenablog.com/entry/2018/04/08/145516
template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

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

template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}

template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
  for(auto &e:t) fill_v(e,v);
}

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

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

#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
#define ALL(v) (v).begin(), (v).end()
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

//*
#define mod 1000000007 /*/
#define mod 998244353 //*/

typedef pair<int, int> P;
#define INF (1LL<<60)




void solve(){
    int N, K;
    cin >> N >> K;
    vector<int> A(N+1);
    for(int i=1; i<=N; i++)
        cin >> A[i];
    
    for(int i=K+1; i<=N; i++){
        if(A[i]>A[i-K]) Yes;
        else No;
    }
    
    
}


signed main(){
    cout << fixed << setprecision(18);
    cerr << fixed << setprecision(18);
    solve();
}


Measured memory_bytes: 4824
#include<stdio.h>

int main(){
  int submit[31], i, x;
  for(i = 0;i < 31;i++)submit[i] = 0;
  for(i = 0;i < 28;i++){
    scanf("%d", &x);
    submit[x] = 1;
  }
  for(i = 1;i < 31;i++){
    if(submit[i] == 0){
      printf("%d\n", i);
    }
  }
  return 0;
}

Measured memory_bytes: 596
#include <iostream>
#include <set>
#include <string>
using namespace std;


int main()
{
	int n;
	cin >> n;
	for (int dataset = 0; dataset < n; dataset++){
		set<string> train;
		string s,left,right,lreverse,rreverse;
		cin >> s;
		for (int i = 1; i < s.length(); i++){
			left = right = lreverse = rreverse = "";
			for (int j = 0; j < i; j++)
				left += s[j];
			for (int j = 0; j < s.length() - i; j++)
				right += s[i + j];
			for (int j = 0; j < left.length(); j++)
				lreverse += left[left.length() - j - 1];
			for (int j = 0; j < right.length(); j++)
				rreverse += right[right.length() - j - 1];
			train.insert(left + right);
			train.insert(right + left);
			train.insert(lreverse + right);
			train.insert(right + lreverse);
			train.insert(left + rreverse);
			train.insert(rreverse + left);
			train.insert(lreverse + rreverse);
			train.insert(rreverse + lreverse);
		}
		cout << train.size() << endl;





	}
	return 0;

}

Measured memory_bytes: 1296
import java.util.Scanner;

public class Main {

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		char c = scanner.next().charAt(0);

		if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
			System.out.println("vowel");
			return;
		}
		System.out.println("consonant");
	}
}


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

const int MAX_H = 50;
const int MAX_W = 50;

int main() {
	int H, W;
	char S[MAX_H][MAX_W];

	std::cin >> H >> W;
	for(int i = 0; i < H; ++i) {
		for(int j = 0; j < W; ++j) {
			std::cin >> S[i][j];
		}
	}

	for(int i = 0; i < H; ++i) {
		for(int j = 0; j < W; ++j) {
			if(S[i][j] == '.') continue;
			else if( (i - 1 >= 0 and S[i - 1][j] == '#')
			or (i + 1 < H and S[i + 1][j] == '#')
			or (j - 1 >= 0 and S[i][j - 1] == '#')
			or (j + 1 < W and S[i][j + 1] == '#')) {
				continue;
			} else {
				std::cout << "No" << std::endl;
				return 0;
			}

		}
	}

	std::cout << "Yes" << std::endl;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  if( (n-1) * (n-2) /2 < k) {
    cout << -1 << endl;
    return 0;
  }
  int max = (n-1) * (n-2) / 2 ;
  int m = n-1+(max-k);
  vector<pair<int, int > > v;
  for(int i = 1; i<n; i++) {
    v.push_back(make_pair(1,i+1));
  }
  int counter = 0;
  for(int i = 1; i<n; i++) {
    for(int j = i+1; j <n; j++) {
      if(counter == max-k) break;
      v.push_back(make_pair(i+1, j+1));
      counter ++;
    }
  }
  cout << v.size() << endl;
  for(auto p : v)
    cout << p.first << " " << p.second << endl;    
  return 0;
}


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

int main(){
    int n, d, x;
    cin >> n >> d >> x;

    int choco = x;
    for(int i = 0; i < n; i++){
        cin >> x;
        choco += 1+(d-1)/x;
    }
    
    cout << choco << endl;
    return 0;
}

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

#define ll long long
#define ull unsigned long long
#define N 100005
#define mod 998244353 
#define boost ios_base::sync_with_stdio(false);cin.tie(0)
#define prec(n) fixed<<setprecision(n)

#define mii unordered_map<int,int>
#define mll unordered_map<ll,ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define pp pop_back
#define vii vector<int>
#define vll vector<ll>
#define vpp vector<pii>
#define all(c) c.begin(),c.end()
#define tr(it,c) for(it = c.begin() ; it!=c.end() ; it++)
int inf = INT_MAX ;
ll modulo(ll num,ll MOD=mod){ return ((num%MOD)+MOD)%MOD;} // for negative integer
ll power(ll b,ll e,ll MOD=mod){ll ans=1; while(e){if(e%2) ans=(ans*b)%MOD; b=(b*b)%MOD; e/=2;} return ans;}
ll inv(ll num,ll MOD=mod){ return power(modulo(num),MOD-2,MOD); }
ll gcd(ll a,ll b){ return ((b==0) ? a:gcd(b,a%b));}

int main(){
	boost;
	


	ll n;
	cin>>n;

	ll k = sqrt(n);

	for(ll i = k;i>=1;i--){
		if(n%i==0){
			cout<<i+n/i-2;
			return 0;
		}
	}


	return 0;
}





Measured memory_bytes: 256
//テンプレート
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>

int main(){
    char b,ans;
    scanf("%c",&b);
    switch (b) {
        case 'A':
            ans='T';
            break;
        case 'T':
            ans='A';
            break;
        case 'G':
            ans='C';
            break;
        case 'C':
            ans='G';
            break;
        default:
            break;
    }
    printf("%c\n",ans);
    return 0;
}



Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int maxn=3200;
const int mod=1000000007,inv2=500000004;
int n,q,x,y,a[maxn],f[maxn][maxn],ans;
signed main()
{ cin>>n>>q;
  for (int i=1;i<=n;i++) cin>>a[i];
  for (int i=1;i<=n;i++)
  for (int j=1;j<=n;j++)
  f[i][j]=a[i]>a[j];
  for (int i=1;i<=q;i++)
  {  cin>>x>>y;
     for (int j=1;j<=n;j++)
     {  if (j==x || j==y)  continue;
	    f[j][y]=f[j][x]=(f[j][x]+f[j][y])*inv2%mod;
		f[x][j]=f[y][j]=(f[x][j]+f[y][j])*inv2%mod;  
	 }
	 f[x][y]=f[y][x]=(f[x][y]+f[y][x])*inv2%mod;
  }
  for (int i=1;i<=n;i++)
  for (int j=i+1;j<=n;j++)
  ans=ans+f[i][j];
  while (q--)  ans=ans*2%mod;
  cout<<ans<<endl;
}
		

Measured memory_bytes: 76032