akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vvvi = vector<vector<vector<int>>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;
using vs = vector<string>;
using vb = vector<bool>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
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;}
template<class T> inline void prn(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << ' ';}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); if (n == 0) cout << endl; REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
template<class T> inline void printvv(vector<vector<T>>& v) {for (auto u : v) printv(u);}
template<class T> inline void printlnv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << endl;}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int w, h, n;
    cin >> w >> h >> n;
    int tx = w;
    int ty = h;
    int bx = 0;
    int by = 0;
    int x, y, a;
    REP(i, n) {
        cin >> x >> y >> a;
        if (a == 1) chmax(bx, x);
        else if (a == 2) chmin(tx, x);
        else if (a == 3) chmax(by, y);
        else if (a == 4) chmin(ty, y);
    }
    if (tx - bx > 0 and ty - by > 0) cout << (tx - bx) * (ty - by) << endl;
    else cout << 0 << endl;
}


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


public class Main{
    static long MOD = 1000000007;
    static long dp[][] = new long[21][1 << 21];
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        // Start writing your solution here. -------------------------------------
        long MOD = 1000000007;
        //int t = sc.nextInt();
        int t = 1;
        while(t -- > 0)
        {
            int n = sc.nextInt();
            int a[][] = new int[n][n];
            for(int i = 0; i < n; i++)
                for(int j = 0; j < n; j++)
                    a[i][j] = sc.nextInt();
            for(int i = 0; i < n; i++)
                Arrays.fill(dp[i], -1l);
            long res = Main.solve(0, a, (1 << n) - 1);
            out.println(res);
            //for(int ii = 0; ii <= n; ii++) System.out.println(Arrays.toString(dp[ii]));
        }
        out.close();
    }
    public static long solve(int m, int[][] a, int state){
        int n = a.length;
        if(m >= n) return 1l;
        if(dp[m][state] != -1) return dp[m][state];
        if(state == 0) return 1l;
        long res = 0l;
        for(int i = 0;i < n; i++)
            if(a[m][i] == 1 && ((state & (1 << i)) > 0))
                res = (res + solve(m + 1, a, state ^ (1 << i))) % MOD;
        return dp[m][state] = res;
    }
    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;
    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
    //--------------------------------------------------------
}

Measured memory_bytes: 369236
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, result;
  string op;
  while(1) {
    cin >> a >> op >> b;
    if (op == "+") {
      cout << a + b << endl; 
    } else if (op == "-") {
      cout << a - b << endl; 
    } else if (op == "*") {
      cout << a * b << endl; 
    } else if (op == "/") {
      cout << a / b << endl; 
    } else if (op == "?") {
      break;
    }
  }
}


Measured memory_bytes: 3152
a,b = STDIN.gets.chomp.split.map{|s| s.to_f}
m = (a+b) / 2

m_int = m.to_i
m_small = m - m_int
tmp = (m_small * 10).to_i 
if tmp >= 5
  puts m_int+1
else
  puts m_int
end



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

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >
# define PQ priority_queue

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvs vector < vs >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";
# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);

# define fr(a,b) for(int i = a; i < b; i++)
# define rep(i,a,b) for(int i = a; i < b; i++)

string vow = "aeiou";
int month[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

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

const ld pie = 3.1415926535897932384626 ;
const ll mod = 1e9 + 7 ;

void solve(){

   string s;
   cin >> s;
    int n = s.size();
   int dp[1000000]={0};
   dp[0] = 1;
   for(int i = 0;i<n;i++){
    if(dp[i]==0) continue;
    if(i+5<=n && s.substr(i,5) == "dream") dp[i+5] = 1;
    if(i+7<=n && s.substr(i,7) == "dreamer") dp[i+7] = 1;
    if(i+6<=n && s.substr(i,6) == "eraser") dp[i+6] = 1;
    if(i+5<=n && s.substr(i,5) == "erase") dp[i+5] = 1;


    }

    if(dp[n]==1) cout << "YES";
    else cout << "NO";
   line
    return;

}

int main(){
	fast
	int tc=1;
	//cin >> tc;
	while(tc--){
             solve();
    }

	R 0;
}


Measured memory_bytes: 7628
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
#define RREP(i, n) for(int (i)=(n)-1; (i)>=0; (i)--)
#define ios() cin.tie(0), ios::sync_with_stdio(false)
typedef long long ll;
typedef unsigned long long ull;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

int main(){
    ll n;
    cin >> n;
    ll ans = n / 11 * 2;
    n %= 11;
    if(n > 0) ans++;
    if(n > 6) ans++;
    cout << ans << endl; 
    return 0;
}

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

int main()
{
    long long int x,k,d;
    cin>>x>>k>>d;
    
    if(x==0)
    {
        if(k%2==0)
            cout<<0;
        else cout<<d;    
    }
    else
    {
        if(k<abs(x)/d)
            cout<<min(abs(x+k*d),abs(x-k*d))<<endl;
        else
        {
            long long int c = abs(x)/d;
            if((k-c)%2==0)
                cout<<abs(x)%d;
            else cout<<min(abs(abs(x)%d+d),abs(abs(x)%d-d));    
        }
    }
    /*
        while(k--)
        {
            if(abs(x-d)>abs(x+d))
                x = x+d;
            else x = x-d;
            //cout<<x<<endl;
        }
        cout<<abs(x);
    */
}   

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

typedef long long ll;

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

    double pi = 3.1415926535897;
    int R;
    cin >> R;

    cout << 2 * pi * R << "\n";
}


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

