akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define maxn 500005
#define ll long long
#define endl '\n'
using namespace std;
int arr[maxn];
ll dp[maxn];
bool ans[maxn];
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,d;
	cin >> n >> d;
	for(int i=1;i<=n;i++)
		cin >> arr[i];
	dp[n] = 1;
	for(int i=n-1;i>=1;i--) {
		dp[i] = dp[i+1] + arr[i+1];
		if((ll)arr[i+1] - dp[i+1] >= dp[i+1])	dp[i] = (ll)arr[i+1] - dp[i+1];
		if(dp[i+1] * 2 <= arr[i+1])		dp[i] = dp[i+1];
	}
	for(int i=1;i<=n;i++) {
		if((ll)d >= dp[i]) 
			ans[i] = true;
		d = min(d,abs(d - arr[i]));
	}
	int q;
	cin >> q;
	while(q--) {
		int idx;
		cin >> idx;
		cout << (ans[idx] ? "YES" : "NO") << endl;
	}
	return 0;
}


Measured memory_bytes: 8320
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))


ans = min(a) + min(b)
for _ in range(M):
   x, y, c = map(int, input().split())

   cost = a[x-1] + b[y-1] - c
   ans = min(ans, cost)

print(ans)


Measured memory_bytes: 18736
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <string>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define Sort(a) sort(a.begin(), a.end())
const int INF = 1<<30;
const ll MOD = 1000000007;

