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

int main(void){
  char x[4];
  int n, i, a, w, t, r;
  a = w = t = r = 0;
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf(" %s", x);
    if(x[0] == 'A') a++;
    if(x[0] == 'W') w++;
    if(x[0] == 'T') t++;
    if(x[0] == 'R') r++;
  }
  printf("AC x %d\n", a);
  printf("WA x %d\n", w);
  printf("TLE x %d\n", t);
  printf("RE x %d\n", r);
  return 0;
}

Measured memory_bytes: 1688
#include <stdio.h>
#define TRUE 1
#define FALSE 0

int main (void)
{
  char *p, str[6];
  int flag = FALSE;

  scanf("%s", str);

  p = str;
  while(*p != '\0') {
    if (*p == 'A') {
      p++;
      if (*p == 'C') {
        flag = TRUE;
        break;
      }
    }
    p++;
  }

  printf("%s", flag? "Yes":"No");

  return 0;
}

Measured memory_bytes: 128
import collections
import sys
readline = sys.stdin.readline


def main():
    n = int(readline().rstrip())
    s = readline().rstrip()
    cnt = s.count("R") * s.count("G") * s.count("B")

    for i in range(n - 2):
        for k in range(1, n):
            if i + 2 * k >= n:
                break
            if (s[i] != s[i + k]) and (s[i + k] != s[i + 2 * k])and (s[i] != s[i + 2 * k]):
                cnt -= 1
    print(cnt)


if __name__ == '__main__':
    main()


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


int main(){
    int h,n,sum=0;
    cin>>h>>n;
    vector<int> a(100001);
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    string ans ="Yes";
    if(sum<h)ans="No";
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 768
#C
#入力
N=int(input())
X=list(map(int,input().split()))

#処理
import numpy as np
X=np.array(X)
Z=[i**2 for i in range(101)]
Y=X-1
S=np.array([Z[i] for i in Y])
T=np.sum(S)
for i in range(2,np.max(X)+1):
    Y=X-i
    S=np.array([Z[abs(i)] for i in Y])
    SS=np.sum(S)
    if int(SS)<int(T):
        T=SS
print(T)

Measured memory_bytes: 12500
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#define INF 999999999
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=(n);i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define MOD(x) (x%(mod))
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

bool debug=true;
/*---------------------------------------------------*/

int main(){
  int n,x,mini;
  vi v;
  while(cin>>n){
    mini=INF;
    if(n==0)break;
    v.clear();
    rep(i,n){
      cin>>x;
      v.pb(x);
    }
    sort(all(v));
    rep(i,v.size()-1){
      mini=min(mini,v[i+1]-v[i]);
    }
    cout<<mini<<endl;
  }
  return 0;
}

Measured memory_bytes: 3168
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i = 0; i < (N); i++)
#define repo(i,N) for(int i = 1; i < (N); i++)
#define pb push_back
#define mp make_pair
#define ll long long
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'大文字'+=32;    で小文字に
//string s = to_string(int数);
//int n = stoi(string文字列);


int main() {
  int n;
  cin >> n;
  
  vector<int> p(n);
  
  int ans=0;
  
  rep(i,n) {
    cin >> p[i];
    ans-=p[i]*p[i];
  }
  
  rep(i,n) {
    rep(j,n) {
    ans+=p[i]*p[j];
    }
  }
  
  cout << ans/2 << endl;       
}


Measured memory_bytes: 256
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define rep(i,n) for(int i = 0; i < n; i++)
#define reps(i,j,n) for(int i = j; i < n; i++)
#define rrep(i,j,n) for(int i = j-1; i >= n; i--)
#define prec(n) fixed << setprecision(n)
#define print_array(v) rep(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define fi first
#define se second
#define endl "\n"
using namespace std;

constexpr int inf = 2147483647;
//constexpr int64_t inf64 = 9223372036854775807;
//constexpr int mod = 1e9+7;

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

  int n;
  cin >> n;

  int maxi = -1;
  rep(i,n) {
    int h;
    cin >> h;
    if (h < maxi) { cout << "No" << endl; return 0; }
    maxi = max(maxi, h-1);
  }

  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>                                                 
                                                                  
int main(void){                                                   
   int X,Y;                                                       
   scanf("%d %d",&X,&Y);                                          
                                                                  
   if(Y < 2*X || 4*X < Y){                                        
      printf("No");                                               
   } else if(Y % 2 == 1){                                         
         printf("No");                                            
   } else {                                                       
         printf("Yes");                                           
      }                                                           
   return 0;                                                      
}    

