akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define   sz(s)         s.size()
#define   ll            long long int
#define   ull           unsigned ll
#define   ld            long double
#define   print(v)      for(ll i=0;i<v.size();i++)cout<<v[i]<<" "
#define   printpair(v)  for(ll i=0;i<v.size();i++)cout<<v[i].first<<" "<<v[i].second<<"\n"
#define   bmd           1000000007
#define   bmd1          998244353
#define   umll          unordered_map<ll,ll>
#define   mll           map<ll,ll>
#define   mcl           map<char,ll>
#define   pll           pair<ll,ll>
#define   F             first
#define   S             second
#define   setp(x)       setprecision(x)
#define   pb            push_back
#define   all(v)        v.begin(),v.end()
#define   tr(a)         for(auto it=a.begin();it!=a.end();it++)
#define   trr(a)        for(auto it1=a.begin();it1!=a.end();it1++)
#define   vll           vector<long long int>
#define   sorty(v)      sort(v.begin(),v.end())
#define   rsort(v)      sort(v.rbegin(),v.rend())
#define   unik(v)       v.erase(unique(all(v)),v.end())
#define   PI            3.1415926535897932384626
#define   db()          cout<<"\n"<<"here"<<"\n"
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;


//---------------------------------------------------------------------------
const int MOD = bmd;
const int N=2e5+100;
inline  ll sqr(ll x){return x*x;}
inline  void normal(ll &a) { a = (a+MOD)%MOD; }
inline  ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline  ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline  ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline  ll modPow(ll b, ll p) { ll r = 1;b=b%MOD; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline  ll modInv(ll a) { return modPow(a, MOD-2); }
inline  ll modDiv(ll a,ll b) { return modMul(a, modInv(b)); }
//---------------------------------------------------------------------------
void solve()
{
    ll k;
    cin>>k;
    if(k%2==0 || k%5==0){
        cout << -1 <<"\n";
        return;
    }
    ll cur = 7;
    ll cnt = 0;
    while(cnt<k){
        cnt++;
        if(cur%k==0){
            cout << cnt <<"\n";
            return;
        }
        cur = (cur*10+7)%k;
    }
    cout << -1 <<"\n";
}

int main()
{
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);//first give all input then gives output
    ll t=1;
    //cin>>t;
    while(t--){
        solve();
    }

    return 0;
}


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