int main(void) {

    ll a, b, k; cin >> a >> b >> k;
    if (a + b < k) cout << 0 << " " << 0 << endl;
    else if (k < a) cout << a - k << " " << b << endl;
    else cout << 0 << " " << b - (k - a) << endl;


    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<long long>;
using pll = pair<long long, long long>;
#define rep(i,n) for(long long i(0);(i)<(n);(i)++)

void solve(long long N, std::vector<long long> A){
    if(N == 2){
        cout << abs(A[0]-A[1]) << endl;
        return;
    }
    sort(A.begin(), A.end());
    if(N & 1){
        ll res1=0, res2=0;
        //* typeA
        rep(i, N/2){
            res1 -= 2* A[i];
        }
        for(ll i= N/2; i< N; i++){
            res1 += 2* A[i];
        }
        res1 -= (A[N/2]+A[N/2+1]);

        //* typeB
        rep(i, N/2+1){
            res2 -= 2*A[i];
        }
        for(ll i=N/2+1; i< N; i++){
            res2 += 2* A[i];
        }
        res2 += A[N/2]+A[N/2-1];

        cout << max(res1, res2) << endl;
        return;
    }
    else{ //* N is even: only one type
        ll res = 0;
        rep(i, N/2)
            res -= 2* A[i];
        for(ll i= N/2; i< N; i++){
            res += 2*A[i];
        }
        res += A[N/2-1] -  A[N/2];
        cout << res << endl;
        return;
    }
}

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


Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main(){
	int a,b,ans=0;
	cin>>a>>b;
	int s=b-a;
	for(int i=1;i<=s;i++){
		ans=i+ans;
	}
	
	cout<<ans-b<<endl;
	
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

const long long MOD = 1000000007;
const int MAX_N = 100000;
int N;
int T[MAX_N], A[MAX_N];

void receiveInput(){
  cin >> N;
  for(int i = 0; i < N; i++){
    cin >> T[i];
  }
  for(int i = 0; i < N; i++){
    cin >> A[i];
  }
  return ;
}

int solve(){
  long long ans = 1;
  int k;
  for(k = 0; k <= N; k++){
    if(k == N) return 0;
    if(T[k] == A[k]) break;
  }
  for(int i = 1; i < k; i++){
    if(A[i] != A[i - 1]) return 0;
    if(T[i] == T[i - 1]){
      ans = (ans * T[i]) % MOD;
    }
  }
  for(int j = N - 2; j > k; j--){
    if(T[j] != T[j + 1]) return 0;
    if(A[j] == A[j + 1]){
      ans = (ans * A[j]) % MOD;
    }
  }
  return (int)ans;
}

int main(){
  receiveInput();
  cout << solve() << endl;
  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll MOD=1000000007LL;
int main(){
  ll n;
  cin>>n;
  ll dp[n+1];
  memset(dp,0,sizeof(dp));
  for(ll i=1;i<=n;i++){
    ll t=i;
    for(ll j=2;j<=n;j++){
      while(t%j==0) {
	dp[j]++;
	t/=j;
      }
    }
  }
  ll ans=1;
  for(ll i=0;i<=n;i++) (ans*=dp[i]+1)%=MOD;
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
typedef long long ll;
#define rep(i,k,n) for(ll i=k;i<n;++i)
#define REP(i,k,n) for(ll i=k;i<=n;++i)
ll n,m,q;
std::vector<ll> a,b,c,d;
std::vector<ll> vec;
ll dfs(ll x,ll y){
    ll res=0;
    if(x==n){
        rep(i,0,q){
            if(vec[a[i]]+c[i]==vec[b[i]]){
                res+=d[i];
            }
        }
        return res;
    } else {
        REP(i,y,m){
            vec[x]=i;
            res=std::max(res,dfs(x+1,i));
        }
        return res;
    }
}

int main(){
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(0);
    std::cout.tie(0);
    std::cin >> n >> m >> q;
    a=b=c=d=std::vector<ll>(q);
    rep(i,0,q){
        std::cin >> a[i] >> b[i] >> c[i] >> d[i];
        a[i]--;
        b[i]--;
    }
    vec.resize(n);
    ll ans=dfs(0,1);
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 3648
#include <cstdio>
#include <climits>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <list>
#include <set>
#include <bitset>
#include <iterator>
#define rep(i, n) for(long long i = 0; i < (long long)(n); i++)
#define debug(x)  cout << #x << " = " << (x) << endl;
using namespace std;
typedef long long int LL;
typedef unsigned long long int ULL;

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

    cout << n - k + 1 << endl;
    return 0;
}


Measured memory_bytes: 888
import java.util.*;
public class Main{
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    if (a*b%2 == 0){
      System.out.println("Even");
    }else{
      System.out.println("Odd");
    }
  }
}

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

using namespace std;

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

    vector<int> c;
    for(int i=0; i<26; i++){
        int tmp;
        cin >> tmp;
        c.push_back(tmp);
    }
    
    vector<vector<int>>  s(d,vector<int>(26,0));
    for(int i=0; i<d; i++){
        for(int j=0; j<26; j++){
            cin >> s[i].at(j);
        }
    }

    vector<int> t;
    for(int i=0; i<d; i++){
        int tmp;
        cin >> tmp;
        t.push_back(tmp);
    }

    vector<int> last(26,0);
    int ans = 0;
    int i = 0;
    while(i<d){
        int dec = 0;
        //cout << s[i][t[i]-1] << endl;
        ans += s[i][t[i]-1];
        /*
        for(int j=0; j<26; j++){
            last[i]++;
        }
        */
        last[t[i]-1] = i+1;
        for(int j=0; j<26; j++){
            dec += c[j] * (i+1-last[j]);
        }
        ans -= dec;
        i++;
        cout << ans << endl;
    }

    /*
    //デバッグ処理
    for(int i=0; i<26; i++){
        cout << c[i] << " ";
    }
    cout << endl;
    for(int i=0; i<d; i++){
        for(int j=0; j<26; j++){
            cout << s[i][j] << " ";
        }
        cout << endl;
    }
    for(int i=0; i<d; i++){
        cout << t[i] << " ";
    }
    */
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main()
{
    int N, K;
    int a[100'000];

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

    int r = (N - 1) / (K - 1);
    int rem = (N - 1) % (K - 1);
    if (rem != 0)
    {
        r++;
    }

    cout << r << endl;
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);++(i))
#define all(x) (x).begin(),(x).end()
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define yes(n) cout << ((n) ? "yes" : "no") << endl

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

const int INF = 1001001001;
const vector<int> di = {-1,  0, 1, 0};
const vector<int> dj = { 0, -1, 0, 1};

void chmin(int &a, int b) { if (a > b) a = b; }

ll GCD(ll a, ll b) {
    if (b == 0) return a;
    else return GCD(b, a % b);
}
ll LCM(ll a, ll b) {
    ll g = GCD(a, b);
    return a / g * b;
}


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

    int ans = 0;
    rep(i, n+1) {
        int num = i;
        int cnt = 0;
        while (num>0) {
            num /= 10;
            cnt++;
        }
        if (cnt % 2 == 1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

s = ns()
n = len(s)

ans = 0

for i in range(1,n//2):
    first = s[:i]
    second = s[i:2*i]
    
    if first == second:
        ans = 2*i
        
print(ans)

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define FOR(i, a, done) for (int i = (a); i < (done); ++i)
#define all(a) (a).begin(), (a).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;
typedef pair<int, int> P;

int main()
{
    int n, c;
    cin >> n >> c;
    vector<vector<int>> D(c, vector<int>(c));
    rep(i, c) rep(j, c) cin >> D[i][j];
    vector<vector<int>> C(n, vector<int>(n));
    vector<vector<int>> used(3, vector<int>(c));
    rep(i, n)
    {
        rep(j, n)
        {
            cin >> C[i][j];
            C[i][j]--;
            rep(k, 3)
            {
                if ((i + 1 + j + 1) % 3 == k)
                {
                    used[k][C[i][j]]++;
                }
            }
        }
    }
    int ans = INT32_MAX;
    //  cout<<ans<<endl;
    rep(i, c)
    {

        rep(j, c)
        {

            rep(k, c)
            {
                int sum = 0;
                rep(ii, c)
                {
                    sum += D[ii][i] * used[0][ii];
                }
                rep(jj, c)
                {
                    sum += D[jj][j] * used[1][jj];
                }
                rep(kk, c)
                {
                    sum += D[kk][k] * used[2][kk];
                }
                if (i != k && i != j && j != k)
                    ans = min(ans, sum);
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 1280
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(ReadLine());
        var L = ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();

        var ans = 0;

        for (int i = 0; i < N; i++)
        {
            for (int j = i + 1; j < N; j++)
            {
                for (int k = j + 1; k < N; k++)
                {
                    if (L[i] == L[j] || L[j] == L[k] || L[k] == L[i])
                        continue;

                    var l = new[] { L[i], L[j], L[k] }.OrderBy(x => x).ToArray();

                    if (l[0] + l[1] > l[2])
                        ans++;
                }
            }
        }

        WriteLine(ans);
    }
}


Measured memory_bytes: 47136
Mod = 10**9 + 7
N,K,*A = `dd`.split.map &:to_i

def mul(mat1, mat2)
 m2 = mat2.transpose
 (0...N).each{ |i|
   r1 = mat1[i]
   row = r1.clone
   (0...N).each{ |j|
     r2 = m2[j]
     v = 0
     (0...N).each{ |k|
       v = (v + row[k] * r2[k]) % Mod
     }
     r1[j] = v
   }
 }
 mat1
end

mat = (0...N).map{ |i| (0...N).map{ |j| A[i*N+j] } }
prd = (0...N).map{ |i| (0...N).map{ |j| i == j ? 1 : 0 } }

b = 1
while b <= K
  if K & b > 0
    prd = mul(prd, mat)
  end
  b <<= 1
  mat = mul(mat, mat)
end

p prd.reduce(0){ |a,row| (a + row.reduce(:+)) % Mod }


Measured memory_bytes: 4216
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<stack>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long 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<double,int,double> 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;}
const double PI=acos(-1);
const double EPS=1e-7;
Def inf=sizeof(Def)==sizeof(long long)?2e18:1e9;
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int main(){
	int n,m;
	cin>>n>>m;
	vs in(n);
	rep(i,n)cin>>in[i];
	vi co(26);
	rep(i,n)rep(j,m)co[in[i][j]-'a']++;
	if(n%2&&m%2){
		rep(i,26)if(co[i]%2){
			co[i]--;
			break;
		}
	}
	rep(i,26)if(co[i]%2){
		cout<<"No"<<endl;
		return 0;
	}
	if(n%2||m%2){
		int t=0;
		if(n%2)t+=m/2;
		if(m%2)t+=n/2;
		rep(i,26)if(co[i]%4==2&&t){
			t--;
			co[i]-=2;
		}
		rep(i,26){
			while(co[i]&&t){
				co[i]-=2;
				t--;
			}
		}
	}
//	rep(i,26)cout<<" "<<co[i];cout<<endl;
	rep(i,26)if(co[i]%4){
		cout<<"No"<<endl;
		return 0;
	}
	cout<<"Yes"<<endl;
}








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

int main()
{
    int n;
    bool flag = true;
    int count = 0;
    vector<int> a;
    
    cin >> n;
    for (int i = 0; i < n; i++) { int tmp; cin >> tmp; a.push_back(tmp); }
    
    for (int i = 0; flag && i < n; i++) {
        flag = false;
        for (int j = n-1; j > i; j--) {
            if (a[j] < a[j-1]) {
                swap(a[j], a[j-1]);
                count++;
                flag = true;
            }
        }
    }
    for (int i = 0; i < n-1; i++) cout << a[i] << " ";
    cout << a[n-1] << endl;
    cout << count << endl;

    return 0; 
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
  int n; cin >> n;
  vector<int> h(n);
  for(auto &e: h) cin >> e;
  vector<int> cost(n);
  cost[0] = 0;
  cost[1] = abs(h[0]-h[1]);
  for(int i=2;i<cost.size();i++) {
    cost[i] = min(cost[i-1] + abs(h[i]-h[i-1]),cost[i-2] + abs(h[i]-h[i-2]));
  }
  cout << cost[n-1];
  return 0;
}

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

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            // 解答はココに書く
            var num = cin.ReadInt;
            var list = new List<int>();
            for(int i=0; i<num; i++)
            {
                int input = cin.ReadInt;
                if (!list.Contains(input)) list.Add(input);
            }

            WriteLine(list.Count().ToString());

        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); }}
        public int ReadInt { get { return int.Parse(Read); }}
        public long ReadLong { get { return long.Parse(Read); }}
        public double ReadDouble { get { return double.Parse(Read); }}
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret;}
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret;}
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret;}
    }
}

