akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;


int main() {
  int N, M;
  cin >> N >> M;
  vector<ll> A(N);
  for (int i = 0; i < N; ++i) {
    cin >> A.at(i);
  }
  sort(A.begin(), A.end());
  
  vector<pair<ll, int>> CB(M);
  for (int i = 0; i < M; ++i) {
    cin >> CB.at(i).second >> CB.at(i).first;
  }
  sort(CB.rbegin(), CB.rend());
  
  int cur = 0;
  bool flg = false;
  for (int i = 0; i < M; ++i) {
    ll c = CB.at(i).first;
    int b = CB.at(i).second;
    int j = 0;
    while (j < b) {
      if (cur >= N) {
        flg = true;
        break;
      }
      ll a = A.at(cur);
      if (a < c) {
        A.at(cur) = c;
        ++j;
      }
      ++cur;
    }
    if (flg) {
      break;
    }
  }
  ll result = 0;
  for (int i = 0; i < N; ++i) {
    result += A.at(i);
  }
  cout << result << endl;
}

Measured memory_bytes: 2688
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s,t;
    cin>>s>>t;
    vector<char> S,T;
    int sn=s.size(),tn=t.size();
    for(int i=0;i<sn;i++){
        S.push_back(s[i]);
    }
    for(int i=0;i<tn;i++){
        T.push_back(t[i]);
    }
    sort(S.begin(),S.end());
    sort(T.begin(),T.end(),greater<char>());
    string A="",B="";
    for(int i=0;i<sn;i++){
        A.push_back(S[i]);
    }
    for(int i=0;i<tn;i++){
        B.push_back(T[i]);
    }
    cout<<(A<B?"Yes":"No")<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String[]args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = a / 3600;
		int c = a % 3600;
		int d = c / 60;
		int e = c % 60;
		System.out.println(b+":"+d+":"+e);
		 }
	 } 

Measured memory_bytes: 17304
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int MOD=(int)1e9+7;
const int INF=(int)1e9;
const ll LINF=(ll)1e18;

int main(){
    int n,m;
    cin>>n>>m;
    bool a[n+1]={};
    int cnt[n+1]={};
    int ac=0;
    int pe=0;
    for(int i=0;i<m;i++){
        int p;
        string s;
        cin>>p>>s;
        if(a[p])continue;
        if(s[0]=='A'){
            ac++;
            a[p]=true;
            pe+=cnt[p];
        }
        else{
            cnt[p]++;
        }
    }
    cout<<ac<<" "<<pe<<endl;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define pb push_back
#define N 500100
#define MOD 1000000007
#define fn(i,n) for(int i=0;i<n;i+=1)
#define rep(i,l,r) for(int i=l;i<=r;i+=1)
#define INF 100000000000000
#define pii pair<int,int>
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int power(int x,int y){
    int res=1LL;
    while(y){
        if(y&1){
            res=(res*x)%MOD;
        }
        x=(x*x)%MOD;
        y=(y>>1);
    }
}

int n;string s;
int xd[N];
int tree[4*N][26]={0};
void build(int node,int st,int en){
    if(st==en){        
        tree[node][xd[st]]++;        
    }
    else{
        int mid=(st+en)>>1;
        build(2*node+1,st,mid);
        build(2*node+2,mid+1,en);
        for(int i=0;i<26;i++){
            tree[node][i]=tree[2*node+1][i]+tree[2*node+2][i];
        }
    }
}
void update(int node,int st,int en,int idx,int val){
    if(st==en){
        tree[node][xd[idx]]--;
        xd[idx]=val;
        tree[node][xd[idx]]++;
    }
    else{
        int mid=(st+en)>>1;
        if(st<=idx && idx<=mid){
            update(2*node+1,st,mid,idx,val);
        }
        else{
            update(2*node+2,mid+1,en,idx,val);
        }
        for(int i=0;i<26;i++){
            tree[node][i]=tree[2*node+1][i]+tree[2*node+2][i];
        }
    }

}
vector <int> query(int node,int st,int en,int l,int r){
    if(r<st || l>en){
        vector <int> p(26,0);
        return p;
    }
    if(l<=st && r>=en){
        vector <int> cnt(26,0);
        for(int i=0;i<26;i++){
            cnt[i]=(tree[node][i]);
        }
        return cnt;
    }
    int mid=(st+en)>>1;
    vector <int> p1=query(2*node+1,st,mid,l,r);
    vector <int> p2=query(2*node+2,mid+1,en,l,r);
    vector <int> res(26,0);
    for(int i=0;i<26;i++){
        res[i]=(p1[i]+p2[i]);
    }
    return res;
}
signed main()
{
    
    speed
    cin>>n;cin>>s;
    for(int i=0;i<n;i++){
        xd[i]=(s[i]-'a');
    }
    build(0,0,n-1);
 
    int q;cin>>q;
    while(q--){
        int lol;cin>>lol;
        if(lol==1){
            int idx,val;char c;
            cin>>idx>>c;
            val=c-'a';
            update(0,0,n-1,idx-1,val);
        }
        else{
            int l,r;cin>>l>>r;
            vector <int> ans=query(0,0,n-1,l-1,r-1);
            int cnt=0;
            for(int i=0;i<26;i++){
                cnt+=(ans[i]>0);
            }
            cout<<cnt<<endl;

        }
    }


    
    return 0;
}

Measured memory_bytes: 220700
import java.util.*;
import java.lang.*;
import java.math.*;

public class Main {
	Scanner sc = new Scanner(System.in);
	void run(){
		int s = sc.nextInt();
		s--;
		int n = sc.nextInt();
		for(int i =0 ;i < n ;i++){
			int a = sc.nextInt();
			int b = sc.nextInt();
			a--;
			a = Math.min(s-a, a);
			b--;
			b = Math.min(s-b, b);
			int c = Math.min(a, b);
			c = c%3;
					System.out.println(c+1);
		}
		
	}
	public static void main(String[] args){
		Main m = new Main();
		m.run();
	}
}

Measured memory_bytes: 13000
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <deque>
#include <numeric>
using namespace std;
using ll = long long;

#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(elem, _list) for(auto& (elem) : (_list))
#define view(_list) foreach(e, _list){ cout << e << sp; } cout << next
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define ALL(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e)
#define INF 1e+8
#define PI acos(-1)
#define TAU PI * 2
const ll MOD = 1000000007;

int main(){
    int s, w;
    cin >> s >> w;
    if(s <= w){
        cout << "unsafe" << endl;
    }else{
        cout << "safe" << endl;
    }
}

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

using namespace std;

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

    int n = 0;
    if (s == "SUN") { n = 7; }
    if (s == "MON") { n = 6; }
    if (s == "TUE") { n = 5; }
    if (s == "WED") { n = 4; }
    if (s == "THU") { n = 3; }
    if (s == "FRI") { n = 2; }
    if (s == "SAT") { n = 1; }
    cout << n;

    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

            int ans = Integer.MIN_VALUE;
            for (int i = 0; i < n; i++) {
                for (int j = i + 1; j < n; j++) {
                    int candidate = Math.abs(a[i] - a[j]);
                    if (candidate > ans) {
                        ans = candidate;
                    }
                }
            }

            System.out.println(ans);

        }
    }

}