ll inf=1ll<<60,mod=1e9+7;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);
	int i;
	bool q=false;
	string a,b;
	cin>>a>>b;
	if (a.size()>b.size()){
		cout<<"GREATER";
		q=true;
	}
	else if (a.size()<b.size()){
		cout<<"LESS";
		q=true;
	}
	else {
		for (i=0;i<a.size();i++){
			if (a[i]>b[i]){
				cout<<"GREATER";
				q=true;
				break;
			}
			else if (a[i]<b[i]){
				cout<<"LESS";
				q=true;
				break;
			}
		}
	}
	if (q==false){
		cout<<"EQUAL";
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
const int N = 1010;
const int mod = 1e9+7;
char a[N][N];
int dp[N][N],n,m;

int main(){
	scanf("%d%d",&n,&m);
    for(int i = 0; i < n; ++i)scanf("%s",a[i]);
    for(int i = 1; i < m && a[0][i] == '.'; ++i)dp[0][i] = 1;
    for(int i = 1; i < n && a[i][0] == '.'; ++i)dp[i][0] = 1;
    for(int i = 1; i < n; ++i){
    	for(int j = 1; j < m; ++j){
        	if(a[i][j] == '.')dp[i][j] = (dp[i-1][j]+dp[i][j-1])%mod;
        }
    }
    printf("%d",dp[n-1][m-1]);
return 0;
}

Measured memory_bytes: 5248
#include <bits/stdc++.h>
typedef long long LL;

using namespace std;

int main() {
	LL a, b; cin >> a >> b;
	
    LL ans;
  	if(a % 2 == 0){
      if(b % 2 == 0){
        ans = (b - a) / 2 % 2 ^ b;
      }else{
        ans = (b - a + 1) / 2 % 2;
      }
    }else{
	  if(b % 2 == 0){
        ans = (b - a - 1) / 2 % 2 ^ b ^ a;
      }else{
        ans = (b - a) / 2 % 2 ^ a;
      }
    }

	cout << ans;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
long long n,a,b[1000000];
int main(){
    cin>>n;
    for(int i=1;i<=n-1;i++){
        cin>>a;
        b[a]++;
    }
    for(int i=1;i<=n;i++){
        cout<<b[i]<<"\n";
    }
}


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

int main() {
  int N, M;
  cin >> N >> M;

  vector<vector<int>> x(M);
  rep(i, N) {
    int A, B;
    cin >> A >> B;

    if (A > M) continue;
    x.at(M - A).push_back(B);
  }

  priority_queue<int> q;
  ll ans = 0;
  for (int i = M - 1; i >= 0; i--) {
    for (int b : x.at(i)) {
      q.push(b);
    }
    if (!q.empty()) {
      ans += q.top();
      q.pop();
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5504
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int N;
    cin >> N;
    int L[N];
    for(int i=0;i<N;i++){
        cin >> L[i];
    }
    sort(L,L+N);
    int ans = 0;
    for(int i=0;i+2<N;i++){
        for(int j=i+1;j+1<N;j++){
            for(int k=j+1;k<N;k++){
                if(L[i] < L[j] && L[j] < L[k] && L[i] + L[j] > L[k]){
                    ans++;
                }
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define max 1000000000
using namespace std;
typedef long long ll;
int main()
{
	int n;
	ll k;
	cin>>n>>k;
	vector<int>arr(n+1);
	for(int i=1; i<=n; i++)
	 cin>>arr[i];
	map<int,int>rel;
	int s=1;
	vector<int>pos;
	int cnt=0;
	while(rel.count(s)==0)
	{
		rel[s]=cnt;
		pos.push_back(s);
		cnt++;
		s=arr[s];
	}
	int step1=rel[s];
//	cout<<"step1 : "<<step1<<"\n";
	int cycle=cnt-rel[s];
//	cout<<"cycle : "<<cycle<<"\n";
	if(k<=step1)
	 cout<<pos[k];
	else
	{
		k-=step1;
		int var=k%cycle;
		cout<<pos[step1+var];
	}
	return 0;
	
}

Measured memory_bytes: 13756
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")

using namespace std;
#include <atcoder/all>
using namespace atcoder;

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
#define fs first
#define sc second
template<typename T> vector<T> make_vec(size_t n, T a) { return vector<T>(n, a); }
template<typename... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec(ts...))>(n, make_vec(ts...)); }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << ' '; return os; }
// 多倍長
#include <boost/rational.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using boost::rational;
using boost::multiprecision::cpp_int;

const double PI = acos(-1);
const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

 

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;




int op(int a, int b){ return max(a, b);}
int e() { return 0; }

const int MAX_A = 300005;

int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    int n,k;
    cin >> n >> k;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    segtree<int, op, e> dp(MAX_A);
    rep(i, n){
        int x = a[i];
        int l = x - k, r = x + k + 1;
        chmax(l, 0);
        chmin(r, MAX_A);
        int now = dp.prod(l, r) + 1;
        //dp.set(x, now);で実はOK
        dp.set(x, max(dp.get(x), now));
    }
    int ans = dp.prod(0, MAX_A);
    print(ans);
    return 0;
}


Measured memory_bytes: 9816
#include<bits/stdc++.h>
using namespace std;
const long long Inf=1e18;

int gi() {
	int x=0,o=1;char ch=getchar();
	while((ch<'0'||ch>'9')&&ch!='-') ch=getchar();
	if(ch=='-') o=-1,ch=getchar();
	while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar();
	return x*o;
}

int main() {
	int n=gi(),a=gi(),b=gi();
	vector<int> p(n+1);
	for(int i=1;i<=n;i++) p[i]=gi();
	vector<int> q(n+1);
	for(int i=1;i<=n;i++) q[p[i]]=i;
	vector<long long> f(1,0);
	for(int i=1;i<=n;i++) {
		vector<long long> new_f(i+1,Inf);
		for(int j=0;j<i;j++) {
			if(q[i]>q[j]) {
				new_f[i]=min(new_f[i],f[j]);
				new_f[j]=min(new_f[j],f[j]+b);
			}
			else {
				new_f[j]=min(new_f[j],f[j]+a);
			}
		}
		swap(f,new_f);
	}
	printf("%lld\n",*min_element(f.begin(),f.end()));
	return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<map>
#include<algorithm>
#include<vector>
using namespace std;
#define N 100010
map<int,int> odd;
map<int,int> even;
struct node
{
    int num;
    int per;
    node(int i1,int i2)
    {
        num=i1;
        per=i2;
    }
};
vector<node> Vo;
vector<node> Ve;
bool cmp(node &n1,node &n2)
{
    return n1.per>n2.per;
}
int n;
int v[N];
int main()
{   
    ios::sync_with_stdio(false);
    while(cin>>n)
    {
        odd.clear();
        even.clear();
        Vo.clear();
        Ve.clear();
        for(int i=1;i<=n;i++) 
        {
            cin>>v[i];
            if(i%2==0) even[v[i]]++;
            else odd[v[i]]++;
        }
        map<int,int>::iterator it;
        for(it=odd.begin();it!=odd.end();it++)
        {
            Vo.push_back(node(it->first,it->second));
        }
        for(it=even.begin();it!=even.end();it++)
        {
            Ve.push_back(node(it->first,it->second));
        }
        Ve.push_back(node(1e6,0));//处理4:1 1 1 1 在各组最后添加一个溢出位
        Vo.push_back(node(1e6,0));
        sort(Vo.begin(),Vo.end(),cmp);
        sort(Ve.begin(),Ve.end(),cmp);
        //cout<<"odd:"<<Vo[0].num<<" "<<Vo[0].per<<endl;
        //cout<<"even:"<<Ve[0].num<<" "<<Ve[0].per<<endl;
        if(Vo[0].num==Ve[0].num)
        {
            cout<<n-max(Vo[1].per+Ve[0].per,Vo[0].per+Ve[1].per);
        }
        else cout<<n-Ve[0].per-Vo[0].per<<endl;
    }
}

Measured memory_bytes: 6524
#include <bits/stdc++.h>
#define print(...) {for(auto x: __VA_ARGS__) cout<<x<<" ";}
#define debug(...) {cout<<#__VA_ARGS__": ";print(__VA_ARGS__);cout<<endl;}
using namespace std;

struct UnionFind {
    vector<int> parent;
    vector<int> rank;

    void init(int n) {
        parent = vector<int>(n);
        rank = vector<int>(n);
        
        for(int i = 0; i < n; i++) {
            parent[i] = i;
            rank[i] = 0;
        }
    }

    int find(int x) {
        if(parent[x] == x)
            return x;
        else
            return parent[x] = find(parent[x]);
    }

    void unite(int x, int y) {
        int px = find(x);
        int py = find(y);

        if(px == py)
            return;

        if(rank[px] == rank[py]) {
            parent[py] = px;
            rank[px]++;
        }
        else if(rank[px] < rank[py])
            parent[px] = py;
        else
            parent[py] = px;
    }

    bool same(int x, int y) {
        return find(x) == find(y);
    }
};

int n, m;

int main() {
    cin >> n >> m;
    UnionFind uf;
    uf.init(n);
    for(int i = 0; i < m; i++) {
        int x, y, z;
        cin >> x >> y >> z;
        x--; y--;
        uf.unite(x, y);
    }

    set<int> s;
    for(int i = 0; i < n; i++) {
        s.insert(uf.find(i));
    }
    cout << s.size() << endl;
}


Measured memory_bytes: 5760
/*****************************************************************************************
******************************AUTHOR:***************************************************
****************************ASHISH RANJAN***********************************************
*****************************************************************************************/
#include<iostream>
#include<algorithm>
#include<cmath>
#include<chrono>
#include<vector>
#include<string>
using namespace std;
using namespace std::chrono;
/*
auto start = high_resolution_clock::now();
auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start); 
  
    cout << "Time taken by function: "
         << duration.count() << " microseconds" << endl;
*/
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ll long long
#define mod 1000000007
#define fr(i,n) for(int i=0;i<(int)n;i++)
int main(){
  fast();
  int N;
  cin>>N;
  cout<<(N*(N+1))/2;
 return 0;
  
}


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

// #include "../../template-proj/myMente.h"

using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;

#define MOD 1000000007
#define rp(i,n) for(int i=0;i<(n);i++)
#define up(i,s,e,d) for(int i=(s);i<(e);i+=(d))
#define ot(x) cout<<(x)
#define ote(x) cout<<(x)<<endl

int main(){
	int N,M;
	cin>>N>>M;

	// vector<ll> L(M), R(M);
	// rp(i,M) cin>>L[i]>>R[i];

	// sort(L.begin(), L.end());
	// sort(R.begin(), R.end());

	// ll ans = R[0] - L[M-1];
	// // cout<<ans<<","<<R[0]<<","<<L[M-1]<<"\n";//
	// ans = max((ll)0, ans);
	// ote(ans + 1);

	vi L(M), R(M);
	int mini = 1000000;
	int maxi = 0;
	up(i,0,M,1){
		int l,r; cin>>l>>r;
		mini = min(mini, r);
		maxi = max(maxi, l);
	}
	// cout<<mini<<","<<maxi<<"\n";//
	ll ans = mini - maxi;
	if(ans<0) ote(0);
	else ote(ans + 1);
}

Measured memory_bytes: 1024
N,M = [int(a) for a in input().split()]


#iから進める場所をリストにして保管
edges = {i:[] for i in range(1,N+1)}
for i in range(M):
  a,b = [int(a) for a in input().split()]
  edges[a].append(b)
  edges[b].append(a)


#深さ優先探索
def dfs(list):
    #lst(通過点)の数がN(頂点数)と等しくなったら探索終了（成功）
  if len(list) == N:
    return 1
  else:
    a = list[-1]
    #lstの最後尾（現在地）が次に進める場所をnextとしてリスト化
    #nextに以前通った場所が入っていないか確認
    next = [n for n in edges[a] if n not in list]
    #次に進める場所がなくなったら探索終了（失敗）
    if len(next) == 0:
      return 0

    total = 0
    #再帰でさらに探索
    for n in next:
      total += dfs(list + [n])

    return total


ans = dfs([1])

print(ans)


Measured memory_bytes: 9208
import java.util.Scanner
import scala.util.control.Breaks

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)

    val N, K = sc.nextInt
    var h = Array.ofDim[Int](N)
    (0 until N).foreach(i => {
      h(i) = sc.nextInt
    })

    h = h.sorted
    var ans = Int.MaxValue
    (0 until N-K+1).foreach(i => {
      ans = Math.min(ans, h(i+K-1) - h(i))
    })

    println(ans)
  }
}

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



int main(){
	//freopen("output.txt","r",stdin);

	int t;
	cin>>t;
	long int sum = 0;
	for(int i=1;i<=t;i++){
		for(int j=1;j<=t;j++){
			for(int k=1;k<=t;k++){
				int temp = __gcd(k,j);
				sum += __gcd(temp,i);
			}
		}
	}

	cout<<sum<<endl;
}

Measured memory_bytes: 3620
#include <iostream>

using namespace std;

const int MAX = 500000;
const int SENTINEL = 2000000000;

int L[MAX / 2 + 2], R[MAX / 2 + 2];
int cnt;

void merge(int A[], int n, int left, int mid, int right) {
    int n1 = mid- left;
    int n2 = right - mid;

    for (int i = 0; i < n1; i++) {
        L[i] = A[left + i];
    }        

    for (int i = 0; i < n2; i++) {
        R[i] = A[mid + i];
    }

    L[n1] = R[n2] = SENTINEL;
    int i = 0, j = 0;

    for (int k = left; k < right; k++) {
        cnt++;
        if (L[i] <= R[j]) {
            A[k] = L[i++];
        }
        else {
            A[k] = R[j++];
        }
    }
}

void mergeSort(int A[], int n, int left, int right) {
    if (left + 1 < right) {
        int mid = (left + right) / 2;
        mergeSort(A, n, left, mid);
        mergeSort(A, n, mid, right);
        merge(A, n, left, mid, right);
    }
}

int main() {
    int A[MAX], n;
    cnt = 0;

    cin >> n;

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

    mergeSort(A, n, 0, n);

    for (int i = 0; i < n; i++) {
        if (i) {
            cout << " ";
        }
        cout << A[i];
    }
    
    cout << endl;

    cout << cnt << endl;
}

Measured memory_bytes: 6888
n=int(input())
h=list(map(float,input().split()))
dp=[[0 for j in range(i+3)] for i in range(n)]

dp[0][0]=1-h[0]
dp[0][1]=h[0]
for i in range(1,n):
	for j in range(i+2):
		dp[i][j]=dp[i-1][j-1]*h[i]+dp[i-1][j]*(1-h[i])
sum=0
for i in range(n//2+1,n+1):
	sum=sum+dp[n-1][i]
print(sum)

Measured memory_bytes: 144312
n = int(input())
a = list(map(int,input().split()))
odd = []
even = []
o = 0
e = 1
while o < n:
  odd.append(str(a[o]))
  o += 2
while e < n:
  even.append(str(a[e]))
  e += 2
if n%2 == 0:
  ans = even[::-1]+odd
else:
  ans = odd[::-1]+even
print(' '.join(ans))

Measured memory_bytes: 33940
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
ll n,a[21][21],f[2100000],h[2100000];
int main()
{
    scanf("%lld",&n);ll mx=1<<n;
    for(int i=1;i<=n;i++)
    for(int j=1;j<=n;j++)
    scanf("%lld",&a[i][j]);
    for(int i=0;i<mx;i++)
    for(int j=1,tmp1=1;j<=n;j++,tmp1<<=1)
    if(i&tmp1)
    for(int k=j,tmp2=tmp1;k<=n;k++,tmp2<<=1)
    if(i&tmp2) h[i]+=a[j][k];
    for(int i=0;i<mx;i++) f[i]=h[i];
    for(int i=0;i<mx;i++)
    for(int j=i&(i-1);j;j=i&(j-1)) f[i]=max(f[i],f[i^j]+h[j]);
    printf("%lld",f[mx-1]);
    return 0;
}

Measured memory_bytes: 2688
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt();
            if (N % 1000 == 0)
                WriteLine(0);
            else
                WriteLine(1000 - N % 1000);
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 27464
N = int(input())
d = {}
a = []
for _ in range(N):
    A = int(input())
    a.append(A)
    if not(A in d):
        d[A] = 1
        continue
    elif d[A]==1:
        d[A] = 0
    else:
        d[A] = 1

ans = 0
for key in d:
    if d[key]==1:
        ans = ans + 1
print(ans)


Measured memory_bytes: 15628
#include<bits/stdc++.h>
using namespace std;
#define maxn 200010
#define LL long long
#define pb push_back
#define mp make_pair
#define fi first
#define se second
typedef pair<int,LL> pii;
const int inf=0x3f3f3f3f;
const int mod=1e9+7;
const int tot=1<<15;

int n;
LL d,c,a[maxn],ans;
LL cnt;
vector<LL> t;

int main(){
	//freopen("test.txt","r",stdin);
	t.pb(0);
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%lld%lld",&d,&c);
		
		while(c>=2){
			if(c%2) c--,++cnt,t.pb(d);
			if(d+d>=10){
				ans+=c;
				d=2*d;
				d=d%10+d/10;
				c>>=1;
			}else{
				d=2*d;
				c>>=1;
				ans+=c;
			}
		}
		++cnt;
		t.pb(d);
	}
	for(int i=1;i<cnt;i++){
		ans++;
		t[i+1]+=t[i];
		if(t[i+1]>=10){
			ans++;
			t[i+1]=t[i+1]/10+t[i+1]%10;
		}
	}
	cout<<ans<<endl;

	
	return 0;
} 

Measured memory_bytes: 34788
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String s = scan.next();
		String t = scan.next();
		int count = 0;
		
		for(int i=0;i<s.length();i++) {
			if(s.charAt(i) == t.charAt(i)) {
				continue;
			}else {
				count++;
			}
		}
		System.out.println(count);

	}

}


