akhauriyash/Code-Regression huggingface dataset:
import sys
import os
import math

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

MOD = 10 ** 9 + 7


def fb(i):
    if i % 15 == 0 or i % 3 == 0 or i % 5 == 0:
        return True
    else:
        return False


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    ret = 0
    for n in range(1, N+1):
        for m in range(1, N + 1):
            for l in range(1, N + 1):
                ret += math.gcd(math.gcd(n,m),l)
    print(ret)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9188
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int i;
        int[] array = new int[2];
        
        i = 1;
        int x;
        int y;
        while (i != 0) {
            for (i = 0; i < 2; i++) {
                array[i] = sc.nextInt();
            }
            if(array[0] == 0 && array[1] == 0) break;
            for(x=0;x<array[0];x++){
                for(y=0;y<array[1];y++){
                    if(x==0 || x==array[0]-1){
                        System.out.print("#");
                    }else if(y==0 || y==array[1]-1){
                        System.out.print("#");
                    }else{
                        System.out.print(".");
                    }
                }
                System.out.println("");
            }
            System.out.println("");
        }
        sc.close();
    }
}


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

#define int long long int
const int MOD = 1e9+7;
const int mxN = 1005;
int n, m;

void solve() {
    cin >> n >> m;
    string s[n];
    for(int i=0; i<n; i++)
        cin >> s[i];
    
    int dp[n][m];
    dp[0][0] = 1;
    bool f = 0;

    for(int j=1; j<m; j++) {
        if(s[0][j] == '#')  
            f = 1;
        if(f)   
            dp[0][j] = 0;
        else 
            dp[0][j] = 1;
    }
    f = 0;
    for(int i=1; i<n; i++) {
        if(s[i][0] == '#')
            f = 1;
        if(f)
            dp[i][0] = 0;
        else 
            dp[i][0] = 1;
    }
    
    for(int i=1; i<n; i++) {
        for(int j=1; j<m; j++) {
            if(s[i][j] == '#')
                dp[i][j] = 0;
            else 
                dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD;
        }
    }
    cout << dp[n-1][m-1] << endl; 
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    solve();
}

Measured memory_bytes: 9088
#include<bits/stdc++.h>
using namespace std;
#define REP(i,st,ed) for(register int i=st,i##end=ed;i<=i##end;++i)
#define DREP(i,st,ed) for(register int i=st,i##end=ed;i>=i##end;--i)
#define y1 fakerbeng
typedef long long ll;
template<typename T>inline bool chkmin(T &x,T y){return (y<x)?(x=y,1):0;}
template<typename T>inline bool chkmax(T &x,T y){return (y>x)?(x=y,1):0;}
inline int read(){
	int x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1)+(x<<3)+(c^'0');
	return x*f;
}
inline ll readll(){
	ll x;
	char c;
	int f=1;
	while((c=getchar())!='-' && (c>'9' || c<'0'));
	if(c=='-') f=-1,c=getchar();
	x=c^'0';
	while((c=getchar())>='0' && c<='9') x=(x<<1ll)+(x<<3ll)+(c^'0');
	return x*f;
}
const int maxn=2e6+10,mod=1e9+7;
int ksm(int x,int y){
	int res=1;
	while(y){
		if(y&1) res=(ll)res*x%mod;
		y>>=1;
		x=(ll)x*x%mod;
	}
	return res;
}
int fac[maxn],ifac[maxn];
int x1,y1,x2,y2,x3,y3,x4,y4,x5,y5,x6,y6;
inline void init(int n){
	fac[0]=1;
	REP(i,1,n) fac[i]=(ll)i*fac[i-1]%mod;
	ifac[n]=ksm(fac[n],mod-2);
	DREP(i,n,1) ifac[i-1]=(ll)i*ifac[i]%mod;
}
inline int C(int n,int m){
	if(m<0 || n<0 || m>n) return 0;
	return (ll)fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}
inline int Calc(int n,int m){
	return C(n+m+2,n+1)-1;
}
inline int calc(int x,int y,int u,int v){
	return ((ll)Calc(x-x1,y-y1)-Calc(x-x2-1,y-y1)-Calc(x-x1,y-y2-1)+Calc(x-x2-1,y-y2-1))*
		((ll)Calc(x6-u,y6-v)-Calc(x5-u-1,y6-v)-Calc(x6-u,y5-v-1)+Calc(x5-u-1,y5-v-1))%mod;

}
int main(){
	init(maxn-10);
	x1=read(),x2=read(),x3=read(),x4=read(),x5=read(),x6=read();
	y1=read(),y2=read(),y3=read(),y4=read(),y5=read(),y6=read();
	int ans=0;
	REP(i,x3,x4) ans=(ans-(ll)calc(i,y3-1,i,y3)*(i-x3)+(ll)calc(i,y4,i,y4+1)*(i-x3+y4-y3+1))%mod;
	REP(i,y3,y4) ans=(ans-(ll)calc(x3-1,i,x3,i)*(i-y3)+(ll)calc(x4,i,x4+1,i)*(i-y3+x4-x3+1))%mod;
//	ans=(ans-(ll)calc(x4,y4)*(x4-x3+y4-y3+2)+calc(x3,y3))%mod;
	ans=(ans+mod)%mod;
	printf("%d\n",ans);
	return 0;
}


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

using namespace std;

#define REP(i, n)   for(int i = 0; i < (n); i++)
#define REPS(i, n)  for(int i = 1; i <= (n); i++)
#define RREP(i, n)  for(int i = (n)-1; i >= 0; i--)
#define RREPS(i, n) for(int i = (n); i > 0; i--)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define mp make_pair
#define mt make_tuple
#define pb push_back

