akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
#include<set>
#include<vector>
#include<stack>
#include<map>
#include<queue>
#include<deque>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<ctime>
#include<functional>
using namespace std;
#define N 2100
#define M 2000010
#define INF 0x3f3f3f3f3f3f3f3fll
#define ll long long
int n,s,t;
struct Edge
{
    int from,to;
	ll cost,cap;
    Edge(int u,int v,ll ca,ll co):from(u),to(v),cap(ca),cost(co){};
};

struct MCMF
{
    vector<Edge> edges;
    vector<int> G[N];
    int inq[N];
    ll d[N];
    int p[N];
    ll a[N];
    int cnt = 0;
	ll flow = 0,cost = 0;
    void init()
    {
        for(int i=0;i<n;i++)
            G[i].clear();
        edges.clear();
        scanf("%d",&n);
   		s = 2 * n + 5;
    	t = 2 * n + 6;
		ll r1,r2,r3;
    	for(int i = 1; i <= n; i++)
    	{
        	scanf("%lld%lld%lld",&r1,&r2,&r3);
       		addedge(s,i,r3,0);
       		addedge(i, 2 * n + 1,r3,r1 + r2);
       		addedge(i, 2 * n + 2,r3,r1 - r2);
       		addedge(i, 2 * n + 3,r3,-r1 + r2);
       		addedge(i, 2 * n + 4,r3,-r1 - r2);       	
		}
		for(int i = 1; i <= n; i++)
    	{
       		scanf("%lld%lld%lld",&r1,&r2,&r3);
       		addedge(i + n,t,r3,0);
       		addedge(2 * n + 1,i + n,r3,-r1 - r2);
       		addedge(2 * n + 2,i + n,r3,-r1 + r2);
       		addedge(2 * n + 3,i + n,r3,r1 - r2);
       		addedge(2 * n + 4,i + n,r3,r1 + r2);       	
		}   
		printf("%lld",-MincotMaxflow(s,t));
    }

    void addedge(int from,int to,int cap,int cost)
    {
        edges.push_back(Edge(from,to,cap,cost));
        edges.push_back(Edge(to,from,0,-cost));
        int m=edges.size();
        G[from].push_back(m-2);
        G[to].push_back(m-1);
    }

    bool SPFA(int s,int t)
    {
    	//printf("%d %d %d\n",cnt,flow,cost);
        memset(d,0x3f,sizeof(d));
        memset(inq,0,sizeof(inq));
        ++cnt;d[s]=0;inq[s]=cnt;p[s]=0;a[s]=INF;
        queue<int> Q;
        Q.push(s);
        
        while(!Q.empty())
        {
            int u=Q.front();
            Q.pop();
            inq[u] = 0;
            for(int i=0;i<G[u].size();i++)
            {
                Edge& e=edges[G[u][i]];
                if(e.cap && d[e.to]>d[u]+e.cost)
                {
                    d[e.to]=d[u]+e.cost;
                    p[e.to]=G[u][i];
                    a[e.to]=min(a[u],e.cap);
                    if(inq[e.to] != cnt)
                    {
                        inq[e.to] = cnt;
                        Q.push(e.to);
                    }
                }
            }
        }
        return d[t] < INF;
    }
	void update(int s,int t)
	{
		ll f = a[t];
		while(s != t)
		{
			int i = p[t];
            edges[i].cap -= f;
            edges[i ^ 1].cap += f;
            t = edges[i ^ 1].to;
		}
	}
    ll MincotMaxflow(int s,int t)
    {
        ll flow=0,cost=0;
        while(SPFA(s,t))
		{
			flow += a[t];
			cost += a[t] * d[t];
			update(s,t);	
		}
        return cost;
    }
};



int main()
{
	MCMF mcmf;
	mcmf.init();
    return 0;
}


Measured memory_bytes: 1180
class Program
    {
        static void Main(string[] args)
        {
            string[] temp = System.Console.ReadLine().Split('/');
            int year = int.Parse(temp[0]);
            int month = int.Parse(temp[1]);
            int day = int.Parse(temp[2]);
            if (year < 2019) { System.Console.WriteLine("Heisei"); }
            else if(year>2019){ System.Console.WriteLine("TBD"); }
            else
            {
                if (month < 5) { System.Console.WriteLine("Heisei"); }
                else { System.Console.WriteLine("TBD"); }
            }
        }
    }

Measured memory_bytes: 11092
#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.at(i);
	}
	sort(A.begin(), A.end());
	stack<int>ans;
	for (int i = 0; i < N; i++) {
		if (ans.empty()) ans.push(A.at(i));
		else if (ans.top() != A.at(i)) ans.push(A.at(i));
	}
	cout << ans.size() << endl;
}


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

#define INF_LL (int64)1e18
#define INF (int32)1e9
#define REP(i, n) for(int64 i = 0;i < (n);i++)
#define FOR(i, a, b) for(int64 i = (a);i < (b);i++)
#define all(x) x.begin(),x.end()
#define fs first
#define sc second

using int32 = int_fast32_t;
using uint32 = uint_fast32_t;
using int64 = int_fast64_t;
using uint64 = uint_fast64_t;
using PII = pair<int32, int32>;
using PLL = pair<int64, int64>;

const double eps = 1e-10;

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

class UnionFind{
private:
	std::vector<int_fast32_t> par;
	size_t n;

public:
	UnionFind(){}
	UnionFind(size_t n):n(n){
		par.resize(n, -1);
	}

	uint_fast32_t find(uint_fast32_t x){
		return par[x] < 0 ? x : par[x] = find(par[x]);
	}

	size_t size(uint_fast32_t x){
		return -par[find(x)];
	}

