akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>

int N;
std::string abc = "abcdefghijklmnopqrstuvwxyz";
std::string S;
int ans[26];
int INF = 1 << 30;

int main() {
	std::cin >> N;
	for (int i = 0; i < 26; i++) {
		ans[i] = INF;
	}
	for (int i = 0; i < N; i++) {
		std::cin >> S;
		int aa[26] = {};
		for (int j = 0; j < (int)S.size(); j++) {
			aa[S[j] - 'a']++;
		}
		for (int j = 0; j < 26; j++) {
			ans[j] = std::min(ans[j], aa[j]);
		}
	}
	for (int i = 0; i < 26; i++) {
		for (int j = 0; j < ans[i]; j++) {
			std::cout << abc[i];
		}
	}
	std::cout << std::endl;
	return 0;
}

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

using namespace std;

int N;
string a_str;
int a_int;

pair<pair<string,int>,int> arr[105];

bool compareDirectly (const pair<pair<string,int>,int> p1, const pair<pair<string,int>,int> p2) {
    if (p1.first.first < p2.first.first) {
        return true;
    } else if (p1.first.first > p2.first.first) {
        return false;
    } else {
        if (p1.first.second > p2.first.second){
            return true;
        } else {
            return false;
        }
    
    }
        
}



int main () {

    cin >> N;

    for (int i = 0; i < N ; i++){
        cin >> a_str >> a_int;

        arr[i] = make_pair(make_pair(a_str,a_int),i);
    }

    sort(arr,arr+N, compareDirectly);

    for ( int j = 0 ; j< N; j++){
        cout << arr[j].second+1 << "\n"; 
    }
    return 0;
}

Measured memory_bytes: 256
N,A,B = map(int,input().split())
players = list(input())
tuuka = 0
kaigai = 0
for i in players:
    if i == "c":
        print("No")
        continue
    if i == "b" or i == "a":
        if tuuka < A + B:
            if i == "a":
                print("Yes")
                tuuka += 1
                continue
            if i == "b" and kaigai < B:
                print("Yes")
                tuuka += 1
                kaigai += 1
            else:
                print("No")
        else:
            print("No")

Measured memory_bytes: 4712
n, m = map(int, input().split())
s = list(map(int, input().split()))
t = list(map(int, input().split()))
dp = [0 for i in range(m)]
mod = 10 ** 9 + 7
for si in s:
    memo = [0]
    for i, ti in enumerate(t):
        memo.append((memo[-1] + dp[i]) % mod)
    for i, ti in enumerate(t):
        if si == ti:
            dp[i] += memo[i] + 1
            dp[i] %= mod

ans = 1
for dpi in dp:
    ans += dpi
    ans %= mod
print(ans)


Measured memory_bytes: 43776
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> vec(n);
    int sum=0;
    for(int i=0;i<n;i++){
    cin >>vec.at(i);
}
    sort(vec.begin(),vec.end());
    reverse(vec.begin(),vec.end());
    for(int i=1;i<n;i++){
    sum+=vec.at(i);
    }
    sum += vec.at(0)/2;
    cout << sum <<endl;
}


Measured memory_bytes: 3632
#include <iostream>
#include<time.h>
#include<string>
#include<cstring>
#include <cstdio>
#include<utility>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<bitset>
#include<queue>
#include<stack>
#include<set>
#include <limits>
#include <climits>
#include <numeric>
#include<cassert>
#include<cctype>
#include<iterator>
#include<unordered_map>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef vector<ll>VI;
typedef vector<bool>VB;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define bitrep(bit,A) for(int bit=A; ;bit=(bit-1)&A)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) (ll)((a).size())
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=c_max(x,a)
#define chmin(x,a) x=c_min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define SORT(c) stable_sort(ALL(c))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
#define MOD 1000000007
#define INF 1<<30
#define INFTY 1000000000000000001LL
#define MAX_INT INT_MAX
#define Endl '\n'
#define greater greater<int>()
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
// g++ -o a a.cpp -Wall -lm -std=c++14

int h,w;
char m[101][101];
int main(){
    cin>>h>>w;
    rep(i,h)rep(j,w)cin>>m[i][j];
    bool W[100];
    bool H[100];
    memset(W,0,sizeof(W));
    memset(H,0,sizeof(H));
    rep(i,h){
        int cn=0;
    rep(j,w){
        if(m[i][j]=='.')cn++;
    }
    if(cn==w){
        W[i]=1;
        }
    }
    //cout<<"now:"<<W[1]<<endl;
    
    rep(j,w){
        int cnt=0;
        rep(i,h){
            if(m[i][j]=='.')cnt++;
        }
        if(cnt==h)H[j]=1;
    }
    
//cout<<"then:"<<W[1]<<endl;
    
    rep(i,h){
        rep(j,w){
        if(W[i]==1 || H[j]==1)continue;
        cout<<m[i][j];
    }
    if(W[i]!=1)cout<<endl;
    }
    cout<<endl;
    
}

Measured memory_bytes: 384
// Vivek Rai
// Blazer_007

#include<bits/stdc++.h>
using namespace std;

#define fastio    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define endl      '\n'

typedef long long int ll;
const int hell = 1e9 + 7 ;

