akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back((a))
#define all(x) (x).begin(),(x).end()
#define uniq(x) sort(all(x)),(x).erase(unique(all(x)),end(x))
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

#define INF 2147483600123456789

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

  vector<long> x(m),y(m),t(m);
  rep(i,m) cin>>x[i]>>y[i]>>t[i];
  rep(i,m) x[i]--, y[i]--;

  long v0,a,b,c;
  cin>>v0>>a>>b>>c;

  vector<vector<pair<long, int>>> vec(2*n*c, vector<pair<long,int>>());
  rep(i,m) rep(j,c){
    long cost = j*t[i];
    long nj = (j*a+b)%c;
    vec[x[i]*c+j].pb(mp(cost, y[i]*c+nj));
    vec[y[i]*c+j].pb(mp(cost, x[i]*c+nj));

    x[i] += n;
    if(y[i]!=n-1) y[i]+=n;
    vec[x[i]*c+j].pb(mp(cost, y[i]*c+nj));
    vec[y[i]*c+j].pb(mp(cost, x[i]*c+nj));
    x[i] -= n;
    if(y[i]!=n-1) y[i]-=n;
  }

  vector<long> d(2*n*c, INF);
  d[v0] = 0;
  priority_queue<pair<long, int>, vector<pair<long,int>>, greater<pair<long,int>>> pq;
  pq.push(mp(0,v0));
  while(!pq.empty()){
    auto p = pq.top(); pq.pop();
    long dd = p.fi, idx = p.se;
    if(dd > d[idx]) continue;
    for(auto pp : vec[idx]){
      long nd = dd + pp.first;
      int ni = pp.second;
      if(nd < d[ni]){
        pq.push(mp(nd, ni));
        d[ni] = nd;
      }
    }
  }

  long ans = INF;
  rep(i,c) ans = min(ans, d[n*c+i]);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 28448
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

//# include <ext/pb_ds/assoc_container.hpp>
//# include <ext/pb_ds/tree_policy.hpp>

//using namespace __gnu_pbds;
using namespace std;
 
//template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

inline void Input_Output () {
	//freopen(".in", "r", stdin);
   //freopen(".out", "w", stdout);
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9;
const int N = 6e5 + 123;                                          
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
 
int n, m, k;
char a[12][2020];
int cnt[21][2020];

int ptr, lst;
int cur;
vector < int > id[12];
		

int Now () {
	int now = 0;
	for (int j = 0; j <= cur; ++j) {
		if (id[j].empty()) continue;

		int l = id[j][0];
		int r = id[j].back() + 1;

		now = max(now, cnt[r][ptr] - cnt[r][lst] - cnt[l][ptr] + cnt[l][lst]);
	}
	return now;
	
}

int main () {
	SpeedForce;
	cin >> n >> m >> k;
	for (int i = 1; i <= n; i ++)
		for (int j = 1; j <= m; ++j) {
			cin >> a[i][j];
			cnt[i][j] = cnt[i-1][j] + cnt[i][j-1] - cnt[i-1][j-1] + (a[i][j] == '1');
		}

	int ans = inf;
	for (int msk = 0; msk < (1 << (n-1)); ++msk) {
		int res = __builtin_popcount(msk);
		for (int j = 0; j < 12; ++j) id[j].clear();
		cur = 0;
		for (int i = 0; i < n; ++i) {
			id[cur].pb(i);
			if (msk & (1 << i)) ++cur;
		}
		ptr = 1;
		lst = 0;
		while (ptr <= m) {
			if (Now() <= k)
				++ptr;
			else {
				if (ptr - lst == 1) {
					res = inf;
					break;
				}
				++res;
				lst = ptr-1;
			}
		}
		//cout << msk << ' ' << res << '\n';
		ans = min(ans, res);
	}

	cout << ans << '\n';
	//printf("%d", ans);
	return Accepted;
}

// B...a

Measured memory_bytes: 384
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using static System.Console;
using static System.Math;

namespace Atcoder
{
    class Program
    {
        static StreamWriter sw = new StreamWriter(OpenStandardOutput()) { AutoFlush = false };
        static void Main(string[] args)
        {
            try
            {
                SetOut(sw);
                Solve.Answer();
                Out.Flush();
            }
            catch (Exception ex)
            {
                WriteLine(ex.ToString());
            }
        }
    }

    public class Solve
    {
        public static void Answer()
        {
            var N = IO.RInt;
            var a = IO.RSInt;
            var ans = 0;
            for (int i = 0; i < N; i++)
            {
                if (i % 2 == 1) continue;
                else
                {
                    if (a[i] % 2 == 1) ans++;
                }
            }
            WriteLine(ans);
        }
    }

    public class IO
    {
        #region Input
        public static int RInt => int.Parse(ReadLine());
        public static long RLong => long.Parse(ReadLine());
        public static double RDouble => double.Parse(ReadLine());

        public static string[] RSString => ReadLine().Split();
        public static int[] RSInt => ReadLine().Split().Select(s => int.Parse(s)).ToArray();
        public static long[] RSLong => ReadLine().Split().Select(s => long.Parse(s)).ToArray();
        public static double[] RSDouble => ReadLine().Split().Select(s => double.Parse(s)).ToArray();
        #endregion

        #region Output
        public static void OutJoinSpace<T>(IEnumerable<T> list) => WriteLine(string.Join(" ", list));
        public static void WriteLineYes_or_No(bool flag) => WriteLine(flag ? "Yes" : "No");
        public static void WriteLineYES_or_NO(bool flag) => WriteLine(flag ? "YES" : "NO");
        #endregion
    }

    public class Mod
    {
        #region
        private readonly static long M = 1000000007;

        public static long Add(long a, long b) => (a * b) % M;
        public static long Sub(long a, long b) => (a - b) % M >= 0 ? (a - b) % M : (a - b) % M + M;
        public static long Multi(long a, long b) => (a * b) % M;
        #endregion
    }
}

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

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

    int N; cin >> N;

    double sum = 0.0;
    rep(i,N) {
        int A; cin >> A;
        sum += 1.0 / A;
    }

    cout << fixed << setprecision(10) << 1 / sum << endl;

    return 0;
}


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