int main() {
    string a, b;
    cin >> a >> b;
    float c = stoi(a  + b );
    c = sqrt(c);
    if(c - (int)c == 0)
    {
     cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
//Author rahuliitkgp

/*A thing of beauty is a joy forever,
Its loveliness increases,
it will never pass into nothingness.*/
//Men at Work :)

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef long long int ll;

#define setbits(x)      __builtin_popcountll(x)
#define mod             1000000007
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define INF (int)1e9 + (int)1e8
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

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

void cpp(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

ll dp[401][401];

ll helper(ll s, ll e, vector<ll>& prefix){
    if(s>=e) return 0;
    if(dp[s][e]!=-1) return dp[s][e];
    ll x = prefix[e]-prefix[s-1];
    ll temp = LLONG_MAX;
    for(ll i=s; i<=e-1; i++){
        temp = min(temp, helper(s, i, prefix)+helper(i+1, e, prefix));
    }
    x+=temp;
    return dp[s][e]=x;
}

int main(){
    cpp();
    ll n;
    cin>>n;
    memset(dp, -1, sizeof dp);
    vector<ll> prefix(n+1);
    for(ll i=1; i<prefix.size(); i++){
        cin>>prefix[i];
        prefix[i]+=prefix[i-1];
    }
    cout<<helper(1, n, prefix)<<endl;
    return 0;
}






Measured memory_bytes: 4888
r, c = (int(i) for i in input().split())
table = tuple([int(x) for x in input().split()] for _ in range(r))
for cols in table:
  cols.append(sum(cols))
  print(*cols)
else:
  sums = tuple(sum(table[y][x] for y in range(r)) for x in range(c + 1))
  print(*sums)

Measured memory_bytes: 8308
macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
            get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
            get!($($t),*)
        ).collect::<Vec<_>>()
    };
}

use std::cmp;

fn main() {
    let (a, b, c, d, e, f) = get!(i32, i32, i32, i32, i32, i32);

    let mut rs = 0;
    let mut rw = a;
    for x in 0..31 {
        for y in 0..31 {
            let tw = x*a + y*b;
            for z in 0..tw*e/c+1 {
                if tw*100 + z*c > f { continue; }
                let w = cmp::min((tw*e-z*c)/d, (f-tw*100-z*c)/d);
                let ts = c*z + d*w;
                if ts * (rs+rw) > rs * (tw+ts) {
                    rs = ts;
                    rw = tw;
                }
            }
        }
    }
    println!("{} {}", rw * 100 + rs, rs);
}

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

using namespace std;

using VI = vector<int>;
using VVI = vector<VI>;
using VB = vector<bool>;
using VVB = vector<VB>;
using VS = vector<string>;
using PII = pair<int, int>;
using VPII = vector<PII>;

#define sz(var) (int)var.size()
#define REP(var, start, end) for(int var = start; var < (int)end; ++var)
typedef long long ll;
/*
    problem : http://abc058.contest.atcoder.jp/tasks/arc071_b
*/
int n, m;
const int MOD = 1e9 + 7;
ll calc(int num)
{
	VI A(num);
	REP(i, 0, num) cin >> A[i];

	ll res = 0;
	REP(i, 1, num){
		res = (res+(ll)(A[i]-A[i-1])*i % MOD * (num-i) )%MOD;
	}

	return res;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
#ifndef ONLINE_JUDGE
	
#endif
	cin >> n >> m;


	ll sumX = calc(n), sumY = calc(m);
	
	cout << (sumX * sumY) % MOD << endl;

	return 0;
}

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


int c[3][3],h[2],w[2];