vector<ll> factors;
map<ll,ll> cnt;
void primeFactors(ll n)  
{  
     
    while (n % 2 == 0)  
    {  
        cnt[2]++; 
        n = n/2;  
    }  
  
    for (ll i = 3; i <= sqrt(n); i = i + 2)  
    {  
        // While i divides n, print i and divide n  
        while (n % i == 0)  
        {  
            cnt[i]++; 
            n = n/i;  
        }  
    }  

    if( n > 2 )
        cnt[n]++;
   
} 



bool isPrime(ll n) 
{ 
    // Corner cases 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
  
    // This is checked so that we can skip  
    // middle five numbers in below loop 
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (ll i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}


signed main() {

    fastio

    ll n ;
    cin >> n ;

    if( n == 1 ) {
        cout << 0 << endl;
        return 0;
    }

    if( isPrime(n) ) {
        cout << 1 << endl;
        return 0;
    }

    primeFactors(n);

    ll ans = 0;
    for( auto i : cnt ) {
        // cout << i.first << " " << i.second << endl;
        int j = i.second ;
        int jj = 1;
        while( j > 0 && j >= jj ) {
            ans++;
            j -= jj;
            jj++;
        }
        // cout << ans << endl;
    }

    cout << ans << endl;

}

Measured memory_bytes: 3704
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string.h>
#include <stdio.h>
#define LL long long
#define all(x) (x).begin(),(x).end()
#define pii pair<int,int>
#define piii pair<int, pii >
#define REP(i,n) for (int (i)=0;(i)<(n);(i)++)
#define vi vector<int>
#define vpi vector< pii >
#define INF 2147483647
#define big 19260817
#define pb push_back
#define mp make_pair
using namespace std;
const int Maxk=1005;
string mul(string a,string b){
	int res[Maxk];
	memset(res,0,sizeof(res));
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	for (int i=0;i<a.length();i++){
		for (int j=0;j<b.length();j++){
			res[i+j]+=(a[i]-'0')*(b[j]-'0');
		}
	}
	for (int i=0;i<Maxk;i++){
		if (res[i]>=10) {
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	string ret;
	bool flag=false;
	for (int i=Maxk-1;i>=0;i--){
		if (flag || res[i]){
			flag=true;
			ret=ret+(char)(res[i]+'0');
		}
	}
	if (ret=="") ret="0";
	return ret;
}
string add(string a,string b){
	if (a.length()<b.length()) swap(a,b);
	while (a.length()!=b.length()){
		b='0'+b;
	}
	for (int i=a.length()-1;i>=0;i--){
		a[i]+=(b[i]-'0');
		if (a[i]>'9' && i){
			a[i]-=10;
			a[i-1]++;
		}
	}
	if (a[0]>'9'){
		a[0]-=10;
		a='1'+a;
	}
	return a;
}

// cf IO: I64d
// atcoder IO: ｌｌｄ
inline int read()
{
	int x = 0, f = 1; char ch = getchar();
	while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); }
	while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
	return x * f;
}
int main(){
	string s;
	cin>>s;
	int ans=0;
	for (int i=1;i<s.length();i++){
		if (s[i]!=s[i-1]) ans++;
	} 
	printf("%d\n",ans);
	return 0; 
}

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

namespace AtCoder
{

    static class Program
    {
        static void Main()
        {

            Solve();

            //Console.WriteLine(ans);
            Console.ReadKey();
        }

        static void Solve()
        {
            int N = GetInt();
            int D;int X;
            Multi(out D, out X);

            for(int i = 0; i < N; i++)
            {
                X += (D - 1) / GetInt() + 1;
            }

            var ans = X;

            Console.WriteLine(ans);
        }


        static public string GetStr() { return Console.ReadLine().Trim(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }
        static string yesno(this bool b) { return b ? "yes" : "no"; }
        static string YesNo(this bool b) { return b ? "Yes" : "No"; }
        static string YESNO(this bool b) { return b ? "YES" : "NO"; }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
    }
}

Measured memory_bytes: 13268
n = int(input())
a = [int(x) for x in input().split()]
mn = 10**10

for i in range(-100,101):
    count = 0
    for j in range(n):
        if a[j] != i:
            tmp = (a[j] - i)**2
            count += tmp
    if count < mn:
        mn = count

print(mn)    


Measured memory_bytes: 3060
S=input()
a=(str(S)[0])
b=(str(S)[1])
c=(str(S)[2])
d=(str(S)[3])
if(int(a)==int(b)):
  print("Bad")
elif(int(b)==int(c)):
  print("Bad")
elif(int(c)==int(d)):
  print("Bad")
else:
    print("Good")

Measured memory_bytes: 3064
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// modint: mod 計算を int を扱うように扱える構造体
template<int MOD> struct ModInt {
	long long val;
	constexpr ModInt(long long v = 0) noexcept : val(v % MOD) {
		if (val < 0) val += MOD;
	}
	constexpr int getmod() { return MOD; }
	constexpr ModInt operator - () const noexcept {
		return val ? MOD - val : 0;
	}
	constexpr ModInt operator + (const ModInt& r) const noexcept { return ModInt(*this) += r; }
	constexpr ModInt operator - (const ModInt& r) const noexcept { return ModInt(*this) -= r; }
	constexpr ModInt operator * (const ModInt& r) const noexcept { return ModInt(*this) *= r; }
	constexpr ModInt operator / (const ModInt& r) const noexcept { return ModInt(*this) /= r; }
	constexpr ModInt& operator += (const ModInt& r) noexcept {
		val += r.val;
		if (val >= MOD) val -= MOD;
		return *this;
	}
	constexpr ModInt& operator -= (const ModInt& r) noexcept {
		val -= r.val;
		if (val < 0) val += MOD;
		return *this;
	}
	constexpr ModInt& operator *= (const ModInt& r) noexcept {
		val = val * r.val % MOD;
		return *this;
	}
	constexpr ModInt& operator /= (const ModInt& r) noexcept {
		long long a = r.val, b = MOD, u = 1, v = 0;
		while (b) {
			long long t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % MOD;
		if (val < 0) val += MOD;
		return *this;
	}
	constexpr bool operator == (const ModInt& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const ModInt& r) const noexcept {
		return this->val != r.val;
	}
	friend constexpr ostream& operator << (ostream &os, const ModInt<MOD>& x) noexcept {
		return os << x.val;
	}
	friend constexpr ModInt<MOD> modpow(const ModInt<MOD> &a, long long n) noexcept {
		if (n == 0) return 1;
		auto t = modpow(a, n / 2);
		t = t * t;
		if (n & 1) t = t * a;
		return t;
	}
};

const int MOD = 1000000007;
using mint = ModInt<MOD>;

// aのn乗をmodで割った余りを計算
ll mod_pow(ll a, ll n, ll mod) {
	ll result = 1;
	while (n > 0) {
		if (n & 1) result = result * a % mod;
		a = a * a % mod;
		n >>= 1;
	}
	return result;
}

int main() {
	ll N;
	cin >> N;

	mint a = mod_pow(10, N, MOD) - mod_pow(9, N, MOD); // A
	mint b = mod_pow(10, N, MOD) - mod_pow(8, N, MOD); // A または B
	mint c = a - (b - a);

	cout << c << endl;

	return 0;
}


Measured memory_bytes: 3612
class PriorityQueue

  def initialize(heap=[])
    @size = heap.size
    @heap = heap.sort
  end

  # log( log n )
  def push x
    i = @size
    @size += 1
    while i > 0
      par = ( i - 1 ) / 2
      break if @heap[par] <= x
      @heap[i] = @heap[par]
      i = par
    end
    @heap[i] = x
  end

  # log( log n )
  # return nil if @size == 0
  def pop

    ret = @heap[0]
    x = @heap[@size-=1]


    i = 0
    while (child = i * 2 + 1) < @size
      child_1 = i * 2 + 2
      child = child_1 if child_1 < @size && @heap[child_1] < @heap[child]
      break if @heap[child] >= x
      @heap[i] = @heap[child]
      i = child
    end

    @heap[i] = x
    @heap.delete_at(-1)
    ret
  end

  def size
    @heap.size
  end

  def top
    @heap[0]
  end

  def any?
    @size > 0
  end

  def empty?
    @size == 0
  end

  def all
    @heap
  end

  def first
    @heap[0]
  end

  def second
    @size < 3 ? @heap[1] : [@heap[1], @heap[2]].min
  end

  def third
    @size < 3 ? nil : [@heap[1], @heap[2]].max
  end
end

class Array

  include Comparable

  def to_pq
    PriorityQueue.new(self)
  end
end

class Node

  attr_accessor :to, :cost
  def initialize(to, cost)
    @to = to
    @cost = cost
  end
end

# with PriorityQueue O(|E|log|V|)
def dijkstra(g, s)

  # inf = 10 ** 12
  inf = Float::INFINITY
  dist = Array.new(g.size, inf)
  dist[s] = 0

  que = PriorityQueue.new
  que.push( [0, s] )

  while que.any?

    d, v = que.pop
    next if dist[v] < d
    # p g[v]
    g[v].each do |e|
      if dist[e.to] > dist[v] + e.cost
        dist[e.to] = dist[v] + e.cost
        que.push( [dist[e.to], e.to ] )
      end
    end
    # p que
  end

  # dist.map!{|d| d == inf ? "INF" : d }
  dist
end

n = gets.to_s.to_i
# n = gets.to_s.split.map{|t|t.to_i}

G = Array.new(n){ [] }
(n-1).times do
  s, t, d = gets.to_s.split.map{|t|t.to_i}
  s -= 1
  t -= 1
  G[s] << Node.new(t, d)
  G[t] << Node.new(s, d)
end
# pp G
q, k = gets.to_s.split.map{|t|t.to_i}
k -= 1
dist = dijkstra(G, k)
ans = []
q.times do
  x, y = gets.to_s.split.map{|t|t.to_i-1}
  ans << (dist[x] + dist[y])
end

puts ans


# judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A
# http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_1_A
# http://judge.u-aizu.ac.jp/onlinejudge/review.jsp?rid=4445328


Measured memory_bytes: 29404
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		List<Integer> ary = new ArrayList<Integer>();
		for (int i = 0; i < s.length(); i++) {
			ary.add(Character.getNumericValue(s.charAt(i)));
		}

		int[] c = new int[s.length() - 1];
		for (int i = 0; i < s.length() - 1; i++) {
			c[i] = i;
		}
		List<Long> finalList = new ArrayList<Long>();
		for (int i = 0; i < 1 << c.length; i++) {
			List<Integer> list = new ArrayList<Integer>();
			for (int j = 0; j < c.length; j++) {
				if ((i >> j & 1) == 1) {
					list.add(c[j]);
				}
			}
			long ret = 0;
			for (int j = 0; j < ary.size(); j++) {
				if (ret == 0) {
					ret += ary.get(j);
				} else {
					ret = ret * 10 + ary.get(j);
				}
				if (list.contains(j)) {
					finalList.add(ret);
					ret = 0;
				}
			}
			finalList.add(ret);
		}
		long out = 0;
		for (long in : finalList) {
			out += in;
		}
		System.out.println(out);
	}

}

Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;
/* ちゃんと考えてわかって実装 */


int main(void){
    ll n;
    cin >> n;
    ll ans = 0;
    // 中で素因数分解を使う。
    // for ll にしないとTLEになった。
    for(ll i=2; i*i <= n; i++){
        if(n%i != 0) continue;
        ll num = 0;
        while(n%i == 0){
            num++;
            n /= i;
        }
        for(ll j=1; ; j++){
            if(num - j >= 0){
                num -= j;
                ans++;
            }
            else{
                break;
            }
        }
    }
    // 最後、nは1になっているか、素数になっているか。
    if(n != 1){
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3544
import java.util.*;
import java.io.*;

public class Main {
	private static void solve(){
	//Implement solution here.
		int p = ni();
		int q = ni();
		int r = ni();
		System.out.println(Math.min(p +q,Math.min(p + r, q + r)));
		
	}

    //Switch input source (stdin/file)
	private static BufferedReader br  = new BufferedReader(new InputStreamReader(System.in));
	public static void main(String[] args){
        String debugDataPath = System.getenv("DD_PATH");        
        if(debugDataPath != null){
            try{
            	br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
            }catch(Exception e){
                throw new RuntimeException(e);
            }
        }
        solve();
	}

    //Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
    //Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
    //Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
    //Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
    //Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
    //Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}

Measured memory_bytes: 21204
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#include <iomanip>
#include <tuple>
#define ll long long
using namespace std;
double factorial(int n){
    if(n==0){
        return 1;
    }
    else{
        return n*factorial(n-1);
    }
}

double dist(pair<int,int> a,pair<int,int> b){
	return sqrt(pow((a.first - b.first) ,2) + pow((a.second - b.second),2));
}

struct all_init
{
    all_init()
    {
        cout << fixed << setprecision(12);
    }
} All_init;


int main()
{
    ll n;
    cin>>n;
    vector<ll>a(n);
    set<ll>s;
    for(ll i=0;i<n;i++){
        cin>>a[i];
        s.insert(a[i]);
    }
    if(s.size()==a.size()){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
    
    
}


Measured memory_bytes: 11136
import java.util.*;
public class Main {
	static Scanner sc = new Scanner(System.in);
	static int w,h;
	static int[] dx = {-1, -1, -1, 0, 1, 1, 1, 0};
	static int[] dy = {-1, 0, 1, 1, 1, 0, -1, -1};
	static int[][] island;
	
	public static void main(String[] args) {
		while(read()){
			System.out.println(slove());
		}

	}
	static boolean read(){
		w = sc.nextInt();//wÌÇÝæè
		h = sc.nextInt();//hÌÇÝæè
		if(w == 0 && h == 0)
			return false;//wÆhª0ÈçfalseBÂÜèAI¹B
		
		island = new int[h+1][w+1];//Ìì¬
		for(int i = 1; i <= h; i++){
			for(int j = 1; j <= w; j++){
				island[i][j] = sc.nextInt();//ÌÇÝÝ
			}
		}
		return true;
	}
	
	static boolean inField(int x, int y){
		return (x >= 1 && x <= w && y >= 1 && y <= h);
	}
	
	static void dfs(int x, int y){
		island[y][x] = 0;
		for(int k = 0; k < 8; k++){
			int nx = x + dx[k];
			int ny = y + dy[k];
			if(inField(nx, ny) && island[ny][nx] == 1)
				dfs(nx, ny);
		}
	}
	
	static int slove(){
		int count = 0;
		for(int i = 1; i <= h; i++){
			for(int j = 1; j <= w; j++){
				if(island[i][j] == 1){
					count++;
					dfs(j, i);
				}
			}
		}
		
		return count;
	}
}

Measured memory_bytes: 13000
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		int a = 0;
		for(int i=0; i<N.length(); i++) {
			a += Integer.parseInt(N.substring(i,i+1));
		}
		sc.close();
		if(a%9==0) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}

	}

}

Measured memory_bytes: 49928
import math
import copy
 
n,p=map(int,input().split())
a=math.floor(p**(1/n)+1)
#print(a)
for i in range(a,0,-1):
    if i==1:
        print(i)
        break
    p_s=copy.deepcopy(p)
    cnt=0
    while p_s%i==0:
        cnt+=1
        p_s//=i
        if cnt>=n:
            print(i)
            exit()

Measured memory_bytes: 3572
N, W = map(int, input().split())
w = []
v = []
for i in range(N):
    a, b = map(int, input().split())
    w.append(a)
    v.append(b)
    
maxv = sum(v)
dp = [[float('inf')]*(maxv+1) for _ in range(N+1)]
dp[0][0] = 0
for i in range(N):
    for sumv in range(maxv+1):
        if sumv - v[i]  >= 0:
            dp[i+1][sumv] = min(dp[i+1][sumv], dp[i][sumv-v[i]] + w[i])
        dp[i+1][sumv] = min(dp[i+1][sumv], dp[i][sumv])

ans = 0
for sumv in range(maxv+1):
    if dp[N][sumv] <= W:
        ans = sumv
print(ans)

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

int main() {
  int N,s,l,t;
  s = 0;
  cin >> N;
  rep(i,N){
    cin >> l >> t;
    s += (t-l) + 1;
  
  }
  cout << s << endl; 
}


Measured memory_bytes: 256
import java.awt.geom.Path2D;
import java.util.Scanner;


public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(sc.hasNext()){
			Path2D.Double data = new Path2D.Double();
			String[] str = sc.nextLine().split("[\\s]");
			double[] array = new double[8];
		
			for(int i = 0; i < 8; i++){
				array[i] = Double.parseDouble(str[i]);
			}
			data.moveTo(array[0], array[1]);
			data.lineTo(array[2], array[3]);
			data.lineTo(array[4], array[5]);
			
			boolean flag = false;
			
			if(data.contains(array[6], array[7])){
				flag = true;
			}
			print(flag);
		}
	}
	public static void print(boolean tmp) {
		if(tmp)
			System.out.println("YES");
		else {
			System.out.println("NO");
		}
	}
}