Measured memory_bytes: 1720
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
#define REP(i,n) for(int i=0;i<(int)n;++i)
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << 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 (a>b) { a=b; return 1; } return 0; }
template<class S, class T> ostream& operator << (ostream& os, const pair<S, T> v){
os << "(" << v.first << ", " << v.second << ")"; return os;
}
template<class T> ostream& operator << (ostream& os, const vector<T> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << " ";} os << v[i];} return os;
}
template<class T> ostream& operator << (ostream& os, const vector<vector<T>> v){
for(int i = 0; i < (int)v.size(); i++){if(i > 0){os << endl;} os << v[i];} return os;
}
string num2bit(ll num, ll len){
    string bit = "";
    REP(i, len){
    bit += char('0'+(num>>i & 1));
    }
    return bit;
}

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

    ll N;
    cin >> N;
    cout << 800*N - (N/15)*200 << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll     long long
#define pb          push_back
#define    endl        '\n'
#define pii         pair<ll ll,ll ll>
#define all(v) (v).begin(), (v).end()
using namespace std;

void solve()
{
    string s;
    cin >> s;
    ll tot = 0;
    for(auto i : s)
        tot += i - '0';
    cout << (tot % 9? "No": "Yes");
}
int main()
{



    ios_base::sync_with_stdio(false);
    cin.tie(0);

    ll TESTS = 1;
    // cin >> TESTS;
    while(TESTS--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3736
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <algorithm>
#include <string>
#include <numeric>
#include <cmath>
#include <iomanip>

using namespace std;

void solve(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin >> a[i];
    for(auto e: a){
        if(e % 2 == 0){
            if(e % 3 != 0 && e % 5 != 0){
                cout << "DENIED" << endl;
                return;
            }
        }
    }
    cout << "APPROVED" << endl;
}

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(16);
    
    solve();

    return 0;
}


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

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

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

const int mod = 1000000007;
struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0)
        : x((x % mod + mod) % mod)
    {
    }
    mint operator-() const { return mint(-x); }
    mint& operator+=(const mint a)
    {
        if ((x += a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint& operator-=(const mint a)
    {
        if ((x += mod - a.x) >= mod)
            x -= mod;
        return *this;
    }
    mint& operator*=(const mint a)
    {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) const { return mint(*this) += a; }
    mint operator-(const mint a) const { return mint(*this) -= a; }
    mint operator*(const mint a) const { return mint(*this) *= a; }
    mint pow(ll t) const
    {
        if (!t)
            return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1)
            a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod - 2); }
    mint& operator/=(const mint a) { return *this *= a.inv(); }
    mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x; }
ostream& operator<<(ostream& os, const mint& a) { return os << a.x; }

struct combination {
    vector<mint> fact, ifact;
    combination(int n)
        : fact(n + 1)
        , ifact(n + 1)
    {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i)
            fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i)
            ifact[i - 1] = ifact[i] * i;
    }
    mint operator()(int n, int k)
    {
        if (k < 0 || k > n)
            return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }
};

int main()
{
    int N, K;
    cin >> N >> K;
    auto c = combination(N);

    for (int i = 1; i <= K; i++) {
        cout << c(N - K + 1, i) * c(K - 1, i - 1) << endl;
    }
    return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a, n) \
    REP(i, n) { cout << (a[i]) << (i == n - 1 ? "\n" : " "); }
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

int main()
{
    ll N;
    cin >> N;
    OUT((N + 1) / 2);
}

Measured memory_bytes: 256
n,k=map(int,input().split())
x=list(map(int,input().split()))
t=input()
y=[[] for i in range(k)]
for i in range(n):
    if t[i]=="r":
        y[i%k].append(2)
    elif t[i]=="s":
        y[i%k].append(0)
    else:
        y[i%k].append(1)

def groupby(a):
    a2=[[a[0],1]]
    for i in range(1,len(a)):
        if a2[-1][0]==a[i]:
            a2[-1][1]+=1
        else:
            a2.append([a[i],1])
    return a2