	void unite(uint_fast32_t x, uint_fast32_t y){
		x = find(x);
		y = find(y);
		if(x == y) return;
		if(size(x) < size(y)) std::swap(x, y);
		par[x] += par[y];
		par[y] = x;
	}

	bool same(uint_fast32_t x, uint_fast32_t y){
		return find(x) == find(y);
	}
};

const int64 mod = 1e9+7;

int main(void){
	int32 N, M;
	cin >> N >> M;
	vector<int32> idx(N);
	UnionFind uf(N);
	REP(i, N){
		int32 x;
		cin >> x;
		idx[x-1] = i;
	}
	REP(i, M){
		int32 x, y;
		cin >> x >> y; x--; y--;
		uf.unite(x, y);
	}
	int32 res = 0;
	REP(i, N){
		if(uf.same(i, idx[i]))
			res++;
	}
	cout << res << endl;
}


Measured memory_bytes: 1792
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <cstring>
#include <cassert>
#include <list>
#include <map>
#include <unordered_map>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <limits>
using namespace std;
typedef long long          ll;
typedef unsigned long long ull;
typedef long double        ld;
typedef pair<int,int>      pii;
typedef pair<ll,ll>        pll;
typedef vector<int>        vi;
typedef vector<long long>  vll;
#define left(x)		   (x << 1)
#define right(x) 	   (x << 1) + 1
#define mid(l, r) 	   ((l + r) >> 1)
#define mp                 make_pair
#define pb                 push_back
#define all(a)             a.begin(),a.end()
#define debug(x)	   {cerr <<#x<<" = " <<x<<"\n"; }
#define debug2(x, y)       {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<"\n";}
#define debug3(x, y, z)    {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<", "<<#z<<" = "<<z<<"\n";}
#define debug4(x, y, z, w) {cerr <<#x<<" = " <<x<<", "<<#y <<" = " <<y <<", "<<#z<<" = "<<z<<", "<<#w << " = " <<w <<"\n";}
#define ss                 second
#define ff                 first
#define m0(x) 		   memset(x,0,sizeof(x))

template<typename T >T min_ ( T a , T b ) { return a > b ? b : a ; }
template < typename T ,  typename... Ts > T min_( T first , Ts... last ){ return  min_(first, min_(last...)); }
template<typename T >T max_ ( T a , T b ) { return a > b ? a : b ; }
template < typename T ,  typename... Ts > T max_( T first , Ts... last ){ return  max_(first, min_(last...)); }

template<class T, class S> std::ostream& operator<<(std::ostream &os, const std::pair<T, S> &t) {
	os<<"("<<t.first<<", "<<t.second<<")";
	return os;
}
template<typename T> ostream& operator<< (ostream& out, const vector<T>& v) {
    out << "["; size_t last = v.size() - 1; for(size_t i = 0; i < v.size(); ++i) {
    out << v[i]; if (i != last) out << ", "; } out << "]"; return out;
}

ll pwr(ll base, ll p, ll mod){
ll ans = 1; while(p) { if(p&1) ans=(ans*base)%mod; base=(base*base)%mod; p/=2; } return ans;
}
ll gcd(ll a, ll b) {  return b == 0 ? a : gcd(b,a%b); }
ll lcm(ll a, ll b) {  return a*(b/gcd(a,b)); }

const long double PI = (long double)(3.1415926535897932384626433832795);
const ll  mx_ll   = numeric_limits<ll> :: max();
const int mx_int  = numeric_limits<int> :: max();
const int mod = 1e9+7;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
  //  freopen("text.in", "rb", stdin);
    //freopen("  .out", "wb", stdout);

    int n; cin >> n;
    bool ok = false;
    while(n) {
        int rem = n%10;
        if(rem == 7) {
            ok = true; break;
        }
        n /= 10;
    }
    if(ok) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }

    return 0;
}


Measured memory_bytes: 3652
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>	
#include <deque>
#include <set>
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(auto &i:a)
#define INF INT_MAX/2;
typedef long long ll;
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
//ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;


int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}


 // 最大公約数計算
 
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}
// 最小公倍数の計算

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

struct union_find
{
	vector<int> par, r;
	union_find(int n)
	{
		par.resize(n);
		r.resize(n);
		init(n);
	}


	void init(int n)
	{
		for (int i = 0; i < n; i++) par[i] = i;
		for (int i = 0; i < n; i++) r[i] = 0;
	}

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

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (r[x] < r[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (r[x] == r[y])
			{
				r[x]++;
			}
		}
	}
};



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

	vector<pair<int, int>> R(n);
	vector<pair<int, int>> B(n);

	rep(i, 0, n) {
		int a, b;
		cin >> a >> b;

		R[i] = make_pair(b, a);
	}
	rep(i, 0, n) {
		int a, b;
		cin >> a >> b;

		B[i] = make_pair(a, b);

	}

	sort(R.begin(), R.end(), greater<pair<int, int>>());
	sort(B.begin(), B.end());

 vector<bool> C(n);
 int ans = 0;
 rep(i, 0, n) {
	 rep(j, 0, n) {
		 if (C[j] == true)continue;
		 if (B[i].first > R[j].second&& B[i].second > R[j].first) {
			 C[j] = true;
			 ans++;
			 break;
		 }
	 }
 }
 cout << ans << endl;
}

Measured memory_bytes: 256
use std::io::BufRead;

