akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;

class Pg
{
    static void Main()
    {
        string line;
        var lst = new List<string>();
        while ((line = Console.ReadLine()) != null)
            lst.Add(line.Split(',').Last());
        Console.WriteLine($"{lst.Count(A => A=="A")}\n" +
                          $"{lst.Count(B => B=="B")}\n" +
                          $"{lst.Count(AB => AB=="AB")}\n" +
                          $"{lst.Count(O => O=="O")}");
    }
}


Measured memory_bytes: 16244
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const ld eps = 1e-9;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}
bool solve() {
  ll n, s, w, q; cin >> n >> s >> w >> q;
  if(n == 0) return false;
  vi a(n);
  int g = s;
  for(int i=0; i<n; i++) {
      a[i] = (g/7) % 10;
      if( g%2 == 0 ) { g = (g/2); }
      else { g = (g/2) ^ w; }
  }
  if(q == 2 || q == 5) {
    ll ans = 0;
    int cnt0 = 0;
    for(int i=0;i<n;++i) {
      cnt0 += a[i] == 0;
      if(a[i] % q == 0) ans += i+1 - cnt0;
    }
    cout << ans << "\n";
    return true;
  }
  vector<bool> iszero(n);
  for(int i=0;i<n;++i) {
    iszero[i] = a[i] == 0;
  }
  ll now = 1;
  for(int i=n-1;i>=0;--i) {
    a[i] *= now;
    a[i] %= q;
    now *= 10;
    now %= q;
  }
  vll su(n+1);
  map<ll, int> mp;
  for(int i=0;i<n;++i) {
    su[i+1] = su[i] + a[i];
    su[i+1] %= q;
    mp[su[i+1]]++;
  }
  ll ans = 0;
  for(int i=0;i<n;++i) {
    if(!iszero[i]) ans += mp[su[i]];
    mp[su[i+1]]--;
  }
  cout << ans << endl;
  return true;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  while(1) {
    if(!solve()) break;
  }
}



Measured memory_bytes: 9616
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;

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

int main()
{
	int n, m;
	int sumV = 0;

	cin >> n >> m;

	vector<int> a(n);

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

	sort(a.begin(), a.end(), greater<int>());

	if (a[m - 1] < (double)sumV / (4 * m))
		cout << "No" << endl;
	else
		cout << "Yes" << endl;


	return 0;
}

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

int main(){
  int n, w;
  cin >> n >> w;
  vector<ll> weight(n+1), value(n+1);
  rep(i,n) cin >> weight[i+1] >> value[i+1];
  vector<vector<ll>> dp(n+1, vector<ll>(100001, 1000000000000000000));
  //int ans = 0;
  dp[0][0] = 0;
  for(int i=1; i<=n; i++){
    for(int v=0; v<100001; v++){
      if(v-value[i] >= 0) dp[i][v] = min(dp[i-1][v], dp[i-1][v-value[i]] + weight[i]);
      else dp[i][v] = dp[i-1][v];
    //  if(dp[i][v] <= w) ans = max(ans, v);
    }
  }
  int ans = 100000;
  while(dp[n][ans] > w) ans--;
  cout << ans << endl;
}


Measured memory_bytes: 83196
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct edge {
	int t;
	edge(int _t) : t(_t) {}
};
bool use[100010];


vector<edge> te[100010];
vector<edge> fe[100010];
int t[64];
int d[100100];
ll rec(int num) {
	if (num == 0) return 0;
	return rec(num - 1) + num;
}

void Solve() {
	string s;
	cin >> s;
	string key = "keyence";
	int keyi = 0;

	for (size_t i = 0; i < s.size(); i++)
	{
		if (s[i] == key[keyi]) keyi++;
		else {
			break;
		}
	}
	int keye = key.size() - 1;
	
	for (int i = s.size() - 1; i >= 0; i--)
	{
		if (s[i] == key[keye]) keye--; 
		else{
			break;
		}
	}

	if (keye == -1 || keye < keyi) {
		cout << "YES" << endl;
	}else
		cout << "NO" << endl;

}


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



Measured memory_bytes: 6016
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repr(i,n) for(int i = (int)(n); i >= 0; i--)
#define all(v) v.begin(),v.end()
typedef long long ll;

int main(){
    ll a,b,c,d;
    cin >> a >> b >> c >> d;
    ll x1 = a * c;
    ll x2 = a * d;
    ll x3 = b * c;
    ll x4 = b * d;
    cout << max(x1, max(x2, max(x3, x4))) << endl;
}


Measured memory_bytes: 3632
#include <stdio.h>