int main()
{
    for(int i=0;i!=3;++i){
        for(int j=0;j!=3;++j){
            cin>>c[i][j];
        }
    }
    for(int i=0;i!=2;++i){
        w[i]=c[0][i]-c[0][i+1];
        h[i]=c[i][0]-c[i+1][0];
    }
    for(int i=0;i!=2;++i){
        for(int j=0;j!=3;++j){
            if(w[i]!=c[j][i]-c[j][i+1]||h[i]!=c[i][j]-c[i+1][j]){
                cout<<"No"<<endl;
                return 0;
            }
        }
    }
    cout<<"Yes"<<endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
public class Main
{
    public static void main(String []args) throws IOException {
    	FastScanner in  = new FastScanner(System.in);
    	PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)), false);
    	solve(in, out);
    	in.close();
    	out.close();
    }
    static long gcd(long a, long b){ return (b==0) ? a : gcd(b, a%b); }
    static int gcd(int a, int b){ return (b==0) ? a : gcd(b, a%b); }
    private static int fact(int n) { int ans=1; for(int i=2;i<=n;i++) ans*=i; return ans; }
    static class FastScanner{
	BufferedReader reader;
	StringTokenizer st;
	FastScanner(InputStream stream){reader=new BufferedReader(new InputStreamReader(stream));st=null;}
	String next(){while(st == null || !st.hasMoreTokens()){try{String line = reader.readLine();if(line == null){return null;}
	     st = new StringTokenizer(line);}catch (Exception e){throw new RuntimeException();}}return st.nextToken();}
	String nextLine()  {String s=null;try{s=reader.readLine();}catch(IOException e){e.printStackTrace();}return s;}
	int    nextInt()   {return Integer.parseInt(next());}
	long   nextLong()  {return Long.parseLong(next());}
	double nextDouble(){return Double.parseDouble(next());}
	char   nextChar()  {return next().charAt(0);}
	int[]  nextIntArray(int n)         {int[] arr= new int[n];   int i=0;while(i<n){arr[i++]=nextInt();}  return arr;}
	long[] nextLongArray(int n)        {long[]arr= new long[n];  int i=0;while(i<n){arr[i++]=nextLong();} return arr;}
	int[]  nextIntArrayOneBased(int n) {int[] arr= new int[n+1]; int i=1;while(i<=n){arr[i++]=nextInt();} return arr;}
	long[] nextLongArrayOneBased(int n){long[]arr= new long[n+1];int i=1;while(i<=n){arr[i++]=nextLong();}return arr;}
	void   close(){try{reader.close();}catch(IOException e){e.printStackTrace();}}
    }
    
    /********* SOLUTION STARTS HERE ************/
    
    private static void solve(FastScanner in, PrintWriter out){
        String s = in.next();
        int n = s.length();
        int mid = n/2;
        if(isPalin(s) && isPalin(s.substring(mid+1,n))) out.println("Yes");
        else out.println("No");
    }
    public static boolean isPalin(String s){
        int n = s.length();
        for(int i=0;i<n/2;i++){
            if(s.charAt(i)!=s.charAt(n-i-1)) return false;
        }
        return true;
    }
    
    /************* SOLUTION ENDS HERE **********/
}

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

