akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <vector>
#include <cmath>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
const LL INF = 1e14;
const LL MOD = 1e9 + 7;

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

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  LL a, b, c;
  cin >> a >> b >> c;
  LL ans;
  if (c <= a+b) ans = c + b;
  else ans = 2*b + a + 1;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);
	static boolean[] cups = new boolean[] { true, false, false };
	public static void main(String[] args) {
		while (sc.hasNext()) {
			swapping(sc.nextLine());
		}

		for (int i = 0; i < 3; i++) {
			if (cups[i]) {
				switch(i) {
				case 0:
					System.out.println("A");
					break;
				case 1:
					System.out.println("B");
					break;
				case 2:
					System.out.println("C");
					break;
				}

			}
		}



	}

	private static void swapping(String nextLine) {
		String[] strs = nextLine.split(",");
		int[] n = new int[strs.length];

			for (int i = 0; i < strs.length; i++) {
				switch(strs[i]) {
				case "A":
					n[i] = 0;
					break;
				case "B":
					n[i] = 1;
					break;
				case "C":
					n[i] = 2;
					break;
				}
			}

		boolean tmp;
		tmp = cups[n[0]];
		cups[n[0]] = cups[n[1]];
		cups[n[1]] = tmp;

	}

}


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

int n;
int d[50];