Measured memory_bytes: 18468
package main

import "fmt"

func sumEachOrder(n int) int {
	sum := 0
	for {
		sum += n % 10
		n /= 10
		if n <= 0 {
			break
		}
	}
	return sum
}

func main() {
	var N, A, B int
	fmt.Scan(&N)
	fmt.Scan(&A)
	fmt.Scan(&B)

	ans := 0
	for n := 0; n <= N; n++ {
		s := sumEachOrder(n)
		if s >= A && s <= B {
			ans += n
		}
	}
	fmt.Println(ans)
}


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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

int main()
{
    int a,b,c; cin >> a >> b >> c;
    int cnt = 0;
    if(a == b) cnt++;
    if(a == c) cnt++;
    if(b == c) cnt++;
    if(cnt == 1) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3612
#include "bits/stdc++.h"
using namespace std;
#define int long long
signed main(){
  
  int n,c;
  cin >> n >> c;
  
  int wt[n];
  int val[n];
  for(int i=0;i<n;i++){
    cin >> wt[i] >> val[i] ;
  }
  
  int sz=100001;
  int dp[sz] ;
  int ans=0;
  for(int i=0;i<=n;i++){
    
    for(int j=sz-1;j>=0;j--){
      
      
      if(j==0)
        dp[j]=0;
      
      else if(i==0)
        dp[j]=c+1;
      
      else if(val[i-1]<=j)
        dp[j]=min(dp[j],wt[i-1]+dp[j-val[i-1]]);
      
    }
 
  }

  for(int j=0;j<=100000;j++){
    if(dp[j]<=c)
      ans=j;
  }
  
  
  cout<<ans;
  
  return 0;
}


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

using namespace std;

int main()
{
	int t;
	t=1;
	while(t--)
	{
      string a,b;
	  cin>>a>>b;	
	int n,i,j,k; 
	n=a.length();
	
	k=0;
	for(i=0;i<n;i++)
	{
		if(a[i]!=b[i])
        k++;		
	}
	
	cout<< k<<endl;
	}



}


Measured memory_bytes: 3920
#include <iostream>

using namespace std;



int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	long long ans = 0;
	for (int i = 1; i <= n; i++) {
		if (i % 3 && i % 5) {
			ans += i;
		}
	}
	cout << ans << "\n";
}

