akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int count = 0;

            while(n-->0)
            {
                int tmp = int.Parse(Console.ReadLine());
                if (isPrime(tmp)) count++;
            }

            Console.WriteLine(count);
        }
        
       static bool isPrime(int tmp)
       {
          int i = 2;
        
          for (; i*i<=tmp;i++)
          {
                if (tmp % i == 0) return false;
          }

          return true;
       } 
    }
}

Measured memory_bytes: 9152
#include <bits/stdc++.h>
#define ll long long
#define endl '\n'
#define modn 1000000007

#define SZ 10005
using namespace std;


int main()
{
    ll a,b;
    cin>>a>>b;
    ll n = b - a - 1;
    cout<<(n*(n+1))/2 - a<<endl;
    return 0;
}

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

int main(){
    int H, W;
    
    while(1){
        cin >> H >> W;
        if(H == 0 && W == 0) break;
        
        for(int i = 0; i < H; i++){
            for(int j = 0; j < W; j++){
                if((i+j) % 2 == 0){
                    cout << "#";
                }else{
                    cout << ".";
                }
            }
            cout << "\n";
        }
        cout << endl;
    }
    return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1e9+7;
const ll inf=1e17;
const int INF=1e9;
const double PI=acos(-1);
const double EPS=1e-10;

int main(){
	cin.tie(0);ios::sync_with_stdio(false);
	int k;
	cin>>k;
	ll ans=0;
	FOR(i,1,k+1)FOR(j,1,k+1)FOR(l,1,k+1){
		ans+=gcd(i,gcd(j,l));
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(), x.end()

const int mod = 1000000007;
int binpow(int a, int b, int mod)
{
    int ans = 1;
    a = a % mod;
    b = b % mod;
    if (b == 0)
        return 1;
    while (b)
    {
        if (b & 1)
            ans = ((ans % mod) * (a % mod)) % mod;
        a = ((a % mod) * (a % mod)) % mod;
        b >>= 1;
    }
    return ans % mod;
}

//read question carefully!

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t = 1;
    // cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        int ma = 0, ct = 0;
        for (int i = 0; i < n; ++i)
        {
            int u, v;
            cin >> u >> v;
            if (u == v)
            {
                ct++;
                ma = max(ct, ma);
            }
            else
            {
                ct = 0;
            }
        }
        if (ma < 3)
        {
            cout << "No"
                 << "\n";
        }
        else
        {
            cout << "Yes"
                 << "\n";
        }
    }
}


Measured memory_bytes: 3640
s = input()
total = 0
count_s = 0
for i in range(len(s)):
  if s[i] == 'S':
    count_s += 1
  if count_s > 0 and s[i] == 'T':
    count_s -= 1
    total -= 2
  total += 1
print(total)


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

int main() {
	ll a,b,ans;
	cin >> a >> b;
	if(a>=10 || b>=10) ans=-1;
	else ans=a*b;
	cout << ans << endl;	
}


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

bool is_prime(int n)
{
  for (int i = 2; i*i<=n; i++) {
    if (n%i == 0) {
      return false;
    }
  }
  return n != 1;
}

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

  vector<int> a(100050, 0);
  for (int i=3; i<100010; i+=2) {
    if (is_prime(i) && is_prime((i+1)/2)) a[i] = 1;
  }
  for (int i=1; i<100010; i++) a[i] += a[i-1];

  vector<int> ans;
  rep(i, q) {
    int l, r; cin >> l >> r;
    ans.push_back(a[r] - a[l-1]);
  }

  rep(i, q) cout << ans[i] << endl;

  return 0;
}


Measured memory_bytes: 1528
#include<bits/stdc++.h>
using namespace std;
void fast(){
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
}

class data{
	public:
	long long x , h;
};

long long bs(long long &start_index  , long long target , vector<data> & a){
	
	long long l = start_index  , r = a.size() - 1;
	long long answer = -1;
	while(l <= r){
		long long mid = (l + (r - l)/2);
		if(a[mid].x <= target){
			answer = mid;
			l = mid + 1;
		}
		else{
			r = mid - 1;
		}
	}
	return answer;
}

class segmentTree{
	vector<long long>tree;
	
	public:
	segmentTree(long long n){
		tree = vector<long long>(4 * n , 0);
	}
	void update(long long &req_index , long long cur ,  long long leftmost , long long rightmost , long long value){
		if(leftmost == rightmost){
			tree[cur] += value;
			return;
		}
		
		long long mid = (leftmost + (rightmost - leftmost)/2);
		if(req_index > mid){
			update(req_index , cur*2 + 2 , mid + 1 , rightmost , value);
		}
		else{
			update(req_index , cur*2 + 1 , leftmost , mid , value);
		}
		tree[cur] = tree[cur*2 + 1] + tree[cur*2 + 2];
	}
	
	int query(long long cur , long long leftmost , long long rightmost , long long l , long long r){
		if(l > rightmost || r < leftmost){
			return 0;
		}
		if(l <= leftmost && r >= rightmost){
			return tree[cur];
		}
		long long mid = (leftmost + (rightmost - leftmost)/2);
		return query(cur * 2 + 1 , leftmost , mid , l , r) + query(cur * 2 + 2 , mid + 1 , rightmost , l , r);
	}
};
int main(){
	fast();	
	long long n , d , a;
	cin >> n >> d >> a;
	vector<data> all(n);
	for(long long i = 0; i < n; ++i){
		cin >> all[i].x >> all[i].h;
	}
	auto thisway = [&](data a , data b){
		return (a.x < b.x);
	};
	sort(all.begin() , all.end() , thisway);
	long long cnt = 0;
	segmentTree obj(n);
	for(long long i = 0; i < n; ++i){
		long long decrease = obj.query(0 , 0 , n - 1 , i , n - 1);
		all[i].h -= decrease;
		if(all[i].h > 0){
			long long farthest_index = bs(i , all[i].x + 2 * d , all);
			long long req = ceil(((double)all[i].h)/a);
			all[i].h -= (a * req);
			obj.update(farthest_index , 0 ,  0 ,  n - 1 , (a * req));
			cnt += req;
		}
	}
	cout << cnt <<  "\n";
}


Measured memory_bytes: 9600
// #pragma GCC optimize("O3")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vll = vector<ll>;
using vii = vector<int>;
using pii = pair<int, int>;
template <typename T = vii>
using vec = vector<T>;