Measured memory_bytes: 41076
#include<iostream>
using namespace std;
int main(int argc, char *argv[])
{
  for(;;) {
    int x, y, s;
    cin >> x >> y >> s;
    if(x == 0 && y == 0 && s == 0) break;
    int mx = 0;
    for(int t = 1; t < s; t++) {
      for(int u = 1; u < s; u++) {
        int uu = u * (100+x) / 100;
        int tt = t * (100+x) / 100;
        if(uu + tt == s) {
          int uuu = u * (100+y) / 100;
          int ttt = t * (100+y) / 100;
          if(mx < uuu+ttt) mx = uuu + ttt;
        }
      }
    }
    cout << mx << endl;
  }
  return 0;
}

Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int m[100000][40];

int main(){
    string s,t;
    cin>>s>>t;
    int p[40];
    memset(m,-1,sizeof(m));
    memset(p,-1,sizeof(p));
    for(int i=s.size()-1;i>=0;i--){
        p[s[i]-'a']=i;
    }
    for(int i=s.size()-1;i>=0;i--){
        for(int j='a';j<='z';j++){
            m[i][j-'a']=p[j-'a'];
        }
        p[s[i]-'a']=i;
    }
    int prev=s.size()-1;
    ll ans=0;
    for(int i=0;i<t.size();i++){
        int n=m[prev][t[i]-'a'];
        if(n==-1){
            cout<<-1<<endl;
            return 0;
        }
        else if(n<=prev){
            ans+=s.size()-prev+n;
            prev=n;
        }
        else{
            ans+=n-prev;
            prev=n;
        }
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 16256
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
using namespace std;
int main(){
  vector<vector<int> > g(100010);
  int j,n,m,h[100010],a,b,i;
  scanf("%d %d\n",&n,&m);
  for(i=0;i<n;i++){
    scanf("%d ",&h[i]);
  }
  for(i=0;i<m;i++){
    scanf("%d %d\n",&a,&b);
    a--,b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  int ans=0;
  for(i=0;i<n;i++){
    ans++;
    if(g[i].size()==0){
      continue;
    }
    for(j=0;j<g[i].size();j++){
      if(h[i]<=h[g[i][j]]){
        ans--;
        break;
      }
    }
  }
  printf("%d\n",ans);
  return 0;
}

Measured memory_bytes: 8716
<?php
fscanf(STDIN, "%d", $num);

function keta($a, $b)
{
    return max(strlen($a), strlen($b));
}

$tmp;
$min;
$count = 0;
$b;
for($i = 1; $i * $i <= $num; $i++) {
    if($num % $i === 0) {
        $b = $num / $i;
        $tmp = keta($i, $b);
        if($min > $tmp || $count === 0) {
            $min = $tmp;
            $count++;
        }
    }
}

echo $min. "\n";


Measured memory_bytes: 3576
#include <iostream>
#include <cmath>

using namespace std;

int main() {
	int N, X;

	cin >> N >> X;

	int rem = X, minimum = 100000, ans = 0;
	for (int i = 0; i < N; i++) {
		int tmp;
		cin >> tmp;
		rem -= tmp;
		ans++;
		minimum = min(minimum, tmp);
	}

	ans += rem / minimum;

	cout << ans << 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++)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
typedef long double ld;

const int INF = 1e9;
const ld EPS = 1e-8;

int main(){
  int N, M;
  cin >> N >> M;
  vector<ll> x(N), y(N), z(N);
  REP(i,N) cin >> x[i] >> y[i] >> z[i];

  ll ret = -1;
  REP(k,8) {
    vector<pair<ll, int>> tmp(N);
    vector<int> sgn(3);
    REP(i,3) sgn[i] = 2 * ((k >> i) & 1) - 1;
    REP(i,N) tmp[i] = make_pair(x[i] * sgn[0] + y[i] * sgn[1] + z[i] * sgn[2], i);
    sort(tmp.rbegin(), tmp.rend());
    ll sx = 0, sy = 0, sz = 0;
    REP(i,M) {
      sx += x[tmp[i].second];
      sy += y[tmp[i].second];
      sz += z[tmp[i].second];
    }
    ret = max(ret, abs(sx) + abs(sy) + abs(sz));
  }

  cout << ret << endl;
  return 0;
}



Measured memory_bytes: 256
/*
	Created by Faisal Ahmed
*/

#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
typedef long double ld;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(NULL);
	
	int n, m;
	
	cin >> n >> m;
	
	char a = n + '0', b = m + '0';
	
	string s1 = "", s2 = "";
	for(int i = 0; i < n; i++){
		s1 += b;
	}
	for(int i = 0; i < m; i++){
		s2 += a;
	}
	
//	cout << s1 << " " << s2 << endl;
	
	if(s1 <= s2){
		cout << s1 << endl;
	}
	else{
		cout << s2 << endl;
	}
	
	return 0;
} 

Measured memory_bytes: 256
#include <cstdio>
#include <string>
#include <iostream>

using namespace std;

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

    // char *colors_char;
    // scanf("%s", colors_char);

    string colors;

    cin >> colors;

    char cur_color = ' ';
    char prev_color = ' ';

    int out = n;

    for (int i = 0; i < n; i++) {
        cur_color = colors[i];

        if (cur_color == prev_color) {
            out--;
        }

        prev_color = cur_color;
    }

    printf("%d", out);
}


Measured memory_bytes: 512
/***************************************************************
	File name: B.cpp
	Author: ljfcnyali
	Create time: 2019年10月27日 星期日 19时54分33秒
***************************************************************/
#include<bits/stdc++.h>

using namespace std;

#define REP(i, a, b) for ( int i = (a), _end_ = (b); i <= _end_; ++ i ) 
#define mem(a) memset ( (a), 0, sizeof ( a ) ) 
#define str(a) strlen ( a ) 
#define pii pair<int, int>
typedef long long LL;

int main()
{
    int n; scanf("%d", &n);
    REP(i, 1, 9) REP(j, 1, 9) if ( i * j == n ) { printf("Yes\n"); return 0; }
    printf("No\n");
    return 0;
}


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

int main() {
  int n,x = 0;
  long long count = 0;
  string a;
  cin >> n;
  vector<string> s(n);
  for(int i = 0; i < n; i++){
    cin >> s.at(i);
    sort(s.at(i).begin(),s.at(i).end());
  }
  sort(s.begin(),s.end());
  a = s.at(0);
  for(int i = 1; i < n; i++){
    if(a == s.at(i)){
      x++;
      count += x;
    }else{
      x = 0;
      a = s.at(i);
    }
  }
  cout << count << endl;
}


Measured memory_bytes: 7296
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int K = Integer.parseInt(sc.next());
        int X = Integer.parseInt(sc.next());

        List<Integer> l = new ArrayList<>();
        l.add(X);
        for (int i = 1; i < K; i++) {
            int before = X - i;
            int after = X + i;
            l.add(before);
            l.add(after);
        }

        l.sort(Comparator.naturalOrder());
        for (int i = 0; i < l.size(); i++) {
            if (i <= l.size()) {
                System.out.print(l.get(i) + " ");
            } else {
                System.out.println(l.get(i));
            }
        }
    }
}