int main() {
  int n;
  cin>>n;
  ll vec[3*n];
  for(int i=0;i<3*n;i++){
    cin>>vec[i];
  }
  sort(vec,vec+3*n);
  reverse(vec,vec+3*n);
  ll ans=0;
  for(int i=1;i<2*n;i+=2){
    ans+=vec[i];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 2560
/*
  NAME : RISHABH SINGH
  INSTITUTION : DELHI TECHNOLOGICAL UNIVERSITY
*/
#include "bits/stdc++.h"
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define int long long
#define pii pair<int, int>
#define bi __builtin_inf()
#define ll long long
#define mp make_pair
#define ss second
#define pb push_back
#define ff first
#define speed_cubing ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define um unordered_map
#define us unordered_set
#define bp __builtin_popcount
#define ld long double
#define rep(n) for (int i = 0; i < n; i++)
#define pll pair<ll, ll>
#define mx = 1e18;
#define lb(v, val) (lower_bound(v.begin(), v.end(), val) - v.begin())
#define ub(v, val) (upper_bound(v.begin(), v.end(), val) - v.begin())
#define PI 3.1415926535
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> pbds;
ll powmod(ll base,ll exp,ll MOD){ll res=1;while(exp>0){if(exp%2==1) res=(res*base)%MOD;base=(base*base)%MOD;exp/=2;}return (res%MOD);}
#define sz(v) (int)v.size()
#define endl '\n'
const int mod = 1e9+7;
ll mul_inv(ll a,ll b = mod) {ll t1=a,t2=b,t3,v1=1,v2=0,v3;while(t2!=1){ll x=t1/t2;t3=t1-x*t2;v3=v1-x*v2;t1=t2,t2=t3;v1=v2,v2=v3;}return(v2+b)%b;}
const int N = 5e5+5;
 
int32_t main(){
   
   speed_cubing
   
   
   int n;
   cin>>n;

   int a[n];
   for(int i=0;i<n;i++)
      cin>>a[i];

   int sum = 0;
   int ans = 0;

   for(int i=0;i<n;i++){
      ans+=sum*a[i];
      ans%=mod;
      sum+=a[i];
      sum%=mod;   
   }   

   cout<<ans;


   return 0;
}

Measured memory_bytes: 5208
#include<stdio.h>

int score(int a){
  if(a < 1200){
  printf("ABC\n");
  }
  else if(a >= 1200 && a < 2800){
  printf("ARC\n");
  } else{
  printf("AGC\n"); 
  }

  return 0;
}

int main(){
  int N;
  scanf("%d",&N);
  score(N);
  return 0;

}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>

using namespace std;

typedef long long ll;

struct node {
    ll x;
    int i, j, k;
    node(ll x, int i, int j, int k): x(x), i(i), j(j), k(k) {}
    bool operator<(node other) const {
        return x < other.x;
    }
};

struct state {
    int i, j, k;
    state(int i, int j, int k):i(i), j(j), k(k) {}
    ll hash() const {
        return 1000000ll * i + 1000 * j + k;
    }
    bool operator<(state other) const {
        return hash() < other.hash();
    }
};

typedef priority_queue<node> pqn;
typedef set<state> ss;

int main() {
    int x, y, z, k;
    cin >> x >> y >> z >> k;
    ll a[x], b[y], c[z];
    for (int i = 0; i < x; i++) {
        cin >> a[i];
    }
    for (int i = 0; i < y; i++) {
        cin >> b[i];
    }
    for (int i = 0; i < z; i++) {
        cin >> c[i];
    }
    sort(a, a+x);
    sort(b, b+y);
    sort(c, c+z);

    pqn q;
    q.push(node(a[x-1] + b[y-1] + c[z-1], x-1, y-1, z-1));
    ss s;
    s.insert(state(x-1, y-1, z-1));
    for (int i = 0; i < k; i++) {
        node t = q.top();
        q.pop();

        cout << t.x << endl;

        if (t.i > 0 && !s.count(state(t.i-1, t.j, t.k))) {
            q.push(node(a[t.i-1] + b[t.j] + c[t.k], t.i-1, t.j, t.k));
            s.insert(state(t.i-1, t.j, t.k));
        }
        if (t.j > 0 && !s.count(state(t.i, t.j-1, t.k))) {
            q.push(node(a[t.i] + b[t.j-1] + c[t.k], t.i, t.j-1, t.k));
            s.insert(state(t.i, t.j-1, t.k));
        }
        if (t.k > 0 && !s.count(state(t.i, t.j, t.k-1))) {
            q.push(node(a[t.i] + b[t.j] + c[t.k-1], t.i, t.j, t.k-1));
            s.insert(state(t.i, t.j, t.k-1));
        }
    }

    return 0;
}


Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;
//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
ll modexpo(ll a,ll b)
{
     ll res=1LL;
     while(b>0)
     {
          if(b&1)res=(res*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return res;
}
 
 
 
 
 
 
 












vector<int> vec[200005];
ll dist[200005];
ll res=0;
void dfs(int node,int par,ll d){
     dist[node]+=d;
     for(int child:vec[node]){
          if(child==par)continue;
          dfs(child,node,dist[node]);
     }
}
int main()
{
    int n;
    cin>>n;
    int q;
    cin>>q;
    for(int i=1;i<n;i++){
         int x,y;
         cin>>x>>y;
         vec[x].push_back(y);
         vec[y].push_back(x);
    }
    while(q--){
         int p1,x1;
         cin>>p1>>x1;
         dist[p1]+=x1;
    }
       dfs(1,-1,0);
    for(int i=1;i<=n;i++){
         cout<<dist[i]<<" ";
    }

}























Measured memory_bytes: 24320
import java.util.HashSet;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        
        var sc = new Scanner(System.in);
    
        int x = Integer.parseInt(sc.next());
        int n = Integer.parseInt(sc.next());
        var set = new HashSet<Integer>();
        for(int i = 0; i < n; i++){
            set.add(Integer.parseInt(sc.next()));
        }
        
        int a = x;
        while(set.contains(a)){
            a--;
        }
        int b = x;
        while(set.contains(b)){
            b++;
        }
        if(x-a <= b-x){
            System.out.println(a);
        }else{
            System.out.println(b);
        }
    }
}

Measured memory_bytes: 35860
n = int(input())
a = list(map(int,input().split()))
b = [0]*n
b[1] = abs(a[1]-a[0])
for i in range(2,n):
    b[i]=min(b[i-2]+abs(a[i-2]-a[i]), b[i-1]+abs(a[i-1]-a[i]))
print(b[n-1])

Measured memory_bytes: 13980
H = int(input())
W = int(input())
N = int(input())
ans = 0
painted_mas = 0


def min_raw():
    if H > W:
        return W
    elif W >= H:
        return H


def max_raw():
    if H > W:
        return H
    elif W >= H:
        return W


for i in range(min_raw()):
    ans += 1
    painted_mas += max_raw()
    if N <= painted_mas:
        print(ans)
        break


Measured memory_bytes: 3060
n,m=map(int,input().split())
stu=[list(map(int,input().split())) for _ in range(n)]
cp=[list(map(int,input().split())) for _ in range(m)]
for x1,y1 in stu:
    dist=10**18
    num=0
    for i in range(m):
        x2,y2=cp[i]
        if dist>abs(x1-x2)+abs(y1-y2):
            dist=abs(x1-x2)+abs(y1-y2)
            num=i
    print(num+1)

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

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

int main() {
    string s; cin >> s;
    int N = s.size();
    rep(i,N){
        cout << 'x';
    }
    cout << endl;
}

Measured memory_bytes: 256
n = gets.to_i
n.times do |i|
  s = gets.to_i
  puts "Case #{i+1}:"

  10.times do
    str = (s**2).to_s
    str = "0" * (8-str.length) + str
    s = str[2,4].to_i
    puts s
  end
end

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

#define int long long

#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define REP1(i, s, cond, cal) for (signed i = signed(s); i cond; i cal)
#define REP2(i, s, n) REP1(i, s, < signed(n), ++)
#define REP3(i, n) REP2(i, 0, n)
#define rep(...) CHOOSE((__VA_ARGS__,REP1,REP2,REP3))(__VA_ARGS__)
#define rrep(i, s) rep(i, s, >= 0, --)

#define all(c) begin(c), end(c)
template<typename T>bool maxup(T& a, T&& b) { if (a < b) { a = b; return true; }; }
template<typename T>bool maxup(T& a, T& b) { if (a < b) { a = b; return true; }; }
template<typename T>bool minup(T& a, T&& b) { if (a > b) { a = b; return true; }; }
template<typename T>bool minup(T& a, T& b) { if (a > b) { a = b; return true; }; }

#define X first
#define Y second

using VV = vector<vector<int>>;
using V = vector<int>;
using P = pair<int, int>;
using IP = pair<int, P>;

template<typename T>
inline void input(vector<T>& v) { for (auto& x : v) cin >> x; }

int dp[65][3];
signed main() {
	const int mod = 1e9 + 7;
	int N; cin >> N;
	dp[0][0] = 1;
	int b = log2(N);
	for (int i = 0; i <= b; i++) rep(j, 3) {
		if (N >> (b - i) & 1) {
			(dp[i + 1][min(j * 2 + 1, 2)] += dp[i][j]) %= mod;
			(dp[i + 1][min(j * 2, 2)] += dp[i][j]) %= mod;
			if (j * 2 - 1 >= 0)(dp[i + 1][min(j * 2 - 1, 2)] += dp[i][j]) %= mod;
		} else {
			(dp[i + 1][min(j * 2, 2)] += dp[i][j]) %= mod;
			if (j * 2 - 1 >= 0) (dp[i + 1][min(j * 2 - 1, 2)] += dp[i][j]) %= mod;
			if (j * 2 - 2 >= 0) (dp[i + 1][min(j * 2 - 2, 2)] += dp[i][j]) %= mod;
		}
	}
	cout << (dp[b + 1][0] + dp[b + 1][1] + dp[b + 1][2]) % mod << endl;
	system("pause");
}

Measured memory_bytes: 756
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>
#include <queue>

using namespace std;

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

struct State{
    int cost;
    int x, y;
    int dir;  
};

bool operator< (const State& lhs, const State& rhs){
    return (lhs.cost < rhs.cost);
}

bool operator> (const State& lhs, const State& rhs){
    return (lhs.cost > rhs.cost);
}

State getNextState(State state, int process){
    State ret;
    
    if(process == 0){
        ret.dir = state.dir;
    }
    else if(process == 1){
        ret.dir = (state.dir + 1) % 4;
    }
    else if(process == 2){
        ret.dir = (state.dir + 2) % 4;
    }
    else if(process == 3){
        ret.dir = (state.dir + 3) % 4;
    }

    ret.cost = state.cost;
    ret.x = state.x + dx[ret.dir];
    ret.y = state.y + dy[ret.dir];

    return ret;
}

const int INF = 1e9;

bool used[30][30][4];
int cost[30][30][4];

int main(){

    while(true){
        int w, h;
        cin >> w >> h;
        if(w == 0){
            break;
        }

        vector<vector<int>> s(h, vector<int>(w));

        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                cin >> s[i][j];
            }
        }

        vector<int> c(4);
        for(int i = 0; i < 4; i++){
            cin >> c[i];
        }

        for(int i = 0; i < h; i++){
            for(int j = 0; j < w; j++){
                for(int k = 0; k < 4; k++){
                    cost[i][j][k] = INF;
                    used[i][j][k] = false;
                }
            }
        }

        priority_queue<State, vector<State>, greater<State>> q;
        State startState;
        startState.cost = 0;
        startState.dir = 0;
        startState.x = 0;
        startState.y = 0;
        q.push(startState);
        cost[0][0][0] = 0;

        while(!q.empty()){
            State state = q.top();
            q.pop();

            if(used[state.y][state.x][state.dir]){
                continue;
            }

            used[state.y][state.x][state.dir] = true;

            int process = s[state.y][state.x];

            for(int i = 0; i < 4; i++){
                State nextState = getNextState(state, i);

                if(i != process){
                    nextState.cost += c[i];
                }

                if(0 <= nextState.x && nextState.x < w && 0 <= nextState.y && nextState.y < h){
                    if(!used[nextState.y][nextState.x][nextState.dir] && nextState.cost < cost[nextState.y][nextState.x][nextState.dir]){
                        cost[nextState.y][nextState.x][nextState.dir] = nextState.cost;
                        q.push(nextState);
                    }
                }
            }
        }

        int ans = INF;
        for(int i = 0; i < 4; i++){
            ans = min(ans, cost[h - 1][w - 1][i]);
        }
    
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3144
#![allow(non_snake_case)]
#![allow(dead_code)]
#![allow(unused_macros)]
#![allow(unused_imports)]

use std::str::FromStr;
use std::io::*;
use std::collections::*;
use std::cmp::*;

struct Scanner<I: Iterator<Item = char>> {
    iter: std::iter::Peekable<I>,
}

macro_rules! exit {
    () => {{
        exit!(0)
    }};
    ($code:expr) => {{
        if cfg!(local) {
            writeln!(std::io::stderr(), "===== Terminated =====")
                .expect("failed printing to stderr");
        }
        std::process::exit($code);
    }}
}

impl<I: Iterator<Item = char>> Scanner<I> {
    pub fn new(iter: I) -> Scanner<I> {
        Scanner {
            iter: iter.peekable(),
        }
    }

    pub fn safe_get_token(&mut self) -> Option<String> {
        let token = self.iter
            .by_ref()
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        if token.is_empty() {
            None
        } else {
            Some(token)
        }
    }

    pub fn token(&mut self) -> String {
        self.safe_get_token().unwrap_or_else(|| exit!())
    }

    pub fn get<T: FromStr>(&mut self) -> T {
        self.token().parse::<T>().unwrap_or_else(|_| exit!())
    }

    pub fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.get()).collect()
    }

    pub fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }

    pub fn char(&mut self) -> char {
        self.iter.next().unwrap_or_else(|| exit!())
    }

    pub fn chars(&mut self) -> Vec<char> {
        self.get::<String>().chars().collect()
    }

    pub fn line(&mut self) -> String {
        if self.peek().is_some() {
            self.iter
                .by_ref()
                .take_while(|&c| !(c == '\n' || c == '\r'))
                .collect::<String>()
        } else {
            exit!();
        }
    }

    pub fn peek(&mut self) -> Option<&char> {
        self.iter.peek()
    }
}