Measured memory_bytes: 23764
import numpy as np
H = np.array([int(i) for i in input()])
p1 = np.array([1 if i %2==0 else 0 for i in range(len(H)) ])
p2 = np.array([0 if i %2==0 else 1 for i in range(len(H)) ])
print(min([np.sum(H!=p1),np.sum(H!=p2)]))

Measured memory_bytes: 20800
a,b,c,d=map(int,input().split())
list1=[a*c,a*d,b*c,b*d]
if (b<0 and c>0) or (a>0 and d<0):
  ans=max(list1)
else:
  list1.append(0)
  ans=max(list1)
print(ans)

Measured memory_bytes: 9180
#include <stdio.h>

int main(void) {
  int N, Q;
  scanf("%d%d", &N, &Q);
  char S[100000+1];
  scanf("%s", S);
  
  int num[100000+1];
  int AC = 0;
  num[0] = 0;
  for(int i = 0; i < N-1; i++) {
    if(S[i] == 'A' && S[i+1] == 'C') AC++;
    num[i+1] = AC;
  }
  num[N-1] = AC;

  int ans[100000+1];
  for(int i = 0; i < Q; i++) {
    int l, r;
    scanf("%d%d", &l, &r);
    ans[i] = num[r-1] - num[l-1];
  }

  for(int i = 0; i < Q; i++) {
    printf("%d\n", ans[i]);
  }
  return 0;
}


Measured memory_bytes: 1664
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<sstream>
using namespace std;

string func(string,int,int);

int main(){
  int n,i;
  string str;

  while(1){
    scanf("%d",&n);
    if(n==0){
      break;
    }
    
    i=0;
    while(getchar()!='\n'){}
    getline(cin,str);

    str=func(str,n,i);

    printf("%s\n",str.c_str());
  }
  return 0;
}

string func(string str,int n,int i){
  if(i==n){
    return str;
  }

  int l,count=1;
  stringstream ss;
  string str1="";
  char check[1];check[0]=str[0];
  for(l=1;l<(int)str.size();l++){
    if(check[0]!=str[l]){
      ss<<count<<str[l-1];
      str1+=ss.str();

      check[0]=str[l];
      count=1;

      ss.str("");//バッファをクリア
      ss.clear(stringstream::goodbit);//ストリームの状況をクリア
    }
    else{
      count++;
    }
  }
  ss<<count<<str[l-1];
  str1+=ss.str();
  
  ss.str("");//バッファをクリア
  ss.clear(stringstream::goodbit);//ストリームの状況をクリア

  return func(str1,n,i+1);
}

Measured memory_bytes: 1308
#include<iostream>
#include<algorithm>
#include<string>
#include<functional>
#include<utility>
#include<stack>
#include<queue>
#include<cmath>
#include<list>
#include<cstdint>
#include<vector>
#include<map>
#include<deque>
#define rep(i,rept)	for(int i = 0; i<(ll)rept;++i)
typedef long long ll;
using namespace std;

//26日目

string merge(string S, string T, int left) {
	for (int i = 0; i < S.size(); i++) {
		if (S[i] == '?') {
			S[i] = 'a';
		}
	}

	for (int j = 0; j < T.size(); j++) {
		S[j + left] = T[j];
	}

	return S;
}


bool check(string part_S, string T) {
	for (int i = 0; i < T.size(); i++) {
		if ((part_S[i] != '?') && (part_S[i] != T[i])) {
			return false;
		}
	}
	return true;
}


int main() {

	using namespace std;

	string S;
	string T;

	cin >> S;
	cin >> T;

	if (S.size() < T.size()) {
		cout << "UNRESTORABLE" << endl;
	}
	else {
		for (int i = S.size() - T.size(); i >= 0; i--) {
			string part_S = S.substr(i, T.size());
			if (check(part_S, T)) {
				cout << merge(S, T, i) << endl;
				return 0;
			}
		}
		cout << "UNRESTORABLE" << endl;
	}

}


Measured memory_bytes: 256
import numpy as np
H, W, K = map(int, input().split())

s = np.zeros((H, W), dtype=int)
num = 1
for i in range(H):
    _s = input()
    for j in range(W):
        if _s[j] == '#':
            s[i,j] = num
            num += 1
        else:
            s[i,j] = 0

flg = False
for i in range(H):
    if all(s[i,:] == 0):
        if flg:
            s[i,:] = s[i-1,:]
    else:
        flg = True
        prej = 0
        for j in range(W):
            if s[i, j] != 0:
                num = s[i, j]
                s[i, prej:j] = num
                prej = j+1
        else:
            s[i, prej:] = num

for i in range(H-1, -1, -1):
    if all(s[i,:] == 0):
        s[i,:] = s[i+1,:]
            
for i in range(H):
    ans = ''
    for j in range(W):
        ans += str(s[i, j]) + ' '
    print(ans)