Measured memory_bytes: 21716
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
    long long int n, p, q, r, i, j, min;
    scanf("%lld %lld %lld", &p, &q, &r);
    min = p+q;
    if(q+r<min) min = q+r;
    if(r+p<min) min = r+p;
    printf("%lld", min);
    
}

Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int main(){
  while(1){
    int n,a=0,b=0,kai=0;
    string asi;
    cin>>n;
    if(n==0)break;
    for(int i=0;i<n;i++){
      cin>>asi;
      if(asi[0]=='r'){
        if(asi[1]=='u')a++;
        else a--;
      }
      if(asi[0]=='l'){
        if(asi[1]=='u')b++;
        else b--;
      }
      if(kai%2==0&&a+b==2)kai++;
      if(kai%2==1&&a+b==0)kai++;
    }
    printf("%d\n",kai);
  }
  return 0;
}

Measured memory_bytes: 3164
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; }
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
#define MOD 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;

const int SIZE = 100010;
ll inv[SIZE], fac[SIZE], finv[SIZE];
void make() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < SIZE; i++) {
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		fac[i] = fac[i - 1] * (ll)i%MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

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

	make();

	int N;
	cin >> N;
	VI A(N);
	REP(i, N) cin >> A[i];

	int ans = 1;
	int i = 0, j = 1;
	int cnt = 1, cntt = 0;

	while (i < N) {
		if (A[i] >= j) {
			A[i] = j;
			j += 2;
			cnt++;
		}
		else {
			cntt++;
			ans *= cnt;
			//cnt = 0;
		}
		i++;
		ans %= mod;
	}
	
	//cout << cntt << endl;
	ans *= fac[N - cntt];
	ans %= mod;
	cout << ans << endl;
	
	return 0;
}