Measured memory_bytes: 13280
#include"stdio.h"
int main(){int N;scanf("%d",&N);int po[N];for(int i=0;i<N;i++){po[i]=(N-i)%2;po[i]*=2;if(po[0]==2)po[0]=1;}for(int i=0;i<N;i++){int kari;scanf("%d",&kari);po[kari]--;}for(int i=0;i<N;i++)if(po[i]!=0){printf("0\n");return 0;}int ans=1;for(int i=0;i<N/2;i++)ans=(ans*2)%1000000007;printf("%d\n",ans);return 0;}



Measured memory_bytes: 512
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{

	public static void main(String[] args) throws IOException
	{
		int a,b,q;
		String str;
		String[] strPrint = new String[128];

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in) );

		str = br.readLine();

		q = Integer.parseInt(br.readLine() );

		for(int i=0; i<q; i++)
		{
			String[] strSplit = br.readLine().split(" ");

			a = Integer.parseInt(strSplit[1]);
			b = Integer.parseInt(strSplit[2]);

			if(strSplit[0].equals("replace") )
			{
				StringBuffer sb_rep = new StringBuffer(str).replace(a, b+1, strSplit[3]);
				str = sb_rep.toString();
			}
			else if(strSplit[0].equals("reverse") )
			{
				StringBuffer sb_str = new StringBuffer(str);
				StringBuffer sb_rev = new StringBuffer(str.substring(a, b+1) );

				sb_rev = sb_rev.reverse();

				StringBuffer sb_revp = sb_str.replace(a, b+1, sb_rev.toString() );
				str = sb_revp.toString();
			}
			else if(strSplit[0].equals("print") )
			{
				strPrint[i] = str.substring(a, b+1);
			}

		}

		for(String strFor : strPrint)
		{
			if(strFor != null)
			System.out.println(strFor);
		}

	}
}