c=0
for i in range(k):
    z=groupby(y[i])
    l=len(z)
    for j in range(l):
        c+=(x[z[j][0]]*((z[j][1]+1)//2))
print(c)


Measured memory_bytes: 14112
#include<iostream>
#include<vector>
#include<string>
#include<cmath>

int n, d;

int distance(std::vector<int> &a, std::vector<int> &b){
    int dist = 0;
    for(int i = 0; i < d; i++){
        dist += (a[i] - b[i]) * (a[i] - b[i]);
    }
    return dist;
}

int main(){
    std::cin >> n >> d;
    std::vector<std::vector<int>> x(n, std::vector<int>(d));
    for(int i = 0; i < n; i++){
        for(int j = 0; j < d; j++){
            std::cin >> x[i][j];
        }
    }

    int cnt = 0;
    for(int i = 0; i < n; i++){
        for(int j = i + 1; j < n; j++){
            int dist = distance(x[i], x[j]);
            long double tmp = std::sqrt(dist);
            if(tmp * tmp == dist) cnt++;
        }
    }

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using ll=long long;
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF=1LL<<60;

int n,cnt;
vector<int> a(110);

int main(){
    cin>>n;
    rep(i,n){
        cin>>a[i];
        if((i+1)%2==1 && a[i]%2==1) cnt++;
    }
    cout<<cnt<<"\n";
    return 0;
}

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

using namespace std;

#define MOD 1000000007
#define ll long long

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

    int a,b;
    cin>>a>>b;
    if(2*b<a)
    {
        cout<<a-(2*b);
    }
    else
    {
        cout<<0;
    }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = Integer.parseInt(in.nextLine());
		String[] tokens = in.nextLine().split(" ");
		int D = Integer.parseInt(tokens[0]);
		int X = Integer.parseInt(tokens[1]);
		int[] A = new int[N];
		for (int i = 0; i < N; ++i) {
			A[i] = Integer.parseInt(in.nextLine());
		}
		int result = X;
		for (int i = 0; i < N; ++i) {
			result += Math.floorDiv(D - 1, A[i]) + 1;
		}
		System.out.println(result);
		in.close();

	}

}


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

using namespace std;

string s;
int c;
int main() {
    cin >> s;
    for(int i = 2; i < s.length() - 1; i++){
        c += (s[i] == 'C');
    }

    for(int i = 0; i < s.length(); i++)
        if (isupper(s[i]) && tolower(s[i]) != 'a' && tolower(s[i]) != 'c'){
            cout << "WA" << endl;
            return 0;
        }
    if (s[0] == 'A' && c == 1){
        cout << "AC" << endl;
    } else {
        cout << "WA" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author ExplodingFreeze
 */

#include <iostream>
#include <fstream>

#pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#define int long long
#define f(i,a,b) for(int i=(a);i<(b);i++)
#define MOD 1000000007
using pii=std::pair<int,int>;
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); <-- PUT IN main()/solve()!

using namespace std;

int n,W,w[105],v[105],valknap[105][100005]={0};
class EKnapsack2 {
public:
	void solve(std::istream& in, std::ostream& out) {
		in >> n >> W;
		f(i,0,n)
			in >> w[i] >> v[i];
		f(i,0,n+1)
			f(j,0,100001)
				valknap[i][j]=(int)2e9;
		valknap[0][0]=0;
		f(i,0,n)
			f(j,0,100001)
				if(j==0||valknap[i][j]<=W)
				{
					valknap[i+1][j]=min(valknap[i+1][j],valknap[i][j]);
					valknap[i+1][j+v[i]]=min(valknap[i+1][j+v[i]],valknap[i][j]+w[i]);
				}
		int ans=0;
		f(i,0,100001)
			if(valknap[n][i]<=W)
				ans=i;
		out << ans << "\n";

	}
};


int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	EKnapsack2 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 80128
#include"bits/stdc++.h"
using namespace std;
namespace ORIGIN {
#define LL long long
#define VLL vector<long long>
#define SORT(x) sort(x.begin(),x.end())
#define REVE(x) reverse(x.begin(),x.end())
#define rep(i,n) for(int i=0;i<n;i++)
#define COUT(x) cout<<x<<endl
#define WHOLE(x) x.begin(),x.end()
	double pai = 3.1415926535;
	string atc = "atcoder";
	typedef pair<long long, long long> data_t;
	string strnum = "0123456789";
	string alpS = "abcdefghijklmnopqrstuvwxyz";
	string alpL = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
	int sizealp = (int)(alpS.size());
	int mod = 1e9 + 7;
	bool test = false;
}
using namespace ORIGIN;

void Test(char a) {
	if (test) {
		printf("%c", a);
	}
}
int gcd(LL a, LL b) {
	if (a == 0 || b == 0)return 0;
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	else gcd(b, a % b);
}

int main() {
	int n, a, b;
	cin >> n >> a >> b;
	int suma, sumb;
	COUT(min(n * a, b));
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>
using namespace std;

int main(){
    int H,N;
    int sum = 0;

    cin >> H >> N;
    for(int i = 0;i < N;i++){
        int a;
        cin >> a;
        sum += a;
    }

    if(H <= sum)cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

int main(){
	
	int N,M;
	long long K;
	cin>>N>>M>>K;
	
	vector<long long> A(N),B(M);
	for(int i=0;i<N;i++){
		cin>>A[i];
		if(i!=0)A[i] += A[i-1];
	}
	
	for(int i=0;i<M;i++){
		cin>>B[i];
		if(i!=0)B[i] += B[i-1];
	}
	A.insert(A.begin(),0LL);
	B.insert(B.begin(),0LL);
	
	int ans = 0;
	
	for(int i=0;i<=N;i++){
		long long t = K-A[i];
		if(t<0)continue;
		int d = distance(B.begin(),upper_bound(B.begin(),B.end(),t));
		ans = max(ans,i+d-1);
	}
	
	cout<<ans<<endl;
	
	return 0;
}


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

int main () {
  int X;
  cin >> X;

  int gohyaku = X / 500;
  X -= 500 * gohyaku;
  
  int go = X / 5;
  
  cout << gohyaku * 1000 + go * 5;
  
}

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

int main()
{

    char b;

    scanf("%c",&b);

    switch(b){
    case 'A':
        printf("T\n");
        break;
    case 'C':
        printf("G\n");
        break;
    case 'T':
        printf("A\n");
        break;
    case 'G':
        printf("C\n");
        break;
    }

    return 0;
}


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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

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

	int A, B, C;
	cin >> A >> B >> C;

	if (A+B >= C)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
// header {{{
#include <bits/stdc++.h>
using namespace std;
#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y
#define ASSERT(expr...) assert((expr))
using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
using f80 = __float80;
// }}}
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
// util {{{
#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T (&)[N]) { return static_cast<i64>(N); }
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}

template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}
// }}}

// init {{{
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;
// }}}

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

signed main() {
    string s;
    string t;
    cin>>s>>t;
    int a=0;
    REP(i,s.size()){
        if(s.at(i) == t.at(i)) a++;
    }
    cout<<a<<endl;

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

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        for(;;) {
            double n = sc.nextDouble();
            if (n<0)
                break;
            if(n>=256) {
                System.out.println("NA");continue;
            }
           String m=Integer.toBinaryString((int)n);
           while(m.length()<8) {
               m="0"+m;
           }
           String r=m+".";
           double a=n-(int)n;
           r+=a>=1/2D?1:0;
           if(a>=1/2D)
           a-=1/2D;
           r+=a>=1/4D?1:0;
           if(a>=1/4D)
           a-=1/4D;
           r+=a>=1/8D?1:0;
           if(a>=1/8D)
           a-=1/8D;
           r+=a>=1/16D?1:0;   
           if(a>=1/16D)
           a-=1/16D;
           if(a>0) {
               System.out.println("NA");
           }else {
               System.out.println(r);
           }
        }
    }
}


Measured memory_bytes: 36876
// Problem : B - Trick or Treat
// Contest : AtCoder - AtCoder Beginner Contest 166
// URL : https://atcoder.jp/contests/abc166/tasks/abc166_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>

using namespace std;
bitset<105> bs;
int main() {
	int n, k;
	scanf("%d %d", &n, &k);
	bs.reset();
	while(k--) {
		int d;
		scanf("%d", &d);
		while(d--) {
			int t;
			scanf("%d", &t);
			bs.set(t);
		}
	}
	auto ans = n - bs.count();
	cout<<ans;
}


Measured memory_bytes: 3692
// #pragma GCC target("avx2")
#pragma GCC optimize("O3", "unroll-loops")

// #include <bits/extc++.h>
// using namespace __gnu_pbds;

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

#define int long long
#define double long double
// template <typename T>
// using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
using pii = pair<int, int>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;
template<typename T>
using Prior = priority_queue<T>;

#define X first
#define Y second
#define ALL(x) (x).begin(), (x).end()
#define eb emplace_back
#define pb push_back

#define fastIO() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define RANDOM() random_device __rd; \
                 mt19937 __gen = mt19937(__rd()); \
                 uniform_int_distribution<int> __dis(1, 1E8); \
                 auto rnd = bind(__dis, __gen)

const int INF = 1E18;
const int mod = 1E9 + 7;
const int maxn = 100 + 5;

int ans = 0;
int v[maxn];

void recur(int L, int R) {
    if (L == R) return;
    int *minElem = min_element(v + L, v + R), minVal = *minElem;
    ans += minVal;
    for (int i = L; i < R; ++i) v[i] -= minVal;
    recur(L, minElem - v), recur(minElem + 1 - v, R);
}

int32_t main() {
    fastIO();
    
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i) cin >> v[i];
    
    recur(0, n);
    
    cout << ans << "\n";
    
    return 0;
}

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