int main(void)
{
    int i, men[7];
    char direction[101];
    
    for (i = 1; i < 7; i++)
        scanf ("%d", &men[i]);
    
    scanf ("%s", direction);
    
    for (i = 0; direction[i] != '\0'; i++){
        
        men[0] = men[1];
        
        switch (direction[i]){
                
            case 'E':
                men[1] = men[4];
                men[4] = men[6];
                men[6] = men[3];
                men[3] = men[0]; 
                break;
            
            case 'N':
                men[1] = men[2];
                men[2] = men[6];
                men[6] = men[5];
                men[5] = men[0]; 
                break;
            
            case 'S':
                men[1] = men[5];
                men[5] = men[6];
                men[6] = men[2];
                men[2] = men[0]; 
                break;
                
            case 'W':
                men[1] = men[3];
                men[3] = men[6];
                men[6] = men[4];
                men[4] = men[0]; 
                break;

        }
    }
    
    printf ("%d\n", men[1]);
    
    return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int MOD=1000000007;
using namespace std;
int main(){
    int n,c,k;
    cin>>n>>c>>k;
    vector<int> t(n);
    rep(i,0,n) cin>>t.at(i);
    sort(all(t));
    
    int ans=0;
    int now=-1;
    int r=0;
    rep(i,0,n){
        if(now<t.at(i)||r>=c){
            now=t.at(i)+k;
            r=1;
            ans++;
        }
        else r++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 640
import sys

sys.setrecursionlimit(200000)


def a(l2,x):
    l3=l2[:]
    if x==n+1:
        for j in l2:
            if j%2==1:
                return 0
        return 1
    for i in sw_l[x]:
        l3[i-1]+=1
    return a(l2,x+1)+a(l3,x+1)







n,m=map(int,input().split())
sw_l=[[] for _ in range(n+1)]
for i in range(1,m+1):
    l=list(map(int,input().split()))
    for j in l[1:]:
        sw_l[j].append(i)
p=list(map(int,input().split()))
ans=a(p,1)
print(ans)

Measured memory_bytes: 3064
#include <cstdio>

int main(){
    char s[20];
    scanf("%s",s);
    for(int i = 0; s[i] != '\0'; i++){
        if(s[i] == ','){
            printf(" ");
        }else{
            printf("%c",s[i]);
        }
    }
    printf("\n");

    return 0;
}

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

int main() {
	int w, n;
	scanf("%d%d", &w, &n);

	vector<int> result(w);
	iota(result.begin(), result.end(), 1);

	for(int i = 0; i < n; ++i) {
		int a, b;
		scanf("%d,%d", &a, &b);
		swap(result[a - 1], result[b - 1]);
	}

	for(const auto &from : result) {
		cout << from << endl;
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1196
#include <stdio.h>
#include <algorithm>

using namespace std;

#define MAXN 100005

typedef long long lint;
typedef pair<int, int> pii;

int A[MAXN];
pii as[MAXN];
int p[MAXN], pn;
lint ans[MAXN];

int main() {
	int N;

	scanf("%d", &N);
	for(int i = 1; i <= N; i++) scanf("%d", A + i);

	int h = 0;
	for(int i = 1; i <= N; i++) if(A[i] > h) {
		p[++pn] = i;
		h = A[i];
	}

	for(int i = 1; i <= N; i++) as[i] = make_pair(A[i], i);
	sort(as, as + N + 1);

	/*
	for(int i = 0; i <= pn; i++) printf("%d ", p[i]);
	printf("\n");
	for(int i = 0; i <= N; i++) printf("(%d, %d)", as[i].first, as[i].second);
	printf("\n");
	*/

	int k = N;
	while(as[k].second != p[pn]) k--;
	lint sum = 0ll;
	for(int i = pn; i > 0; i--) {
		//printf("i = %d, k = %d\n", i, k);
		ans[p[i]] += (lint) (N - k + 1) * (A[p[i]] - A[p[i - 1]]);
		for(k--; as[k].second != p[i - 1]; k--)
			ans[p[i]] += as[k].first - A[p[i - 1]];
	}

	for(int i = 1; i <= N; i++) printf("%lld\n", ans[i]);
	return 0;
}


Measured memory_bytes: 3328
#include<cstdio>
#include<functional>
#include<algorithm>
int main(void)
{
	int n,a[100],i,cnt,mx;
	scanf("%d",&n);
	for(i=0;i<n;i++)	scanf("%d",&a[i]);
	cnt=1;mx=1;
	for(i=0;i<n;i++)	{
		if(a[i]==1){
			cnt++;
			if(mx<cnt)	mx=cnt;
		}
		else{
			cnt=1;
		}
	}
	printf("%d\n",mx);
	return 0;
}


Measured memory_bytes: 2764
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <deque>
#include <numeric>
#include <utility>
#define sign(a) ((a>0)-(a<0))
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define LL long long
#define INF (LL)(1LL<<60)
#define all(a) a.begin(), a.end()
#define gr greater<LL>()

using namespace std;

const string YES = "Yes";
const string NO = "No";

void solve(long long N, long long M, std::vector<std::string> A, std::vector<std::string> B){
    rep(i, N-M+1){
        rep(j, N-M+1){
            bool ans = true;
            rep(di, M)rep(dj, M)if(A[i+di][j+dj] != B[di][dj])ans=false;
            if(ans){
                cout << YES << endl;
                return;
            }
        }
    }
    cout << NO << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    std::vector<std::string> A(N);
    for(int i = 0 ; i < N ; i++){
        std::cin >> A[i];
    }
    std::vector<std::string> B(M);
    for(int i = 0 ; i < M ; i++){
        std::cin >> B[i];
    }
    solve(N, M, std::move(A), std::move(B));
    return 0;
}


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

using namespace std;

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

	int n;
	cin >> n;

	int a, b, c;
	cin >> a >> b >> c;

	vector<string> s(n);
	for(int i = 0; i < n; ++i) {
		cin >> s[i];
	}

	int A = 0;
	int B = 0;
	int C = 0;

	vector<char> ans(n, 'D');

	bool ok = true;

	function<void(int, int, int, int)> dfs = [&] (int d, int a, int b, int c) {
		if(a < 0 || b < 0 || c < 0) {
			return;
		}
		if(d == n) {
			cout << "Yes" << '\n';
			for(char c : ans) {
				cout << c << '\n';
			}
			exit(0);
		}
		if(s[d] == "AB") {
			ans[d] = 'A';
			dfs(d + 1, a + 1, b - 1, c);
			ans[d] = 'B';
			dfs(d + 1, a - 1, b + 1, c);
		}
		if(s[d] == "BC") {
			ans[d] = 'B';
			dfs(d + 1, a, b + 1, c - 1);
			ans[d] = 'C';
			dfs(d + 1, a, b - 1, c + 1);
		}
		if(s[d] == "AC") {
			ans[d] = 'A';
			dfs(d + 1, a + 1, b, c - 1);
			ans[d] = 'C';
			dfs(d + 1, a - 1, b, c + 1);
		}
	};

	dfs(0, a, b, c);

	cout << "No" << '\n';

	return 0;
}


Measured memory_bytes: 25644
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  long long n, c;
  cin >> n >> c;
  vector<long long> v(n + 2), x(n + 2);
  for (int i = 1; i <= n; i++) {
    cin >> x[i] >> v[i];
  }
  x[1 + n] = c;
  long long cur = 0;
  vector<long long> dp1(n + 2);
  for (int i = 1; i <= n; i++) {
    cur += v[i];
    cur -= x[i] - x[i - 1];
    dp1[i] = max(dp1[i - 1], cur);
  }
  cur = 0;
  vector<long long> dp2(n + 2);
  for (int i = n; i >= 0; i--) {
    cur += v[i];
    cur -= x[i + 1] - x[i];
    dp2[i] = max(dp2[i + 1], cur);
  }
  long long ans = 0;
  for (int i = 0; i <= n; i++) {
    ans = max({ans, dp1[i] + dp2[i + 1] - x[i], dp1[i] + dp2[i + 1] + x[i + 1] - c});
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3456
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) rep(i,v.size())cout<<" "<<v[i];cout<<endl<<endl;
#define show2d(v) rep(i,v.size()){rep(j,v[i].size())cout<<" "<<v[i][j];cout<<endl;}cout<<endl;
using namespace std;
//kaewasuretyuui
typedef long long ll;
//#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
// #define mt make_tuple
// typedef tuple<int,int,int> tp;
// typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
//template<class C>constexpr int size(const C &c){return (int)c.size();}
//template<class T,size_t N> constexpr int size(const T (&xs)[N])noexcept{return (int)N;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
int dx[]={0,1,0,-1,1,1,-1,-1};
int dy[]={1,0,-1,0,1,-1,1,-1};//RDLU
int main(){
	int a;
	cin>>a;
	while(1){
		if(a/100==a%10&&a%10==a/10%10){
			cout<<a<<endl;
			return 0;
		}
		a++;
	}
}









Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int INF = 100000000;
int i,j,k;
int main(){
    string s,t;cin>>s>>t;

    vector<int> s_num(26,0),t_num(26,0);

    for(i=0;i<s.size();i++){
        s_num[(int)(s[i]-'a')]++;
        t_num[(int)(t[i]-'a')]++;
    }

    sort(s_num.begin(),s_num.end());
    sort(t_num.begin(),t_num.end());

    bool canchange=true;
    for(i=0;i<26;i++){
        if(s_num[i]!=t_num[i]){canchange=false;}
    }

    if(canchange){cout<<"Yes"<<endl;}
    else{cout<<"No"<<endl;}
    return 0;
}

Measured memory_bytes: 776
from fractions import gcd
n = int(raw_input())
lim = 10**19
for i in xrange(n):
	a, b, c, d = map(int, raw_input().split())
	if a < b or d < b:
		print 'No'
	else:
		# c - b + 1
		e = c - b + 1
		g = gcd(b, d)
		dist = abs(a % g) - abs(e % g) + g
		dist %= g
		e += dist
		if e < 0 or e > c - b + d:
			print 'No'
		else:
			print 'Yes'


Measured memory_bytes: 5288
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
using namespace std;

int main() {
  int N;
  cin>>N;
  vector<pair<int,int> > ab(N);
  for (int i=0; i<N; i++) {
    cin>>ab[i].first>>ab[i].second;
  }
  sort(ab.begin(),ab.end());
  vector<pair<int,int> > cd(N);
  for (int i=0; i<N; i++) {
    cin>>cd[i].first>>cd[i].second;
  }
  sort(cd.begin(),cd.end());
  bool used[N];
  memset(used,false,sizeof(used));
  int ans=0;
  for (int i=0; i<N; i++) {
    int maxy=-1,x=-1;
    for (int j=0; j<N; j++) {
      if (!used[j] && cd[i].first>ab[j].first && cd[i].second>ab[j].second && maxy<ab[j].second) {
        maxy=ab[j].second;
        x=j;
      }
    }
    if (x>-1) {
      used[x]=true;
      ans++;
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var N = F;
		var a = G;
		WriteLine(a.Sum(x => x - 1));
	}
}


Measured memory_bytes: 13296
import java.util.*;

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

    for (int i = 0; i < N; i++) {
      h[i] = sc.nextInt();
    }

    Arrays.sort(h);
    int minDiff = Integer.MAX_VALUE;
    for (int i = 0; i <= N - K; i++) {
      int diff = h[i+K-1] - h[i];
      if (diff < minDiff) {
        minDiff = diff;
      }
    }
    
    System.out.println(minDiff);
  }
}

Measured memory_bytes: 50260
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(n)]

ab.sort(key=lambda x: x[0])

count = 0
money = 0
while True:
    count += ab[0][1]
    if count < m:
        money += ab[0][0] * ab[0][1]
        del ab[0]
    else:
        money += ab[0][0] * (m - count + ab[0][1])
        break

print(money)

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

int a[3];

int main() {
	ios::sync_with_stdio(false), cin.tie(0);
	cin >> a[0] >> a[1] >> a[2];
	sort(a, a + 3);
	cout << a[2] - a[0];
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<iomanip>
#include<string>
#include<vector>

typedef unsigned long long ULL;
typedef long long LL;

using namespace std;

void process();
int Max(int a, int b );
int main(){
    ULL x;
    int K;
    int i,j;
    int pos;
    int number[18]={0};
    int max = 1;
    cin >> K;
    if( K <= 10){
        x = K;
    }else{
        number[0] = 0;
        number[1] = 1;
        for(i=11;i<=K;i++){
            pos = 0;
            while(1){
                if( abs(number[pos+1] - ( number[pos]+1)) <= 1 && number[pos] < 9){
                    number[pos]++;
                    for(j = pos;j>0;j--){
                        number[j-1] = Max(number[j] - 1,0);
                    }
                    break;
                }else{
                    pos++;
                    if(max == pos){
                        if(number[pos] == 9){
                            max++;
                            pos++;
                            number[pos] = 1;
                        }else{
                            number[pos]++;
                        }
                        for(j = pos;j>0;j--){
                            number[j-1] = Max(number[j] - 1,0);
                        }
                        break;
                    }
                    
                }
            }
        }
        x = 0;
        for(i=17;i>=0;i--){
            x *= 10;
            x += number[i];
        }
    }
    cout << x << endl;
    return 0;
}
int Max(int a, int b ){
    if(a > b ){
        return a;
    }else{
        return b;
    }
}
void process(){
    
}

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

int main()
{
    double num, t;
	int a[4],b[4];
	int hit, brow;
	while ( cin >> a[0] >> a[1] >> a[2] >> a[3]  ) {
			cin >> b[0] >> b[1] >> b[2] >> b[3];
			
			hit = 0; brow = 0;
			for( int i = 0; i < 4; i++ ) {
				for( int j = 0; j < 4; j++ ) {
					if( b[i] == a[j] ) {
						if( i == j ) {
							hit++;
						}
						else  {
							brow++;
						}
					}
				}			
			}
			
			cout << hit  << " " << brow << endl;

	}

        return 0;
}
  

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

float dist (int a[],int b[],int i,int j)
{
    float d;
    d=sqrt(((a[i]-a[j])*(a[i]-a[j]))+((b[i]-b[j])*(b[i]-b[j])));
    return d;
}

int main()
{
    int n,i;
    float sum=0;
    cin>>n;
        int a[n],b[n];

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

        }
    }
    sum=sum*2/n;
    cout<<setprecision(12)<<sum;

    return 0;
}


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

const int INF = 1 << 30;

int W[101];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    for (int i = 0; i < N; i++) cin >> W[i];
    int ans = INF;
    for (int i = 0; i < N - 1; i++) {
        int sum1 = 0, sum2 = 0;
        for (int j = 0; j <= i; j++) sum1 += W[j];
        for (int j = i + 1; j < N; j++) sum2 += W[j];
        ans = min(ans, abs(sum1 - sum2));
    }
    cout << ans << endl;
    return 0;
}

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