Measured memory_bytes: 24704
#include <iostream>
#include <vector>
#include <queue>
#include <set>

using namespace std;
using ii = pair<int, int>;

int dijkstra(vector<vector<char>> graph, int sourcex, int sourcey, int endx, int endy) {
	priority_queue<pair<int, ii>> pq;
	set<pair<int, int>> visited;

	pq.push(make_pair(0, ii(sourcex, sourcey)));

	while (!pq.empty()) {
		pair<int, ii> val = pq.top();
		pq.pop();
		int d = val.first;
		int nodex = val.second.first;
		int nodey = val.second.second;

		if (visited.find(make_pair(nodex, nodey)) != visited.end()) {
			continue;
		}
		if (nodex == endx && nodey == endy) {
			return -d;
		}
		if (nodex > 0 && graph[nodex - 1][nodey] == '.') {
			pq.push(make_pair(d, ii(nodex - 1, nodey)));
		}
		if (nodex + 1 < graph.size() && graph[nodex + 1][nodey] == '.') {
			pq.push(make_pair(d, ii(nodex + 1, nodey)));
		}
		if (nodey > 0 && graph[nodex][nodey - 1] == '.') {
			pq.push(make_pair(d, ii(nodex, nodey - 1)));
		}
		if (nodey + 1 < graph[0].size() && graph[nodex][nodey + 1] == '.') {
			pq.push(make_pair(d, ii(nodex, nodey + 1)));
		}
		for (int i = nodex - 2; i <= nodex + 2; i++) {
			if (i < 0 || i >= graph.size()) {
				continue;
			}
			for (int j = nodey - 2; j <= nodey + 2; j++) {
				if (j < 0 || j >= graph[0].size()) {
					continue;
				}
				if (graph[i][j] == '.') {
					pq.push(make_pair(d - 1, ii(i, j)));
				}
			}
		}
		visited.insert(make_pair(nodex, nodey));
	}
	return -1;
}

int main() {
	int H, W, Ch, Cw, Dh, Dw;
	cin >> H >> W >> Ch >> Cw >> Dh >> Dw;
	Ch--;
	Cw--;
	Dh--;
	Dw--;
	cin.get();
	vector<vector<char>> maze(W, vector<char>(H));
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin.get(maze[j][i]);
		}
		cin.get();
	}
	cout << dijkstra(maze, Cw, Ch, Dw, Dh);
}

Measured memory_bytes: 26000
import java.util.*;
public class Main {
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	int N;
  	N = sc.nextInt();
  	if(N==0) System.exit(0);

  	String[] s = new String[N];
  	int[] t = new int[N];
  
