akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vb=vector<bool>;
using vvb=vector<vb>;
using vd=vector<double>;
using vvd=vector<vd>;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pll=pair<ll,ll>;
using tll=tuple<ll,ll>;
using tlll=tuple<ll,ll,ll>;
using vs=vector<string>;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rep(i,n) range(i,0,n)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define range(i,a,n) for(ll i=(a);i<(n);i++)
#define LINF ((ll)1ll<<60)
#define INF ((int)1<<30)
#define EPS (1e-9)
#define MOD (1000000007ll)
#define fcout(a) cout<<setprecision(a)<<fixed
#define fs first
#define sc second
#define PI (3.1415926535897932384)

int dx[]={1,0,-1,0,1,-1,-1,1},dy[]={0,1,0,-1,1,1,-1,-1};
template<class T>bool chmax(T&a,T b){if(a<b){a=b; return true;}return false;}
template<class T>bool chmin(T&a,T b){if(a>b){a=b; return true;}return false;}
template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
int sgn(const double&r){return (r>EPS)-(r<-EPS);} // a>0  : sgn(a)>0
int sgn(const double&a,const double&b){return sgn(a-b);} // b<=c : sgn(b,c)<=0

template<class T>void puta(T&&t){cout<<t<<"\n";}
template<class H,class...T>void puta(H&&h,T&&...t){cout<<h<<' ';puta(t...);}
template<class S,class T>void tf(bool b,S t,T f){if(b)puta(t);else puta(f);}
void YN(bool b){tf(b,"YES","NO");}
void Yn(bool b){tf(b,"Yes","No");}
void yn(bool b){tf(b,"yes","no");}
template<class S,class T>ostream&operator<<(ostream&os,pair<S,T>p){os<<"["<<p.first<<", "<<p.second<<"]";return os;};
template<class S>auto&operator<<(ostream&os,vector<S>t){bool a=1;for(auto s:t){os<<(a?"":" ")<<s;a=0;}return os;}
template<class S>auto&operator>>(istream&is,vector<S>&t){for(S&a:t)cin>>a;return is;}

/*他のライブラリを入れる場所*/
ll n;
vvl edge;


ll solve(ll p=0){
    ll ret=0;
    vl len;
    if(edge[p].size()==0){
        ret = 0;
    }else{
        for(auto&child:edge[p]){
            len.push_back(solve(child));
        }
        sort(rall(len));
        rep(i,len.size()){
            chmax(ret, len[i]+i);
        }
        ret+=1;
    }
    // puta(p, ret);
    return ret;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n;
    edge.resize(n);
    range(i,1,n){
        ll t;cin>>t;t--;
        edge[t].push_back(i);
    }
    // rep(i,n)puta(i,":",edge[i]);
    puta(solve());
    return 0;
}

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

bool func(int x)
{
	bool flag = true;

	for (int i = 3; i <= sqrt(x); i += 2) {
		if (x%i == 0) {
			flag = false;
			break;
		}
	}

	return flag;
}

int main()
{
	while (true) {
		int a, d, n;
		cin >> a >> d >> n;

		if (a == 0 && d == 0 && n == 0) {
			break;
		}

		int count = 0;
		a -= d;

		while (count != n) {
			a += d;

			if (a == 2) {
				count++;
			}
			else if (a % 2 == 1 && a > 1) {
				if (func(a) == true) {
					count++;
				}
			}
		}

		cout << a << endl;
	}

	return 0;
}

Measured memory_bytes: 3080
import java.util.HashSet;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        HashSet<String> set = new HashSet<>();
        for (int i = 0; i < n; i++) {
            set.add(sc.next());
        }
        if(set.size() == 4) {
            System.out.println("Four");
        } else {
            System.out.println("Three");
        }
    }
}

Measured memory_bytes: 35696
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
using namespace std;
#include <vector>
#define rep(i,n) for (int i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

/*
#include <math.h>
int standerd = int(pow(10.0,9.0)) + 7;
*/
string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 
 

int main(){


    string S;
    
    cin >> S;

    if(S.substr(2,1)==S.substr(3,1)){
        if(S.substr(4,1)==S.substr(5,1)){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }


    }else{
        cout << "No" << endl;

    }

}