#define ll long long
#define ull unsigned long long 
#define endl '\n'
//const int MOD = 1e9+7;


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

    cout << 2*min(c0, c1);
}


Measured memory_bytes: 3728
N,K=map(int,input().split())
a=N//K
if a==0:
    x=N
    y=abs(N-K)
    if x>y:
        print(y)
    else:
        print(x)
elif N%K!=0:
    x=N-a*K
    y=abs(N-(a+1)*K)
    if x>y:
        print(y)
    else:
        print(x)
else:
    print(0)

Measured memory_bytes: 9056
A,B=map(int,input().split())
A-=1
if A%4==1:
    A=1
elif A%4==2:
    A+=1
elif A%4==3:
    A=0
if B%4==1:
    B=1
elif B%4==2:
    B+=1
elif B%4==3:
    B=0
print(A^B)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <map>
using namespace std;
int main(){
	int i,j;
	vector<int>v;
	string s;
	cin>>s;
	for(i=0;i<=(int)s.size()-8;i++){
		map<char,int>m;
		for(j=0;j<8;j++)m[s[i+j]]++;
		if(m['A']==2 && m['D']==1 && m['I']==1 && m['N']==2 && m['U']==1 && m['Y']==1)v.push_back(i);
	}
	for(i=0;i<v.size();i++)for(j=0;j<8;j++)s[v[i]+j]="AIZUNYAN"[j];
	cout<<s<<endl;
}