int main() {
	int i, j;
	
	cin >> n;
	for (i = 0; i < n; i++) cin >> d[i];
	
	int ans = 0;
	for (i = 0; i < n; i++) {
		for (j = i + 1; j < n; j++) {
			ans += d[i] * d[j];
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-

N = int(input())
A = list(map(int, input().split(' ')))

aor = 0
for a in A:
    aor |= a

r = 0
while aor > 0:
    b = aor & 1
    if b:
        break
    aor >>= 1
    r += 1

print(r)


Measured memory_bytes: 2940
N = int(input())
C0, C1, C2, C3 = 0, 0, 0, 0
for i in range(N):
    Si = input()
    if Si == 'AC':
        C0 += 1
 
    elif Si == 'WA':
        C1  += 1
 
    elif Si == 'TLE':
        C2 += 1
 
    else:
        C3 += 1
 
print('AC x ' + str(C0))
print('WA x ' + str(C1))
print('TLE x ' + str(C2))
print('RE x ' + str(C3))

Measured memory_bytes: 9212
#include<iostream>
#include<vector>
using namespace std;
int n,c,d[30][30],i,j,k,g[500][500],t[3][30],res=1<<30,tmp;
main(){
  cin>>n>>c;
  for(i=0;i<c;++i)for(j=0;j<c;++j)cin>>d[i][j];
  for(i=0;i<n;++i)for(j=0;j<n;++j)cin>>g[i][j],--g[i][j];
  for(k=0;k<c;++k){
    for(i=0;i<n;++i){
      for(j=0;j<n;++j){
        t[(i+j)%3][k]+=d[g[i][j]][k];
      }
    }
  }
  for(i=0;i<c;++i){
    for(j=0;j<c;++j){
      if(j==i)continue;
      for(k=0;k<c;++k){
        if(k==i||k==j)continue;
        tmp=0;
        tmp+=t[0][i];
        tmp+=t[1][j];
        tmp+=t[2][k];
        res=min(res,tmp);
      }
    }
  }
  cout<<res<<endl;
}


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

int main(){
    int b;
    while(cin >> b, b){
        int n;
        for(n = sqrt(2*b);; n--){
            if((b-n*(n-1)/2) % n == 0)  break;
        }
        cout << (b-n*(n-1)/2)/n << " " << n << endl;
    }
    return 0;
}


Measured memory_bytes: 3096
fun main(args: Array<String>) {
    val N = nextInt()
    val AB = Array<Pair<Int, Int>>(N, {
        val (a, b) = listOfInt()
        Pair(a, b)
    }).toList().sortedBy { it.second }
    var ans = true
    var t = 0
    repeat(N) {
        t += AB[it].first
        if (t > AB[it].second) ans = false
    }
    println("${if (ans) "Yes" else "No"}")
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }


Measured memory_bytes: 124900
#pragma GCC optimize("Ofast", "unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double

int main() {
	int N, M; cin >> N >> M;
	cout << (N * (N - 1) / 2 + M * (M - 1) / 2) << endl;
	return 0;
}

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

int main(){
	int n, k, arr[5005], sm = 0, ans = -1;
	cin >> n >> k;
	for(int i = 0; i < n; i++){
		cin >> arr[i];
	}
	sort(arr, arr + n, greater<int> ());

	for(int  i = 0; i < n; i++){
		sm = 0;
		for(int j = i; j < n; j++){
			if(sm + arr[j] < k){
				sm += arr[j];
				continue;
			}
			ans = max(ans, j);
		}
	}
	cout<< n - ans - 1 << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define mod998 998244353
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define mkp make_pair
typedef long long ll;
using namespace std;

int N, P[100000], a[100001];
ll res;
set<ll>st;

int main(){
	cin >> N;
	for (int i = 0; i < N; ++i) {
		cin >> P[i];
		a[P[i]] = i;
	}
	st.insert(-1);
	st.insert(N);
	for (int i = N; i >= 1; --i) {
		auto it = st.insert(a[i]).first;
		auto ith = it;
		auto itl = it;
		++ith;
		--itl;
		if (*itl != -1) {
			auto itll = itl;
			--itll;
			res += (*itl - *itll)*(*ith - a[i])*i;
		}
		if (*ith != N) {
			auto ithh = ith;
			++ithh;
			res += (*ithh - *ith)*(a[i] - *itl)*i;
		}
	}
	cout << res << endl;
}

Measured memory_bytes: 5760
#include<bits/stdc++.h>
#include<cctype>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);i++)
#define all(v) (v).begin(),(v).end()
typedef long long int ll;
#define pi 3.1415926535897932384
#define E9 1000000000
#define eps 1e-4
#define pii pair<int,int>

int main(){
  int N; cin >> N;
  string s;
  map<string, ll> cnt;
  rep(i,N){
    cin >> s;
    sort(all(s));
    cnt[s]++;
  }

  ll retval = 0;
  for (auto p:cnt){
    retval += p.second*(p.second-1)/2;
  }

  cout << retval << endl;


  // cout << fixed << setprecision(10);
  
  return 0;
}



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

int main(){
  int h,w;cin>>h>>w;
  string s[h];
  int t[h+2][w+2]={};
  rep(i,h){
    cin>>s[i];
    rep(j,w){
      if(s[i][j]=='#'){
        rep(k,3){
          t[i][j+k]++;
          t[i+1][j+k]++;
          t[i+2][j+k]++;
        }
      }//if
    }//repj
  }//repi
  rep(i,h){
    rep(j,w)s[i][j]=='#'?cout<<'#'
      :cout<<t[i+1][j+1];
    cout<<endl;
  }                       
}

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

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

using ll = long long;
#define INF 1e9


int main(){
  string s;
  cin >> s;
  int N = s.size();
  int l = 0, r = N-1;
  bool ans = true;
  while(l < r){
    while(s[l] == 'x' && l< N){
      l++;
    }
    while(s[r] == 'x' && r > 0){
      r--;
    }
    if(l < r && s[l] != s[r]){
      ans = false;
      break;
    }
    l++, r--;
  }
  int cnt =0 ;
  l =0, r = N-1;
  if(ans){
    while(l < r){
      if(s[l] == s[r]){
        l++, r--;
      }
      else if(s[l] == 'x'){
        l++;
        cnt++;
      }
      else if(s[r] == 'x'){
        r--;
        cnt++;
      }
    }
  }
  if(ans){
    cout << cnt << endl;
  }
  else{
    cout << -1 << endl;
  }
  return 0;
}


Measured memory_bytes: 512
N, M = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(N)]

import heapq
AB_dict = {}
for i in range(M):
    AB_dict[i + 1] = []
for i in range(N):
    if AB[i][0] > M:
        continue
    AB_dict[AB[i][0]].append(-AB[i][1])

Job = []
ans = 0
for i in range(M):
    for j in range(len(AB_dict[i + 1])):
        heapq.heappush(Job, AB_dict[i + 1][j])
    if len(Job) != 0:
        ans -= heapq.heappop(Job)
        
print(ans)

Measured memory_bytes: 44212
package main

import (
	"fmt"
)

func ceiling(tNow, t int) int {
	if tNow%t == 0 {
		return tNow
	}
	return t * ((tNow / t) + 1)
}

func main() {
	var n int
	fmt.Scan(&n)

	var tNow, aNow int
	fmt.Scan(&tNow, &aNow)
	for i := 1; i < n; i++ {
		var t, a int
		fmt.Scan(&t, &a)
		tNext := ceiling(tNow, t)
		aNext := ceiling(aNow, a)
		if a*(tNext/t) > aNext {
			tNow = tNext
			aNow = a * (tNext / t)
		} else {
			tNow = t * (aNext / a)
			aNow = aNext
		}
	}

	fmt.Println(tNow + aNow)
}


Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
using namespace std;

template <typename Tp> inline void getint(Tp &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

int N, a[105];

int main(){
	getint(N); int avg = 0, ans = 0;
	for(register int i = 0; i < N; i++) getint(a[i]), avg += a[i], a[i] *= N;
	for(register int i = 1; i < N; i++) if(abs(a[i] - avg) < abs(a[ans] - avg)) ans = i;
	return printf("%d\n", ans), 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin>>N;
    int A,B; cin>>A>>B;
    vi p(N);
    rep(i,N) cin>>p[i];
    sort(all(p));
    int a = upper_bound(all(p),A)-p.begin();
    int b = p.end()-upper_bound(all(p),B);
    int c = N-a-b;
    cout<<min(min(a,b),c)<<endl;
    return 0;
}


Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <set>
#include <queue>
#include <stack>
using namespace std;
typedef long long int ll;

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

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define drep(i, n) for(int i = n - 1; i >= 0; i--)

const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int main() {
  int k, a, b;
  cin >> k >> a >> b;
  rep (i, 10000) {
    if (a <= i * k && i * k <= b) {
      P("OK");
      return 0;
    }
    if (i * k > b) {
      break;
    }
  }
  P("NG");

  return 0;
}

Measured memory_bytes: 3632
from collections import defaultdict
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())

A,B,K = inpl()
tmp = max(A,B)+1
k = 0
while k < K:
    tmp -= 1
    if A%tmp == 0 and B%tmp == 0:
        k += 1
        
print(tmp)


Measured memory_bytes: 4212
#define _GLIBCXX_DEBUG
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
vector<int> d(1000010, 0);
void prime(ll N){
    ll a = 2;
  	ll it = 0;
    while(N >= a*a){
        if(N%a == 0){
            d[it]++;
            N /= a;
        }else{
            a++;
          	it++;
        }
    }
  	if(N!=1)(N%a==0)?d[it]++:d[it+1]++;
}
int main(){
    ll N;
    cin >> N;
    prime(N);
    ll ans = 0;
    for(int i=0; i<1000010; i++){
        ll tmp = 1;
        while(true){
            if(d[i]<tmp)break;
            d[i]-=tmp;
            ans++;
            tmp++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 7028
#include <bits/stdc++.h>
using namespace std;
int main()
  {
   int n;
   string s;
   cin >> n;
   cin >> s;
  int cnt =0;
   for(int i=0; i<n-2; i++)
     {
      if(s[i]=='A' && s[i+1] =='B' &&s[i+2]=='C')
        cnt++;
     }
   cout << cnt << endl;
  return 0;
  }


Measured memory_bytes: 256
n = int(input())
# A = list(map(int, input().split()))
# a, b, c = map(int, input().split())
dic = {}
S = list(input()for _ in range(n))
for s in S:
    if s not in dic:
        dic[s] = 0
    dic[s] += 1
sort_dic = sorted(dic.items(), key=lambda x: x[0])
max_cnt = max(dic.values())
for i in range(len(sort_dic)):
    if sort_dic[i][1] == max_cnt:
        print(sort_dic[i][0])


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 62)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

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


i64 mod_pow(i64 x, i64 y, i64 mod){
	i64 res = 1;
	while(y > 0){
		if(y & 1) res = res * x % mod;
		x = x*x %mod;
		y >>= 1;
	}
	return res;
}
int n, m, a[404], b[404];
i64 dp[404][404];
int p[404][404];
void solve(){
	cin >> n >> m;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	for(int i = 0; i < n; i++){
		cin >> b[i];
	}
	for(int i = 0; i < n; i++){
		for(int j = 0; j <= m; j++){
			for(int k = a[i]; k <= b[i]; k++){
				p[i][j] += mod_pow(k,j,INF);
				p[i][j] %= INF;
			}
		}
	}
	
	dp[0][0] = 1;
	for(int i = 0; i < n; i++){
		for(int j = 0; j <= m; j++){
			for(int k = 0; k <= m; k++){
				if(j+k > m) break;
				dp[i+1][j+k] += dp[i][j]*p[i][k] %INF;
				dp[i+1][j+k] %= INF;
			}
		}
	}
	cout << dp[n][m] << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}

Measured memory_bytes: 2176
// AtCode.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <algorithm>
#include <stdint.h>

using namespace std;



int main()
{
	string S, T;
	cin >> S >> T;
	string out = T + S;
	cout << out << endl;

	return 0;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String in = sc.nextLine();
		int a = Integer.parseInt(in);
		String in2 = sc.nextLine();
		int b = Integer.parseInt(in2);

		String in3 = sc.nextLine();
		String[] inArray = in3.split(" ");
		int answer = 0;
		for (int i = 0; i < inArray.length; i++) {
			int n = Integer.parseInt(inArray[i]);
			int min = Math.min(robotA(a,n), robotB(b,n));
			answer += min;
//			System.out.println(min);
		}
		System.out.println(answer);

	}

	private static int robotA(int a, int n) {
		int res = 0;
		for (int i = 0; i <= n; i++) {
			if (i < n) {
				res++;
			}
		}
//		System.out.println("RobotA:" + res);
		return res*2;
	}

	private static int robotB(int b, int n) {
		int res = 0;
		for (int i = b; i >= n; i--) {
			if (i > n) {
				res++;
			}
		}
//		System.out.println("RobotB:" + res);
		return res*2;
	}

}

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

int main() {
    int a, b, c, d, x, y;
    cin >> a >> b >> c >> d;
    x = a*b;
    y = c*d;

    if(x > y) {
        cout << x;
    }
    else {
        cout << y;
    }
    
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>

using namespace std;

/////////////         qsortのラッピング

int qsort_int_compare_ascend(const void *a, const void *b) {
	return *(int*)a - *(int*)b;
}
int qsort_int_compare_descend(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}
void ascendOrder(int size, int *array) {//昇順
	qsort(array, size, sizeof(int), qsort_int_compare_ascend);
}
void descendOrder(int size, int *array) {//降順
	qsort(array, size, sizeof(int), qsort_int_compare_descend);
}

int main() {
	long N; cin >> N;
	long *a = new long[N];
	long *b = new long[N];

	long sum = 0;
	long bmax = 0;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		sum += a[i];
	}
	for (int i = 0; i < N; i++) {
		b[i] = a[(i + 1) % N] - a[i];
		bmax = max(b[i], bmax);
	}
	
	long block = N * (N + 1); block /= 2;

	if (sum % block != 0) {
		cout << "NO" << endl;
		return 0;
	}

	long n = sum / block;

	long count = 0;
	for (int i = 0; i < N; i++) {
		b[i] = bmax - b[i];
		if (b[i] % N != 0) {
			cout << "NO" << endl;
			return 0;
		}
		count += b[i] / N;
	}

	if (count > n) {
		cout << "NO" << endl;
		return 0;
	}
	if ((n - count) % N == 0) {
		cout << "YES" << endl;
	}
	else {
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++)
#define P pair<ll,ll>
#define fs first
#define sc second
#define _GLIBCXX_DEBUG

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}
template <class S>
void print(vector<S> &v){
	for(ll i=0; i<(ll)v.size(); i++){
		cerr << v[i] << ' ';
	}
	cerr << endl;
}
template <class S>
void print(vector<vector<S>> &v) {
  	for (ll i = 0; i < (ll)v.size(); i++) {
    	for (ll j = 0; j < (ll)v[i].size(); j++) {
      		cerr << v[i][j] << ' ';
    	}
    	cerr << endl;
  	}
}

int main(){
	int a,b,c; cin >>a>>b>>c;
	cout << a+b+c-max({a,b,c}) << endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<cstring>
#include<string>
#include<vector>
#include<bitset>
#include<queue>
#include<map>
#include<set>
using namespace std;
#define ri register int 
#define il inline
#define pairint pair<int,int>
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define LL long long
#define gc getchar
template<class T>il void in(T &x)
{
    x=0;bool f=0;char c=gc();
    while(c<'0'||c>'9') 
    {
        if(c=='-') f=1;
        c=gc();
    }
    while(c>='0'&&c<='9') x=x*10+(c^'0'),c=gc();
    if(f) x=-x;
} 
#undef gc
#define N 100005
#define int LL
int x,y,z,n;
int a[N],b[N],c[N];
int id[N];
bool cmp(const int &x,const int &y)
{
	return a[x]-b[x]>a[y]-b[y];
}
struct Node
{
	int id,val;
	Node(){}
	Node(const int &ii,const int &vv)
	{
		id=ii,val=vv;
	}
	friend bool operator<(const Node &a,const Node &b)
	{
		return a.val>b.val;
	}
};
priority_queue<Node>q;
pairint f[N],g[N]; // (a,c) (b,c)
signed main()
{
#ifdef M207
    freopen("in.in","r",stdin);
#endif
	in(x),in(y),in(z),n=x+y+z;
	for(ri i=1;i<=n;++i) in(a[i]),in(b[i]),in(c[i]),id[i]=i;
	sort(id+1,id+1+n,cmp);
	for(ri i=1;i<=n;++i)
	{
		int u=id[i];
		f[i]=f[i-1];
		if(i<=x) 
		{
			f[i].fi+=a[u];
			q.push(Node(u,a[u]-c[u]));
		}
		else 
		{
			Node t=q.top();
			if(a[t.id]-c[t.id]<a[u]-c[u])
			{
				f[i].fi=f[i].fi-a[t.id]+a[u];
				f[i].se+=c[t.id];
				q.pop();q.push(Node(u,a[u]-c[u]));
			}
			else f[i].se+=c[u];
		}
	}
	while(!q.empty()) q.pop();
	for(ri i=n;i>=1;--i)
	{
		int u=id[i];
		g[i]=g[i+1];
		if(n-i+1<=y) 
		{
			g[i].fi+=b[u];
			q.push(Node(u,b[u]-c[u]));
		}
		else 
		{
			Node t=q.top();
			if(b[t.id]-c[t.id]<b[u]-c[u])
			{
				g[i].fi=g[i].fi-b[t.id]+b[u];
				g[i].se+=c[t.id];
				q.pop();q.push(Node(u,b[u]-c[u]));
			}
			else g[i].se+=c[u];
		}
	}
	int ans=0;
	for(ri i=x;i<=n-y;++i)
		ans=max(ans,f[i].fi+f[i].se+g[i+1].fi+g[i+1].se);
	printf("%lld",ans);
    return 0;
}
//8494

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

using ll = long long;
using ld  = long double;
using pll = pair<ll, ll> ;
using pld = pair<ld, ld>;
const int INF=1e9+7;
const ll LINF=1LL<<60 ;

#define ALL(a) a.begin(),a.end() //sort(ALL(vec));
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define MP(a,b) make_pair(a,b)
#define PB(a) push_back(a)

int main() {
  
  ll N, M;
  cin >> N >> M;

  //「けん」0-N-1
  // けんけん N-2N-1
  // ぱ 2N-3N-1
  vector<set<ll> > ken_Adjs(N*3);
  rep(i,M){
    ll u, v;
    cin >> u >> v;
    u--;
    v--; //0-indexed
    ken_Adjs.at(u).insert(v + N);
    ken_Adjs.at(u + N).insert(v + 2*N);
    ken_Adjs.at(u + 2 * N).insert(v);
  }

  ll S, T;
  cin >> S >> T;
  S--;
  T--; //0-indexed
 
  if (M==0){
    cout << "-1" << endl;
    return 0;
  }

  //BFS
  queue<pair<ll, ll> > q; //nnode, turn
  q.push(MP(S, 0));
  
  vector<bool> vstd(N*3, false);
  vstd.at(S) = true;
 
  // 空でない間繰り返す
  ll nnode, turn; 
  ll ans;
  while (not q.empty()) {
    tie(nnode, turn) =  q.front();  // 先頭の要素を得る
    q.pop();  // 先頭の値を削除
    for (ll nextnode : ken_Adjs.at(nnode)){
      if (nextnode == T){
        cout << (turn + 1) / 3 << endl;
        return 0;
      }
      else if (not vstd.at(nextnode)){
        q.push(MP(nextnode, turn+1));
 //       cout << nextnode << ' ' << turn+1<< endl; 
        vstd.at(nextnode) = true;
      }
    }
  }

  cout << "-1" << endl;

}


 


Measured memory_bytes: 28416
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		String ans = "";
		while(n != 0) {
			if(n % 2 == 0) {
				ans = "0" + ans;
				n /= -2;
			} else {
				ans = "1" + ans;
				n = (n - 1) / (-2);
			}
		}
		if(ans.isEmpty()) {
			System.out.println("0");
		} else {
			System.out.println(ans);
		}
	}
}


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

typedef long long ll;
typedef pair<ll,ll> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vii;
typedef vector<ll> vll;

#define X first
#define Y second
#define rep(i,n) for(ll i=0; i<(n); i++)
#define repp(i,a,b) for(ll i=a; i<=(b); i++)
#define repp2(i,b,a) for(ll i=b; i>=(a); i--)
#define fill(a,val) memset(a, (val), sizeof(a))
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define uni(c) c.resize(distance(c.begin(), unique(all(c))))
#define io ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sc(num) scanf("%lld",&num)
//#define ONLINE
#ifdef ONLINE
FILE *fin = freopen("great.in","r",stdin);
FILE *fout = freopen("great.out","w",stdout);
#endif

ll mod= 1e9 + 7, mod1=1e9+9;
const ll N=2005;
int n,k;
int dp[N][N];
vii ed[N];

int solve(int in, int par, int h){
    
    if(h<0)return 0;
    if(dp[in][h]!=-1)return dp[in][h];
    int an=0,ma=1;
    int le=min(h-1,k-1-h);
    for(auto x:ed[in]){
        if(x!=par)an+=solve(x,in,le);
        if(x!=par)solve(x,in,h);
    }
    for(auto x:ed[in]){
        if(x!=par){
            int tmp=an;
            tmp-=solve(x,in,le);
            tmp+=solve(x,in,h-1);
            ma=max(ma,1+tmp);
        }
    }
    
    ma=max(ma,solve(in,par,h-1));
    return dp[in][h]=ma;
    
}

int main(){
    io;
    
    cin>>n>>k;
    fill(dp,-1);
    rep(i,n-1){
        int x,y;
        cin>>x>>y;
        ed[x].pb(y),ed[y].pb(x);
    }
    int ans=0;
    repp(i,0,k)solve(1,0,i);
    repp(i,1,n)repp(j,0,k){
        //if(dp[i][j]>ans)cout<<i<<' '<<j<<' '<<dp[i][j]<<endl;
        ans=max(ans,dp[i][j]);
    }
    //repp(i,1,n){repp(j,0,k)cout<<dp[i][j]<<' ';cout<<endl;}
    cout<<n-ans;
    
    return 0;
}

Measured memory_bytes: 16256
import java.util.*;

class Main{
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    int n=sc.nextInt();
    int[] h=new int[n+2];
    for(int i=0;i<n;i++){
      h[i]=sc.nextInt();
    }
    int[] dp=new int[n+2];
    Arrays.fill(dp,Integer.MAX_VALUE);
    dp[0]=0;
    for(int i=0;i<n-1;i++){
      dp[i+1]=Math.min(dp[i]+Math.abs(h[i+1]-h[i]),dp[i+1]);
      dp[i+2]=Math.min(dp[i]+Math.abs(h[i+2]-h[i]),dp[i+2]);
    }
    System.out.println(dp[n-1]);
  }
}

Measured memory_bytes: 52148
N, H = gets.chomp.split.map(&:to_i)
b = []
a_max = 1

N.times do
  a_i, b_i = gets.chomp.split.map(&:to_i)

  a_max = a_i > a_max ? a_i : a_max
  b << b_i
end

# a_max以下のものは取り除く
b = b.select{ |num| num >= a_max }.sort.reverse

ans = 0
dmg = 0

b.size.times do |i|
  dmg += b[i]
  ans += 1

  break if dmg >= H
end

rest = H - dmg

if rest > 0
  p ans + (rest.to_f/a_max).ceil.to_i
else
  p ans
end



Measured memory_bytes: 4984
n=int(input())
t0,x0,y0=0,0,0
ans="Yes"
for i in range(n):
    t,x,y=map(int,input().split())
    d=abs(x-x0)+abs(y-y0)
    if t-t0<d or (t-t0-d)%2==1:
        ans="No"
        break
    else:
        t0,x0,y0=t,x,y
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <utility>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <deque>
#include <utility>
#include <cctype>

using namespace std;

using ll = long long;
using P = pair<int, int>;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define mkp(a, b) make_pair(a, b)
const int inf = 1e+9;

//素数であればその数は割り切れない。
//1

int main() {
	int n;
	cin >> n;
	vector<int> a(n);

	rep(i, n) {
		cin >> a[i]; 
	}

	vector<bool> used(1000010,false);
	vector<int> count(1000010,0);

	rep(i,n) {

		if (used[a[i]]) {
			count[a[i]] ++;
			continue;
		}
		used[a[i]] = true;

		int counter = 1;
		while(a[i] * counter <= 1000001) {
			count[a[i] * counter] += counter;
			counter++;
		}
	}

	int ans = 0;
	rep(i, 1000010) {
		if (count[i] == 1) {
			ans++;
		}

	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 7536
def selection_sort(array, n):
    count = 0
    for i in range(n):
        index_min = i
        for j in range(i, n):
            if array[j] < array[index_min]:
                index_min = j
        if array[index_min] < array[i]:
            array[i], array[index_min] = array[index_min], array[i]
            count += 1
    return count


def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    count = selection_sort(a, n)
    print(*a)
    print(count)


if __name__ == '__main__':
    main()



Measured memory_bytes: 5608
#include <cstdio>
#include <algorithm>
using namespace std;
#define reps(i,j,k) for(int i = j;i < k;i++)
#define rep(i,j) reps(i,0,j)
typedef pair < int,int > Pii;
bool F;
char change(int s){
	if(s == 0)return '+';
	if(s == 1)return '-';
	if(s == 2)return '*';
}
int calc(int a,int s,int b){
	if(s == 0)return a+b;
	if(s == 1)return a-b;
	if(s == 2)return a*b;
}
void solve(int num[5],int s[4],int dep){
	if(F)return ;
	if(dep == 3){
		if(calc(calc(calc(num[0],s[0],num[1]),s[1],num[2]),s[2],num[3]) == 10){
			printf("(((%d%c%d)%c%d)%c%d)\n",num[0],change(s[0]),num[1],change(s[1]),num[2],change(s[2]),num[3]);
			F = true;
			return ;
		}
		if(calc(calc(num[0],s[0],num[1]),s[1],calc(num[2],s[2],num[3])) == 10){
			printf("((%d%c%d)%c(%d%c%d))\n",num[0],change(s[0]),num[1],change(s[1]),num[2],change(s[2]),num[3]);
			F = true;
			return ;
		}
		return ;
	}
	rep(i,3){
		s[dep] = i;
		solve(num,s,dep+1);
	}
}
int main(){
	int a,b,c,d;
	while(scanf("%d%d%d%d",&a,&b,&c,&d),(a|b|c|d)){
		int num[4];
		F = false;
		num[0] = a;num[1] = b;num[2] = c;num[3] = d;
		sort(num,num+4);
		do{
			int s[4];
			solve(num,s,0);
			if(F)break;
		}while(next_permutation(num,num+4));
		if(!F)puts("0");
	}
	return 0;
}

Measured memory_bytes: 1056
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;



class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }


    Scanner cin;

    void calc()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        int[] A = cin.ArrayInt(N);
        int best = 0;
        for (int i = 0; i < N; i++)
        {
            if(Math.Abs(A[i]) > Math.Abs(A[best]))
            {
                best = i;
            }
        }
        List<string> ans = new List<string>();
        for (int i = 0; i < N; i++)
        {
            ans.Add(string.Format("{0} {1}", best + 1, i + 1));
            A[i] += A[best];
        }
        
        if(A[best] >= 0)
        {
            for (int i = 0; i < N - 1; i++)
            {
                ans.Add(string.Format("{0} {1}", i + 1, i + 2));
                //A[i] += A[i + 1];
            }
        }
        else
        {
            for (int i = N - 2; i >= 0; i--)
            {
                ans.Add(string.Format("{0} {1}", i + 2, i + 1));
                //A[i + 1] += A[i];
            }
        }

        foreach (var item in A)
        {
           // Console.WriteLine(item);
        }

        Console.WriteLine(ans.Count);
        foreach (var item in ans)
        {
            Console.WriteLine(item);
        }
    }
}






class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,n) for (int i = 1; i < (n); ++i)
using namespace std;
typedef long long ll;
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int X, A, B;
    cin >> X >> A >> B;
    cout << (X-A)%B << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int a[20];