Measured memory_bytes: 18592
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
template<typename T> istream& operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream& operator<<(ostream &os, vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream& operator<<(ostream &os, set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream& operator<<(ostream &os, pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream& operator<<(ostream &os, map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
#define dbg(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ") " << __FILE__ << endl;

int N, M, S[2];
vector<int> U, V;
vector<int> to[100001];
vector<lint> C[2], d[2];

int main()
{
    cin >> N >> M >> S[0] >> S[1];
    S[0]--;
    S[1]--;
    REP(e, M)
    {
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        U.push_back(u - 1);
        V.push_back(v - 1);
        C[0].push_back(a);
        C[1].push_back(b);
        to[u - 1].push_back(e);
        to[v - 1].push_back(e);
    }

    REP(i, 2)
    {
        d[i].resize(N, 1E15);
        d[i][S[i]] = 0;
        priority_queue<plint, vector<plint>, greater<plint>> pq;
        for (auto e : to[S[i]]) pq.push(plint(C[i][e], U[e] + V[e] - S[i]));

        while (!pq.empty())
        {
            auto pa = pq.top();
            pq.pop();
            int now = pa.second;
            if (d[i][now] > pa.first)
            {
                d[i][now] = pa.first;
                for (auto e : to[now])
                {
                    int nxt = U[e] + V[e] - now;
                    if (d[i][nxt] > d[i][now] + C[i][e]) pq.push(plint(d[i][now] + C[i][e], nxt));
                }
            }
        }
    }

    vector<lint> ans;
    lint tmp_cost = 1E15;
    IREP(i, N)
    {
        tmp_cost = min(tmp_cost, d[0][i] + d[1][i]);
        ans.push_back(tmp_cost);
    }
    IREP(i, N) cout << (lint)1E15 - ans[i] << endl;
}


Measured memory_bytes: 13016
from math import gcd
N = int(input())
A = list(map(int,input().split()))

g = A[0]
for i in range(1,N):
    g = gcd(g,A[i])

if g>1:
    print("not coprime")
    exit()

MAXN = 10**6 + 9
D = [i for i in range(MAXN+1)]
p = 2
while(p*p <=MAXN):
    if D[p]==p:
        for q in range(2*p,MAXN+1,p):
            if D[q]==q:
                D[q]=p
    p+=1

st = set()
for a in A:
    tmp = set()
    while(a>1):
        tmp.add(D[a])
        a //=D[a]
    for p in tmp:
        if p in st:
            print("setwise coprime")
            exit()
        st.add(p)

print("pairwise coprime")


Measured memory_bytes: 216920
#include <stdio.h>
#include <string.h>
int main()
{   char s[11];
    scanf("%s",s);
    int l=strlen(s),max=0,cnt=0;
    for(int i=0;i<l;i++){
        if(s[i]=='A'||s[i]=='T'||s[i]=='G'||s[i]=='C'){
            cnt++;
            if(cnt>max){
                max=cnt;
            }}else{
                cnt=0;
            }
        
    }printf("%d",max);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int f[200010][41],a[200010],nxt[200010],pos[200010];
int ans[200010],mark[200010];
int i,j,k,n,m,x,y,t;
ll T;
int main(){
	scanf("%d%lld",&n,&T);
	for (i=1;i<=n;i++)scanf("%d",&a[i]);
	for (i=1;i<=n;i++)if (!pos[a[i]])pos[a[i]]=i;
	for (i=n;i>=1;i--)nxt[i]=pos[a[i]]%n,pos[a[i]]=i;f[n+1][0]=1;
	for (i=n;i>=1;i--){
		if (i==n&&nxt[i]==0){f[i][0]=n+1;continue;}
		if (nxt[i]<=i)f[i][0]=nxt[i]+1;else f[i][0]=f[nxt[i]+1][0];
	}
	for (i=1;i<=40;i++)for (j=1;j<=n+1;j++)f[j][i]=f[f[j][i-1]][i-1];
	x=1;T--;
	for (i=40;i>=0;i--)if ((1ll<<i)<=T)
		x=f[x][i],T-=(1ll<<i);
	for (i=x;i<=n;i++){
		if (mark[a[i]]){
			while (ans[ans[0]]!=a[i]){
				mark[ans[ans[0]]]=0;
				ans[0]--;
			}
			mark[a[i]]=0;ans[0]--;
		}
		else ans[++ans[0]]=a[i],mark[a[i]]=1;
	}
	for (i=1;i<=ans[0];i++)printf("%d ",ans[i]);
	return 0;
}


Measured memory_bytes: 37376
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

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

string S;

int main(){
    cin>>S;
    sort(S.begin(),S.end());
    out((S=="abc"?"Yes":"No"));

}


Measured memory_bytes: 256
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>

int main()
{
    int H, N;
    std::cin >> H;
    std::cin >> N;
    
    int sum = 0;
    
    for (int i = 0; i < N; i++) {
        int x;
        std::cin >> x;
        sum += x;
        
        if (sum >= H) {
            std::cout << "Yes" << std::endl;
            return 0;
        }
    }
    
    std::cout << "No" << std::endl;
    
   return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

class Main {

  private static int N;

  private static int A, B, C;

  private static int[] l;

  private static int abs(int n) {
    return Math.abs(n);
  }

  private static int INF = Integer.MAX_VALUE / 4;

  public static int rec(int i, int a, int b, int c) {
    if (i == N) {
      if (a == 0 || b == 0 || c == 0) {
        return INF;
      }
      return abs(a - A) + abs(b - B) + abs(c - C) - 30;
    }
    int res0 = rec(i + 1, a + l[i], b, c) + 10;
    int res1 = rec(i + 1, a, b + l[i], c) + 10;
    int res2 = rec(i + 1, a, b, c + l[i]) + 10;
    int res3 = rec(i + 1, a, b, c);
    return Math.min(Math.min(Math.min(res0, res1), res2), res3);
  }

  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    N = scanner.nextInt();
    A = scanner.nextInt();
    B = scanner.nextInt();
    C = scanner.nextInt();
    l = new int[N];
    for (int i = 0; i < N; i++) {
      l[i] = scanner.nextInt();
    }
    System.out.println(rec(0, 0, 0, 0));
  }

}


Measured memory_bytes: 24740
x, n = map(int, input().split())
if n == 0:
    print(x)
else:
    p = [int(i) for i in input().split()]
    q = [x]
    for i in range(200):
        q.append(x - 1 - i)
        q.append(x + 1 + i)
    for i in q:
        if i not in p:
            print(i)
            break

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


int main() {
  string S;
  long N,a=0;
  cin>>S>>N;
  for(long long i=0;i<N;i++){
    if(S.at(i)!='1'){
      cout<<S.at(i);
      a=1;
      break;
    }
  }
  if(a==0){
    cout<<'1';
  }
  
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(void) {
	long long int n, k;
	long long int re = 0;;
	cin >> n >> k;
	if (k != 0) {
		for (long long int i = k + 1; i <= n; i++) {
			re += (n / i) * (i - k);
			if (n % i - k + 1 > 0)re += n % i - k + 1;
		}
		cout << re << endl;
	}
	else cout << n * n << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void)
{
	int n,m;
	cin>>n>>m;
  	int ar[n][m];
  	for(int i=0;i<n;++i)
    {
      for(int j=0;j<m;++j)
      {
        cin>>ar[i][j];
      }
    }
  	int res=0;
  	double dist;
  	for(int i=0;i<n;++i)
    {
      for(int j=i+1;j<n;++j)
      {
        dist=0;
        for(int k=0;k<m;++k)
        {
          dist+=(abs(ar[i][k]-ar[j][k])*abs(ar[i][k]-ar[j][k]));
        }
        //cout<<dist<<endl;
        if(sqrt(dist)-floor(sqrt(dist))==0)
           ++res;
      }
    }
  	cout<<res<<endl;
  	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
int cnt[100];
int main() {
    int a,b;
    while (scanf("%d%d",&a,&b)!=EOF) {
        for (int i=0; i<100; i++) cnt[i]=0;
        cnt[a-1]++; cnt[b-1]++;
        while (scanf("%d%d",&a,&b)) {
            if (!a&&!b) break;
            cnt[a-1]++; cnt[b-1]++;
        }
        int odd=0;
        for (int i=0; i<100; i++) {
            if (cnt[i]%2!=0) odd++;
        }
        if (odd==2) puts("OK");
        else puts("NG");
    }
}

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

N, K, Q = gli
counts = Array.new(N, 0)
Q.times do |t|
  t = gi
  counts[t - 1] += 1
end

counts.each do |v|
  puts K - (Q - v) > 0 ? 'Yes' : 'No'
end


Measured memory_bytes: 4860
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <complex>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <limits>
#include <time.h>
#include <cstdint>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rRep(i,a,b) for(ll i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
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);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

ll N,M;
vector<vector<ll>> E(100007);
ll  Ch[100007],Pre[100007],C[100007];
ll Z=0;

vector<ll>  V,F; 
int main(){
  cin >> N >>M;
  rep(i,M){
    ll A,B;
    cin >> A >> B;
    E[A].pb(B);
    E[B].pb(A);
  }
  V.pb(1);
  V.pb(E[1][0]);
  C[1]=1;
  C[E[1][0]]=1;
  while(1){
    ll Z=0;
    ll key=V[V.size()-1];
    rep(i,E[key].size()){
      if(C[E[key][i]]==0){
        V.pb(E[key][i]);
        C[E[key][i]]=1;
        Z=1;
        break;
      }
    }
    if(Z==0){
      break;
    }
  }
  ll key =V[0];
  while(1){
    ll Z=0;
    rep(i,E[key].size()){
      if(C[E[key][i]]==0){
        F.pb(E[key][i]);
        C[E[key][i]]=1;
        key=F[F.size()-1];
        Z=1;
        break;
      }
    }
    if(Z==0){
      break;
    }
  }
  cout << F.size()+V.size() << endl;
  reverse(ALL(F));
  if(F.size()>0){
    cout << F << " ";
  }
  cout << V << endl;
}


Measured memory_bytes: 10380
/**
 * ?´???°?????°

???????????´??° a???b???c ??????????????????a ?????? b ?????§?????´??°????????????c
????´???°?????????????????????????±???????????????°????????????????????????????????????

Input
a???b???c ?????????????????????????????§??????????????????????????????

Output
?´???°?????°???????????????????????????????????????

Constraints
1???a,b,c???10000

Sample Input
5 14 80
Sample Output
3

 */

#include <iostream>
#include <sstream>

int main(int argc, char const *argv[]) {
  unsigned int a, b, c;
  a = b = c = 1;

  while (true) {
    std::string param;

    getline(std::cin, param);
    std::istringstream iss(param);
    iss >> a >> b >> c;

    if ((a < 1 || a > 10000) || (b < 1 || b > 10000) || (c < 1 || c > 10000)) {
      std::cout << "Error: 1 <= a, b, c <= 10000" << std::endl;
    } else {
      break;
    }
  }

  unsigned int count = 0;
  for (size_t i = a; i <= b; i++) {
    if (c % i == 0) {
      count++;
    }
  }
  std::cout << count << std::endl;
  
  return 0;
}

Measured memory_bytes: 3184
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
 
int N;
double p[3000];
double a[3000][6001];

double num(int n,int m)
{
  double temp;
  
  if(a[n][3000+m]>-0.5)
  {
    return a[n][3000+m];
  }
  else if(n>abs(m)+1)
  {
    temp=p[n]*num(n-1,m-1)+(1-p[n])*num(n-1,m+1);
  }
  else if(n==m || n==m+1)
  {
    temp=p[n]*num(n-1,m-1);
  }
  else if(n==-m || n==-m+1)
  {
    temp=(1-p[n])*num(n-1,m+1);
  }
    a[n][m+3000]=temp;
  
  return temp;
}
 
int main()
{
  
  int i,j;
  double s,t;
  scanf("%d",&N);
  for(i=1;i<N+1;i++)
  {
    scanf("%lf",&p[i]);
  }

  for(i=0;i<3000;i++)
  {
    for(j=0;j<6001;j++)
    {
      a[i][j]=-1.;
    }
  }
  a[1][3001]=p[1];
  a[1][2999]=1.-p[1];
  a[1][3000]=0.;

  s=0.;
  for(i=1;i<N+1;i++)
  {
    s+=num(N,i);
  }
  
  printf("%.16f",s);
  
  return 0;
}

Measured memory_bytes: 141056
N,D = map(int,input().split())
X = [list(map(int,input().split())) for _ in range(N)]

def dist_sq(x,y):
    ret = 0
    for i in range(D):
        ret += (x[i]-y[i])**2
    return ret

SQ,a = set([]),1
while a**2 <= 40**2*D:
    SQ.add(a**2)
    a += 1

ans = 0
for i in range(N):
    for j in range(i+1,N):
        if dist_sq(X[i],X[j]) in SQ:
            ans += 1

print(ans)


Measured memory_bytes: 3064
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		sa = br.readLine().split(" ");
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = Integer.parseInt(sa[i]);
		}
		br.close();

		long now = 1000;
		long cnt = 0;
		for (int i = 0; i < n - 1; i++) {
			if (a[i] < a[i + 1]) {
				cnt += now / a[i];
				now %= a[i];
			}
			if (a[i] > a[i + 1]) {
				now += a[i] * cnt;
				cnt = 0;
			}
		}
		now += a[n - 1] * cnt;
		System.out.println(now);
	}
}


Measured memory_bytes: 32496
n = int(input())
a = [int(i) for i in input().split()]

count1 = 0
count2 = 0
sum = 0

for i in range(0,n):
    if i % 2 == 0:
        if sum + a[i] > 0:
            sum += a[i]
            continue
        elif sum + a[i] <= 0:
            count1 += abs(1 - sum -a[i])
            sum = 1
    elif i % 2 == 1:
        if sum + a[i] < 0:
            sum += a[i]
            continue
        else:
            count1 += abs(-1 - sum - a[i])
            sum = -1

sum = 0
for i in range(0,n):
    if i % 2 == 1:
        if sum + a[i] > 0:
            sum += a[i]
            continue
        elif sum + a[i] <= 0:
            count2 += abs(1 - sum -a[i])
            sum = 1
    elif i % 2 == 0:
        if sum + a[i] < 0:
            sum += a[i]
            continue
        else:
            count2 += abs(-1 - sum - a[i])
            sum = -1

if count1 >= count2:
    print(count2)
else:
    print(count1)


Measured memory_bytes: 20404
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
const int N=2e5+5;
string str;
int main(){
	ios::sync_with_stdio(false);cin.tie(0);
	cin>>str;
	int s=1<<3;
	bool flag=true;
	for(int i=0;i<s&&flag;i++){
		int res=str[0]-'0';
		for(int j=0;j<3;j++){
			int sub=(i>>j)&1;
			int v=str[j+1]-'0';
			if(sub)	res-=v;
			else	res+=v;
		}
		if(res==7){
			cout<<str[0];
			for(int j=0;j<3;j++){
				if((i>>j)&1)	cout<<'-';
				else	cout<<'+';
				cout<<str[j+1];
			}
			cout<<"=7"<<'\n';
			flag=false;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
const int N=1000005,P=1e9+7;
int n,C,w,ans,iv[N],f[N],g[N];
int main(){
	//freopen("1.in","r",stdin);
	scanf("%d",&n);
	iv[1]=f[0]=C=w=1;
	FOR(i,2,N-5) iv[i]=1ll*iv[P%i]*(P-P/i)%P;
	FOR(i,1,N-5) f[i]=2ll*g[i-1]%P,g[i]=(g[i-1]+f[i-1])%P;
	FOR(i,1,n){
		C=1ll*C*(n-i+1)%P*iv[i]%P;
		w=1ll*w*iv[3]%P;
		(ans+=1ll*C*g[i]%P*iv[i]%P)%=P;
	}
	ans=1ll*ans*w%P*iv[n]%P;
	cout<<ans<<'\n';
}

Measured memory_bytes: 11904
package main
 
import (
	"bufio"
	"fmt"
	"log"
	"os"
	"strconv"
)
 
func run() {

	var N int;
    N = nextInt();
	solve(N);

}

func solve(N int){
	for i := 1; i <= 9; i++ {
		for j := 0; j <= 9; j++ {
			if i*j == N {
				Println("Yes")
				return
			}
		}
	}
	Println("No")
}


// --- template ---
// Thanks https://gist.github.com/halllllll/853ab587fd82ee3ffe6f7fb7fb499695
 
var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)
 
// Caution: You will get unexpected result if a single token is larger than this size.
const BufferSize = 64 * 1024 * 1024
 
func Print(a ...interface{}) (n int, err error) {
	return fmt.Fprint(out, a...)
}
 
func Printf(format string, a ...interface{}) (n int, err error) {
	return fmt.Fprintf(out, format, a...)
}
 
func Println(a ...interface{}) (n int, err error) {
	return fmt.Fprintln(out, a...)
}
 
func next() string {
	sc.Scan()
	return sc.Text()
}
 
func nextInt() int {
	a, err := strconv.Atoi(next())
	if err != nil {
		log.Fatal(err)
	}
	return a
}

func nextFloat() float64 {
	a, err := strconv.ParseFloat(next(), 64)
	if err != nil {
		log.Fatal(err)
	}
	return a
}


type IntHeap []int
func (h IntHeap) Len() int           { return len(h) }
func (h IntHeap) Less(i, j int) bool { return h[i] > h[j] }
func (h IntHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *IntHeap) Push(x interface{}) {
	// Push and Pop use pointer receivers because they modify the slice's length,
	// not just its contents.
	*h = append(*h, x.(int))
}

func (h *IntHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

/////数字と文字
// 基本クラス
type NS struct {
    Num int
    Str string
}

//////　数字と数字
// 基本クラス
type NN struct {
    Num1 int
    Num2 int
}

 
func main() {
	sc.Buffer(make([]byte, 0, BufferSize), BufferSize)
	sc.Split(bufio.ScanWords)
	run()
	out.Flush()
}



Measured memory_bytes: 2816
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();

		int nana = 7;
		int ans = -1;
		for (int i = 1; i <= k; i++) {
			if (nana % k == 0) {
				ans = i;
				break;
			}
			nana = (nana * 10 + 7)  % k;
		}

		System.out.println(ans);


		sc.close();

	}

}


Measured memory_bytes: 35660
N = int(input())
H = [int(zz) for zz in input().split()][::-1]
p = H[0]

for i in range(N):
    if H[i] > p:
        H[i] -= 1
        if H[i] > p:
            print('No')
            exit()
    p = H[i]

print('Yes')

Measured memory_bytes: 14396
//INCLUDE
//------------------------------------------
#include <bits/stdc++.h>
//DEFINE
//------------------------------------------
#define ll long long
#define ld long double
#define ALLv(a)  (a).begin(),(a).end()
#define ALL(a,n)  (a),(a)+n
#define vi vector<long long>
#define vd vector<long double>
#define vs vector<string>
//CONST
//------------------------------------------
#define INF 1010000000000000017LL
#define MOD 1000000007LL
#define EPS 1e-12
#define PI 3.14159265358979323846
//REPEAT
//------------------------------------------
#define   FOR(i,m,n) for(ll (i)=(m);   (i)<(n);  (i)++)
#define   REP(i,n)   for(ll (i)=0;     (i)<(n);  (i)++)
#define  REPS(i,x)   for(ll (i)=1;     (i)<=(x); (i)++)
#define  RREP(i,x)   for(ll (i)=(x)-1; (i)>=0;   (i)--)
#define RREPS(i,x)   for(ll (i)=(x);   (i)> 0;   (i)--)
#define  WREP(i,in,j,jn) REP(i,in)REP(j,jn)
//-----------------------------------------
#define ifYN(x) cout<<(x?"Yes":"No")<<"\n" 
#define dcml(n) fixed<<setprecision(n)

 
ll GCD(ll a,ll b) { return b ? GCD(b,a%b) : a; } 
ll LCM(ll a,ll b) { return a/GCD(a,b)*b; } 
ll Factorial(ll n){ ll m=1;while(n>=1)m*=n--;return m; } 
ll modPow(ll x,ll n,ll mod=MOD){ 
    return (!n?1:!n%2?modPow(x*x,n/2,mod)%mod:x%mod*modPow(x,n-1,mod)%mod); 
} 
using namespace std;
//-------------------------------------------
typedef pair<ll,ll> P;
int main(void){
    ll N;cin>>N;
    cout<<N*N*N<<"\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ull unsigned long long
#define mod 1000000007
#define INF (1 << 30)
#define MAX (1 << 20)

ll power(ll base, ll p, ll pr){
    ll ans = 1;

    if(base == 1)
        return 1;

    if(base == 0)
        return 0;

    while(p){
        if(p&1)
            ans = (ans*base)%pr;

        base = (base*base)%pr;
        p >>= 1;
    }

    return ans;
}

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

    int n, k;

    cin >> n >> k;

    ll arr[n];
    ll fact[n+1];

    fact[0] = 1;

    for(ll i = 1; i <= n; i++){
        fact[i] = (fact[i-1]*i)%mod;
    }

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

    if(k == 1){
        cout << 0 << endl;
        return 0;
    }

    ll nCr[n+1];

    nCr[k-2] = 1;

    for(int i = k-1; i <= n; i++){
        //cout << "factorial: " << fact[i] << endl;
        nCr[i] = (((fact[i]*power(fact[((i-k)+2)], mod-2, mod))%mod)*power(fact[k-2], mod-2, mod))%mod;
        //cout << "val: " << i << " " << nCr[i] << endl;
    }

    ll nCr_suff[n+1];

    nCr_suff[k-2] = nCr[k-2];

    for(int i = k-1; i <= n; i++){
        nCr_suff[i] = (nCr_suff[i-1] + nCr[i])%mod;
    }

    sort(arr, arr+n);

    int max_itrs = (n - k) + 1;

    ll ans = 0;

    for(int i = 0; i < max_itrs; i++){
        ans = ans - ((nCr_suff[n-i-2]*arr[i])%mod);

        while(ans < 0)
            ans += mod;
    }

    for(int i = k-1; i < n; i++){
        ans = ans + ((nCr_suff[i - 1]*arr[i])%mod);

        while(ans >= mod)
            ans -= mod;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2560
let () =
  let max a b = if a > b then a else b in
  let min a b = if a < b then a else b in
  let rec loop () =
    let a, b = Scanf.scanf "%d %d\n" (fun a b -> a, b) in
    if a = 0 && b = 0 then ()
    else (Printf.printf "%d %d\n" (min a b) (max a b); loop ()) in
  loop ()

Measured memory_bytes: 3816
#include <iostream>
using namespace std;
int main(){
  int a,b,n,s,f,i=0;
  cin >> a >> b >> n;
  while(1){
    cin >> s >> f;
    if((a >= s && b <= f) || (s > a && s < b) || (f > a && f < b)){
      cout << '1' << endl;
      break;
    }
    if(++i >= n){
      cout << '0' << endl;
      break;
    }
  }
}


Measured memory_bytes: 3092
Imports System.Console
Module Module1
    Dim ans As Integer
    Sub Main()
        Dim s() As String = ReadLine().Split
        Dim n As Int64 = s(0)
        Dim d As Int64 = s(1)
        d ^= 2
        Dim x As Int64
        Dim y As Int64
        For i = 1 To n
            s = ReadLine().Split
            x = s(0)
            y = s(1)
            If (x ^ 2 + y ^ 2) <= d Then
                ans += 1
            End If
        Next
        WriteLine(ans)
    End Sub
End Module


Measured memory_bytes: 41620
# 以下DFSでやろうとしたけど全然ダメだった奴

import copy
import itertools

# N頂点M辺
N, M = map(int, input().split())

# グラフのリスト　各頂点からどこの頂点に向かって辺が伸びてるかという情報
# 2次元配列初期化
graph_list = [[] for i in range(N)]
a_b_list = []

for i in range(M):
    a, b = map(int, input().split())
    a_b_list.append([a - 1, b - 1])
    graph_list[a - 1].append(b - 1)
    graph_list[b - 1].append(a - 1)

# グラフのDFS
def dfs(i, current, graph_list, visited):

    for j in graph_list[current]:
        if visited[j] == False:
            # 現在地を書き込む
            visited[j] = True
            # 次の頂点に移動する
            dfs(i + 1, j, graph_list, visited)

    # 全ての頂点を通ったかどうか判定
    if all(visited):
        return True
    else:
        return False


# 橋の数
count_bridge = 0

for m in range(M):
    graph_list_tmp = copy.deepcopy(graph_list)

    a = a_b_list[m][0]
    b = a_b_list[m][1]

    graph_list_tmp[a].pop(graph_list_tmp[a].index(b))
    graph_list_tmp[b].pop(graph_list_tmp[b].index(a))

    # 頂点を通ったかどうか
    visited = [False] * N
    visited[0] = True
    # 一度でも全ての頂点がTrueになったかどうか
    is_visited_all = False
    result = dfs(0, 0, graph_list_tmp, visited)

    if result != True:
        count_bridge += 1

print(count_bridge)



Measured memory_bytes: 3572
N, M = map(int, input().split())

AB = []
for i in range(N):
    AB.append(list(map(int, input().split())))

AB.sort(key=lambda x: (x[0], x[1]))

ct = 0
money = 0
for i in AB:
    A, B = i[0], i[1]
    money += A*B
    ct += B
    if ct >= M:
        money -= (ct - M)*A
        break

print(money)


Measured memory_bytes: 35296
#include<iostream>
using namespace std;
 
int main(){
 
  int n;
  cin >> n;
  string s[n+1];
  int cnt = 0;
  int start = 0;
  int end = 0;
  int both = 0;
 
  for(int i=0; i<n; ++i){
  	cin >> s[i];
  }
  
  for(int i=0; i<n; ++i){
  	if(s[i][0] == 'B' && s[i][s[i].length()-1] != 'A'){
     	start++;
    }
    if(s[i][s[i].length()-1] == 'A' && s[i][0] != 'B'){
     	end ++; 
    }
    if(s[i][0] == 'B' && s[i][s[i].length()-1] == 'A'){
    	both ++;
    }
  }
  
  for(int i=0; i<n; ++i){
  	while(s[i].find("AB") != -1){
      int num = s[i].find("AB");
      s[i][num] = 'C';
      cnt ++;
    }
  }
  
  if(both == 0){
  	cnt += min(start,end);
    cout << cnt << endl;
  }
  else if(both > 0 && (start > 0 || end > 0)){
    cnt += both + min(start,end);
    cout << cnt << endl;
  }else if(both > 0 && start == 0 && end == 0){
    cnt += both - 1;
    cout << cnt <<endl;  
  }
  else{
   	cout << cnt <<endl; 
  }
}

Measured memory_bytes: 768
S=str(input())
digits=len(S)-1
out=0
for i in range(2**digits):
    cs=0
    b=format(i,'0'+str(digits)+'b')
    for j in range(digits):
        if b[j]=='1':
            out+=int(S[cs:j+1])
            cs=j+1
    out+=int(S[cs:])
print(out)

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

int main() {
  char x;
  cin >> x;
  char a, i, u, e, o;
  if(x== 'a' || x== 'i' || x== 'u' || x== 'e' || x== 'o') {
    cout << "vowel" << endl;
  }

  else {
    cout << "consonant" << endl;
  }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  string a, b;
  cin >> a >> b;
  int ka = a.length();
  int kb = b.length();
  if(ka < kb)
    cout << "LESS" << endl;
  else if(ka > kb)
    cout << "GREATER" << endl;
  else{
    if(a < b)
      cout << "LESS" << endl;
    else if(a == b)
      cout << "EQUAL" << endl;
    else
      cout << "GREATER" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
int main()
{
    int n, t;
    cin >> n >> t;
    vector<P> v(n);
    for(int i = 0; i < n; i++)
    {
        int a, b;
        cin >> a >> b;
        v[i] = P(a, b);
    }
    sort(v.begin(), v.end());
    vector<vector<ll>> dp(n+1, vector<ll>(t+3100));
    for(int i = 0; i < n+1; i++)
    {
      for(int j = 0; j < t+3100; j++)
      {
        dp[i][j] = -1;
      }
    }
    dp[0][0] = 0;
    for(int i = 1; i <= n; i++)
    {
        P p = v[i-1];
        for(int j = 0; j < t+3100; j++)
        {
            dp[i][j] = max(dp[i][j], dp[i-1][j]);
            if(j < t && dp[i-1][j] != -1)
            {
              dp[i][j+p.first] = max(dp[i][j], dp[i-1][j] + p.second);
            }
        }
    }
    ll ans = 0;
    for(int i = 0; i < t+3100; i++)
    {
        ans = max(ans, dp[n][i]);
    }
    cout << ans << endl;
}


Measured memory_bytes: 143488
//In The Name of Beauty
//...So here I go is my shot
//Feet fail me not 'cause maybe the only opportunity that I got...
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define IB std::ios::sync_with_stdio(0);
#define pb(x) push_back(x);
#define mp(x,y) make_pair(x,y)
#define pll pair<ll,ll>
#define F first
#define S second
ll const MAXN = 1e5 + 8;
ll const INF  = 1e12 + 8;
ll const delta = 1000000007;

int main()
{
    IB;
    cin.tie(0);
    cout.tie(0);
    ll n , a , b;
    cin >> n >> a >> b;
    if(llabs(a - b) % 2)return cout << "Borys",0;
    cout << "Alice";
    return 0;
}
//Written by M_H_H_7


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
char s[SIZE];
int main(){
    RS(s);
    int v=0;
    for(int i=1;s[i];i++){
        if(s[i]!=s[i-1])v++;
    }
    printf("%d\n",v);
    return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
/////////////////////////////////
int main(){
    int a;
    string s;
    cin>>a>>s;
    if(a>=3200)
        cout << s << endl;
    else
    {
        cout << "red" << endl;
    }
    
}

Measured memory_bytes: 3600
using System;
//using System.Collections.Generic;
//using System.Linq;
//using Vector = CGL.Point;
//using Line = CGL.Segment;
//using Polygon = System.Collections.Generic.List<CGL.Point>;


namespace CGL
{
    class Program
    {
        static void Main(string[] args)
        {
            var p = scan;
            var p1 = new Point(p[0], p[1]);
            var p2 = new Point(p[2], p[3]);
            var s = new Segment(p1, p2);
            var q = scan[0];
            for (int i = 0; i < q; i++)
            {
                p = scan;
                var P = new Point(p[0], p[1]);
                var Q = s.Projection(P);
                Console.WriteLine(Q.x+" "+Q.y);
            }
        }
        static int[] scan { get { return Array.ConvertAll(Console.ReadLine().Split(), int.Parse); } }
    }
    
    struct Point
    {
        static readonly double EPS = 1E-10;
        public double x, y;
        public Point(double x, double y)
        {
            this.x = x;
            this.y = y;
        }

        public static Point operator +(Point a, Point b) { return new Point(a.x + b.x, a.y + b.y); }
        public static Point operator -(Point a, Point b) { return new Point(a.x - b.x, a.y - b.y); }
        public static Point operator *(double k, Point a) { return new Point(k * a.x, k * a.y); }
        public static Point operator /(double k, Point a) { return new Point(a.x / k, a.y / k); }
        
        public double Abs { get { return Math.Sqrt(Norm); } }  
        public double Norm { get { return x * x + y * y; } }

        public static bool operator <(Point a, Point b) { return Math.Abs(a.x - b.x) > EPS ? a.x < b.x : a.y < b.y; }
        public static bool operator >(Point a, Point b) { return Math.Abs(a.x - b.x) > EPS ? a.x > b.x : a.y > b.y; }
        public static bool operator ==(Point a, Point b) { return Math.Abs(a.x - b.x) < EPS && Math.Abs(a.y - b.y) < EPS; }
        public static bool operator !=(Point a, Point b) { return Math.Abs(a.x - b.x) >= EPS || Math.Abs(a.y - b.y) >= EPS; }

        public override bool Equals(object p){  return Math.Abs(x - ((Point)p).x) < EPS && Math.Abs(y - ((Point)p).y) < EPS; }
        public override int GetHashCode(){ return x.GetHashCode() ^ y.GetHashCode(); }

        public double Dot(Point p) { return x * p.x + y * p.y; }
        public double Cross(Point p) { return x * p.y - y * p.x; }

    }
    struct Segment
    {
        public Point p1, p2;
        public Segment(Point p1, Point p2)
        {
            this.p1 = p1;
            this.p2 = p2;
        }
        public Point Projection(Point p)
        {
            Point b = p2 - p1;
            double r = b.Dot(p - p1) / b.Norm;
            return p1 + r * b;

        }
    }
    /*struct Circle
    {
        public Point c; double r;
        public Circle(Point c, double r)
        {
            this.c = c;
            this.r = r;
        }

    }*/
}

Measured memory_bytes: 9492
/**Which of the favors of your Lord will you deny ?**/

#include<bits/stdc++.h>
using namespace std;

#define LL long long
#define PII pair<int,int>
#define PLL pair<LL,LL>
#define MP make_pair
#define F first
#define S second
#define INF INT_MAX

#define ALL(x) (x).begin(), (x).end()
#define DBG(x) cerr << __LINE__ << " says: " << #x << " = " << (x) << endl

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

template<class TIn>
using indexed_set = tree<
                    TIn, null_type, less<TIn>,
                    rb_tree_tag, tree_order_statistics_node_update>;

/*
PBDS
-------------------------------------------------
1) insert(value)
2) erase(value)
3) order_of_key(value) // 0 based indexing
4) *find_by_order(position) // 0 based indexing

*/

inline void optimizeIO()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const int nmax = 2e5+7;
const LL LINF = 1e17;

string to_str(LL x)
{
    stringstream ss;
    ss<<x;
    return ss.str();
}

//bool cmp(const PII &A,const PII &B)
//{
//
//}

LL a[nmax];
LL b[nmax];

LL BIT[nmax];
void update(int index,int val,int len)
{
    while(index<=len)
    {
        BIT[index] = BIT[index]+val;
        index += index&(-index);
    }
}

LL query(int index)
{
    LL sum=0;
    while(index>0)
    {
        sum = sum+BIT[index];
        index -= index&(-index);
    }
    return sum;
}

int main()
{
    optimizeIO();

    int n;
    cin>>n;

    for(int i=1;i<=n;i++)
    {
        cin>>a[i]>>b[i];
        update(i,a[i],n);
        update(i+1,-a[i],n);
    }

    LL ans = 0;


    for(int i=n;i>=1;i--)
    {
        LL aa = query(i);

        if(aa%b[i]==0) continue;


        LL mul = aa/b[i] + 1;
        LL target = b[i]*mul;
        LL add = target - aa;
        ans += add;

        int l = 1,r =i;
        update(l,add,n);
        update(r+1,-add,n);
    }

    cout<<ans<<endl;

    return 0;
}




Measured memory_bytes: 3584
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int k = Integer.parseInt(sc.next());
        int[] x = new int[n];
        for (int i = 0; i < n; i++) {
            x[i] = Integer.parseInt(sc.next());
        }
        long ans = Long.MAX_VALUE;
        for (int i = 0; i <= n - k; i++) {
            ans = Math.min(ans, Math.abs(x[i]) + Math.abs(x[i + k - 1] - x[i]));
            ans = Math.min(ans, Math.abs(x[i + k - 1]) + Math.abs(x[i + k - 1] - x[i]));
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 49676
#include <bits/stdc++.h>
#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++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long int ll;
const int MOD = 1e9+7;

int dp[1005][1005] = {0};

int main()
{
  int h,w;
  cin >> h >> w;
  vector<string> g(h);
  REP(i,h) cin >> g[i];
  dp[0][0]=1;
  REP(i,h){
    REP(j,w){
      if(i+1<h && g[i+1][j]=='.'){
        dp[i+1][j] += dp[i][j];
        dp[i+1][j] %= MOD;
      }
      if(j+1<w && g[i][j+1]=='.'){
        dp[i][j+1] += dp[i][j];
        dp[i][j+1] %= MOD;
      }
    }
  }
  cout << dp[h-1][w-1] << '\n';
  return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  string s;
  ll n;
  cin >> s >> n;
  rep(i, s.size()) {
    if (i%n == 0) cout << s.at(i);
  }
  cout << endl;
}

Measured memory_bytes: 256