akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
  public static void main(String args[]) {

    Scanner sc = new Scanner(System.in);

    int A = sc.nextInt();
    int B = sc.nextInt();
    int count = 0;
    int sumA = 0;

    while (count < B - 1) {
      count += (A - 1);
      sumA++;
    }

    System.out.print(sumA);

    sc.close();
  }
}

Measured memory_bytes: 23892
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <unordered_map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
#include <bitset>
#include <functional>
#include <cassert>

#define all(x) (x).begin(),(x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}

ll conbinationMemo[100][100];

void cmemoInit(){
    rep(i, 100){
        rep(j, 100){
            conbinationMemo[i][j] = -1;
        }
    }
}
 
ll nCr(ll n, ll r){
    if(conbinationMemo[n][r] != -1) return conbinationMemo[n][r];
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return conbinationMemo[n][r] = (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
//-----------------------ここから-----------
int main(void){
    char a;
    cin >> a;
    if('a' <= a && a <= 'z'){
        cout << "a" << endl;
    } else {
        cout << "A" << endl;
    }
}


Measured memory_bytes: 3628
n=gets.to_i
v=gets.split.map(&:to_i)
he=[0]*(10**5+1)
ho=[0]*(10**5+1)
n.times do |i|
  if i.even?
    he[v[i]]+=1
  else
    ho[v[i]]+=1
  end
end
hemv = he.max
homv = ho.max
hemk = he.index(he.max)
homk = ho.index(ho.max)
if hemk == homk
  he[hemk]=0
  ho[homk]=0
  if he==[0]*(10**5+1)
    hhemv=0
  else
    hhemv = he.max
  end
  if ho==[0]*(10**5+1)
    hhomv=0
  else
    hhomv = ho.max
  end
  puts n-[hemv+hhomv,homv+hhemv].max
else
  puts n-hemv-homv
end


Measured memory_bytes: 13196
// warm heart, wagging tail,and a smile just for you!
//
//                            ▒█████▒▒
//                             ██████████▒
//                             ▒████████████▒
//                            ██████████████████
//                           ████████████████████▒
//                          ▒██████████████████████▒
//                          ▒███████████████████████
//                      ▒████▒▒▒▒▒▒█████████████████▒
//                    ███▒▒▒▒▒▒██████████████████████▒▒▒
//                  ▒██▒▒███████████████████████▒▒▒▒▒██████
//                 ▒█████████████████████████▒▒▒▒▒▒█████████▒
//                 ▒█████████████████████▒▒▒▒▒▒██████████████
//                  ▒████         ████▒▒▒▒▒████         ████▒
//              ▒█████▒    ████    ▒▒▒▒███████    ████    ██████▒
//            ▒██▒▒▒▒▒    ██████    █████████    ██████    ██▒▒▒██▒
//           █████████   ████████   █████████   ████████   ▒▒▒▒█████
//          ▒█████████    ██████    ████████▒    ██████    █████████
//          ▒██████████    ████    █████▒▒▒▒▒▒    ████    ██████████
//           ████████████        ▒▒▒▒▒▒▒████████        ███████████▒
//       ▒██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████████▒
//     ███▒▒▒▒▒▒▒▒▒▒▒▒█████████████████████████████████████████▒▒████████▒
//   ▒▒▒▒▒▒▒▒▒██████████████                         ███████▒▒▒▒███████████
//   █████████████████████████                     ███████▒▒▒██████████████▒
//   █████████████████████████████             ███████▒▒▒██████████████████▒
//   ██████████████████████████████████████████████████████████████████████
//    ██████████████████████████████████████████████████████████████████▒
//      ▒█████████████████▒▒▒▒▒▒▒██████████████████████████████████▒▒▒
//
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i = (b-1);i>=(a);--i)
#define REP(i,n)  FOR(i,0,(n))
#define RREP(i,n) RFOR(i,0,(n))
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

void ng(){
  cout << "No" << endl;
  exit(0);
}

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

  string s;
  cin >> s;

  if(s == "Sunny") cout << "Cloudy" << endl;
  if(s == "Cloudy") cout << "Rainy" << endl;
  if(s == "Rainy" ) cout << "Sunny" << endl;

  return 0;
}

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

int cnt[802][802] = {0};

const int ud[4] = {1, -1, 0, 0};
const int lr[4] = {0, 0, 1, -1};