Measured memory_bytes: 3640
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
using namespace std;

int main()
{
    string s, t;
    int cnt = 0;
    vector<string> vec;
    getline(cin, s);

    while (1) {
        cin >> t;
        if (t == "END_OF_TEXT") break;
        transform(t.cbegin(), t.cend(), t.begin(), ::tolower);
        stringstream ss{t};
        getline(ss, t, ' ');
        vec.push_back(t);
        if (t == s) cnt++;
    }
    cout << cnt << endl;
}


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

int main(){
  int n, q;
  cin >> n >> q;
  vector<int>yoko(n), tate(n);
  yoko[n-1]=tate[n-1]=n-2;
  int yokop=n-1, tatep=n-1;
  int t, x;
  long ret = long(n-2)*long(n-2);
  for(int i=0; i<q; i++){
    cin >> t >> x;
    x--;
    if(t==1){ //yokoを操作
      if(x>yokop)ret -= yoko[x];
      else {
        for(int j=yokop-1; j>=x; j--){
          yoko[j]=yoko[yokop];
        }
        yokop=x;
        tate[tatep]=yokop-1;
        ret -= yoko[x];
      }
    }
    if(t==2){ //tateを操作
      if(x>tatep)ret -= tate[x];
      else {
        for(int j=tatep-1; j>=x; j--){
          tate[j]=tate[tatep];
        }
        tatep=x;
        yoko[yokop]=tatep-1;
        ret -= tate[x];
      }
    }
  }
  cout << ret;
  return 0;
}