fn main() {
    let stdin = std::io::stdin();
    let (n, c): (usize, usize) = stdin.lock().gets().split(' ').values();
    let mut diff = Vec::new();
    for line in stdin.lock().lines().take(c).map(|x| x.unwrap()) {
        let x = line.split(' ').map(|x| x.parse().unwrap())
            .collect::<Vec<u32>>();
        diff.push(x);
    }
    let mut color = Vec::new();
    for line in stdin.lock().lines().take(n).map(|x| x.unwrap()) {
        let x = line.split(' ').map(|x| x.parse().unwrap())
            .collect::<Vec<usize>>();
        color.push(x);
    }

    // Total iwakan when line `(x + y) % 3` is repainted in color `new_c`.
    let mut iwasum = vec![vec![0; c]; 3];
    for y in 0..n {
        for x in 0..n {
            for new_c in 0..c {
                let old_c = color[y][x] - 1;
                iwasum[(x + y) % 3][new_c] += diff[old_c][new_c];
            }
        }
    }
    let mut ans = std::u32::MAX;
    for c0 in 0..c {
        for c1 in (0..c).filter(|&x| x != c0) {
            for c2 in (0..c).filter(|&x| x != c0 && x != c1) {
                ans = std::cmp::min(
                    ans, iwasum[0][c0] + iwasum[1][c1] + iwasum[2][c2]);
            }
        }
    }
    println!("{}", ans);
}

trait Gets { fn gets(&mut self) -> String; }
impl<T: std::io::BufRead> Gets for T {
    fn gets(&mut self) -> String { self.lines().next().unwrap().unwrap() } }

trait Values<T> { fn values(&mut self) -> T; }
impl<'a, I, T1, T2> Values<(T1, T2)> for I
    where I: Iterator<Item=&'a str>,
          T1: std::str::FromStr, T1::Err: std::fmt::Debug,
          T2: std::str::FromStr, T2::Err: std::fmt::Debug {
    fn values(&mut self) -> (T1, T2) {
        (self.next().unwrap().parse().unwrap(),
         self.next().unwrap().parse().unwrap())
    }
}


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

typedef long long ll;

int main() {
  int N,x; cin >>N >>x;
  vector<int> a(N);
  vector<int> b(N);
  rep(i,0,N) {
    cin >>a[i]; b[i]=a[i];
  }
  rep(i,0,N) {
    if (x<b[i]) b[i]=x;
  }
  int i=0;
  while (i<N-1) {
    if (x<b[i]+b[i+1]) b[i+1]=x-b[i];
    i++;
  }
  ll Ans=0;
  rep(i,0,N) Ans+=a[i]-b[i];
  cout <<Ans <<endl;
  return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int A, B;
    cin >> A >> B;

    if ( A % 3 == 0 || B % 3 == 0 || (A + B) % 3 == 0){
        cout << "Possible" << endl;
    }
    else {
        cout << "Impossible" << endl;
    }
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	int x,r=1;
  	cin >> x;
  	if(x <= 599) r=8;
  	else if(x >= 600 && x <= 799) r=7;
  	else if(x >= 800 && x <= 999) r=6;
  	else if(x >= 1000 && x <= 1199) r=5;
  	else if(x >= 1200 && x <= 1399) r=4;
  	else if(x >= 1400 && x <= 1599) r=3;
  	else if(x >= 1600 && x <= 1799) r=2;
  	cout << r << endl;
  	return 0;
}

Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int A = 0;
		int B = 0;
		int T = 0;
		Scanner sc = new Scanner(System.in);
		A = Integer.parseInt(sc.next());
		B = Integer.parseInt(sc.next());
		T = Integer.parseInt(sc.next());
		int count=0;
		count=T/A*B;
		System.out.println(count);
	}

}

Measured memory_bytes: 23252
io = STDIN
w,h,n=io.gets.chomp.split.map(&:to_i)
ar=Array.new(w){Array.new(h){true}}
n.times do
  x,y,a=io.gets.chomp.split.map(&:to_i)
  case a
  when 1
    (0..(x.pred)).each do |i|
      h.times {|j|ar[i][j]=false}
    end
  when 2
    (x...w).each do |i|
      h.times {|j|ar[i][j]=false}
    end
  when 3
    (0..(y.pred)).each do |j|
      w.times {|i|ar[i][j]=false}
    end
  when 4
    (y...h).each do |j|
      w.times {|i|ar[i][j]=false}
    end
  end
end
p ar.flatten.select{|a|a==true}.size

Measured memory_bytes: 2044
#include <iostream>
using namespace std;
int main(){
  int a;
  int b;
  cin >> a;
  b = a;
  int sum = 0;
  while(a != 0){
    sum += a%10;
    a /= 10;
 }
  if(b % sum == 0){
  cout << "Yes" << endl;
  }else{
  cout << "No" << endl;
  }
}

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

#define all(x) (x).begin(),(x).end()
#define SP <<" "<<
#define MOD 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000

typedef long long LL;
typedef long double LD;

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  vector<int> a(n+2,0),b(n+2,0);
  for(int i=1;i<=n;i++){
    a[i]=a[i-1],b[i]=b[i-1];
    if(s[i-1]=='.') a[i]++;
    else b[i]++;
  }
  a[n+1]=a[n];
  b[n+1]=b[n];
  int ans=IINF;
  for(int i=0;i<=n;i++){
    ans=min(ans,n-(a[i]+b[n+1]-b[i]));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 2180
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    a.sort(reverse=True)
    ans =a[0]*10 +a[1] +a[2]
    print(ans)



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

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

int main() {
    string S;
    cin >> S;
    int ans = 10000;
    REP(i, S.size() - 2) {
        int num = stoi(S.substr(i, 3));
        ans = min(ans, abs(753 - num));
    }
    cout << ans << endl;
    return 0;
}

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

class Progaram
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var p = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        var index = new List<int>();
        for (var i = 0; n > i; i++)
        {
            if (p[i] == i + 1) index.Add(i);
        }

        var res = 0;
        int m = 0;
        while (index.Count > m)
        {
            if (m == index.Count - 1)
            {
                var f = p[index[m] - 1];
                var j = p[index[m]];
                var t = f;
                f = j;
                j = t;
                p[index[m] - 1] = f;
                p[index[m]] = j;
                res++;
                m++;
            }
            else if (index[m] + 1 == index[m + 1])
            {
                var f = p[index[m]];
                var j = p[index[m + 1]];
                var t = f;
                f = j;
                j = t;
                p[index[m]] = f;
                p[index[m + 1]] = j;
                res++;
                m += 2;
            }
            else if (index[m] == 0)
            {
                var f = p[index[m]];
                var j = p[index[m + 1]];
                var t = f;
                f = j;
                j = t;
                p[index[m]] = f;
                p[index[m + 1]] = j;
                res++;
                m ++;
            }
            else
            {
                var f = p[index[m] - 1];
                var j = p[index[m]];
                var t = f;
                f = j;
                j = t;
                p[index[m] - 1] = f;
                p[index[m]] = j;
                res++;
                m++;
            }
        }
        Console.WriteLine(res);
    }
}