Measured memory_bytes: 256
/*Remember: The Struggle Is Important*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

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

#define     int          long long int
#define     fast() 	     ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)       x.begin(),x.end()
#define     mem(a,b)     memset(a,b,sizeof(a))
#define     gcd(a,b)     __gcd((a),(b))
#define     lcm(a,b)     ((a)*(b))/gcd((a),(b))
#define     pb           push_back
#define     ins          insert
#define     F            first
#define     S            second

const int inf=1e18,MOD=1e9+7;

int n;
vector<int> v,c;

int f(int in,int x,int y)
{
 if(in==n)
 return x-y;

 int res1=f(in+1,x,y);
 int res2=f(in+1,x+v[in],y+c[in]);

 return max(res1,res2);
}

void solve()
{
 cin>>n;

 v=c=vector<int>(n);

 for(int i=0;i<n;++i)
 cin>>v[i];

 for(int i=0;i<n;++i)
 cin>>c[i];

 cout<<f(0,0,0);
}

int32_t main()
{
 fast();

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

 return 0;
}



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

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

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

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

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

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

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

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

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

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

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;

fn main() {
    input!{
      s: chars,
    }
    for i in 0..3 {
        if s[i] == s[i+1] {
            println!("{}", "Bad");
            return
        }
    }
    println!("{}", "Good");
}


Measured memory_bytes: 4352
import java.io.*;
import java.math.*;
import java.util.*;






public class Main {

    static MyScanner in = new MyScanner();
    static   PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    int N;
    static int max = 200001;
    static int [] dr = {1,-1,0,0};
    static int [] dc={0,0,-1,1};
    static boolean [][] grid;
    static int [] bishopr = {-1,1,-1,1};
    static int [] bishopc = {1,1,-1,-1};
    static long H,W,cnt;
    public static void main(String args[]) throws IOException {
          BigDecimal A = new BigDecimal(in.next());
          BigDecimal B  = new BigDecimal(in.next());
          BigDecimal db = A.multiply(B);
          long answer = db.longValue();
          out.println(answer);
        out.flush();
        }
       static boolean isValid (int r, int c){
           if(r>=0&&r<H&&c>=0&&c<W){
               return true;
           }
           return false;
       }
        private static void dfs(int r, int c) {
            for(int i=0;i<4;i++){
                int nr = bishopr[i] +r;
                int nc = bishopc[i]+c;
                if(isValid(nr, nc)&&!grid[nr][nc]){
                    cnt++;
                    grid[nr][nc] = true;
                    dfs(nr, nc);
                }
            }
        }

        static boolean isEven(long a) {
            return (a&1)==0;
        }
       static  void swap (int a, int b){

        int temmp = b;
        b=a;
        a = temmp;
        }
    

    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;
   
        public MyScanner() {
           br = new BufferedReader(new InputStreamReader(System.in));
        }
   
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
   
        int nextInt() {
            return Integer.parseInt(next());
        }
   
        long nextLong() {
            return Long.parseLong(next());
        }
   
        double nextDouble() {
            return Double.parseDouble(next());
        }
   
        String nextLine(){
            String str = "";
        try {
           str = br.readLine();
        } catch (IOException e) {
           e.printStackTrace();
        }
        return str;
        }
  
     }
}

Measured memory_bytes: 33336
#include <bits/stdc++.h>
#define ALL(v) std::begin(v), std::end(v)
#define ALLR(v) std::rbegin(v), std::rend(v)
using ll = std::int64_t;
using ull = std::uint64_t;
using pll = std::pair<ll, ll>;
using tll = std::tuple<ll, ll, ll>;
template <typename T> using vec = std::vector<T>;
template <typename T> using vvec = vec<vec<T>>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return vec<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
using namespace std;
int main() {
    ll a, b, m;
    cin >> a >> b >> m;
    vec<ll> av(a), bv(b);
    for (ll &e : av) cin >> e;
    for (ll &e : bv) cin >> e;
    ll ans = *min_element(ALL(av)) + *min_element(ALL(bv));
    while (m--) {
        ll x, y, c;
        cin >> x >> y >> c;
        x--; y--;
        ll tmp = av[x] + bv[y] - c;
        chmin(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1920
import sys


def get_sliding_minimum_element(nums, k):
    res = []
    queue = []
    for i, v in enumerate(nums):
        if queue and queue[0] <= i - k:
            queue = queue[1:]
        while queue and nums[queue[-1]] > v:
            queue.pop()
        queue.append(i)
        if i + 1 >= k:
            res.append(nums[queue[0]])
    return res


b = [0 for _ in range(1000000)]
deq = [0 for _ in range(1000000)]

line = sys.stdin.readline()
n, l = map(int, line.split())
arr = list(map(int, input().split()))
s = 0
t = 0
for i in range(n):
    while s < t and arr[deq[t - 1]] >= arr[i]:
        t -= 1
    deq[t] = i
    t += 1
    if i - l + 1 >= 0:
        b[i - l + 1] = arr[deq[s]]
        if deq[s] == i - l + 1:
            s += 1

for i in range(n-l+1):
    if i == n - l:
        print(str(b[i]), end='')
    else:
        print(str(b[i]) + " ", end='')
print("\n", end='')



Measured memory_bytes: 141188
#include <iostream>
using namespace std;
int main()
{

	int n, m;
	char cstr[100][2], str[1000000];

	cin >> n;

	while (n != 0){

		for (int i = 0; i < n; i++) cin >> cstr[i][0] >> cstr[i][1];

		cin >> m;

		for (int i = 0; i < m; i++){
			cin >> str[i];
			for (int j = 0; j < n; j++){
				if (str[i] == cstr[j][0]){
					str[i] = cstr[j][1];
					break;
				}
			}
		}

		for (int i = 0; i < m; i++) cout << str[i];

		cout << endl;

		cin >> n;

	}

}

Measured memory_bytes: 1252
#include<iostream>
#include<string>

using namespace std;

class Dice {
private:
	int label[6];

public:
	Dice() {}

	void set_label(int i)
	{
		cin >> label[i];
	}
	void action(char s) 
	{
		int temp;
		if (s == 'N')
		{
			temp = label[0];
			label[0] = label[1];
			label[1] = label[5];
			label[5] = label[4];
			label[4] = temp;
		}
		if (s == 'E')
		{
			temp = label[0];
			label[0] = label[3];
			label[3] = label[5];
			label[5] = label[2];
			label[2] = temp;
		}
		if (s == 'W')
		{
			temp = label[0];
			label[0] = label[2];
			label[2] = label[5];
			label[5] = label[3];
			label[3] = temp;
		}
		if (s == 'S')
		{
			temp = label[0];
			label[0] = label[4];
			label[4] = label[5];
			label[5] = label[1];
			label[1] = temp;
		}
	}
	void print()
	{
		cout << label[0] << "\n";
	}
};

int main()
{
	Dice One;

	for (int i = 0; i < 6; i++) {
		One.set_label(i);
	}

	string order;
	cin >> order;

	for (int i = 0; i < order.length(); i++) {
		One.action(order[i]);
	}
	
	One.print();
}

Measured memory_bytes: 1208
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
    string w;
    cin >> w;
    transform(w.begin(),w.end(),w.begin(),::tolower);
    int n = 0;
    while(1)
    {
        string t;
        cin >> t;
        if(t == "END_OF_TEXT")
        {
            cout << n << endl;
            return 0;
        }
        transform(t.begin(),t.end(),t.begin(),::tolower);
        if(w == t)
        {
            n++;
        }
    }
}

Measured memory_bytes: 1192
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>

int main()
{
	long long a = 0, b = 0, c = 0, d = 0, e = 0, min = 0, ma = 0, ans = 0,count=0;
	bool okada = true;
	long long number[100000];
	using namespace std;

	cin >> a >> b;
	
	
	cout<< a-b+1<<endl;

}





Measured memory_bytes: 256
load = list()
for i in range(3):
  a, b = list(map(int, input().split()))
  load.append(a)
  load.append(b)
error = 0
for i in range(1, 5):
  if load.count(i) >= 3:
    error += 1
if error >= 1:
  print("NO")
else:
  print("YES")

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

#define rep(i, n) for(int i=0; i < n; i++)
#define REP(i, n, m) for(int i=n; i < m; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

const ll INF = 1LL << 60;

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

int main() {
  int a,b,c,d,e;
  cin>>a>>b>>c>>d>>e;
  if(a==0){cout<<1;return 0;}
  if(b==0){cout<<2;return 0;}
  if(c==0){cout<<3;return 0;}
  if(d==0){cout<<4;return 0;}
  if(e==0){cout<<5;return 0;}
}

Measured memory_bytes: 3584
////////////////////////////////////////////////////////////////////
// This source code is for Visual Studio
////////////////////////////////////////////////////////////////////
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <iterator>
#include <stack>
#include <functional>
#include <iomanip>
#include <string>
#include <cstring>
#include <deque>
#include <math.h>
#include <assert.h>

#define	numberof(a)	(sizeof(a) / sizeof(a[0]))
#define	INF32		INT32_MAX
#define	INF64		INT64_MAX
#define Rep(i,n) for(int i = 0; i < (n); ++i )

using namespace std;

typedef vector< vector<int> > MAT;
typedef pair<int, int> PINT;
typedef long long ll;
typedef uint32_t u32;
typedef uint64_t u64;
typedef int32_t s32;
typedef int64_t s64;

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

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

// main function
int main()
{
	ll N = 0;
	ll ret = INF64;

	cin >> N;
	vector<ll> A(N, 0);

	Rep(i, N) {
		cin >> A[i];
	}
	sort(A.begin(), A.end());

	for (ll i = 1; i < N; ++i) {
		ll tmp = gcd(A[0], A[i]);
		ret = min(ret, tmp);
	}

	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <stack>
#include <cassert>
#include <string>
#include <cmath>
#include <iomanip>

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

#define st first
#define nd second

const int MAXN = 1e5 + 5, inf = 1e9;
const ll INF = 1e18, mod = 1e9 + 7;
const ld PI = 3.1415926535897932384626433832795;

int cnt[MAXN], n;
ll dp[MAXN], a[20][20];
bool vis[MAXN], used[MAXN];

vector<int> G[MAXN];
vector<ll> V;
set<ll> S;
map<ll, int> M;
stack<ll> St;
queue<ll> Q;

ll solve(int mask) {
    ll res = 0;
    for (int i = 0; i < n; i++) {
        if (mask & (1 << i)) {
            for (int j = i + 1; j < n; j++) {
                if (mask & (1 << j)) {
                    res += a[i][j];
                }
            }
        }
    }
    return res;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout << setprecision(13) << fixed;

    //////////////////////////////////////////
    //////////////////////////////////////////

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

    for (int mask = 1; mask < (1 << n); mask++) {
        dp[mask] = solve(mask);
        for (int submask = mask; submask; submask = (submask - 1) & mask) {
            dp[mask] = max(dp[mask], dp[submask] + dp[mask ^ submask]);
        }
    }

    cout << dp[(1 << n) - 1] << "\n";
}


Measured memory_bytes: 3072
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>

using namespace std;
#define ALL(a) (a).begin(), (a).end()
#define REP(i, n) for (size_t i = 0; i < (n); i++)
#define nvec(T, v, n) vector<T> v(n); REP(i, n) {cin>>(v)[i];}
#define npairs(T1, T2, v, n) vector<pair<T1, T2>> v(n); REP(i, n){cin>>v[i].first>>v[i].second;}
#define ntuples(T1, T2, T3, v, n) vector<tuple<T1, T2, T3>> v(n); REP(i, n){cin>>get<0>(v[i])>>get<1>(v[i])>>get<2>(v[i]);}
#define vec2d(T, v, m, n) vector<vector<T>> (v)(m, vector<T>(n))
#define nvec2d(T, v, m, n) vec2d(T, v, m, n); REP(j, m){REP(i, n) {cin>>(v[j])[i];}}

#define min_index(v) size_t( min_element(all(v)) - (v).begin() )
#define max_index(v) size_t( max_element(all(v)) - (v).begin() )
#define min_e(v) *min_element(ALL(v))
#define max_e(v) *max_element(ALL(v))

#define count_le(v, a) size_t( upper_bound(ALL(v), a) - (v).begin() )
#define count_lt(v, a) size_t( lower_bound(ALL(v), a) - (v).begin() )
#define count_ge(v, a) size_t( (v).end() - lower_bound(ALL(v), a) )
#define count_gt(v, a) size_t( (v).end() - upper_bound(ALL(v), a) )

#define order(neq_sl) [](const auto s, const auto l){return neq_sl;}
#define make_lr(v,type,l,r) vector<type> l(n+1),r(n+1);FOR(i,n){l[i+1]=l[i]+v[i];r[i+1]=r[i]+v[n-1-i];}

#define acm accumulate
#define SUM(v) accumulate(ALL(v), 0l)
#define SORT(v) sort(ALL(v))

#define GCD(v) gcd(ALL(v), 0l)

/*template <typename T>
T gcd(T a, T b) {
    if (a > b) swap(a, b);
    if (a == 0) return b;
    return gcd(b%a, a);
}
template <typename InputItr, typename T>
T gcd(InputItr first, InputItr last, T init) {
    for (; first != last; ++first) init = gcd(init, *first);
    return init;
}*/