signed main(void)
{
	int a, b, c;
	long long k;
	cin >> a >> b >> c >> k;
	if (k % 2 == 0)
		cout << a - b << endl;
	else
		cout << b - a << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repl(i,n) for(int64_t i=0;i<(int64_t)(n);i++)
#define MAX_N 10000000 //10^7
#define ll int64_t
#define all(v) (v).begin(),(v).end()
using namespace std;

int main() {
    int n; cin>>n;
    cout<<180+(n-3)*180<<endl;
}

Measured memory_bytes: 256
open Scanf
open Printf
    
let ($) f x = f x
let string2charlist s = let rec proc i res =
                          try proc (i+1) $ s.[i]::res
                          with Invalid_argument _ -> res
  in List.rev $ proc 0 []


let rec ocaunt = function
    [] -> 0
  | x::xs -> if x=='o' then 1+ocaunt xs else ocaunt xs;;

printf "%d" $ 700 + 100 * ocaunt (string2charlist $ read_line ()) ;;


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i, l, r) for(register int i = l; i < r; i++)
#define hrp(i, l, r) for(register int i = l; i <= r; i++)
#define rev(i, r, l) for(register int i = r; i >= l; i--)
#define pb push_back
#define int ll
#ifndef JOEON
#define D(...)
#define R(x, l)
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
template<typename tn> inline tn next(void);
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v);
int w[50000];
signed main(void)
{
	#ifdef JOEON
//		freopen("C:\Users\Joeon\Desktop\IN.txt", "r", stdin);
//		freopen("C:\Users\Joeon\Desktop\OUT.txt", "w", stdout);
	#endif
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k, cnt = 0;
	cin>>n>>k;
	while(k--)
	{
		int p = next<int>();
		while(p--) w[next<int>()] = 1;
	}
	R(w, 100);
	hrp(i, 1, n) if (!w[i]) cnt++;
	cout<<cnt<<endl;
	return 0;
}
template<typename tn> inline tn next(void)
{
	tn k;
	cin>>k;
	return k;
}
template<typename tn> inline ostream& operator << (ostream& os, const vector<tn>& v)
{
	rep(i, 0, v.size()) os<<v[i]<<' ';
	return os;
}


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

int main(){
	int n, s;

	while(true){
		cin >> n;
		if(n == 0){
			break;
		}
		s = 1;

		if(n == 1 || n == 2 || n == 3){
			cout << "deficient number" << endl;
			continue;
		}
		for(int i = 2; i * i <= n; i++){
			if(n % i == 0){
				s = s + i;
				if(i != n / i){
					s = s + n / i;
				}
			}
		}
		if(n == s){
			cout << "perfect number" << endl;
		}
		else if(n > s){
			cout << "deficient number" << endl;
		}
		else if(n < s){
			cout << "abundant number" << endl;
		}

	}
}

Measured memory_bytes: 0
N = int(input())
B = list(map(int,input().split()))

for i in range(N):
    if i+1 < B[i]:
        print(-1)
        exit()

ans = []
for i in range(N):
    b = B[i]
    ans.insert( b-1, b)