Measured memory_bytes: 21216
import sys
sys.setrecursionlimit(500*500)
n = int(input())
l = [list(map(int,input().split())) for _ in range(n-1)]
g = [[] for _ in range(n)]

for i in l:
    v = i[0]-1
    y = i[1]-1
    w = i[2]
    g[v].append([y,w])
    g[y].append([v,w])

seen = [0] + [-1] * (n-1)

def dfs(s):
    for k in g[s]:
        v,w = k[0],k[1]
        if seen[v]!=-1:continue
        seen[v] = seen[s]^(w%2)
        dfs(v)
        
dfs(0)

for i in seen:
    print(i)

Measured memory_bytes: 101192
s = list(input())
k = int(input())
num = len(s)

for i in range(num):
    a = 122-ord(s[i])+1
    if a <= k and s[i] != 'a':
        k -= a
        s[i] = 'a'
if k > 0:
    s[-1] = chr(ord(s[-1])+k%26)
print(*s, sep='')
        


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

int main() {
    // a: 500 b: 100 c: 50
    int a, b, c, x;
    cin >> a >> b >> c >> x;
    int counter = 0;
    //if (c >= 0) cout << "Hi" << endl;
    for(int i=0; i<a+1; ++i){
        for(int j=0; j<b+1; ++j){
            for(int k=0; k<c+1; ++k){
                if (x - (i*500+j*100+k*50) == 0) {
                    ++counter;
                }
            }
        }
    }
    cout << counter << endl;
}


// C++ language references:
//   https://cppreference.com/
//   https://isocpp.org/
//   http://www.open-std.org/jtc1/sc22/wg21/


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

typedef long long ll;

int main() {
    int n; cin >> n;
    int vet[n];
    for(int i = 0; i < n - 1; i++) cin >> vet[i];
    int vetA[n];
    vetA[n-1] = vet[n-2];
    for(int i = n - 3; i >= 0; i--){
       vetA[i+1] = min(vet[i], vet[i+1]); 
    }
    vetA[0] = vet[0];
    int res = 0;
    for(int i = 0; i < n; i++) res += vetA[i];
    cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>

using namespace std;

typedef long long ll;

int main() {
    int a, b, c, d; cin >> a >> b >> c >> d;

    cout << min(a, b) + min(c, d) << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin>>n;
    unordered_map<string,int> m;
    while(n--)
    {
        string str;
        cin>>str;
        if(m.find(str)==m.end())
        m[str]=1;
        else m[str]++;
    }
    cout<<m.size();
    
}

Measured memory_bytes: 17704
use proconio::input;

fn main() {
    input! {
        k: usize,
        a: usize,
        b: usize,
    };
    // b / k * k は b 以下で最大の k の倍数
    let ans = if a <= b / k * k { "OK" } else { "NG" };
    println!("{}", ans);
}


Measured memory_bytes: 2112
#include<bits/stdc++.h>
using namespace std;
#define mod 10000007
#define ff first
#define ss second
#define ll long long
#define int long long
#define pii pair<ll,ll>
#define vi vector<ll>
#define mii map<ll,ll>
#define pb push_back
#define mp make_pair
#define sp(x,y) fixed<<setprecision(y)<<x
#define mk(arr,n,type) type *arr=new type[n];
#define w(x) ll x; cin>>x; while(x--)
#define endl '\n'
#define str string
#define all(v) v.begin(),v.end()
void kehsihba() {
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int32_t main() {
	//kehsihba();
	str a,b,c;
	cin>>a>>b>>c;
	cout<<"A"<<b[0]<<"C";
}


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

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

    vector<int> K(M);
    vector<vector<int>> S(M, vector<int>(N));

    rep(i, M)
    {
        cin >> K.at(i);
        rep(j, K.at(i))
        {
            cin >> S.at(i).at(j);
        }
    }

    vector<int> P(M);

    ll ans = 0;
    rep(i, M) cin >> P.at(i);

    for (int i = 0; i < (1 << N); i++)
    {
        bitset<10> tmp(i);
        bool ok = false;

        for (int j = 0; j < M; j++)
        {
            int cnt = 0;
            for (int k = 0; k < K.at(j); k++)
            {
                if (tmp.test(S.at(j).at(k) - 1))
                {
                    cnt++;
                }
            }

            ok = cnt % 2 == P.at(j);
            if (!ok)
            {
                break;
            }
        }

        if (ok)
        {
            ans++;
        }
    }

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

Measured memory_bytes: 3600
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        while(true) {
            int n = stdIn.nextInt();
            if(n == 0) break;
            int[] scores = new int[n];
            double ave_sum = 0;
            
            for(int i = 0; i < scores.length; i++) {
                scores[i] = stdIn.nextInt();
                ave_sum += scores[i];
            }
            double average = ave_sum / scores.length;
            double variance = 0;

            for(int i = 0; i < scores.length; i++) {
                variance += ((scores[i] - average) * (scores[i] - average)) / scores.length;
            }

            System.out.println(Math.sqrt(variance));
        }
    }
}



