akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(){
  int n;
  scanf("%d",&n);
  for(int i=0;i<n;i++){
    int y,m,d;
    scanf("%d%d%d",&y,&m,&d);
    int answer=1;
    for(int j=y;j<1000;j++){
      if(j%3){
        answer+=195;
      }else{
        answer+=200;
      }
    }
      if(y%3){
        for(int k=1;k<m;k++){
          if(k%2){
            answer-=20;
          }else{
            answer-=19;
          }
        }
      }else{
        for(int k=1;k<m;k++){
          answer-=20;
        }
      }
      
        
      
      answer-=d;
      printf("%d\n",answer);
  }
}


Measured memory_bytes: 2032
n = int(input())
lists = [[0,0,0]]
for i in range(n):
  a = list(map(int,input().split()))
  lists.append(a)

diffs = []  
for i in range(1,n+1,1):
  diff = [ x - y for (x,y) in zip(lists[i], lists[i-1])]
  diffs.append(diff) 
  
for diff in diffs:
  if diff[0] < abs(diff[1]) + abs(diff[2]):
    print('No')
    exit()
  elif diff[0] % 2 != (abs(diff[1]) + abs(diff[2])) % 2:
    print('No')
    exit()
print('Yes')  

Measured memory_bytes: 36244
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1234567;
const double EPS = 1e-10;
const double pi = acos(-1);//3.1415926535897932384626433832795028...
const ll SIZE = 2000005;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[SIZE], finv[SIZE], inv[SIZE];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;
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 mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}
	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}

template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

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

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

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

template<typename T>
void outp(vector<T>v) {
	for (int i = 0; i < v.size(); ++i) {
		cout << v[i];
		if (i != v.size() - 1) { cout << " "; }
	}
}

double add(double a, double b) {
	if (abs(a + b) < EPS * (abs(a) + abs(b))) { return 0; }
	return a + b;
}

double len(int a, int b, int c, int d) {
	return (double)sqrt((a - c) * (a - c) + (b - d) * (b - d));
}

ll n, k[200005], ans = INF, sum, uku;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 0; i < n; ++i) { cin >> k[i]; sum += k[i]; }
	for (int i = 0; i < n - 1; ++i) {
		uku += k[i];
		ans = min(ans, abs(sum - uku * 2));
	}

	cout << ans << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>
#

typedef struct{
	int tcard[100],hcard[100],tsum,hsum,tnum,hnum;
	int result;
	int card[2];
}SET;


int main()
{
	int k=0,i,j,diff;
	SET game[200];
	
	while(1){

		scanf("%d %d",&game[k].tnum,&game[k].hnum);
		if(game[k].tnum==0 && game[k].hnum==0){
			break;
		}
		
		for(i=0;i<game[k].tnum;i++){
			scanf("%d",&game[k].tcard[i]);
			game[k].tsum+=game[k].tcard[i];
		}
		for(i=0;i<game[k].hnum;i++){
			scanf("%d",&game[k].hcard[i]);
			game[k].hsum+=game[k].hcard[i];
		}
		if(!((game[k].tsum+game[k].hsum)%2)){
			diff=game[k].tsum-(game[k].tsum+game[k].hsum)/2;
			for(i=0;i<game[k].tnum&&game[k].result==0;i++){
				for(j=0;j<game[k].hnum;j++){
					if(diff==(game[k].tcard[i]-game[k].hcard[j])&&game[k].tcard[i]!=0&&game[k].hcard[j]!=0){
						game[k].card[0]=game[k].tcard[i];
						game[k].card[1]=game[k].hcard[j];
						game[k].result++;
						break;
					}
				}
			}
		}
		k++;
	}
	for(i=0;i<k;i++){
		//printf("%d\n",game[i].result);
		if(game[i].result==0){
			printf("-1");
		}
		else{
			printf("%d %d",game[i].card[0],game[i].card[1]);
		}
			printf("\n");
		
	}
	return 0;
}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
#define INF (ll)1e18
#define PR 1010101


ll N;
vector<ll> pr;
ll prmk[1020202];
ll mk[101];
ll i, j, k;

int main(){
    scanf("%lld", &N);
    fornum(i,2,PR){
        if(prmk[i])
            continue;
        pr.push_back(i);
        for (j = i * 2; j < PR;j+=i){
            prmk[j] = 1;
        }
    }
    j = 0;
    k = 1;
    fornum(i,0,100){
        if(i==k){
            ++j;
            k += j + 1;
        }
        mk[i] = j;
    }
    ll ans = 0;
    fornum(i,0,pr.size()){
        j = 0;
        while(N%pr[i]==0){
            N /= pr[i];
            ++j;
        }
        ans += mk[j];
    }
    if(N>1){
        ++ans;
    }
    printf("%lld\n", ans);

    return 0;
}

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

using namespace std;

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

const int N = 200010;
const double eps = 1e-6;

LL x, y;