const ll INF = 1e18, A = 1e9 + 7, B = 1e9 + 9;

const int MAX = 1e6;

struct S {
    static const ll PA = 31, PIA = 129032259;
    static const ll PB = 37, PIB = 297297300;
    int n;
    string s;
    vll hA;
    vll ppA, piA;
    vll hB;
    vll ppB, piB;
    S(string const& s) : n(s.size()), s(s), hA(n + 1), ppA(n + 1), piA(n + 1), hB(n + 1), ppB(n + 1), piB(n + 1) {
        ppA[0] = piA[0] = 1;
        ppB[0] = piB[0] = 1;
        for (int i = 0; i < n; i++) {
            ppA[i + 1] = (ppA[i] * PA) % A;
            piA[i + 1] = (piA[i] * PIA) % A;
            hA[i + 1] = (hA[i] + (s[i] - 'a' + 1) * ppA[i]) % A;
            
            ppB[i + 1] = (ppB[i] * PB) % B;
            piB[i + 1] = (piB[i] * PIB) % B;
            hB[i + 1] = (hB[i] + (s[i] - 'a' + 1) * ppB[i]) % B;
        }
    }

    pair<ll, ll> get_hash(const int i, const int len) {
        const ll resa = (hA[i + len - 1] + A - hA[i - 1]) % A;
        const ll resb = (hB[i + len - 1] + B - hB[i - 1]) % B;
        return {(resa * piA[i - 1]) % A, (resb * piB[i - 1]) % B};
    }
};

int main() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
    // freopen("in.in", "r", stdin);
    
    int n;
    cin >> n;
    string tmp;
    cin >> tmp;
    S s(tmp);
    auto check = [&] (const int len) {
        map<pair<ll, ll>, int> m;
        for (int i = 1; i + len - 1 <= n; i++) {
            const auto h = s.get_hash(i, len);
            if (m[h] == 0) m[h] = i;
            else if (m[h] + len <= i) {
                return true;
            }
        }
        return false;
    };
    int lo = 0, hi = n / 2 + 1;
    while (lo + 1 < hi) {
        const int mid = (lo + hi) / 2;
        if (check(mid)) lo = mid;
        else hi = mid;
    }
    cout << lo << '\n';
}

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

#define ll long long
#define fast_io ios::sync_with_stdio(0); cin.tie(0)
#define infl 1e18+9
#define inf 1e9+9
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()

const int mod=1e9+7; 

ll dp[20][20]; 
ll cnt[20][20]; 
void solve(){
  vector<int> d; 
  string s; cin>>s; 
  int n=sz(s); 
  for(int i=0;i<n;i++){
    d.push_back(s[i]-'0'); 
    dp[i][i]=d.back(); 
    cnt[i][i]=1;
  }
  for(int l=2;l<=n;l++){
    for(int i=0;i+l-1<n;i++){
      int j=i+l-1; 
      ll num=d[i]; 
      for(int k=i+1;k<=j;k++){
        dp[i][j]+=dp[k][j]+num*cnt[k][j]; 
        cnt[i][j]+=cnt[k][j]; 
        num=num*10+d[k]; 
      }
      cnt[i][j]+=1; 
      dp[i][j]+=num; 
    }
  }
  cout<<dp[0][n-1]<<endl; 
}

int main()
{
	fast_io;
	clock_t beg=clock(); 
	solve(); 
	clock_t end=clock(); 
	fprintf(stderr,"%.2lf sec\n",(double)(end-beg)/CLOCKS_PER_SEC); 
	return 0;
}

Measured memory_bytes: 256
parseline(str=readline()) = parse.(Int, split(str))
function MazeMaster()
    direction = [[-1, 0], [1, 0], [0, 1], [0, -1]]
    H, W = parseline()
    S = readlines() #Array{String, 1}
    ans = -1
    for h in 1:H
        length(S[h])==0 && continue
        for w in 1:W 
            score = fill(-1, H, W)
            S[h][w]=='#' && continue
            que = [[h, w]]
            score[h, w] = 0
            while !isempty(que)
                now = popfirst!(que)
                for d in direction
                    x, y = now + d
                    (!(1≤x≤H)||!(1≤y≤W)||(S[x][y]=='#')) && continue
                    score[x, y] < 0 && (push!(que, [x, y]); 
                        score[x, y] = score[now[1], now[2]] + 1)
                end
            end
            ans = max(ans, maximum(score))
        end
    end
    println(ans)
end
MazeMaster()

Measured memory_bytes: 247972
#include<stdio.h>

int min(int a, int b){return a < b ? a : b;}
int max(int a, int b){return a > b ? a : b;}

int main(void){
    int a, b, c, x, y;
    
    scanf("%d%d%d%d%d", &a, &b, &c, &x, &y);
    
    //ABピザを使わない場合
    int notAB_price = a * x + b * y;
 
    int all_AB = c * max(x, y) * 2;

    int withAB_price;

    withAB_price = c * min(x, y) * 2;//ABピザの値段
    if(x < y){                  
        withAB_price += (y - x) * b;//Bピザの必要枚数が多い場合は買い足す
    }else if(y < x){
        withAB_price += (x - y) * a;
    }
    int ans = min(withAB_price, min(notAB_price, all_AB));
    printf("%d", ans);

    return 0;
}
//この問題のポイント：long intを使う，
//long int を使う場合は，printf で %ldを使う
//max（） 関数を定義する



Measured memory_bytes: 1712
s = input()

l = int(s[0:2])
r = int(s[2:4])

if (l > 0 and l < 13) and (r > 0 and r < 13):
    ret = 'AMBIGUOUS'
elif (l > 0 and l < 13) and (r == 0 or r >= 13):
    ret = 'MMYY'
elif (l == 0 or l >= 13) and (r > 0 and r < 13):
    ret = 'YYMM'
else:
    ret = 'NA'

print(ret)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int d[10005];
int f()
{
    for(int i=1;i<10005;i++){
        if(d[i]==0)return i;
    }
}
int main()
{
    int n;
    cin >>n;
    int a[n];
    for(int i=0;i<n;i++)cin >>a[i],d[a[i]]++;

    int c=0;
    for(int i=0;i<n-1;i++){
        if(a[i]==a[i+1]){
             int x=f();
            a[i+1]=x;
            c++;
        }
    }
    cout <<c<<endl;
    return 0;
}