using ll  = long long;
using pi  = pair<int, int>;
using pl  = pair<ll, ll>;
using vi  = vector<int>;
using vl  = vector<ll>;
using vs  = vector<string>;
using vb  = vector<bool>;
using vvi = vector<vi>;
using vvl = vector<vl>;

const int MOD = 1e9 + 7;
const int INF = 1e9 + 7;
const ll  INFL = 1e18;
const double PI = 3.141592653589793;
const double EPS = 1e-9;

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(a > b) { a = b; return true; } return false; }

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int A, B; cin >> A >> B;
    A = (A+11) % 13;
    B = (B+11) % 13;
    if(A == B) cout << "Draw" << endl;
    else if(A < B) cout << "Bob" << endl;
    else cout << "Alice" << endl;
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const double PI = 4*atan(1);
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-9;
const string YES = "Possible";
const string NO = "Impossible";
#define pb push_back
#define mp make_pair
#define eb emplace_back

const int MAX_N = 1e5+2;
int N, Q;
ll a[MAX_N],b[MAX_N],c[MAX_N];

void solve()
{
	map<ll, ll> cur;
	for(int i=0;i<N;++i) cur[a[i]]++;
	ll sum  = accumulate(a,a+N,0LL);
	for(int i=0;i<Q;++i){
		if(cur.count(b[i])){
			sum -= b[i]*cur[b[i]];
			sum += c[i]*cur[b[i]];
			cur[c[i]]+=cur[b[i]];
			cur.erase(b[i]);
		}
		cout << sum << '\n';
	}
	return;
}

int main()
{
	ios::sync_with_stdio(false);
	cin >> N;
	for(int i=0;i<N;++i) cin >> a[i];
	cin >> Q;
	for(int i=0;i<Q;++i) cin >> b[i] >> c[i];
	solve();
	return 0;
}

Measured memory_bytes: 9916
#include<cstdio>
#include<queue>
#include<algorithm>
#include<cstring>
#define re register
#define int long long
using namespace std;
const int Mxdt=100000;	//单次大小 
inline char gc(){
	static char buf[Mxdt],*p1=buf,*p2=buf;
	return p1==p2&&(p2=(p1=buf)+fread(buf,1,Mxdt,stdin),p1==p2)?EOF:*p1++;
}
int n,a,b,pos,f[44][12],g[44][12],h[44][22],ans,cnt,m,kk;
char s[22];
#define gc() (cnt<m?s[++cnt]:'\0')
inline int read(){
	re int t=0,f=0;re char v=gc();
	while(v<'0'||v>'9')f|=(v=='-'),v=gc();
	while(v>='0'&&v<='9'){
	t=(t<<3)+(t<<1)+v-48,v=gc();if(v=='.')v=gc();}
	return f?-t:t;
}
signed main(){
	scanf("%lld",&n);
	for(re int i=1;i<=n;++i){
		scanf("%s",s+1);
		a=0,b=0,pos=0;cnt=0;
		 m=strlen(s+1);
		while(s[m]=='0')--m;kk=m;
		while(s[m]!='.'&&m>=0)--m,++pos;
		if(m<0)pos=0,m=1e8;
		else m=kk;
		re int x=read();
		while(x%2==0)x/=2,++a;
		while(x%5==0)x/=5,++b;
		if(!pos){
			for(re int j=0;j<=15;++j)for(re int k=0;k<=7;++k)ans+=h[j][k];
			for(re int j=0;j<=40;++j)for(re int k=0;k<=9;++k)if(min(a+j,b)>=k)ans+=f[j][k];
			for(re int j=0;j<=20;++j)for(re int k=0;k<=9;++k)if(min(a,b+j)>=k)ans+=g[j][k];
			++h[a][b];
		}
		else{
			for(re int j=0;j<=15;++j)for(re int k=0;k<=7;++k)if(min(a+j,b+k)>=pos)ans+=h[j][k];
		
			for(re int j=0;j<=40;++j)for(re int k=0;k<=9;++k)if(min(a+j,b)>=k+pos)ans+=f[j][k];
			for(re int j=0;j<=20;++j)for(re int k=0;k<=9;++k)if(min(a,b+j)>=k+pos)ans+=g[j][k];
			if(a)++f[a][pos];
			else ++g[b][pos];
		}
	}
	printf("%lld",ans);
}


Measured memory_bytes: 1744
N = int(input())
for n in range(1,3501):
    for w in range(1,3501):
        if 4*n*w-N*w-N*n <= 0:
            continue
        h = (N*n*w)/(4*n*w-N*w-N*n)
        if h.is_integer():
            print(int(h),n,w)
            exit()

Measured memory_bytes: 67912
import java.util.*;
import java.io.*;
 
public class Main {
    public static void main(String[] args)throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        
        int a = 0;
        int b = 0;
        String str ="";
        
        
        
        for(int r=0;r<3000;r++){
        StringTokenizer st = new StringTokenizer(br.readLine(), " ");
        a = Integer.parseInt(st.nextToken());
        b = Integer.parseInt(st.nextToken());
        
        if(a==0&&b==0){
            break;
        }
        
        else if(a<b){
            System.out.println(a+" "+b);
        }
        
        else if(a>b){
            System.out.println(b+" "+a);
        }
        
        else if(a==b){
            System.out.println(a+" "+b);
        }
        
        
        
        
        
        }
        
    }
    
}

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

int main() {
    int x[5];
    for (size_t i = 0; i < 5; i++)
    {
        cin >> x[i];
    }

    for (size_t i = 0; i < 5; i++)
    {
        if(x[i] == 0) {
            cout << i + 1 << '\n';
            return 0;

        }
    }
}