int main()
{
    cin >> x >> y;

    LL res = 0, t = x;
    while(t <= y)
    {
        res++;
        t *= 2;
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
K, S = list(map(int, input().split()))

import math
def comb(M, N):
    if M<0: return 0
    if M<N: return 0
    return (math.factorial(M)//(math.factorial(M-N)*math.factorial(N)))

print(comb(S+2, 2)-3*(comb(S+2-K-1, 2))+3*(comb(S+2-2*(K+1), 2)))


Measured memory_bytes: 81364
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#include"debug_deque.hpp"
#define vector DebugDeque
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printe) FUNC(printw) FUNC(printew) FUNC(printb) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }

#include<unistd.h>
char buff[1 << 22];
template <int size>
struct Buffer{
    int idx = 0;
    Buffer(){ read(0, buff, size); }
    void next(int& ret){
        // int ret = 0;
        ret = 0;
        // while(!(buff[idx] & 0x10)){ idx++; }
        while(buff[idx] & 0x10){ ret = ret * 10 + buff[idx++] - '0'; }
        idx++;
        // while(!isdigit(buff[idx])){ idx++; }
        // while(isdigit(buff[idx])){ ret = ret * 10 + buff[idx++] - '0'; }
        // return ret;
    }
};
struct FastInput {
    Buffer<1 << 22> buf;
    template <class T>
    FastInput& operator >> (T& num) { buf.next(num); return *this; }
    // FastInput& operator >> (T& num) { num = buf.next(); return *this; }
    void tie(int){ }
    template <class S, class T>
    friend FastInput& operator >> (FastInput& in, pair<S, T>& p){ return in >> p.first >> p.second; }
    template <class T>
    friend FastInput& operator >> (FastInput& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
};
FastInput fin;
#define cin fin

enum { SIZE = 1 << 20 };
char buf[SIZE];
int accs[512][512];
pair<int, int> pqs[100000];
int main(){
    int n, m, q;
    cin >> n >> m >> q;
    for(int i = 0; i < m; i++){
        int l, r;
        cin >> l >> r;
        accs[1][r]++;
        accs[l + 1][r]--;
    }
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= n; j++){
            accs[i + 1][j] += accs[i][j];
            accs[i][j] += accs[i][j - 1];
        }
    }
    // int idx = SIZE;
    char* ptr = buf + SIZE;
    for(int i = 0; i < q; i++){
        cin >> pqs[i].first >> pqs[i].second;
    }
    for(int i = q - 1; i >= 0; i--){
        int p = pqs[i].first, q = pqs[i].second;
        *--ptr = '\n';
        // buf[--idx] = '\n';
        div_t num2;
        num2.quot = accs[p][q];
        do{
            num2 = div(num2.quot, 10);
            *--ptr = num2.rem + '0';
            // buf[--idx] = num2.rem + '0';
        }while(num2.quot);
    }
    write(1, ptr, buf + SIZE - ptr);
    // write(1, buf + idx, SIZE - idx);
}


Measured memory_bytes: 6784
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		List<BigInteger> list = new ArrayList<>();
		int N = sc.nextInt();
		for(int i = 0; i < N; i++) {
			list.add( new BigInteger(sc.next()) );
		}
		List<BigInteger> newList = new ArrayList<>(new HashSet<BigInteger>(list));

		if(newList.size() == 1) {
			System.out.println(newList.get(0));
		} else {
			BigInteger result = LCM(newList.get(0), newList.get(1));
			for(int i = 2; i < newList.size(); i++) {
				result = LCM(result, newList.get(i));
			}
			System.out.println(result);
		}
	}

	private static BigInteger LCM(BigInteger a, BigInteger b) {
		return a.multiply(b).divide(a.gcd(b));
	}
}


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

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0 ; i < n ; i++) {
            a[i] = sc.nextInt();
        }
        Arrays.sort(a);
        long mod = 1000000007;

        long fac[] = new long[n + 3];
        long finv[] = new long[n + 3];
        long inv[] = new long[n + 3];
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2 ; i < n + 3; i++) {
            fac[i] = fac[i - 1] * i % mod;
            inv[i] = mod - inv[(int)mod % i] * (mod / i) % mod;
            finv[i] = finv[i - 1] * inv[i] % mod;
        }

        long ans = 0;
        for (int i = 0 ; i < n - k + 1 ; i++) {
            ans -= a[i] * COM(n - i - 1, k - 1, fac, finv, mod);
            ans %= mod;
            ans += a[n - i - 1] * COM(n - i - 1, k - 1, fac, finv, mod);
            ans %= mod;
        }
        System.out.println((ans + mod) % mod);

    }
    static long COM(int n, int k, long[] fac, long[] finv, long mod){
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
    }

}

Measured memory_bytes: 50808
n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
d1, d2, d3, di = 0, 0, 0, 0
for i in range(n):
  d1 += abs(x[i]-y[i])
  d2 += (x[i]-y[i])**2
  d3 += abs((x[i]-y[i]))**3
  di = max(di, abs(x[i]-y[i]))
print(d1)
print(d2**0.5)
print(d3**(1/3))
print(di)


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
char t[200500];
char d[200050];
int N, Q;
string s;
bool fallr(int pos) {
    for(int q = 1; q <= Q; q++) {
        //cerr << q << " " << pos << endl;
        if(t[q] != s[pos]) continue;
        if(d[q] == 'L') pos--;
        else pos++;
        if(pos >= N + 1) return true;
        if(pos <= 0) return false;
    }
    return false;
}

bool falll(int pos) {
    for(int q = 1; q <= Q; q++) {
        //cerr << q << " " << pos << endl;
        if(t[q] != s[pos]) continue;
        if(d[q] == 'L') pos--;
        else pos++;
        if(pos >= N + 1) return false;
        if(pos <= 0) return true;
    }
    return false;
}

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> Q;
    cin >> s;
    s = "#" + s;
    for(int i = 1; i <= Q; i++) cin >> t[i] >> d[i];
    int lok = 0;
    int lng = N + 1;
    int rok = N + 1;
    int rng = 0;
    while(lng - lok > 1) {
        int mid = (lng + lok) / 2;
        //cerr << mid << endl;
        if(falll(mid)) lok = mid;
        else lng = mid;
    }
    while(rok - rng > 1) {
        int mid = (rok + rng) / 2;
        if(fallr(mid)) rok = mid;
        else rng = mid;
    }
    //cerr << rok << " " << lok << endl;
    if(rok <= lok) cout << 0 << endl;
    else cout << rok - lok - 1 << endl;
    return 0;
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

using i64=int64_t;

//10 1 2 3 4 5 6 7 8 9

vector<i64> unroll(i64 m,vector<i64> a){
    vector<i64> res={a.front()};

    i64 s=a.front();
    rep(i,1,a.size()){
        if(a[i]>a[i-1]){
            res.push_back(s+a[i]-a[i-1]);
            s+=a[i]-a[i-1];
        }else{
            res.push_back(s+m-a[i-1]+a[i]);
            s+=m-a[i-1]+a[i];
        }
    }
    return res;
}