#define N 26

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

Node tree[N];

void postorder(int id) {
    if (id == -1) {
        return;
    }
    postorder(tree[id].left);
    postorder(tree[id].right);
    cout << " " << id;
}

void inorder(int id) {
    if (id == -1) {
        return;
    }
    inorder(tree[id].left);
    cout << " " << id;
    inorder(tree[id].right);
}

void preorder(int id) {
    if (id == -1) {
        return;
    }
    cout << " " << id;
    preorder(tree[id].left);
    preorder(tree[id].right);
}

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

    for (int i = 0; i < n; i++) {
        tree[i].parent = -1;
        tree[i].left = -1;
        tree[i].right = -1;
    }

    int id, left, right;
    for (int i = 0; i < n; i++) {
        cin >> id >> left >> right;
        if (left != -1) {
            tree[id].left = left;
            tree[left].parent = id;
        }
        if (right != -1) {
            tree[id].right = right;
            tree[right].parent = id;
        }
    }

    int root;
    for (int i = 0; i < n; i++) {
        if (tree[i].parent == -1) {
            root = i;
            break;
        }
    }

    cout << "Preorder" << endl;
    preorder(root);
    cout << endl;
    cout << "Inorder" << endl;
    inorder(root);
    cout << endl;
    cout << "Postorder" << endl;
    postorder(root);
    cout << endl;
}