Measured memory_bytes: 3580
#include<iostream>
using namespace std;
long mod=1e6+3;
long power(long a,long b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
long fac[1<<20],inv[1<<20];
main()
{
	fac[0]=1;
	for(long i=1;i<mod;i++)fac[i]=fac[i-1]*i%mod;
	inv[mod-1]=power(fac[mod-1],mod-2);
	for(long i=mod-1;i--;)inv[i]=inv[i+1]*(i+1)%mod;
	long Q;cin>>Q;
	for(;Q--;)
	{
		long x,d,n;cin>>x>>d>>n;
		if(d==0)
		{
			cout<<power(x,n)%mod<<endl;
			continue;
		}
		long div=x*power(d,mod-2)%mod;
		if(n+div-1>=mod)cout<<0<<endl;
		else cout<<power(d,n)*fac[(n+div-1+mod)%mod]%mod*inv[(div-1+mod)%mod]%mod<<endl;
	}
}

Measured memory_bytes: 17280
#include <iostream>
#include <cmath>
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

int main(){
  int n;
  cin >> n;
  int maxh = 0;
  int ans = 0;
  rep(i, n){
    int h;
    cin >> h;
    if (h >= maxh){
      ans++;
      maxh = h;
    }
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 3632
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC_Training
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var a = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var b = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var c = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var sat = b[a[0] - 1];
            var prev = a[0] - 1;
            for (int i = 1; i < n; i++)
            {
                sat += b[a[i] - 1];
                if (prev + 1 == a[i] - 1)
                {
                    sat += c[prev];
                }
                prev = a[i] - 1;
            }
            Console.WriteLine(sat);

        }

    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
#define SZ(v) ((int)(v).size())
#define zero(v) memset(v,0,sizeof(v))
#define rep(i,n) for(int i=0;i<(n);i++)
#define foreach(it,c) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
#define all(v) (v).begin(),(v).end()
template<typename T>inline bool chkmin(T &a,const T &b){return a>b?a=b,1:0;}
template<typename T>inline bool chkmax(T &a,const T &b){return a<b?a=b,1:0;}
typedef long long ll;
typedef unsigned uint;
const int INF=0x3f3f3f3f;
const ll INFL=0x3f3f3f3f3f3f3f3f;
const double EPS=1e-10;
typedef pair<int,int>P;
int inline in(){int x=0,c;for(;(uint)((c=getchar())-'0')>=10;)
{if(c=='-')return -in();if(!~c)throw ~0;}do{x=(x<<3)+(x<<1)+(c-'0');}
while((uint)((c=getchar())-'0')<10);return x;}
int N,W;
const int Maxn=105;
const int Maxw=1e5+5;
int w[Maxn];
ll v[Maxn];
ll dp[Maxw][Maxn];
ll f(int i,int j){
	if(dp[i][j]!=-1)return dp[i][j];
	if(i==0)return dp[i][j]=0;
	if(j==0)return dp[i][j]=0;
	ll a=0,b=0;
	if(i>=w[j])a=f(i-w[j],j-1)+v[j];
	b=f(i,j-1);
	return dp[i][j]=max(a,b);
}
int main(){
	N=in();W=in();
	for(int i=1;i<=N;i++){
		w[i]=in();v[i]=in();
	}
	memset(dp,-1,sizeof(dp));
	ll ans=0;
	for(int i=0;i<=W;i++){
		chkmax(ans,f(i,N));
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 82304
#include<iostream>
#include<string>
#include<vector>
#include<list>
#include<cmath>
#include<algorithm>
#include<cstdio>
#include<set>
#include<map>
#include<queue>
#include<cstring>
#include<sstream>
using namespace std;

typedef long long ll;

int main() {
  int N; cin >> N;
  int C,K; cin >> C >> K;
  int T[100010];
  for( int i = 0; i < N; i++ ) {
    cin >> T[i];
  }

  sort(T,T+N);
  int ans = 0;
  int cnt = 1;
  int tmp = T[0];
  for ( int i = 1;i < N; i++ ) {
    if ( T[i]-tmp > K || cnt == C ) {
	tmp = T[i];
	cnt = 1;
	ans++;
    }else if ( T[i]-tmp <= K ) cnt++;
  }
  if ( T[N-1]-tmp <= K && cnt <= C ) ans++;
    cout << ans << endl;
  return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <ctype.h>
#include <cmath>
#include <algorithm>
#include <map>

using namespace std;

char *p1, *p2, buf[1 << 20];

inline char gc()
{
    return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 20, stdin), p1 == p2) ? EOF : *p1++;
}

template<typename T>
void rd(T &num)
{
    bool flag = 0;
    char tt;
    while (!isdigit(tt = gc()) && tt != '-');
    if (tt == '-')
        num = 0, flag = 1;
    else
        num = tt - '0';
    while (isdigit(tt = gc()))
        num = num * 10 + tt - '0';
    if (flag)
        num = -num;
    return;
}

const int _N = 200010;

int N, A[_N], B[_N];
map<int, int> MP;

int main()
{
    rd(N);
    for (int i = 1; i <= N; ++i)
        rd(A[i]);
    sort(A + 1, A + 1 + N);
    for (int i = 1; i <= N; ++i) {
        for (B[i] = 1; B[i] <= A[i]; B[i] <<= 1);
        B[i] -= A[i];
        ++MP[A[i]];
    }
    int ans = 0;
    for (int i = N; i >= 1; --i) {
        if (MP[A[i]]) {
            --MP[A[i]];
            if (MP[B[i]])
                --MP[B[i]], ++ans;
        }
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 21504
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
string s1,s2,s3;
cin >> s1 >> s2 >> s3;
string s = s1.substr(0,1) + s2.substr(0,1) + s3.substr(0,1);
 transform(s.cbegin(), s.cend(), s.begin(), ::toupper);
cout << s << endl;
return 0;
}

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

using ll = long long;
#define ALL(c) (c).begin(), (c).end()
const int MOD = 1000000007;


int main() {
    int a, b;
    cin >> a >> b;
    if (a + b == 15) {
        cout << "+" << endl;
    } else if (a * b == 15) {
        cout << "*" << endl;
    } else {
        cout << "x" << endl;
    }
}


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

int main(void) {
  int N;
  cin >> N;
  if (N % 2 == 0) {
    cout << N / 2 << endl;
  } else {
    cout << N / 2 + 1 << endl;
  }
  return 0;
}

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

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

    int a, b, c;
    cin >> a >> b >> c;
    int five = 0;
    int seven = 0;
    if (a == 5) {
        five = five + 1;
    } else {
        seven = seven + 1;
    }
    if (b == 5) {
        five = five + 1;
    } else {
        seven = seven + 1;
    }
    if (c == 5) {
        five = five + 1;
    } else {
        seven = seven + 1;
    }
    if (five == 2 && seven == 1) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }
}

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

int main() {
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;

    int t = (h2 - h1)*60 + (m2 - m1);

    t -= k;


    cout << t << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define rep(i, n) FOR(i, 0, n)
#define whole(x) (x).begin(),(x).end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
using P = pair<int, int>;
#define debug(var) cerr << "[" << #var << "] " << var << endl
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
const ll mod = 1000000007;
const int dx[] = {-1,0,1,0};
const int dy[] = {0,-1,0,1};



int main(){
    int x, n;
    cin >> x >> n;
    int ans = mod;
    vector<int> p(n);
    map<int, int> mp;
    rep(i, n) {
        cin >> p[i];
        mp[p[i]]++;
    }
    int diff = 0;
    while (1) {
        int v1 = x-diff;
        int v2 = x+diff;
        if (mp[v1]==0) {
            ans = v1;
            break;
        }
        if (mp[v2]==0) {
            ans = v2;
            break;
        }
        diff++;
    }
    

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


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

int main() {
	
	int k, t;
	cin >> k >> t;
	vector<int> tmp;
	int maxv = INT_MIN;
	int minv = INT_MAX;
	
	rep(i, 0, t) {
		int num;
		cin >> num;
		tmp.push_back(num);
	}
	if (t != 1) {
		sort(tmp.begin(), tmp.end(), greater<int>());
		while (tmp[1] != 0) {
			tmp[0]--;
			tmp[1]--;
			sort(tmp.begin(), tmp.end(), greater<int>());
		}
	}

	if (tmp[0] != 0) tmp[0]--;
	cout << tmp[0] << endl;
	

	return 0;
}

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

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

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

    ll N,R; cin >> N >> R;

    if(N < 10) cout << R+100*(10-N) << endl;
    else cout << R << endl;

    return 0;

}

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


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

int main(){
  int N,A,B;
  cin >> N >> A >> B;
  int total = 0;
  for (int i = 0;i <= N;i++){
    int sum = calculate(i);
    if(sum >= A&&sum <= B){
      total += i;
    }
  }
  cout << total << endl;
}
    

      

Measured memory_bytes: 256
# coding: utf-8

N = int(input())
M = int(input())
A = list(map(int, input().split(' '))) # M個
B = [list(map(int, input().split(' '))) for i in range(M)]

scores = [0 for i in range(N)]
for i in range(M):
    target = A[i]
    for j in range(N):
        if B[i][j] == target:
            scores[j] += 1
        else:
            scores[target-1] += 1

for score in scores:
    print(score)


Measured memory_bytes: 5704
import java.util.Scanner;

public class Main {

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

        final int n = sc.nextInt();

        final int[] p = new int[n];
        for (int i = 0; i < n; i++) {
            p[i] = sc.nextInt();
        }

        int ans = 0;
        for (int i = 1; i < n - 1; i++) {
            if (Math.min(p[i-1], p[i+1]) < p[i] && p[i] < Math.max(p[i-1], p[i+1])) {
                ans++;
            }
        }

        System.out.println(ans);
    }
}


Measured memory_bytes: 21588
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,m,a;
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)
	{
		scanf("%d",&a);
		n-=a; 
	}
	if(n>=0) printf("%d",n);
	else printf("-1");
	return 0; 
}