Measured memory_bytes: 256
import math

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

def isPossible(X):
    global N, K, A

    cuts = 0
    for i in range(N):
        cuts += math.ceil(A[i]/X) - 1
    
    return cuts <= K

minVal = 0
maxVal = max(A)

while math.ceil(minVal) != math.ceil(maxVal):
    if isPossible((maxVal + minVal) / 2):
        maxVal = (maxVal + minVal) / 2
    else:
        minVal = (maxVal + minVal) / 2

print(math.ceil(maxVal))


Measured memory_bytes: 31060
#include<stdio.h>
void selectionSort(int[],int);

int main(){
  int A[100],n,i;

  scanf("%d",&n);

  for(i = 0 ; i < n ; i++){
    scanf("%d",&A[i]);
  }
  selectionSort(A,n);

  return 0;
}

void selectionSort(int a[], int n){
  int count=0,i,j,minj,temp;

  for(i = 0 ; i < n - 1 ; i++){
    minj = i;
    for(j = i ; j < n ; j++){
      if(a[j] < a[minj]){
	minj = j;
      }
    }
      temp = a[i];
      a[i] = a[minj];
      a[minj] = temp;
      if(i != minj) count++;
  }
  
  for(i = 0 ; i < n ; i++){
    if(i > 0) printf(" ");
    printf("%d",a[i]);
  }
  printf("\n%d\n",count);
}




Measured memory_bytes: 2084
#include<bits/stdc++.h>
#define MAX 200005
#define INF 1000000000000007
using namespace std;
typedef long long ll;
 
ll a[MAX];
ll jun(int l, int r){
  if(r - l == 1) return 0;
  int mid = (l+r)/2;
  ll ans = 0;
  ans += jun(l, mid) + jun(mid, r);
  ll s[MAX], t[MAX];
  for(int i = l; i < mid; i++) s[i-l] = a[i];
  for(int i = mid; i < r; i++) t[i-mid] = a[i];
  s[mid-l] = INF;
  t[r-mid] = INF;
  int i = 0, j = 0;
  while(i < mid-l || j < r-mid){
    if(s[i] <= t[j]){
      a[l+i+j] = s[i];
      i++;
    }else {
      a[l+i+j] = t[j];
      ans += i;
      j++;
    }
  }
  return ans;
}

int main(){
  int n, k;
  ll s, ans;
  a[0] = 0;
  scanf("%d%d", &n, &k);
  for(int i = 0; i < n; i++){
    scanf("%lld", &s);
    a[i+1] = a[i] + s - k;
  }
  ans = jun(0, n+1);
  printf("%lld", ans);
}

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

main()
{

  int a, b, c;
  int x;
  int ans = 0;
  
  cin >> a >> b >> c >> x;

  int temp = 0;

  for ( int i = 0; i <= a ; i++) {
    for ( int j = 0; j <= b ; j++) {
      for ( int k = 0; k <= c ; k++) {
        temp = ( 500 * i ) + ( 100 * j ) + ( 50 * k );
        if ( x == temp ) {
          ans++;
        }
      }
    }
  }

  cout << ans << endl;

  return (0);
}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cstring>
#include <iostream>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define TRACE(x) cout << #x << " = " << x << endl
#define _ << " _ " <<

typedef long long llint;

int main(void) {
  int N;
  scanf("%d", &N);
  char buff[111];
  scanf("%s", buff);
  string a = buff;
  scanf("%s", buff);
  string b = buff;
   
  for (int l = N; l <= 2*N; ++l) {
    string s = a + b.substr(2*N - l);
    if (s.substr(0, N) == a && s.substr(l-N, N) == b) {
      printf("%d\n", l);
      return 0;
    }
  }
  assert(false);
  return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

vector <int> vec[26];

int main(){
    ios_base::sync_with_stdio(false);
	cout.precision(10);
	cout << fixed;

    string s, t;
    cin >> s >> t;
    int n = s.size();
    for(int i=0; i<n; i++){
        vec[s[i]-'a'].push_back(i+1);
    }
    int tren = 0;
    ll sum = 0;
    int m = t.size();
    for(int i=0; i<m; i++){
        int x = t[i]-'a';
        int l = 0, r = vec[x].size()-1, res = vec[x].size();
        while(l <= r){
            int mid = (l+r)/2;
            if(vec[x][mid] > tren){
                res = mid;
                r = mid-1;
            }
            else l = mid+1;
        }
        //cout << i << endl;
        if(res == vec[x].size()){
            if(tren == 0){
                cout << -1;
                return 0;
            }
            else{
                sum += n;
                tren = 0;
                i--;
            }
        }
        else{
            tren = vec[x][res];
        }
    }
    cout << sum+tren;
    return 0;
}


Measured memory_bytes: 1228
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using tii = tuple<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define INF 1E9
#define LINF 1E18*5
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template<class S, class T>ostream& operator<<(ostream&os, pair<S, T>p) { os << "[" << p.first << ", " << p.second << "]"; return os; };
template<class S>auto&operator<<(ostream&os, vector<S>t) { bool a = 1; for (auto s : t) { os << (a ? "" : " ") << s; a = 0; } return os; }

//int dx[]={1,1,1,0,-1,-1,-1,0},dy[8]={1,0,-1,-1,-1,0,1,1,1};
//
constexpr ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

class compare {
public:
	bool operator()(tuple<int, int> a, tuple<int, int> b) {
		return (get<1>(a) < get<1>(b));
	}
};

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	ll ans = 0;
	cin >> n;
	multiset<ll> s;
	vl v(n), pw;
	rep(i, n) {
		cin >> v[i];
		s.insert(v[i]);
	}
	ll tmp = 1;
	rep(i, 31) {
		tmp *= 2;
		pw.push_back(tmp);
	}
	while (!s.empty()) {
		auto ritr = s.rbegin();
		ll tmp = *ritr;
		s.erase(s.find(tmp));
		ll rtmp = *upper_bound(all(pw), tmp) - tmp;
		//cout << tmp << " " << rtmp << endl;
		auto itr = s.find(rtmp);
		if (itr != s.end()) {
			s.erase(itr);
			ans++;
		}
	}
	cout << ans << endl;
}