Measured memory_bytes: 31480
N,M = map(int, input().split())
H = list(map(int, input().split()))
A = [0] * M
B = [0] * M
high = [1]*N
for i in range(M):
    A, B = map(int, input().split())
    if H[A-1] > H[B-1]:
      high[B-1] = 0
    elif H[A-1] < H[B-1]:
      high[A-1] = 0
    else:
      high[B-1] = 0
      high[A-1] = 0

even = filter(lambda x:x ==1, high)		#
print(len(list(even)))


Measured memory_bytes: 88024
#include <iostream>
#include <iomanip>
#include <cmath>
#include <vector>
#include <queue>
#include <limits>
#include <algorithm>
#include <string>
#include <map>
using namespace std;

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

	vector<int32_t> duration(N), start(N), interval(N);
	for (int32_t i = 0; i < N; i++) {
		cin >> duration[i] >> start[i] >> interval[i];
	}

	for (int32_t start_station = 0; start_station < N; start_station++) {
		int32_t _time = 0;
		for (int32_t i = start_station; i < N; i++) {
			if (_time > start[i]) {
				_time = ((_time + interval[i] - 1) / interval[i]) * interval[i];
			} else {
				_time = start[i];
			}
			_time += duration[i];
		}
		cout << _time << endl;
	}
	cout << 0 << endl;

	return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

#define MAX 1100000

bool valid[MAX];

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);
    map<ll, ll> num;
    bool one = false;
    REP(i,N){
        ll a;
        cin >> a;
        A[i] = a;
        num[a]++;
        if(a == 1)
            one = true;
    }

    //if(one){
    //    cout << 0 << endl;
    //    return 0;
    //}

    sort(A.begin(), A.end());

    REP(i,MAX) valid[i] = true;

    ll ans = 0;

    REP(i,N){
        ll a = A[i];
        if(valid[a]) {
            if(num[a] == 1)
                ans++;
            for(int x = a; x < MAX; x += a){
                valid[x] = false;
            }
        }
    }

    cout << ans << endl;


    return 0;
}