Measured memory_bytes: 3760
from collections import Counter
import sys
input = sys.stdin.readline

def combination(n, k):
    numer = denom = 1
    for i in range(k):
        numer *= n-i
        denom *= i+1
    return numer // denom

N = int(input())
A = list(map(int, input().split()))
counter = Counter(A)
num1 = {}
num2 = {}
total = 0
for k, v in counter.items():
    total += combination(v, 2)
    num1[k] = combination(v, 2)
    num2[k] = combination(v-1, 2)
for a in A:
    print(total - num1[a] + num2[a])

Measured memory_bytes: 108108
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
#define se second
#define fi first
#define ll long long
#define ld long double
#define pll pair<ll ,ll >
#define plll pair<pll,ll>
#define ppll pair<pll, pll>
#define pii pair<int, int> 
#define piii pair<pii, int>
#define pb push_back
const ll llinf = 2e18 + 7;
const int inf = 2e9 + 7;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 7;
const ld pi = 3.14159265358979; 

void solve() {
    int x,y;
    cin>>x>>y;
    for(int i=0;i<=x;i++) {
        int rem = x - i;
        if((i*2 + rem*4) == y) {
            cout<<"Yes";
            return ;
        }
    }
    cout<<"No";
    return ;
}

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t;
    t=1;
    // cin>>t;
    while(t--) {
        solve();
        // cout<<"\n";
    }
    return 0; 

}


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