int b[20];
int c[20];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i];
    int sum = 0;
    for (int i = 0; i < n; ++i)
    {
        cin >> b[i];
        sum += b[i];
    }
    for (int i = 0; i < n - 1; ++i)
        cin >> c[i];
    for (int i = 1; i < n; ++i)
        if (a[i] == a[i - 1] + 1)
            sum += c[a[i] - 2];
    cout << sum;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
#define R(i,n) for(int i=0;i<n;i++)
int n,a=1e9,c[2][20],p[1<<18][51];main(){cin>>n;R(i,n*2)cin>>c[i/n][i%n];fill(p[1],p[1<<n],1e9);R(B,1<<n){int o=0,d[n];R(i,n)if(~B&1<<i)d[i]=o++;R(i,n){int k=c[abs(i-n+o)%2][i];R(j,k+1){int &t=p[B|1<<i][k];t=min(t,p[B][j]+d[i]);}}}R(i,51)a=min(a,p[(1<<n)-1][i]);cout<<(a>1e8?-1:a);}

Measured memory_bytes: 52480
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;

char buf[10000];

int main() {
  while (1) {
    if (scanf("%s", buf) != 1) return 0;

    int n = strlen(buf);
    string ans;

    for (int i=0; i<n; i++) {
      char c = buf[i];
      if (c != '@') ans += c;
      else {
        ans += string((buf[i+1]-'0'), buf[i+2]);
        i += 2;
      }
    }

    printf("%s\n", ans.c_str());
  }
}