Measured memory_bytes: 18212
import sys
def main():
    input = sys.stdin.readline
    M=int(input())
    DC=[tuple(map(int, input().split())) for _ in range(M)]
    Dsum=sum(d*c for d,c in DC)
    Csum=sum(c for d,c in DC)
    print(Csum-1 + (Dsum-1)//9)

if __name__ == '__main__':
    main()

Measured memory_bytes: 69980
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

int main(void) {
    int N, X;
    cin >> N >> X;
    vector<int> L(N+1);
    for(int i=1; i<=N; i++) {
        cin >> L[i];
    }

    partial_sum(L.begin(), L.end(), L.begin());

    cout << distance(L.begin(), upper_bound(L.begin(), L.end(), X)) << endl;
    return 0;
}


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

#define pan(i,n) for(int i=0;i<n;i++)
#define pans(i,n,a) for(int i=a;i<n;i++)
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define pb push_back
#define INF 1e9+7
#define PI 3.141592653
#define inf 100007

using namespace std;

int main(){
    int n,a=0,b=0,ba=0,ans=0;
    cin>>n;
    string s; 
    pan(i,n){
        cin>>s;
        pan(i,(int)s.size()-1){
            if(s[i]=='A'&& s[i+1]=='B') ans++;
        }
        if(s[0]=='B' && s[(int)s.size()-1]=='A') ba++;
        else{
            if(s[0]=='B' ) b++;
            if(s[(int)s.size()-1]=='A') a++;
        }
    }
    if(ba==0) ans+=min(a,b);
    else{
        if(a+b>0) ans=ans+ba+min(a,b);
        else if(a+b==0) ans=ans+ba-1;
    }
    cout<<ans;
}

Measured memory_bytes: 256
// 　　＿＿
// 　／　<＠ﾌ
//  ｜(ﾉﾉハ))
//  ﾉ从ﾟヮﾟ从
// 　ﾉ｜ｿﾉГ|つ author:hotarunx
// 〈_ﾉ^^^ヽ|
// 　~~tｧtｧ~
#include <algorithm>
#include <array>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <vector>
using namespace std;
#define int long long

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

    string n;
    cin >> n;

    int x = 0;

    for (auto &&i : n) {
        const int ni = i - '0';
        x = (x + ni) % 9;
    }

    cout << (x == 0 ? "Yes" : "No") << endl;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;

int main() {
  int n;
  cin >> n;
  vector<ll> l(n);
  rep(i, n) cin >> l[i];
  ll ans = 0;

  sort(l.begin(), l.end());
  for (int i = 0; i < n; ++i) {
    for (int j = i + 1; j < n; ++j) {
      for (int k = j + 1; k < n; ++k) {
        if (l[k] < l[i] + l[j]) ans++;
      }
    }
  }

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


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <list>
#include <unordered_map>
#include <set>
#include <map>

using namespace std;

#define TRACE

#ifndef TRACE
#define tcout cout
#else
#define tcout 0 && cout
#endif

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

int n;
int a[100010];
int s[100010];

int main(void)
{
	for(int i=3; i<=100000; i+=2)
	{
		if(isprime(i) && isprime((i+1)/2))
		{
			a[i] = 1;
		}
	}
	for(int i=1; i<=100000; i++)
	{
		s[i] = s[i-1] + a[i];
	}
	cin >> n;
	while(n--)
	{
		int l, r;
		cin >> l >> r;
		cout << s[r] - s[l-1] << endl;
	}
	return 0;
}













Measured memory_bytes: 1408
#include<stdio.h>
int main(void)
{
	int n;
	long long cnt=0;
	scanf("%d",&n);
	int p[n+1],m[n],a[n];
	for(int i=0;i<n;i++) scanf("%d",&a[i]);
	for(int i=0;i<=n;i++) p[i]=0;
	for(int i=0;i<n;i++) {
		if(i+a[i]<=n) p[i+a[i]]++;
		if(i-a[i]>=0) cnt+=p[i-a[i]];
	}
	printf("%lld\n",cnt);
	return 0;
}
	

Measured memory_bytes: 3256
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <set>
#include <vector>
#include <queue>

using namespace std;

typedef long long ll;
typedef long double ld;

constexpr int INF = 1e9;
constexpr ll BIGINF = 1e18;
constexpr double EPS = 1e-16;
constexpr int MOD = 1e9 + 7;

void preambule() {
  cin.tie(0);
  cout.precision(16);
  cout << fixed;
}

int a;
int b;
int c;

void input() {
  cin >> a >> b >> c;
}

void solve() {
  cout << a * b / 2;
}

int main() {
#ifdef _DEBUG
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  preambule();
  input();
  solve();
}


Measured memory_bytes: 256
n = int(input())
arr = list(map(int,input().split()))

ng = []
for i in range(n):
    if arr[i] == i+1:
        ng.append(i)

ind = 0
ans = 0
if len(ng) != 0:
    while True:
        if ind == len(ng)-1:
            ans += 1
            break
        if ng[ind] + 1 == ng[ind+1]:
            ans += 1
            ind += 2
        else:
            ans += 1
            ind += 1

        if ind > len(ng)-1:
            break

print(ans)


Measured memory_bytes: 14008
import math
A, B, H, M = map(int, input().split())

alpha = 360/12*(12-H-M/60)
beta = 360/60*(60-M)
the = abs(alpha - beta)
the = min(the, 360-the)
C = (A**2+B**2-2*A*B*math.cos(math.radians(the)))**0.5
print (C)

Measured memory_bytes: 9508
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl


int main(){
    ll n;
    cin >> n;
    ll diff = 0;
    for(int i = 0; i < n; i++){
        int p;
        cin >> p;
        if(p != i+1){diff++;}
    }

    if(diff<=2){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
    
    return 0;

}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayDeque;
import java.util.InputMismatchException;
import java.util.Queue;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static int modP = 1000000007;

	static int[] mx = {1, -1, 0, 0};
	static int[] my = {0, 0, 1, -1};

	static char WHITE = '.';
	static char BLACK = '#';

	static class TaskX {
		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int H = in.nextInt(), W = in.nextInt();
			char[][] maze = new char[H][W];
			for (int i = 0; i < H; i++) {
				maze[i] = in.nextString().toCharArray();
			}

			int blackCount = 0;
			for (int i = 0; i < H; i++) {
				for (int j = 0; j < W; j++) {
					if (maze[i][j] == BLACK) blackCount++;
				}
			}

			int sy = 0, sx = 0;
			int gy = H-1, gx = W-1;
			boolean[][] isVisited = new boolean[H][W];
			int[][] cost = new int[H][W];


			Queue<P> q = new ArrayDeque<>();
			q.add(new P(sx, sy));
			cost[sy][sx] = 1;
			isVisited[sy][sx] = true;

			while (!q.isEmpty()) {
				P p = q.remove();
				int px = p.x;
				int py = p.y;

				for (int i = 0; i < 4; i++) {
					int tx = px + mx[i];
					int ty = py + my[i];

					if (tx < 0 || ty < 0 || tx >= W || ty >= H || maze[ty][tx] == BLACK || isVisited[ty][tx]) {
						continue;
					}

					q.add(new P(tx, ty));
					cost[ty][tx] = cost[py][px] + 1;
					isVisited[ty][tx] = true;
				}
			}

			if (cost[gy][gx] == 0) {
				out.println(-1);
				return;
			}

			int ans = H*W-blackCount-cost[gy][gx];
			out.println(ans);

		}
	}
	static class P {
		int x, y, cost;
		P (int x, int y) {
			this.x = x;
			this.y = y;
		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

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

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}

	}

}


Measured memory_bytes: 22740
#[allow(unused_imports)]
use std::cmp::{min,max};
#[allow(unused_imports)]
use std::collections::BTreeMap;

fn main() {
    let (a,b,k) = {
        let xs = read_vec_i64();
        (xs[0],xs[1],xs[3])
    };
    let res = if k % 2 == 0 { a - b } else { b - a };
    println!("{}", res); 
}

#[allow(dead_code)]
fn read_line() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).ok();
    ret.pop();
    return ret;
}

#[allow(dead_code)]
fn read_i64() -> i64 {
    let ss = read_line();
    return ss.parse::<i64>().unwrap();
}

#[allow(dead_code)]
fn read_vec_i64() -> Vec<i64> {
    let mut res = vec![];
    let ss = read_line();
    for ts in ss.split_whitespace() {
        let x = ts.parse::<i64>().unwrap();
        res.push(x);
    }
    return res;
}

use std::fmt::Display;
#[allow(dead_code)]
fn write_vec_i64<T: Display>(xs: &Vec<T>) {
    if xs.len() == 0 {
        println!("");
        return;
    }
    print!("{}", xs[0]);
    for i in 1..xs.len() {
        print!(" {}", xs[i]);
    }
    println!("");
}


Measured memory_bytes: 4352
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <valarray>
#include <vector>

#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++)
#define ite iterator
#define mp make_pair
#define mt make_tuple
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define sec second
#define sz(x) ((int)(x).size())

using namespace std;

struct timer{
	time_t start;
	timer(){start=clock();}
	~timer(){cerr<<1.*(clock()-start)/CLOCKS_PER_SEC<<" secs"<<endl;}
};

typedef istringstream iss;
typedef long long ll;
typedef pair<ll,ll> pi;
typedef stringstream sst;
typedef vector<ll> vi;