void solve(){
    i64 n,m;
    cin >> n >> m;
    vector<i64> a(n);
    rep(i,0,n){
        cin >> a[i];
        --a[i];
    }

    vector<queue<i64>> push(m);
    vector<i64> pop(a.size()-1);
    vector<i64> d(a.size()-1);
    rep(i,0,a.size()-1){
        if((a[i+1]-a[i]+m)%m<=1) continue;
        push[(a[i]+2)%m].push(i);
        pop[i]=(a[i+1]+1)%m;
        d[i]=(a[i+1]-a[i]+m)%m-1;
    }

    i64 ans=0,s=0;
    rep(i,0,a.size()-1){
        if(a[i]<a[i+1]) s+=a[i+1]-a[i];
        else s+=m-a[i]+a[i+1];
    }
    ans=s;

    vector<i64> k(m);
    vector<vector<i64>> erase_id(m);
    i64 c=0,cnt_id=0;
    rep(i_,0,2*m){
        i64 i=i_%m;
        while(!push[i].empty()){
            ++cnt_id;
            erase_id[pop[push[i].front()]].push_back(push[i].front());
            push[i].pop();
        }

        for(auto id:erase_id[i]){
            --cnt_id;
            c-=d[id];
        }
        erase_id[i].clear();

        c+=cnt_id;
        k[i]+=c;
        ans=min(ans,s-k[i]);
    }
    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


Measured memory_bytes: 75264
package main

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

func Battle(ps [4]int) string {
	thp := ps[0]
	tap := ps[1]
	ahp := ps[2]
	aap := ps[3]
	var isWin string
	for {
		ahp = ahp - tap
		if ahp <= 0 {
			isWin = "Yes"
			break
		}
		thp = thp - aap
		if thp <= 0 {
			isWin = "No"
			break
		}
	}
	return isWin
}

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	stdin.Scan()
	args := strings.Split(stdin.Text(), " ")
	thp, _ := strconv.Atoi(args[0])
	tap, _ := strconv.Atoi(args[1])
	ahp, _ := strconv.Atoi(args[2])
	aap, _ := strconv.Atoi(args[3])
	isWin := Battle([4]int{thp, tap, ahp, aap})
	fmt.Println(isWin)
}


Measured memory_bytes: 1760
import sys
import itertools
n=int(input())
l=list(map(int,input().split()))
l.sort()
s=set(l)
if len(s)>=4 :print("No");sys.exit()
if len(s)==1:print("Yes" if 0 in s else "No");sys.exit()
s=list(s);s.sort()
if len(s)==2:
  if 0 not in s:print("No");sys.exit()
  if n%3==1:
    if l.count(0)==(n-1)//3:print("Yes");sys.exit()
    else:print("No");sys.exit()
  elif n%3==2:
    if l.count(0)==(n+1)//3:print("Yes");sys.exit()
    else:print("No");sys.exit()
  elif n%3==0:
    if l.count(0)==n//3:print("Yes");sys.exit()
    else:print("No");sys.exit()
a=l.count(s[0]);b=l.count(s[1]);c=l.count(s[2])
if a!=b or b!=c or c!=a:print("No");sys.exit()
flag=0
for i in itertools.permutations(s):
  if i[0]^i[2]==i[1] and i[1]^i[2]==i[0] and i[0]^i[1]==i[2]:flag+=1
if flag!=0:print("Yes")
else:print("No")


Measured memory_bytes: 14212
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define ina(n,a) cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            coyhhhhhhyoc    
#define next          sdNNNmNNNNNNNmds  
#define y0           hNNNNy_yNNNNNN_sNh
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy___smNNNms
#define tm            oooooosyysooooot 
#define read               tyhyt        
#define rank              ytmNmo         
#define index              yyy
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    cout << (s[2] == s[3] && s[4] == s[5] ? "Yes" : "No") << endl;
    return 0;
}


Measured memory_bytes: 768
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=0
for i in range(n):
    s+=b[i]
    if i<=n-2 and a[i+1]==a[i]+1:
        s+=c[a[i]-1]
print(s)

Measured memory_bytes: 38384
#include <iostream>
#include<string>
#include<cctype>
#include<algorithm>
#include <stdio.h>
#include<cstdlib>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	a = a*b;
	if (a % 2 == 0)cout << "Even" << endl;
	else cout << "Odd" << endl;
	return 0;

}

Measured memory_bytes: 764
#include <stdio.h>
int main(void){
  int A[3];
  for(int i=1; i<=3; i++){
    scanf("%d", &A[i]);
  }
  if(A[1]+A[2]+A[3]>=22){
    printf("bust");
  }else{
    printf("win");
  }
  return 0;
}

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

#define CIN2(a,b) long long a,b;cin >> a >> b;
#define CIN3(a,b,c) long long a,b,c;cin >> a >> b >> c;
#define rep(i,n) for(long long i=0,i##_len=(n); i<i##_len; ++i)
typedef long long lli;

bool is_ok(lli &,lli &,lli &,lli &);
string acgt = "acgt";
long long dp[1001][4][4][4]; 
int main(){
    int N;cin >> N;
    rep(i,4){rep(j,4){rep(k,4){
        lli tmp = -1;
        if(is_ok(tmp,i,j,k)) dp[3][i][j][k] = 1;
    }}}
    
    for(int n = 4; n <= N; n++){
        rep(i,4){rep(j,4){rep(k,4){
            long long sum = 0;
            rep(l,4){
                if(is_ok(i,j,k,l)){
                    sum += dp[n-1][j][k][l];
                    if(sum > (lli)1e9+7) sum %= (lli)1e9+7;
                }
            }
            dp[n][i][j][k] = sum; 
        }}}
    }
   
    lli ans = 0;
    rep(i,4){rep(j,4){rep(k,4){
        ans += dp[N][i][j][k];
        if(ans > (lli)1e9+7) ans %= ((lli)1e9)+7;
        //cout << dp[N][i][j][k] << "," << i << "," << j << "," << k << "\n";
    }}}
    cout << endl;
    cout << ans << endl;
}