Measured memory_bytes: 3100
#include <iostream>
#include <algorithm>
#include <deque>
using namespace std;
int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, a;
	deque<int> dq;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> a;
		if (i % 2) dq.push_back(a);
		else dq.push_front(a);
	}
	if (n % 2 == 0)
		reverse(dq.begin(), dq.end());
	for (int i = 0; i < n; ++i) {
		if (i == 0) cout << dq[i];
		else cout << " " << dq[i];
 	}
	cout << "\n";
	return 0;
}

Measured memory_bytes: 3072
n = gets.to_i

arr = Array.new(10){Array.new(10,0)}
ans = 0

(1..n).each do |i|
    i = i.to_s
    x, y = i[0].to_i, i[-1].to_i
    ans += arr[y][x] * 2
    ans += 1 if x == y
    arr[x][y] += 1
end

puts ans

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

int main() 
{
  string s, t;
  int count = 0;
  cin >> s >> t;
  for(int i = 0; i < s.length(); i++)
  {
    if(s[i] != t[i])
      count++;
  }
  cout << count;
}

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

int main(){
  
  int n, r, p, c;
  int card[60], tmp[60];

  while(cin>>n>>r, n){
    for(int i=0;i<n;i++) card[i]=n-i;
    for(int i=0;i<r;i++){
      cin>>p>>c;
      for(int j=0;j<c;j++) tmp[j]=card[p-1+j];
      for(int j=0;j<p;j++) card[p-1+c-j-1]=card[p-1-j-1];
      for(int j=0;j<c;j++) card[j]=tmp[j];
    }
    cout<<card[0]<<endl;
  }
  
  return 0;
}

Measured memory_bytes: 3072
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    r=II()
    print(3.141592653589793*2*r)
main()

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

#define ll long long

int main(){
    ll n;
    cin >> n;

    vector<ll > a(n);
    for(ll i=0;i<n;i++){
        cin >> a[i];
    }

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

    ll conf = 0;
    for(ll i=0;i<(n-1);i++) {
        conf += a[n-1-(i+1)/2];
    }
    cout << conf << endl;

    return 0;
}


Measured memory_bytes: 4856
#include <bits/stdc++.h>
#define MOD 1000000007
#define pb push_back
#define ll long long
using namespace std;
const int nmax=101234;

int n,x,z;
bool a[25][25],flg[1<<22];
ll dp[1<<22];
queue<ll> q2;

int main()
{
    scanf("%d",&n);
    for(int i=0; i<n; ++i)
        for(int j=0; j<n; ++j)
            scanf("%d",&a[i][j]);
    dp[0]=0;
    for(int j=0; j<n; ++j)
    {
        if(a[0][j]==1)
        {
            x=1<<j;
            dp[x]=1;
            q2.push(x);
        }
    }
    q2.push(0);
    for(int i=1; i<n; ++i)
    {
        while(q2.front()!=0)
        {
            x=q2.front();
            q2.pop();
              for(int j=0; j<n; ++j)
            {
                if(a[i][j]==1)
                {
                    if((z=x|1<<j)!=x){
                        dp[z]=(dp[z]+dp[x])%MOD;
                        if(flg[z]==0){
                            q2.push(z);
                            flg[z]=1;
                        }
                    }
                }
            }
        }
        q2.pop();
        q2.push(0);
    }
    printf("%lld",dp[(1<<n)-1]);
    return 0;
}


Measured memory_bytes: 25984
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s,t;
  cin>>s>>t;
  bool x=true;
  for(int i=0;i<s.size();i++){
    if (s.at(i)!=t.at(i)){
      x=false;
      break;}}
    if(x){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}
}

Measured memory_bytes: 3604
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong();
        long B = sc.nextLong();
        long N = sc.nextLong();

        long ans = 0;

        if (N < B - 1) {
            ans = ((A * N) / B) - A * (N / B);
        } else {
            ans = ((A * (B - 1)) / B) - A * ((B - 1) / B);
        }

        System.out.print(ans);
    }
}

Measured memory_bytes: 35828
#include <cstdio>
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#define rep(i,n) for (int i=0;i<n;i++)
using ll = long long;
using namespace std;


void solve(){

}
int main (){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int a,b;
    cin >> a >> b;
    if(a%2==b%2){
        cout << (a+b)/2;
    }
    else{
        cout << "IMPOSSIBLE";
    }



    return 0;
}


Measured memory_bytes: 3532
import java.util.Iterator;
import java.util.Scanner;

public class Main {
    static Scanner sc;

    public static void main(String[] args) {
        sc = new Scanner(System.in);
        new Main().run();
    }

    private void run() {
        String O = sc.next();
        String E = sc.next();
        int fullsize = O.length() + E.length();

        boolean isodd = false;
        if (fullsize % 2 != 0) {
            isodd = true;
        }

        String ans = "";
        for (int i = 0; i < E.length(); i++) {
            ans += O.charAt(i);
            ans += E.charAt(i);
        }
        if (isodd) {
            ans += O.charAt(O.length() - 1);
        }
        
        System.out.println(ans);
    }
}