Measured memory_bytes: 11264
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
typedef vector<int> vec;
typedef vector<ll> lvec;
typedef vector<char> cvec;
typedef vector<double> dvec;
typedef pair<ll, ll> LP;
typedef tuple<ll, ll, ll> LT;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
#define fs first
#define sc second
const int mx=100001;
int main()	{
  int n;
  ll sum=0;
  cin>>n;
  vector<ll>d(mx);
  rep(i,n){
    int a;
    cin>>a;
    d[a]++;
  }
  rep(i,mx) sum+=i*d[i];
  int q;
  cin>>q;
  rep(i,q){
    int b,c;
    cin>>b>>c;
    sum+=(c-b)*d[b];
    d[c]+=d[b];
    d[b]=0;
    cout<<sum<<endl;
  }
}

Measured memory_bytes: 4056
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <list>
#include <string>
#include <map>
#include <vector>
#include <stack>
#include <queue>
#include <iomanip> // setprecisionを使用するのに必要 cout << fixed << setprecision(15) << p でpを小数点以下15桁表示
using namespace std;
#define REPD(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) REPD(i, 0, n)
#define DIV0 1000000007
typedef long long ll;
#define fin(ans) cout << (ans) << '\n'
/*

*/
int main()
{
    int N,K;
    cin >> N >> K;
    ll A[N];
    REP(i,N) cin >> A[i];
    for(int i = K; i < N; i++){
        //i番目とi-K番目を比べて、i番目の方が大きければ大きい。
        if(A[i] > A[i-K]){
            fin("Yes");
        }else fin("No");
    }
    return 0;
}

Measured memory_bytes: 4532
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,n) for (int64_t i=0; i<(n); ++i)
#define P pair<int,int>
using ll=int64_t;
using namespace std;
#define ketasuu(n) fixed<<setprecision(n)
#define btoe(p) p.begin(),p.end()
#define etob(p) p.rbegin(),p.rend()




int main(){
    ll n,k; cin>>n>>k;
    if(k==0){
        cout<<n*n<<endl;
        return 0;
    }
    ll ans=0;
    for(ll i=k+1; i<=n; ++i){
        ans+=(i-k)*(n/i);
        ans+=max((ll) 0, (n%i)-k+1);
    }
    cout<<ans<<endl;
    return 0;
}

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

typedef long long int ll;
typedef unsigned long long int ull;
#define rep(i,n) for(auto i=0;i<(n);i++)
#define rep1(i,n) for(auto i=1;i<=(n);i++)
#define all(x) (x).begin(),(x).end()

using namespace std;


struct init{ init(){ cin.tie(0); ios::sync_with_stdio(0); cout<<fixed<<setprecision(20); }; }aaaaaaa;



struct Node{
  ll pos;
  ll cost;
  bool operator< (const Node &r) const{
    return cost > r.cost;
  }
};


int main(){
  ll n, m;
  cin >> n >> m;
  vector<ll> u(m);
  vector<ll> v(m);
  rep(i, m) cin >> u[i] >> v[i];
  ll s, t;
  cin >> s >> t;

  rep(i, m) u[i]--, v[i]--;
  s--, t--;


  vector<set<ll>> g(n, set<ll>());

  rep(i, m) g[u[i]].insert(v[i]);

  priority_queue<Node> que;
  que.push({s, 0});

  vector<vector<bool>> visited(n, vector<bool>(3, false));
  while(!que.empty()){
    Node node = que.top(); que.pop();

    if(node.cost%3 == 0 && node.pos == t){
      cout << node.cost/3 << endl;
      return 0;
    }

    if(visited[node.pos][node.cost%3]) continue;
    visited[node.pos][node.cost%3] = true;

    for(auto to : g[node.pos]) que.push({to, node.cost+1});
  }

  cout << -1 << endl;


  return 0;
}


Measured memory_bytes: 18304
import math

def solution(count,nums,g,oppai):
    for i in range(g,count):
        objNum = nums[i]
        j = i - g
        while j >= 0 and nums[j] > objNum:
            nums[j+g] = nums[j]
            j -= g
            oppai.append(1)
        nums[j+g] = objNum

def shellSort(nums,count):
    oppai = []
    b = 701
    G = [x for x in [1,4,10,23,57,132,301,701] if x <= count]
    while True:
        b = math.floor(2.25*b)
        if b > n:
            break
        G.append(b)
    G = G[::-1]
    print(len(G))
    print(' '.join(map(str,G)))
    for i in range(len(G)):
        solution(count,nums,G[i],oppai)
    print(len(oppai))
    for ele in nums:
        print(ele)

n = int(input())
nums = []


for _ in range(n):
    nums.append(int(input()))
shellSort(nums,n)



Measured memory_bytes: 180932
def piyo():
    n = list(input())
    s = len(n)
    fuga = []
    for i in range(s-2):
        hoge = int(n[i] + n[i+1] + n[i+2])
        hoge = abs(hoge-753)
        fuga.append(hoge)
    print(min(fuga))

if __name__ == '__main__':
    piyo()

Measured memory_bytes: 3060
//#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <numeric>
#include <iomanip>  //setprecision(桁)
using namespace std;
#define pb push_back
#define ll long long int
#define rep(i,n) for(int i = 0;i < n;i++)
#define INF 1e+9
const ll MOD = 1000000007;

struct edge {
    int to;
    double cost;
};

// <最短距離, 頂点の番号>
using P = pair<double, int>;