Measured memory_bytes: 3456
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


# globals
inf = float('inf')
N, K = 0, 0
S = ""
M = 300000


def set_inputs():
    global N, K, S
    N, K = get_li()
    S = get_str()
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    # ----------MAIN----------
    cont = []
    cur = S[0]
    count = 1
    for s in S[1:]:
        if cur == s:
            count += 1
        else:
            cont.append(count)
            cur = s
            count = 1
    cont.append(count)
    
    lc = len(cont)
    if lc == 1:
        print(len(S))
        return
    cont = cont + ([0] * M)
    if S[0] == "0":
        cont = [0] + cont
    ans = 0
    tmp = sum(cont[:2*K+1])
    ans = tmp
    i = 2
    while i < lc + 1:
        tmp = tmp - cont[i-2] - cont[i-1] + cont[i+2*K-1] + cont[i+2*K]
        ans = max(ans, tmp)
        i += 2
    print(ans)
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    main()


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

int main(){
	int n;
	cin >> n;
	if(n%1000 == 0){
		cout << 0 << endl;
		return 0;
	}
	cout << 1000-(n%1000) << endl;
}


Measured memory_bytes: 3632
raw1 = gets.split(" ").map{|nn|nn.to_i}
n = raw1[0]
m = raw1[1]
c = raw1[2]
b = gets.split(" ").map{|nn|nn.to_i}