for a in ans:
    print(a)


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

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var Vs = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var Cs = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            var ret = Vs.Select((x, i) => Vs[i] - Cs[i] > 0 ? Vs[i] - Cs[i] : 0).Sum();
            Console.WriteLine(ret);
        }
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main(void) {
    int H, W;
    cin >> H >> W;
    vector< vector<int> > canvas(H+2, vector<int>(W+2));
    for(int i=1; i<=H; i++) {
        for(int j=1; j<=W; j++) {
            char s;
            cin >> s;
            if(s == '#') {
                canvas[i][j] = 1;
            }
        }
    }
    for(int i=1; i<=H; i++) {
        for(int j=1; j<=W; j++) {
            if(canvas[i][j] == 1 && canvas[i-1][j] + canvas[i][j-1] + canvas[i+1][j] + canvas[i][j+1] == 0) {
                cout << "No" << endl;
                return 0;
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    static long gcd (long a, long b) {return b>0?gcd(b,a%b):a;}
    static long lcm (long a, long b) {return a*b/gcd(a,b);}

    
    public static void main(String args[]) {

        Scanner sc = new Scanner(System.in);
        long A = sc.nextLong()-1;
        long B = sc.nextLong();
        long C = sc.nextLong();
        long D = sc.nextLong();
        
        long cc = (B/C)-(A/C);
        long dc = (B/D)-(A/D);
        long lcm = lcm(C, D);
        
        long ccd = (B/lcm)-(A/lcm);
        System.out.println(B-A-cc-dc+ccd);
    }
}

Measured memory_bytes: 21972
#include <stdio.h>

int main(void)
{
	
	//与えられる秒S
	int S;
	
	//時間、分、秒
	int hr, min, sec;
	
	scanf("%d", & S);
	
	hr = S / 3600;
	
	S = S % 3600;
	
	min = S / 60;
	
	S = S % 60;
	
	sec = S;
	
	//出力
	printf("%d:%d:%d\n", hr, min, sec);
	
	return 0;
}

Measured memory_bytes: 592
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}

//INSERT ABOVE HERE
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(0);

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

  while(1){
    c-=b;
    if(c<=0) drop("Yes");
    a-=d;
    if(a<=0) drop("No");
  }

  return 0;
}


Measured memory_bytes: 3644
import itertools
import math

n , m , r = map(int , input().split())
rr = list(map(int,input().split()))
q = len(rr)
INF = 1145141919810364364334

p = list(itertools.permutations(rr))

d = [[INF] * n for _ in range(n)]

for i in range(n):
    d[i][i] = 0
    
for i in range(m):
    a,b,c = map(int , input().split())
    d[a-1][b-1] = c
    d[b-1][a-1] = c
    
for k in range(n):
    for i in range(n):
        for j in range(n):
            d[i][j] = min( d[i][j] , d[i][k] + d[k][j] )
            
ans = INF
for i in p:
    temp = 0
    for j in range(q-1):
        temp += d[i[j] - 1][i[j+1] - 1]
        
    ans = min(ans , temp)
    
print(ans)

Measured memory_bytes: 69848
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Set;
import java.io.IOException;
import java.util.stream.Collectors;
import java.io.InputStreamReader;
import java.util.stream.Stream;
import java.util.StringTokenizer;
import java.io.BufferedReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        C solver = new C();
        solver.solve(1, in, out);
        out.close();
    }

    static class C {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.Int();
            String[] S = new String[N];
            for (int i = 0; i < N; i++) {
                S[i] = in.next();
            }
            Set<String> set = Arrays.stream(S).collect(Collectors.toSet());
            out.println(set.size());
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 74628
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

ll gcd(ll a, ll b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

const string YES = "POSSIBLE";
const string NO = "IMPOSSIBLE";

void solve(long long N, long long K, std::vector<long long> A)
{
    SORT(A);

    if (K < A[0] || A[N - 1] < K)
    {
        cout << NO << endl;
        return;
    }
    ll gcd_ans = A[0];

    for (int i = 0; i < N; i++)
    {
        gcd_ans = gcd(gcd_ans,A[i]);
    }

    if( K % gcd_ans == 0){
        cout << YES << endl;
    }else{
        cout << NO << endl;
    }
}

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


Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mp(a,b) make_pair(a,b)
#define big 1000000007
#define all(a) sort((a).begin(),(a).end()) //ソートのマクロ
#define Re(a) reverse((a).begin(),(a).end())
#define YN(a) if(a){cout<<"Yes"<<endl;}else cout<<"No"<<endl;//条件によってYes、Noを出力する
const int MOD=1000000007;
const double pi = 3.141592653589793;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n;
    cin>>n;
    vector<string> s(n);
    map<string,int> p;
    rep(i,n){
        cin>>s[i];
        p[s[i]]++;
    }
    cout<<"AC x "<<p["AC"]<<endl;
    cout<<"WA x "<<p["WA"]<<endl;
    cout<<"TLE x "<<p["TLE"]<<endl;
    cout<<"RE x "<<p["RE"]<<endl;
}


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

int main()
{
    long long N, M;
    string S;
    cin >> N >> M >> S;

    if (S.front() != '0')
    {
        cout << -1 << endl;
    }
    if (S.back() != '0')
    {
        cout << -1 << endl;
    }

    reverse(S.begin(), S.end());
    vector<bool> over(S.size());
    for (int i = 0; i < over.size(); i++)
    {
        over[i] = S[i] == '0';
    }

    bool now = true;
    long long count = 0;
    vector<pair<bool, long long>> comp;
    for (int i = 0; i < over.size(); i++)
    {
        if (now != over[i])
        {
            comp.push_back(make_pair(now, count));
            now = over[i];
            count = 1;
        }
        else
        {
            count++;
        }
    }
    if (count > 0)
    {
        comp.push_back(make_pair(now, count));
    }

    vector<long long> ans;
    long long current = 0;
    long long idx = 0;
    long long remain = comp[0].second - 1;
    while (N > 0)
    {
        long long m = M;
        long long sum = 0;
        while (m > 0)
        {
            if (remain == 0)
            {
                if ((idx + 1) < comp.size() && comp[idx + 1].second < m)
                {
                    m -= comp[idx + 1].second + 1;
                    sum += comp[idx + 1].second + 1;
                    idx += 2;
                    remain = comp[idx].second - 1;
                }
                else
                {
                    m = 0;
                }
            }
            else
            {
                long long d = min(remain, m);
                sum += d;
                m -= d;
                remain -= d;
            }
        }
        if (sum == 0)
        {
            cout << -1 << endl;
            return 0;
        }
        ans.push_back(min(N, sum));
        N -= sum;
    }
    reverse(ans.begin(), ans.end());
    for (long long a : ans)
    {
        cout << a << " ";
    }
    cout << endl;
}


Measured memory_bytes: 2548
#include<bits/stdc++.h>
#include<cstdio>
#define ll long long int

using namespace std;

int main(){
    int a,b,c;
    cin >> a >> b >> c;

    if(a-b>c){
        cout << 0 << endl;
    }else{
        int ans=c-(a-b);
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
    int H,W,N;
    scanf("%d",&H);
    scanf("%d",&W);
    scanf("%d",&N);
    
    int tem;
    if(H >= W){
        tem = H;
    }else{
        tem = W;
    }
    int cnt=0;
    while(N > 0){
        cnt++;
        N -= tem;
    }
    printf("%d",cnt);
    return 0;
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<PLL> xy(n);
    REP(i,n)cin>>xy[i].first>>xy[i].second;
    SORT(xy);
    LL ans = 100;
    REP(i,n)for(int j = i+1; j < n; j++){
        LL p = xy[j].first - xy[i].first;
        LL q = xy[j].second - xy[i].second;
        LL t = 0;
        REP(k,n){
            LL a = xy[k].first;
            LL b = xy[k].second;
            for(int l = k+1; l < n; l++){
                LL x = xy[l].first;
                LL y = xy[l].second;
                if(x == a + p && y == b + q){
                    t++;
                    break;
                }
            }
        }
        // t = 2 n = 6 -> 4
        ans = min(ans, n - t);
    }
    PUTS(n == 1 ? 1 : ans);
}

Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <iostream>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <vector>

const int mod = 1e9 + 7;
const int kmax = 510000;

long long fact[kmax], fact_inv[kmax], inv[kmax];

int gcd(int a, int b)
{
    if (!b) {
        return a;
    }

    return gcd(b, a % b);
}

void init_comb()
{
    fact[0] = fact[1] = 1;
    fact_inv[0] = fact_inv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < kmax; i++) {
        fact[i] = fact[i - 1] * i % mod;
        inv[i] = mod - inv[mod % i] * (mod / i) % mod;
        fact_inv[i] = fact_inv[i - 1] * inv[i] % mod;
    }
}

long long comb(int n, int r)
{
    if (n < r) {
        return 0;
    }

    if (n < 0 || r < 0) {
        return 0;
    }

    return fact[n] * (fact_inv[r] * fact_inv[n - r] % mod) % mod;
}

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

    std::vector<int> h(n);
    for (int i = 0; i < n; i++) {
        std::cin >> h[i];
    }

    std::vector<int> dp(n, std::numeric_limits<int>::max());
    dp[0] = 0;

    for (int i = 0; i < n; i++) {
        for (int j = 1; j <= k; j++) {
            if (i + j < n) {
                dp[i + j] = std::min(dp[i + j], std::abs(h[i + j] - h[i]) + dp[i]);
            }
        }
    }

    std::cout << dp[n - 1] << std::endl;
}


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