trait Joinable {
    fn join(self, sep: &str) -> String;
}

impl<U: ToString, T: Iterator<Item = U>> Joinable for T {
    fn join(self, sep: &str) -> String {
        self.map(|x| x.to_string()).collect::<Vec<_>>().join(sep)
    }
}
fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin.bytes().map(|c| c.unwrap() as char));
    let N: usize = sc.get();
    let d: Vec<usize> = sc.vec(N);
    let mut ans = 0;
    let mut cnt = 0;
    for i in 0..N-1 {
        for j in i+1..N {
            ans += d[i] * d[j];
            cnt += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4476
#include <stdio.h>
int main(void)
{
	int a[10],i,j,escape=0;

	
	for(i=0;i<10;i++)
	{
		scanf("%d",&a[i]);
	}
	
	for(i=0;i<100;i++)
	{
		for(j=0;j<9;j++)
		{
			if(a[j]<a[j+1])
			{
				escape=a[j];
				a[j]=a[j+1];
				a[j+1]=escape;
			}
		}
	}printf("%d\n%d\n%d\n",a[0],a[1],a[2]);
	return 0;
}

Measured memory_bytes: 600
from collections import deque
from heapq import heappush,heappop
import re

def int_raw():
    return int(input())

def ss_raw():
    return input().split()

def ints_raw():
    return list(map(int, ss_raw()))

INF = 1<<29



def main():
    N, M = ints_raw()
    rower = 1
    higher = N
    for _ in range(M):
        l,r = ints_raw()
        rower = max(l,rower)
        higher = min(higher,r)
    return max(higher-rower+1,0)
            
print(main())


Measured memory_bytes: 48104
#include <iostream>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	int n,k;
	while( cin >> k >> n , k){
		int no = 0,ret = 0;
		int data[100000] = {0};
		int memo[100000] = {0};
		rep(i,n){
			int c; cin >> c;
			if(!c)no++;
			else data[c-1] = 1;
		}
		rep(i,k){
			if(i)memo[i] = memo[i-1];
			if(!data[i])memo[i] += 1;
//			cout << memo[i] << endl;
		} 
		int l = 0, h = 0;
		while(h < k){
//			cout << l << " " << h << endl;
			int d; if(l == 0)d = 0; else d = memo[l-1];
			
			if(memo[h]-d <= no){
//				cout << ">" << memo[h]-memo[l] << endl;
//				cout << " nokori :" << h-l+1 << endl;
				ret = max(ret,h-l+1);
				h++;
			}else{
				l++;
			}
		}
		cout << ret << endl;
	}
}

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

int main() {
	std::ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	vector<bool> found(int(1e6) + 1);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	sort(a.begin(), a.end());
	int ans = 0;
	for (int i = 0; i < n; i++) {
		if (found[a[i]]) {
			continue;
		}
		for (int j = a[i]; j <= int(1e6); j += a[i]) {
			found[j] = true;
		}
		if (i >= n - 1 || a[i] != a[i + 1])
			ans++;
	}
	cout << ans << '\n';
}



Measured memory_bytes: 4316
//
//  main.cpp
//  project for C++
//
//  Created by 伊藤博隆 on 2020/04/17.
//  Copyright © 2020 伊藤博隆. All rights reserved.
//

#include <iostream>
#include<set>
#include<string>
#include <sstream>
#include <algorithm>
#include <math.h>

using namespace std;
long int x;



long ans;

int main(){
    
    cin >> x;
    long int now = 100;
    double r = 1.01;
   
    for(long i=1;i<10000000;i++){
        now = now * r;
        if (now >= x) {
            ans = i;
            break;
        }
          
    }
            
        
    
   cout << ans << endl;
    
    
    return 0;
}




Measured memory_bytes: 3160
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)n; ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
static const int MAX = 10000;
int n;
int p[41];
int t[41];
int memo[100][5];
int dfs(int k, int bals){
  if(k > n) return (bals)?p[k-1]:0;
  if(memo[k][bals] != -1) return memo[k][bals];
  int pos = p[k-1];
  int time = t[k-1];
  int ret = MAX + k;
  if(bals == 0){
    int needtime = abs(pos-p[k]) * (bals+1);
    if(needtime + time <= t[k]) {
      int d = dfs(k+1, bals + 1);
      if(d < MAX) ret = d + abs(pos-p[k]);
      else ret = d;
    }
  }else if(bals == 3){
    int needtime = pos * (bals+1) + p[k];
    if(needtime + time <= t[k]){
      int d = dfs(k+1, 1);
      if(d < MAX) ret = d + pos + p[k];
      else ret = d;
    }
  }else{
    int need1 = abs(pos-p[k]) * (bals+1);
    int need2 = pos * (bals+1) + p[k];
    if(need1 + time <= t[k]){
      int d = dfs(k+1, bals + 1);
      if(d < MAX) ret = min(ret,d + abs(pos-p[k]));
      else ret = max(ret,d);
    }
    if(need2 + time <= t[k]){
      int d =  dfs(k+1,1);
      if(d < MAX) ret = min(ret,d + pos + p[k]);
      else ret = max(ret,d);
    }
  }
  return memo[k][bals] = ret;
}