bool is_ok(lli &d,lli &c,lli &b,lli &a){
    //vector<int> input{d,b,a} == vector<int> tmp{0,2,1};  
    if((d==0&&b==2&&a==1) ||
    (d==0&&c==2&&a==1) ||
    (d==2&&c==0&&b==1) ||
    (c==2&&b==0&&a==1) ||
    (d==0&&c==1&&b==2) ||
    (c==0&&b==1&&a==2) ||
    (d==0&&c==2&&b==1) ||
    (c==0&&b==2&&a==1)
    ){
        return false;
    }
    return true;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int[] a = new int[n + 1];
    for (int i = 1; i <= n; i++) {
      a[i] = sc.nextInt();
    }
    ArrayList<Integer> b = new ArrayList<>();
    if (n % 2 == 0) {
      for (int i = n; i >= 2; i -= 2) {
        b.add(a[i]);
      }
      for (int i = 1; i < n; i += 2) {
        b.add(a[i]);
      }
    } else {
      for (int i = n; i >= 1; i -= 2) {
        b.add(a[i]);
      }
      for (int i = 2; i < n; i += 2) {
        b.add(a[i]);
      }
    }
    for (int i = 0; i < b.size(); i++) {
      if (i == 0) {
        System.out.print(b.get(i));
      } else {
        System.out.print(" " + b.get(i));
      }
    }
    System.out.println();
  }
}

Measured memory_bytes: 98944
// Aizu 2406: Al dente
// 2017.9.26 bal4u@uu

#include <stdio.h>

int main()
{
	int n, t, e, x;
	int i, k;

	scanf("%d%d%d", &n, &t, &e);
	for (i = 1; i <= n; i++) {
		scanf("%d", &x);
		for (k = x; ; k += x) {
			if (k > t+e) break;
			if (t-e <= k && k <= t+e) {
				printf("%d\n", i);
				return 0;
			}
		}
	}
	puts("-1");
	return 0;
}

Measured memory_bytes: 1844
#include <bits/stdc++.h>
#include <algorithm>
#include <limits>
#include <cmath> 
using namespace std;

int main(){
    long N,s=2,t=1,R;
    cin>>N;
    
    for(int i=1;i<N;i++){
        R=s+t;
        s=t;
        t=R;
    }
    if(N==1)cout<<1<<endl;
    else cout<<R<<endl;
}

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

#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef long long int lli;
typedef pair<lli, lli> pi;

lli dp[100020][15], mod = 1000000007;

int main()
{
    string s;
    cin >> s;
    if(s[0] == '?'){
        for(int i=0; i<10; i++){
            dp[0][i] = 1;
        }
    }
    else{
        int ind = s[0] - '0';
        dp[0][ind] = 1;
    }
    for(int i=1; i<s.size(); i++){
        if(s[i] == '?'){
            for(int j=0; j<13; j++){
                for(int k=0; k<10; k++){
                    int ind = (j*10+k) % 13;
                    dp[i][ind] = (dp[i-1][j]+dp[i][ind]) % mod;
                }
            }
        }
        else{
            for(int j=0; j<13; j++){
                int ind = s[i] - '0';
                ind += j*10;
                ind %= 13;
                dp[i][ind] = (dp[i-1][j]+dp[i][ind]) % mod;
            }
        }
    }

    cout << dp[s.size()-1][5] << "\n";

    return 0;
}


Measured memory_bytes: 12160
#include <bits/stdc++.h>
using namespace std;
#define debug(x) std::cerr << #x << " = " << (x) << std::endl
typedef long long LL;
const int MAXN = 2e5+5;
const int MOD = 1e9+7;
int dp[MAXN],nxt[MAXN][26+3],ocr[26+3];
int main(int argc ,char const *argv[])
{
  #ifdef noob
  freopen("Input.txt","r",stdin);freopen("Output.txt","w",stdout);
  #endif  
  string str;
  cin>>str;
  int n = str.size();
  for (int i = 0; i < 26; ++i)
  {
    ocr[i] = n;
  }
  for (int i = n-1; i >=0; i--)
  {
    ocr[str[i]-'a'] = i;
    for (int j = 0; j < 26; ++j)
    {
      nxt[i][j] = ocr[j];
    }
    dp[i] = MOD;
  }


  dp[n] = 1;
  for (int i = n-1; i > -1; --i)
    for (int j = 0; j < 26; ++j)
      dp[i] = min(dp[i],dp[nxt[i][j]+1]+1);

  for (int i = 0; dp[0]; --dp[0])
  {
    for (int j = 0; j < 26; ++j)
    {
      if(dp[i]==dp[nxt[i][j]+1]+1)
      {
        printf("%c",j+'a');
        i = nxt[i][j]+1;
        break;
      }
    }
  }

  cout<<endl;

  return 0; 
}


Measured memory_bytes: 24068
N = int(input())
MONSTER = list(map(int, input().split()))

def euclidean(a, b):
  if b == 0:
    return a
  return euclidean(b, a % b)

for i in range(1, len(MONSTER)):
  MONSTER[i] = euclidean(MONSTER[i-1], MONSTER[i])
print(MONSTER[len(MONSTER) - 1])


Measured memory_bytes: 14224
#include <iostream>
#define M 998244353
#define ll long long
#define MAX 2000005
using namespace std;
 