template <typename T>
using vec =vector<T>;

template <typename T>
using vvec =vector<vector<T>>;

int main(){
  string s;
  cin>>s;
  int p = 0;
  for (char c: s) {
    p += (c - '0');
    p %= 9;
  }
  if(p==0)cout<<"Yes"; else cout<<"No";
}


/* きょむ〜 */


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

#define all(x) (x).begin(), (x).end()
#define pb push_back

typedef long long ll;
typedef pair<int,int> pi;
typedef vector<int,int> vi;

int N,A,B,C;
int l[8];

int dfs(int cur,int a,int b,int c){
	if(cur==N){
		if(a>0&&b>0&&c>0)
			return abs(a-A)+abs(b-B)+abs(c-C)-30;
		else
			return 1e+9;
	}

	int take0=0,take1=0,take2=0,take3=0;
	take0=dfs(cur+1,a,b,c);
	take1=dfs(cur+1,a+l[cur],b,c)+10;
	take2=dfs(cur+1,a,b+l[cur],c)+10;
	take3=dfs(cur+1,a,b,c+l[cur])+10;
	return min(take0,min(take1,min(take2,take3)));

}

int main(){
	cin>>N>>A>>B>>C;
	for (int i = 0; i < N; ++i){
		cin>>l[i];
	}

	cout<<dfs(0,0,0,0)<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>

using namespace std;

typedef long long ll;

int N, X;
int S[200 + 10];

const ll MOD = 1000000007;
ll dp[201][100001];

int main() {
	cin >> N >> X;
	for (int i = 0; i < N; i++)cin >> S[i];

	sort(S, S + N);
	for (int i = 0; i <= X; i++)dp[0][i] = i;
	for (ll i = 0; i < N; i++) {
		for (int j = 0; j <= X; j++) {
			//初めに入れる or 途中に入れる
			dp[i + 1][j] += dp[i][j] * i;
			dp[i + 1][j] %= MOD;
			
			dp[i + 1][j] += dp[i][j % S[i]];
			dp[i + 1][j] %= MOD;
		}
	}

	cout << dp[N][X] << endl;
	return 0;
}

Measured memory_bytes: 157312
#include<functional>
#include<algorithm>
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define all(v) (v).begin(),(v).end()
#define pf push_front
#define pb push_back
#define int long long
using namespace std;
const int INF=1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};