int V;
const int ci = 2e5+ 5;
vector<edge> G[ci];
double d[ci];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) { //cout << "On" << endl;
        P p = que.top();
        que.pop();
        int v = p.second; //cout << "v=" << v << endl;
        if (d[v] < p.first) continue;
        for (int i=0; i<G[v].size(); i++) {
            edge e = G[v][i]; //cout << "koo" << endl;
            if (d[e.to] > d[v] + e.cost) { //cout << e.cost << endl;
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}
ll modPow(ll a, ll n, ll p) {
    if (n == 0) return 1; // 0乗にも対応する場合
    if (n == 1) return a % p;
    if (n % 2 == 1) return (a * modPow(a, n - 1, p)) % p;
    long long t = modPow(a, n / 2, p);
    return (t * t) % p;
}
vector<int> par;
vector<int> RANK;
void init(int n){
    for(int i = 0; i < n; i++){
        par.pb(i);
        RANK.pb(0);
    }return;
}

int FindRoot(int x){
    if(par[x] == x) return x;
    par[x] = FindRoot(par[x]);
    return par[x];
}

bool isSame(int x, int y){
    return FindRoot(x) == FindRoot(y);
}

void Union(int x, int y){
    x = FindRoot(x);
    y = FindRoot(y);
    if(x == y) return;
    if(RANK[x] > RANK[y]) par[y] = x;
    else {
        par[x] = y;
        if(RANK[x] == RANK[y]){
            RANK[y]++;
        }
    }return;
}


int main() {
    int n, m; cin >> n >> m;
    init(n);
    for(int i  = 0; i < m; i++){
        int x, y, z; cin >> x >> y >> z;
        x--; y--;
        Union(x,y);
    }
 	
  	int ans = 0;
  	rep(i,n) if(par[i] == i) ans++;
  	
  	cout << ans << endl;
}


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


int main(){
    double r, area, circumference;
    cin >> r;

    area=3.141592653589*r*r;
    circumference=2*3.141592653589*r;

    cout << fixed << setprecision(6) << area << " ";
    cout << fixed << setprecision(6) << circumference << endl;
    return 0;
}


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

LL A, B, C, D;
map<LL, LL> memo;
LL solve(LL N) {
    if (N == 0) return 0;
    if (N == 1) return D;
    if (memo.count(N)) return memo[N];
    LL l2 = (N/2)*2;
    LL r2 = ((N+1)/2)*2;
    LL l3 = (N/3)*3;
    LL r3 = ((N+2)/3)*3;
    LL l5 = (N/5)*5;
    LL r5 = ((N+4)/5)*5;

    LL res = 1e18;
    if (N < res/D) res = N*D;
    res = min(res, llabs(l2-N)*D + A + solve(l2/2));
    res = min(res, llabs(r2-N)*D + A + solve(r2/2));

    res = min(res, llabs(l3-N)*D + B + solve(l3/3));
    res = min(res, llabs(r3-N)*D + B + solve(r3/3));

    res = min(res, llabs(l5-N)*D + C + solve(l5/5));
    res = min(res, llabs(r5-N)*D + C + solve(r5/5));

    memo[N] = res;

    return res;
}

int main() {
    int T;
    cin >> T;
    for (int t = 0; t < T; t++) {
        memo.clear();
        LL N;
        cin >> N;
        cin >> A >> B >> C >> D;
        cout << solve(N) << "\n";
    }
}


Measured memory_bytes: 4464
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

namespace AtCoder {
    class Program {
        static void Main(string[] args) {

            var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            Console.WriteLine(input[1] % input[0] == 0 ? input[0] + input[1] : input[1] - input[0]);
        }
    }
}

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

int main() {
  int N;
  vector<int>a(109);
  cin >> N;
  for(int i=0; i<N; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  int x, y;
  x=0;
  y=0;
  for(int i=0; i<N; i++) {
    if(i%2 == 0){
      x += a.at(i);
    }else {
      y += a.at(i);
    }
  }
  int result;
  result = x-y;
  cout << result << endl;
}


Measured memory_bytes: 256
n,m,c = map(int,input().split())
b = list(map(int,input().split()))

ans = 0
for i in range(n):
    a = list(map(int,input().split()))
    t = c
    for j in range(m):
        t += a[j]*b[j]
    if t > 0:
        ans += 1
print(ans)


Measured memory_bytes: 3060
def timdiff(dif):
    l=[]
    for i in range(24):
        if dif[i]==1:
            l+=[i]
        if dif[i]>=2:
            return 0
    m=24
    for i in range(len(l)):
        if i < len(l)-1:
            m=min(m,l[i+1]-l[i])
    if len(l)>=2:
        m=min(m,24-l[len(l)-1])
    return m

n=int(input())
d=list(map(int,input().split(' ')))
diff=[0]*24
if n>=24:
    print(0)
elif n<12: #global search
    m=0
    for i in range(2**n):
        for j in range(1,24):
            diff[j]=0
        diff[0]=1
        for j in range(n):
            if (i >> j)%2==1:
                diff[d[j]]+=1
            elif d[j]==0:
                diff[0]+=1
            else:
                diff[24-d[j]]+=1
        m=max(m,timdiff(diff))
    print(m)
else: #judge 0 or 1
    bl=False
    for i in range(13):
        if bl:
            break
        m=0
        for j in range(n):
            if d[j] == i:
                m+=1
            if m>2 or (i==0 and d[j]==0) or (i==12 and m>=2):
                bl=True
                break
        
    if bl:
        print(0)
    else:
        print(1)


Measured memory_bytes: 3064
#include <stdio.h>

int prime(int n){
  int p = 2;
  while(p*p<=n){
    if(n%p==0){
      return 0;
    }
    p++;
  }
  return 1;
}

int main(){
  int N,i;
  int cnt = 0;
  scanf("%d",&N);
  for(i=0;i<N;i++) {
    int n;
    scanf("%d",&n);
    if(prime(n)) {
      cnt++;
    }
  }
printf("%d\n",cnt);
 return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <stdlib.h>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <queue>
#include<unordered_map>
#define mod 1000000007
typedef unsigned long long int ll;
using namespace std;
 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++)
    cin>>a[i];
    int b[n-1];
    for(int i=0;i<n-1;i++)
    b[i]=a[i+1]-a[i];
    int ct=0;int max=0;
    for(int i=0;i<n-1;i++)
    {
        if(b[i]<=0)
        ct++;
        else
        {
            if(ct>max)
            max=ct;
            ct=0;
        }
        
    }
    if(ct>max)
    max=ct;
    cout<<max<<"\n";
    return 0;
}
 

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define ii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define INF 100000000000000000
#define modulo 1000000007
#define mod 998244353
#define int long long int
using namespace std;

int32_t main(){
      ios_base::sync_with_stdio(false);
      cin.tie(NULL);
   //   freopen("q.gir","r",stdin);
   //   freopen("q.cik","w",stdout);
      int n,k;
      cin>>n>>k;
      vector<int> arr(n+1);
      for(int i=1;i<=n;i++)cin>>arr[i];
      vector<vector<int>> dp(n+1,vector<int>(k+1,0));
      dp[0]=vector<int>(k+1,1);
      for(int i=1;i<=n;i++){
            for(int j=0;j<=k;j++){
                  int dec=0;
                  if(j-arr[i]-1>=0)dec=dp[i-1][j-arr[i]-1];
                  dp[i][j]=(dp[i][j]+dp[i-1][j]-dec+modulo)%modulo;
            }
            for(int j=1;j<=k;j++){
                  dp[i][j]+=dp[i][j-1];
                  dp[i][j]%=modulo;
            }
      }
      int dec=0;
      if(k-1>=0)dec=dp[n][k-1];
      cout<<(dp[n][k]-dec+modulo)%modulo;
}


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

vector<int> forintinput(int n) {
	vector<int> x;
	for(int i = 0;i < n;i++){
		int ia;
		cin >> ia;
		x.push_back(ia);
	}
	return x;
}
int main(){
	int r;
	cin >> r;
	cout << 3*r*r << endl;
}

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

int x[50][50], cx, cy, cz, sum, sum2, chain, h, w, gx, gy, pass, line; char a; string S, T; bool y;

void WHILE();
void PASS();
void ugoku(char W);
void IF();
bool hantei();

void ugoku(char W) {
	if (W == '^') {
		if (cz == 0 && x[cy - 1][cx] == 0) { cy--; }
		if (cz == 1 && x[cy][cx + 1] == 0) { cx++; }
		if (cz == 2 && x[cy + 1][cx] == 0) { cy++; }
		if (cz == 3 && x[cy][cx - 1] == 0) { cx--; }
		sum++;
	}
	if (W == 'v') {
		if (cz == 2 && x[cy - 1][cx] == 0) { cy--; }
		if (cz == 3 && x[cy][cx + 1] == 0) { cx++; }
		if (cz == 0 && x[cy + 1][cx] == 0) { cy++; }
		if (cz == 1 && x[cy][cx - 1] == 0) { cx--; }
		sum++;
	}
	if (W == '>') {
		cz += 1; cz %= 4; sum++;
	}
	if (W == '<') {
		cz += 3; cz %= 4; sum++;
	}
	if (W == '[') {
		IF();
	}
	if (W == '}') {
		PASS();
	}
	if (W == '{') {
		WHILE();
	}
}

void IF() {
	T = ""; chain = 0;
	for (int i = line + 1; i < line + 3; i++) { T += S[i]; }
	y = hantei();
	if(y==false){
		for (int i = line; i < S.size(); i++) {
			if (S[i] == '[') { chain++; }
			if (S[i] == ']') { chain--; }
			if (chain == 0) { line = i; break; }
		}
	}
}

void WHILE () {
	T = ""; chain = 0;
	for (int i = line + 1; i < line + 3; i++) { T += S[i]; }
	y = hantei();
	if (y == false) {
		for (int i = line; i < S.size(); i++) {
			if (S[i] == '{') { chain++; }
			if (S[i] == '}') { chain--; }
			if (chain == 0) { line = i; break; }
		}
	}
}

void PASS() {
	chain = 0;
	for (int i = line; i >= 0; i--) {
		if (S[i] == '}') { chain++; }
		if (S[i] == '{') { chain--; }
		if (chain == 0) { pass = i; break; }
	}
	line = pass - 1;
}

bool hantei() {
	if (T[0] == 'N' && cz == 0) { return true; }
	if (T[0] == 'E' && cz == 1) { return true; }
	if (T[0] == 'S' && cz == 2) { return true; }
	if (T[0] == 'W' && cz == 3) { return true; }
	if (T[0] == 'C') {
		if (cz == 0 && x[cy - 1][cx] == 1) { return true; }
		if (cz == 1 && x[cy][cx + 1] == 1) { return true; }
		if (cz == 2 && x[cy + 1][cx] == 1) { return true; }
		if (cz == 3 && x[cy][cx - 1] == 1) { return true; }
	}
	if (T[0] == 'T') { return true; }
	if (T[0] == '~') {
		if (T[1] == 'N' && cz != 0) { return true; }
		if (T[1] == 'E' && cz != 1) { return true; }
		if (T[1] == 'S' && cz != 2) { return true; }
		if (T[1] == 'W' && cz != 3) { return true; }
		if (T[1] == 'C') {
			if (cz == 0 && x[cy - 1][cx] != 1) { return true; }
			if (cz == 1 && x[cy][cx + 1] != 1) { return true; }
			if (cz == 2 && x[cy + 1][cx] != 1) { return true; }
			if (cz == 3 && x[cy][cx - 1] != 1) { return true; }
		}
	}
	return false;
}

int main() {
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a;
			if (a == '#') { x[i][j] = 1; }
			if (a == 'g') { gx = j; gy = i; }
			if (a == 's') { cx = j; cy = i; }
		}
	}
	cin >> S;
	line = 0;
	while (line < S.size()) {
		ugoku(S[line]);
		line++;
		if (cx == gx && cy == gy) { goto F; }
		sum2++;
		if (sum2 > 2500000) { sum = -1; break; }
	}
	sum = -1;
F:;
	cout << sum << endl;
	return 0;
}

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