Measured memory_bytes: 4464
#include<iostream>
#include<cstdio>
#include<cstring>
#include<vector>
#include<algorithm>
#include<queue>
#include<cmath>
#include<cstdlib>
#define LL long long
#define LD long double
using namespace std;
const int NN=100000 +117;
const int MM=100000 +117;
int read(){
	int fl=1,x;char c;
	for(c=getchar();(c<'0'||c>'9')&&c!='-';c=getchar());
	if(c=='-'){fl=-1;c=getchar();}
	for(x=0;c>='0'&&c<='9';c=getchar())
		x=(x<<3)+(x<<1)+c-'0';
	return x*fl;
}
void open(){
	freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
}
void close(){
	fclose(stdin);
	fclose(stdout);
}

void link(int x,int y){
	printf("%d %d\n",x,y);
}
int m,n;
int c[2]={};
int main(){
	//open();
	n=read();
	int x=n;
	while(!(x&1))x>>=1;
	if(x==1){
		printf("No\n");
		return 0;
	}
	else printf("Yes\n");
	int now=n^1;
	if(now&1){
		for(int i=2;i<n;++i){
			if((now^i)<n){
				c[0]=i,c[1]=now^i;
				break;
			}
		}
	}
	int top=n;
	if(n%2==0)--top;
	for(int i=2;i<=top;++i){
		link(i,1);
		link(i+n,i^1);
		if(c[0]==i)link(i,n);
		if(c[1]==i)link(i,n+n);
	}
	link(n+1,n+2);
	close();
	return 0;
}