int main(){
  string S,T; cin >> S >> T;
  int slen=S.size(), tlen=T.size();
  if(tlen>slen){
    cout << "UNRESTORABLE" << endl;
  }else{
    for(int i=slen-tlen; i>=0; i--){
      bool match=true;
      for(int j=0; j<tlen; j++){
        if(S[i+j]!=T[j]&&S[i+j]!='?'){
          match=false;
          break;
        }
      }
      if(match){
        for(int j=0; j<slen; j++){
          if(i<=j&&j<=i+tlen-1){
            S[j]=T[j-i];
          }else if(S[j]=='?'){
            S[j]='a';
          }
        }
        cout << S << endl;
        return 0;
      }
    }
    cout << "UNRESTORABLE" << endl;
  }
}

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

public class Main {

	static final int oo = 1 << 28;

	static ArrayList<Integer>[] g;

	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		int n = sc.nextInt(), m = sc.nextInt();
		g = new ArrayList[n];
		for (int i = 0; i < n; i++)
			g[i] = new ArrayList<>();
		for (int i = 0; i < m; i++) {
			int u = sc.nextInt() - 1, v = sc.nextInt() - 1;
			g[u].add(v);
			g[v].add(u);
		}
		int[] dist = new int[n];
		Arrays.fill(dist, oo);
		dist[0] = 0;
		Queue<Integer> q = new LinkedList<>();
		q.add(0);
		while (!q.isEmpty()) {
			int u = q.poll();
			for (int v : g[u])
				if (dist[v] == oo) {
					q.add(v);
					dist[v] = dist[u] + 1;
				}
		}
		out.println(dist[n - 1] > 2 ? "IMPOSSIBLE" : "POSSIBLE");
		out.flush();
		out.close();
	}

	static class MyScanner {
		StringTokenizer st;
		BufferedReader br;

		public MyScanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}

		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}

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

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

		public double nextDouble() throws IOException {
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if (x.charAt(0) == '-') {
				neg = true;
				start++;
			}
			for (int i = start; i < x.length(); i++)
				if (x.charAt(i) == '.') {
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				} else {
					sb.append(x.charAt(i));
					if (dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg ? -1 : 1);
		}

		public String nextLine() throws IOException {
			return br.readLine();
		}

		public boolean ready() throws IOException {
			return br.ready();
		}
	}
}


Measured memory_bytes: 87708
#include <stdio.h>
#include <math.h>

int main(){
  int N,S,i,j=1;
  scanf("%d",&N);
  int Ntil=round(sqrt(2.0*N));
  S=Ntil;
  int Nrow[10000]={0};
  Nrow[0]=Ntil;
  for(i=Ntil-1;i>0;i--){
    if(S+i<N){
      Nrow[j]=i;
      S+=i;
      j+=1;
    }
    else{
      if(S+i==N){
	Nrow[j]=i;
	break;
      }
    }
  }
  for(;j>=0;j--)
    if(Nrow[j]>0)
      printf("%d\n",Nrow[j]);
  return 0;
}


Measured memory_bytes: 384
def main():
    data = list(input())
    num = int(input())

    set_dic = set()
    for i in range(26):
        point = chr(97 + i)
        for j in range(len(data)):
            if data[j] == point:
                for k in range(min(len(data) - j, num)):
                    set_dic.add(''.join(data[j:j+k + 1]))
        if len(set_dic) >= num:
            break
    set_dic = list(set_dic)
    set_dic.sort()
    print(set_dic[num - 1])



if __name__ == '__main__':
    main()


Measured memory_bytes: 41072
N = int(input())
a = list(map(int,input().split()))

num = {}

for i in a:
    if i in num:
        num[i] += 1
    else:
        num[i] = 1

keys = list(num.keys())
values = list(num.values())

ans = 0
for i in range(len(keys)):
    if values[i] < keys[i]:
        ans += values[i]
    else:
        ans += values[i] - keys[i]

print(ans)

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

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

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t; cin>>s>>t;
    t.pop_back();
    if (s==t){
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
    return 0;
}


Measured memory_bytes: 3648
s = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    d *= 10
    d%= 2019
    counts[num] += 1

ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2

print(ans) # 答えの出力

Measured memory_bytes: 9296
/*---------------------------------------------------------------------*/
/*                   -------------------------------------             */
/*                   -----------MEHEDI HASAN--------------             */
/*                   -----CSE,JAHANGIRNAGAR UNIVERSITY----             */
/*                   -------------------------------------             */
/*---------------------------------------------------------------------*/
#include<bits/stdc++.h>
//#include <cassert>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
using namespace std;
/*---------------------------------------------------------------------*/
#define FAST        ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
#define cc(x)       cout<<#x<<"="<<x<<" ";
#define ccc(x)      cout<<#x<<"="<<"("<<x.ff<<" "<<x.ss<<") ";
#define CC(x)       cout<<"["<<#x<<"] = ";for(auto xx: x) cout<<xx<<" ";
#define CCC(x)      cout<<"["<<#x<<"] = ";for(auto xx: x) cout<<"("<<xx.ff<<" "<<xx.ss<<") ";
#define MARK(x)     cout<<x<<" ";
#define ee          cout<<"\n";
#define OK          cout<<"Ok till line "<<__LINE__<<"\n";
/*---------------------------------------------------------------------*/
#define ff          first
#define ss          second
#define ll          long long
#define ull         unsigned long long
#define pii         pair<int,int>
#define mp          make_pair
#define ps          push
#define psb         push_back
#define psf         push_front
#define pp          pop
#define ppb         pop_back
#define ppf         pop_front
#define all(x)      x.begin(),x.end()
#define TESTS       int t;cin>>t;for(int tcase=1;tcase<=t;tcase++)
#define ordered_set tree< int, null_type, less_equal< int >, rb_tree_tag, tree_order_statistics_node_update>
/*---------------------------------------------------------------------*/
#define MAX (int) (5e5+88)