int main(){
    string str;
    int sum;
    while(cin >>str && str !="0"){
        sum = 0;
        for(int i=0;i<str.size();i++){
            sum +=str[i] -'0';
        }
        cout << sum << endl;
    }
}


Measured memory_bytes: 3164
# -*- coding: utf-8 -*-
D, G = map(int, input().split())
data = [list(map(int, input().split())) for i in range(D)]
ps, cs = zip(*data)
clear_cnt = D
min_prb = 1000
for i in range(1 << D):
    result = 0
    num_prb = 0
    not_selected_list = list()
    for j in range(D):
        if (i >> j & 1):
            result += ps[j] * 100 * (j+1) + cs[j]
            num_prb += ps[j]
        else:
            not_selected_list.append(j)
    if result < G:
        not_selected = max(not_selected_list)
        add_num_prb = min(ps[not_selected], -(-(G - result)//(100*(not_selected+1))) )
        num_prb += add_num_prb
        result += add_num_prb * (not_selected+1) * 100
    if result >= G:
        min_prb = min(min_prb, num_prb)
print(int(min_prb))


Measured memory_bytes: 9124
A, B, K = map(int, input().split())

ans = []
end = A + K if A + K < B else B
for a in range(A, end):
    ans.append(a)

start = B - K + 1 if B - K + 1 > A else A
for b in range(start, B + 1):
    ans.append(b)

for a in sorted(set(ans)):
    print(a)


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

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


Measured memory_bytes: 3080
def gi; gets.to_i end
def gs; gets.chomp end
def gli; gets.split(' ').map(&:to_i) end
def d(n); Math.log10(n).to_i + 1 end
class Integer
  # 約数の組み合わせを列挙する
  def divisor_combinations
    (1..Math.sqrt(self).to_i).
      select { |i| self % i == 0 }.
      map { |i| [i, self / i] }
  end
end

N = gi

puts (1..N).each.select(&:odd?).size.to_f / N


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

#define REP(i,n) for(ll i=0;i<n;++i)
#define RREP(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<n;++i)
#define RFOR(i,m,n) for(ll i=n-1;i>=m;--i)
#define ALL(v) (v).begin(),(v).end()
#define PB(a) push_back(a)
#define UNIQUE(v) v.erase(unique(ALL(V),v.end()));
#define DUMP(v) REP(i, (v).size()) { cout << v[i]; if (i != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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

typedef long long ll;
using namespace std;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, l;
	cin >> n >> l;
	vector<string> v(n);
	REP(i, n)cin >> v[i];
	sort(ALL(v));
	string s = "";
	REP(i, n)s += v[i];
	cout << s << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define mrep(i,j,n) for(int i = j; i < n; i++)
#define reps(i,n) for(int i = 1; i <= n; i++)
#define rrep(i,n) for(int i = n-1; i >= 0; i--)
#define rreps(i,n) for(int i = n; i >= 1; i--)
#define co(x) cout << x <<endl
#define cs(x) cout << x <<" "
#define el cout<<endl
#define cer(x) cerr << x <<endl
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define ERASE(x,val) x.erase(remove(ALL(x), val), x.end())
#define vi vector<int> 
#define vvi vector<vector<int>> 
#define vpii vector<pair<int,int>> 
#define vl vector<ll> 
#define vvl vector<vector<ll>> 
#define vb vector<bool> 
#define vvb vector<vector<bool>>
#define vs vector<string> 
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
ll mod = 1e9 + 7;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a * b / g; }
bool is_prime(ll x) { for (ll i = 2; i * i <= x; i++) { if (x % i == 0)return false; } return true; }

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

	int n;
	cin >> n;
	vi x(n),l(n);
	rep(i, n)cin >> x[i] >> l[i];
	vpii robot(n);
	rep(i, n)
	{
		robot[i].first = x[i] + l[i];
		robot[i].second = x[i] - l[i];
	}
	sort(all(robot));
	int ans = 0;
	int i = 0, t = INT_MIN;

	while (i < n)
	{
		int start = robot[i].second;
		int end = robot[i].first;
		if (t <= start)
		{
			t = end;
			ans++;
		}
		i++;
	}
	co(ans);
;	return 0;
}


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