ll pre[MAX];
ll power(ll x,ll y){
    if(y==0)
        return 1ll;
    ll val=power(x,y/2);
    if(y%2==1)
        return ((val*val)%M*x)%M;
    return (val*val)%M;
}
void buildTree(ll *a,ll *tree,ll s,ll e,ll i){
    if(s==e){
        tree[i]=pre[e-s];
        return;
    }
    tree[i]=pre[e-s];
    ll m=(s+e)/2;
    buildTree(a,tree,s,m,2*i);
    buildTree(a,tree,m+1,e,2*i+1);
}
 
void updateTreeLazy(ll *lazy,ll *tree,ll s,ll e,ll l,ll r,ll i,ll val){
    if(lazy[i]!=-1){
        tree[i]=(lazy[i]*pre[e-s])%M;
        if(s!=e){
            lazy[2*i]=lazy[i];
            lazy[2*i+1]=lazy[i];
        }
        lazy[i]=-1;
    }
    if(s>e || s>r || e<l)
        return;
    //Complete Overlap
    if(s>=l && e<=r){
        tree[i]=(val*pre[e-s])%M;
        if(s!=e){
            lazy[2*i]=val;
            lazy[2*i+1]=val;
        }
        return;
    }
    ll m=(s+e)/2;
    updateTreeLazy(lazy,tree,s,m,l,r,2*i,val);
    updateTreeLazy(lazy,tree,m+1,e,l,r,2*i+1,val);
    tree[i]=(tree[2*i]*power(10,e-m))%M+tree[2*i+1]%M;
    tree[i]%=M;
 
}
int main()
{
    ll n,q;
    cin>>n>>q;
    ll arr[n];
    for(ll i=0;i<n;i++){
        arr[i]=1;
    }
    pre[0]=1;
    for(ll i=1;i<MAX;i++){
        pre[i]=((pre[i-1]*10)%M+1)%M;
    }
    ll *tree=new ll[4*n]();
    ll *lazy=new ll[4*n];
    for(ll i=0;i<4*n;i++)
        lazy[i]=-1;
    buildTree(arr,tree,0,n-1,1);
    for(ll i=0;i<q;i++){
        ll l,r,x;
        cin>>l>>r>>x;
        updateTreeLazy(lazy,tree,0,n-1,l-1,r-1,1,x);
        cout<<tree[1]%M<<endl;
    }
    return 0;
}

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

class Problem0009
{
    static void Main(string[] args)
    {
        int[] primes = Enumerable.Range(1, 999999).Where(IsPrime).ToArray();

        foreach (int n in GetInputLines().Select(int.Parse))
        {
            Console.WriteLine(primes.TakeWhile(p => p <= n).Count());
        }
    }

    static bool IsPrime(int n)
    {
        if (n < 2)
        {
            return false;
        }
        else
        {
            return Enumerable.Range(2, (int)Math.Sqrt(n) - 1).All(i => n % i != 0);
        }
    }

    static IEnumerable<string> GetInputLines()
    {
        string line;
        while (!string.IsNullOrEmpty(line = System.Console.ReadLine()))
        {
            yield return line;
        }
    }
}

Measured memory_bytes: 11216
import sys
from itertools import accumulate
def input(): return sys.stdin.readline().rstrip()

def main():
    N, K = map(int, input().split())
    P = tuple(map(int, input().split()))

    sum_ls = tuple(accumulate(range(max(P) + 1)))
    acc_P = [0] + list(accumulate([sum_ls[p] / p for p in P]))

    ans = 0
    for i in range(N - K + 1):
        v = acc_P[i+K] - acc_P[i]
        if v > ans:
            ans = v
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 25408
import java.util.*;

public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      	int H = sc.nextInt();
      	int W = sc.nextInt();
      	int total = H * W;
      	List<Integer> mapList = new ArrayList<>();
      	List<Integer> bombList = new ArrayList<>();
      	for(int i = 0; i < H; i++){
        	String[] strs = sc.next().split("");
          	for(int j = 0; j < strs.length; j++){
              	if(strs[j].equals("#")){
                  	mapList.add(-1);
                	bombList.add(i * W + j);
                }else{
                	mapList.add(0);
                }
            }
        }
      
      	for(Integer i : bombList){
        	int x1 = i - W - 1;
          	int x2 = i - W;
          	int x3 = i - W + 1;
          	int x4 = i - 1;
          	int x5 = i + 1;
          	int x6 = i + W - 1;
          	int x7 = i + W;
          	int x8 = i + W + 1;
          	if(x1 >= 0 && i % W != 0) mapList.set(x1, mapList.get(x1) != -1 ? mapList.get(x1) + 1 : -1);
          	if(x2 >= 0) mapList.set(x2, mapList.get(x2) != -1 ? mapList.get(x2) + 1 : -1);
          	if(x3 >= 0 && (i + 1) % W != 0) mapList.set(x3, mapList.get(x3) != -1 ? mapList.get(x3) + 1 : -1);
          	if(x4 >= 0 && i % W != 0) mapList.set(x4, mapList.get(x4) != -1 ? mapList.get(x4) + 1 : -1);
          
          	if(x5 < total && (i + 1) % W != 0) mapList.set(x5, mapList.get(x5) != -1 ? mapList.get(x5) + 1 : -1);
          	if(x6 < total && i % W != 0) mapList.set(x6, mapList.get(x6) != -1 ? mapList.get(x6) + 1 : -1);
          	if(x7 < total) mapList.set(x7, mapList.get(x7) != -1 ? mapList.get(x7) + 1 : -1);
          	if(x8 < total && (i + 1) % W != 0) mapList.set(x8, mapList.get(x8) != -1 ? mapList.get(x8) + 1 : -1);
        }

      	for(int i = 0; i < H; i++){
          	StringBuilder sb = new StringBuilder();
            for(int j = 0; j < W; j++){
                int mapItem = mapList.get(i * W + j);
				if(mapItem == -1){
                	sb.append("#");
                }else{
                  	sb.append(mapItem);
                }
            }
          	System.out.println(sb.toString());
        }
    }
}