int main(){
    for(int i = 0; i < 10; i++) cout << "+";
    cout << "[";
    for(int i = 3; i <= 12; i++){
        cout << ">";
        for(int j = 0; j < i; j++)  cout << "+";
    }
    for(int i = 3; i <= 12; i++)    cout << "<";
    cout << "-]>";

    vector<int> v(15, 0);
    for(int i = 3; i <= 12; i++){
        v[i] = i*10;
    }
    int pos = 3;
    
    string s;
    cin >> s;
    for(char c : s){
        int x = (int)c;
        while(pos+1 <= x/10)    cout << ">", pos++;
        while(pos-1 >= x/10)    cout << "<", pos--;
        while(v[pos]+1 <= x)    cout << "+", v[pos]++;
        while(v[pos]-1 >= x)    cout << "-", v[pos]--;
        cout << ".";
    }
    return 0;
}


Measured memory_bytes: 3188
n,a,b=gets.split.map &:to_i
a+=b
s=[0,0,0]
gets.chop.chars.each{|x|
  k=-97+x.ord

  if(k==2)
    puts "No"
  elsif(k==0)
    if s[0]+s[1] < a then
      puts "Yes"
      s[0]+=1
    else
      puts "No"
    end
  else
    if s[0]+s[1] < a && s[1] < b then
      puts "Yes"
      s[1]+=1
    else
      puts "No"
    end
  end
}