Measured memory_bytes: 2304
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String t = sc.next();
		HashMap<String, String> map1 = new HashMap<String, String>();
		HashMap<String, String> map2 = new HashMap<String, String>();
		String ans = "Yes";

		for (int i = 0; i < s.length(); i++) {
			String c1 = s.substring(i, i + 1);
			String c2 = t.substring(i, i + 1);

			if (map1.get(c1) != null) {
				if (!map1.get(c1).equals(c2)) {
					ans = "No";
					break;
				}
			} else {
				map1.put(c1, c2);
			}

			if (map2.get(c2) != null) {
				if (!map2.get(c2).equals(c1)) {
					ans = "No";
					break;
				}
			} else {
				map2.put(c2, c1);
			}
		}

		System.out.println(ans);

		sc.close();
	}

}


Measured memory_bytes: 46008
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
#include <cmath>
#include <queue>
using namespace std;
#define mod (long)(1e9 + 7)
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl(long(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
long power(long base, long exponent, long module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ long root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{-1, 0}, {0, 1}, {1, 0}, {0, -1}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr start, itr goal){ for(auto i = start; i != goal; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<long> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } long C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };

int main(){
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    cout << H * W - (H * w + h * W - h * w) << endl;
}


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

using namespace std;

int main()
{
	int N;
	string S;
	int ans = 0;
	cin >> N >> S;

	const int a_count = 'z' - 'a' + 1;
	int table_l[a_count] = {};
	int table_r[a_count] = {};
	for (int i = 1; i < N; i++)
	{
		for (int j = 0; j < N; j++)
		{
			if (j < i)
			{
				table_l[S[j] - 'a'] = 1;
			}
			else
			{
				table_r[S[j] - 'a'] = 1;
			}
		}

		int cnt = 0;
		for (int j = 0; j < a_count; j++)
		{
			if (table_l[j] == 1 && table_r[j] == 1)
			{
				cnt++;
			}

			table_l[j] = 0;
			table_r[j] = 0;
		}

		if (cnt > ans)
		{
			ans = cnt;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
typedef long long int ll;

int main(){
	int n;
	cin >> n;
	vector<int> x(n), y(n);
	for(int i = 0; i < n; i++) cin >> x[i] >> y[i];
	int res = n;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			if(i == j) continue;
			int p = x[i] - x[j];
			int q = y[i] - y[j];
			int cnt = 1;
			for(int k = 0; k < n; k++){
				for(int l = 0; l < n; l++){
					if(k == i && l == j) continue;
					if(x[k] - x[l] == p && y[k] - y[l] == q) cnt++;
				}
			}
			res = min(res, n - cnt);
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
 
using ll = long long;
using P = std::pair<ll, ll>;

#define rep(i, a, b) for (ll(i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << i << std::endl
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}

template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a<b && (a=b,true);}
 
// const ll MOD = 998244353;
const ll MOD = 1e9 + 7;
 
int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
 
  ll n;
  std::cin>>n;

  std::vector<ll> a(n);
  rep(i,0,n)std::cin>>a[i];

  ll sum=0;
  rep(i,0,n)sum+=a[i];

  if(sum%(n*(n+1)/2)!=0){
    std::cout<<"NO\n";
    return 0;
  }

  sum=sum/(n*(n+1)/2);

  a.push_back(a[0]);

  rep(i,0,n){
    if((a[i+1]-a[i]-sum>0)||(sum+a[i]-a[i+1])%n!=0){
      std::cout<<"NO\n";
      return 0;
    }
  }

  std::cout<<"YES\n";
 
  return 0;
}

Measured memory_bytes: 1792
c=[list(map(int,input().split()))for _ in range(3)]
for i in range(c[0][0]+1):
    b=[c[0][0]-i,c[0][1]-i,c[0][2]-i]
    a=[i,c[1][0]-b[0],c[2][0]-b[0]]
    t=1
    for j in range(3):
        for k in range(3):
            if c[j][k]!=a[j]+b[k]:
                t=0
                break
    if t:
        print('Yes')
        exit()
print('No')

Measured memory_bytes: 38384
import java.util.Scanner;
public class Main{
	public static void main(String[]args){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		String s=sc.next();
		String ans="";
		for(int i=0;i<n;i++) {
			if(i==k-1)ans+=s.substring(i,i+1).toLowerCase();
			else ans+=s.substring(i,i+1);
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 21716
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
const int delta = 1e5;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); } 
template <typename T> void read(T &x) {
	x = 0; int f = 1;
	char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
	for (; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	x *= f;
}
template <typename T> void write(T x) {
	if (x < 0) x = -x, putchar('-');
	if (x > 9) write(x / 10);
	putchar(x % 10 + '0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
bool used[MAXN];
int n, l[MAXN], r[MAXN];
vector <int> hl[MAXN], hr[MAXN];
ll solve(int now, bool flg) {
	for (int i = 1; i <= n; i++) {
		used[i] = false;
		hl[l[i]].push_back(i);
		hr[r[i]].push_back(i);
	}
	ll ans = 0;
	int p = 0, q = 2e5;
	while (true) {
		if (flg) {
			while (q > now && (hl[q].empty() || used[hl[q].back()])) {
				while (q > now && hl[q].empty()) q--;
				while (q > now && !hl[q].empty() && used[hl[q].back()]) hl[q].pop_back();
			}
			if (q == now) break;
			ans += q - now, now = q;
			used[hl[q].back()] = true;
		} else {
			while (p < now && (hr[p].empty() || used[hr[p].back()])) {
				while (p < now && hr[p].empty()) p++;
				while (p < now && !hr[p].empty() && used[hr[p].back()]) hr[p].pop_back();
			}
			if (p == now) break;
			ans += now - p, now = p;
			used[hr[p].back()] = true;
		}
		flg ^= true;
	}
	return ans + abs(now - delta);
}
int main() {
	read(n);
	for (int i = 1; i <= n; i++) {
		read(l[i]), read(r[i]);
		l[i] += delta;
		r[i] += delta;
	}
	writeln(max(solve(delta, false), solve(delta, true)));
	return 0;
}

Measured memory_bytes: 15744
import sys,math
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float('inf')
MOD = 10**9+7
dy = [0,1,0,-1]
dx = [1,0,-1,0]
ddy = [0,1,1,1,0,-1,-1,-1]
ddx = [1,1,0,-1,-1,-1,0,1]

n,k = map(int,input().split())
if math.ceil(n/2) >= k:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define all(x) (x).begin(),(x).end()

using ll = long long;
using ld = long double;
using namespace std;

const ll inf = 2e18;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 5;

string s, t;

void code() {
    cin >> s >> t;

    int ans = 1e9, ind = -1;
    for (int i = 0; i + t.size() - 1 < s.size(); i++) {
        string tmp = s.substr(i, t.size());

        int cnt = 0;
        for (int j = 0; j < t.size(); j++) {
            cnt += (tmp[j] != t[j]);
        }

        ans = min(ans, cnt);
    }

    cout << ans << "\n";
}

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

    int t = 1;
    // cin >> t;

    while (t-- > 0) {
        code();
    }
}

Measured memory_bytes: 3696
#include <bits/stdc++.h>
#define _ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int long long
#define pb push_back
#define sz(i) (int)(i.size())
#define F first
#define S second
#define L long double
#define P pair<int, int>
const int inf = 0x3f3f3f3f3f3f3f3LL;
const int mod = (int)1e9 + 7;
using namespace std;
#if LOCAL
#include "../../tr.h"
#else
#define tr(...)
#define endl '\n'
#endif
template<class T> void smin(T& a, T val) {if (a > val) a = val;}template<class T> void smax(T& a, T val) {if (a < val) a = val;}
const int N = 5*(int)1e5 + 10;

int h, w, n;
int sr, sc;
string s, t;

int32_t main(){_

   cin>>h>>w>>n;
   cin>>sr>>sc;
   cin>>s>>t;

   int x = sr, y = sc;
   for (int i = 0; i < n; ++i)
   {
      if(s[i] == 'L'){
         y--;
      }
      if(y < 1){
         cout<<"NO";
         return 0;
      }
      if(t[i] <= w-1 and t[i] == 'R'){
         ++y;
      }
   }


   x = sr, y = sc;
   for (int i = 0; i < n; ++i)
   {
      if(s[i] == 'R'){
         y++;
      }
      if(y > w){
         cout<<"NO";
         return 0;
      }
      if(y >= 2 and t[i] == 'L'){
         --y;
      }
   }

   x = sr, y = sc;
   for (int i = 0; i < n; ++i)
   {
      if(s[i] == 'U'){
         x--;
      }
      if(x < 1){
         cout<<"NO";
         return 0;
      }
      if(x <= h-1 and t[i] == 'D' and t[i] <= h){
         ++x;
      }
   }

   x = sr, y = sc;
   for (int i = 0; i < n; ++i)
   {
      if(s[i] == 'D'){
         x++;
      }
      if(x > h){
         cout<<"NO";
         return 0;
      }
      if(x >= 2 and t[i] == 'U'){
         --x;
      }
   }

   cout<<"YES";

   return 0;
}

// Common sense: do smth instead of nothing
// Even a single second counts...
// If other's can do it, even I can do it. It wouldn't be that tough. Let me give it a try.
// Mistakes made in past
// -Ques. ask for max-min => think binary_search, DP, greedy
// -not reading question properly / skipping to read & understand all samples properly & wasting time in wrong direction.
// -Using wrong indexing in nested loops something like a[i], when it is supposed to be a[j](WA)
// -value of const int N is not correct (WA/RTE).
// -Did you memset dp to -1 ?
// -check for small edges cases and work on small test cases manually if WA
// -not deallocating memory to pointers can lead to MLE. Use delete :))
// -not reading problem statements of harder problems E,..., thinking it couldn't be solved, but it isn't the case.
// -Avoid using #define int long long as much as possible when it's dp problem and requires high memory say, O(N^2, N=5000) (MLE)
// -Check Bitwise Operator Precedence 
// -Use pragmas to optimize (by constant factor) when necessary..
// -Think before coding & starting to debug. Have patience to look inside code and actually see how it works


Measured memory_bytes: 920
#include <stdio.h>

int main(){
    int n, k, sum = 0, i;
    scanf("%d", &n);
    scanf("%d", &k);
    int h[n];
    for(i = 0; i < n; i++){
        scanf("%d", &h[i]);
        if(h[i] >= k){
            sum++;
        }
    }
    printf("%d", sum);
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
 
#define clr(i, j)     memset(i, j, sizeof(i))
#define pb            push_back
 
typedef long long     ll;
 
//-*-*-*-*-*-*-*-*-



ll n,m,k,a,x,y,ans;
 vector<pair<ll,ll>>v;
 // vector<ll>v;
vector<pair<ll,ll>>vv;

int main()
{ 
 //clr(dp,0);
 /*
 ll f[99999];
cin>>a>>n>>m;
for(int i=0;i<n;i++){
   cin>>x>>y;v.push_back({x,y});
}sort(v.begin(),v.end());
   for(int i=0;i<m;i++){
   cin>>x>>y;
   f[x]=min(y,f[x]);
}
for(int i=0;i<a;i++){
   nxt=v[t].first;ll o=
   if(f[i]&&i<=nxt){dp[t]=min(dp[i]+s*)}
}*/
cin>>a>>n>>m;
cout<<(m/a)*n;
}





Measured memory_bytes: 256
<?php
$i=1;
while(true){
    //??\?????????????????????
    $stdin=trim(fgets(STDIN));
    //0?????\??????????????¨??????10000??\??????????????????????????????break
        if($stdin==0 || 10000 < $i){
            break;
        }
        //??´??°x???1??\???10000??\????????????????????????
        if(1<=intval($stdin) && intval($stdin) <= 10000){
            echo "Case ".$i.": ".intval($stdin)."\n";
            //????????????????¢???????
            $i++;
        }
}

Measured memory_bytes: 15120
#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
#include <cstdlib> 
#include <math.h>
#include<cstdio>
#include<cstring>
#define FOR(I, A, B) for (ll I = (A); I <= (B); I++)
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fo(i,n) for(ll i=0;i<n;i++)
#define sz(a) ll((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define dbg(x) cout << #x << " = " << x << endl
#define dbg2(x,y) cout << #x << " = " << x << ", " << #y << " = " << y << endl
#define dbg3(x,y,z) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << endl
#define dbg4(x,y,z,q) cout << #x << " = " << x << ", " << #y << " = " << y << ", " << #z << " = " << z << ", " << #q << " = " << q << endl
#define scan(char_array) scanf("%[^\n]s",&char_array);



ll isgood[100005];
ll siize[100005];
vector<ll> adj[100005];

int main(){

	IOS
	ll n,m;
	cin>>n>>m;
	fo(i,100005){
		isgood[i]=1;
		siize[i]=0;
	}
	FOR(i,1,n) cin>>siize[i];
	ll aa,bb;
	fo(i,m){
		cin>>aa>>bb;
		adj[aa].pb(bb);
		adj[bb].pb(aa);


	}
	ll cnt=0;
	FOR(i,1,n){
		bool can=true;
		for(auto jj:adj[i]){
			if(siize[i]>siize[jj]) ;
			else can=false;

		}
		if(can) cnt++;
	}
	cout<<cnt<<endl;





	
}

Measured memory_bytes: 11060
import java.util.*;

public class Main {
       public static void sort(int array[], int left, int right){
        if(left <= right){
            int p = array[(left + right) >>> 1];
            int l = left;
            int r = right;
            while(l <= r){
                while (array[l] < p){
                    l++;
                }
                while (array[r] > p){
                    r--;
                }
                if (l <= r){
                    int tmp = array[l];
                    array[l] = array[r];
                    array[r] = tmp;

                    l++;
                    r--;
                }
            }
            Main.sort(array, left, r);
            Main.sort(array, l, right);
        }
    }
    
    public static void main(String[] args) throws Exception {
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int a[] = new int[n];
        boolean flag = true;
        
        for(int i = 0; i < n; i++){
            a[i] = stdIn.nextInt();
        }
        
        sort(a, 0, n - 1);
        
        for(int i = 1; i < n; i++){
            if(a[i - 1] == a[i]){
                flag = false;
                break;
            }
        }
        
        if(flag){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
        
    }
}


Measured memory_bytes: 64868
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;

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

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

int main() {
  ll A, B;
  cin >> A >> B;

  ll ans = 1;  // 1
  map<ll, ll> mA = prime_factor(A);
  map<ll, ll> mB = prime_factor(B);

  for (auto iter = mA.begin(); iter != mA.end(); iter++) {
    ll Fi = iter->fi;
    if (mB.find(Fi) != mB.end())
      ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256