ass = []
n.times do
  ass << gets.split(" ").map{|nn|nn.to_i}
end

ans = 0
addition = 0
ass.each do|elem|
  addition = 0
  m.times do|idx|
    addition += elem[idx] * b[idx]
  end
  addition += c
  if addition > 0
    ans += 1
  end
end

puts ans.to_s()

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> A(N + 1);
  for (int i = 0; i <= N; i++){
    cin >> A[i];
  }
  vector<int> B(N);
  for (int i = 0; i < N; i++){
    cin >> B[i];
  }
  long long ans = 0;
  for (int i = 0; i < N; i++){
    if (A[i] >= B[i]){
      ans += B[i];
      A[i] -= B[i];
    } else if (A[i] < B[i]){
      ans += A[i];
      B[i] -= A[i];
      A[i] = 0;
      if (A[i + 1] >= B[i]){
        ans += B[i];
        A[i + 1] -= B[i];
      } else {
        ans += A[i + 1];
        A[i + 1] = 0;
      }
    }
  }
  cout << ans << endl;
}

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

int main() {
	int a[3], b[3];
	int city[4] = { 0, 0, 0, 0 };
	cin >> a[0] >> b[0] >> a[1] >> b[1] >> a[2] >> b[2];

	for (int n : a) {
		city[n - 1]++;
	}
	for (int n : b) {
		city[n - 1]++;
	}

	int count2 = 0;
	int count1 = 0;
	for (int c : city) {
		if (c == 2) count2++;
		else if (c == 1) count1++;
	}

	if (count2 == 2 && count1 == 2) cout << "YES";
	else cout << "NO";


	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e6+10;
int main()
{
 ll a,b,c;
    cin>>a>>b>>c;
    ll ans=c;
    for(int i=1;i<=10;i++)
    {
        ans=a*ans-b;
        cout<<ans<<endl;
    }


    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
X = int(input())

ans = ""
for i in range(10 ** 4):
    for j in range(-70, i, 1):
        if i ** 5 - j ** 5 == X:
            ans = "{} {}".format(i, j)
            break
    if ans != "":
        break

if ans != "":
    print(ans)
else:
    print(aaa)

Measured memory_bytes: 9132
use std::fmt::Write;
use std::slice;

fn main() {
    let _n: usize = read();
    let mut vec: Vec<u32> = read_as_vec();
    let cnt = merge_sort(&mut vec);
    println!("{}", join(' ', &vec));
    println!("{}", cnt);
}

fn merge_sort(slice: &mut [u32]) -> u64 {
    let mut cnt = 0u64;
    if slice.len() > 1 {
        let m = (0 + slice.len()) / 2;
        let (s0, s1, s2) = split_at_mut(slice, m);
        cnt += merge_sort(s1);
        cnt += merge_sort(s2);
        // merge
        let mut tmp = vec![0; m];
        tmp.copy_from_slice(s1);
        let mut iter1 = tmp.iter();
        let mut iter2 = s2.iter();
        let mut o1 = iter1.next();
        let mut o2 = iter2.next();
        let mut idx = 0;
        loop {
            if o1 != None && o2 != None {
                cnt += 1;
                let e1: u32 = *o1.unwrap();
                let e2: u32 = *o2.unwrap();
                if e1 <= e2 {
                    s0[idx] = e1;
                    o1 = iter1.next();
                } else {
                    s0[idx] = e2;
                    o2 = iter2.next();
                }
            } else if o1 != None {
                cnt += 1;
                s0[idx] = *o1.unwrap();
                o1 = iter1.next();
            } else if o2 != None { // この分岐は本当はいらない。
                o2 = iter2.next();
                cnt += 1;
            } else {
                break;
            }
            idx += 1;
        }
    }
    cnt
}

fn split_at_mut(slice: &mut [u32], mid: usize) -> (&mut [u32], &mut [u32], &mut [u32]) {
    let n = slice.len();
    let ptr: *mut u32 = slice.as_mut_ptr();
    assert!(mid <= n);
    unsafe {
        let s0: &mut [u32] = slice::from_raw_parts_mut(ptr, n);
        let s1: &mut [u32] = slice::from_raw_parts_mut(ptr, mid);
        let s2: &mut [u32] = slice::from_raw_parts_mut(ptr.offset(mid as isize), n - mid);
        (s0, s1, s2)
    }
}

fn join<T: std::fmt::Display>(delimiter: char, es: &Vec<T>) -> String {
    let mut output = String::new();
    for (i, e) in es.iter().enumerate() {
        if i != 0 {
            output.push(delimiter);
        }
        write!(output, "{}", e).unwrap();
    }
    output
}

fn read<T: std::str::FromStr>() -> T {
    let mut input = String::new();
    std::io::stdin().read_line(&mut input).unwrap();
    input.trim().parse::<T>().ok().unwrap()
}

fn read_as_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| { e.trim().parse::<T>().ok().unwrap() })
        .collect()
}