Measured memory_bytes: 23252
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <assert.h>

using namespace std;

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

int N, M;
vector<int> s, c;

int main()
{
  cin >> N >> M;
  s.resize(M);
  c.resize(M);
  for (int i = 0; i < M; i++)
  {
    cin >> s[i] >> c[i];
    s[i]--;
  }

  string digits(N, 'a');

  for (int i = 0; i < M; i++)
  {
    if (digits[s[i]] == 'a')
    {
      digits[s[i]] = c[i] + '0';
      continue;
    }
    if (digits[s[i]] != c[i] + '0')
    {
      cout << -1 << endl;
      return 0;
    }
  }

  if (N == 1)
  {
    if (digits[0] == 'a')
    {
      cout << 0 << endl;
    }
    else
    {
      cout << digits << endl;
    }
    return 0;
  }

  if (digits[0] == '0')
  {
    cout << -1 << endl;
    return 0;
  }

  if (digits[0] == 'a')
  {
    digits[0] = '1';
  }

  for (int i = 1; i < N; i++)
  {
    if (digits[i] == 'a')
    {
      digits[i] = '0';
    }
  }

  cout << digits << endl;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

h,w,n,*a = map(int,read().split())

res = []
for i in range(n):
    res += [i+1]*a[i]

ans = [[0]*w for _ in range(h)]
for x,i in zip(range(h*w),res):
    q,r = x//w,x%w
    if q%2:
        ans[q][-1-r] = i
    else:
        ans[q][r] = i
        
for i in ans:
    print(*i)
    
        




Measured memory_bytes: 9408
#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++){
                cout << "#";
            }
            cout << endl;
        }
        cout << endl;
    }
    return 0;
}


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

int main() {
	int N;
	cin >> N;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	int flag = 1;
	for (int i = 0; i < N; i++) {
		if (!(A[i] % 6 == 0 || A[i] % 10 == 0 || A[i] % 2 == 1)) flag = 0;
	}

	if (flag) {
		cout << "APPROVED" << endl;
	}
	else {
		cout << "DENIED" << endl;
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] ans = new int[n];
        for (int i = 1; i <= n; i++) {
            ans[sc.nextInt() - 1] = i;
        }

        for (int i = 0; i < n; i++) {
            System.out.println(ans[i]);
        }
    }
}


Measured memory_bytes: 57076
#include<bits/stdc++.h>
// Begin Header {{{
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i,n) for(ll i=0; i<n; i++)
#define loop(i, j, n) for(ll i=j; i<n; i++)
#define all(x) (x).begin(), (x).end()
constexpr int INF  = 0x3f3f3f3f;
const long long mod=1e9+7;
const long double PI = acos(-1);
// }}} End Header

int main() {
	char a, b;
	cin >> a >> b;
	if(b == 'H'){
		if(a == 'H') puts("H");
		else puts("D");
	}else{
		if(a == 'H') puts("D");
		else puts("H");
	}
 	return 0;
}

Measured memory_bytes: 256
///A drunk man will find his way home, but a drunk bird may get lost forever...
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
typedef pair <int, int> pii;
#define pb push_back
#define f first
#define s second
#define sz(x) (int)x.size()
const int mx = 1000 * 100 + 5, M = 1e9 + 7;
int n, m, s, t, dis[2][mx], cnt[2][mx];
set < pii > ms;
vector < pii > ad[mx];
vector < pair < pii , int > > ed;
void dij(int a, int ind){
	memset(dis[ind], 127, sizeof dis[ind]);
	dis[ind][a] = 0;
	cnt[ind][a] = 1;
	for(int i = 0; i < n; i++)
		ms.insert({dis[ind][i], i});
	while(sz(ms)){
		auto v = ms.begin() -> s;
		ms.erase(ms.begin());
		for(auto u : ad[v]){
			if(dis[ind][v] + u.s < dis[ind][u.f]){
				ms.erase({dis[ind][u.f] , u.f});
				dis[ind][u.f] = dis[ind][v] + u.s;
				cnt[ind][u.f] = cnt[ind][v];
				ms.insert({dis[ind][u.f] , u.f});
			}
			else if(dis[ind][v] + u.s == dis[ind][u.f]){
				cnt[ind][u.f] += cnt[ind][v];
				cnt[ind][u.f] %= M;
			//	(cnt[ind][u.f] >= M ? cnt[ind][u.f] -= M : cnt[ind][u.f] = cnt[ind][u.f]);
			}
		}
	}
	return;
}
int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
 	cout.tie(0);
	cin >> n >> m >> s >> t;
	s--, t--;
	int u, v, w;
	for(int i = 0; i < m; i++){
		cin >> u >> v >> w;
		u--, v--;
		ad[u].pb({v , w});
		ad[v].pb({u , w});
		ed.pb({{u , v} , w});
	}
	dij(s , 0);
	dij(t , 1);
	int sum = cnt[0][t] * cnt[1][s] % M;
	for(int i = 0; i < n; i++){
		if(dis[0][i] == dis[1][i] && dis[0][i] + dis[1][i] == dis[0][t]){
			sum += M - cnt[0][i] * cnt[0][i] % M * cnt[1][i] % M * cnt[1][i] % M;
			sum %= M;
		//	(sum >= M ? sum -= M : sum = sum);
		}
	}
	for(auto u : ed){
		if (dis[0][u.f.f] > dis[0][u.f.s]) 
			swap(u.f.f , u.f.s);
		if(dis[0][u.f.f] + dis[1][u.f.s] + u.s == dis[1][s] && dis[0][u.f.f] < dis[1][s] / 2 && dis[1][u.f.s] < dis[1][s] / 2){
			sum += M - cnt[0][u.f.f] * cnt[0][u.f.f] % M * cnt[1][u.f.s] % M * cnt[1][u.f.s] % M;
			sum %= M;
		//	(sum >= M ? sum -= M : sum = sum);

		}
	}
	cout << sum << endl;
	return 0;
}



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