int n;
pi s[100010];

int main2(){
	cin.tie(0);
	ios_base::sync_with_stdio(0);
	
	cin>>n;
	if(n==0)return 1;
	int end=0;
	rep(i,n){
		int c;
		cin>>c;
		if(i%2==0){
			if(end==0){
				s[end++]=mp(c,1);
			}else{
				if(s[end-1].fir==c)s[end-1].sec++;
				else s[end++]=mp(c,1);
			}
		}
		if(i%2==1){
			if(s[end-1].fir==c)s[end-1].sec++;
			else{
				s[end-1].fir^=1;
				s[end-1].sec++;
				if(end>=2){
					s[end-2].sec+=s[end-1].sec;
					end--;
				}
			}
		}
	}
	int ans=0;
	rep(i,end)if(s[i].fir==0)ans+=s[i].sec;
	cout<<ans<<endl;
	return 0;
}

int main(){
	while(!main2());
}

Measured memory_bytes: 2752
n, a, b = map(int, input().split())
n1 = 0
for i in range(1,n+1):
    
    s = str(i)    
    array = list(map(int, s))
    s1 = sum(array)
    if a <= s1 <= b:
        n1 = n1+i
        
print(n1)

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

public class Main {

	public static String Y = "Yes";
	public static String N = "No";
	public static long MOD = (long) (Math.pow(10, 9) + 7);
	public static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int n = ni();
		long a[] = new long[n];

		for (int i = 0; i < n; i++) {
			a[i] = nl();
		}
		Arrays.parallelSort(a);
		out(a[n - 1] - a[0]);
	}

	/*
	 * 以下メソッド集
	 */
	static double[] sort(double[] r) {
		Arrays.sort(r);
		return r;
	}

	static void debug() {
		out("---");
	}

	static void debug(long a) {
		out("-------");
		out(a);
		out("-------");
	}

	static void debug(String a) {
		out("-------");
		out(a);
		out("-------");
	}

	static long[] sort(long[] n) {
		Arrays.sort(n);
		return n;
	}

	static int ketasuu(int n) {
		String str = "" + n;
		return str.length();
	}

	static int account(String str) {
		String target = "AC";
		int count = 0;
		int len = str.length();
		for (int i = 0; i < len - 1; i++) {
			if (target.equals(str.substring(i, i + target.length()))) {
				count++;
			}
		}
		return count;
	}

	static int ni() {
		return sc.nextInt();
	}

	static long nl() {
		return sc.nextLong();
	}

	static double nd() {
		return sc.nextDouble();
	}

	static String n() {
		return sc.next();
	}

	static char[] nc() {
		return sc.next().toCharArray();
	}

	static int kaijo(int n) {
		if (n == 0 || n == 1) {
			return 1;
		} else {
			return n * kaijo(n - 1);
		}
	}

	static int fib(int n) {
		return (n == 1 || n == 0) ? n : fib(n - 2) + fib(n - 1);
	}

	static long lcm(long m, long n) {

		return m * n / gcd(m, n);
	}

	static int lcm(int m, int n) {

		return m * n / gcd(m, n);
	}

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

	static void out(String info) {
		System.out.println(info);
	}

	static void out(int info) {
		System.out.println(info);
	}

	static void out(double info) {
		System.out.println(info);
	}

	static void out(long info) {
		System.out.println(info);
	}

	static void out(char info) {
		System.out.println(info);
	}

	static void out(Object obj) {
		System.out.println(obj.toString());
	}

	static void outn(String info) {
		System.out.print(info);
	}

	static void outn(int info) {
		System.out.print(info);
	}

	static void outn(double info) {
		System.out.print(info);
	}

	static void outn(long info) {
		System.out.print(info);
	}

	static void outn(char info) {
		System.out.print(info);
	}

	static double max(double d, double e) {
		return Math.max(d, e);
	}

	static long max(long a, long b) {
		return Math.max(a, b);
	}

	static long min(long d, long e) {
		return Math.min(d, e);
	}

	static int min(int a, int b) {
		return (int) Math.min(a, b);
	}
}

class XY {
	int h;
	int c;

	XY(int h, int c) {
		this.h = h;
		this.c = c;
	}
}