Measured memory_bytes: 2660
#include <bits/stdc++.h>
using namespace std;
#define MAX 1000000

int main() {
    int a, b; cin >> a >> b;
    if (a > 0) cout << "Positive" << endl;
    else if (a <= 0 && b >= 0) cout << "Zero" << endl;
    else {
        if ((a - b) % 2 == 0) cout << "Negative" << endl;
        else cout << "Positive" << endl;
    }
}

Measured memory_bytes: 256
N = int(input())
ls = list(map(int,input().split()))
ls2 = []
for i in range(N):
    ls2.append([i,ls[i]])

ls3 = sorted(ls2, key=lambda x: x[1])
ls4 = []
for i in ls3:
    ls4.append(i[0]+1)

L=[str(a) for a in ls4]
L = ' '.join(L)
print(L)

Measured memory_bytes: 105960
m,k =map(int,input().split())
if k>=2**m:
  print(-1)
elif [m,k]==[0,0]:
  print("0 0")
elif [m,k]==[1,0]:
  print("0 0 1 1")
elif [m,k]==[1,1]:
  print(-1)
else:
  l=[]
  for iii in range(2**m):
    if iii!=k:
      l.append(iii)
  out=" ".join(map(str,l[::-1]+[k]+l+[k]))
  print(out)

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

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();
        
        int on = Math.max(A,C);
        int off = Math.min(B,D);
        System.out.println(Math.max(0,off-on));
    }
}

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