int main() {
  int N;
  cin >> N;
  vector<int> vec(N);
  
  for (int i = 0;i < N;i++) {
    cin >> vec.at(i);
  }
  
  for (int i = 0;i < N;i++) {
    for (int j = 0;j < N - 1;j++) {
      if (vec.at(j) < vec.at(j + 1)) {
        int a = vec.at(j);
        vec.at(j) = vec.at(j + 1);
        vec.at(j + 1) = a;
      }
    }
  }
  
  int sum = 1;
  for (int i = 0;i < N - 1;i++) {
    if (vec.at(i) != vec.at(i + 1)) {
      sum++;
    }
  }
  
  cout << sum << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<numeric>
#include<utility>

using namespace std;

typedef long long int ll;
const int INF = 1<<30;
const long long LINF = 1LL<<60;

int main(){
    int a, p, ans = 0;
    cin >> a >> p;
    ans = (3 * a + p) / 2;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

#define MAX 10000
#define NIL -1

typedef struct { int parent, left, right;} Node;

Node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u,int d) {
	if(u == NIL) return;
	D[u] = d;
	setDepth(T[u].left, d+1);
	setDepth(T[u].right,d+1);
}

int setHeight(int u) {
	int h1 = 0, h2 = 0;
	if(T[u].left != NIL)
		h1 = setHeight(T[u].left)  + 1;
	if(T[u].right != NIL)
		h2 = setHeight(T[u].right) + 1;
	return H[u] = (h1 > h2 ? h1 : h2);
}

// 接点 u の兄弟を返す
int getSibling(int u) {
	if(T[u].parent == NIL) return NIL;
	if(T[T[u].parent].left != u && T[T[u].parent].left != NIL )
		return T[T[u].parent].left;
	if(T[T[u].parent].right != u && T[T[u].parent].right != NIL )
		return T[T[u].parent].right;
	return NIL;
}

void print(int u) {
	int deg = 0;
	printf("node %d: ",u);
	printf("parent = %d, ",T[u].parent);
	printf("sibling = %d, ",getSibling(u));
	if(T[u].left  != NIL) deg++;
	if(T[u].right != NIL) deg++;
	printf("degree = %d, ",deg);
	printf("depth = %d, ",D[u]);
	printf("height = %d, ",H[u]);
	
	if(T[u].parent == NIL) {
		printf("root\n");
	} else if(T[u].left == NIL && T[u].right == NIL) {
		printf("leaf\n");
	} else {
		printf("internal node\n");
	}
}

int main(void) {
	int i, v, l, r, root = 0;
	scanf("%d",&n);
	for(i=0;i<n;i++) T[i].parent = NIL;
	for(i=0;i<n;i++) {
		scanf("%d %d %d",&v,&l,&r);
		T[v].left  = l;
		T[v].right = r;
		if(l != NIL) T[l].parent = v;
		if(r != NIL) T[r].parent = v;
	}
	
	for(i=0; i<n; i++)
	if(T[i].parent == NIL) root = i;
	
	setDepth(root,0);
	setHeight(root);
	
	for(i=0;i<n;i++) print(i);
	
	return 0;
}



Measured memory_bytes: 2076
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

vector<ll> G[300];

int main() {
    string s,t;
    cin >> s >> t;
    ll n = s.size();
    ll m = t.size();

    rep(i,s.size()){
        ll ii = i;
        G[(int)s[i]].push_back(ii);
        G[(int)s[i]].push_back(ii+n);
    }

    rep(i,300){
        sort(G[i].begin(), G[i].end());
    }

    ll ans = 0;

    rep(i,m){
        int x = (int)t[i];
        ll aa = ans % n;
        auto ite = lower_bound(G[x].begin(), G[x].end(), aa);
        if(G[x].size()==0){
            cout << "-1" << endl;
            return 0;
        }else{
            ll tmp;
            /*
            rep(j,G[x].size()){
                if(aa <= G[x][j]){
                    tmp = G[x][j];
                    break;
                }
            }
            */
            ans += *ite;
            ans -= aa;
            ans++;
        }
    }

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


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

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n)  FOR(i, 0, n)
#define ASC(c) sort((c).begin(), (c).end())
#define DESC(c) sort((c).begin(), (c).end(), greater<int>())

#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

typedef long long ll;
typedef unsigned long long ull;
struct edge { int u, v; ll w; };
 
ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
    int n; cin >> n;
    int d, x; cin >> d >> x;
    vector<int> a(n);
    REP(i, n) cin >> a[i];

    int ans = 0;
    REP(i, n) {
        ans += 1;
        for (int k = 1; (k * a[i] + 1) <= d; k++ ) ans++;
    }
    cout << ans + x << endl;
}


Measured memory_bytes: 504
#include <bits/stdc++.h>
 
using namespace std;
 
#define repr(i,a,b) for (int i=a; i<b; i++)
#define rep(i,n) for (int i=0; i<  n; i++)
 
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
 
const long long INF = 1LL << 60;
#define PI 3.14159265359 
 
template<typename T>
void remove(std::vector<T>& vector, unsigned int index)
{
    vector.erase(vector.begin() + index);
}
 
int gcd(int a, int b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}
 
long long lcm (int a, int b){
    return  (long long) a*b /gcd(a,b);
}



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

    vector<long long>A(N+1);
    rep(i,N)cin >> A[i+1];

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


}