Measured memory_bytes: 22228
N,K=map(int,input().split())
V=[int(a) for a in input().split()]
able=min(N,K)
ans=0
 
for a in range(able+1):
    for b in range(able+1-a):
        if b==0:
            have=V[:a]
        else:
            have=V[:a]+V[-b:]
        have.sort()

        for i in range(min(a+b,K-a-b)+1):
            val=sum(have[i:])
            if ans<val:
                ans=val
 
print(ans)

Measured memory_bytes: 3188
"""
Writer: SPD_9X2
https://atcoder.jp/contests/arc098/tasks/arc098_c

Nの制約が小さい→O(N**2) ?

小さい方からQこの集合にするのは簡単→最小を含むように範囲を選んでけば良い
重要なのは最小の奴を飛ばして範囲がちぢめられるとき。

→最小値を全探索するのか？

最小値を決め、それ以下の数字を含まないようにできるだけ小さい方からとっていく？

k以下の数字のindexで配列を切る。O(N)
各数字がどこに属しているかを二分探索で小さい方からとっていく？
O(NlogN)

→O(N**2logN)で解ける(ちょっときつくないですか)
各数字が領域差しておくか前処理して置けばO(N**2)で解けるかな

"""

N,K,Q = map(int,input().split())
a = list(map(int,input().split()))

ai = []
for i in range(N):
    ai.append([a[i],i])
ai.sort()

ans = ai[Q-1][0]-ai[0][0]

for cant in range(N-Q):

    #0 ~ cantまでのai[i]を取ってはいけない

    rannum = [-1] * (cant+2)
    rannum[0] = 0
    indlis = [0] * N #rannumのindexを指し示す

    for i in range(cant+1):

        na,nind = ai[i]
        indlis[nind] += 1


    for i in range(N):

        if i != N-1:
            indlis[i+1] += indlis[i]

        rannum[indlis[i]] += 1

    #print (rannum , indlis)

    ncat = []
    for i in range(cant+1,N):

        na,nind = ai[i]

        if rannum[indlis[nind]] >= K:
            ncat.append(na)
            rannum[indlis[nind]] -= 1

        if len(ncat) == Q:
            ans = min(ans , ncat[-1] - ncat[0])
            break

    #print (ncat)
    
print (ans)

    

   

    


Measured memory_bytes: 46044
import java.io.IOException;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) throws IOException {
    Scanner sc = new Scanner(System.in);
    String raw;
    char ch[] = new char[1025];
    int times = sc.nextInt();
    sc.nextLine();

    for (int i = 0; i < times; i++) {
      int cnt = 0;
      raw = sc.nextLine();

      for (int j = 0; j < raw.length(); j++) {
        ch[j] = raw.charAt(j);
      }

      for (int j = 0; j < raw.length(); j++) {
        try {
          if (ch[j] == '0' && ch[j - 1] != '0') {
            chooseLiteral(ch[j - 1], cnt);
            cnt = 0;
          } else if (ch[j] == '0') {
          } else {
            cnt++;
          }
        } catch (ArrayIndexOutOfBoundsException e) {
        }
      }
      System.out.println();
    }

    sc.close();
  }

  public static void chooseLiteral(char c, int times) {
    switch (c) {
    case '1':
      times %= 5;

      switch (times) {
      case 1:
        System.out.print('.');
        break;

      case 2:
        System.out.print(',');
        break;

      case 3:
        System.out.print('!');
        break;

      case 4:
        System.out.print('?');
        break;

      case 0:
        System.out.print(' ');
        break;

      default:
        System.out.println("there is exist a bug");
      }
      break;

    case '2':
      printMes('a', times, 3);
      break;

    case '3':
      printMes('d', times, 3);
      break;

    case '4':
      printMes('g', times, 3);
      break;

    case '5':
      printMes('j', times, 3);
      break;

    case '6':
      printMes('m', times, 3);
      break;

    case '7':
      printMes('p', times, 4);
      break;

    case '8':
      printMes('t', times, 3);
      break;

    case '9':
      printMes('w', times, 4);
      break;

    default:
      System.out.println("there is exist a bug");
    }
  }

  public static void printMes(char c, int times, int maxTimes) {
    while (times > maxTimes) {
      times -= maxTimes;
    }
    for (int i = 0; i < times - 1; i++) {
      c++;
    }
    System.out.print(c);
  }

}

Measured memory_bytes: 33528
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef vector<ll> VI;
typedef vector<VI> VVI;
const ll MOD = 1000000007;
const ll INF = 2147483647;
const ll LINF = 9223372036854775807;
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()

int main(){
	long double l; cin >> l;
	cout << setprecision(10) << pow((l/3),3) << endl;
	return 0;
}

Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.StringTokenizer;

public class Main {
	
	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		
		final int n = sc.nextInt();
		
		int[][] adj = new int[n][n];
		