  	for (int i=0;i<N;i++){
		s[i] = sc.next();
	}
  	Arrays.sort(s);
  	int tmp = 1;
  	for(int k=0;k<N-1;k++){
      	if(s[k].compareTo(s[k+1])==0){
          tmp++;
          if(k==N-2) t[k+1] =tmp;
        }else{
          t[k] = tmp;
          tmp=1;
          if(k==N-2) t[k+1] =tmp;
        }
      
    } 	
  //	System.out.println("s: " + Arrays.toString(s));
  //	System.out.println("t: " + Arrays.toString(t));
	int max=0;
  	for(int l=0;l<N;l++){
      	if(max < t[l]) max = t[l];
    }
  	
  	for(int p=0;p<N;p++){
      	if(t[p]==max){
          System.out.println(s[p]);
        }
    }
  
	}
}

Measured memory_bytes: 79188
#include <stdio.h>

int main(){
  int n, u, k, v, c, list[100][100], s[100], d[100], p[100];
  int i, j, min, min_v;

  for (i = 0; i < 100; i++) {
    d[i] = 999999;
    s[i] = -1;
    for (j = 0; j < 100; j++) {
      list[i][j] = 999999;
    }
  }

  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d %d", &u, &k);
    for (j = 0; j < k; j++) {
      scanf("%d %d", &v, &c);
      list[u][v] = c;
    }
  }

  d[0] = 0;

  for (j = 0; j < n; j++){
    min = 1000000;
    for (i = 0; i < n; i++) {
      if (min > d[i] && s[i] != 1) {
        min = d[i];
        min_v = i;
      }
    }

    s[min_v] = 1;
    for (i = 0; i < n; i++) {
      if (d[min_v]+list[min_v][i]<d[i] && s[i]!=1){
        d[i] = d[min_v] + list[min_v][i];
        p[min_v] = i;
      }
    }
  }

  for (i = 0; i < n; i++) {
    printf("%d %d\n", i, d[i]);
  }

  return 0;
}