signed main(){
  int S;
  cin>>S;
  int h=S/3600;
  int m=(S-h*3600)/60;
  int s=(S-h*3600-m*60);
  cout<<h<<':'<<m<<':'<<s<<endl;

  return 0;
}

Measured memory_bytes: 3076
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    a=input().split()
    print('A'+a[1][0]+'C')

if __name__ == '__main__':
    main()


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

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

    int e[m];
    for(int i = 0; i < m; i++)  scanf("%d", e+i);

    bool used[200001] = {};

    for(int i = m-1; i >= 0; i--){
        if(used[e[i]])  continue;

        used[e[i]] = true;
        printf("%d\n", e[i]);
    }

    for(int i = 1; i <= n; i++) if(!used[i])    printf("%d\n", i);
    
    return 0;
}


Measured memory_bytes: 3808
#include <stdio.h>
#include <math.h>
#include <stdbool.h>
  
int main(void) {
    int n = 0;
    int num[2001] = {};
    int a = 0;
    int q = 0;
  
    int i = 0;
    int j = 0;
  
    scanf("%d", &n);
  
    for (i = 0; i < n; i++) {
        scanf("%d", &a);
  
        num[0] = 1;
  
        for (j = 2000; j >= 0; j--) {
            if (num[j] && j + a < 2001)
                num[j + a] = 1;
        }
    }
  
    scanf("%d", &q);
  
    for (i = 0; i < q; i++) {
        scanf("%d", &a);
  
        if (num[a])
            printf("yes\n");
        else
            printf("no\n");
    }
  
    return 0;
}