int main(){
  while( cin>>n,n){
    REP(i,n)cin>>p[i+1]>>t[i+1];
    memset(memo, -1, sizeof(memo));
    int ans = dfs(1,0);
    if(ans > MAX) printf("NG %d\n",ans-MAX);
    else printf("OK %d\n",ans);
  }
  return 0;
}

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

int main() {
	int h, r; scanf("%d%d", &h, &r);
	if (h + r > 0)puts("1");
	else if (h + r == 0)puts("0");
	else puts("-1");
}

Measured memory_bytes: 3124
H, W = map(int, input().split())
S = ['.'*(W+1)] + ['.'+input() for h in range(H)]

dp = [[float('inf')]*(W+1)] + [[float('inf')] + [0]*W for h in range(H)]
dp[0][1] = dp[1][0] = 0
for h in range(1, H+1):
  for w in range(1, W+1):
    if S[h][w] == '.':
      dp[h][w] = min(dp[h][w-1], dp[h-1][w])
    else:
      if S[h][w-1] == S[h-1][w] == '.':
        dp[h][w] = min(dp[h-1][w], dp[h][w-1]) + 1
      elif S[h][w-1] == '#' and S[h-1][w] == '.':
        dp[h][w] = min(dp[h][w-1], dp[h-1][w]+1)
      elif S[h][w-1] == '.' and S[h-1][w] == '#':
        dp[h][w] = min(dp[h][w-1]+1, dp[h-1][w])
      else:
        dp[h][w] = min(dp[h][w-1], dp[h-1][w])

