akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;

int main() {
  int N;
  cin >> N;
  vector<int> b(N);
  vector<int> ans;
  for (int i = 0; i < N; i++) {
    cin >> b[i];
  }
  for (int i = 0; i < N; i++) {
    bool can = false;
    for (int j = b.size() - 1; j >= 0; j--) {
      if (b[j] == j+1) {
        b.erase(b.begin()+j);
        ans.push_back(j+1);
        can = true;
        break;
      }
    }
    if (!can) {
      cout << -1 << endl;
      return 0;
    }
  }
  for (int i = ans.size()-1; i>= 0; i--) {
    cout << ans[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int I = 0; 
 
struct AdjListNode
{
    int dest;
    struct AdjListNode* next;
};
 
struct AdjList
{
    struct AdjListNode *head;  // pointer to head node of list
};
 
struct Graph
{
    int V;
    struct AdjList* array;
};
 
struct AdjListNode* newAdjListNode(int dest)
{
    struct AdjListNode* newNode =
            (struct AdjListNode*) malloc(sizeof(struct AdjListNode));
    newNode->dest = dest;
    newNode->next = NULL;
    return newNode;
}
 
struct Graph* createGraph(int V)
{
    struct Graph* graph = (struct Graph*) malloc(sizeof(struct Graph));
    graph->V = V;
 
    graph->array = (struct AdjList*) malloc(V * sizeof(struct AdjList));
 
    int i;
    for (i = 0; i < V; ++i)
        graph->array[i].head = NULL;
 
    return graph;
}
 
void rdfs(struct Graph* graph, int V, int src, int b[])
{
    struct AdjListNode* n = graph->array[src].head;
    b[src] = I;
    while(n)
    {
        if (b[n->dest] < I) {
            rdfs(graph, V, n->dest, b);
        }
        n = n->next;
    }
}
void dfs(struct Graph* graph, int V, int src, int a[], int b[])
{
    struct AdjListNode* n = graph->array[src].head;
    b[src] = 1;
    while(n)
    {
        if (b[n->dest] == 0) {
            dfs(graph, V, n->dest, a, b);
        }
        n = n->next;
    }
    a[I++] = src;
}
 
void addEdge(struct Graph* graph, int src, int dest)
{
    struct AdjListNode* newNode = newAdjListNode(dest);
    newNode->next = graph->array[src].head;
    graph->array[src].head = newNode;
}
 
int main()
{
    int V, E;
    scanf("%d", &V);
    scanf("%d", &E);
    int a[V];
    int b[V];
    int c[V];
    int i, j, k;
    struct Graph* graph = createGraph(V);
    struct Graph* rgraph = createGraph(V);
    for(i = 0; i < E; i++) { 
        scanf("%d", &j);
        scanf("%d", &k);
        addEdge(graph, j, k);
        addEdge(rgraph, k, j);
    }
    for(i = 0; i < V; i++) { 
        a[i] = 0;
        b[i] = 0;
    }
    for(i = 0; i < V; i++) { 
        if (b[i] == 0)
            dfs(graph, V, i, a, b);
    }
    for(i = 0; i < V; i++) { 
        b[i] = 0;
    }
    for(i = V - 1; i > -1; i--) { 
        if (b[a[i]] == 0) {
            rdfs(rgraph, V, a[i], b);
            I--;
        }
    }
    int q;
    scanf("%d", &q);
    for(i = 0; i < q; i++) { 
        scanf("%d", &j);
        scanf("%d", &k);
        printf("%d\n", b[j] == b[k]);
    }
  return 0;
}

Measured memory_bytes: 2724
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

int main()
{
	int A, B, C;
	cin >> A >> B >> C;
	cout << min(B / A, C) << endl;
}


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

int main(){
  ll H,W,M;
  cin >> H >> W >> M;
  map<ll,ll> Hn;
  map<ll,ll> Wn;
  set<pair<ll,ll>> S; 
  for(ll i=0;i<M;i++){
    ll hn,wn;
    cin >> hn >> wn;
    Hn[hn]++;
    Wn[wn]++;
    S.insert(make_pair(hn,wn));
  }
  vector<ll> Hindex(0);
  vector<ll> Windex(0);
  ll Hmax=0;
  for(ll i=1;i<=H;i++){
    if(Hn[i]>Hmax){
      Hindex={i};
      Hmax=Hn[i];
    }
    else if(Hn[i]==Hmax){
      Hindex.push_back(i);
    }
  }
  ll Wmax=0;
  for(ll i=1;i<=W;i++){
    if(Wn[i]>Wmax){
      Windex={i};
      Wmax=Wn[i];
    }
    else if(Wn[i]==Wmax){
      Windex.push_back(i);
    }
  }
  for(ll h:Hindex){
    for(ll w:Windex){
      if(!S.count(make_pair(h,w))){
        cout << Hmax+Wmax << endl;
        return 0;
      }
    }
  }
  cout << Hmax+Wmax-1 << endl;
  return 0;
}

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

using namespace std;

const int N = 1e7 + 5;
const int mod = 998244353;
inline int pls( int a , int b ) { a += b - mod; return a + ( a >> 31 & mod ); }
inline int mns( int a , int b ) { a -= b; return a + ( a >> 31 & mod ); }
inline void inc( int & a , int b ) { a += b - mod; a += a >> 31 & mod; }
inline void dec( int & a , int b ) { a -= b; a += a >> 31 & mod; }
inline int fpow( int b , int k ) {
  int res = 1;
  while( k ) {
    if( k & 1 ) res = 1LL * res * b % mod;
    b = 1LL * b * b % mod; k >>= 1;
  }
  return res;
} int _w;

int n , fac[N] , ifac[N] , Pow[N] , inv[N] , ans;

int binom( int n , int m ) { return 1LL * fac[n] * ifac[m] % mod * ifac[n - m] % mod; }

int main( void ) {
  _w = scanf("%d",&n);
  fac[0] = fac[1] = ifac[0] = ifac[1] = inv[1] = 1 , Pow[1] = 2;
  for( int i = 2 ; i <= n ; ++i ) {
    fac[i] = 1LL * fac[i - 1] * i % mod;
    inv[i] = 1LL * ( mod - mod / i ) * inv[mod % i] % mod;
    ifac[i] = 1LL * ifac[i - 1] * inv[i] % mod;
    Pow[i] = pls( Pow[i - 1] , Pow[i - 1] );
  }
  ans = fpow( 3 , n );
  for( int i = n / 2 + 1 ; i <= n ; ++i )
    dec( ans , 1LL * binom( n , i ) * Pow[n - i + 1] % mod );
  cout << ans;
  return 0;
}


Measured memory_bytes: 156544
#include<bits/stdc++.h>
#define ALL(c) begin(c), end(c)
using namespace std;
using ll = long long;
using ld = long double;

const int N = 1e6+6;


int main(){
    //freopen("input.txt","r",stdin); //freopen("output.txt","w",stdout);
    ios::sync_with_stdio(0);cin.tie(0);//cout.precision(12);cout<<fixed;
    
    string s;
    cin>>s;
    
    for(char c : s) if(c=='7'){
        cout<<"Yes";
        return 0;
    }
    
    cout<<"No";
    
    
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define ll long long 
#define pb push_back
#define inf 2e9
#define maxn 200003
using namespace std;
int t,n;
ll sum[maxn];
main(){
	cin >> n;
	sum[0] = 0;
	For(i,1,n){
		scanf("%d",&t);								
		sum[i] = sum[i-1] + t;
	}
	ll ans = abs(sum[n]-2*sum[1]);
	For(i,2,n-1){
		ans = min(ans,abs(sum[n]-2*sum[i]));
	}
	cout << ans;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
//#include <math.h>
//#include <queue>
//#include <stack>
//#include <iomanip>

// sometimes used
//#include <set>
//#include <map>
//#include <numeric>
//#include <list>
//#include <deque>
//#include <unordered_map>

typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 200100
//#define NIL -1

int main() {
    string s;
    string t;
    string tmp_s;
    vector<string> cand_ans;
    cin >> s >> t;
    int ss = s.size();
    int ts = t.size();
    bool ok;
    for(int i=0; i<ss; i++){
        tmp_s=s;
        ok=true;
        if(i+ts>ss){
            continue;
        }
        for(int j=0; j<ts; j++){
            if(s[i+j]!=t[j] && s[i+j]!='?'){
                ok=false;
            }else{
                tmp_s[i+j]=t[j];
            }
        }
        if(ok==true){
            for(int j=0; j<ss; j++){
                if(tmp_s[j]=='?'){
                    tmp_s[j]='a';
                }                
            }
            cand_ans.push_back(tmp_s);
        }
    }

    if(cand_ans.size()!=0){
        sort(cand_ans.begin(), cand_ans.end());
        //for(int i=0; i<cand_ans.size(); i++){
        //    cout << cand_ans[i] << endl;
        //}
        cout << cand_ans[0] << endl;
    }else{
        cout << "UNRESTORABLE" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
n = input()
k = len(n)
a = 9 * (k - 1) + int(n[0]) - 1
b = 0
for i in range(k):
  b += int(n[i])
c = 0
m = ''
if k > 2 and n[-2] != '0':
  m = str(int(n))[:k - 2] + str(int(n[-2]) - 1) + '9'
elif k > 2 and n[-2] == '0':
  m = str(int(n) - (int(n[-1]) + 1))
for i in range(len(m)):
  c += int(m[i])
ans = max(a, b, c)
print(ans)

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

int main() {

	string str;

	while (1) {

		int sum = 0;
		getline(cin, str);

		if (str[0] == '0') break;

		for (int i = 0; i<str.size(); i++) {
			sum += str[i] - '0';
		}
		cout << sum << endl;
	}
}

Measured memory_bytes: 3144
#include <iostream>
#include <vector>
#include <bitset>
using namespace std;

int main(){
  int D, G;
  cin >> D >> G;
  vector<int> p(D), c(D);
  for(int i=0; i<D; i++){
    cin >> p.at(i) >> c.at(i);
  }
  int ans = 1000;
  for(int tmp=0; tmp<(1<<10); tmp++){
    bitset<10> s(tmp);
    int score = 0, num = 0, index = 0;
    for(int i=0; i<D; i++){
      if(s.test(i)){
        score += 100*(i+1)*p.at(i)+c.at(i);
        num += p.at(i);
      }else{
        index = max(index, i);
      }
    }
    int m = 0;
    while(score<G){
      score += 100*(index+1);
      m++;
    }
    if(m>=p.at(index)){
      continue;
    }else{
      num += m;
    }
    ans = min(ans, num);
  }
  cout << ans;
  return 0;
}

Measured memory_bytes: 3612
#include<iostream>
using namespace std;
int main()
{
    int a,y,z,p;
    cin>>a>>y>>z;
    p=a;
    a=y;
    y=p;
    p=a;
    a=z;
    z=p;
    cout<<a<<" "<<y<<" "<<z;
    return 0;
}


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

#define rep(i, a, b) for(int i = (a); i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define endl '\n'

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

const ll mod = 1000000007;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
// head

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

    ll n;
    cin >> n;

    auto sub = [&](ll a, ll b) {
        a -= b;
        if(a < 0) {
            a += mod;
        }
        return a;
    };
    ll p10 = 1;
    ll p9 = 1;
    ll p8 = 1;
    for(int i = 1; i <= n; i++) {
        p10 *= 10;
        p8 *= 8;
        p9 *= 9;
        p10 %= mod;
        p8 %= mod;
        p9 %= mod;
    }
    p10 = sub(p10, p9);
    p10 = sub(p10, p9);
    p10 += p8;
    if(p10 >= mod) p10 -= mod;
    cout << p10 << endl;
    return 0;
}


Measured memory_bytes: 3624
#include <stdio.h>

int main(void)
{
	int a,b,c,x;
	scanf("%d %d %d",&a,&b,&c);
	
	if(a>b){
		x=a;
		a=b;
		b=x;
	}
	if(b>c){
		x=b;
		b=c;
		c=x;
	}
	if(a>b){
		x=a;
		a=b;
		b=x;
	}
	
	printf("%d %d %d\n",a,b,c);
	return 0;
}


Measured memory_bytes: 1964
#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG_OUTPUT
#define DEBUG_LOG(s) cout << s << endl;
#else
#define DEBUG_LOG(s) void();
#endif

int dp_solve(const int n, const string& s){
    //x : s.size()
    //y : use cnt
    //z ; lucky number
    vector<vector<vector<bool>>> dp(n + 1, vector<vector<bool>>(4, vector<bool>(1000, false)));
    dp[0][0][0] = true;
    for (auto i = 0; i < n; i++) {
        for (auto j = 0; j <= 3; j++) {
            for (auto k = 0; k <= 999; k++) {
                int index = k * 10 + (s[i] - '0');
//                cout << i << " " << j << " " << k << " " << index << endl;
//                cout << dp[i][j][k] << " -> " << dp[i + 1][j][k] << endl;
                dp[i + 1][j][k] = dp[i][j][k] or dp[i + 1][j][k];
                if(index <= 999 and j < 3) {
//                    cout << dp[i][j][k] << " -> " << dp[i + 1][j + 1][index] << endl;
                    dp[i + 1][j + 1][index] = dp[i][j][k] or dp[i + 1][j + 1][index];
                }
            }
        }
    }

//    for (auto i = 0; i <= n; i++) {
//        for (auto j = 0; j <= 3; j++) {
//            for (auto k = 0; k <= 30; k++) {
//                cout << dp[i][j][k] << " ";
//            }
//            cout << endl;
//        }
//        cout << endl;
//    }

    int cnt = 0;
    for (auto i = 0; i <= 999; i++) if(dp[n][3][i]) cnt++;

    return cnt;
}

int main(){
    int n; string s;
    cin >> n >> s;

//    int ans = 0;
//    for (auto i = 0; i <= 999; i++) {
//        vector<int> number(3);
//        int tmp = i;
//        for (auto j = 0; j < 3; j++) {
//            number[j] = tmp % 10;
//            tmp /= 10;
//        }
//        int cnt = 0;
//        for (auto k = 0; k < (int)s.size(); k++) {
//            if(s[k] - '0' == number[cnt]) cnt++;
//            if(cnt == 3) {
//                ans++;
//                break;
//            }
//        }
//    }
//
//    cout << ans << endl;

    cout << dp_solve(n, s) << endl;
    return 0;
}

Measured memory_bytes: 23040
#include<bits/stdc++.h>
using namespace std;
#define int long
#define m (1000000007)
constexpr int mul(int a,int b){
  return ((a%m)*(b%m))%m;
}
int f(int k, vector<vector<int>>& v, int s, int s0){
  int kf=k-2+!(s0+1),c=1;
  if(k<v[s].size())return 0;
  for(auto i:v[s])if(s-i&&s0-i)c=mul(c,kf--);
  for(auto i:v[s])if(s-i&&s0-i)c=mul(c,f(k,v,i,s));
  return c;
}
main(){
  int n,k,a,b; 
  cin>>n>>k;
  vector<vector<int>> v(n);
  for(int i=1;i<n;++i){
    cin>>a>>b;
    a--; b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  cout<<mul(k,f(k,v,0,-1));
}

Measured memory_bytes: 11520
#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());
  
  cout << abs(a.at(n - 1) - a.at(0)) << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
bool b[1111][1111][1111];
int main() {
	int n; cin >> n;
	int sum = 0;
	for (int i = 0; i < n; i++) {
		int a[3]; cin >> a[0] >> a[1] >> a[2];
		sort(a, a + 3);
		if (b[a[0]][a[1]][a[2]])sum++;
     	b[a[0]][a[1]][a[2]] = true;

	}
	cout << sum << endl;
}


Measured memory_bytes: 7080
#include <iostream>

using namespace std;
int main()
{
    int N;
    int p[20];

    int count = 0;
    cin >> N ;
    for (int i = 0; i < N; i++) cin >> p[i];

    for (int j = 1; j < N - 1; j++) {
        if (p[j] > p[j - 1]) {
            if (p[j] < p[j + 1]) count++;
        }
        else {
            if (p[j] > p[j + 1]) count++;
        };
    };
    

    // 出力
    cout << count << endl;

    
}


Measured memory_bytes: 256
// #include C {
#include<cstring>
#include<cassert>
#include<cstdio>
#include<cctype>
#include<cmath>
// }

// #include C++ {
#include<functional>
#include<algorithm>
#include<iostream>
#include<vector>
#include<string>
#include<bitset>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<map>
#include<set>
// }

using namespace std;
// #typedef {
typedef long long int64;
typedef pair <int, int> PII;
typedef pair <int64, int64> PLL;
// }

// #parameter{
#ifdef DEBUG_MODE

#define TYPE decltype
#define RF(filename) {freopen((filename), "r", stdin);}
#define WF(filename) {freopen((filename), "w", stdout);}
#define DF(filename) {freopen((filename), "w", stderr);}
#define eprintf printf

#else

#define TYPE __typeof
#define RF(filename) {;}
#define WF(filename) {;}
#define DF(filename) {;}
#define eprintf(...)
#define fprintf(...)

#endif

// #define {
#define SZ(a) ((int)(a).size())
#define X first
#define Y second
#define MP make_pair
#define L(x) ((x)<<1)
#define R(x) ((x)<<1 | 1)
#define max3(x, y, z) (max(max((x), (y)), (z)))
#define min3(x, y, z) (min(min((x), (y)), (z)))
#define BIT(x, i) (((x) >> (i)) & 1)
#define ALL(it) (it).begin(), (it).end()
#define FILL(__space, __val) memset(__space, __val, sizeof(__space))
#define MOVE(__spaceTo, __spaceFrom) memmove(__spaceTo, __spaceFrom, sizeof(__spaceTo))
#define UNIQUE(__vector) sort(ALL(__vector)), __vector.resize(unique(ALL(__vector)) - __vector.begin())
#define FOR(it, c) for( TYPE((c).begin()) it = (c).begin(); it != (c).end(); it++)
/////////////////////////////////////////////////////////////
const double PI = acos(-1.0);
const double EPS = 1e-6;

#define MAX_N 205
#define MAX_M 100005
#define MOD (int)(1e9+7)
#define INF ((1 << 30) - 1)
#define BINF ((1LL << 62) - 1LL)
#define NONE -1
#define NIL 0
// }

/////////////////////////////////////////////////////////////
void solve(int64 N) {
	for (int a = 1; a <= 3500; a++) for (int b = a; b <= 3500; b++) {
		int64 lhs = 4LL * a * b;
		int64 rhs = N * (a + b);
		if (rhs > lhs)
			break;
		int lb = 1, rb = 3500;
		int res = lb;
		while (lb < rb) {
			int c = (lb + rb) >> 1;
	//		printf(">> %d %d %d\n", lb, rb, c);
			res = c;
			int64 ls = 4LL * a * b * c;
			int64 rs = N * (a*b + b*c + a*c);
			if (ls == rs) {
				printf("%d %d %d\n", a, b, c);
				return;
			}
			if (rs > ls) {
				lb = c + 1;
			}
			else
				rb = c;
		}
	}
}
/////////////////////////////////////////////////////////////
int main() {
	RF("input.txt");
//  WF("output.txt");
	DF("err.txt");

	int64 N;
	scanf("%lld", &N);
	solve(N);
}

Measured memory_bytes: 384
//#include<bits/stdc++.h>	// 全てのヘッダーファイルをinclude
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<set>
#include<map>
#include<utility>	// wrap,pair
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR (i,n) for(int i=n;i>0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
const int MOD{ int(1e9 + 7) };	// int 1000000007
const int inf{ int(1e9) };	// inf = 1000000000 // 1e9 はdouble型
using namespace std;
typedef long long ll;

// 最大公約数（ユークリッドの互除法）
int GCD(int x, int y) {
	if (x > y) {
		swap(x, y);
	}
	int r = y % x;
	while (r != 0) {
		y = x;
		x = r;
		r = y % x;
	}
	return x;
}

// 最小公倍数
int LCM(int x, int y) {
	ll gcd = GCD(x, y);
	return x * y / gcd;
}

// 素数判定(素数ならtrue,合成数ならfalse)
bool IsPrime(int num) {
	if (num < 2) return false; // 0,1
	else if (num == 2) return true;	// 2
	else if (num % 2 == 0) return false; // 偶数

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false; // 割り切れたら素数ではない
	}
	return true; // 全部通ったら素数
}

// pairをsecond基準で昇順sort
// sort(vector_name.begin(),vector_name.end(),compare_by_b);
bool compare_by_b(pair<int, int>a, pair<int, int>b) {
	if (a.second != b.second) return a.second < b.second;
	else return a.first < b.first;
}

// ----------------------------------------------------------------

int main(void) {

	string s;
	cin >> s;
	int n = s.length();

	int cntA = 0, cntB = 0;
	// 0スタート
	REP(i, n) {
		if (i % 2 == 0) {
			if (s[i] != '1') cntA++;
		}
		else if (i % 2 == 1) {
			if (s[i] != '0') cntA++;
		}
	}
	// 1スタート
	REP(i, n) {
		if (i % 2 == 0) {
			if (s[i] != '0') cntB++;
		}
		else if (i % 2 == 1) {
			if (s[i] != '1') cntB++;
		}
	}
	cout << min(cntA, cntB) << endl;

	return 0;
}

Measured memory_bytes: 512
#include <cstdio>
int main()
{
	int n , i , ans = 0;
	scanf("%d" , &n);
	for(i = 10 ; i <= n ; i *= 100)
		ans += i - i/10;
	i /= 10;
	if(n >= i) ans += n - i + 1;
	printf("%d\n" , ans);
	return 0; 
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
typedef long long ll;
int main(){
	string s;
	cin >> s;
	int l = s.size();
	bool flag;	//Bなら0, Wなら1
	if (s[0]=='B') flag = 0;
	else flag = 1;

	int cnt = 0;
	FOR(i,1,l){
		if (s[i]=='B' && flag) {
			cnt++;
			flag = 0;
		}
		else if (s[i]=='W' && !flag) {
			cnt++;
			flag = 1;
		}
	}

	cout << cnt << endl;
	return 0;
}


Measured memory_bytes: 512
function main()
  
  N = parse(Int,readline())
  s = []
  ans = 0
  for i in 1:N
    num = parse(Int,readline())
    if num % 10 != 0
      push!(s,num)
    end
    ans += num
  end
  
  sort!(s)

  for i in 1:length(s)
    if ans % 10 == 0
      ans -= s[i]
    end
  end
  
  if ans % 10 == 0
    println(0)
  else
    println(ans)
  end
  
end

main()

Measured memory_bytes: 110508
#include<iostream>
#include <string>
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define M 1000000007
#define all(v) v.begin(),v.end()
#define fr(a,b,c) for(ll i=a;i<=b;i+=c)
#define inarr(arr,n); for(ll i=0;i<n;i++) cin >> arr[i];
#define outarr(arr,n); for(ll i=0;i<n;i++) cout<<arr[i]<<" ";
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
int main() {
    ios;
	ll x,y,z;
    cin>>x>>y>>z;
    cout<<z<<" "<<x<<" "<<y<<endl;
    return 0;
}

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

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "Yes" : "No") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e5 + 1;

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

  CIN(N);
  vector< int > A(N);
  REP(i, N)
    cin >> A[i];

  sort(ALL(A), [](const int p, const int q) {
      return p > q;
    });

  int a, b;
  a = b = 0;
  REP(i, N) {
    if (i % 2 == 1) b += A[i];
    else a += A[i];
  }
  cout << (a - b) << endl;
    

  return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <string>

using std::cout;;
using std::endl;;
using std::string;;

int main(void) {

  int num = 0;
  int max = 0; // maximum
  int min = 0; // minimum
  int N;
  std::string S;

  min = 300001;
  std::cin >> N;
  std::cin >> S;

  int e = 0, w = 0;
  int E[3 * 100000];
  int W[3 * 100000];

  for (int i = 0; i < N; ++i) {
    if (S[i] == 'W') ++w;
    W[i] = w;
  }

  for (int i = N; 0 < i; --i) {
    if (S[i - 1] == 'E') ++e;
    E[i - 1] = e;
  }

  for (int i = 0; i < N; ++i) {
    min = std::min(min, E[i] + W[i] - 1);
  }

  cout << min << endl;
  
  return 0;
}


Measured memory_bytes: 3076
import java.util.*

fun main(args: Array<String>) {
    val N = readInt()
    val A = readLongList()
    println(if (A.size == A.toSet().size) "YES" else "NO")
}

fun readString() = readLine()!!
fun readStringList() = readLine()!!.split(" ")
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)

Measured memory_bytes: 80728
#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;
    cin >> n >> k;
    vector<int> value;
    //cum.push_back(0);
    rep(i,n){
        int v;
        cin >> v;
        //dq.push_back(v);
        value.push_back(v);

    }

    int res = 0;
    rep(l,k+1){
        for(int r=0; l+r<=k; ++r){
            int sum=0;
            int back_num = k-l-r;
            vector<int> neg;
            //cout << "start" << endl;
            rep(i,l){
                if(i>=n) break;
                if(value[i]<0) neg.push_back(value[i]);
                //cout << "l add" << value[i] << endl;
                sum+=value[i];
            }
            rep(i,r){
                int ind = n-i-1;
                if(ind<l) break;
                if(value[ind]<0) neg.push_back(value[ind]);
                //cout << "r add" << value[ind] << endl;
                sum+= value[ind];
            }

            sort(neg.begin(),neg.end());
            rep(i,back_num){
                if(i>=neg.size()) break;
                sum -= neg[i];
                //cout << "remove" << neg[i];
            }

            /*
            cout << "neg" << endl;
            for(auto nn:neg) cout << nn << " ";
            cout << endl;
           
            cout << "l" << l << "r" << r << "sum" << sum << endl;
            */
            res = max(sum,res);

        }
    }

    cout << res << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int inf = -1000000000;
long long dp[1001][100001]; 
//the definition of dp[i][j] is the maximum value we can get by use the first i goods
//with current weight j

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n,W; //n goods and W (weight maximal)
	memset(dp, inf, sizeof(dp));
	cin >> n >> W;
	vector<int> val(n+1,0), weight(n+1,0);
	for(int i=1;i<=n;i++) cin >> weight[i] >> val[i];
	for(int i=0;i<=W;i++) dp[0][i] = 0;
	for(int i=1;i<=W;i++){
		for(int j=1;j<=n;j++){
			if(i-weight[j] >= 0) dp[j][i] = max(dp[j-1][i-weight[j]]+val[j], dp[j-1][i]); 
			else dp[j][i] = dp[j-1][i];
		}
	}
	cout << dp[n][W] << "\n";  
/*	for(int j=0;j<=W;j++) dp[0][j] = 0;
	for(int i=1;i<=n;i++){
		for(int j=0;j<=W;j++){
			if(j-weight[i] >= 0) dp[i][j] = max(dp[i-1][j-weight[i]]+val[i], dp[i-1][j]);
			else dp[i][j] = max(dp[i][j], dp[i-1][j]);
		}
	} */
//	cout << dp[n][W] << "\n"; 
	return 0;
}

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

public class Hello
{
    public static void Main()
    {
        var q = new Queue<int>();
        var n = int.Parse(Console.ReadLine().Trim());
        var imax = (int)Math.Pow(2, n - 1);
        for (int i = 0; i < imax; i++)
        {
            var w = int.Parse(Console.ReadLine().Trim());
            var w2 = int.Parse(Console.ReadLine().Trim());
            if (w == w2) q.Enqueue(w);
            else q.Enqueue(Math.Abs(w - w2));
        }
        Console.WriteLine(getAns(q));
    }
    public static int getAns(Queue<int> q)
    {
        while (true)
        {
            var w = q.Dequeue();
            if (q.Count() == 0) return w;
            var w2 = q.Dequeue();
            if (w == w2) q.Enqueue(w);
            else q.Enqueue(Math.Abs(w - w2));
        }
    }
}


Measured memory_bytes: 16216
n=int(input())
ar=list(map(int,input().split()))
ar.sort()
div=[0 for i in range(ar[-1]+1)]
for i in ar:
    if div[i]<=1:
        for j in range(i,ar[-1]+1,i):
            div[j]+=1
ans=0
for i in ar:
    if div[i]==1:
        ans+=1
print(ans)


Measured memory_bytes: 164608
import std.stdio, std.string, std.range, std.conv, std.array, std.algorithm, std.math, std.typecons;

alias pred = (a,b) => a < b;

void main() {
    const tmp = readln.split.to!(long[]);
    const A = tmp[0], B = tmp[1], Q = tmp[2];
    auto ss = A.iota.map!(_ => readln.chomp.to!long).array.sort!(pred);
    auto ts = B.iota.map!(_ => readln.chomp.to!long).array.sort!(pred);
    const xs = Q.iota.map!(_ => readln.chomp.to!long).array;

    Nullable!long getNearest(typeof(ss) xs, long x, bool left) {
        auto a = left ? xs.lowerBound(x) : xs.upperBound(x);

        if (a.empty) return typeof(return).init;
        return typeof(return)(left ? a.back : a.front);
    }

    Nullable!long func(long x, typeof(ss) as, typeof(ss) bs, bool leftA, bool leftB) {
        auto a = getNearest(as, x, leftA);
        if (a.isNull) return typeof(return).init;

        auto b = getNearest(bs, a, leftB);
        if (b.isNull) return typeof(return).init;

        auto s = a.get;
        auto t = b.get;
        return typeof(return)(abs(x-s) + abs(s-t));
    }

    foreach (i; 0..Q) {
        const x = xs[i];
        [
            func(x, ss, ts, false, false),
            func(x, ss, ts, false, true),
            func(x, ss, ts, true, false),
            func(x, ss, ts, true, true),
            func(x, ts, ss, false, false),
            func(x, ts, ss, false, true),
            func(x, ts, ss, true, false),
            func(x, ts, ss, true, true),
        ]
            .filter!(a => !a.isNull)
            .map!(a => a.get())
            .reduce!min.writeln;
    }
}



Measured memory_bytes: 5884
import java.util.*;

public class Main{
  public static void main(String[] args) {
    Scanner sc=new Scanner(System.in);
    String s=sc.next();
    if (s.charAt(0)==s.charAt(1)||s.charAt(1)==s.charAt(2)||s.charAt(2)==s.charAt(3)) {
      System.out.println("Bad");
    }else{
      System.out.println("Good");
    }
  }
}


Measured memory_bytes: 21844
s = input()
n = len(s)

t = s.replace('RL','AA')
i = 0
count = 0
li = [0] * len(s)

while i < n:
    if t[i] == 'R':
        count += 1
        i += 1
    elif t[i] == 'A':
        if count % 2 == 0:
            li[i] = 1 + count // 2
            li[i+1] = 1 + count // 2
        else:
            li[i] = 1 + count // 2
            li[i+1] = 2 + count // 2
        count = 0
        i += 2
    else:
        i += 1

i = 0
count = 0

while i < n:
    if t[n-1-i] == 'L':
        count += 1
        i += 1
    elif t[n-1-i] == 'A':
        if count % 2 == 0:
            li[n-1-i] += count // 2
            li[n-2-i] += count // 2
        else:
            li[n-1-i] += count // 2
            li[n-2-i] += count // 2 + 1
        count = 0
        i += 2
    else:
        i += 1

ans = ''
for i in range(n):
    ans += str(li[i])
    if i != n-1:
        ans += ' '

print(ans)


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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acosl(-1);

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	int n; cin >> n;
	string c; cin >> c;

	string str = c;
	sort(all(str));
	int ans = 0;
	rep(i, n){
		if(str[i] == 'R' and c[i] == 'W')
			ans++;
	}

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

Measured memory_bytes: 3824
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int a = 0, b = 0;
    for(int i = 0; i < 4; ++i) {
        int n;
        cin >> n;
        a += n;
    }
    for(int i = 0; i < 4; ++i) {
        int n;
        cin >> n;
        b += n;
    }
    cout << max(a, b) << endl;
    return 0;
}

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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;

    static void solve(InputReader in, PrintWriter out){
        int n = in.ni();
        int[] x = in.ni(n);
        int max = x[0], min = x[0];
        for (int i = 1; i < n; i++) {
            max = Math.max(max,x[i]);
            min = Math.min(min,x[i]);
        }
        out.println(max - min);
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

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

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n, h, w;
	
	cin >> n >> h >> w;
	
	if(h > n || w > n)
	{
		cout << 0;
		return 0;
	}
	
	cout << (n - w + 1) * (n - h + 1);
}

Measured memory_bytes: 256
from collections import *
from heapq import *
from itertools import *
from fractions import gcd
import sys
from decimal import *
import copy
from bisect import *
input=lambda :sys.stdin.readline().rstrip()

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

A.sort()
B.sort()
C.sort()

lstB=[0 for i in range(N)]
a=0
c=N-1
count=0
#print(A)
#print(B)
#print(C)

for b in range(N)[::-1]:
    while c>=0 and C[c]>B[b]:
        c-=1
    lstB[b]=N-(c+1)
b=N-1
lstA=[0 for i in range(N+1)]
for a in range(N)[::-1]:
    lstA[a]+=lstA[a+1]
    while b>=0 and B[b]>A[a]:
        lstA[a]+=lstB[b]
        b-=1


#print(lstB)
#print(lstA)
print(sum(lstA))


Measured memory_bytes: 120364
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define rep(i,n) for (int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
int main(){
  int n;
  while(cin>>n&&n){
    int dat[2*n],a,turn=0;
    for(int i=0;i<2*n;i++)dat[i]=1;
    for(int i=0;i<n;i++){
      cin>>a;a--;
      dat[a]=0;
    }
    int cnt[2],now=-1;
    cnt[0]=cnt[1]=n;
    while(1){
      bool f=true;
      for(int i=now+1;i<2*n;i++)if(dat[i]==turn){
        dat[i]=-1;
        cnt[turn]--;
        now=i;
        f=false;
        break;
      }
      if(f)now=-1;
      if(cnt[0]==0||cnt[1]==0)break;
      turn^=1;
    }
    if(cnt[0]==0)cout<<cnt[1]<<endl<<0<<endl;
    else cout<<0<<endl<<cnt[0]<<endl;
  }
}

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

int main(){
    int ans = 0;
    int n; cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    set<int> s, t;
    
    for(int i = 0; i < n; i++){
        int x = a[i];
        if(x < 400) s.insert(0);
        else if(x < 800) s.insert(1);
        else if(x < 1200) s.insert(2);
        else if(x < 1600) s.insert(3);
        else if(x < 2000) s.insert(4);
        else if(x < 2400) s.insert(5);
        else if(x < 2800) s.insert(6);
        else if(x < 3200) s.insert(7);
        else t.insert(i+7);
    }
    if(s.size() < 1){
        cout << 1 << " ";
    }else{
        cout << s.size() << " ";
    }

    put(s.size() + t.size());
}

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

namespace ITP1_7_A
{
    class Program
    {
        static void Main(string[] args)
        {
            var result = new List<char>();
            string input;
            char res;
            while ((input = Console.ReadLine()) != "-1 -1 -1")
            {
                if ((res = GetResult(input.Split(' ').Select(x => Convert.ToInt32(x)).ToArray())) == 'X')
                    Console.WriteLine("Error");
                else result.Add(res);              
            }
            foreach (var r in result) Console.WriteLine(r);                
        }
        static char GetResult(int[] score)
        {
            var score_normal = score[0] + score[1];
            if (score[0] == -1 || score[1] == -1 || score_normal < 30) return 'F';
            else if (score_normal >= 80) return 'A';               
            else if (score_normal >= 65) return 'B';               
            else if (score_normal >= 50) return 'C';                
            else if (score_normal >= 30)
            {
                if (score[2] >= 50) return 'C';
                else return 'D';
            }
            else return 'X';
        }
    }
}

Measured memory_bytes: 9284
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()
#define ll long long
const ll mod = 1e9+7;
const ll INF = 2*1e18;
const int inf = 1e9+7;
vector<pair<int,int>> p;
int main(void){
	int N,K,O;
	cin >> N >> K;
	int E = 0;
	for(int i=3;i<=N;i++){
		E += (i-2);
	}
	if(K>E){
		cout << "-1" << endl;
		return 0;
	}
	int M = 0;
	//とりあえず2から全ての辺を結ぶ
	for(int i=1;i<=N;i++){
		if(i==N)continue;
		M++;
		//printf("%d %d\n",i,N);
		p.push_back(pair<int,int>(i,N));
	}
	
	O = E-K;//Oは減らすべき頂点対の数
	int cur = 1;
	while(O){
		for(int i=cur+1;i<=N-1;i++){
			//printf("%d %d\n",cur,i);
			p.push_back(pair<int,int>(cur,i));
			M++;
			O--;
			if(O==0)break;
		}
		cur++;
	}
	cout << M << endl;
	for(auto x:p){
		printf("%d %d\n",x.first,x.second);
	}
}

Measured memory_bytes: 384
#include<stdio.h>

int main(void){

  int s,h,m;

  scanf("%d",&s);
  h=s/3600;
  m=(s-3600*h)/60;
  s=s-(3600*h+60*m);

  printf("%d:%d:%d\n",h,m,s);

  return 0;

}

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

class SegTree{
  int n;
  vector<int>dat;
public:
  SegTree(int n_){
    n = 1;
    while(n < n_) n *= 2;
    dat.resize(2*n - 1);
    for(int i = 0; i < 2*n - 1; i++) dat[i] = (1<<31) - 1;
  }
  void update(int k,int a){
    k += n - 1;
    dat[k] = a;
    while(k > 0){
      k = (k - 1)/2;
      dat[k] = min(dat[k*2 + 1], dat[k*2 + 2]);
    }
  }
  int query(int a,int b,int k = 0,int l = 0,int r = 0){
    if(r <= l) r = n;
    if(r <= a || b <= l) return (1<<31)-1;
    if(a <= l && r <= b) return dat[k];
    int vl = query(a, b, k*2 + 1, l, (r + l)/2);
    int vr = query(a, b, k*2 + 2, (r + l)/2, r);
    return min(vl,vr);
  }
};

int main(){
  int n, q, com, x, y;
  std::cin >> n >> q;
  SegTree st(n);
  for (int i = 0; i < q; i++) {
    std::cin >> com >> x >> y;
    if(com){
      std::cout << st.query(x, y + 1) << std::endl;
    }else{
      st.update(x, y);
    }
  }
  return 0;
}

Measured memory_bytes: 2060
void main(){
	int[] ngs = [7, 5, 3];
	int x = _scan();
	writeln(ngs.count(x)==1? "YES": "NO");
}

import std.stdio, std.conv, std.algorithm, std.numeric, std.string, std.math;

// 1要素のみの入力
T _scan(T= int)(){
	return to!(T)( readln().chomp() );
}

// 1行に同一型の複数入力
T[] _scanln(T = int)(){
	T[] ln;
	foreach(string elm; readln().chomp().split()){
		ln ~= elm.to!T();
	}
	return ln;
}


Measured memory_bytes: 2632
import sys


def small(grid, x, y):
    grid[x][y] += 1
    grid[x + 1][y] += 1
    grid[x][y + 1] += 1
    grid[x][y - 1] += 1
    grid[x - 1][y] += 1
    return grid


def middle(grid, x, y):
    grid[x][y] += 1
    grid[x + 1][y] += 1
    grid[x][y + 1] += 1
    grid[x][y - 1] += 1
    grid[x - 1][y] += 1
    grid[x - 1][y - 1] += 1
    grid[x - 1][y + 1] += 1
    grid[x + 1][y + 1] += 1
    grid[x + 1][y - 1] += 1
    return grid


def large(grid, x, y):
    grid[x][y] += 1
    grid[x + 1][y] += 1
    grid[x][y + 1] += 1
    grid[x][y - 1] += 1
    grid[x - 1][y] += 1
    grid[x - 1][y - 1] += 1
    grid[x - 1][y + 1] += 1
    grid[x + 1][y + 1] += 1
    grid[x + 1][y - 1] += 1
    grid[x][y + 2] += 1
    grid[x][y - 2] += 1
    grid[x + 2][y] += 1
    grid[x - 2][y] += 1
    return grid


grid = [[0 for _ in range(14)] for __ in range(14)]
for line in sys.stdin:
    d = list(map(int, line.split(",")))
    x = d[0] + 2
    y = d[1] + 2
    ink_size = d[2]
    if ink_size == 1:
        grid = small(grid, x, y)
    elif ink_size == 2:
        grid = middle(grid, x, y)
    else:
        grid = large(grid, x, y)
max_element = 0
count = 0
for i in range(2, 12):
    for j in range(2, 12):
        max_element = max(max_element, grid[i][j])
        if grid[i][j] == 0:
            count += 1
print(count)
print(max_element)



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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  // ll N; cin >> N;
  ll N, K; cin >> N >> K;
  // ll x, y, z; cin >> x >> y >> z;
  // ll a, b, c; cin >> a >> b >> c;
  // string s; cin >> s;
  vector<ll> a(N); rep(i, N) cin >> a[i];
  
  bool ok = false;
  for(ll i = 0; i < N - K; i++) {
      cout << (a[i] < a[i + K]?"Yes":"No") << endl;
  }
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


Measured memory_bytes: 4840
#include <iostream>
#include <cstdio>



int main (){
  char x,y,z;

  int sum = 700;

  std::cin >> x>>y>>z;

  if (x == 'o') {
    /* code */
    sum += 100;
  }
  if(y == 'o'){
    sum += 100;

  }
  if(z =='o'){
    sum += 100;

  }
std::cout << sum << '\n';

}

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

int main(){
    int n;
    cin >> n;
    int h[n];
    for(int i=0; i<n; i++){
        cin >> h[i];
    }
    int ans = 1;

    for(int i=1; i<n; i++){
        int judge = 0;
        for(int j=0; j<i; j++){
            if(h[j]<=h[i]){
                judge += 1;
            }if(judge == i){
                ans += 1;
            }
        }
    }

    cout << ans;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
using namespace std;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[10000001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
//long long num[100000];
int main(){
	int n,m;
	cin>>n>>m;
	cout<<(n-1)*(m-1)<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>

int main() {
	int a, b;
	auto mark = ">";
	std::cin >> a >> b;
	if (a > b)
	{
		mark = ">";
	}
	else if(a < b)
	{
		mark = "<";
	}
	else mark = "==";
	std::cout << "a" << " " << mark << " " << "b" << std::endl;
	return 0;
}

Measured memory_bytes: 3104
#include <iostream>
#define NMAX 3005
using namespace std;
string a,b;
char t[NMAX];
int v[NMAX][NMAX],k;
void sir(int x,int y)
{
    if(x>=1 && y>=1)
    {
        if(a[x]==b[y])
        {
            k++;
            t[k]=a[x];
            sir(x-1,y-1);
        }
        else
        {
            if(v[x-1][y]>v[x][y-1])
                sir(x-1,y);
            else
                sir(x,y-1);
        }
    }
}
int main()
{
    int n,m,i,j;
    cin>>a;
    cin>>b;
    a='#'+a;
    b='#'+b;
    n=a.size();
    m=b.size();
    for(i=1;i<n;i++)
    {
        for(j=1;j<m;j++)
        {
            if(a[i]==b[j])
            {
                v[i][j]=v[i-1][j-1]+1;
            }
            else
            {
                v[i][j]=max(v[i-1][j],v[i][j-1]);
            }
        }
    }
    sir(n-1,m-1);
    for(i=k;i>=1;i--)
        cout<<t[i];
    return 0;
}


Measured memory_bytes: 35456
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (1<<25)

struct P{
	int x,y;
	P(int a,int b){x = a , y = b;}
	P(){}
};
struct NODE{
	int x,y,cost,cur,id;
	NODE(P a,int c,int d,int b){
		x = a.x , y = a.y , cost = c , cur = d , id = b;
	}
};
bool operator<(const NODE &a,const NODE &b){
	return a.cost > b.cost;
}
#define next(n) ((n+1)%5)

int getCost(P a,P b){
	return abs(a.x-b.x)+abs(a.y-b.y);
}
int main(){
	int W,H;
	while(cin >> W >> H,W){
		vector<P> pos[5];
		P goal,start;
		rep(i,H)rep(j,W){
			char c;
			cin >> c;
			if(c == 'S')start = P(j,i);
			else if(c == 'G')goal = P(j,i);
			else if(c != '.')pos[c-'1'].push_back(P(j,i));
		}
		int ans = INF , choice = -1;
		rep(X,5){
			priority_queue<NODE> Q;
			Q.push(NODE(start,0,X,1023));
			int dijk[5][1024];
			rep(i,5)rep(j,1024)dijk[i][j] = INF;
			while(Q.size()){
				NODE q = Q.top(); Q.pop();
				
				if(q.cur == -1){
					if( q.cost < ans ){
						ans = q.cost;
						choice = X;
					}
					break;
				}
				
				if( next(q.cur) == X){
					Q.push(NODE(goal,q.cost+getCost(P(q.x,q.y),goal),-1,1023));
					continue;
				}
				rep(i,pos[next(q.cur)].size()){
					NODE t = NODE(pos[next(q.cur)][i] , q.cost+getCost(P(q.x,q.y),pos[next(q.cur)][i]) , next(q.cur) , i);
					if( t.cost < dijk[t.cur][t.id]){
						dijk[t.cur][t.id] = t.cost;
						Q.push(t);
					}
				}
			}
		}
		if(~choice)cout << choice+1 << " " << ans << endl;
		else cout << "NA" << endl; 
	}
}

Measured memory_bytes: 1504
# include <bits/stdc++.h>
using namespace std;
namespace Base{
	# define mr make_pair
	typedef long long ll;
	typedef double db;
	const int inf = 0x3f3f3f3f, INF = 0x7fffffff;
	const ll  infll = 0x3f3f3f3f3f3f3f3fll, INFll = 0x7fffffffffffffffll;
	template<typename T> void read(T &x){
    	x = 0; int fh = 1; double num = 1.0; char ch = getchar();
		while (!isdigit(ch)){ if (ch == '-') fh = -1; ch = getchar(); }
		while (isdigit(ch)){ x = x * 10 + ch - '0'; ch = getchar(); }
	    if (ch == '.'){
	    	ch = getchar();
	    	while (isdigit(ch)){num /= 10; x = x + num * (ch - '0'); ch = getchar();}
		}
		x = x * fh;
	}
	template<typename T> void chmax(T &x, T y){x = x < y ? y : x;}
	template<typename T> void chmin(T &x, T y){x = x > y ? y : x;}
}
using namespace Base;

const int P = 1e9 + 7, N = 5010;
int use[N], sz[N], fg[N], num, a[N], n, cnt, ans, po[N], mul[N];
vector <int> e[N];
int power(int x, int y){
	int i = x; x = 1;
	while (y > 0){
		if (y & 1) x = 1ll * i * x % P;
		i = 1ll * i * i % P;
		y /= 2;
	}
	return x;
}

void dfs(int x){
	use[x] = 1; sz[num]++;
	if (a[x] == -1) fg[num] = 2;
	for (unsigned i = 0; i < e[x].size(); i++)
		if (use[e[x][i]] == 0)
			dfs(e[x][i]);
}
int main(){
	read(n);
	for (int i = 1; i <= n; i++){
		read(a[i]);
		if (a[i] == -1) cnt++;
			else {
				e[i].push_back(a[i]);
				e[a[i]].push_back(i);
			}
	}
	for (int i = 1; i <= n; i++){
		if (!use[i]){
			num++;
			fg[num] = 1;
			dfs(i);
			if (fg[num] == 2) sz[num] *= -1;
		}
	}
	sort(sz + 1, sz + num + 1);
	po[0] = 1;
	for (int i = 1; i <= n; i++) po[i] = 1ll * po[i - 1] * (n - 1) % P;
	ans = 1ll * power(n - 1, cnt) * (n - num) % P;
	mul[0] = 1;
	for (int i = 1; i <= cnt; i++){
		sz[i] = -sz[i];
		ans = (ans + 1ll * po[cnt - 1] * (n - sz[i])) % P;
		for (int j = 1; j < i; j++){
			ans = (ans - 1ll * mul[j] * po[cnt - i] % P * sz[i] % P + P) % P;
		}
		for (int j = i; j >= 1; j--)
			mul[j] = (1ll * mul[j] * (n - 1) + 1ll * mul[j - 1] * j % P * sz[i]) % P;
		mul[0] = 1ll * mul[0] * (n - 1) % P;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3932
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define DUMP(x)  cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for(ll i = m; i < n; i++)
#define IFOR(i, m, n) for(ll i = n - 1; i >= m; i-- )
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define FOREACH(x,a) for(auto& (x) : (a) )
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main(){
  string s,t; cin >> s >> t;
  ll n = SZ(s), m = SZ(t);
  //a,b,c,...,zの出現位置を格納
  vector<vector<ll>> nxt(26);
  REP(i,n) nxt[s[i]-'a'].push_back(i+1);
  REP(i,n) nxt[s[i]-'a'].push_back(i+n+1);
  ll ans = 0;
  ll pos = 0;
  REP(i,m){
    ll c = t[i] - 'a';
    if(SZ(nxt[c])==0){
      cout << -1 << endl;
      return 0;
    }
    pos = *lower_bound(ALL(nxt[c]), pos+1);
    if(pos > n){
      pos -= n;
      ans += n;
    }
  }
  ans += pos;
  cout << ans << endl;
}



Measured memory_bytes: 2800