Measured memory_bytes: 1812
#include <stdio.h>

int main()
{
  int i, j, k, l, n;
  int m[101][101], p[101];
  
  scanf("%d", &n);
  
  for(i = 0; i < n; i++){
      scanf("%d%d", &p[i], &p[i+1]);
    }
  
    for (i = 1; i <= n; i++) {
      m[i][i] = 0;
    }
  
    for (l = 2; l <= n; l++) {
      for (i = 1; i <= n - l + 1; i++) {
        j = i + l - 1;
        m[i][j] = 100000000;
        for (k = i; k <= j - 1; k++) {
          if (m[i][j] > m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]) {
            m[i][j] = m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j];
          }
        }
      }
    }
  
  printf("%d\n", m[1][n]);
  
  return 0;
}

Measured memory_bytes: 636
n,k=map(int,input().split())
p=list(map(int,input().split()))
s=[(i+1)/2 for i in p]
cans=sum(s[:k])
ans=cans
for i in range(n-k):
    cans=cans-s[i]+s[i+k]
    ans=max(ans,cans)
print(ans)

Measured memory_bytes: 32132
N = int(input())
maxA = -1
maxV = -1
for l in range(N):
    a,v = [int(i) for i in input().split()]
    if v > maxV:
        maxV = v
        maxA = a
    elif v == maxV:
        maxA = min(a, maxA)
print(maxA, maxV)