Measured memory_bytes: 1200
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define MOD 998244353
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=100050;
//↑templete
signed main(){

	bool flag=0;
	int N;
	cin>>N;
	for(int i=0;i<N;i++){
		int a;
		cin>>a;
		if(a%2==0){
			if(a%3 && a%5)
				flag=1;
		}
	}
	if(flag)
		cout<<"DENIED"<<endl;
	else
		cout<<"APPROVED"<<endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < (N); i++)
#define swap(a, b) (a += b, b = a - b, a -= b)
using namespace std;
int main()
{
    int N;
    long long ans = 3 * (1e+9);
    cin >> N;
    vector<long long> a(N), b(N - 1), c(N - 1);
    rep(i, N)
    {
        cin >> a[i];
    }
    if (N == 2)
    {
        cout << abs(a[0] - a[1]) << endl;
        return 0;
    }
    else
    {
        b[0] = a[0];
        c[N - 2] = a[N - 1];
        for (int i = 1; i < N - 1; i++)
        {
            b[i] = b[i - 1] + a[i];
        }
        for (int i = N - 3; i >= 0; i--)
        {
            c[i] = c[i + 1] + a[i + 1];
        }
        rep(i, N - 1)
        {
            ans = min(ans, abs(b[i] - c[i]));
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {
    public static boolean flag1 = false;
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        int i1[] = new int[4];
        for (int k = 0;k < i1.length;++k){
            i1[k] = Integer.valueOf(String.valueOf(s.charAt(k)));
        }
        fuka(i1,1,i1[0],String.valueOf(i1[0]));
    }

    public static void fuka(int array[],int count,int in,String out){
        if(flag1){
            return;
        }
        if(count == 4){
            if(in == 7){
                System.out.println(out + "=7");
                flag1 = true;
            }
        }
        else {
            fuka(array, count + 1, in + array[count], out + "+" + array[count]);
            fuka(array, count + 1, in - array[count], out + "-" + array[count]);
        }
    }


}

Measured memory_bytes: 21972
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define PI 3.1415926535897932
#define MOD 1000000007;
using namespace std;
long long GCD(long long A,long long B){
  if(B==0){
    return A;
  }
  else{
    return GCD(B,A%B);
  }
}
long long LCM(long long A,long long B){
  long long g=GCD(A,B);
  return A/g*B;
}
long long num_order(long long X){
  long long ans=0;
  while(true){
    if(X==0){
      break;
    }
    else{
      X/=10;
      ans++;
    }
  }
  return ans;
}
int main() {
  
  int N,K;
  cin>>N>>K;
  
  vector<int> A(N);
  for(int i=0;i<N;i++){
    cin>>A[i];
  }
  
  set<int> S;
  for(int i=0;i<N;i++){
    S.insert(A[i]);
  }
  
  int x=S.size();
  
  vector<int> app(200000);
  for(int i=0;i<N;i++){
    app[A[i]-1]++;
  }
  sort(app.begin(),app.end());
  
  int ans=0;
  
  int i=0;
  
  while(x>K){
    if(app[i]==0){
      i++;
    }
    else{
    x--;
    ans+=app[i];
    i++;
    }
  }
  
  cout<<ans<<endl;
}

Measured memory_bytes: 13988
def Test(n,k):
    if n > 2 * k:
        res = "YES"
    else:
        count = 0
        res = "NO"
        for i in range(1,n + 1,2):
            count += 1
            if count == k:
                res = "YES"
    print(res)
    
if __name__ == '__main__':
    N,K = map(int,input().split())
    try:
        Test(N,K)
    except:
        print("Error")

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using  namespace std;
main(){
int i,j,k,l;
while(cin>>k){
 int x[k+1]={0};
 for(i=1;i<k;i++){
    cin>>j; x[j]++;
 }
 for(i=1;i<=k;i++)cout<<x[i]<<endl;
} return 0;
}


Measured memory_bytes: 4380
// Problem: B - Product Max
// Contest: AtCoder - AtCoder Beginner Contest 178
// URL: https://atcoder.jp/contests/abc178/tasks/abc178_b
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;

#define int long long
#define endl "\n"
#define deb(x) cout << #x << " -> " << x << endl;
#define print(x)                          \
    for (auto &x_ : x) cout << x_ << " "; \
    cout << endl;
#define pb push_back
#define all(x) x.begin(), x.end()
#define prec(x, y) fixed << setprecision(y) << x

/*
Think of an easier solution because the problems you solve are always easy
-> Problems till Div-2 C are going to be ad-hoc
Think of change occuring in window (K periodic)
Binary Search
Traverse the array in reverse and check if any idea works out
*/

void solve(int tc) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << max({b * d, a * c, b * c, a * d}) << endl;
}

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

    int tc = 1;
    // cin >> tc;
    while (tc--) {
        solve(tc);
    }
}