print(dp[H][W])


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

int main(){
    double d,t,s; cin >> d >> t >> s;
    if(ceil(d/s) <= t) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int n, m, l;
int d[310], a[310], k[310], t[310];
int dp[5][10][50];
int ans = 0;

signed main()
{
  cin >> n >> m >> l;
  for(int i = 0; i < m; i++){
    cin >> d[i] >> a[i] >> k[i] >> t[i];
  }

  for(int i1 = 0; i1 < 5; i1++){
    if(i1 >= 1){
      for(int i3 = 1; i3 <= l; i3++){
	dp[i1][0][i3] = dp[i1 - 1][n][i3];
      }
    }
    for(int i2 = 1; i2 <= n; i2++){

      for(int i3 = 1; i3 <= l; i3++){
	dp[i1][i2][i3] = dp[i1][i2 - 1][i3];
      }
      for(int i3 = 0; i3 < m; i3++){
	if(d[i3] == i1 && a[i3] + k[i3] - 1 == i2){
	  for(int i4 = 1; i4 <= l; i4++){
	    dp[i1][i2][i4] = max(dp[i1][i2][i4], dp[i1][a[i3] - 1][i4 - 1] + t[i3]);
	  }
	}
      }
    }
  }

  for(int i = 1; i <= l; i++){
    ans = max(ans, dp[4][n][i]);
  }
  cout << ans << endl;
  return 0;
}

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

class Main{
    public static void main(String[] args){
      Scanner sc = new Scanner(System.in);
      String An = sc.nextLine();
      String[] max = An.split(" ");
      

      int W = Integer.parseInt(max[0]);
      int H = Integer.parseInt(max[1]);
      int x = Integer.parseInt(max[2]);
      int y = Integer.parseInt(max[3]);
      int r = Integer.parseInt(max[4]);
      
      int A = W - x;
      int B = H - y;
      if (x >= r && y >= r && A >= r && B >= r){
        System.out.println("Yes");
      }else
      System.out.println("No");
  }
}

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

void erase(int* a,int k,int n){
  for(int i=k;i<n-1;i++){
    a[i]=a[i+1];
  }
}

int main(){
  int i,j,cnt=0;
  int n;
  cin>>n;
  int b[n];
  for(i=0;i<n;i++)cin>>b[i];
  for(i=0;i<n;i++){
    if(i+1<b[i]){
      cout<<-1;
      return 0;
    }
  }
  int a[n];
  int m=n;
  while(m!=0){
    for(i=m-1;i>=0;i--){
      if(i+1==b[i]){
        a[cnt]=b[i];
        cnt++;
        erase(b,i,m);
        break;
      }
    }
    m--;
  }
  for(i=0;i<cnt;i++){
    cout<<a[cnt-1-i]<<endl;
  }
}

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

int main() {
  int n, k, c;
  string s;
  cin >> n >> k >> c >> s;

  // 働ける最大日数をカウントする
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    if (s.at(i) == 'o') {
      cnt++;
      i += c;
    }
  }
  if (cnt > k) {
    cout << "" << endl;
    return 0;
  }

  // 必ず働く日を求める
  vector<bool> w(n, false);
  for (int i = n - 1; i >= 0; i--) {
    if (s.at(i) == 'o') {
      w.at(i) = true;
      i -= c;
    }
  }
  for (int i = 0; i < n; i++) {
    if (s.at(i) == 'o') {
      if (w.at(i)) {
        cout << i + 1 << endl;
      }
      i += c;
    }
  }
  return 0;
}