Measured memory_bytes: 5600
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        if (N < 3) {
            System.out.println(0);
            return;
        }

        int[] L = new int[N];
        for (int i = 0; i < N; i++) {
            int l = sc.nextInt();
            L[i] = l;
        }
        // ソート
        L = Arrays.stream(L).boxed()
            .sorted(Comparator.reverseOrder())
            .mapToInt(Integer::intValue)
            .toArray();
        int count = 0;
        for (int i = 0; i < N; i++) {
            int Li = L[i];
            for (int j = i + 1; j < N; j++) {
                int Lj = L[j];
                for (int k = j + 1; k < N; k++) {
                    int Lk = L[k];
                    if (Li >= Lj + Lk) {
                        break;
                    }
                    if (Lj >= Li + Lk) {
                        break;
                    }
                    if (Lk < Li + Lj) {
                        count++;
                    }
                }
            }
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 29396
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
#define itrep(type, it, t) for(type::iterator it=t.begin(); it!=t.end(); it++)
using namespace std;

#define MOD (1000000007)

int main(void) {

    int N;
    cin >> N;
    string ans = "APPROVED";
    rep(i, N) {
        int a;
        cin >> a;
        if((a%2)==0) {
            if((a%3) && (a%5)) {
                ans = "DENIED";
            }
        }
    }
    cout << ans;
    
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
#define rev(i, n) for(int i = (int)(n - 1); i >= 0; i--)
#define rev1(i, n) for(int i = (int)(n); i > 0; i--)
#define pb push_back
#define ts to_string
#define all(v) (v).begin(), (v).end()
#define vi vector<int>
#define vvi vector<vector<int>>
#define vc vector<char>
#define vvc vector<vector<char>>
#define vs vector <string>
#define vvs vector <vector<string>>
#define pq  priority_queue<int>
using ll = long long;
/* ----------------よく使う数字や配列----------------- */
int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
const int INF = 2000000000;
constexpr ll mod = 1e9 + 7;
constexpr long double pi = 3.141592653589793238462643383279;
/* ----------------------end----------------------- */
/*---------------------template----------------------*/
/*----------------------end--------------------------*/
/* --------------------ライブラリ--------------------*/
bool isprime(ll a)//素数判定、primeならtrue,違うならfalse
{
    if (a < 2) return false;
    else if (a == 2) return true;
    else if (a % 2 == 0) return false;
    double m = sqrt(a);
    for (int i = 3; i <= m; i += 2)
    {
        if (a % i == 0)
        {
            return false;
        }
    }
    // 素数である
    return true;
}
ll ketasum(ll n) {    //各桁の和
    ll sum = 0;
    while (n != 0) {
        sum += n % 10;
        n /= 10;
    }
    return sum;
}
/* ----------------------end----------------------- */
/*---------------------臨時関数----------------------*/
/*----------------------end-------------------------*/
signed main(){
  int s;cin>>s;
  vector<int>A;
  A.pb(s);
  for(int i=0;;i++){
    int push=A[i]%2==0?A[i]/2:A[i]*3+1;
    auto B=A;
    sort(all(B));
    if(binary_search(all(B),push)){
      cout<<i+2<<endl;
      break;
    }
    else {
      A.pb(push);
    }
  }
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (int)n; i++)
#define REPvec(itr, mp) for(auto itr = mp.begin();itr != mp.end(); itr ++)
#define all(x) x.begin(), x.end()
#define MOD 1000000007//1e9+7
using namespace std;
typedef long long ll;
typedef vector<int >    vecint;
typedef vector<string > vecstr;
int main()
{
  int a, b;
  cin >> a >> b;
  if(a %3 != 0 && b%3 != 0 && (a + b)%3 != 0){
    cout << "Impossible" << endl;
  }else{
    cout << "Possible" << endl;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Arrays;

class Main{
  public static void main(String args[]){
  int vec[] = new int[3];
  Scanner scan = new Scanner(System.in);
  vec[0] = scan.nextInt();
  vec[1] = scan.nextInt();
  vec[2] = scan.nextInt();
  scan.close();
  Arrays.sort(vec);
  int count = 0;
  count = vec[2] - vec[1];
  vec[1] = vec[2];
  vec[0] += count;
  if((vec[1] - vec[0]) % 2 == 0){
    count += (vec[1] - vec[0])/2;
    System.out.println(count);
  }
  else{
    count += (vec[1] - vec[0])/2 +2;
    System.out.println(count);
  }
  }
}


Measured memory_bytes: 21844
n=int(input())
s=input()
e=[0]*n
w=[0]*n
for i in range(n):
  if s[i]=='W':
    w[i]+=1+w[i-1]
    e[i]=e[i-1]
  else:
    e[i]+=1+e[i-1]
    w[i]=w[i-1]
ans=10**6
for i in range(n):
  ans=min(ans,[w[i-1],0][i==0]+(e[-1]-e[i]))
print(ans)

Measured memory_bytes: 17568
N,K[30],A,B,i;
long long x[30],y;
main(){
	scanf("%d%d",&N,K);
	for(i=1;i<30;++i){
		K[i]=*K&1<<i?(*K|(1<<i)-1)^1<<i:0;
	}
	for(;~scanf("%d%d",&A,&B);){
		for(i=0;i<30;++i){
			(A|K[i])<=K[i]&&(x[i]+=B);
		}
	}
	for(i=0;i<30;++i){
		x[i]>y&&(y=x[i]);
	}
	printf("%lld",y);
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
const int mod = 1e9 + 7;
const int INF = 1e9;
const double pi = acos(-1.0);
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
int main(){
    char c; cin >> c;
    cout << ((c<'a')?'A':'a') << endl;
    return 0;
}  

Measured memory_bytes: 3576
<?php
fscanf(STDIN, "%s", $s);

$even = '';
$odd = '';
for($i = 0; $i < strlen($s); $i++) {
    if($i%2==0) {
        $odd .=  $s[$i];
    } else {
        $even .=  $s[$i];
    }
}

if(strpos($odd,'L') === false && strpos($even,'R') === false){
    echo 'Yes';
} else {
    echo 'No';
}

Measured memory_bytes: 4728
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define gcd __gcd
#define all(x) (x).begin(), (x).end()
template<class T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<class T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
const int INF = 1e18, MOD = 1e9 + 7;
signed main() {
    INCANT;
    string s, t;
    map<char, char> m;
    map<char, bool> used;
    cin>>s>>t;
    rep(i, s.size()) {
        if(m[s[i]] == NULL) {
            if(used[t[i]] == true) {
                cout<<"No"<<endl;
                return 0;
            }
            m[s[i]] = t[i];
            used[t[i]] = true;
        }
        if(m[s[i]] != t[i]) {
            cout<<"No"<<endl;
            return 0;
        }
    }
    cout<<"Yes"<<endl;
}


Measured memory_bytes: 916
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
s = [input() for i in range(n)]
l = []
d = defaultdict(int)
ss = set()
for i,j in enumerate(s):
    d[j] += 1
for jj in list(d):
    l.append([jj,d[jj]])
l.sort()
l.sort(key=lambda x:x[1],reverse = True)
max = l[0][1]
# print(l,max)
for i,j in enumerate(l):
    if j[1] == max:
        print(j[0])
    else:
        break


Measured memory_bytes: 131908
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <set>
#include <stdio.h>
#include <math.h>
#include <queue>
#include <stack>
#include <string>
using namespace std;
typedef long long int lli;
const long long int MaxN=3005;
const lli mod=1e9+7;
#define fst first
#define snd second
#define mp make_pair
const float pi=3.1415926535897932384626433832795028;
	lli mcd(lli a,lli b){
		if(a==0)return b;
		return mcd(b%a,a);
	}
	
	priority_queue <lli> pq;
	void solve(){
		lli N,M,i,j,p,q,res=0;
		cin>>N>>M;
		for(i=0;i<N;i++){
			cin>>p;
			pq.push(p);
		}
		while(M--){
			p=pq.top();
			p=p/2;
			pq.pop();
			pq.push(p);
		}
		while(!pq.empty()){
			p=pq.top();
			res+=p;
			pq.pop();
		}
		cout<<res<<"\n";
	}	
int main(){
	//cin.tie(0),ios_base::sync_with_stdio(0);
	lli i,j,t; 
	t=1;
	for(i=1;i<=t;i++){
		solve();
	}
	
}

Measured memory_bytes: 3880
#include <iostream>
#include <string>
#include <map>
#include <queue>
using namespace std;

#define ansstr "111111111222444666555333333333"

class Cube{
public:
    string str;
};

int main(){
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        string str(30, 0);
        for(int j=0;j<30;j++){
            cin >> str[j];
        }

        Cube cube;
        cube.str = str;
        
        queue<Cube> que;
        que.push(cube);

        map<string, int> puz;
        puz[cube.str] = 0;

        while(!que.empty()){
            cube = que.front();
            que.pop();

            if(cube.str == ansstr){
                cout << puz[ansstr] << endl;
                break;
            }

            Cube cube2 = cube;  //right front
            for(int j=0;j<3;j++)
                swap(cube2.str[2+j*3], cube2.str[21+j*3]);
            swap(cube2.str[11], cube2.str[18]);
            swap(cube2.str[12], cube2.str[14]);
            if(puz.find(cube2.str) == puz.end()){
                que.push(cube2);
                puz[cube2.str] = puz[cube.str]+1;
            }

            cube2 = cube;       //left front
            for(int j=0;j<3;j++)
                swap(cube2.str[6+j], cube2.str[21+j]);
            swap(cube2.str[12], cube2.str[17]);
            swap(cube2.str[ 9], cube2.str[11]);
            if(puz.find(cube2.str) == puz.end()){
                que.push(cube2);
                puz[cube2.str] = puz[cube.str]+1;
            }

            cube2 = cube;       //right back
            for(int j=0;j<3;j++)
                swap(cube2.str[0+j], cube2.str[27+j]);
            swap(cube2.str[14], cube2.str[15]);
            swap(cube2.str[18], cube2.str[20]);
            if(puz.find(cube2.str) == puz.end()){
                que.push(cube2);
                puz[cube2.str] = puz[cube.str]+1;

            }

            cube2 = cube;       //left back
            for(int j=0;j<3;j++)
                swap(cube2.str[0+j*3], cube2.str[23+j*3]);
            swap(cube2.str[ 9], cube2.str[20]);
            swap(cube2.str[15], cube2.str[17]);
            if(puz.find(cube2.str) == puz.end()){
                que.push(cube2);
                puz[cube2.str] = puz[cube.str]+1;
            }
        }
    }

    return 0;
}


Measured memory_bytes: 3228
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iN = int.Parse(sS[0]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            string sOut = "No";
            List<int> lst99 = new List<int>();
            for (int i = 1; i <= 9; i++)
            {
                for (int j = 1; j <= 9; j++)
                {
                    lst99.Add(i * j);
                }
            }
            lst99.Sort();
            lst99 = lst99.Distinct().ToList();
            if (lst99.Contains(iN)) { sOut = "Yes"; }

            // 出力
            System.Console.WriteLine("{0}", sOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 13396
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#define rep(i,n) for(int i = 0;i<(n);i++);
#define all(a) (a).begin(),(a).end()
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 10010010010;
typedef pair<ll, ll> P;
const ll mod = 1000000007;
ll gcd(ll a, ll b) {//a>b
	if (a < b)swap(a, b);
	if (a % b == 0) return b;
	else return gcd(b, a % b);
}

int main() {
	ll R, G, B, N;
	cin >> R >> G >> B >> N;//Ra + Gb + Bc = N
	ll n = N / min(R, min(G, B));
	ll ans = 0;
	for (int i = 0; i <= n; i++) {// 1 2 3 4
		for (int j = 0; j <= n; j++) {
			if ((N - i * R - j * G) % B == 0 && N - i * R - j * G >= 0)ans++;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    struct State
    {
        internal int x, y, cnt;

        public State(int x, int y, int cnt)
        {
            this.x = x;
            this.y = y;
            this.cnt = cnt;
        }
    }

    class Problem
    {
        readonly int[] moveX = new int[] { -1, 0, 1, 0 };
        readonly int[] moveY = new int[] { 0, -1, 0, 1 };
        readonly int INF = 1 << 20;
        readonly int w, h;

        int[,] map, memo;
        int sx, sy, minCnt;

        public Problem(int w, int h)
        {
            this.w = w;
            this.h = h;
            map = new int[h, w];
            memo = new int[h, w];
        }

        public int Solve()
        {
            MakeMap();
            minCnt = INF;

            Stack<State> stk = new Stack<State>();
            stk.Push(new State(sx, sy, 0));

            while (stk.Count > 0)
            {
                State cur = stk.Pop();
                memo[cur.y, cur.x] = cur.cnt;

                for (int i = 0; i < 4; i++)
                {
                    int nextX = cur.x + moveX[i];
                    int nextY = cur.y + moveY[i];

                    if (IsValid(nextX, nextY))
                    {
                        int tempCnt = cur.cnt + (map[cur.y, cur.x] == 1 ? 0 : map[nextY, nextX]);

                        if (memo[nextY, nextX] > tempCnt && tempCnt < minCnt)
                        {
                            stk.Push(new State(nextX, nextY, tempCnt));
                        }
                    }
                    else minCnt = Math.Min(minCnt, cur.cnt);
                }
            }
            return minCnt;
        }

        private bool IsValid(int x, int y)
        {
            if (x < 0 || x >= w || y < 0 || y >= h) return false;
            return true;
        }

        private void MakeMap()
        {
            for (int i = 0; i < h; i++)
            {
                string input = Console.ReadLine();

                for (int j = 0; j < w; j++)
                {
                    switch (input[j])
                    {
                        case '#':
                            map[i, j] = 1;
                            break;
                        case '&':
                            sx = j;
                            sy = i;
                            break;
                    }
                    memo[i, j] = INF;
                }
            }
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            while (true)
            {
                string[] input = Console.ReadLine().Split(' ');
                int w = int.Parse(input[0]);
                int h = int.Parse(input[1]);

                if (w == 0 && h == 0) break;

                Problem pb = new Problem(w, h);
                sb.AppendLine(pb.Solve().ToString());
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 10548
#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)
#define ll long long
#define lld long double
#ifdef DEBUG
#define line() cout << "[" << __LINE__ << "] ";
#define dump(i) cout << #i ": " << i << " ";
#define dumpl(i) cout << #i ": " << i << endl;
#else
#define line(i)
#define dump(i)
#define dumpl(i)
#endif
using namespace std;

int main(int argc, char const *argv[])
{
#define int long long
    int n;
    cin >> n;
    pair<int, int> p[n];
    map<pair<int, int>, bool> g;

    rep(i, n)
    {
        cin >> p[i].first >> p[i].second;

        g[{p[i].first, p[i].second}] = true;
    }
    //    sort(p, p + n);
    if (n == 1)
    {
        cout << 1 << endl;
        return 0;
    }
    map<pair<int, int>, int> mp;

    rep(i, n)
    {
        rep(j, i + 1, n)
        {
            int k = 1;
            if (p[i].first - p[j].first < 0 || (p[i].first - p[j].first == 0 && p[i].second - p[j].second < 0))
            {
                k = -1;
            }
            mp[{k * (p[i].first - p[j].first), k * (p[i].second - p[j].second)}]++;
        }
    }
    int now = -1;
    int x = 0, y = 0;
    for (auto itr = mp.begin(); itr != mp.end(); itr++)
    {
        int value = itr->second;
        auto key = itr->first;
        if (now < value)
        {
            now = value;
            x = key.first;
            y = key.second;
        }
    }
    cout << n - now << endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a, b;
  cin >> a >> b;
  if(a < 1 || a > 9 || b < 1 || b > 9){
    cout << -1 << endl;
    return 0;
  }
  cout << a * b << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define int         long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define sz(x)       (int)x.size()
#define endl        "\n"
#define repp(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a,b) 	for(int i=a;i<=b;i++)
#define IOS         ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 
set<int> s;
 
int check(int n,int x)
{
	while(n%x==0)
		n = n/x;
	if(n%x==1)
		return 1;
	return 0;
}
 
void isPrime1(int N)
{
	int i;
	int c=0;
	for(i=2;i*i<=N;i++)    // O(sqrt(n))
	{
		if(N%i==0)
		{
			if(i*i==N)
			{
				s.insert(i);
			}
			else
			{
				s.insert(i);
				s.insert(N/i);
			}
		}
	}
	return;
}
 
void isPrime2(int N)
{
	int i;
	int c=0;
	for(i=2;i*i<=N;i++)    // O(sqrt(n))
	{
		if(N%i==0)
		{
			if(i*i==N && check(N,i)==1)
			{
				s.insert(i);
			}
			else
			{
				if(check(N,i)==1)
					s.insert(i);
				if(check(N,N/i)==1)
					s.insert(N/i);
			}
		}
	}
	return;
}
 
int32_t main()
{
	//IOS;
	//memset(dp,-1,sizeof(dp));	
	int T;
	T = 1;
	while(T--)
	{
		int n;
		cin >> n;
		if(n==1 || n==2)
		{
			cout << "1" << endl;
			return 0;
		}	
		int x =n;
		x--;
		isPrime1(x);
		s.insert(x);
		isPrime2(n);
		cout << s.size()  + 1<< endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 1; i < n; i++)
using namespace std;
 
int main() {
  int n;
  cin>>n;
  bool a=0;
  if(n<=81){
    rep(i,10){
      rep(j,10){
        if(i*j==n){
          a=1;
          break;
        }
      }
    }
  }
  if(a){
    cout<<"Yes";
  }
  else{
    cout<<"No";
  }
  cout<<endl;
}

   


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

int main() {
  int h,w;
  cin >> h >> w;
  int nx[8] = {1,0,-1,0,1,1,-1,-1};
  int ny[8] = {0,1,0,-1,1,-1,1,-1};
  vector<string>s(h);
  rep(i,h) cin >> s[i];
  rep(i,h) rep(j,w){
    if(s[i][j] == '#') continue;
    int c = 0;
    rep(k,8){
      if(i+nx[k] >= 0 && i+nx[k] < h && j+ny[k] >= 0 && j+ny[k] < w){
        if(s[i+nx[k]][j+ny[k]] == '#') c++;
      }
    }
    s[i][j] = '0'+c;
  }
  rep(i,h) cout << s[i] << endl;
}


Measured memory_bytes: 256