Measured memory_bytes: 35812
// Undone
#include <bits/stdc++.h>
#define int long long
#define double long double
#define INF 1e18
using namespace std;
int x[3000];
signed main() {
  int x, r, d;
  cin>>r>>d>>x;
  for (int i = 0; i < 10; i++) {
    int ans = r*x-d;
    x=ans;
    cout<<ans<<endl;
  }
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define Int int64_t
#define ll long long
#define pb push_back
using namespace std;
const Int MAXN=2005;
const int ALPHA=26;

Int N,K,M;
Int X,Y,Z;
Int A,B,C;
vector<Int> ID;
vector<Int> SZ;
int find(int x){
    if(ID[x]==x) return x;
    return find(ID[x]);
}
void Union(int x,int y){
    x=find(x);y=find(y);
    if(x==y) return;
    if(SZ[x]>SZ[y]){
        ID[y]=x;
        SZ[x]+=SZ[y];
    }
    else{
        ID[x]=y;
        SZ[y]+=SZ[x];
    }
    return;
}
string common_prefix(string s,string t){
    string ans="";
    for(int i=0;i<min(s.length(),t.length());++i){
        if(s[i]==t[i]) ans.pb(s[i]);
        else break;
    }
    return ans;
}
string LCP(vector<string> A,int l,int r){
    if(l>r) return "";
    if(l==r) return A[l];
    int mid=(l+r)/2;
    string left=LCP(A,l,mid);
    string right=LCP(A,mid+1,r);
    return common_prefix(left,right);
}
int main()
{
    int t;
    t=1;
    while(t--){
       cin>>N>>K;
       vector<Int> A(N);
       for(auto &x:A) cin>>x;
       for(int i=K;i<N;++i){
           if(A[i]>A[i-K]) cout<<"Yes\n";
           else cout<<"No\n";
       }
    }
}

Measured memory_bytes: 4776
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <numeric>
#include <cmath>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
using P = pair<ll, ll>;

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 ll MOD = 1000000007;
const int INF = 1<<30;
//const ll INF = (ll)1e18 + 1;

class mint {
public:
    long long x;
    mint(long long x=0) : x((x%MOD+MOD)%MOD) {}
    //mint operator-() const{ return mint(-x);}
    mint operator-() const {
      return mint(-x);
    }
    mint& operator+=(const mint& a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint& a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const  mint& a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint& a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint& a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint& a) const {
        mint res(*this);
        return res*=a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime mod
    mint inv() const {
        return pow(MOD-2);
    }
    mint& operator/=(const mint& a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint& a) const {
        mint res(*this);
        return res/=a;
    }

};


int main(){
  int H, W; cin >> H >> W;
  vector<string> a(H);
  rep(i, H) cin >> a[i];

  vector<vector<mint>> dp(H + 10, vector<mint>(W + 10, 0));
  dp[0][0] = 1;
  for (int i = 0; i < H; ++i){
    for (int j = 0; j < W; ++j){
      if (i + 1 < H && a[i + 1][j] == '.') dp[i + 1][j] += dp[i][j];
      if (j + 1 < W && a[i][j + 1] == '.') dp[i][j + 1] += dp[i][j];
    }
  }
  cout << dp[H - 1][W - 1].x << endl;
}


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

#define int long long

#define rep(i,n) for(int i=0;i<(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

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

struct UnionFindTree{
    vector<int>par,sz;
    UnionFindTree(int n){
        par.resize(n);
        sz.resize(n);
        for(int i=0;i<n;i++){
            par[i]=i;
            sz[i]=1;
        }
    }
    int find(int x){
        return x==par[x]?x:par[x]=find(par[x]);
    }
    void unite(int x,int y){
        x=find(x);y=find(y);
        if(x==y)return;
        if(sz[x]<sz[y])swap(x,y);
        sz[x]+=sz[y];
        par[y]=x;
    }
    bool areSame(int x,int y){
        return find(x)==find(y);
    }
    int size(int x){
        return sz[find(x)];
    }
};

int N,M;
vpint G[111111];
vint lis[111111];
int deg[111111];
int col[111111];


void dfs(int v,int c){
    col[v]=c;
    for(auto &e:G[v]){
        int cc=(c+3+e.se)%3;
        if(col[e.fi]==-1)dfs(e.fi,cc);
    }
}

int calc(vint lis){
    dfs(lis[0],0);

    set<int>s;
    vint cnt(3);
    for(auto v:lis){
        cnt[col[v]]++;
        s.insert(col[v]);
    }

    int sum=0;
    bool flag=true;
    for(auto v:lis)for(auto &e:G[v]){
        if(e.se==1)sum++;
        if(col[e.fi]!=(col[v]+e.se+3)%3)flag=false;
    }

    if(!flag)return lis.size()*lis.size();
    if(s.size()<3)return sum;


    int ret=0;
    rep(i,3){
        ret+=cnt[i]*cnt[(i+1)%3];
    }
    return ret;
}

signed main(){
    memset(col,-1,sizeof(col));
    cin>>N>>M;

    UnionFindTree uf(N);
    rep(i,M){
        int a,b;
        cin>>a>>b;
        a--;b--;
        G[a].pb({b,1});
        G[b].pb({a,-1});
        uf.unite(a,b);
        deg[b]++;
    }
    rep(i,N)lis[uf.find(i)].pb(i);


    int ans=0;
    rep(i,N)if(lis[i].size())ans+=calc(lis[i]);
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;

class Solution {
public:
	void solve() {
		string s, t;
		cin >> s >> t;
		if (t.length() != s.length() + 1) {
			cout << "No\n";
			return;
		}
		for (int i = 0; i < s.length(); i++) {
			if (s[i] != t[i]) {
				cout << "No\n";
				return;
			}
		}
		cout << "Yes\n";
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int a,b,c;
  cin >>a>>b;
  a=a+b;
  if(a>=10) cout <<"error\n";
  else cout <<a<<'\n';
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 205;
int n, L, R;
int ans[maxn];
int Ask(int l, int r) {
	cout << '?';
	for(int i = l; i <= r; ++i) {
		cout << ' ' << i;
	}
	cout << '\n';
	string ret;
	cin >> ret;
	return ret == "Red" ? -1 : 1; 
}
int Ask(int x) {
	cout << '?' << ' ' << x;
	for(int i = 1; i <= 2 * n; ++i) {
		if(i != L && i != R && (L < i && i < R) != (L < x && x < R)) {
			cout << ' ' << i;
		}
	}
	cout << '\n';
	string ret;
	cin >> ret;
	return ret == "Red" ? -1 : 1;
}
int main() {
	cin >> n;
	int prv = Ask(1, n);
	int l = 1, r = n + 1;
	while(r - l > 1) {
		int mid = l + r >> 1;
		if(Ask(mid, mid + n - 1) == prv) {
			l = mid;
		} else {
			r = mid;
		}
	}
	ans[l] = prv;
	ans[l + n] = -prv;
	L = l;
	R = l + n;
	for(int i = 1; i <= 2 * n; ++i) {
		if(i != L && i != R) {
			ans[i] = Ask(i);
		}
	}
	cout << "! ";
	for(int i = 1; i <= 2 * n; ++i) {
		cout << (ans[i] == -1 ? 'R' : 'B');
	}
	cout << '\n';
	return 0;
}

Measured memory_bytes: 724