int main()
{
    FAST
    int r;cin>>r;
    cout<<2*3.1416*r<<endl;
    return 0;
}
/*--------------------------------------------------------------------*/
/*
>Check Corner Cases (n==1 or T==1)
>Overflow issues?
>LB / UB !!not found!! check?
*/
/*--------------------------------------------------------------------*/
/* ---INPUT---
--------(1)------
4
3
AAB
5
AABAA
1
B
4
BABA
-------(2)-------
5
5
AAAAA
6
BBAAAA
1
A
2
BA
10
AAAAAAAAAB


-------(3)-------


-------(4)-------



--------------
*/
/*--------------------------------------------------------------------*/


//https://codeforces.com/contest/466/problem/C try again


Measured memory_bytes: 3772
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int n, k, c;
    cin >> n >> k >> c;
    string s;
    cin >> s;
    vector<vector<int>> ans(2, vector<int>(k, -1));
    int cnt = 0;
    rep(i, n){
        if(s[i]=='x') continue;
        else{
            ans[0][cnt] = i;
            i += c;
            cnt++;
            if(cnt >= k)break;
        }
    }
    cnt = k - 1;
    for(int i = n - 1; i >= 0; --i){
        if(s[i] == 'x') continue;
        else{
            ans[1][cnt] = i;
            i -= c;
            cnt--;
            if(cnt<0) break;
        }
    }
    rep(i, k){
        if(ans[0][i]==ans[1][i])cout << ans[0][i]+1 << endl;
    }
}

Measured memory_bytes: 3444
import java.util.*;

public class Main {
	static final int MOD = 1000000007;
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long ans = n / 11 * 2;
		long mod = n % 11;
		if (mod > 6) {
			ans += 2;
		} else if (mod > 0) {
			ans++;
		}
		System.out.println(ans);
	}
}


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

ac = 0
wa = 0
acs = [0]*(N+1)
was = [0]*(N+1)

for i in range(M):
	p,s = input().split()
	p = int(p)
	if s == "AC":
		if acs[p]==0:
			ac += 1
			wa += was[p]
			acs[p] = 1
	else:
		was[p] += 1

print(ac,wa)

Measured memory_bytes: 4596
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    int n;
    cin >> n;
    vector<int> h(n);
    rep(i, n) cin >> h[i];

    vector<int> a(n);
    int now = a[0] = 0;
    int ans = 0;
    rep(i, n - 1){
        if(h[i] >= h[i+1]){
            now++;
        }else{
            now = 0;
        }
        a[i+1] = now;
        ans = max(ans, a[i+1]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define int long long
#define lint long long
#define pii pair<int,int>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) (c).begin(),(c).end()
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MINF(a) memset(a,0x3f,sizeof(a))
#define POW(n) (1LL<<(n))
#define IN(i,a,b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline T LB(vector<T>& v, T a) { return *lower_bound(ALL(v),a); }
template <typename T> inline int LBP(vector<T>& v, T a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline T UB(vector<T>& v, T a) { return *upper_bound(ALL(v),a); }
template <typename T> inline int UBP(vector<T>& v, T a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e,v); }
const lint MOD = 1000000007;
const lint INF = 0x3f3f3f3f3f3f3f3f;
const double EPS = 1e-10;

string S;
int K;
int dp[310][310][310];

int dfs(int i, int j, int k) {
    if (dp[i][j][k])
        return dp[i][j][k];
    if (i > j)
        return dp[i][j][k] = 0;
    if (i == j)
        return dp[i][j][k] = 1;
    if (S[i] == S[j])
        return dfs(i + 1, j - 1, k) + 2;
    int res = -1;
    if (k > 0)
        CHMAX(res, dfs(i + 1, j - 1, k - 1) + 2);
    CHMAX(res, dfs(i + 1, j, k));
    CHMAX(res, dfs(i, j - 1, k));
    return dp[i][j][k] = res;
}

void _main() {
    cin >> S >> K;
    cout << dfs(0, S.size() - 1, K) << endl;
}

signed main(signed argc, char **argv) {
    if (argc > 1) {
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    }
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 223360
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
typedef long long ll;

int main(){
    int x,a,b; cin >> x >> a >> b;
    cout << ((abs(x-a) > abs(x-b))? "B" : "A") << endl; return 0;
}


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

int main(){
    int a, b, c; cin >> a >> b >> c;
    if(b-a == c-b) cout << "YES";
    else cout << "NO";
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <string>
#include <cctype>
#include <map>
#include <queue>

using namespace std;

const int mod = 1000000007;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))
#define ll long long

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

    int a = n / 2;
    float b = n - a;

    cout << (b/n) << endl;
}

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

using namespace std;

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

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(vi c, vi d){
	return c.S < d.S;
}

int main() {
	string s;
	ll k;
	cin >> s >> k;
	ll ans = 0, c = 5*pow(10, 15); 
	
	while(k > 0){
		 int num = s[ans]- '0';
		 k -= pow(num, c);
		 ++ans;
	 }
	
	cout << s[ans-1];

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long
using P = pair<int, int>;
struct edge{ int to, cost; };

signed main(){

  int n; cin >> n;
  vector<vector<edge>> G(n);
  for(int i = 0; i < n-1; i++){
    int a, b, w; cin >> a >> b >> w;
    G[a].push_back({b, w});
    G[b].push_back({a, w});
  }

  vector<vector<P>> dp(n, vector<P>(2, P(0,0)));
  auto dfs = [&](auto&& dfs, int u, int p)->void{
    for(edge e : G[u]){
      if(e.to == p) continue;
      dfs(dfs, e.to, u);
      int cost = dp[e.to][0].first + e.cost;
      if(dp[u][0].first < cost){
        dp[u][1] = dp[u][0];
        dp[u][0] = P(cost, e.to);
      }else if(dp[u][1].first < cost){
        dp[u][1] = P(cost, e.to);
      }
    }
  };
  dfs(dfs, 0, -1);

  vector<int> ans(n, 0);
  auto dfs2 = [&](auto&& dfs2, int u, int p, int cost)->void{
    ans[u] = max(dp[u][0].first + dp[u][1].first, dp[u][0].first + cost);
    if(dp[u][0].first < cost){
      dp[u][1] = dp[u][0];
      dp[u][0] = P(cost, p);
    }else if(dp[u][1].first < cost){
      dp[u][1] = P(cost, p);
    }
    for(edge e : G[u]){
      if(e.to == p) continue;
      cost = e.cost + (e.to == dp[u][0].second ? dp[u][1].first : dp[u][0].first);
      dfs2(dfs2, e.to, u, cost);
    }
  };
  dfs2(dfs2, 0, -1, 0);
  cout << *max_element(ans.begin(),ans.end()) << endl;


  return 0;
}



Measured memory_bytes: 22880
import java.util.Scanner;
import java.util.ArrayList;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		ArrayList<Integer> list = new ArrayList<Integer>();
		while(a>=0){
			list.add(a);
			if(a%2==0){
				a/=2;
			}else{
				a=3*a+1;
			}
			if(list.contains(a)){
				a=list.size()+1;
				break;
			}
		}
		System.out.println(a);
	}
}

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