int main(){
	int a,b,c,d,e,f;
	double x,y;
	
	while(cin >>a>>b>>c>>d>>e>>f){
		x=1.000*(c*e-b*f)/(a*e-b*d);
		y=1.000*(d*c-a*f)/(b*d-a*e);
		
		if(x==-0.000) x=0.000;
		printf("%.3f %.3f\n",x,y);
	}
	
	return 0;
}

Measured memory_bytes: 1192
#include <iostream>
using namespace std;
int main(void){
    // Here your code !
    int a, b ,ans=0;
    
    cin>>a>>b;
    
    if(a%3==0){ans=1;}
    
    if(b%3==0){ans=1;}
    
    if((a+b)%3==0){ans=1;}
    
    if(ans==1){cout<<"Possible"<<endl;}
    else{cout<<"Impossible"<<endl;}
    
    
}


Measured memory_bytes: 256
n,k=map(int,input().split())
d=[]
a=[]
l=[0]*n
for _ in range(k):
    d.append(int(input()))
    a.append(list(map(int,input().split())))
for i in range(k):
    for j in range(d[i]):
        l[a[i][j]-1]+=1
print(l.count(0))

Measured memory_bytes: 9284
#include<bits/stdc++.h>
using namespace std;
#define int long long

string s;
int32_t main(){
     int x;
     cin>>s>>x;
     int n=s.size();

     if(s[0]!=s[n-1]){
          int ans=0;
          char prev=s[0];
          int cnt=1;
          for(int i=1;i<n;i++){
               if(s[i]==prev)cnt++;
               else{
                    ans+=cnt/2;
                    cnt=1;
                    prev=s[i];
               }
          }
          ans+=cnt/2;
          cout<<ans*x;
     }
     else{
          int pre=1, suff=1;
          char prev=s[0];
          for(int i=1;i<n;i++){
               if(s[i]==prev)pre++;
               else break;
          }
          for(int i=n-2;i>=0;i--){
               if(s[i]==prev)suff++;
               else break;
          }
         
          if(pre==n){
               int temp=pre*x;
               cout<<temp/2;
              return 0;
          }
          int ans=0;
          prev=s[pre];
          int cnt=1;
          for(int i=pre+1;i<n-suff;i++){
               if(s[i]==prev)cnt++;
               else{
                    ans+=cnt/2;
                    prev=s[i];
                    cnt=1;
               }
          }
          ans+=cnt/2;
          int res=ans*x+((pre+suff)/2)*(x-1)+pre/2+suff/2;
          cout<<res;
     }
     
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;
    int min = (a < b) ? a : b;
    int max = (a > b) ? a : b;
    int c = max - min;
    if (c % 2 == 0)
    {
        cout << min + c / 2 << endl;
    }
    else
    {
        cout << "IMPOSSIBLE\n";
    }
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

constexpr int MOD = 1000000007;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

vector<int> v;

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

    int v = 1;
    while (v*(v+1)/2<N) {
        ++v;
    }

    int diff = v*(v+1)/2 - N;

    for (int j = 1; j <= v; ++j) {
        if (diff == j) {
            continue;
        }
        cout << j << endl;
    }


    return 0;
}


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

