akhauriyash/Code-Regression huggingface dataset:
N,M = map(int, input().split())
S = list(input())

cnt,cnt1 = 0,0
for s in S:
    if s == "1":
        cnt1 += 1
    else:
        cnt = max(cnt, cnt1)
        cnt1 = 0
if cnt >= M:
    print(-1)
    exit()

ans = []
pos = N
while pos > 0:
    for m in range(M, 0, -1):
        if pos - m < 0: continue
        if S[pos - m] == "1": continue

        ans.append(m)
        pos -= m
        break

print(*ans[::-1])

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

int main()
{
    int A,B,K;
    cin >> A >> B >> K;
    int cnt = 0;
    for (int i = min(A,B);i > 0 ;i--) {
        if(A % i == 0 && B % i == 0){
            cnt++;
        }
        if(cnt == K){
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    int n, a, b;
    cin >> n >> a >> b;
    cout << min(a, b) << " ";
    if (a + b <= n)
        cout << "0";
    else
        cout << a + b - n;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll                  long long
#define dl                 double
#define pb                push_back
#define F                  first
#define S                  second
#define endl              "\n"
#define rep(i,a,b)       for(i=a;i<b;i++)
#define all(v)             v.begin(),v.end()
#define allr(v)            v.rbegin(),v.rend()
#define mod              1000000007LL
#define CIN(V,s,n)      for(int i=s;i<n;i++){cin >> V[i];}
#define COUT(V,s,n)   {for(int i=s;i<n;i++){cout <<  V[i] << " "  ;} cout << endl;}
#define fast               ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define CLEAR(V);      for(ll i=0;i<V.size();i++) V[i] = 0;
#define N                  150
#define tmod             998244353LL
using namespace std;

bool sBs(const pair<int,int> &a,const pair<int,int> &b)
{   return (a.second < b.second);   }

ll SUMD(ll n);
ll BS(vector<pair< ll ,ll > > &PS,ll s,ll e,ll ser);
ll MI(ll a, ll m);
//bool P[N+1];
void Sieve(int n=N);
ll Powb(ll b,ll n,ll m);

int main()
{
fast;
ll q=1,t;
//cin >> q;
while(q--)
{
    ll i,j,n,m,k,l,r,a,b,c=0,d=0,e,g,p,q,u,v,w,x,y,flag=1;
    //n=m=k=i=j=l=r=a=b=c=d=u=v=w=p=x=y=0;
    cin >> n;
    vector<ll> H(n+1);
    for(i=1;i<=n;i++)
    {
        cin >>H[i];
    }
    map<ll,ll> M;
    ll ans = 0;
    for(i=1;i<=n;i++)
    {
        d = i-H[i];
        ans += M[d];
        M[i+H[i]]++;
    }
    cout << ans;
}
    return 0;
}

//*****************************************************************************************************************************************

ll Powb(ll b,ll n,ll m)
{
    if(n==0) return 1LL;
    if(n==1) return b;
    ll temp = Powb(b,n/2,m);
    if(n%2==0){return (temp*temp)%m;}
    else{return (b*((temp*temp)%m))%m;}
}

ll SUMD(ll n)
{   ll sum=0;
    while(n>0){sum += n%10;n = n/10;}
    return sum;

}
ll BS(vector<pair<ll,ll> > &PS,ll s,ll e,ll ser)
{
    if(s>e)
        return s;
    ll mid = (s+e)/2;
    if(PS[mid].F==ser)
    {
        return mid;
    }
    else if(PS[mid].F > ser)
    {
        return BS(PS,s,mid-1,ser);
    }
    else
        return BS(PS,mid+1,e,ser);
}
ll MI(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
    return x;
}
/*
void Sieve(int n)
{
    memset(P,true,sizeof(P));
    P[0] = false;
    P[1]= false;
    for(ll i=2;i*i<=n;i++)
    {
        if(P[i])
        {
            for(ll j=i*i;j<=n;j+=i)
            {
                P[j]=false;
            }
        }
    }

}

*/


Measured memory_bytes: 27460
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

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


Measured memory_bytes: 256
//g++ -std=c++14 test.cpp -o test.out
 
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <stack>
#include <map> 
#include <unordered_map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

//xを素因数分解する
//例えば60 = 5*3*2*2 であれば[(5,1),(3,1),(2,2)]を返す
vector<pair<LL,LL>> factorial(LL x){
	vector<pair<LL,LL>> ret;
	for(LL i=2;i*i<=x;i++){
		if(x%i==0){
			LL counter = 0;
			while(1){
				if(x%i!=0) break;
				x /= i;
				counter++;
			}
			ret.push_back(make_pair(i,counter));
		}
	}
	if(x!=1) ret.push_back(make_pair(x,1));
	return ret;
}

LL N;

LL ans = 0;

void solve(){
    for(LL C=1;C<=N-1;C++){
        if((N-C)==1){
            ans += 1LL;
        }else{
            vector<pair<LL,LL>> f = factorial(N-C);
            LL num = 1;
            for(int i=0;i<f.size();i++){
                num *= (f[i].second+1);
            }
            ans += num;
        }
    }
}
 
int main(){
	cin >> N;
 
    solve();

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

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

ans = 0
res = 0
for i in range(1,N+1):
    tmp = i
    cnt = 0
    while True:
        if tmp%2 == 0:
            cnt += 1
            tmp = tmp//2
        else:
            break
    if ans <= cnt:
        res = i
        ans = cnt
print(res)

Measured memory_bytes: 3068
import java.util.*;
class Main
{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int n=Integer.parseInt(sc.nextLine());
		String aa[]=sc.nextLine().split(" ");
		int ans=0;
		for(int i=0;i<aa.length;i+=2)
		{
			if(Integer.parseInt(aa[i])%2!=0){ans+=1;}
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 35588
use proconio::*;

fn main() {
    input! {
        n: usize,
        s: String
    }

    let mut ans = vec![0; n];
    let x: Vec<i64> = s.chars().map(|e| e.to_digit(2).unwrap() as i64).collect();
    let pc: i64 = x.iter().sum();
    for b in 0..=1 {
        let mut pc = pc;
        if b == 0 {
            pc += 1;
        } else {
            if pc == 1 {
                continue;
            }
            pc -= 1;
        }

        let mut r0: i64 = 0;
        for &e in &x {
            r0 = ((r0 << 1) + e).rem_euclid(pc);
        }

        let mut k: i64 = 1;
        for (i, &e) in x.iter().enumerate().rev() {
            if e == b {
                if b == 0 {
                    ans[i] = f((r0 + k).rem_euclid(pc)) + 1;
                } else {
                    ans[i] = f((r0 - k).rem_euclid(pc)) + 1;
                }
            }
            k = (k << 1).rem_euclid(pc);
        }
    }

    for e in &ans {
        println!("{}", e);
    }
}

fn f(n: i64) -> i64 {
    if n == 0 {
        return 0;
    }

    1 + f(n.rem_euclid(n.count_ones() as i64))
}


Measured memory_bytes: 5468
N = int(input())
dams = [int(x) for x in input().split()]
ans = dams[0]
for i in range(1, N):
  if (i % 2) == 1:
    ans -= dams[i]
  else:
    ans += dams[i]
print(ans, end=' ')
for i in range(N-2):
  ans = (dams[i] - ans // 2) * 2
  print(ans, end=' ')
ans = (dams[N-2] - ans // 2) * 2
print(ans)

Measured memory_bytes: 14024
N=int(input())
from collections import defaultdict
d=defaultdict(list)
f=defaultdict(int)
for _ in range(N-1):
    a,b,c=map(int,input().split())
    d[a].append([b,c,a])
    d[b].append([a,c,b])
Q,K=map(int,input().split())

dist=defaultdict(int)
dist[K]=0
f[K]=1
que=d[K]
prev=defaultdict(int)
prev[K]=0
while len(que)>0:
    tmp=[]
    tmpd=defaultdict(int)
    for t,c,e in que:
        if f[t]==0:
            dist[t]=c+dist[e]
            tmpd[t]=c+dist[e]
            f[t]=1
            tmp+=d[t]
    prev=tmpd
    que=tmp

for _ in range(Q):
    x,y=map(int,input().split())
    print(dist[x]+dist[y])



Measured memory_bytes: 78440
#1
import sys
K=int(input())
A,B=map(int, input().split())

if A==B:
    if A%K==0:
        print("OK")
        sys.exit()
else:
    for i in range(A,B+1):
        if i%K==0:
            print("OK")
            sys.exit()
print("NG")
        

Measured memory_bytes: 9160
#include<stdio.h>
int main()
{
	int cho = 0, hi = 0;
	int a, b, c;
	while (scanf("%d,%d,%d", &a, &b, &c)>0) {
		if (a*a + b*b == c*c)
			cho ++;
		else if (a == b)
			hi ++;
	}
	printf ("%d\n%d\n", cho, hi);
	return 0;
}

Measured memory_bytes: 0
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int R = sc.nextInt();
        if(N < 10){
          System.out.println(R + 100*(10 - N));        	
        }else{
        	System.out.println(R); 
        }
    }
}

Measured memory_bytes: 22608
import itertools

N, M, Q = map(int, input().split(' '))

q_list = []

for i in range(Q):
    q_list.append(list(map(int, input().split(' '))))


def check(target, point, i):

    if len(q_list) == i:
        return point

    a = q_list[i][0]
    b = q_list[i][1]
    c = q_list[i][2]
    d = q_list[i][3]

    if target[b - 1] - target[a - 1] == c:
        point = check(target, point + d, i + 1)

    else:
        point = check(target, point, i + 1)

    return point


a_list = list(itertools.combinations_with_replacement(range(1, M+1), N))

result = max([check(target, 0, 0) for target in a_list])
print(result)


Measured memory_bytes: 101128
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,b,a) for(int i=b;i>=a;i--)
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Forenska(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define sqr(x) ((x)*(x))
#define lowbit(x) ((x)&(-x))
#define GREATER(x) x,vector<x>,greater<x>
#define randIn(L,R) (((LL)rand()*rand())%(R-L)+L)
#define __lcm(a,b) ((a)/__gcd(a,b)*(b))
using namespace std;
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pLL;
typedef vector<int> vec;
typedef vector<LL> vecL;
typedef vector<pii> vecP;
typedef vector<pLL> vecPL;
typedef vector<string> vecS;
typedef vector<vec> mat;
typedef complex<double> point;
const long double PI=3.14159265358979323846264338327950288419716939937510582097;
const LL INFLL=0x3f3f3f3f3f3f3f3f;
const int INF=0x3f3f3f3f;
const long double EPS=1e-10;
int read()
{
    int x=0;
    char ch=' ';
    bool flag=false;
    while(ch<'0' || ch>'9')
    {
        if(ch=='-')flag=true;
        ch=getchar();
    }
    while(ch>='0' && ch<='9')
    {
        x=(x<<3)+(x<<1)+ch-'0';
        ch=getchar();
    }
    return flag?-x:x;
}
const int MAX_N=505;
int sum[MAX_N][MAX_N];
int N,M,Q;
int main()
{
//	freopen("input.txt","r",stdin);
	cin>>N>>M>>Q;
	rep(i,0,M)sum[read()][read()]++;
	For(i,1,N)
	{
		For(j,1,N)
		{
			sum[i][j]+=sum[i][j-1]+sum[i-1][j]-sum[i-1][j-1];
		}
	}
	while(Q--)
	{
		int p=read(),q=read();
		cout<<sum[q][q]-sum[p-1][q]-sum[q][p-1]+sum[p-1][p-1]<<endl;
	}
	return 0;
}



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

int main(){

    int x, y, temp;

    while(1){
        
        cin >> x >> y;

        if(x==0 && y==0) break;

        if(x > y){
            temp = x;
            x = y;
            y = temp;
        }

        cout << x <<" " << y << endl;
    }

    return 0;
    
}


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

const int M=5;

int a[M][M];

int main()
{
	for(int i=1;i<=3;i++)
		for(int j=1;j<=3;j++)
			scanf("%d",&a[i][j]);
	int n; scanf("%d",&n);
	int b;
	for(int k=0;k<n;k++)
	{
		scanf("%d",&b);
		for(int i=1;i<=3;i++)
			for(int j=1;j<=3;j++)
				if(a[i][j]==b) a[i][j]=-1;
	}
	int f=0;
	for(int i=1;i<=3;i++)
	{
		int ff=1;
		for(int j=1;j<=3;j++)
			if(a[i][j]!=-1)
			{
				ff=0;
				break;
			}
		if(ff) f=1;
	}
	for(int i=1;i<=3;i++)
	{
		int ff=1;
		for(int j=1;j<=3;j++)
			if(a[j][i]!=-1)
			{
				ff=0;
				break;
			}
		if(ff) f=1;
	}
	if(a[1][1]==-1&&a[2][2]==-1&&a[3][3]==-1) f=1;
	if(a[3][1]==-1&&a[2][2]==-1&&a[1][3]==-1) f=1;
	printf("%s\n",f?"Yes":"No");
	return 0;
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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 = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;


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 ngcd(vector<ll> a) {
  ll res = a[0];
  for(ll i=1; i<a.size() && res!=1; i++) res = gcd(a[i], res);
  return res;
}
ll nlcm(vector<ll> a){
  ll res = a[0];
  for(ll i=1; i<a.size(); i++) res = lcm(a[i], res);
  return res;
}
bool is_prime(ll n) {
  if(n < 2) return false;
  for (ll i = 2; i * i <= n; i++) if (n % i == 0) return false;
  return true;
}
ll digsum(ll n) {
  ll res=0;
  while(n) res += n%10, n /= 10;
  return res;
}
ll digcnt(ll n){
  ll res=0;
  while(n) res++, n /= 10;
  return res;
}
vector<ll> divisor(ll n) {
  vector<ll> res;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      res.push_back(i);
      if (i != n / i) res.push_back(n / i);
    }
  }
  sort(res.begin(), res.end());
  return res;
}
map<ll, ll> prime_factor(ll n) {
  map<ll, ll> res;
  for (ll i = 2; i * i <= n; i++) {
    while (n % i == 0) ++res[i], n /= i;
  }
  if (n != 1) res[n] = 1;
  return res;
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  ll ans=0;
  for(auto e: divisor(n)){
    if(e==1) continue;
    ll tmp=n;
    while(tmp%e==0){
      tmp/=e;
    }
    if(tmp%e==1){
      ans++;
    }
  }
  cout<<ans+divisor(n-1).size()-1<<endl;
}

Measured memory_bytes: 384
#include <iostream>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <stack>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <cctype>
#include <functional>
#include <string>
#include <cstring>
#include <sstream>
#include <deque>
#define fir first
#define sec second
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<P,int> Q;

const int inf1=1e9+9;
const ll inf2=1e16+9;
const ll mol=1e9+7;
const int maxn=5e3+9;
const ll maxx=1e12+9;

int n,k,ar[maxn],p[maxn];
int vis[maxn];
ll tmp[maxn+maxn],ans=-inf2;
ll ss[maxn+maxn];

ll calc_tmp(int len,int cnt)
{
    for(int i=1;i<=len;i++) tmp[i+len]=tmp[i];
    len*=2;
    for(int i=1;i<=len;i++) ss[i]=ss[i-1]+tmp[i];
    ll res=-inf2;
    for(int i=1;i<=len;i++)
        for(int j=i;j<=len&&j-i+1<=cnt;j++)
            res=max(res,ss[j]-ss[i-1]);
    return res;
}
void calc_cir(int s)
{
    int len=0;
    ll sum=0;
    while(!vis[s]) vis[s]=1,tmp[++len]=ar[s],sum+=ar[s],s=p[s];
    if(sum>=0)
    {
        ans=max(sum*(k/len)+calc_tmp(len,k%len),ans);
        if(k/len>=1) ans=max(sum*(k/len-1)+calc_tmp(len,len),ans);
    }
    else ans=max(ans,calc_tmp(len,k));
}
int main()
{
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++) scanf("%d",&p[i]);
    for(int i=1;i<=n;i++) scanf("%d",&ar[i]);
    for(int i=1;i<=n;i++)
        if(!vis[i]) calc_cir(i);
    printf("%lld\n",ans);
}


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


int main(){
    int N,max,sum;
    
    cin>>N;
    int p[N];
    max=-1;
    sum=0;
    for(int i=0;i<N;i++){
        cin>>p[i];
        sum+=p[i];
        if(p[i]>=max){
            max=p[i];
        }
    }
    //cout<<"sum="<<sum<<endl;
    //cout<<"max="<<endl;
    sum=sum-max;
    sum+=max/2;

    cout<<sum<<endl;
 
    return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        char[] a = Console.ReadLine().ToCharArray();
        char[] b = Console.ReadLine().ToCharArray();

        if (a[0].Equals(b[2]) && a[1].Equals(b[1]) && a[2].Equals(b[0])){
            Console.WriteLine("YES");
        }else{
            Console.WriteLine("NO");
        }
        return;
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
using ll=long long;
template<class T,class U> inline bool chmin(T&x,U y){if(x>y){x=y;return true;}return false;}
template<class T,class U> inline bool chmax(T&x,U y){if(x<y){x=y;return true;}return false;}
#define fr(i,n) for(int i=0;i<(n);++i)
#define Fr(i,n) for(int i=1;i<=(n);++i)
#define ifr(i,n) for(int i=(n)-1;i>=0;--i)
#define iFr(i,n) for(int i=(n);i>0;--i)

void solve(){
    int n,k;
    cin>>n>>k;
    mcf_graph<int,ll> g(2*n+2);
    int s=2*n,t=s+1;
    constexpr ll inf=1e9;
    g.add_edge(s,t,n*k,inf);
    fr(i,n){
        g.add_edge(s,i,k,0);
        g.add_edge(i+n,t,k,0);
    }
    {
        ll a;
        fr(i,n) fr(j,n){
            cin>>a;
            g.add_edge(i,j+n,1,inf-a);
        }
    }
    cout<<inf*n*k-g.flow(s,t,n*k).second<<'\n';
    auto ans=vector(n,string(n,'.'));
    for(auto[fr,to,_,fl,__]:g.edges()){
        if(fr==s||to==t||fl==0) continue;
        ans[fr][to-n]='X';
    }
    for(auto&c:ans) cout<<c<<'\n';
}

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

Measured memory_bytes: 3948
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<numeric>
#include<utility>
#include<unordered_map> //hash map
#include<cmath>

#define rep(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)

#define INF 10000007

typedef  long long ll;

using namespace std;


void solve(){
  int a;
  string s;
  cin >> a >> s;
  int ans = 0;
  string p = "ABC";
  for(int i = 0;i < a-2;i++){

    if(s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C') ans++;
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,l;
string s;
vector<string> v;
int main(){
	scanf("%d%d",&n,&l);
	for(int i=1;i<=n;i++){
		cin >> s;
		v.push_back(s);
	}
	sort(v.begin(),v.end());
	for(int i=0;i<v.size();i++){
		cout << v[i];
	}
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        int n = sc.nextInt();
        int result = 0;

        sc.close();

        for(int i=1; i < n; i++){
            result += (n - 1) / i;
        }
        System.out.println(result);
    }    
}

Measured memory_bytes: 35772
import java.util.Scanner;

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

		if(S.equals("AAA") || S.equals("BBB")) {
			System.out.println("No");
		}else {
			System.out.println("Yes");
		}	
		sc.close();
	}
}


Measured memory_bytes: 21844
import java.util.*;
class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();

        if(s.equals("5 7 5") || s.equals("7 5 5") || s.equals("5 5 7")) {
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}

Measured memory_bytes: 21712
def solve():
    from collections import deque
    import sys

    input = sys.stdin.readline

    n = int(input())

    g = tuple(set() for _ in range(n))
    for idx in range(n - 1):
        a, b = (int(x) - 1 for x in input().split())
        g[a].add((b, idx))
        g[b].add((a, idx))

    q = deque()
    q.append((0, -1, -1))

    e = [-1] * n  # e[-1]は使わない
    used = [False] * n
    used[0] = True
    while q:
        v, v_idx, prev_color = q.popleft()
        curr = 1 if prev_color != 1 else 2
        for u, u_idx in g[v]:
            if used[u]:
                continue
            used[u] = True
            e[u_idx] = curr
            q.append((u, u_idx, curr))
            curr += 1
            if curr == prev_color:
                curr += 1

    ret = e[:-1]
    return len(set(ret)), ret


l, ret = solve()
print(l)
print(*ret, sep='\n')


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

int main() {
	int n;
	cin>>n;
	int a[n];
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int h=0,k=0;
	for(int i=0;i<n;i++){
		if(k>h)h=k;
		if(a[i]>=a[i+1])k++;
		else k=0;
	}
	cout<<h;
}

Measured memory_bytes: 640
using AtCoderBeginnerContest158.Questions;
using AtCoderBeginnerContest158.Extensions;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;

namespace AtCoderBeginnerContest158.Questions
{
    public class QuestionA : AtCoderQuestionBase
    {
        public override IEnumerable<object> Solve(TextReader inputStream)
        {
            var s = inputStream.ReadLine();
            yield return s.All(c => c == 'A') || s.All(c => c == 'B') ? "No" : "Yes";
        }
    }
}


namespace AtCoderBeginnerContest158
{
    class Program
    {
        static void Main(string[] args)
        {
            IAtCoderQuestion question = new QuestionA();    // 問題に合わせて書き換え
            var answers = question.Solve(Console.In);
            foreach (var answer in answers)
            {
                Console.WriteLine(answer);
            }
        }
    }
}

#region Base Classes

namespace AtCoderBeginnerContest158.Questions
{

    public interface IAtCoderQuestion
    {
        IEnumerable<object> Solve(string input);
        IEnumerable<object> Solve(TextReader inputStream);
    }

    public abstract class AtCoderQuestionBase : IAtCoderQuestion
    {
        public IEnumerable<object> Solve(string input)
        {
            var stream = new MemoryStream(Encoding.Unicode.GetBytes(input));
            var reader = new StreamReader(stream, Encoding.Unicode);

            return Solve(reader);
        }

        public abstract IEnumerable<object> Solve(TextReader inputStream);
    }

}

#endregion

#region Extensions

namespace AtCoderBeginnerContest158.Extensions
{
    internal static class TextReaderExtensions
    {
        internal static int ReadInt(this TextReader reader) => int.Parse(ReadString(reader));
        internal static long ReadLong(this TextReader reader) => long.Parse(ReadString(reader));
        internal static double ReadDouble(this TextReader reader) => double.Parse(ReadString(reader));
        internal static string ReadString(this TextReader reader) => reader.ReadLine();

        internal static int[] ReadIntArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(int.Parse).ToArray();
        internal static long[] ReadLongArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(long.Parse).ToArray();
        internal static double[] ReadDoubleArray(this TextReader reader, char separator = ' ') => ReadStringArray(reader, separator).Select(double.Parse).ToArray();
        internal static string[] ReadStringArray(this TextReader reader, char separator = ' ') => reader.ReadLine().Split(separator);
    }
}

#endregion

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

using namespace std;

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

	vector<int> Beaten(n);
	vector<int> Beats(n);
	vector<int> H(n);

	for(int i = 1; i < n; ++i) {
		cin >> Beaten[i];
		Beaten[i] -= 1;
		Beats[Beaten[i]] += 1;
	}

	cerr << "OK" << endl;

	auto cmp = [&](int a, int b) {
		return H[a] > H[b];
	};
	priority_queue<int, vector<int>, decltype(cmp)> Q(cmp);

	for(int i = 0; i < n; ++i) {
		if(Beats[i] == 0) {
			Q.push(i);
		}
	}

	for(int i = 1; i < n; ++i) {
		int top = Q.top();
		Q.pop();

		int par = Beaten[top];
		
		if(H[par] < H[top]) 
			H[par] = H[top];
		H[par] += 1;
		
		if(--Beats[par] == 0)
			Q.push(par);
	}

	assert(Beats[0] == 0);
	assert(Q.top() == 0);
	for(int i = 1; i < n; ++i)
		assert(H[0] > H[i]);

	cout << H[0] << endl;

	return 0;
}

Measured memory_bytes: 2044
// #include <bits/stdc.h>
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <functional>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define for1(i, m, n) for(int i = m;i < n;i++)
#define ll long long
#define endl '\n'
using namespace std;


int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
    string s;
    cin >> s;
    if ((s[0] == 'Y') && (s[1] == 'A') && (s[2] == 'K') && (s[3] == 'I')) {
        puts("Yes");
    } else {
        puts("No");
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <map>
#include <cmath>
#include <cstring>

#define fi first
#define se second
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for (int i = 1; i < (n); ++i)
#define drep(i,n) for (int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define all(x) (x).begin(), (x).end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define pb push_back
#define sz(x) (int)(x).size()
#define PQ(T) priority_queue<T, v(T), greater<T> >

using namespace std;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;

const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

const int mod = 1000000007;

vector<string> f;
ll dp[1010][1010];

int main() {
    int h, w;
    cin >> h >> w;
    f.resize(h);
    rep(i,h) cin >> f[i];
    dp[0][0] = 1;
    rep(i,h) {
        rep(j,w) {
            if (f[i][j]=='#') continue;
            else {
                if (i+1 < h && f[i+1][j]=='.') {
                    dp[i+1][j] += dp[i][j];
                    dp[i+1][j] %= mod;
                }
                if (j+1 < w && f[i][j+1]=='.') {
                    dp[i][j+1] += dp[i][j];
                    dp[i][j+1] %= mod;
                }
            }
        }
    }
    cout << dp[h-1][w-1] << endl;
    return 0;
}






















    


Measured memory_bytes: 9216
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long n; 
  cin>>n;
  string ans="";
  while(n>0){
    n--;
    ans+=(n%26)+'a';
    n/=26;
  }
  reverse(ans.begin(),ans.end());
  cout<<ans;
  return 0; 
}

Measured memory_bytes: 3584
N, K = map(int, input().split())

t_1 = [n+1 for n in range(N)]

t_2 = []
t_3 = {}


for i in range(K):
    
    d = input()
    d = int(d)
        
    A = input().split()

    for a in A:
            
        t_2.append(int(a))

    t_3 = set(t_1) - set(t_2)
    
print(len(t_3))
        

Measured memory_bytes: 9188
#include <bits/stdc++.h>
using  namespace std;
#define    ll  long long int
ll fre[11];
int main( )
{
    ll n, i,j ,x, k, mx = -1,sum=0;
    string s;
    cin>>n;
    for( i=0; i<n; i++)
    {
        cin>>s;
        if(s[0]=='M')fre[1]++;
        if(s[0]=='A')fre[2]++;
        if(s[0]=='R')fre[3]++;
        if(s[0]=='C')fre[4]++;
        if(s[0]=='H')fre[5]++;
    }
    for(i=1; i<=5; i++)
    {
        for(j=i+1; j<=5; j++)
        {
            for(k=j+1; k<=5; k++)
            {
                sum+=(fre[i]*fre[j]*fre[k]);

            }
        }
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define rREP(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    char x,y;
    cin >> x >> y;
    if (x < y)
    {
	    cout << "<" << endl;
    }
    else if (x == y)
    {
	    cout << "=" << endl;
    }
    else
    {
	    cout << ">" << endl;
    }

}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <iomanip>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define REP(i,n) for (int i = 0; i < n; i++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long ll;

int main ()
{
    int N,H,W; 
    cin >> N >> H >> W;

    int ans = (N - H + 1) * (N - W + 1);
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

#define rep(i,n) for(int i=0;i<n;i++)

typedef long long ll;

using namespace std;

int dp[100001];
int INF = 1e+8;
int MOD = 1e+9 + 7;

int main(){
  int n,m;
  cin >> n >> m;
  int a[n];
  rep(i,m) cin >> a[i];
  rep(i,n+1) dp[i] = INF;
  rep(i,m) dp[a[i]] = 0;

  dp[0] = 1;
  for(int i=1; i<=(n+1); i++){
    if(dp[i] == 0) continue;
    if(i == 1){
      dp[i] = dp[i-1];
      continue;
    }
    dp[i] = dp[i-1] + dp[i-2];
    dp[i] %= MOD;
  }
  cout << dp[n] << endl;
}


Measured memory_bytes: 1024
n, m, x = map(int,input().split())
c = [0] *(n)
a = [[0] for _ in range(n)]

ans = 10**10

for i in range(n):
    ca = list(map(int,input().split()))
    c[i] = ca[0]
    a[i] = ca[1:]

for i in range(1 << n):
    skill = [0] * m
    total_cost = 0
    for j in range(n):
        if (i>>j) & 1:
            total_cost += c[j]
            skill = [skill[t] + a[j][t] for t in range(m)]
    if all (y >= x for y in skill):
        ans = min(ans, total_cost)

if ans == 10**10:
    print(-1)
else:
    print(ans)

Measured memory_bytes: 9180
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef double ld;
typedef long double lld;
//#define LOCAL_DEFINE 0
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define pb push_back
#define mp make_pair
#define pi pair<int,int>
#define pl pair<ll,ll>
template<class T> T umax(T a,T b) {return (a>b?a:b);}
template<class T> T umin(T a,T b) {return (a<b?a:b);}
template<class T,class P> T umax(T a,P b) {return (a>b?a:b);}
template<class T,class P> T umin(T a,P b) {return (a<b?a:b);}


const ll mod = 1e9+7;

ll power(ll a,ll b) {
    ll res = 1;
    while(b) {
        if(b&1) res = (res*a)%mod;
        a = (a*a)%mod;
        b >>= 1;
    }
    return res;
}

int X[] = {0,1,0,-1};
int Y[] = {1,0,-1,0};

int main() {
#ifdef LOCAL_DEFINE
    freopen("CCL.in","r",stdin);
    freopen("ans.txt","w",stdout);
#endif
    ios::sync_with_stdio(false);
    // logic
    int n,m,x,l;
    cin >> n >> m >> x;
    vector<int> a(n+1);
    for(int i=0;i<m;i++) {
        cin >> l;
        a[l] = 1;
    }
    int p = x;
    int c = 0, d = 0;
    while(p != 0) {
       c += a[p];
       p--;
    }
    p = x;
    while(p != n) {
       d += a[p];
       p++;
    }
    cout << min(c,d) << endl;
#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <stdlib.h>
#include <fstream>
#include <iostream>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

ll modpow(ll a,ll b,ll c){
  ll res=1;
  while(b>0){
    if(b&1) res=mod(res*a,c);
    a=mod(a*a,c);
    b>>=1;
  }
  return res;
}

int main() {
  int k,a,b;
  cin>>k>>a>>b;
  for(int i=a;i<=b;i++){
    if(i%k==0){
      cout<<"OK"<<endl;
      return 0;
    }    
  }
  cout<<"NG"<<endl;
  return 0;
}


Measured memory_bytes: 3544
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

long long solve(int n, int m, int q,
        vector<int>& a, vector<int>& b, vector<int>& c, vector<int>& d,
        vector<int>& h) {
    if (n == static_cast<int>(h.size())) {
        long long res = 0;
        for (int i = 0; i < q; i++) {
            if (h[b[i] - 1] - h[a[i] - 1] == c[i]) {
                res += d[i];
            }
        }
        return res;
    }

    long long res = 0;
    for (int i = (h.size() == 0 ? 1 : h[h.size() - 1]); i <= m; i++) {
        h.push_back(i);
        res = max(res, solve(n, m, q, a, b, c, d, h));
        h.pop_back();
    }

    return res;
}

int main() {
    int n, m, q;
    cin >> n >> m >> q;

    vector<int> a(q), b(q), c(q), d(q);
    for (int i = 0; i < q; i++) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }

    vector<int> h(0);
    cout << solve(n, m, q, a, b, c, d, h) << endl;
}


Measured memory_bytes: 3636
import java.util.*;
import java.lang.*;

public class Main {
    public static void main(String[] args) {
        //コード
        Scanner scanner = new Scanner(System.in);
        String x = scanner.next();
        String[] xx = x.split("");


        String check_char_one = new String();
        String check_char_two = new String();

        for (int i = 0; i < xx.length / 2; i++) {
            check_char_one += xx[i];
        }

        for (int i = ((xx.length + 3 ) / 2 -1); i < xx.length; i++) {
            check_char_two += xx[i];
        }

        if (check_char_one.equals(check_char_two)) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }

    }
}

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

//1-origin
template <typename T>
struct FenwickTree {
        vector<T> data;
        FenwickTree(int n) : data(n + 1, 0) {}
        //data[i] += x
        void add(int i, T x){
                while (i <= (int)data.size()) {
                        data[i] += x;
                        i += i & -i;
                }
        }
        //[1, i)
        T sum(int i){
                T res = 0;
                while (i > 0) {
                        res += data[i];
                        i -= i & -i;
                }
                return res;
        }
        //[l, r)
        T sum(int l, int r) { return sum(r) - sum(l); }
};
long long InversionNumber(const vector<int> &a) {
        FenwickTree<long long> ft(300030);
        long long res = 0;
        for (int i = 0; i < a.size(); i ++) {
                res += i - ft.sum(a[i]);
                ft.add(a[i], 1);
        }
        return res;
}

int main() {
        int n;
        scanf("%d", &n);
        vector<int> a(n);
        rep(i, n) {
                scanf("%d", &a[i]);
        }
        long long lb = 0, ub = 1e9 + 5;
        while (ub - lb > 1) {
                long long x = (lb + ub) / 2;
                vector<int> b(n);
                rep(i, n) {
                        b[i] = a[i] >= x ? 1 : -1;
                }
                vector<int> acc(n + 1);
                for (int i = 1; i <= n; i ++) {
                        acc[i] = acc[i - 1] + b[i - 1];
                }
                rep(i, n + 1) acc[i] += 150000;
                long long res = (long long) (n + 1) * n / 2 - InversionNumber(acc);
                if (res >= ((long long) (n + 1) * n / 2 + 1) / 2) {
                        lb = x;
                } else {
                        ub = x;
                }
        }
        printf("%lld\n", lb);
        return 0;
}


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


int main(void){
  int n; scanf("%d",&n);
  if(n%2 == 0) printf("%d",n/2);
  else printf("%d",n/2 + 1);
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#define MAX_N 50
using namespace std;

int n, p, np, id;

void PRINT(vector<int> &a) {
  cout << " -------" << endl;
  cout << "np : " << np << endl;
  for(int i = 0; i < n; ++i) {
    cout << "a[" << i << "]: " << a[i] << endl;
  }
  cout << endl;
}

bool step(vector<int> &a) {

  if(np > 0) {
    np--;
    a[id]++;

    if(np == 0 && count(a.begin(), a.end(), p) == 1) {
      return 1;
    }
  }
  else {
    np += a[id];
    a[id] = 0;
  }
  return 0;
}

int play() {
  vector<int> a(n, 0);
  id = 0;
  np = p;
  while(1) {
    if(step(a)) break;
    id++;
    id %= n;
  }
  return id;
}

int main() {
  while(cin >> n >> p && n && p) {
    cout << play() << endl;
  }
  return 0;
}



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


int main() {
  int N;
  vector<int> A(200001);
  map<ll, ll> mp;
  cin >> N;
  rep(i, N){
      cin >> A[i];
      mp[A[i]]++;
  }
  ll answer = 0;
  for (auto x: mp){
      answer += x.second * (x.second - 1)/2;
  }
  rep(i, N){
      cout << answer - mp[A[i]] + 1 << endl;
  }
  return 0;
}


Measured memory_bytes: 10240
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define SZ(a) (int)((a).size())
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef double db;
typedef pair <int, int> Pii;
typedef pair <ll, int> Pli;
typedef unsigned long long ull;
const double eps = 1e-8;
const int mod = (int)(1e9) + 7;
const int inf = 0x7fffffff;
const int N = (int)(2e5) + 7;

int n, m;
int hd[N], vis[N], cnt, tot;
struct edge {
    int to, nxt;
} e[N << 1];
void add(int u, int v) {
    e[++cnt] = { v, hd[u] };
    hd[u] = cnt;
}
void dfs(int x) {
    vis[x] = 1;
    ++tot;
    for (int i = hd[x]; i; i = e[i].nxt) {
        int to = e[i].to;
        if (vis[to]) continue;
        dfs(to);
    }
}

int main() {

    // freopen("in.in", "r", stdin);
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= m; ++i) {
        int u, v;
        scanf("%d%d", &u, &v);
        add(u, v); add(v, u);
    }
    int res = 1;
    for (int i = 1; i <= n; ++i) {
        if (vis[i]) continue;
        tot = 0;
        dfs(i);
        res = max(res, tot);
    }
    printf("%d\n", res);

    return 0;
}

Measured memory_bytes: 14580
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        int[] ints = new int[10];

        ints[a]++;
        ints[b]++;
        ints[c]++;

        for(int i=0;i<10;i++){
            if(ints[i] == 2){
                System.out.println("Yes");
                return;
            }
        }

        System.out.println("No");

    }
}


Measured memory_bytes: 23764
/// input macro from https://qiita.com/tanakh/items/1ba42c7ca36cd29d0ac8
macro_rules ! read_value {($ next : expr , ($ ($ t : tt ) ,* ) ) => {($ (read_value ! ($ next , $ t ) ) ,* ) } ; ($ next : expr , [$ t : tt ; $ len : expr ] ) => {(0 ..$ len ) . map (| _ | read_value ! ($ next , $ t ) ) . collect ::< Vec < _ >> () } ; ($ next : expr , chars ) => {read_value ! ($ next , String ) . chars () . collect ::< Vec < char >> () } ; ($ next : expr , usize1 ) => {read_value ! ($ next , usize ) - 1 } ; ($ next : expr , $ t : ty ) => {$ next () . parse ::<$ t > () . expect ("Parse error" ) } ; }
macro_rules ! input_inner {($ next : expr ) => {} ; ($ next : expr , ) => {} ; ($ next : expr , $ var : ident : $ t : tt $ ($ r : tt ) * ) => {let $ var = read_value ! ($ next , $ t ) ; input_inner ! {$ next $ ($ r ) * } } ; }
macro_rules ! input {(source = $ s : expr , $ ($ r : tt ) * ) => {let mut iter = $ s . split_whitespace () ; let mut next = || {iter . next () . unwrap () } ; input_inner ! {next , $ ($ r ) * } } ; ($ ($ r : tt ) * ) => {let stdin = std :: io :: stdin () ; let mut bytes = std :: io :: Read :: bytes (std :: io :: BufReader :: new (stdin . lock () ) ) ; let mut next = move || -> String {bytes . by_ref () . map (| r | r . unwrap () as char ) . skip_while (| c | c . is_whitespace () ) . take_while (| c |! c . is_whitespace () ) . collect () } ; input_inner ! {next , $ ($ r ) * } } ; }
fn main() {
    input!(n: u64, k: u64, a: [u64; n as usize]);

    for i in 0..(n - k) {
        if a[i as usize] < a[(k + i) as usize] {
            println!("Yes");
        }
        else {
            println!("No");
        }
    }
}


Measured memory_bytes: 3552
#include <bits/stdc++.h>
using namespace std;
int countNum[55];
int main () {
	int N,M;
	cin >> N >> M;
	for (int i = 0; i < M; ++i)
	{
		int tmp1 = 0;
		int tmp2 = 0;
		cin >> tmp1 >> tmp2;
		countNum[tmp1]++;
		countNum[tmp2]++;
	}
	for (int i = 1; i <= N; ++i)
	{
		cout << countNum[i] << endl;
	}
}

Measured memory_bytes: 256
inp = list(map(int,input().split()))
res = 0

if inp[3] <= inp[0] :
    res = inp[3]
elif inp[3] <= (inp[0] + inp[1]) :
    res = inp[0]
elif inp[3] < (inp[0] + inp[1] + inp[2]) :
    res = inp[0] - (inp[3] - inp[0] - inp[1])
elif inp[3] == (inp[0] + inp[1] + inp[2]) :
    res = inp[0] - inp[2] 

print(res)


Measured memory_bytes: 9176
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset

#include <math.h>
#include <stdlib.h>


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

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

//INT_MAX	2,147,483,647 = 2*1.0e9

int main(){
  int H, W;
  cin >> H >> W;

  vector<string> field(H);
  for(int i = 0 ; i < H; i++) cin >> field[i];

  vector<int> okR;
  vector<int> okC;
  for(int i = 0; i < H ; i++){
    for(int j = 0; j < W; j++){
      if(field[i][j] != '.'){
        okR.push_back(i);
        break;
      }
    }
  }

  for(int j = 0; j < W ; j++){
    for(int i = 0; i < H; i++){
      if(field[i][j] != '.'){
        okC.push_back(j);
        break;
      }
    }
  }

  for(int i : okR){
    for(int j : okC){
      cout << field[i][j];
    }
    cout << endl;
  }

  return 0;
}


Measured memory_bytes: 256
n, k = map(int, input().split())
cnt = 0
for i in range(k, n+2):
    mini = (i-1) * i // 2
    maxi = (n+n-i+1) * i // 2
    # print(i, mini, maxi)
    cnt += maxi - mini + 1
    cnt %= 10 ** 9 + 7
print(cnt)

Measured memory_bytes: 9184
import java.util.*;
import java.io.*;
import java.lang.*;
class Main  {
    static class FastReader
    {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
    public static void main(String[] args) {
        FastReader ob = new FastReader();
        int n = ob.nextInt();
        int m = ob.nextInt();
        int arr[] =  new int[n];
        int sum=0;
        for (int i = 0; i < n; i++) {
            arr[i]=ob.nextInt();
            sum+=arr[i];
        }
        int count=0;
        double limit=(double)sum/(4*m);
        for (int i = 0; i <n ; i++) {
            if((double)arr[i]>=limit){
                count++;
            }
        }
        if(count>=m){
            System.out.println("Yes");
        }
        else{
            System.out.println("No");
        }



    }
}

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

using namespace std;

class Dice {
public:
	int F[6];
	void roleE() {
		int a = F[0]; F[0] = F[3]; F[3] = F[5]; F[5] = F[2]; F[2] = a;
	}
	void roleS() {
		int a = F[0]; F[0] = F[4]; F[4] = F[5]; F[5] = F[1]; F[1] = a;
	}
	void roleW() {
		int a = F[0]; F[0] = F[2]; F[2] = F[5]; F[5] = F[3]; F[3] = a;
	}
	void roleN() {
		int a = F[0]; F[0] = F[1]; F[1] = F[5]; F[5] = F[4]; F[4] = a;
	}
};

int main() {
	Dice dice1, dice2;
	int T = 0;
	for (int i = 0; i < 6; i++) {
		cin >> dice1.F[i];
	}
	for (int j = 0; j < 6; j++) {
		cin >> dice2.F[j];
	}
	for (int a = 0; a < 6; a++) {
		while (true) {
			if (dice2.F[0] == dice1.F[0]) break;
			else if (dice2.F[2] == dice1.F[0] || dice2.F[3] == dice1.F[0]) dice2.roleE();
			else dice2.roleS();
		}
		int f[4] = { 1, 2, 4, 3 };
		for (int k = 0; k < 4; k++) {
			if (dice2.F[f[k]] == dice1.F[1] && dice2.F[f[(k + 1) % 4]] == dice1.F[2] &&
				dice2.F[f[(k + 2) % 4]] == dice1.F[4] && dice2.F[f[(k + 3) % 4]] == dice1.F[3]) T = 1;
		}
		if (T == 1) break;
		if (a + 1 == 1) dice1.roleN();
		else if (a + 1 == 2) dice1.roleW();
		else if (a + 1 == 3) { dice1.roleW(); dice1.roleW(); }
		else if (a + 1 == 4) dice1.roleN();
		else if (a + 1 == 5) dice1.roleN();
	}
	if (T == 0) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 3088
#include<cstdio>
#include<cstring>
using namespace std;
char d[10000];
int main()
{
    int a,b;
    scanf("%d%d",&a,&b);
    for(int i=0;i<=a+b+1;i++)
    {
    	scanf("%c",&d[i]);
	}
	
	if(d[a+1]!='-')
	{
		printf("No");
		return 0;
	}
	for(int i=1;i<=a+b+1;i++)
    {
    	if(d[i]<'0'||d[i]>'9')
    	{
    		if(i!=(a+1))
    		{
    			printf("No");
    			
    			return 0;
			}
		}
	}
	printf("Yes");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;
int main()
{
	string s2,s,s1,t;
	cin >>s >>t;
	int lens=s.size(),lent=t.size(),i=0,j=0;
	bool ok=0;
	for (i=0;i<=lens-lent;i++)
	{
		if (s[i]==t[0])
		{
			s2=s.substr(i,lent);
			if (s2==t)
			{
				for (j=0;j<lens;j++)
					if (s[j]=='?')
						s[j]='a';
				cout <<s<<endl;
				return 0;
			}
		}
	}
	for (i=lens-lent;i>=0;i--)
	{
		ok=0;
		if (s[i]==t[0]||s[i]=='?')
		{ 
			s1=s.substr(i,lent);
			for (j=0;j<s1.size();j++)
			{
				if (s1[j]!=t[j]&&s1[j]!='?')
				{
					ok=1;
					break;
				}
			}
			if (ok==0)
			{
				s=s.substr(0,i)+t+s.substr(i+lent,lens);
				for (j=0;j<lens;j++)
					if (s[j]=='?')
						s[j]='a';
				cout <<s<<endl;
				return 0;
			}
		}
	}
	cout <<"UNRESTORABLE" <<endl;
	return 0;
}

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

int main(){
	string S;
	cin >> S;
	int x=0;
	for(int i=0;i<S.size();i++)if(S[i]=='x')x++;
	if(x<8)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256