Measured memory_bytes: 3660
namespace ABC143.B
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using static System.Console;


    public class Program
    {

        public static void Main(string[] args)
        {
            var n = ReadInputAsInt();
            var d = ReadInputsAsInt().ToList();
            WriteLine(Solve(d));

        }

        public static long Solve(List<int> d)
        {
            var sum = 0;
            for (int i = 1; i < d.Count; i++)
            {
                for (int j = 0; j < i; j++)
                {
                    sum += (d[j] * d[i]);
                }
            }
            return sum;
        }


        static IEnumerable<int> ReadInputsAsInt() => ReadLine().Split(' ').Select(x => int.Parse(x));

        static int ReadInputAsInt() => int.Parse(ReadLine());

    }


}


Measured memory_bytes: 11348
import java.util.*;
import java.util.Map.Entry;
public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int k = in.nextInt();
		int x = in.nextInt();
		int y = in.nextInt();
		int total = 0;
		if (n>k) {
			total = x*k;
			total+= (n-k)*y;}
		else {
			total = n*x;
		}
		
		System.out.println(total);
            }
		}
	



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

int main(int argc, const char * argv[]) {
  int a ,b;
  cin >> a >> b;
  if ( a == b){
    cout << "a == b" << endl;
  }else if(a < b){
    cout << "a < b" << endl;
  }else{
    cout << "a > b" << endl;
  }
}


Measured memory_bytes: 3080
#include <stdio.h>
#include <string.h>
int main(void)
{
    int N, L;
    char s[100][200], tmp[200];
    scanf("%d %d", &N, &L);
    for (int i = 0; i < N; i++)
        scanf("%s", s[i]);
    for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
            if (strcmp(s[i], s[j]) > 0) {
                strcpy(tmp, s[i]);
                strcpy(s[i], s[j]);
                strcpy(s[j], tmp);
            }
        }
    }
    for (int i = 0; i < N; i++)
        printf("%s", s[i]);
    return 0;
}

Measured memory_bytes: 2072
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
#define ll          long long
#define pb          push_back
#define INF         9223372036854775807
#define    endl        '\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)    for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define lower(u)    transform(u.begin(), u.end(), u.begin(), ::tolower);//convert string u to lowercase;
#define upper(u)    transform(u.begin(), u.end(), u.begin(), ::toupper);
using namespace std;

using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
#define N  3005