Measured memory_bytes: 3748
#include<bits/stdc++.h>
#include<cmath>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#define R register int
#define mm make_pair
using namespace std;
const int manx=300;
#define LL long long
int a[1000050];
int dis[3005][3005];
int main()
{
   int n, x, y; cin >> n >> x >> y;
   cout << n << endl;
   map<int,int> mp;

   for (int i = 1; i <= n; i ++)
        for (int j = i + 1; j <= n; j ++)
        {
            dis[i][j] = j - i;
            if(i <= x && j >= y) dis[i][j] = min(dis[i][j], x- i + j - y + 1);
            else if(i <= x && j > x && j < y) dis[i][j] = min(dis[i][j], x - i + 1 + y - j);
            else if(i > x && i <= y && j <= y) dis[i][j] = min(dis[i][j], i - x + 1 + y - j);
            else if(i > x && i <= y && j > y) dis[i][j] = min(dis[i][j], i - x + 1 + j - y);
            else  dis[i][j] = min(dis[i][j], j - i);
            mp[dis[i][j]] ++;
        }
    for (int i = 2; i <= n - 1; i ++)
        cout << mp[i] << endl;

   return 0;
}



Measured memory_bytes: 24832
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 1000000000000000002


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

Measured memory_bytes: 4048
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 29 22:19:15 2020

@author: naoki
"""

N = int(input())

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

count1 = 0
count2 = 0
count = 10**9 +7
for i in A:
    count1+=i

for j in A:
    count2 = (j*(count1-j) + count2)%count
    count1 = count1 -j 
    
print(count2%count)
    
    
    

Measured memory_bytes: 31452
N=int(input())

c=[[0]*10 for _ in range(10)]
for k in range(1,N+1):
  n=str(k)
  i=int(n[0])
  j=int(n[-1])
  c[i][j]+=1

ans=0
for i in range(10):
  for j in range(10):
    ans+=c[i][j]*c[j][i]
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
       Scanner sc = new Scanner(System.in);
        while(true) {
            int a = sc.nextInt();
            String op = sc.next();
            int b = sc.nextInt();
            switch (op) {
                case "+":
                    System.out.println(a + b);
                    break;
                case "-":
                    System.out.println(a - b);
                    break;
                case "*":
                    System.out.println(a * b);
                    break;
                case "/":
                    System.out.println(a / b);
                    break;
            }
            if (op.equals("?")) {
                break;
            }
        }
    }
}


Measured memory_bytes: 26232
fn main() {
    let (a, b): (f64, f64) = (read::<f64>(), read::<f64>());
    let (h, m): (f64, f64) = (read::<f64>(), read::<f64>());
    let arc = (30.0 * (h + m / 60.) - 6.0 * m).abs();
    let arc = arc.min(360.0 - arc);
    let rad = arc * std::f64::consts::PI / 180.0;
    println!(
        "{}",
        ((a - b * rad.cos()).powf(2.0) + (b * rad.sin()).powf(2.0)).powf(0.5)
    );
}

// =========
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::process::exit;

fn read<T: std::str::FromStr>() -> T {
    use std::io::Read;
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

// =========


Measured memory_bytes: 2916
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <set>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)

#define REP(i,m,M) for(int i=m; i<M; i++)
#define REPR(i,M,m) for(int i=M; i>m; i—-)
#define REPLL(i,m,M) for(ll i=m; i<M; i++)
#define REPLLR(i,M,m) for(ll i=M; i>m; i—-)
#define ALL(v) v.begin(),v.end()

int par[100000];
int perm[100000];

int find(int n)
{
    if (n==par[n]) return n;
    else return par[n] = find(par[n]);
}

void unite(int n, int m)
{
    par[find(n)] = find(m);
}


int main(int argc, const char * argv[]) {
    int N, M;
    cin >> N >> M;
    for (int n=0; n<N; ++n) {
        cin >> perm[n];
        perm[n]--;
        par[n] = n;
    }
    for (int m=0; m<M; ++m) {
        int x, y;
        cin >> x >> y;
        x--; y--;
        unite(x, y);
    }
    int res=0;
    for (int n=0; n<N; ++n) {
        if (find(n) == find(perm[n])) res++;
    }
    for (int n=0; n<N; ++n) {
        cerr << n << ": " << par[n] << endl;
    }
    cout << res << endl;

    return 0;
}


Measured memory_bytes: 1024
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
#define min(x,y) (x < y ? x : y)
#define max(x,y) (x < y ? y : x)
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
void solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

void solve() {
  ll n; cin >> n;
  bool is_find = false;
  rep(i, n) {
    ll x; cin >> x;
    if (x % 2 == 1) is_find = true;
  }
  if (is_find) {
    cout << "first" << endl;
  }
  else {
    cout << "second" << endl;
  }
}


Measured memory_bytes: 256
#include<cstdio>
using namespace std;
int main()
{
    int n,t,x,y;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d%d%d",&t,&x,&y);
        if(x+y>t)//???,???????????
        {
            printf("No\n");
            return 0;
        }
        if((x+y)%2==0&&t%2==1)//??????????????,?????
        {
            printf("No\n");
            return 0;
        }
        if((x+y)%2==1&&t%2==0)//??
        {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");//????No??return 0?,???????Yes?
    return 0;
}


Measured memory_bytes: 128