int f(int n){
    int cnt=0;
    for(int x=1;x*x<=n;x++){
        for(int y=1;y*y<=n;y++){
            for(int z=1;z*z<=n;z++){
                if(x*x+y*y+z*z+x*y+y*z+z*x>n) break;
                if(x*x+y*y+z*z+x*y+y*z+z*x==n){
                    cnt++;
                    break;
                }
            }
        }
    }
    return cnt;
}
int main(){
    int n;
    cin >> n;
    for(int i=1;i<=n;i++){
        cout << f(i) << endl;
    }
}

Measured memory_bytes: 3560
from sys import stdin

n, d = map(int, input().split())
x = []
for i in range(n):
        x.append(list(map(int,input().split())))

ans = 0
for i in range(n):
  for k in range(i+1, n):
    tmp = 0
    for j in range(d):
        tmp += (x[i][j] - x[k][j])**2
    if tmp**(1/2)%1 == 0:
        ans += 1
print(ans)

Measured memory_bytes: 3064
import sys
import math
sys.setrecursionlimit(int(1e6))
#dprint = print
def dprint(*args):
  pass

n, k = list(map(int, input().split()))
A = list(map(int, input().split()))
dprint('n, k = ', n, k)
dprint('A = ', A)

i_l = 0
for i_r in range(k, n):
  dprint('i_l, i_r = ', i_l, i_r)
  if A[i_l] >= A[i_r]:
    print('No')
  else:
    print('Yes')

  i_l = i_l + 1


Measured memory_bytes: 33032
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
using namespace std;

#define ll long long
#define INF (1 << 30)
#define INFLL (1LL << 60)

#define FOR(i,a,b) for(ll i = (a);i<(b);i++)
#define REP(i,a) FOR(i,0,(a))
#define MP make_pair