string s,t,ans;
ll n,m;
ll dp[N][N];
ll dps(ll i,ll j)
{
    if(i==0||j==0)
        return 0;
    if(dp[i][j]!=-1)
        return dp[i][j];
    dp[i][j]=0;
    if(s[i-1]==t[j-1])
    {
        dp[i][j]=1+dps(i-1,j-1);
    }
    else
    {
        dp[i][j]=max(dps(i-1,j),dps(i,j-1));
    }
    return dp[i][j];
}
void fun(ll i,ll j)
{
    if(i==0||j==0)
        return ;
    if(s[i-1]==t[j-1])
    {
        ans+=s[i-1];
        fun(i-1,j-1);
        return;
    }
    if(dps(i-1,j)>dps(i,j-1))
    {
        fun(i-1,j);
    }
    else
    {
        fun(i,j-1);
    }
}
void solve()
{
    cin>>s>>t;
    memset(dp,-1,sizeof(dp));
    dps(s.size(),t.size());
    fun(s.size(),t.size());
    reverse(all(ans));
    cout<<ans<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int TESTS=1;
//    cin>>TESTS;
    while(TESTS--)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 74488
#include<bits/stdc++.h>
using namespace std;
int dp[100001];
int solve(int i,int a[],int n,int k)
{
    if(i<=0)
    return dp[0]=0;
    if(dp[i]!=-1)
    return dp[i];
    else
    {
        int ans,j;
        ans=INT_MAX;
        if(i<k)
        {
            for(j=1;j<i+1;j++)
            ans=min(ans,abs(a[i]-a[i-j])+solve(i-j,a,n,k));
            return dp[i]=ans;
        }
        else
        {
            for(j=1;j<k+1;j++)
            ans=min(ans,abs(a[i]-a[i-j])+solve(i-j,a,n,k));
            return dp[i]=ans;
        }
    }
}
int main()
{
    for(int i=0;i<100001;i++)
    dp[i]=-1;
    int n,i,k;
    cin>>n>>k;
    int c[n];
    for(i=0;i<n;i++)
    cin>>c[i];
    solve(n-1,c,n,k);
    cout<<dp[n-1];
}

Measured memory_bytes: 10368
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
using namespace std;

#define REP(i,n) for(ll i=0; i<(ll)(n); i++)
#define FOR(i,n,m) for (ll i=n; i<(ll)(m); i++)
#define pb push_back
#define INF 1000000007LL
#define all(a) (a).begin(),(a).end()

typedef long long ll;
typedef pair<int,int> p;

int dy[4]={-1,1,0,0};
int dx[4]={0,0,1,-1};

int H, W, N;
int main(){
    ios::sync_with_stdio(false);
    cin >> H >> W;
    cin >> N;
    vector<int> v;
    REP(i, N) {
        int t;
        cin >> t;
        REP(j, t) {
            v.pb(i+1);
        }
    }
    vector<vector<int> > hw(H, vector<int>(W));
    int cur = 0;
    REP(i, H) REP(k, W) {
        int j = k;
        if (i%2) {
            j = W - 1 - k;
        }
        hw[i][j] = v[cur];
        cur++;
    }
    
    REP(i, H) {
        REP(j, W) {
            if (j == 0) cout << hw[i][j];
            else cout << " " << hw[i][j];
        }
        cout << endl;
    }
    
    return 0;
}

Measured memory_bytes: 384
import sys
N,H=map(int,input().split())

max_swing=0
blist=[]
for i in range(N):
  a,b=map(int,input().split())
  max_swing=max(max_swing,a)
  blist.append(b)

throw_list=[]
for b in blist:
  if b>max_swing:
    throw_list.append(b)
throw_list.sort(reverse=True)
#print(max_swing,throw_list)

answer=0
for t in throw_list:
  answer+=1
  H-=t
  if H<=0:
    print(answer)
    sys.exit(0)
    
#print(answer,H,max_swing)
print(answer+(H-1)//max_swing+1)

Measured memory_bytes: 8204
# coding:utf-8

import sys


input = sys.stdin.readline
INF = float('inf')
MOD = 10 ** 9 + 7


def inpl(): return list(map(int, input().split()))


N, K = inpl()
H = [int(input()) for _ in range(N)]

H.sort()
ans = INF
for i in range(N - K + 1):
    ans = min(ans, H[i + K - 1] - H[i])

print(ans)


Measured memory_bytes: 7384
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

using P = pair<ll, int>;

struct UnionFind {
  vector<int> parent;  // parent[root] is the negative of the size.
  UnionFind(int n)
      : parent(n, -1){};
  bool unite(int u, int v) {
    u = root(u);
    v = root(v);
    if (u == v) return false;
    if (parent[u] > parent[v]) swap(u, v);
    parent[u] += parent[v];
    parent[v] = u;
    return true;
  }
  bool find(int u, int v) {
    return root(u) == root(v);
  }
  int root(int u) {
    return parent[u] < 0 ? u : parent[u] = root(parent[u]);
  }
  int size(int u) {
    return -parent[root(u)];
  }
};

template <class Compare>
void push(vector<P>& ps, P x, Compare cmp) {
  bool found = false;
  for (auto& y : ps) {
    if (y.snd == x.snd) {
      found = true;
      if (cmp(x, y))
        y = x;
    }
  }
  if (!found) ps.push_back(x);
  sort(ps.begin(), ps.end(), cmp);
  if (ps.size() > 2)
    ps.resize(2);
}

template <class T, class Compare>
void func(vector<P>& cheapest, UnionFind& uf, T bg, T ed, Compare cmp) {
  vector<P> ps;
  while (bg != ed) {
    auto now = *bg++;
    ll x = now.fst;
    int r = uf.root(now.snd);
    for (auto p : ps) {
      if (p.snd != r)
        cheapest[r] = min(cheapest[r], P(abs(x - p.fst), p.snd));
    }
    push(ps, P(x, r), cmp);
  }
}

const ll INF = 1ll << 60;

int main() {
  int N;
  while (cin >> N) {
    vector<P> xs, ys;
    for (int i = 0; i < N; i++) {
      ll x, y;
      cin >> x >> y;
      xs.emplace_back(x, i);
      ys.emplace_back(y, i);
    }
    sort(xs.begin(), xs.end());
    sort(ys.begin(), ys.end());
    UnionFind uf(N);
    int components = N;
    ll res = 0;
    while (components >= 2) {
      vector<P> cheapest(N, P(INF, -1));
      func(cheapest, uf, xs.begin(), xs.end(), greater<P>());
      func(cheapest, uf, xs.rbegin(), xs.rend(), less<P>());
      func(cheapest, uf, ys.begin(), ys.end(), greater<P>());
      func(cheapest, uf, ys.rbegin(), ys.rend(), less<P>());
      for (int r = 0; r < N; r++) {
        if (cheapest[r].fst >= INF)
          continue;
        if (uf.unite(r, cheapest[r].snd)) {
          res += cheapest[r].fst;
          --components;
        }
      }
    }
    cout << res << endl;
  }
  return 0;
}


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

int main() {
  int n, a, x;
  
  cin >> n >> a;

  x = n % 500;
  if (x <= a) {
	cout << "Yes" << endl;
   }
  else {
	cout << "No" << endl;
  }
  
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<cmath>
#include<cstring>
#include<cctype>
#include<complex>
#include<iostream>
#include<sstream>
#include<algorithm>
#include<functional>
#include<vector>
#include<string>
#include<stack>
#include<queue>
#include<map>
using namespace std;
const int dx[] = {1,0,-1,0},dy[] = {0,1,0,-1};
#define INF 1e+8
#define EPS 1e-8
#define rep(i,j) for(int i = 0; i < (j); i++)
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define MAX_v 100
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const int Lcalendar[] = {366,31,29,31,30,31,30,31,31,30,31,30,31};
const int Ncalendar[] = {365,31,28,31,30,31,30,31,31,30,31,30,31};
int GetTotalDays(int y,int m,int d){
    long long int sum = 0;
    sum = y * 365 + ((y-1)/4) - ((y-1)/100) + ((y-1)/400);
    if(y % 4 == 0 &&(y % 400 == 0 || y % 100 != 0)){
        for(int i = 1; i <= m-1; i++)sum += Lcalendar[i];
    }

    else{
        for(int i = 1; i <= m-1; i++) sum += Ncalendar[i];
    }
    sum += d;
    return sum;
}
int main(){
	int y1,m1,d1,y2,m2,d2;

	while(true){
		scanf("%d%d%d%d%d%d",&y1,&m1,&d1,&y2,&m2,&d2);
		if(y1 == m1 && d1 == y2 && m2 == d2 && m2 == -1)break;
		printf("%d\n",GetTotalDays(y2,m2,d2)-GetTotalDays(y1,m1,d1));
	}

	return 0;
}

Measured memory_bytes: 1188
package main

import (
	"fmt"
	"strings"
)

func main() {
	var n, k int
	fmt.Scan(&n, &k)

	var s string
	fmt.Scan(&s)

	ss := strings.Split(s, "")
	for i, s := range ss {
		if i != k-1 {
			fmt.Print(s)
			continue
		}
		if s == "A" {
			fmt.Print("a")
			continue
		} else if s == "B" {
			fmt.Print("b")
			continue
		} else {
			fmt.Print("c")
			continue
		}
	}
}


Measured memory_bytes: 640
#include<iostream>
using namespace std;
int main()
{
  string s;
  cin>>s;
  int len=s.length();
  char c=s[len-1];
  if(c=='3')cout<<"bon"<<endl;
  else if(c=='0'||c=='1'||c=='6'||c=='8')cout<<"pon"<<endl;
  else cout<<"hon"<<endl;
}

Measured memory_bytes: 3588
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
constexpr Int mod = 1e9 + 7;
template <class T> T modpow(T a, T b) {
    if (b == 0) return T(1);
    if (b % 2 == 0) {
        long long d = modpow(a, b / T(2));
        return (d * d) % mod;
    } else {
        return (a * modpow(a, b - 1) % mod );
    }
}
template<class T> T mod_nCr(T n, T r, T mod ) {
    T denom = 1;
    T numer = 1;
    for (T i = 1; i <= r; i++) numer = (numer * i) % mod;
    for (T i = n - r + 1; i <= n; i++) denom = (denom * i) % mod;
    return (denom * modpow(numer, mod - 2) % mod);
}
class modcomb {
public:
    int maxn,MOD;
    vector<Int>fac,finv,inv;
    modcomb(Int _maxn,Int _mod) : maxn(_maxn),MOD(_mod),fac(_maxn),finv(_maxn),inv(_maxn){
        fac[0] = fac[1] = 1;
        finv[0] = finv[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < maxn; i++){
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
    };
    Int modComb(int n,int k){
        if (n < k) return 0LL;
        if (n < 0 || k < 0) return 0LL;
        return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
    }
    
};

void solve(){
    Int N,K; cin >> N >> K;
    vector<Int>A(N);
    for(auto& e : A) cin >> e;
    sort(A.begin(),A.end());
    Int ans = 0;
    auto C = modcomb(N + 1,mod);
    vector maxi(N,0LL), mini(N,0LL);
    for(int i = 0 ; i < N; ++i){
        if(i  >= K -1)maxi[i] = C.modComb(i,K - 1) *  A[i];
    }
    for(int j = N - 1; j >= 0; --j){
        if(N - j - 1 >= K - 1) mini[j] = C.modComb(N - j - 1,K - 1) * A[j];
    }
    for(int i = 0; i < N; ++i){
        ans += maxi[i] - mini[i];
        ans += mod;
        ans %= mod;
    }
    cout << ans << endl;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int Q = 1;
    while (Q--) { solve();}
}


Measured memory_bytes: 7904
import java.util.Scanner;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        
        for(;;){
            String x = sc.next();
            sc.nextLine();
            if(x.charAt(0) == '0') break;
            int n = 0;
            for(int i=0;i<x.length();i++){
                n += x.charAt(i);
                n -= 48;
            }
            System.out.println(n);
        }
    }
}


Measured memory_bytes: 26852
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    string s;
    cin >> s;
    int r = 0, b = 0;
    rep(i, s.size())
    {
        if (s[i] == '0')
            r++;
        else
            b++;
    }
    cout << 2 * min(r, b) << endl;
}

Measured memory_bytes: 512
import heapq
from sys import stdin
input = stdin.readline

#入力
# s = input()[0:-1]
# n = int(input())
m1,d1 = map(int, input().split())
m2,d2 = map(int, input().split())
# a = list(map(int,input().split()))
# a = [int(input()) for i in range()]


# ab=[]
# for i in range():
#     a,b = map(int, input().split())
#     ab.append([a,b])


     
def main():
    if m1 ==12:
        if m2 == 1 and d2 ==1 :
            print(1)
        else:
            print(0)
    else:
        if m2 ==m1+1 and d2 ==1:
            print(1)
        else:
            print(0)
        
    
    

if __name__ == '__main__':
    main()

Measured memory_bytes: 3060
inp_ls = input().split(" ")
n,k = [int(e) for e in inp_ls[:2]]

sunuke = [1 for _ in range(n)]
for i in range(k):
	d = int(input())
	a_ls = [int(e) for e in input().split(" ")[:d]]
	for a in a_ls:
		sunuke[a-1] = 0

print(sum(sunuke))

Measured memory_bytes: 9140
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
using namespace std;
#define INF 2000000007
#define LINF 100000000000000007
#define MOD 1000000007
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define repb(i, n) for (int i = n - 1; i >= 0; i--)
#define MODE 0
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long ll;
typedef pair<int,int> P;
struct edge{int to,cost;};
int ceil2(int a,int b){if(a%b){return a/b+1;}else{return a/b;}}
using namespace std;

int n,m,ans;
int r,b,g;
signed main(){
	char col[]={'R','G','B'};
	string s;
	cin>>n;
	cin>>s;
	for(int i=s.size()-1;i>=0;i--){
		if(s[i]=='R')r++;
		if(s[i]=='G')b++;
		if(s[i]=='B')g++;
	}
	ans+=r*b*g;
	for(int i=0;i<s.size();i++){
		for(int j=i+1;j<s.size()-1;j++){
			if(!(0<=j+j-i && j+j-i<s.size()))continue;
			if(s[i]!=s[j] && s[j]!=s[j+j-i] && s[i]!=s[j+j-i])ans--;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 3628
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace _0139
{
    public class Program
    {
        static Regex snakeA = new Regex(@"^>'=+#=+~$", RegexOptions.Compiled);
        static Regex snakeB = new Regex(@"^>\^(Q=)+~~$", RegexOptions.Compiled);

        public static void Main(string[] args)
        {
            int n = RInt();
            for (int i = 0 ; i < n ; i++) Console.WriteLine(Judge(RSt()));
        }

        private static string Judge(string snake)
        {
            if (snakeB.IsMatch(snake)) return "B";
            else if (snakeA.IsMatch(snake))
            {
                if (snake.Count(x => x == '=') % 2 != 0) return "NA";

                string[] splitSnake = snake.Split(new char[] { '>', '\'', '#', '~' });
                if (splitSnake[2].Length != splitSnake[3].Length) return "NA";
                else return "A";
            }
            else return "NA";
        }

        static string RSt() { return Console.ReadLine(); }
        static int RInt() { return int.Parse(Console.ReadLine().Trim()); }
        static long RLong() { return long.Parse(Console.ReadLine().Trim()); }
        static double RDouble() { return double.Parse(Console.ReadLine()); }
        static string[] RStAr(char sep = ' ') { return Console.ReadLine().Trim().Split(sep); }
        static int[] RIntAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => int.Parse(e)); }
        static long[] RLongAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => long.Parse(e)); }
        static double[] RDoubleAr(char sep = ' ') { return Array.ConvertAll(Console.ReadLine().Trim().Split(sep), e => double.Parse(e)); }
        static string WAr<T>(IEnumerable<T> array, string sep = " ") { return string.Join(sep, array.Select(x => x.ToString()).ToArray()); }
    }

}



Measured memory_bytes: 21376
#include <bits/stdc++.h>
using namespace std;
//型に気を付けよう
//a=0x61=97
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long  ll;
typedef long double  ld;
typedef pair<int,int> pairii;
typedef vector<int> veci;
const double pi=3.1415926535;
const ll  mod=1000000007;
#define aall a.begin()v.end()
//桁数指定　cout << fixed << setprecision(2)
int main() {
  int n;
  cin>>n;
  int t;
  veci ans(n+1);
  rep(i,n){
    cin>>t;
	ans[t]=i+1;
  }
  rep(j,n)cout<<ans[j+1]<<" ";
}


Measured memory_bytes: 1152
/*
  AtCoder Beginner Contest 095
  A - Something on It
*/

#include<iostream>
using namespace std;

char memo[4];

int main() {
  scanf("%s", memo);
  int sum = 700;
  for (int i = 0; i < 3; ++i) {
    if (memo[i] == 'o') sum += 100;
  }

  printf("%d\n", sum);
  return 0;
}

Measured memory_bytes: 764