Measured memory_bytes: 16272
import collections

l=[]
n=int(input())
for x in range(1,10**2+1):
    if x**2>n:continue
    for y in range(1,10**2+1):
        if x**2+y**2>n:continue
        for z in range(1,10**2+1):
            if x**2+y**2+z**2>n:continue
            l.append(x**2+y**2+z**2+x*y+y*z+z*x)

c=collections.Counter(l)
for x in range(1,n+1):
    print(c[x])

Measured memory_bytes: 30204
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF 1e9
#define PIE 3.14159265358979323

template <class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
#define int long long

signed main() {
    int n;
    cin >> n;
    string ans = "";
    while (n) {
        n--;
        ans += (char)('a' + (n % 26));
        n /= 26;
    }
    reverse(ans.begin(), ans.end());
    cout << ans << endl;
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int d, n;
    cin >> d >> n;
    if (d == 0) {
        if (n == 100)
            cout << n + 1 << endl;
        else
            cout << n << endl;
    } else if (d == 1) {
        if (n == 100)
            cout << (n+1)*100 << endl;
        else
            cout << n*100 << endl;
    } else if (d == 2) {
        if (n == 100)
            cout << (n+1) * 10000 << endl;
        else
            cout << n*10000 << endl;
    }
    
    
    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int x,y;
  cin >> x >> y;
  vector<string> vec(x);
  for (int i = 0; i < x; i++){
    cin >> vec[i];
  }
  
  for (int i = 0; i < y+2; i++){
    cout << "#";
  }
  cout << endl;
  
  for (int i = 0; i < x; i++){
    cout << "#" << vec[i] << "#" << endl;
  }
  
  for (int i = 0; i < y+2; i++){
    cout << "#";
  }
  cout << endl;
}


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

int main(){
    int n;
    cin>>n;
    vector<pair<int,int>> a(n);
    for (int i = 0; i < n; ++i) {
        int b;
        cin>>b;
        a[i]=make_pair(b,i+1);
    }
    sort(a.begin(),a.end());
    for (int j = 0; j < n; ++j) {
        cout<<a[j].second;
        if(j==n-1)cout<<endl;
        else cout<<" ";
    }
    return 0;
}

Measured memory_bytes: 1664
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
 
using namespace std;
int N;

int main()
{
  int ret;
  int X;
  long sum=0;
  long sum2=0;
  long t1, t2;
  int P;

  cin >> N;

  for (int i=0; i<N; i++) {
    cin >> X;
    sum += X;
    sum2 += X*X;
  }
  P = sum/N;
  t1 = sum2 - 2*P*sum + N * P * P;
  t2 = sum2 - 2*(P+1)*sum + N * (P+1) * (P+1);
  printf("%ld\n", (t1<t2?t1:t2));
  return 0;
}