Measured memory_bytes: 9852
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int n;
    cin >> n;
    map<int,int> m;
    rep(i,n) {
        int a;
        cin >> a;
        m[a]++;
    }
    int ans = 0;
    for (auto itr = m.begin(); itr != m.end(); itr++)
    {
        if (itr->second < itr->first) {
            ans += itr->second;
        } else if (itr->second > itr->first) {
            ans += itr->second - itr->first;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4736
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>

using namespace std;

typedef pair<int, int> coord;

int distance(int x1, int y1, int x2, int y2)
{
  return abs(x1 - x2) + abs(y1 - y2);
}

int main()
{
  int N, M;
  cin >> N >> M;
  vector<coord> students(N);
  vector<coord> checkpoints(M);
  vector<coord> answers(N);
  for (int i = 0; i < N; ++i) cin >> students[i].first >> students[i].second;
  for (int i = 1; i <= M; ++i) {
    int x, y;
    cin >> x >> y;
    for (int j = 0; j < N; ++j) {
      int dist = distance(x, y, students[j].first, students[j].second);
      if (answers[j].first == 0 or dist < answers[j].second) {
        answers[j].first = i;
        answers[j].second = dist;
      }
    }
  }
  for (const auto answer: answers) cout << answer.first << endl;
  return 0;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

#define REP(i,x,y) for(int i=(x);i<(y);i++)
#define RREP(i,x,y) for(int i=(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
//#define int long long

using namespace std;

// conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#else
#define eprintf(...)
#define dump(x)
#define debug(x)
#endif

typedef long long ll;

const ll MOD = 1e9 + 7;

class EFriendships {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int N, K;
	    in >> N >> K;
	    const int maxK = (N-1)*(N-2)/2;
	    if (maxK < K) {
	        out << -1 << "\n";
	        return;
	    }

	    out << (N-1) + (maxK - K) << "\n";
	    REP(i,2,N+1) {
	        out << 1 << " " << i << "\n";
	    }
	    int count = maxK - K;
	    if (count == 0) return;
	    REP(i,2,N) {
	        REP(j,i+1,N+1) {
                if (count == 0) return;
                out << i << " " << j << "\n";
	            count--;
	        }
	    }
	}
};


int main() {
	EFriendships solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

ll solve() {
    ll N, a;
    cin >> N;
    vector<ll> s(N);
    for ( int i = 1; i < N; i++ ) {
        cin >> a;
        a--;
        s[a]++;
    }
    for ( int i = 0; i < N; i++ ) {
        cout << s[i] << "\n";
    }
    return 0;
}

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

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

int main() {
    ll l, r;
    cin >> l >> r;
    ll mod = 2019;
    ll ans = 1e9;
    if (r - l >= mod) {
        cout << 0 << endl;
        return 0;
    }
    for (ll i = l; i < r; i++) {
        for (ll j = i + 1; j <= r; j++) {
            ans = min(ans, i * j % mod);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define rep(i,n) for (int i = 0; i < (n); ++i) 
#define MAX 100000
#define SENTINEL 2000000000
typedef long long ll;
using namespace std;

int partition(int A[], int p, int r)
{
    int x = A[r];
    int t;
    int i = p - 1;
    for ( int j = p; j < r; ++j){
        if (A[j] <= x ) {
            ++i;
            t = A[i]; A[i] = A[j]; A[j] = t;
        }
    }
    t = A[i+1]; A[i+1] = A[r]; A[r] = t;
    return i+1;
}

int main()
{
    int n, A[MAX];
    cin >> n;
    rep(i, n) cin >> A[i];

    int pivot = partition(A, 0, n-1);

    rep(i, n){
        if(i) cout << " ";
        if(i == pivot) cout << "[";
        cout << A[i];
        if(i == pivot) cout << "]";
    }

    cout << endl;
    return 0;
}


Measured memory_bytes: 3392
import java.util.Scanner;

public class Main {

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

//    	File file = new File("test.txt");
//    	Scanner sc = new Scanner(file);
    	Scanner sc = new Scanner(System.in);
    	String N = sc.next();
    	sc.close();
    	System.out.println(N.contains("7")?"Yes":"No");
    }
}

Measured memory_bytes: 35544
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();
        long x = sc.nextLong();
        if (a == 0)
            System.out.println(b / x + 1);
        else
            System.out.println((b / x + 1) - ((a - 1) / x + 1));
    }
}


Measured memory_bytes: 23764
dic = {"A":(0,0), "B":(0,1), "C":(0,2),
       "D":(1,0), "E":(1,1), "F":(1,2),
       "G":(2,0), "H":(2,1), "I":(2,2)}
while True:
    n = input()
    if n == 0:
        break
    dp = [[[0] * 3 for _ in xrange(3)] for _ in xrange(n + 1)]
    s, t, b = raw_input().split()
    dp[0][dic[s][0]][dic[s][1]] = 1
    for i in xrange(n):
        for y in xrange(3):
            for x in xrange(3):
                for dx, dy in ((0, 1), (-1, 0), (0, -1), (1, 0)):
                    if not(0 <= x + dx < 3 and 0 <= y + dy < 3) or dic[b] == (y + dy, x + dx):
                        dp[i + 1][y][x] += dp[i][y][x]
                    else:
                        dp[i + 1][y + dy][x + dx] += dp[i][y][x]
    print "{:.8f}".format(float(dp[n][dic[t][0]][dic[t][1]]) / 4.**n)

Measured memory_bytes: 4384
#include <stdio.h>

int main(void)
{
    int h, n, i, sum = 0, a;

    scanf("%d %d" ,&h, &n);
    for (i = 1; i <= n; i++)
	{
		scanf("%d" ,&a);
		sum += a;
	}

    if (sum >= h)
		printf("Yes");
	else
		printf("No");
	return 0;
}


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

public class Main {

    public static void main(String[] args) throws IOException {
        // write your code here
        Scanner sc = new Scanner(System.in);

        int value = sc.nextInt();
        int numOfOne = sc.nextInt();

        value %= 500;
        if (numOfOne - value >= 0) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 25300
n = int(input())
a = list(map(int,input().split()))

# 最大公約数(greatest_common_divisor)
def gcd(a, b):
  if b == 0:
    return a
  return gcd(b, a%b)

# 最小公倍数(lowest_common_multiple)
def lcm(a, b):
  return a*b//gcd(a,b)

# 最小公倍数と、比べていない数字を比べ、最小公倍数を更新する
alcm = a[0]
for i in a[1:]:
  alcm = lcm(alcm, i)

res = 0

# 関数f
for i in range(n):
  res += (alcm-1) % a[i]

print(res)



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

using namespace std;

int main () {
    int n = 0;
    cin >> n;
    vector<vector<long long>> height(n, vector<long long> (3));
    int non_zero = 0;
    for (int i=0; i<n; i++) {
        cin >> height.at(i).at(0) >> height.at(i).at(1) >> height.at(i).at(2);
    }
    while (height.at(non_zero).at(2) == 0) non_zero++;
    for (int i=0; i<101; i++) {
        for (int j=0; j<101; j++) {
            long long hei = height.at(non_zero).at(2) + abs(i - height.at(non_zero).at(0)) + abs(j - height.at(non_zero).at(1));
            int count = 0;
            for (vector<long long> a : height) {
                if (a.at(2) != max(hei - abs(i - a.at(0)) - abs(j - a.at(1)), 0ll)) break;
                count++;
            }
            if (count == n) {
                cout << i << " " << j << " " << hei << endl;
                return 0;
            }
        }
    }
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>
#define repeat(i, n) for (int i = 0; (i) < (n); ++(i))
#define repeat_from(i, m, n) for (int i = (m); (i) < (n); ++(i))
using namespace std;
template <class T>
void setmax(T &a, T const &b) {
    if (a < b) a = b;
}

template <typename T, typename X>
auto vectors(T a, X x) { return vector<T>(x, a); }

template <typename T, typename X, typename Y, typename... Zs>
auto vectors(T a, X x, Y y, Zs... zs) {
    auto cont = vectors(a, y, zs...);
    return vector<decltype(cont)>(x, cont);
}

int main() {
    string S;
    cin >> S;
    int res = 0;
    repeat(i, S.size()) {
        if (S[i] == 'R') {
            int tmp = 0;
            repeat_from(j, i, S.size()) {
                if (S[j] != 'R') break;
                ++tmp;
            }
            setmax(res, tmp);
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 3572
use proconio::{input, fastout};

#[fastout]
fn main() {
    input! {
        n: usize,
        k: usize,
        mut p: [i64; n],
    }
    p.sort();
    let mut ans = 0;
    for i in 0..k {
        ans += p[i];
    }
    println!("{}", ans);
}


Measured memory_bytes: 2168
#include <iostream>
#include <set>
#include <algorithm>
int main()
{
  int N;
  std::string S;
  std::set<std::string> kind;
  
  std::cin >> N;
  for(int i=0;i<N;i++)
  {
    std::cin >> S;
    kind.insert(S);
  }
  std::cout << kind.size() << std::endl;
  
  return 0;
}

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

int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int x=0;
  int y=0;
  for(int i=0;i<n;i++){
    if(s.at(i)=='I'){
      x++;
    }
    else{
      x--;
    }
    y = max(y,x);
  }
  cout << y << endl;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	ans := 0
	for i := 1; i*i < n; i++ {
		if n%i == 0 {
			j := n / i
			if i < j-1 {
				ans += j - 1
			}
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1788
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  int N;
  cin>>N;
  int h[N];
  REP(i,N)cin>>h[i];
  int c[N][100];
  REP(i,N)REP(j,100){
    if(h[i]>j)c[i][j]=1;
    else c[i][j]=0;
  }
  int ans=0;
  for(int j=99;j>=0;j--){
    int state=0;
    REP(i,N){
      if(c[i][j]==1 and state==0)ans++;
      state=c[i][j];
    }
  }
  // REP(i,N){
  //   REP(j,10)cerr<<c[i][j];
  //   cerr<<endl;
  // }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n;
int a[100000];
int mn,ans=1;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	cin>>a[i];
	vector<int> d;
	for(int i=0;i<n;i++)
	{
		a[i]=-a[i];
	}
	for(int i=0;i<n;i++)
	{
		int pos=upper_bound(d.begin(),d.end(),a[i])-d.begin();
		if(pos==d.size()||d[pos]==a[i])
		d.push_back(a[i]);
		else
		d[pos]=a[i];
	}
	cout<<d.size();
	return 0;
}


Measured memory_bytes: 1276
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))

A.sort(reverse=True)

M = (N-1)//2
ans = 0
ans += 2*sum(A[1:M+1])
ans += A[0]
if N % 2 == 1:
    ans -= A[M]
print(ans)



Measured memory_bytes: 92040
use proconio::input;

const MAX: u128 = 1000000000000000000;

fn main() {
  input! {
    n: usize,
    mut a: [u128; n],
  }
 
  a.sort();

  let mut res = 1_u128;
  for i in 0..n {
    res *= a[i];
    if res > MAX {
      println!("-1");
      return;
    }
  }

  println!("{}", res);
}


Measured memory_bytes: 6136
N=int(input())

sosuu=[2]
sosuu2=[2]
ans=[]

for i in range(3,55556):
    for j in sosuu2:
        if i%j==0:
            break
    else:
        sosuu.append(i)
        if i<=int(55556**0.5)+1:
            sosuu2.append(i)

cnt=0
for j in sosuu:
    if cnt<N-1 and j%5==1:
        print(j,end=" ")
        cnt+=1
    elif cnt==N-1 and j%5==1:
        print(j,end="")
        break

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::pair;
using std::vector;
const int Maxn = 100005, mod = 1e9 + 7;
const long long inf = 0x3f3f3f3f3f3f3f3f;
void cmax( long long &x, long long y )
{
// cout << "x" << x;
 if( y > x )
  x = y;
 return; 
}
int n;
long long f[ Maxn ][ 3 ];
inline long long read( )
{
 int x = 0;
 char ch = getchar( );
 bool f = 0;
 while( !isdigit( ch ) )
  f |= ch == '-',
  ch = getchar( );
 while( isdigit( ch ) )
 {
  x = x * 10 + ch - '0';
  ch = getchar( );
 }
 return f ? -x : x;
}
int main( )
{
 n = read( );
 f[ 0 ][ 0 ] = 0;
 f[ 0 ][ 1 ] = f[ 0 ][ 2 ] = -inf;
 for( int i = 1, x; i <= n; ++i )
 {
  x = read( );
  f[ i ][ 0 ] = std::max( f[ i - 1 ][ 0 ], f[ i - 1 ][ 1 ] );
  f[ i ][ 1 ] = std::max( f[ i - 1 ][ 1 ], f[ i - 1 ][ 2 ] );
  f[ i ][ 2 ] = f[ i - 1 ][ 2 ];
  f[ i ][ 2 ] += x;
  f[ i ][ 1 ] -= x;
  f[ i ][ 0 ] += x;
  if( x < 0 )
   cmax( f[ i ][ 2 ], f[ i ][ 1 ] ),
   cmax( f[ i ][ 1 ], f[ i ][ 0 ] );
//  cout << f[ i ][ 0 ] << " " << f[ i ][ 1 ] << " " << f[ i ][ 2 ] << '\n';
 }
 printf( "%lld", std::max( f[ n ][ 0 ], std::max( f[ n ][ 1 ], f[ n ][ 2 ] ) ) );
 return 0;
}

Measured memory_bytes: 6100
#include<cstdio>
#include<cstring>

typedef long long LL;

const int N = 20;
char s[N];

LL dp[N], a[N], cnt[N];

int main(){
	while(~scanf("%s", s)){
		int n = strlen(s);
		for(int i=1; i<=n; i++){
			a[i] = s[i-1] - '0';
		}
        dp[0] = 0;
        cnt[0] = 1;
        for(int i=1; i<=n; i++){
			LL p = 1;
			LL cur = 0;
			dp[i] = 0;
			cnt[i] = 0;
			for(int j=i; j>=1; j--){
				cur = a[j] * p + cur;
				p *= 10;
                dp[i] = dp[i] + cur * cnt[j-1] + dp[j-1];
				cnt[i] += cnt[j-1];
			}
        }
        printf("%lld\n", dp[n]);
	}
	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string str1;
    int N;
    int con=0;
  
    cin >> str1;
    cin >> N;

    for(int i=1; i<=N; i++){
        string str2;
        cin >> str2;
	str2 = str2+str2;

      if(str2.find( str1 )!=string::npos){
          
         con+=1;
        }
        }

    cout << con << endl;

    return 0;

}

Measured memory_bytes: 0
/*  In the name of ALLAH */

#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and Constants    *******/

#define int long long
#define ull unsigned long long 
#define ld long double
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i < k ; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define debug(a) cout << #a << ": " << a << endl
#define Flag(n) cout << "here " << n << endl
#define w(x) int x;cin>>x;while(t--)
#define mp make_pair
#define pb push_back

#define endl '\n';
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int POSITIVE_INFINITY = 9223372036854775807;
const int NEGATIVE_INFINITY = -9223372036854775807;
const int MOD = 1000000007;
const ld PI = acos(-1.0);
 

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif



int32_t main() {
    io;
    // freopen("input.txt","r",stdin); 
    // freopen("output.txt","w",stdout);
  
    string a,b;
    cin>>a>>b;
    int cnt=0;
    for(int i = 0;i<a.size();i++) cnt += a[i]!=b[i];
    cout<<cnt<<endl;
 

 
    
 
    return 0;
}


Measured memory_bytes: 3764
#include<iostream>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
using namespace std;
#define rep(i,s,n) for(int i = s;i<n;i++)
#define repe(i,s,n) for(int i = s;i<=n;i++)
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
static const ll maxLL = (ll)1 << 62;
const int mod=1e9+7;

ll gcd(ll a, ll b)
{
   if(b==0)return a;
   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;
    ll a[100010];
    rep(i,0,n)cin>>a[i];
    sort(a,a+n,greater<ll>());
    
    ll x=a[0];
    rep(i,1,n){
        if(x%a[i]!=0)x=lcm(x,a[i]);
    }
    cout<<x<<endl;
    return 0;
}

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

typedef long long ll;

ll F[100005];
const ll mod = 1000000007LL;

ll extgcd(ll a, ll b, ll &x, ll &y){
  ll g = a;
  x = 1;
  y = 0;
  if(b != 0){
    g = extgcd(b, a%b, y, x);
    y -= (a / b) * x;
  }
  return g;
}
ll modinv(ll a, ll m=mod){
  ll x,y;
  if(extgcd(a,m,x,y) == 1) return (x + m) % m;
  return -1;
}

ll mult( ll a, ll b ){
  return a * b % mod;
}

ll cnb(ll a, ll b){
  if( a < b ) return 0LL;
  return mult( mult( F[a], modinv( F[b] ) ), modinv( F[a-b] ) );
}

ll n;

void add(ll &a, ll b){
  a += b;
  a += mod;
  a %= mod;
}

int main(){
  cin >> n;
  vector<int> A(n+1,-1);

  F[0] = 1LL;
  for(ll i=1;i<=n+2;i++)
    F[i] = mult( i, F[i-1] );

  ll x=-1;
  for(int i=0;i<n+1;i++){
    int a; cin >> a;
    if( A[a] != -1 ) {
      assert(x==-1);
      x = A[a];
      x += n - i;
    }
    A[a] = i;
  }
  assert(x!=-1);

  cout << n << endl;
  for(ll k=2;k<=n+1;k++){
    ll res = cnb(n+1,k);
    ll sm = cnb(x,k-1);
    add(res, -sm);
    cout << res << endl;
  }
}

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

int main(){
  int N; cin >> N;
  int A,B; cin >> A >> B;
  int l=0,m=0,n=0;
  int p;
  for(int i=0; i<N; i++){
    cin >> p;
    if(p<=A) l++;
    else if(p<=B) m++;
    else n++;
  }
  cout << min(l,min(m,n)) << endl;
}

Measured memory_bytes: 256
def main():
  ans = 0
  n = int(input())
  l = list(map(int, input().split()))
  l.sort(reverse=True)
  for i in range(len(l)):
    if i % 2 == 0:
      ans += l[i]
    else:
      ans -= l[i]
  print(ans)

if __name__ == '__main__':
  main()

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#define ll long long
#define fi first
#define se second
#define pb push_back
#define me memset
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
using namespace std;
typedef pair<int,int> PII;
typedef pair<long,long> PLL;

int a,b;

int main() {
    ios::sync_with_stdio(false);
    cin>>a>>b;
     if(a>b) puts("safe");
     else puts("unsafe");


    return 0;
}

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

int main () {
    string s;
    cin >> s;
    vector<char> a(s.size());
    rep(i, s.size()) {
        a.at(i) = s.at(i);
    }
    if (a.at(2) == a.at(3) && a.at(4) == a.at(5)) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
/**
 *		author:  zvm
 *		created: 25.09.2020 16:30:44
**/

#include <bits/stdc++.h>

using namespace std ;

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

	char x, y ;
	cin >> x >> y ;
	cout << ( x < y ? "<" : ( x > y ? ">" : "=" ) ) << endl ;
}


Measured memory_bytes: 3624