int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<string> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  int ans = 0;
  for (int A = 0; A < n; ++A) {
    bool works = true;
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < n; ++j) {
        int ni1 = (i + A) % n;
        int nj1 = j;
        int ni2 = i;
        int nj2 = (j + A) % n;
        if (a[ni1][nj1] != a[nj2][ni2]) {
          works = false;
          break;
        }
      }
      if (!works) break;
    }
    if (works) {
      ans += n;
    }
  }
  cout << ans << endl;
  return 0;
}


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

#define ll long long
using namespace std;


void solve()
{
	int N,K;
	cin>>N>>K;
	vector<int> A(N);
	for(auto &a: A)
		cin>>a;
	for(int i=K; i<N; ++i)
		if(A[i]>A[i-K])
			cout<<"Yes"<<endl;
		else
		{
			cout<<"No"<<endl;
		}
		
}


int main()
{
	//xyz();
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	//int T;
	//cin>>T;
	//while(T--)
		solve();
		
	return 0;
}


Measured memory_bytes: 3988
def f():
    import sys
    input=sys.stdin.buffer.readline
    sys.setrecursionlimit(10**9)
    from collections import defaultdict
    table=defaultdict(list)
    
    s,t=input().rstrip(),input().rstrip()
    n=len(s)
    for j in range(n):
        table[s[j]-97].append(j)
    now=0
    ind=0
    if set(t)-set(s):print(-1);exit()
    from bisect import bisect_left as bl
    for p in t:
        if ind>table[p-97][-1]:now+=1;ind=0
        ind=table[p-97][bl(table[p-97],ind)]+1

    print(now*n+ind)
if __name__ == "__main__":
    f()

Measured memory_bytes: 7916
#include<stdio.h>