/*
  ��(Xi-P)^2 =
  ��Xi^2-2*XiP+P^2
  ��Xi^2-2P*��Xi+ N*P^2

  2NP-2��Xi = 0
  P = ��Xi/N
  */


Measured memory_bytes: 256
from collections import defaultdict
from operator import itemgetter
import sys
input = sys.stdin.readline

h, w, m = map(int, input().split())
bombs = [tuple(map(int, input().split())) for _ in range(m)]

x_cnt = defaultdict(int)
y_cnt = defaultdict(int)
for x, y in bombs:
    x_cnt[x] += 1
    y_cnt[y] += 1

x_cnt_max = max(x_cnt.values())
y_cnt_max = max(y_cnt.values())
cnt = cnt_x = cnt_y = 0
for x, y in bombs:
    if x_cnt[x] == x_cnt_max and y_cnt[y] == y_cnt_max:
        cnt += 1

cnt_x = sum(v == x_cnt_max for v in x_cnt.values())
cnt_y = sum(v == y_cnt_max for v in y_cnt.values())
if cnt_x * cnt_y == cnt:
    ans = x_cnt_max + y_cnt_max - 1
else:
    ans = x_cnt_max + y_cnt_max

# print(cnt_x, cnt_y, cnt)
print(ans)


Measured memory_bytes: 75432
#include <stdio.h>

int main(){
	int k,n;
	scanf("%d%d",&k,&n);
	int a[n+1];
	for(int i=0;i<n;++i){
		scanf("%d",&a[i]);
	}

	a[n] = k + a[0];

	int candidate = 0;
	for(int i = n; i > 0; i--){
		a[i] -= a[i-1];
		candidate = (a[i] > candidate) ? a[i] : candidate;
	}

	printf("%d",k - candidate);

	return(0);
}



Measured memory_bytes: 896
#include<bits/stdc++.h>
using namespace std;
int main(){
    string N;
    cin >> N;
    int n = N.length();
    long long int S[n+1];
    int i;
    for(i=0;i<n;i++)S[i+1]=N[i]-'0';
    S[0]=0;
    long long int dp[n+1][2];
    dp[0][0]=0;dp[0][1]=1;
    for(i=1;i<n+1;i++){
        dp[i][0]=min(dp[i-1][0]+S[i],dp[i-1][1]+10-S[i]);
        dp[i][1]=min(dp[i-1][0]+1+S[i],dp[i-1][1]+10-S[i]-1);
    }
    cout << dp[n][0] << endl;
}

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

public class Main {

	public static void main(String[] args) throws IOException {

		new Main().run();
	}

	private void run() throws IOException {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int[][] player = new int[n][3];
		int[][] num = new int[101][3];
		for (int i = 0; i < n; i++)
			for (int j = 0; j < 3; j++) {
				int a = scanner.nextInt();
				player[i][j] = a;
				num[a][j]++;
			}

		for (int i = 0; i < n; i++) {
			int ans = 0;
			for (int j = 0; j < 3; j++) {
				if (num[player[i][j]][j] == 1)
					ans += player[i][j];
			}
			System.out.println(ans);

		}
	}
}

Measured memory_bytes: 20612
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};
#[allow(unused_imports)]
use std::io::{stdout, stdin, BufWriter, Write};

pub fn pow(mut b: usize, mut power: usize) -> usize {
    let mut result = 1;
    while power > 0 {
        if power & 1 == 1 {
            result = result * b;
        }
        b = b * b;
        power >>= 1;
    }
    result
}


fn main() {
    let out = std::io::stdout();
    let mut out = BufWriter::new(out.lock());
    macro_rules! puts {
        ($($format:tt)*) => (write!(out,$($format)*).unwrap());
    }

    input!{
      n: usize,
      m: usize,
      d: usize,
    }

    let unit = if d == 0 {
        n
    } else {
        2*n - 2*d
    };

    let mut ans = (unit * (m-1)) as f64;
    ans /= (n*n) as f64;
    puts!("{}\n", ans);
}


Measured memory_bytes: 4352
/* بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ */
//codeforces
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define mp make_pair
#define pb push_back
#define sz(v) ((int)v.size())
#define all(v) v.begin(), v.end()
void parseArray(ll* A,ll n){ for ( ll K = 0; K < n; K++){ cin >> A[K]; } }
ll modInverse(ll a, ll b){ return 1<a ? b - modInverse(b%a, a)*b/a : 1; }
ll gcd(ll a, ll b){ return b?gcd(b, a % b):a; }
ll lcm(ll a, ll b){ return (a*b)/gcd(a, b); }
ld dist(ld x, ld y, ld a, ld b){ return sqrt((x-a)*(x-a) + (y-b)*(y-b)); }
void debug(ll* a, ll n) { for ( ll k = 0; k < n; k++ ){ cerr << a[k] << " ";} cout << "\n"; }
#define PI 3.14159265358979323846
#define FF first
#define SS second

int main(){
	FASTIO;
	ll n, m; cin >> n >> m;
	ll a[n]; parseArray(a, n);
	for ( int k = m; k < n; k++ ){
		if (a[k] > a[k - m])
			cout << "Yes\n";
		else
			cout << "No\n";
	}
	return 0;
}

Measured memory_bytes: 5260