int main(void) {
	int H, W, K;
	cin >> H >> W >> K;

	int sh, sw;
	for (int h = 1; h <= H; h++) {
		for (int w = 1; w <= W; w++) {
			char c;
			cin >> c;
			if (c == 'S') {
				cnt[h][w] = 0;
				sh = h;
				sw = w;
			} else if (c == '#') {
				cnt[h][w] = -1;
			} else { // '.'
				cnt[h][w] = 1000000;
			}
		}
	}

	queue<pair <int, int> > que;
	que.push(make_pair(sh, sw));
	
	while (!que.empty()) {
		pair <int, int> pos;
		pos = que.front();
		que.pop();

		int h = pos.first;
		int w = pos.second;
		int now_cnt = cnt[h][w];
		for (int mv = 0; mv < 4; mv++) {
			int new_h = h + ud[mv];
			int new_w = w + lr[mv];
			if (cnt[new_h][new_w] > (now_cnt+1)) {
				cnt[new_h][new_w] = now_cnt+1;
				que.push(make_pair(new_h, new_w));
			}
		}
	}

	int ans = 1000000;
	for (int h = 1; h <= H; h++) {
		for (int w = 1; w <= W; w++) {
			if ((0 <= cnt[h][w]) && (cnt[h][w] <= K)) {
				int min_dist = 10000000;
				min_dist = min(min_dist, abs(h - 1));
				min_dist = min(min_dist, abs(h - H));
				min_dist = min(min_dist, abs(w - 1));
				min_dist = min(min_dist, abs(w - W));

				ans = min(ans, 1+((min_dist+K-1)/K));
			}
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 2816
#include <iostream>
#include <cmath>
#include <algorithm>
#include <map>
#include <string>
#define FOR(i, a, b)  for(int i=a;i<=b;++i)
#define rep(i, n) for(int i=0;i<n;++i)
using namespace std;

int main(){
  string s; cin >> s;
  int ctr = 0, k; cin >> k;
  int siz = (int)s.size();
  map<string, int> mp;
  rep(i, siz){
    FOR(j, 1, k){
      string subs = s.substr(i, j);
      if(mp[subs]>=1) continue;
      mp[subs]++;
    }
  }
  for(auto itr = mp.begin(); itr != mp.end(); ++itr){
    ctr++;
    if(ctr == k){
      cout << itr->first << endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 1920
/**
 *   author: bholuakku
**/

#include <bits/stdc++.h>
#define For(i,a,b) for(i=(a); i<(b); i++)
#define rep(i,n) for(i=0; i<(n); i++)
#define Nfor(i,a,b) for(i=(a)-1; i>=(b); i--)
#define dep(i,n) for(i=(n-1);i>=0; i--)
#define mp make_pair
#define pb push_back
#define Auto(a) for(auto &val : a)
#define X first
#define Y second
#define MOD 1000000007
#define MOD1 998244353
#define iterate(A, i) for(auto i = A.begin(); i!=A.end(); i++)
#define mset(A,val,n) memset(A, val, n*sizeof(int))
#define Endl cout<<"\n"
#define Test cout<<"Hello\n"

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<bool> vb;
typedef vector<vector<bool> > vvb;
typedef pair<int, int> pii;
typedef vector<vector<pair<int, int> > > vvp;

int power(ll x, ll y, ll p) { ll res = 1; x = x % p; while (y>0){ if (y & 1) res = (res*x) % p; y = y>>1; x = (x*x)%p;} return res;}
int modInverse(ll n) {ll p = MOD;return power(n, p-2, p);}
int min(int a, int b, int c) { return min(a, min(b, c)); }
int max(int a, int b, int c) { return max(a, max(b, c)); }
inline void swap(int &a, int &b) { int t = a; a = b; b = t;}
bool cmp(int a, int b){return a>b;}

int n;
long double dp[301][301][301];
vi A;

long double foo(int c1, int c2, int c3){
    if(dp[c1][c2][c3]!=-1) return dp[c1][c2][c3];
    if(c1==0&&c2==0&&c3==0) return 0;
    long double ans = n*1.0;
    if(c1>0) ans+= (c1*foo(c1 -1, c2, c3));
    if(c2>0) ans+=(c2*foo(c1+1, c2-1, c3));
    if(c3>0) ans+= (c3*foo(c1, c2+1, c3-1));
    ans/=(0.0+c1+c3+c2);
    dp[c1][c2][c3] = ans;
    return ans;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
        //freopen("C:\\Users\\ACER\\Desktop\\Codes\\input.txt", "r", stdin);
    #endif
    int i, j, k, one=0, two=0, three=0;
    for(i=0; i<301; i++) for(j=0; j<301; j++) for(k=0; k<301; k++) dp[i][j][k] = -1;
    cin>>n;
    A.resize(n);
    for(int& x : A) {
        cin>>x;
        if(x==1) one++;
        else if(x==2) two++;
        else three++;
    }
    cout<<setprecision(17)<<foo(one, two, three);
    return 0;
}


Measured memory_bytes: 426496
#include <iostream>

#define H 9
#define W 9

bool endCheck(int h, int w, const bool A[H][W]){
  for(int i=0; i<=h; i++){
    for(int j=0; j<=w; j++){
      if(A[i][j]) return false;
    }
  }
  return true;
}

bool solve(int h, int w, int nowh, int noww, bool A[H][W]){
  A[nowh][noww] = false;
  if(h==nowh and w==noww)
    return endCheck(h, w, A);

  bool ret = false;
  if(nowh<h && A[nowh+1][noww]){
    bool T[H][W];
    for(int i=0; i<=h; i++){
      for(int j=0; j<=w; j++){
	T[i][j] = A[i][j];
      }
    }
    ret |= solve(h, w, nowh+1, noww, T);
  }
  if(noww<w && A[nowh][noww+1]){
    bool T[H][W];
    for(int i=0; i<=h; i++){
      for(int j=0; j<=w; j++){
	T[i][j] = A[i][j];
      }
    }
    ret |= solve(h, w, nowh, noww+1, T);
  }

  /*
  for(int i=0; i<=h; i++){
    for(int j=0; j<=w; j++){
      std::cout << A[i][j] << " ";
    }
    std::cout << std::endl;
  }
  std::cout << std::endl;
  */
  return ret;
}

int main(void){
  int h, w;
  bool A[H][W] = {};
  std::cin >> h >> w;
  for(int i=0; i<h; i++){
    for(int j=0; j<w; j++){
      char c;
      std::cin >> c;
      if(c=='#') A[i][j] = true;
    }
  }

  if(solve(h-1, w-1, 0, 0, A)){
    std::cout << "Possible" << std::endl;
  }else{
    std::cout << "Impossible" << std::endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using P=pair<long long,long long>;
#define rep(i,n) for(long long i=0; i<(long long)n; i++)
#define FOR(i,a,b) for(long long i=a; i<b; i++)
#define ll long long
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((long long)(x).size())
#define COUT(x) cout << x << endl
#define PB(x) push_back(x)
#define MP make_pair
#define vint vector<int>
#define vvint vector<vector<int>>
#define vstr vector<string>
#define SUM(x) accumulate(x.begin(),x.end(),0)
#define MAX(x) *max_element(x.begin(),x.end())
#define MIN(x) *min_element(x.begin(),x.end())
#define couty cout<<'Y'<<'e'<<'s'<<endl
#define coutn cout<<'N'<<'o'<<endl
#define coutY cout<<'Y'<<'E'<<'S'<<endl
#define coutN cout<<'N'<<'O'<<endl
#define yn(x) cout<<(x?"Yes":"No")<<endl
#define YN(x) cout<<(x?"YES":"NO")<<endl
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}
const long long dx[4]={1,0,-1,0};
const long long dy[4]={0,1,0,-1};
const long long INF = 1e12;
const long long MOD = 1e9+7;
//cout<<fixed<<setprecision(15)<<

#define ld long double

signed main(){
    int a,b,c; cin >> a >> b >> c;
    yn((4*a*b<(c-a-b)*(c-a-b))&&((c-a-b)>0));
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  int M=-1000000;
  string m;
  cin>>n;
  map<string,int> poll;
  for(int i=0;i<n;i++){
    string s;
    cin>>s;
    poll[s]++;
  }
  for(auto v : poll){
    if(v.second>M){
      M=v.second;
     
    }
  }
  for(auto v : poll){
    if(v.second==M){
      cout<<v.first<<endl;
    }
  }
}


Measured memory_bytes: 25216
x, k, d = map(int, input().split())
x = abs(x)
temp = (0 - -x//d)

if temp > k:
    ans = x - d*k

else:
    ref1 = x - temp*d #0かマイナス
    ref2 = x - (temp - 1)*d #プラス
    k = k - temp
    if k%2 == 0:
        ans = ref1
    else:
        ans = ref2

print(abs(ans))

Measured memory_bytes: 9172
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <queue>
#include <sstream>
#include <stack>
#include <time.h>
#include <vector>
#include <complex>
#include <map>
#include <set>
#include <iomanip>
#include <math.h>
#include <stdlib.h>
#include <list>
#include <utility>
#include <memory>
#include <cstring>
#include <fstream>
#include <numeric>
#include <assert.h>
#include <bits/stdc++.h>
using namespace std;
vector <int> g[100003];
int vis[100003];
int main() {
	int n;
	cin>>n;
	for (int i=0; i<n-1; i++) {
		int x,y;
		cin>>x>>y;
		  g[x].push_back(y);
		g[y].push_back(x);
	}
	queue <int> q;
	q.push(1),q.push(n);
	memset (vis,-1,sizeof(vis));
	vis[1]=0;
	vis[n]=1;
	while (!q.empty()) {
		int x=q.front();
		q.pop();
		for (int i=0; i<g[x].size(); i++) {
			if (vis[g[x][i]]==-1) {
				vis[g[x][i]]=vis[x];
				q.push(g[x][i]);
			}
		}
	}
	int cnt1=0,cnt2=0;
	for (int i=1;i<=n;i++){
		if (vis[i]==0) cnt1++;
		else cnt2++;
	}
	if (cnt1>cnt2) cout<<"Fennec";
	else cout<<"Snuke";
	return 0;
}

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

int main()
{
	int N,K,ANS=0;
	cin >> N;
	K = log10(N) + 1;

	for (int i = 1; i < K; i+=2)
	{
		ANS = ANS + pow(10, i) - pow(10,i-1);
	}

	if (K % 2 != 0)
	{
		cout << ANS + N - pow(10, K-1) + 1 << endl;
	}
	else
	{
		cout << ANS << endl;
	}

}

Measured memory_bytes: 512
import math

def main():
    n, k = [int(i) for i in input().split()]

    res = 0
    for i in range(n):
        ini = i + 1
        succ_req = math.ceil(math.log2(math.ceil(k / ini)))
        prob = (0.5 ** succ_req) / n
        res += prob
    print(res)

if __name__ == '__main__':
    main()



Measured memory_bytes: 3188
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto K = RD;
	auto X = RD;
	auto Y = RD;
	
	writeln(min(N, K) * X + max(N - K, 0) * Y);
	stdout.flush();
	debug readln();
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
using namespace std;
const int INF= 1e9+5;
typedef long long ll;

int main(){
  int d;
  cin>>d;
  if(d==7 || d==5 || d==3)cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {

    int A ,B ,i;
    int res = 0;
    
    //空白区切りで入力
    scanf("%d %d" ,&A ,&B);

    for( i = 0; i < 2; i++)
    {
        if (A <= B) {
            res = res + B;
            B--;
        }else if (B <= A)
        {
            res = res + A;
            A--;
        }
    }
    
    printf("%d\n" ,res);

    return 0;

}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main() {
  int r,d,x;
  cin>>r>>d>>x;
  rep(i,10){
    x=r*x-d;
    cout<<x<<endl;
  }
}

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

using namespace std;

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

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int N; cin >> N;
	vector<ll> a(3*N, 0LL);
	rep (i, 3*N) cin >> a[i];

	priority_queue<ll, vector<ll>, greater<ll> > p; // 前半分
	priority_queue<ll> q;	// 後ろ半分
	ll qsum = 0LL;
	ll psum = 0LL;
	rep (i, 3 * N){
		if (i < N){
			p.push(a[i]);
			psum += a[i];
		} // end if
		if (i >= 2 * N){
			q.push(a[i]);
			qsum += a[i];
		} // end if
	} // end for

	vector<ll> pm(N + 1, 0LL);
	pm[0] = psum;
	for (int k = N; k < 2 * N; ++k){
		p.push(a[k]); psum += a[k];
		psum -= p.top(); p.pop();
		pm[k - N + 1] = psum;
	} // end for

	vector<ll> qm(N + 1, 0LL);
	qm[N] = qsum;
	for (int k = 2 * N - 1; k >= N; --k){
		q.push(a[k]); qsum += a[k];
		qsum -= q.top(); q.pop();
		qm[k - N] = qsum;
	} // end for

	ll res = -INF;
	rep (i, N + 1){
//		cerr << pm[i] << ' ' << qm[i] << endl;
		ll curr = pm[i] - qm[i];
		res = max(res, curr);
	} // end rep
	cout << res << endl;
	
	return 0;
}

Measured memory_bytes: 5876
#define _CRT_SECURE_NO_WARNINGS
	#include <stdio.h>

int main() {
	int x;
	scanf("%d", &x);
	int b = x / 100, a = x % 100;
	if (b > 12||b==0) {
		if (a > 12 || a == 0) {
			puts("NA");
		}
		else {
			puts("YYMM");
		}
	}
	else {
		if (a > 12 || a == 0) {
			puts("MMYY");
		}
		else {
			puts("AMBIGUOUS");
		}
	}
	getchar();
	return 0;
}


Measured memory_bytes: 128
s = gets.chomp

def head_tail?(s, l)
    (0..(s.size - l)).each{|i|
        if s[i] == s[i + l - 1]
            return [i + 1, i + l]
        end
    }
    nil
end

def short_pattern(s)
    (2..3).each{|l|
        result = head_tail?(s, l)
        return result if result
    }
    [-1, -1]
end

puts "%d %d" % short_pattern(s)


Measured memory_bytes: 2044
#include <stdio.h>
 
int main(void){
  int i;
  char st,al[53] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
   
  do{
    scanf("%c", &st);
 
    for(i=0;i<52;i++)
      if(al[i] == st){
        st = al[ (i+26)%52 ];
        break;
      }
 
    printf("%c", st);
 
  }while(st != '\n');
 
  return 0;
}


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

 long long N, K, A[1 << 18];

 int main() {
 cin >> N >> K;
 for (int i = 1; i <= N; i++) cin >> A[i];
 for (int i = K + 1; i <= N; i++) {
 if (A[i - K] < A[i]) cout << "Yes" << endl;
 else cout << "No" << endl;
 }
 return 0;
 }

Measured memory_bytes: 5180
#include<iostream>

using namespace std;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    int n;cin>>n;
    int j=0;
    rep(i,n){
        int a;cin>>a;
        if(a%2==1)j++;
    }
    if(j%2==0)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
static const ll MOD = 1e9 + 7;

bool pairCompare(const pair<int, int>& firstElof, const pair<int, int>& secondElof) {
    return firstElof.first > secondElof.first;
}

int main(void) {
    int r, D, x_2000;
    cin >> r >> D >> x_2000;

    int ans, x_before = x_2000;
    for(int i=0;i<10;i++) {
        ans = r*x_before -D;
        cout << ans << endl;
        x_before = ans;
    }
    
    return (0);
}


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

ll min(ll a, ll b)
{
  if(a<b) return a;
  return b;
}

int main()
{
  int n,m;
  cin >> n;
  m = pow(10,9);
  ll sum=0;
  ll count = 1;
  for(int i=0; i<n; i++)
  {
    ll tmp;
    cin >> tmp;
    sum += abs(tmp);
    m = min(m,abs(tmp));
    if(tmp<0) count*=-1;
  }
  count = count-1;
  cout << sum+count*m << endl;
  return 0;
}


Measured memory_bytes: 256
import itertools
import math
H,W,A,B=map(int,raw_input().split())

mod=10**9+7

FACT={}

n=1
for i in range(H+W-1):
	if i==0: n=1
	else: n=(n*i)%mod
	FACT[i]=n

#print FACT

def C(n,r):
	return (FACT[n]*pow(FACT[r],10**9+5 ,mod)*pow(FACT[n-r],10**9+5 ,mod)) %mod


p=0
for i in range(B,W):
	p+=C(H-A-1+i,i)*C(A-1+W-i-1,W-i-1)
	p=p%mod


print p




Measured memory_bytes: 31672
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <tuple>
#include <cmath>
using namespace std;
#define _GLIBCXX_DEBUG

int main(void){

    int N;
    string S;
    int count = 0;

    cin >> N >> S;

    for(int i=0; i < N-2; i++){
        if(S.at(i) == 'A' && S.at(i+1) =='B' && S.at(i+2) == 'C'){
            count++;
        }
    }

    cout << count << endl;

}

Measured memory_bytes: 256
Q,S,H,D = map(int,input().split())
N = int(input())

one = min(Q*4,S*2,H)

if one * 2 <= D:
  print(N * one)
else:
  if N % 2 == 0:
    print((N//2)*D)
  else:
    print((N//2)* D + one)

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

using E = System.Linq.Enumerable;

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var s = Console.ReadLine().Trim();
        Console.WriteLine(n % 2 == 0 && s.EndsWith(s.Substring(0, n / 2)) ? "Yes" : "No");
    }
}


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

int main()
{
    int n,h,cnt=0,i;
    cin >> n >> h;
    vector<int> a(2*n);
    map<int ,long long> k;
    for(i=0;i<n;i++){
        int p,q;
        cin >> p >> q;
        if(k[q]==0)k[q]=1;
        if(k[p]==1)k[p]=2;
        a.at(i*2)=p;a.at(i*2+1)=q;
    }
    sort(a.begin(),a.end());
    reverse(a.begin(),a.end());
    for(i=0;h>0;i++){
        if(k.at(a.at(cnt))%2){
            h-=a.at(cnt);
            cnt++;
        }else{
            if(h%a.at(cnt)==0){
                i+=h/a.at(cnt);
            }else{
                i+=h/a.at(cnt)+1;
            }
            cout << i << endl;
            return 0;
        }
    }
    cout << i << endl;
    return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

//++時計回り --反時計回り
// int dx[4] = {1, 0, -1, 0};
// int dy[4] = {0, 1, 0, -1};

int main() {
  int N;
  cin >> N;
  int A[N], B[N], C[N];
  REP(i, N) {
    int x;
    cin >> x; x--;
    A[i] = x;
  }
  REP(i, N) {
    int x;
    cin >> x;
    B[i] = x;
  }
  REP(i, N-1) {
    int x;
    cin >> x;
    C[i] = x;
  }
  int ans = 0;
  REP(i, N) {
    ans += B[i];
  }
  REP(i, N-1) {
    if (A[i] + 1 == A[i+1]) ans += C[A[i]];
  }
  cout << ans << '\n';

}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <utility>
#include <cmath>
#include <map>
#include <set>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

#define INF_LL (ll)1e18
#define INF (int)1e9
#define REP(i, n) for(int i = 0;i < (n);i++)
#define FOR(i, a, b) for(int i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
using ll = long long;
using PII = pair<int, int>;

const double eps = 1e-10;

template<typename A, typename B>inline void chmin(A &a, B b){if(a > b) a = b;}
template<typename A, typename B>inline void chmax(A &a, B b){if(a < b) a = b;}


bool f[101][5][2] = {};
ll p[101][11] = {};
int main(void){
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N;
	cin >> N;
	REP(i, N){
		REP(j, 5){
			REP(k, 2){
				cin >> f[i][j][k];
			}
		}
	}
	REP(i, N){
		REP(j, 11)
			cin >> p[i][j];
	}
	ll res = -INF_LL;
	FOR(i, 1, (1 << 10)){
		int cnt[100] = {};
		REP(j, 10){
			if((i >> j)&1){
				REP(k, N){
					if(f[k][j%5][j/5])
						cnt[k]++;
				}
			}
		}
		ll sum = 0;
		REP(j, N){
			sum += p[j][cnt[j]];
		}
		if(res < sum){
			res = max(res, sum);
		}
	}
	cout << res << endl;
}


Measured memory_bytes: 256
<?php
$n = trim(fgets(STDIN));
$a = explode(" ",trim(fgets(STDIN)));
$i = 0;
$o = 0;
$e = 0;
$ee = 0;
while($i < $n){
if($a[$i] % 2 == 1){
++$o;
}elseif($a[$i] % 4 == 0){
++$ee;
}else{
++$e;
}
++$i;
}

if($o <= $ee){
echo "Yes";
}elseif($o == $ee + 1){
if($o + $ee == $n){
echo "Yes";
}else{
echo "No";
}
}else{
echo "No";
}

Measured memory_bytes: 21928
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <tuple>
#include <cassert>
#include <memory>
using namespace std;
typedef long long ll;
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;

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

    int s = N + M;
    cout << (s * (s - 1) / 2) - N * M << endl;

    return 0;
}


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

using namespace std;

double sum(0);
int main()
{
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		double t;string yuan;
		cin >> t >> yuan;
		if (yuan == "JPY")
			sum += t;
		else
			sum += t * 380000;
	}
	printf("%.5lf", sum);
	cout << endl;

	return 0;
}

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

int main(int argc, char const *argv[]) {
  int x, y, z, count = 0;
  cin >> x >> y >> z;
  for (x; x <= y; x++) {
    if (z % x == 0) {
      count++;
    }
  }
  cout << count++ << endl;
  return 0;
}



Measured memory_bytes: 3096
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <unordered_map>
#include <vector>

using namespace std;

#define ll long long
#define el '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repi(i, a, b) for (int i = a; i >= b; i--)
#define vi vector<int>
#define vii vector<pair<int, int>>
#define pii pair<int, int>
#define mp make_pair
#ifdef LOCAL
#define debug(fmt, ...) printf(fmt, ##__VA_ARGS__)
#define check(...) assert(__VA_ARGS__)
#else
#define debug(fmt, ...)
#define check(...)
#endif

#define MODULO 1000000007

int n, k;

int add(int a, int b) {
    return (a + b) % MODULO;
}

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

    cin >> n >> k;
    int ans = 0;
    rep(i, k, n + 2) {
        ll min_sum = (ll)(0 + i - 1) * i / 2;
        ll max_sum = (ll)(n + n - i + 1) * i / 2;
        ll cnt = max_sum - min_sum + 1;
        debug("choose %d, cnt=%d\n", i, cnt);
        ans = add(ans, cnt % MODULO);
    }
    cout << ans;
}


Measured memory_bytes: 3164
import java.util.Scanner;

class Main {

    static long ans;
    static int[] k_list;

    public static void main(String[] args) {
        var scaner = new Scanner(System.in);
        var n = scaner.nextInt();
        var m = scaner.nextInt();

        int[] h_list = new int[n];
        for(int i=0; i<n; i++) {
            h_list[i] = scaner.nextInt();
        }

        boolean[] bad = new boolean[n];
        for (int i = 0; i < m; i++) {
            int a = scaner.nextInt() - 1;
            int b = scaner.nextInt() - 1;

            if (h_list[a] <= h_list[b]) {
                bad[a] = true;
            } 
            if (h_list[a] >= h_list[b]) {
                bad[b] = true;
            }
        }

        int ans = 0;
        for(boolean e: bad) {
            if(!e) ans++;
        }

        System.out.println(ans);
        scaner.close();
    }

}


Measured memory_bytes: 59316
using System;

namespace ABC173C
{
    class Program
    {
        static void Main(string[] args)
        {
            var t = Console.ReadLine().Trim().Split(' ');
            int H = int.Parse(t[0]);
            int W = int.Parse(t[1]);
            int K = int.Parse(t[2]);
            char[,] x = new char[H,W];
            for(int i=0;i<H;i++) {
                var s = Console.ReadLine().ToCharArray();
                for(int j=0;j<W;j++)
                    x[i,j] = s[j];
            }
            int ans = 0;
            for(int i=0; i<Math.Pow(2, H); i++){
                for(int j=0; j<Math.Pow(2, W); j++){
                    int remain = 0;
                    for(int k=0;k<H;k++){
                        for(int l=0;l<W;l++){
                            if( (i & (1 << k)) == 0 && (j & (1 << l)) == 0 && x[k,l] == '#' )
                                remain++;
                        }
                    }
                    if(remain == K) ans++;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 27860
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

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

func Foo() int {
	n := nextInt()
	d := nextInt()
	d2 := d * d

	res := 0

	for i := 0; i < n; i++ {
		x, y := nextInt(), nextInt()
		if d >= x && d >= y {
			m := x*x + y*y
			if m <= d2 {
				res = res + 1
			}
		}
	}

	return res
}

func main() {
	sc.Split(bufio.ScanWords)

	res := Foo()
	fmt.Println(res)
}


Measured memory_bytes: 4896
//I am so vegetable
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define FIO ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define PB push_back
#define IN insert
#define ER erase
#define CT count
#define EP empty
#define _for(i,a,b) for(int i = (a);i<(b);++i)
#define _rfor(i,a,b) for(int i = (a);i>(b);--i)
#define _sfor(p,st) for(auto &p:st)
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9+7;
const double eps = 1e-6;
const double pi = 3.141593;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
ll qpow(ll x, ll y) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans *= x; x *= x; }return ans; }
ll qpow(ll x, ll y, int MOD) { ll ans = 1; for (; y > 0; y >>= 1) { if (y & 1)ans = ans*x%MOD; x = x*x%MOD; }return ans; }
void exgcd(ll a,ll b,ll &x,ll &y){
    if(!b){x=1;y=0;return;}
    exgcd(b,a%b,x,y);
    ll X=x*x*x*x*x;
    x=y; y=X-a/b*y;
}
ll inv(ll x, int mod = MOD) { return qpow(x, mod - 2) % mod; }
ll m_m(ll a){ return (a%MOD+MOD)%MOD; }

int main() {
	//ofstream cout("E:\\acm dream\\out.txt",ios::out);
	FIO;
	int n;cin>>n;
    _for(i,-200,201){
        _for(j,-200,201){
            if(1ll*i*i*i*i*i-1ll*j*j*j*j*j==n){
                cout<<i<<' '<<j;
                return 0;
            }
        }
    }
	return 0;
}

Measured memory_bytes: 3612
#include<stdio.h>

int main()
{int a,b,c,d,e=0;
scanf ("%d%d%d%d",&a,&b,&c,&d);
if(a>=b)
{
e=(c*b)+((a-b)*d);
}
else
{
e=a*c;
}
printf("%d\n",e);

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int wrong[100005];
int accepted[100005];
int main()
{
	int N,M,correct=0,penalty=0;cin>>N>>M;
	for(int i=1;i<=M;i++)
	{
		int p;string s;cin>>p>>s;
		if(accepted[p]) continue;
		if(s=="AC")
		{
			accepted[p]++;
			correct++;
			penalty += wrong[p];
		}
		else if(s=="WA")
		{
			wrong[p]++;
		}
	}
	cout<<correct<<" "<<penalty<<"\n";
	return 0;
}

Measured memory_bytes: 1024
def get_neighbors(S, i):
    n = []
    if S[i]:
        if i >= W: #First row
            if S[i-W]:
                n += [i-W]
        if i < (H-1)*W:
            if S[i+W]:
                n += [i+W]
        if i % W > 0:
            if S[i-1]:
                n += [i-1]
        if i % W < W-1:
            if S[i+1]:
                n += [i+1]
    return n

import numpy as np
H, W = map(int, raw_input().split())
S = np.empty(H*W, bool)

for i in xrange(H):
    S[i*W:(i+1)*W] = map(lambda x: x==".", raw_input())
    
NR = sum(S) # Number of road cube
NE = [] # The neighbors
for i in xrange(H*W):
    NE += [get_neighbors(S, i)]

M = np.zeros([H*W, H*W], int)
# init
for i,n in enumerate(NE):
    for j in n:
        M[i,j] = 1
        
# find road
I = np.sum(M != 0)
Count = 2

while I < NR *NR:
    a = []
    for i,n in enumerate(NE):
        for j in n:
            a = np.logical_and(M[i] == 0, M[j] == Count-1)
            M[i][a] = Count
    I = np.sum(M != 0)
    Count += 1

np.fill_diagonal(M, 0)
print(M.max())

Measured memory_bytes: 17668
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    cout << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        cout << ", " << *it;
    }
    return cout << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    cout << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        cout << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint X; cin >> X;
    lint lo = 0, hi = X;
    while (hi - lo > 1) {
        lint mid = (lo + hi) / 2;
        if (mid * (mid + 1) / 2 < X) lo = mid;
        else hi = mid;
        // cout << lo << " " << hi << "\n";
    }
    cout << hi << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1, _2, _3, name, ...) name
#define _repi(i, a, b) for (int i = int(a), i##_hoge = int(b); i < i##_hoge; ++i)
#define _rep(i, n) _repi(i, 0, n)


#define overload4(_1, _2, _3, _4, name, ...) name
#define rep4(i, a, b, c) for (int i = int(a), i##_hogeb = int(b), i##_hogec = int(c); i < i##_hogeb; i += i##_hogec)
#define rep1(n) rep4(i, 0, n, 1)
#define rep2(i, n) rep4(i, 0, n, 1)
#define rep3(i, a, b) rep4(i, a, b, 1)
#define REP(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__)
#define rrep1(n) for (ll i = (n)-1; i >= 0; i--)
#define rrep2(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rrep3(i, a, b) for (ll i = (b)-1; i >= (a); i--)
#define rrep4(i, a, b, c) for (ll i = a + (b - a - 1) / c * c; i >= a; i -= c)
#define RREP(...) overload4(__VA_ARGS__, rrep4, rrep3, rrep2, rrep1)(__VA_ARGS__)
#define FOREACH(i, x) for (auto &i : x)
#define pb(x) push_back(x)
#define mp(x, y) make_pair(x, y)
#define print(x) cout << x << endl;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 9;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
template <class T> using vv = vector<vector<T>>;
using vint = vector<int>;
using vvint = vv<int>;
using vll = vector<ll>;
using vvll = vv<ll>;
using vbool = vector<bool>;
using vvbool = vv<bool>;
using vchar = vector<char>;
using vvchar = vv<char>;
// clang-format off
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;}
// clang-format on

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

int main() {
    int H, W;
    cin >> H >> W;

    vv<char> A(H + 2, vchar(W + 2, '#'));
    REP(i, 1, H + 1) REP(j, 1, W + 1) cin >> A[i][j];

    queue<pair<pii, int>> q;
    REP(i, 1, H + 1) REP(j, 1, W + 1) {
        if (A[i][j] == '#') q.push(mp(mp(i, j), 0));
    }

    int x, y, c;
    while (!q.empty()) {
        auto now = q.front();
        q.pop();
        y = now.first.first;
        x = now.first.second;
        c = now.second;
        REP(4) {
            if (A[y + dy[i]][x + dx[i]] == '.') {
                q.push(mp(mp(y + dy[i], x + dx[i]), c + 1));
                A[y + dy[i]][x + dx[i]] = '#';
            }
        }
    }
    print(c);
}

Measured memory_bytes: 13328
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long r = sc.nextLong(), d = sc.nextLong(), x = sc.nextLong();
        for(long i = 0; i < 10; i++) {
            x = r * x - d;
            System.out.println(x);
        }
    }
}


Measured memory_bytes: 23508
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
using namespace std;

int main(){
  	int n;
    cin >> n;
    int a[110];
    for(int i=0;i<n;i++)cin >> a[i];
    sort(a,a+n);
    cout<< a[n-1]-a[0] << endl;
}


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

const ll INF = ll(1e18)+1;

int main() {
  int n; ll k;
  cin >> n >> k;
  vector<ll> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(), a.end());

  //左を-∞　右を∞にする
  ll l = -INF, r = INF;
  
  //左右が重なったら探索終了
  while (l+1 < r) {
    //二部探索なので２で割る
    ll x = (l+r)/2;

    bool ok = [&]{
      ll tot = 0;

      rep(i,n) {
        if (a[i] < 0) {
          //負の時
          int l = -1, r = n;
          while (l+1<r) {
            int c = (l+r)/2;
            if (a[c]*a[i] < x) r = c; else l = c;
          }
          tot += n-r;
        } else {
          //正の時
          int l = -1, r = n;
          while (l+1<r) {
            int c = (l+r)/2;
            if (a[c]*a[i] < x) l = c; else r = c;
          }
          tot += r;
        }
        if (a[i]*a[i] < x) tot--;
      }
      tot /= 2;
      return tot < k;
    }();

    //範囲内であれば左(ans候補)範囲外であれば右(ans候補ではなく右側を更新する)
    if (ok) l = x; else r = x;
  }
  cout << l << endl;
  return 0;
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;

int main()
{
  int n,ans;
  ans=0;
  cin>>n;
  vector<int> v;
  v.push_back(n);
  for(int i=1;;i++)
  {
    if(n%2==0)
      n/=2;
    else
      n=n*3+1;
    v.push_back(n);
    for(int k=0;k<i;k++)
    {
      if(v.at(i)==v.at(k))
      {
        ans=i+1;
        break;
      }
    }
    if(ans!=0)
      break;
  }
  cout<<ans<<endl;
}

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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using P = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  ll a, v, b, w, t;
  cin >> a >> v >> b >> w >> t;
  dump(v, w);
  if (v <= w) {
    cout << "NO" << endl;
    return;
  }
  ll d = v - w;
  ll x = abs(a - b);
  dump(d*t, x);
  if (d * t < x) {
    cout << "NO" << endl;
    return;
  }
  dump(d, x);
  // if (x % d != 0) {
  //   cout << "NO" << endl;
  //   return;
  // }
  dump(x/d);
  if (x / d <= t) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}

Measured memory_bytes: 3616
#include<bits/stdc++.h>
using namespace std;
using lli = long long;
const int m = 26;
int d;
vector<int> c;
vector<int> last;
vector<vector<int>> s;
vector<int> t;

int main(void){
    cin >> d;
    c = vector<int>(m+1);
    last = vector<int>(m+1, 0);
    s = vector<vector<int>>(d+1, vector<int>(m+1));
    t = vector<int>(d+1);
    for(int i = 1; i <= m; i++){
        cin >> c[i];
    }
    for(int i = 1; i <= d; i++){
        for(int j = 1; j <= m; j++){
            cin >> s[i][j];
        }
    }
    for(int i = 1; i <= d; i++){
        cin >> t[i];
    }
    lli res = 0;
    for(int i = 1; i <= d; i++){
        res += s[i][t[i]];
        last[t[i]] = i;
        for(int j = 1; j <= m; j++){
            res -= c[j]*(i-last[j]);
        }
        cout << res << endl;
    }

    return 0;
}


Measured memory_bytes: 3644
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

const ITEM_MAX: usize = 401;
const INF: usize = 10_000_000;
use std::cmp::min;

fn main() {
    input! {
        n: usize,
        m: (usize, usize),
        items: [((usize, usize), usize); n],
    }

    let mut dp = vec![vec![vec![INF; ITEM_MAX]; ITEM_MAX]; n + 1];

    dp[0][0][0] = 0;

    for i in 0..n {
        for j in 0..ITEM_MAX {
            for k in 0..ITEM_MAX {
                if dp[i][j][k] == INF {
                    continue;
                }
                // 加えない場合
                // なにも変わらないので、次の値と比較して小さい方で更新
                dp[i + 1][j][k] = min(dp[i + 1][j][k], dp[i][j][k]);

                // 加える場合
                let ((a, b), c) = items[i];
                let next_a = j + a;
                let next_b = k + b;
                // 他のパターンですでに更新されている場合もありうるので、今の値にCを足したものと、次のテーブルの対象の値とを比較して小さい方で更新
                dp[i + 1][next_a][next_b] = min(dp[i + 1][next_a][next_b], dp[i][j][k] + c);
            }
        }
    }

    let mut min_c = None;

    // 一番小さいCの合計を探す
    for j in 1..ITEM_MAX {
        for k in 1..ITEM_MAX {
            // 比率が同じ場合のみ
            // a:b = Ma:Mb => a*Mn == b*Ma
            let c = dp[n][j][k];
            if j * m.1 == k * m.0  && c != INF {
                min_c = min_c.map(|x| min(x, c)).or(Some(c));
            }
        }
    }
    match min_c {
        Some(x) => println!("{:?}", x),
        _ => println!("-1"),
    }
}

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

#define _ ios::sync_with_stdio(0);
#define __ cin.tie(0);
#define ___ cout.tie(0);
#define endl "\n";
#define fr first
#define se second

using namespace std;

int main() { _ __ ___

	int n;
	cin >> n;
int a[n+1];
for(int i=1; i<=n; i++) cin>>a[i];
int ans = 0;
for(int i=1; i<=n; i++) {
	if(a[a[i]] == i) ans++;
}
cout << ans/2 << endl;
	return 0;
}

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

int main()
{
    int N,b,sum;
    vector<int> B;
    cin>>N;
    
    for(int i=0;i<N-1;i++){
        cin>>b;
        B.push_back(b);
    }
    
    sum=B[0];
    
    for(int i=0;i<N-1;i++){
        sum+=min(B[i],B[i+1]);
    }
    sum+=B[N-2];
    
    cout<<sum;
    
    return 0;
}



Measured memory_bytes: 256
x1, y1, x2, y2 = STDIN.read.split(' ').map(&:to_i)

dx = (x2 - x1).abs
dy = (y2 - y1).abs

if x1 == x2 && y1 < y2
  # 右下、右上パターン
  x3 = x2 - (y2 - y1).abs
  y3 = y2
  x4 = x3
  y4 = y1
elsif x1 > x2 && y1 == y2
  # 右上、左上パターン
  x3 = x2
  y3 = y2 - (x1 - x2).abs
  x4 = x1
  y4 = y3
elsif x1 == x2 && y1 > y2
  # 左上、左下パターン
  x3 = x2 + (y1 - y2).abs
  y3 = y2
  x4 = x3
  y4 = y1
elsif x1 < x2 && y1 == y2
  # 左下、右下パターン
  x3 = x2
  y3 = y2 + (x2 - x1).abs
  x4 = x1
  y4 = y3
elsif x1 < x2 && y1 < y2
  x3 = x2 - dy
  y3 = y2 + dx
  x4 = x3 - dx
  y4 = y3 - dy
elsif x1 > x2 && y1 < y2
  x3 = x2 - dy
  y3 = y2 - dx
  x4 = x3 + dx
  y4 = y3 - dy
elsif x1 > x2 && y1 > y2
  x3 = x2 + dy
  y3 = y2 - dx
  x4 = x3 + dx
  y4 = y3 + dy
else
  x3 = x2 + dy
  y3 = y2 + dx
  x4 = x3 - dx
  y4 = y3 + dy
end

puts "#{x3} #{y3} #{x4} #{y4}"

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define SORT(a) sort(a.begin(),a.end())
 
int main() {
	
	//string ans="";
	//vector<int> c(30,0);
	int n;
	
	cin >> n;
	
	
	
	if(n>=2000){
		cout << 1 << endl;
		return 0;
	}
	int c=n/100;
	
	if(n-c*100<=c*5){
		cout << 1 << endl;
		return 0;
	}
	
    cout << 0 << endl;
    
    return 0;

}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Scanner;

class Main {
    static final int MOD = 1000000007;
    static final int INF = 1 << 30;
    static final int ALF = 26;

    Main() {
        Scanner sc = new Scanner(System.in);
        long ans = 0;
        int N = sc.nextInt();
        int[] A = new int[N];
        for(int i=0;i<N;i++){
            A[i]=sc.nextInt();
            if(i%2==0&&A[i]%2==1)ans++;
        }
        System.out.println(ans);
    }

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


Measured memory_bytes: 35784