int main()
{
	int i, j, N,ans,m,max, d[100];

	scanf("%d", &N);

	for (i = 0; i < N; i++)
		scanf("%d", &d[i]);

	ans = N;

	for (i = 0; i < N; i++)
	{
		for (j = i + 1; j < N; j++)
		{
			if (d[i] == d[j] && d[j] != 0)
			{
				ans--;
				d[j] = 0;
			}
		}
	}

	printf("%d\n", ans);

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
long long int min(long long int a,long long int b){
    if(a<b){
        return a;
    }
    return b;
}
long long int max(long long int a,long long int b){
    return -min(-a,-b);
}
int main(){
    long long int N,A[100010],B[100010];
    scanf("%lld",&N);
    long long int i;
    for(i=1;i<=N+1;i++){
        scanf("%lld",&A[i]);
    }
    for(i=1;i<=N;i++){
        scanf("%lld",&B[i]);
    }
    long long int ans;
    ans=0;
    long long int c,d;
    for(i=N;i>=1;i--){
        c=min(A[i+1],B[i]);
        ans=ans+c;
        d=A[i];
        A[i]=max(A[i]-(B[i]-c),0);
        ans=ans+d-A[i];
    }
    printf("%lld",ans);
}

Measured memory_bytes: 1664
using System;
using System.Collections.Generic;

namespace D
{
    class Program
    {
        static void Main(string[] args)
        {
            long x = long.Parse(Console.ReadLine());

            int p = 0;
            var pow = new List<long>();
            for(int i=0; i<120; i++){
                pow.Add((long) Math.Pow(i, 5));
                if(pow[i]<x) p++; 
            }

            for(int i=0; i<120; i++){
                long d = Math.Abs(pow[i]-x);
                for(int j=0; j<120; j++){
                    if(pow[j]==d){
                        if(pow[i]<x) j *= -1;
                        Console.WriteLine("{0} {1}", i, j);
                        return;
                    }
                }
            }
        }
    }
}


Measured memory_bytes: 28152
a = input().split(" ")

tmp_out=[[""] for i in range(int(a[0])+2)]

for j in range(int(a[1])+2):
    tmp_out[0]=["".join(tmp_out[0]+["#"])]

for i in range(1, int(a[0])+1):
    tmp_out[i]=["".join(["#"]+input().split(" ")+["#"])]

tmp_out[int(a[0])+1]=tmp_out[0]

for i in range(int(a[0])+2):
    print("".join(tmp_out[i]))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int mod = 1e9 + 7;

class RollingHash{
public:
  typedef long long ll;
  ll B, mod;  //B: ハッシュ基数
  int n;
  string s;
  vector<ll> hash;
  vector<ll> k;

  RollingHash():n(-1){};
  RollingHash(string s,ll B = 1777771,ll mod = 1e9 + 7):
    B(B),mod(mod),n(s.size()),s(s),hash(n+1),k(n+1)
  {
    for(int i=0;i<n;i++) hash[i+1] = (hash[i] * B % mod + s[i]) % mod;
    k[0] = 1;
    for(int i=1;i<=n;i++) k[i] = (k[i-1] * B) % mod;
  }

  ll get(int l,int r){ //[l, r)
    assert(0<=l && r<=n && l<=r);
    return (mod + hash[r] - hash[l] * k[r-l] % mod) % mod;
  }
  
  //hash[a]とB.hash[b]からみて何文字一致してるか。
  int count(int a, RollingHash &B, int b){
    int L = 0, R = min( n - a, B.n - b ) + 1;
    while( L + 1 < R ){
      int M = ( L + R ) / 2;
      get( a, a + M ) != B.get( b, b + M ) ? R = M : L = M;
    }
    return L;
  }
};

typedef long long ll;

string s;

bool check(int l, int r, int d, RollingHash &rh){
  if( r - l == 1 ) return true;
  return rh.get( l, r - d ) == rh.get( l + d, r );
}

vector<vector<int> > d(500005);

signed main(){
  
  for(int i=1;i<=500000;i++){
    
    for(int j=i*2;j<=500000;j+=i){
      
      d[j].push_back(i);
      
    }
    
  }
  
  cin>>s;
  
  int n = (int)s.size();
  
  int flg0 = 0;
    
  for(int i=0;i<n;i++){
    if( s[0] != s[i] ) flg0 = 1;
  }
  
  if( flg0 == 0 ){
    cout<<n<<endl;
    cout<<1<<endl;
    return 0;
  }
  
  RollingHash rh(s);
  
  int flg = 0;
  
  for(int i=0;i<(int)d[n].size();i++){
    if( check( 0, n, d[n][i], rh ) == true ) flg = 1;
  }
  
  if( !flg ){
    cout<<1<<endl;
    cout<<1<<endl;
    return 0;
  }
  
  int ans = 0;
  
  for(int i=0;i<n-1;i++){
    
    int flg1 = 0;
    
    for(int j=0;j<(int)d[i+1].size();j++){
      if( check( 0, i + 1, d[i+1][j], rh ) == true ) flg1 = 1;
    }
    
    int flg2 = 0;
    
    for(int j=0;j<(int)d[n-i-1].size();j++){
      if( check( i + 1, n, d[n-i-1][j], rh ) == true ) flg2 = 1;
    }
    
    if( flg1 == 0 && flg2 == 0 ) ans++;
    
  }
  
  cout<<2<<endl;
  cout<<ans<<endl;
  
  return 0;
}


Measured memory_bytes: 97644
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

void solve()
{
	int N;
	cin >> N;
	vector<int> p(N);
	for (int i = 0; i < N; ++i)
	{
		cin >> p[i];
	}
	sort(p.begin(), p.end());
	int sum = 0;
	for (int i = 0; i < N - 1; ++i)
	{
		sum += p[i];
	}
	cout << sum + p[N - 1] / 2 << endl;
}

int main()
{
	solve();
	return(0);
}

Measured memory_bytes: 256
/******************************\
*  Everyone has a different way of thinking, so God Created us
Hope You Respect My Way..,Thank You ):  *
*                            *
*   Created by : Murad   *
\******************************/
//std::transform(s1.begin(), s1.end(), s1.begin(),::tolower);
#include<bits/stdc++.h>
using namespace std;
#define pi 3.1415926536
#define forn(i,a,b)for(int i=a;i<b;i++)
#define LL long long
#define MP make_pair
#define ff first
#define ss second
#define INF 2147483647
#define _INF -2147483647
#define pq priority_queue
#define MM multimap
#define PB push_back
#define ipair pair<int,int>
#define lpair pair<LL,LL>
#define MAXN 100004
#define El3zba ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define modd 1000000007
LL MMIN(LL a, LL b)
{
	if (a <= b)
		return a;
	else
		return b;
}
LL MMAX(LL a, LL b) {
	if (a >= b)
		return a;
	else
		return b;
}
int main()
{
	El3zba;
	int n, d;
	cin >> n >> d;
	vector<int>a[30];
	int cnt = 0;
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < d; j++)
		{
			int x;
			cin >> x;
			a[i].PB(x);
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = i+1; j <n; j++) {
			double ans = 0.0;
			for (int idx = 0; idx < a[j].size(); idx++)
			{
				ans+= pow(a[i][idx] - a[j][idx],2);
			}
			ans = sqrt(ans);
			if (ceil(ans) == floor(ans))
				cnt++;
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
int main(){
  int n;
  scanf("%d", &n);
  int i;
  double x[n], y[n];
  for(i=0; i<n; ++i){
	scanf("%lf", &x[i]);
  }
  for(i=0; i<n; ++i){
	scanf("%lf", &y[i]);
  }
  double d1=0.0, d2=0.0, d3=0.0, d4=0.0;
  double tmp;
  double max=0;
  double tmp2;
  for(i=0; i<n; ++i){
	tmp=x[i]-y[i];
	if(tmp<0)
	  tmp=tmp*(-1);
	if(tmp>max)
	  max=tmp;
	tmp2=tmp;
	d1+=tmp;
	tmp*=tmp;
	d2+=tmp;
	tmp*=tmp2;
	d3+=tmp;
  }
  d2=sqrt(d2);
  d3=cbrt(d3);
  d4=max;
  //
  printf("%lf\n", d1);
  printf("%lf\n", d2);
  printf("%lf\n", d3);
  printf("%lf\n", d4);
}



Measured memory_bytes: 2104
#include<bits/stdc++.h>
#include<unordered_map>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;

int main(){
    string str; cin >> str;
    if(str[0] == str[1] || str[1] == str[2] || str[2] == str[3]) cout << "Bad" << endl;
    else cout << "Good" << endl;
}

Measured memory_bytes: 256