int main() {
    ll n, ans;
    cin >> n;

    cout << n * 800 - (int)(n / 15) * 200 << endl;

    return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
a = list(map(int, input().split()))
a = [0] + a
visited = [False] * (n + 1)
i = 1
visited[i] = True
path = [i]
while True:
    i = a[i]
    path.append(i)
    if visited[i]:
        break
    else:
        visited[i] = True


start = path.index(i)
pattern = path[start:-1]
m = len(pattern)

if m == 0:
    print(1)
elif k < start:
    print(path[k])
else:
    print(pattern[(k - start) % m])

Measured memory_bytes: 32224
def f(a,c):
    b=[a.count(i) for i in a]
    if b==a:print(c);print(' '.join(map(str,b)));return
    f(b,c+1) 
while 1:
    n=int(input())
    if not n:break
    a=list(map(int,input().split()))
    f(a,0)

Measured memory_bytes: 7732
//BinarySearch + DynamicProgramming
//
#include<iostream>
#include<cassert>
#include<cstdlib>
#include<algorithm>
#include<numeric>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)
typedef long long ll;
const int N = 1000;
int adj[N][N];
int r[N];

int bestpoint(int n,int *esa,int l,int y,int x,ll tdist){
  int r=n-1;
  int ret=-1;
  if (esa[r] < x)return r;
  while(l <= r){
    int mid=(l+r)/2;
    ll mdist=esa[mid]-x;
    assert(mdist >= 0);
    if (mdist < tdist){
      ret=mid;
      l=mid+1;
    }else {
      r=mid-1;
    }
  }
  return ret;
}

void setdata(int n,int *esa,int m,int *y,int *x,int *num){
  rep(i,n){
    REP(j,i+1,n)adj[i][j]=0;
    rep(j,m){
      if (esa[i] < x[j]){
	ll tdist=llabs(esa[i]-x[j]);
	int ind=bestpoint(n,esa,r[j],y[j],x[j],tdist);
	//cout <<"check " << i <<" " << j <<" : " << esa[i] <<" " << x[j] << " " << ind << endl;
	if (ind == -1)ind=r[j]-1;
	if (ind >= 0)adj[i][ind]+=num[j];
      }
    }
    for(int j=n-2;j>i;j--){
      adj[i][j]+=adj[i][j+1];
    }

    /*
    for(int k=m-1;k>=0;k--){
      ll tmp=llabs(esa[i]-x[k]);
      REP(j,i+1,n){
	if (tmp > llabs(esa[j]-x[k]))adj[i][j]+=num[k];
      }
    }
    */
  }
}

int dp[N];
bool isok(int n,int lim,int total){
  rep(i,n){
    dp[i]=total;
    rep(j,i){
      if (dp[j]-adj[j][i] > lim)continue;
      dp[i]=min(dp[i],adj[j][i]);
    }
  }
  rep(i,n)if (dp[i] <= lim)return true;
  return false;
}

int solve(int n,int total){
  int l=0,r=total;
  int ret=total;
  while(l <= r){
    int mid=(l+r)/2;
    if (isok(n,mid,total))ret=mid,r=mid-1;
    else l=mid+1;
  }
  return ret;
}

main(){
  int n,m;
  static int x[N],y[N],num[N],esa[N];
  while(cin>>m>>n){
    if (m == 0 && n == 0)break;
    int total=0;
    rep(i,m)cin>>x[i]>>y[i]>>num[i],total+=num[i];
    rep(i,n)cin>>esa[i];
    sort(esa,esa+n);
    rep(i,m){
      r[i]=n-1;
      for(int j=n-1;j>=0;j--){
	if (x[i] <= esa[j] )r[i]=j;
      }
    }
    setdata(n,esa,m,y,x,num);
    //int total=accumulate(num,num+m,0);
    cout << solve(n,total) << endl;
  }
  return false;
}

Measured memory_bytes: 4812
<?php
fscanf(STDIN, '%d', $next);
for ($i=0; $i < 999; $i++) { 
    $tmp = str_split($next);
    if ($tmp[0] ==$tmp[1] && $tmp[0] == $tmp[2]) {
        echo $next."\n";
        exit;
    }
    $next++;
}

Measured memory_bytes: 4728
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <bitset>
#include <vector>
#include <queue>
#include <map>
#include <set>

#define i64 int64_t
#define ff(ii,nn,mm) for(int ii=nn;ii<mm;ii++)
#define ffrvs(ii,nn,mm) for(int ii=nn;ii>=mm;ii--)
#define srt(vvv) sort(vvv.begin(),vvv.end())
#define srtrvs(vvv) reverse(vvv.begin(),vvv.end())
#define Graph vector<vector<int>>
int inf = 1000000007;
i64 giant = 4000000000000000037;

using namespace std;

//メモリ置き場
int n;
vector<tuple<string, int,int>> dat(n);

//inputします
void input() {
    cin >> n;
    dat.resize(n);
    ff(i, 0, n) {
        string s;
        int t;
        cin >> s >> t;
        t = 100 - t;
        tuple<string, int, int > pre(s, t, i);
        dat[i] = pre;
    }
    srt(dat);
}

//ライブラリ置き場

//main
int main() {
    input();
    ff(i, 0, n) {
        string s;
        int t, j;
        tie(s,t,j) = dat[i];
        cout << j+1 << endl;
    }
	return 0;
}

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

int main()
{
    int n;
    cin >> n;
    long long x[n];
    for (int i = 0; i < n; i++)
        cin >> x[i];

    long long a[n];

    long long x_tot = x[0];
    for (int i = 1; i < n; i++)
        x_tot ^= x[i];

    for (int i = 0; i < n; i++)
    {
        a[i] = x_tot ^ x[i];
        cout << a[i] << " ";
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 6668
#include <iostream>

using namespace std;

int main() {
    string s;
    cin >> s;
    int n1 = stoi(s.substr(0, 2)), n2 = stoi(s.substr(2, 2));
    if (0 < n1 && n1 <= 12) {
        if (0 < n2 && n2 <= 12) {
            cout << "AMBIGUOUS";
        } else {
            cout << "MMYY";
        }
    } else if (0 < n2 && n2 <= 12) {
        cout << "YYMM";
    } else {
        cout << "NA";
    }
    cout << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <cmath>
#include <tuple>
#include <cassert>

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

#define FOR(i,m,n) for(int i=(m); i<(n); i++)
#define REP(i,n) for(int i=0; i<(n); i++)
#define RFOR(i,n,m) for(int i=(n);i>=(m); i--)
#define RREP(i,n) for(int i=(n-1); (i)>=0; i--)
#define pb push_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << x << endl
// #define int long long 

const double eps=1e-14;
const int mod = 1e9 + 7;
const int inf = 100100100;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

struct mint 
{
  ll x;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

mint dp0[2005][2005];
mint dp1[2005][2005];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    vector<int> s(n+1), t(m+1);
    REP(i,n) cin >> s[i];
    REP(i,m) cin >> t[i];
    dp0[0][0] = 1;
    REP(i,n+1) REP(j,m+1)
    {
        dp0[i+1][j] += dp0[i][j];
        dp1[i][j] += dp0[i][j];
        dp1[i][j+1] += dp1[i][j];
        if(s[i] == t[j]) dp0[i+1][j+1] += dp1[i][j];
    }
    mint ans = dp1[n][m];
    cout << ans.x << endl;
    return 0;
}

Measured memory_bytes: 63232
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  string s;
  cin >> s;
  int n = s.length();
  int R(n / 2), L(n - 1 - R);
  char c = s[R];
  for (; R < n && s[L] == c && s[R] == c; R++, L--) {}
  int ret = R;
  cout << ret << '\n';
  return 0;
}

Measured memory_bytes: 512