void __print(int x) {cerr << x;};void __print(long x) {cerr << x;};void __print(long long x) {cerr << x;};void __print(unsigned x) {cerr << x;};void __print(unsigned long x) {cerr << x;};void __print(unsigned long long x) {cerr << x;};void __print(float x) {cerr << x;};void __print(double x) {cerr << x;};void __print(long double x) {cerr << x;};void __print(char x) {cerr << '\'' << x << '\'';};void __print(const char *x) {cerr << '\"' << x << '\"';};void __print(const string &x) {cerr << '\"' << x << '\"';};void __print(bool x) {cerr << (x ? "true" : "false");}

#define int             long long
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define endl             '\n'
#define pb              push_back
#define all(x)          x.begin(),x.end()
#define ff              first
#define ss              second
int powmod(int a,int b) {int res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int string_to_int(string s){int ans = 0;int p=1;for(int i=s.size()-1;i>=0;i--){ans += (s[i]-'0')*p;p *= 10;}return ans;}

//DEBUGGING-LINES
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr <<'}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i);cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif

void t_c_c()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
/*#ifndef ONLINE_JUDGE
	freopen("inp.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
#endif*/

	int n,k; cin >> n >> k;
	int arr[n];
	for(int i=0;i<n;i++){
		cin >> arr[i];
	}
	int idx = 0;
	for(int i=k;i<n;i++){
		if(arr[i]>arr[idx]){
			cout << "Yes" << endl;
		}
		else{
			cout << "No" << endl;
		}
		idx++;
	}
}