		for(int i = 0; i < n; i++){
			final int u = sc.nextInt() - 1;
			final int k = sc.nextInt();
			
			for(int j = 0; j < k; j++){
				final int v = sc.nextInt() - 1;
				
				adj[u][v] = 1;
			}
		}
		
		for(int i = 0; i < n; i++){
			for(int j = 0; j < n; j++){
				System.out.print((j != 0 ? " " : "") + adj[i][j]);
			}
			System.out.println();
		}
		
	}

	public static class Scanner {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while (!hasNext()) {
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

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

		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}

		public void close() throws IOException {
			br.close();
		}
	}

}

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

int main() {
    string s;
    cin >> s;
    int n = s.size();
    for (int i = 0; i < n - 1; i+=2) {
        if (s.substr(i, 2) == "hi")continue;
        else {
            puts("No");
            return 0;
        }
    }
    if (n & 1) puts("No");
    else puts("Yes");
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("O3","Ofast")
using namespace std;

template<class T> ostream& operator<<(ostream &os,vector<T> V){os<<"[ ";for(auto v:V)os<<v<<" ";return os<<"]";}
template<class L,class R> ostream& operator<<(ostream &os,pair<L,R> P){return os<<"("<<P.first<<","<<P.second<<")";}
#define DEBUG1(x) cout  << '>' << " " << #x << ':' << " " <<  x << endl;
#define DEBUG2(x,y) cout  << '>' << " " << #x << ':' << " " <<  x <<  " " << #y << ':' << " " <<  y <<endl;
#define DEBUG3(x,y,z) cout  << '>' << " " << #x << ':' << " " <<  x << " " << #y << ':' << " " <<  y <<" " << #z << ':' << " " <<  z << " " <<endl;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL);

#define TC int t; cin >> t;while(t--)
#define forn(i,n) for(int i=0;i<n;i++)

#define ALL(x) x.begin(),x.end()
#define LL long long int
#define PB push_back
#define EB emplace_back
#define F first
#define S second
#define endl "\n"

typedef pair<int,int>PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<PII> VPII;

const int mod = 1000*1000*1000+7;
const int inf = 2e9;
const LL linf = 2e18;
const double eps = 1e-9;

/////////////////////////////

const int N = 1234;

int dp[N][N];
vector<vector<char>> a(N,vector<char>(N, '#'));
int main(){
    int h,w;
    cin >> h >> w;
    forn(i, h) forn(j, w) cin >> a[i + 1][j + 1];
    for (int i = 1; i <= h;i++){
        for (int j = 1; j <= w;j++){
            if(a[i][j] == '.'){
                i == 1 && j == 1 ? dp[i][j] = 1 : dp[i][j] = 0;
                dp[i][j] += a[i - 1][j] == '#' ? 0 : dp[i - 1][j];
                dp[i][j] += a[i][j - 1] == '#' ? 0 : dp[i][j - 1];
                dp[i][j] %= mod;
            }
        }
    }
    cout << dp[h][w] << endl;
        return 0;
}

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

const int N = 1e5 + 10 , M = 5e5+10 ,  MOD = 1e9+7;
const int OO = 0x3f3f3f3f;
const double EPS = 1e-3;

#define clr(arr,val) memset(arr , val , sizeof (arr))
#define loop(i,n) for(int i = 0;i < int(n);i++)
#define rloop(i,n) for(int i = int(n)-1;i >= 0;i--)
#define range(i,a,b) for(int i = int(a);i <= int(b);i++)
#define ALL(v) ((v).begin()) , ((v).end())
#define SZ(v)  ((int)((v).size()))
typedef pair <int,int> pii ;
typedef vector < pii > vii ;
typedef vector < int > vi;
int dx[]={1,0,-1,0};int dy[]={0,1,0,-1}; //4 Direction
//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[6]={2,1,-1,-2,-1,1};int dy[6]={0,1,1,0,-1,-1}; //Hexagonal Direction
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
 


int a,b;



int main() {

    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
	
    string ans = "";

    cin >> a >> b;
    if(a < b){
        for(int i = 0 ; i < b ; ++i)
            ans += to_string(a);
        cout << ans << "\n";

    }
    else if(a > b){
        for(int i = 0 ; i < a ; ++i)
            ans += to_string(b);
        cout << ans << "\n";

    }
    else {
        for(int i = 0 ; i < a ; ++i)
            ans += to_string(b);
        cout << ans << "\n";
    }


    
    return 0;
}

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

int main(void){
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    int N, K;
    cin >> N >> K;
    int cnt = 0;

    while(N > 0){
        cnt += 1;
        N /= K;
    }
    cout << cnt;
    return 0;
}


Measured memory_bytes: 256
using System;

public class AtCoderE
{
    static void Main()
    {
        string str = Console.ReadLine();
        int answer = solve(str);
        Console.WriteLine(answer);
    }

    private static int solve(string str)
    {
        int answer = 0;
        bool isUp = false;

        for (int i = 0; i < str.Length; i++)
        {
            string s = str.Substring(str.Length - i - 1, 1);
            int n = int.Parse(s);
            if (isUp)
            {
                n = n + 1;
            }
            if (n == 5)
            {
                answer += n;
                isUp = false;
                if (i != str.Length - 1)
                {
                    string next = str.Substring(str.Length - i - 2, 1);
                    int nextN = int.Parse(next);
                    if (nextN >= 5)
                    {
                        isUp = true;
                    }
                }
            }
            else if (n < 5)
            {
                answer += n;
                isUp = false;
            }
            else
            {
                answer += 10 - n;
                isUp = true;
                if (i == str.Length - 1)
                {
                    answer += 1;
                }
            }
        }
        return answer;
    }
}

Measured memory_bytes: 18912
N, K, Q=map(int, input().split())
A=[int(input()) for _ in range(Q)]
score=[0 for _ in range(N+1)]
for a in A:
  score[a]+=1
for i in range(1, N+1):
  if K-Q+score[i]>0:
    print("Yes")
  else:
    print("No")

Measured memory_bytes: 8640
using System;
using System.Collections.Generic;
using System.Linq;
using static Constans;

public static class Constans
{
    public const long Mod = (long)1e9 + 7;
}

public class Combination
{
    private readonly long[] Fact;
    private readonly long[] InvFact;  // モジュラ逆数

    public Combination(long n)
    {
        Fact = new long[n + 1];
        InvFact = new long[n + 1];

        long f = 1;
        Fact[0] = f;
        for (long i = 1; i <= n; i++)
        {
            f *= i;
            f %= Mod;
            Fact[i] = f;
        }

        long inv = ModInt.GetInv(f).Num;

        InvFact[n] = inv;
        for (long i = n - 1; i >= 0; i--)
        {
            InvFact[i] = (InvFact[i + 1] * (i + 1)) % Mod;
        }
    }

    // nCr
    public ModInt GetCombination(long n, long r)
    {
        var comb = Fact[n] * InvFact[r] % Mod;
        comb = comb * InvFact[n - r] % Mod;
        return new ModInt(comb);
    }
}

public struct ModInt
{
    public long Num;

    public ModInt(long num)
    {
        Num = num;
    }

    // x^n
    public static long Power(long x, long n)
    {
        long pow = 1;
        while (n > 0)
        {
            if (n % 2 == 0)
            {
                x *= x;
                x %= Mod;
                n /= 2;
            }
            else
            {
                pow *= x;
                pow %= Mod;
                n--;
            }
        }

        return pow;
    }

    public static ModInt GetInv(long f)
    {
        // フェルマーの小定理 a^(-1) = a^(mod-2)
        return new ModInt(Power(f, Mod - 2));
    }

    public ModInt GetInv()
    {
        return GetInv(Num);
    }

    public override string ToString()
    {
        return Num.ToString();
    }

    public static ModInt operator +(ModInt l, ModInt r)
    {
        l.Num += r.Num;
        if (l.Num >= Mod)
        {
            l.Num -= Mod;
        }
        return l;
    }

    public static ModInt operator -(ModInt l, ModInt r)
    {
        l.Num -= r.Num;
        if (l.Num < 0)
        {
            l.Num += Mod;
        }
        return l;
    }

    public static ModInt operator *(ModInt l, ModInt r)
    {
        return new ModInt(l.Num * r.Num % Mod);
    }

    public static implicit operator ModInt(long n)
    {
        n %= Mod;
        if (n < 0)
        {
            n += Mod;
        }
        return new ModInt(n);
    }
}

public class Solution
{
    public static void Main()
    {
        var vals = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
        var n = vals[0];
        var k = vals[1];
        var comb = new Combination(n);

        ModInt pattern = 0;
        for (int empty = 0; empty <= Math.Min(k, n - 1); empty++)
        {
            var m = n - empty;
            pattern += comb.GetCombination(n, m) * comb.GetCombination(n - 1, m - 1);
        }
        Console.WriteLine(pattern);
    }
}

Measured memory_bytes: 14816
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds; 

#define int long long
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl "\n"
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout<<(x)<<endl
#define watch2(x,y) cout<<(x)<<" "<<(y)<<endl
#define watch3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;

const int INF = 9e18;
const int mod = 1e9 + 7;
const int N = 5005;

int i,n;
string s;

bool check(int mid)
{
	map<string,vpii> cnt;
	for(i=0;i+mid-1<n;++i)
	{
		string t=s.substr(i,mid);
		cnt[t].pb({i,i+mid-1});
	}
	for(auto it:cnt)
	{
		if(sz(it.s)>=2)
		{
			int l=it.s[0].s,r=it.s.back().f;
			if(l<r)
				return true;
		}
	}
	return false;
}

void solve()
{
    cin>>n>>s;
    int lo=0,hi=n;
    while(lo<hi)
    {
    	int mid=(lo+hi+1)/2;
    	if(check(mid))
    		lo=mid;
    	else
    		hi=mid-1;
    }
    cout<<lo;
}

signed main()
{
    fastio;
    int t;
    //cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 10124