Measured memory_bytes: 4792
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            long[] a = new long[n];
            long[] b = new long[n];
            long s = 0;
            for (int i = 0; i < n; ++i) {
                a[i] = in.nextInt();
            }
            for (int i = 0; i < n; ++i) {
                b[i] = in.nextInt();
                s += b[i];
                s -= a[i];
            }
            if (s < 0) {
                out.println("No");
                return;
            }
            long twos = s;
            long ones = s;
            for (int i = 0; i < n; ++i) {
                if ((b[i] - a[i]) % 2 != 0) {
                    --ones;
                    ++b[i];
                }
                if (a[i] < b[i]) {
                    twos -= (b[i] - a[i]) / 2;
                } else {
                    ones -= a[i] - b[i];
                }
            }
            if (twos < 0 || ones < 0) {
                out.println("No");
            } else {
                out.println("Yes");
            }
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 27820
w,h,n=gets.split.map &:to_i
x=[]
y=[]
a=[]
n.times{
    unko=gets.split.map(&:to_i)
    x<<unko[0]
    y<<unko[1]
    a<<unko[2]
}
lx=0
ux=w
ly=0
uy=h
a.each_with_index{|j,i|
    if j==1
        lx=[lx,x[i]].max
    elsif j==2
        ux=[ux,x[i]].min
    elsif j==3
        ly=[ly,y[i]].max
    else
        uy=[uy,y[i]].min
    end
}
w=ux-lx
h=uy-ly
if w<0||h<0
    p 0
else
    p w*h
end

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
using UL = unsigned long;
using ULL = unsigned long long;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)

struct Problem {

    void Solve() {
        double x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
        double dx = x1 - x2, dy = y1 - y2;
        cout << sqrt(dx * dx + dy * dy) << endl;
    }
};
int main() {
    unique_ptr<Problem> p(new Problem());
    cout << fixed << setprecision(10);
    p->Solve();
    return 0;
}



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

void bubbleSort(int numbers[], int array_size)
{
  int i, j, temp;

  for (i = 0; i < (array_size - 1); i++) {
    for (j = (array_size - 1); j > i; j--) {
      if (numbers[j-1] > numbers[j]) {
        temp = numbers[j-1];
        numbers[j-1] = numbers[j];
        numbers[j] = temp;
      }
    }
  }
}

int main(){
  int A[3];
  for(int i=0;i<3;i++)cin>>A[i];
  bubbleSort(A,3);
  int x;
  x = A[2]*10+A[1]+A[0];
  cout<<x;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#define ll long long

const ll MOD = 1e9+7;
const int MAX = 2e5+10;
ll a[MAX], pre[MAX];

int main(){
    int n; scanf("%d", &n);
    for (int i = 0; i < n; i++){
        scanf("%lld", &a[i]);
        if (i == 0) {pre[i] = a[i]; continue;}
        pre[i] = a[i] + pre[i-1];
    }
    ll ans = 0, sum = 0;
    for (int i = 0; i < n-1; i++){
        sum = pre[n-1] - pre[i];
        ans = ans+(sum%MOD*a[i]%MOD)%MOD;
    }
    printf("%lld\n", ans%MOD);
    return 0;
}


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

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

    vector<pair<int, int> > cnt_even(100100), cnt_odd(100100);
    for (int i = 0; i < 100100; i++) {
        cnt_even[i].first = 0;
        cnt_even[i].second = i;
        cnt_odd[i].first = 0;
        cnt_odd[i].second = i;
    }
    for (int i = 0; i < n; i++) {
        if (i % 2 == 0) cnt_even[v[i]].first++;
        else cnt_odd[v[i]].first++;
    }
    sort(cnt_even.begin(), cnt_even.end(), greater<pair<int, int> >());
    sort(cnt_odd.begin(), cnt_odd.end(), greater<pair<int, int> >());

    int res = 100100;
    if (cnt_even[0].second == cnt_odd[0].second) {
        res = min(n - cnt_even[0].first - cnt_odd[1].first, n - cnt_even[1].first - cnt_odd[0].first);
    }
    else {
        res = n - cnt_even[0].first - cnt_odd[0].first;
    }

    /*
    for (int i = 0; i < 100100; i++) {
        cout << cnt_even[i].first << " " << cnt_odd[i].first << endl;
    }
    cout << endl;
    */

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

Measured memory_bytes: 2176
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
a.sort()
pre=0
ans=0
count=0
for i in a:
    if pre==i:
        count+=1
    else:
        if count%2==1:
            ans+=1
        pre=i
        count=1
    
if count%2==1:
    ans+=1

print(ans)



Measured memory_bytes: 7388
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <sstream>
#include <set>
#include <tuple>
#include <algorithm>
#include <memory>
#include <numeric>
#include <queue>
#include <functional>
#include <cmath>
#include <cstring>
#include <map>
#include <unordered_map>
#include <sstream>
#include <iomanip>

using namespace std;
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;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

const ll INF = 1LL << 60;
const ll MOD = 1000000007;

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

	ll L, R, d;
	cin >> L >> R >> d;

	ll ans = 0;
	for (ll i = L; i <= R; ++i)
	{
		if (i % d == 0) ans++;
	}

	cout << ans << endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <algorithm> // swap, sort, min, max,
#include <vector>
#include <utility> // pair<int, int>(x, y)
#define FOR(i, a, b) for(int i=(a); i<b; i++)
using namespace std;
typedef unsigned long ul;
typedef long long int ll;

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

  int n, q;
  cin >> n >> q;

  string s, s_;
  cin >> s;

  int l[q], r[q];
  FOR(i, 0, q){
    cin >> l[i] >> r[i];
  }

  int num = 0;
  int snum[n];
  snum[0]=0;
  FOR(j, 0, n-1){
    if(s[j]=='A' && s[j+1]=='C'){
      num++;
    }
    snum[j+1] = num;
  } // ACACTACG = 01122233

  FOR(i, 0, q){
    cout << snum[r[i]-1]-snum[l[i]-1] << "\n";
  }

  return 0;
}


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

int main() {
	int A, B;
	cin >> A >> B;
	cout << max(max(A + B, A - B), A * B);
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり
また、コンテスト後に https://31536000.hatenablog.com/ で解説していると思うので、良かったら読んでねー

やるだけ
*/

Measured memory_bytes: 384