int32_t main()
{
	t_c_c();
	return 0;
}


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

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

  int sentou[200005];
  for (int i = 0; i < n; i++)
  {
    cin >> sentou[i];
  }

  int res = 0;
  for (int i = 1; i < n; i++)
  {
    res += std::min(t, sentou[i] - sentou[i - 1]);
  }
  res += t;

  cout << res << endl;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>

using namespace std;

int n;
int x[11],y[11],l[11];
double data[11];

double check(double nx,double ny){
	for(int i=0;i<n;i++){
		double xx=(nx-x[i])*(nx-x[i]);
		double yy=(ny-y[i])*(ny-y[i]);
		data[i]=(double)l[i]*l[i]-xx-yy;
	}
	double res=data[0];
	for(int i=1;i<n;i++){
		res=min(res,data[i]);
	}
	return res;
}

double check_y(double nx){
	double l=-100.0,r=100.0;
	for(int i=0;i<100;i++){
		double ly=check(nx,(l*2+r)/3);
		double ry=check(nx,(l+r*2)/3);
		if(ly<ry)l=(l*2+r)/3;
		else r=(r*2+l)/3;
	}
	return max(check(nx,((l*2+r)/3)),check(nx,((l+r*2)/3)));
}

int main(void){
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		for(int i=0;i<n;i++){
			scanf("%d %d %d",&x[i],&y[i],&l[i]);
		}
		double l=-100.0,r=100.0;
		for(int i=0;i<100;i++){
			double lx=check_y((l*2+r)/3);
			double rx=check_y((l+r*2)/3);
			if(lx<rx)l=(l*2+r)/3;
			else r=(r*2+l)/3;
		}
		printf("%.8f\n",sqrt(max(check_y((l*2.0+r)/3.0),check_y((l+r*2.0)/3.0))));
	}
	return 0;
}

Measured memory_bytes: 1068
#include<bits/stdc++.h>
using namespace std;
#define all(a)  (a).begin(),(a).end()
typedef long long ll;
const ll mod=1000000007;
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)

int main() {
  int n;cin>>n;
  int cnt = 0;
  map<int, int> mp;
  int arr_cnt = 0;
  repi(i,0,n) {
    int t;cin >> t;
    if(t == i+1){
      ++arr_cnt;
    } else {
      if(arr_cnt == 0) continue;
      if(mp.find(arr_cnt) == mp.end()){
        mp[arr_cnt] = 1;
      } else {
        mp[arr_cnt] = mp[arr_cnt] + 1;
      }
      arr_cnt =0;
    }
  }
  if(arr_cnt >0){
    if(mp.find(arr_cnt) == mp.end()){
      mp[arr_cnt] = 1;
    } else {
      mp[arr_cnt] = mp[arr_cnt] + 1;
    }
  }
  int out = 0;
  for(auto&& ele:mp){
    //cout << ele.first << " " << ele.second << endl;
    if(ele.first == 1){
      out += ele.second;
    } else {
      out += (ele.first/2 + ele.first%2) * ele.second;
    }
  }
  cout << out << endl;
  return 0;
}