Measured memory_bytes: 2052
#include<stdio.h>
int main(){
  char s[52][52]={0};
  int h,w,i,j;
  scanf("%d%d",&h,&w);
  for(i=1;i<=h;i++)scanf("%s",&s[i][1]);
  for(i=1;i<=h;i++)for(j=1;j<=w;j++)if(s[i][j]=='#'&&s[i][j-1]!='#'&&s[i][j+1]!='#'&&s[i-1][j]!='#'&&s[i+1][j]!='#'){printf("No");return 0;}
  printf("Yes");
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define REPS(i, m, n) for (int i = (m); i <= (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define reps(i, n) for (int i = 0; i <= (int)(n); i++)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define rreps(i, x) for (int i = (int)(x); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> P;
const int inf = INT_MAX;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val) { fill( (T*)array, (T*)(array+N), val ); }


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

    string a, b, c;
    cin >> a >> b >> c;
    char diff = 'A' - 'a';
    cout << char(a[0] + diff) << char(b[0] + diff) << char(c[0] + diff) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int h = sc.nextInt();
		int w = sc.nextInt();
		int c = sc.nextInt();
		if (c==h-w||c==w-h||c==w+h) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;
template<class T> void assign(V<T>& v, int n, const T& a = T()) { v.assign(n, a); }
template<class T, class... U> void assign(V<T>& v, int n, const U&... u) { v.resize(n); for (auto&& i : v) assign(i, u...); }

struct M {
  using T = int;
  static T op(const T& a, const T& b) { return a + b; }
  static constexpr T e() { return 0; }
};

template<class M> struct ST {
  using T = typename M::T;
  int n;
  V<T> t;

  ST(int n) : n(n) {
    t.assign(2 * n, M::e());
  }

  void build() {
    for (int i = n - 1; i; i--) t[i] = M::op(t[2 * i], t[2 * i + 1]);
  }

  T get(int l, int r) {
    T resl = M::e(), resr = M::e();
    for (l += n, r += n; l < r; l >>= 1, r >>= 1) { 
      if (l & 1) resl = M::op(resl, t[l++]); 
      if (r & 1) resr = M::op(t[--r], resr);
    }
    return M::op(resl, resr);
  }

  void set(int i, const T& a) {
    for (t[i += n] = a; i >>= 1;) t[i] = M::op(t[2 * i], t[2 * i + 1]);
  }
};

int main() {
  cin.tie(NULL); ios::sync_with_stdio(false);
  int n; cin >> n;
  V<> a(n); for (int i = 0; i < n; i++) cin >> a[i];
  auto chk = [&](int x) {
    V<> c(n + 1);
    c[0] = n;
    for (int i = 0; i < n; i++) c[i + 1] = c[i] + (a[i] >= x ? 1 : -1);
    lint s = 0;
    ST<M> st(2 * n + 1);
    for (int i = 0; i < n + 1; i++) {
      s += st.get(0, c[i] + 1);
      st.set(c[i], st.get(c[i], c[i] + 1) + 1);
    }
    return 4 * s >= (lint) n * (n + 1);
  };
  V<> b = a;
  sort(b.begin(), b.end());
  b.erase(unique(b.begin(), b.end()), b.end());
  b.push_back(2e9);
  auto l = b.begin(), r = --b.end();
  while (r - l > 1) {
    auto m = l + (r - l) / 2;
    if (chk(*m)) l = m;
    else r = m;
  }
  cout << *l << '\n';
}

Measured memory_bytes: 3064
#[allow(dead_code)]
fn read_line(n: usize) -> String {
    let mut ss = String::new();
    for _i in 0..n {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        ss.push_str(&s);
    }
    ss
}

macro_rules! parse {
    ($s:expr => $($r:tt)*) => {
        let s = $s;
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        parse!{s => $($r)*}
    };
}

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn sub() -> bool
{
    parse!{
        n: i32,
    }
    if n > 81 {
        false
    }
    else {
        for i in 1..10 {
            for j in 1..10 {
                if i * j == n {
                    return true;
                }
            }
        }
        false
    }
}

fn main()
{
    match sub() {
        true  => println!("Yes"),
        false => println!("No"),
    }
}

Measured memory_bytes: 4352
function Main(input) {
    input = input.trim();
    // input = input.split("\n")
    // input = input.map(e=>e.split(" ").map(f=>parseInt(f)))
    if(input == "ABC"){
        console.log("ARC")
    }else{
        console.log("ABC")
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 29628
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
const ll BIG=1e15;

int main(){
    ll ans=0;
    int N; cin>>N;
    vector<ll> d(N);
    ll sum=0;
    for(int i=0;i<N;i++) {cin>>d.at(i); sum+=d.at(i);}
    for(int i=0;i<N;i++) ans+=(d.at(i)*(sum-d.at(i)));
    cout<<ans/2<<endl;



} 


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, f, n) for (ll i = (f); i < (n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define repv(v) for (auto it = (v).begin(); it != (v).end(); it++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define INIT    \
    cin.tie(0); \
    ios::sync_with_stdio(false);

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

ll const INF = 1LL << 60;
ll const MOD = 1000000007;

int main() {
    INIT;
    string s;
    cin >> s;

    rep(i, SZ(s)) {
        if (s[i] == '1')
            cout << "9";
        else if (s[i] == '9')
            cout << "1";
    }
    cout << endl;

    return 0;
}

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


int main() {
	long long n,c=0;
	cin>>n;
	if(n%2==1){
		cout<<0<<endl;
		return 0;
	}
	else{
		n/=2;
		while(n>4){
			n/=5;
			c+=n;
		}
	}
	cout<<c<<endl;
}


Measured memory_bytes: 256
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <complex>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;

int main() {
  int H, N;
  cin >> H >> N;
  ll sum = 0;
  for (int i = 0; i < N; i++) {
    int x;
    cin >> x;
    sum += x;
  }
  if (sum >= H) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;




int main(){
    ll n;
    cin>>n;
    vector<ll> a(n,0);
    ll mx=-E;
    ll w=-1;
    vector<ll> g,k;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(a[i]>mx){w=i; mx=a[i];}
    }
    ll gsum=0;
    for(int i=0;i<n;i+=2){
        if(a[i]>0){g.push_back(i); gsum+=a[i];}
    }
    ll ksum=0;
    for(int i=1;i<n;i+=2){
        if(a[i]>0){k.push_back(i); ksum+=a[i];}
    }
    if(gsum==0 && ksum==0){
        cout<<mx<<endl<<n-1<<endl;
        while(w>0){
            cout<<1<<endl;
            w--;
            n--;
        }
        while(n>1){
            cout<<n<<endl;
            n--;
        }
        return 0;
    }
    vector<ll> ans;
    if(gsum>ksum){ans=g; mx=gsum;}
    else{ans=k; mx=ksum;}
    deque<bool> A(n,false);
    for(int i=0;i<ans.size();i++){
        A[ans[i]]=true;
    }
    cout<<mx<<endl;
    vector<ll> job;
    while(A[0]==false){
        A.pop_front();
        job.push_back(0);
    }
    while(A[A.size()-1]==false){
        A.pop_back();
        job.push_back(A.size());
    }
    for(ll i=A.size()-1;i>=0;i-=2){
        if(A[i]==false){job.push_back(i);}
    }
    for(ll i=ans.size()-2;i>=0;i--){
        job.push_back(i*2+1);
    }
    cout<<job.size()<<endl;
    for(int i=0;i<job.size();i++){
        cout<<job[i]+1<<endl;
    }
    
    
    return 0;
}


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<string> v(n);
  vector<map<char, int>> count(n);

  for (int i = 0; i < n; i++) {
    cin >> v[i];
    for(auto a : v[i]){
      count[i][a]++;
    }
  }

  map<char, int> res;
  for(auto a : count[0]){
    res[a.first] += a.second;
  }

  for(auto a = count.begin() + 1; a < count.end(); a++){
    map<char, int> tmp;
    for(auto b : *a){
      tmp[b.first] = b.second;
    }
    for(auto b : res){
      // print(b);
      res[b.first] = min(b.second, tmp[b.first]);
    }
  }

  string s = "";
  for(auto a : res){
    for (int i = 0; i < a.second; i++) {
      s += a.first;
    }
  }
  cout << s << endl;
}


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

typedef long lint;
typedef long long llint;
typedef pair<int, int> pint;
typedef pair<long long, long long> pllint;
typedef tuple<long long, long long, long long> tllint;

// static const int MAX = 1e6;
// static const int NIL = -1;
// static const llint INF = 1<<21;
// static const llint MOD = 1e9 + 7;

bool compPair(const pint& arg1, const pint& arg2) { return arg1.first > arg2.first; }
bool compTuple(const tllint& arg1, const tllint& arg2) { return get<2>(arg1) > get<2>(arg2); }
template<class T> void chmax(T& a, T b) { if (a < b) { a = b; } }
template<class T> void chmin(T& a, T b) { if (a > b) { a = b; } }

int main(void) {
    llint n, d;
    cin >> n >> d;
    d *= d;

    llint x, y, l, ans = 0;
    for(llint in=0;in<n;++in) {
        cin >> x >> y;
        l = x * x + y * y;
        if(l<=d) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3644
#include<bits/stdc++.h>
#define mz 998244353
#define pq priority_queue
using namespace std;

map <int,int> mp;

int main()
{
    int n,a;
    long long ans=0;
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a);
        ans+=mp[i-a];
        mp[i+a]++;
    }
    printf("%lld\n",ans);
    return 0;
}


Measured memory_bytes: 20772
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Linq;

class Program
{
    static void Main()
    {
        new Magatro().Solve();
    }
}

class Magatro
{

    private int A, B, C;

    public void Solve()
    {
        var Map = new Dictionary<int, int>();
        int N, M;
        var line = Console.ReadLine().Split(' ');
        N = int.Parse(line[0]);
        M = int.Parse(line[1]);
        for (int i = 0; i < M; i++)
        {
            line = Console.ReadLine().Split(' ');
            int a = int.Parse(line[0]);
            int b = int.Parse(line[1]);
            int d;
            if (!Map.TryGetValue(a, out d)) Map[a] = 0;
            if (!Map.TryGetValue(b, out d)) Map[b] = 0;
            Map[a]++;
            Map[b]++;
        }
        foreach(var i in Map)
        {
            if (i.Value % 2 == 1)
            {
                Console.WriteLine("NO");
                return;
            }
        }
        Console.WriteLine("YES");
    }


}




Measured memory_bytes: 21072
# ABC134D - Preparing Boxes
# Better ver.
def main():
    n = int(input())
    A = [0] + list(map(int, input().rstrip().split()))
    ans = []  # answer "in any order"
    ans_append = ans.append
    for i in range(n, 0, -1):
        A[i] = sum(A[i::i]) % 2
        if A[i]:
            ans_append(i)
    print(len(ans))
    print(*ans)


if __name__ == "__main__":
    main()

Measured memory_bytes: 12576
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=10000005;
int cnt[M];
 main()

{
    fast
    int n;
    cin>>n;
    f(i,1,n)
    {
        for(int j=i;j<=n;j=j+i)
        {
            cnt[j]++;
        }
    }
    int ses=0;
    f(i,1,n)
    {
        ses+=(i*cnt[i]);
    }
    cout<<ses<<endl;
    return 0;

}





































Measured memory_bytes: 81756
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    int N, K;
    cin >> N >> K;
    vector<ll> a(N);
    rep(i, 0, N) cin >> a[i];
    vector<ll> sum(N + 1), sum2(N + 1);
    sum[0] = sum2[0] = 0;
    rep(i, 0, N)
    {
        sum[i + 1] = sum[i] + a[i];
        sum2[i + 1] = sum2[i] + max(a[i], 0LL);
    }

    ll ans = 0;
    rep(i, 0, N - K + 1)
    {
        // [l, r)
        const int l1 = 0;
        const int r1 = i;
        const int l2 = i;
        const int r2 = i + K;
        const int l3 = i + K;
        const int r3 = N;
        
        ll x = 0, y = 0;
        if (l1 < r1)
        {
            x += sum2[r1] - sum2[l1];
            y += sum2[r1] - sum2[l1];
        }
        x += sum[r2] - sum[l2];
        if (l3 < r3)
        {
            x += sum2[r3] - sum2[l3];
            y += sum2[r3] - sum2[l3];
        }
        chmax(ans, x);
        chmax(ans, y);
    }
    cout << ans << endl;
}


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

int main(){
  string s,ans="YES";
  cin >> s;
  int i=0;
  int n =s.size();
  while(i<n){
    if(i+4>=n){ans="NO";break;}
    if(s[i]=='d'){
      if(s[i+1]=='r' and s[i+2]=='e' and s[i+3]=='a' and s[i+4]=='m'){
        if(i+4==n-1) break;
        if(s[i+5]=='e' and s[i+6]=='r'){
          if(i+6==n-1) break;
          if(s[i+7]=='a'){i+=5;continue;}
          else if(s[i+7]=='d' or s[i+7]=='e'){i+=7;continue;}
          else{ans="NO";break;}
        }else{i+=5;continue;}
      }else{ans="NO";break;}
    }else if(s[i]=='e'){
      if(s[i+1]=='r' and s[i+2]=='a' and s[i+3]=='s' and s[i+4]=='e'){
        if(i+4==n-1) break;
        if(s[i+5]=='r'){i+=6;continue;}
        else{i+=5;continue;}
    }else{ans="NO";break;}
    }else{ans="NO";break;}
  }
  cout << ans <<"\n";
  return 0;
}

Measured memory_bytes: 3736
n, m = map(int, input().split())
like_dict = {}
for _ in range(n):
    for val in map(int, input().split()[1:]):
        if val in like_dict:
            like_dict[val] += 1
        else:
            like_dict[val] = 1

like_list = [val for val in like_dict.values() if val == n]

print(len(like_list))


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e6+5;
int n,ans;
int main()
{
	cin>>n;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
		{
			if(i*j>=n)
				break;
			else
				ans++;
		}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
using ll=long long;
ll M=1000000007;
int main(){
    int N;cin>>N;
    string s,ss;cin>>s>>ss;
    ll ans{1},prv{};
    for(int i{};i<N;++i){
        ll nw{1};
        if(i+1<N&&s[i]==s[i+1])nw=2,++i;
        if(!prv){ans*=nw>1?6:3;}
        else if(prv<2)ans=ans*2%M;
        else if(nw>1)ans=ans*3%M;
        prv=nw;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
typedef long long ll;
ll k, a, b;
int main() {
	scanf("%lld%lld%lld", &k, &a, &b);
	k -= a;
	if (k <= 0) printf("1");
	else if (a > b) printf("%lld", (((k - 1) / (a - b) + 1) << 1) + 1);
	else printf("-1");
	return 0;
}

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

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int con = 0;
	int N;
	
	cin>>N;
	
	for(int i = 1; i < N; i++){
		int j = N-i;
		if(i > j) continue;
		if(j != i) con++;
	}
	
	cout<<con<<endl;
	
	return 0;
}

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

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

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

map<ll, int> prime_factor(ll n) {
    map<ll, int> ret;
    for (ll i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

int main() {
    int N;
    cin >> N;
    vector<ll> A(N);
    rep(i, N) cin >> A[i];

    map<ll, int> p, tmp;
    rep(i, N) {
        tmp = prime_factor(A[i]);
        for (auto itr = tmp.begin(); itr != tmp.end(); itr++) {
            p[itr->first] = max(p[itr->first], itr->second);
        }
    }

    mint lcm = 1;
    for (auto itr = p.begin(); itr != p.end(); itr++)
        rep(i, itr->second) lcm *= itr->first;

    mint ans;
    rep(i,N)
        ans += lcm / A[i];

    cout << ans.x << endl;

    return 0;
}

Measured memory_bytes: 896
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
using namespace std;
typedef long long LL;

int main(void) {
	int a, b;
	cin >> a >> b;
	cout << (a - 1)*(b - 1) << endl;
	return 0;
}

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




Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <algorithm>
using namespace std;

typedef long long int ll;

int main () {
    ll k, n; cin >> k >>  n;
    vector<int> a,b;
    for (int i = 0; i < n; i++) {
        ll tmp; cin >> tmp;
        a.push_back(tmp);
    }
    sort(a.begin(), a.end());
    ll max_diff = 0;
    ll ans = 0;
    a.push_back(a[0] + k);
    for (int i = 0; i < n; i++) {
        ans += (a[i+1] - a[i]);
        max_diff = max((ll)(a[i+1]- a[i]), max_diff);
    }
    cout << ans - max_diff << endl;

    return 0;
}

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

int main(){
    int a, b, c, d;

    cin >> a >> b >> c >> d;

    int left = a + b;
    int right = c + d;

    int ans = left - right;
    string anser;
    if(ans > 0) anser = "Left";
    else if(ans == 0) anser = "Balanced";
    else anser = "Right";

    cout << anser << endl;

}


Measured memory_bytes: 256