Measured memory_bytes: 256
# 幅優先探索（行きがけ）
import collections
import sys
import math
import copy
import collections


def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())


def main():
    N = I()
    AArry = LI()
    AArry.sort()
    count = 0
    li = [0 for _ in range(10**6+2)]

    for i, v in enumerate(AArry):
        a = v
        if li[a] == 1:
            count += 1
        if li[a] == 0:
            if i != N-1 and AArry[i+1] == a:
                count += 1

            for j in range(a, 10**6+2, a):
                li[j] = 1

    print(N-count)


if __name__ == '__main__':
    main()


Measured memory_bytes: 32852
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <deque>
#include <queue>//for queue and priority_queue
#include <fstream>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#define endl "\n"
typedef long long ll;
using namespace std;
void Lancer() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); }
bool isPrime(ll n){
	if (n == 2 || n == 3 || n == 5)
		return true;
	else if (n % 2 == 0 || n % 3 == 0 || n % 5 == 0 || n == 1)
		return false;
	else {
		for (int i = 5; i <= sqrt(n); i += 2){
			if (n%i == 0)
				return false;
		}
		return true;
	}
}
//int frq[123];
//int arr[107];
int main(){
	Lancer();
	ll n, x=0,res=0;
	string str;
	cin >> n>>str;
	for (int i = 0; i < n; i++){
		if (str[i] == 'D')
			x--;
		else
			x++;
		res = max(x, res);
	}
	cout << res;
	cout << endl;
	return 0;
}


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

int main() {

    ios::sync_with_stdio(0);
    cin.tie(NULL), cout.tie(NULL);

    int a, b, c;
    cin >> a >> b >> c;

    c -= (a - b);

    cout << max(0, c) << "\n";
    return 0;
}


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

#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 rep(i,a,b)  for(int i=a;i<b;i++)
#define rep0(a,n)  for(int i=0;i<n;i++)cin>>a[i]
#define si(x)       cin>>x
#define sii(x,y)    cin>>x>>y
#define siii(x,y,z) cin>>x>>y>>z
#define ahell   998244353
#define hell 1000000007
#define N 1000001
#define fl 1.0000000000
//#define mod 998244353
#define cntbit(a) __builtin_popcountl(a)
#define ios ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

main()
{
  ios
int n,m,i;
int j;
int u,v,q;
int test=1;
//si(test);

while(test--)
{
    string s,t;
    cin>>s>>t;
    int n=s.size(),m=t.size();
    int dp[n+1][m+1],last1[n+1][m+1],last2[n+1][m+1];
    for(i=0;i<n;i++)
    {
        for(j=0;j<m;j++)
        {
            last1[i][j]=-1;
            last2[i][j]=-1;
            dp[i][j]=0;
        }

    }

 //dp[0][i]
    int id1=-1,id2=-1;
    for(i=0;i<m;i++)
    {
        if(s[0]==t[i])
        {
            if(id1==-1)
                id1=i;
        }

        if(id1!=-1)
        {
            last1[0][i]=0;
            last2[0][i]=id1;
            dp[0][i]=1;
        }

    }

// dp[i][0]

    id1=-1;
     for(i=0;i<n;i++)
    {
        if(s[i]==t[0])
        {
            if(id1==-1)
                id1=i;
        }

        if(id1!=-1)
        {
            last1[i][0]=id1;
            last2[i][0]=0;
            dp[i][0]=1;
        }

    }


for(i=1;i<n;i++)
{

    for(j=1;j<m;j++)
    {
        int t1=0;

        if(s[i]==t[j])
            t1=dp[i-1][j-1]+1;
        t1=max(t1,max(dp[i-1][j],dp[i][j-1]));
        dp[i][j]=t1;

        if(t1>0)
        {
            if(t1==dp[i-1][j])
            {
                last1[i][j]=last1[i-1][j];
                last2[i][j]=last2[i-1][j];
            }
            else if(t1==dp[i][j-1])
            {
                 last1[i][j]=last1[i][j-1];
                 last2[i][j]=last2[i][j-1];
            }
            else
            {
                last1[i][j]=i;
                last2[i][j]=j;
            }
        }
    }
}

/*for(i=0;i<n;i++)
{
    for(j=0;j<m;j++)
    {

        cout<<i<<" "<<j<<" "<<dp[i][j]<<" "<<last1[i][j]<<" "<<last2[i][j]<<"\n";
    }

}

*/

int u=last1[n-1][m-1],v=last2[n-1][m-1];

stack<char>s1;
while(u!=-1&&v!=-1)
{
  //  cout<<u<<" "<<v<<"\n";
s1.push(s[u]);

int g=u,h=v;

if(g==0||h==0)
    break;
u=last1[g-1][h-1];v=last2[g-1][h-1];
}

while(!s1.empty())
{
    cout<<s1.top();
    s1.pop();
}

}

}


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

int main()
{
    int n,k;
    cin>>n>>k;
    long long sum=0;
    for(int i=1;i<=n;i++)
    {
        if(k>=i)continue;
        long long p=n/i;
        long long r=abs(i-k);
        p=(p*r);
        if(n%i!=0)
        {
            long long c = n-(i*(n/i));
          //  if(c==0)continue;
   //     cout<<i<<" "<<c<<endl;
          if(c>=k)p+=(c-k+1);
          if(k==0)p--;
           // else if(c==k)p+=(c-k+1);
        }
        sum+=p;
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 256