akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

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

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

    string s, t; cin >> s >> t;
    if (s[0] == t[2] && s[1] == t[1] && s[2] == t[0]) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int a[200000];
int b[200000];

int main() {
    int n, i, j, k;
    
    scanf("%d", &n);
    
    for (i = 0; i < n; i++) scanf("%d", &a[i]);
    
    for (i = n - 1, j = 0, k = n - 1; i >= 0; ) {
        b[j++] = a[i--];
        if (i >= 0) b[k--] = a[i--];
    }
    
    for (i = 0; i < n; i++) {
        if (i > 0) putchar(' ');
        
        printf("%d", b[i]);
    }
    puts("");
    
    return 0;
}


Measured memory_bytes: 3712
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int A, B; cin >> A >> B;
    if(A <= 9 and B <= 9) cout << A * B << endl;
    else cout << -1 << endl;
    return 0;
}


Measured memory_bytes: 256
import Control.Applicative
    
solve :: Int -> Int

solve
    = id

output :: Int -> Int -> String

output i x
    = "Case " ++ show i ++ ": " ++ show x

loop :: Int -> IO ()
    
loop i
    = do
        input <- read <$> getLine
        case solve input of
            0
                -> return ()
                
            x
                -> do
                    putStrLn $ output i x
                    loop $ i + 1
                    
main :: IO ()
    
main
    = loop 1

Measured memory_bytes: 4120
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
const long long mod = 1e9+7;
long long power(long long a, long long b, long long m = mod) {
    long long x = 1;
    while(b) {
        if(b & 1) {
            x = 1ll * x * a % m;
        }
        a = 1ll * a * a % m;
        b /= 2;
    }
    return x;
}
const int N = 2e5+9;
int a[14][1009];
signed main() {  
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
    
    int n, m, k; cin >> n >> m >> k;
    for(int i = 1; i <= n; i++) {
    	for(int j = 1; j <= m; j++) {
    		char foo; cin >> foo;
    		a[i][j] = foo - '0';
    	}
    }
    int ans = n-1+m-1;
    for(int msk = 0; msk < (1 << (n-1)); msk++) {
    	vector<int> bits;
    	bits.push_back(0);
    	for(int i = 0; i < n-1; i++) {
    		if((msk >> i) & 1) {
    			bits.push_back(i+1);
    		}
    	}
    	bits.push_back(n);
    	bool cant = 0;
    	int p = bits.size();
    	vector<int> sum(p);
    	int cnt = 0;
    	for(int j = 1; j <= m; j++) {
    		int mx = 0;
    		for(int t = 1; t < p; t++) {
    			for(int x = bits[t-1]+1; x <= bits[t]; x++) {
    				sum[t] += a[x][j];
    			}
    			mx = max(mx, sum[t]);
    		}
    		if(mx > k) {
    			cnt++;
    			for(int t = 1; t < p; t++) {
    				sum[t] = 0;
	    			for(int x = bits[t-1]+1; x <= bits[t]; x++) {
	    				// if(msk == 1 && t == 1) {
	    				// 	cout << "$" << a[x][j] << " " << x << " " << j << endl;
	    				// }
	    				sum[t] += a[x][j];
	    			}
		    			if(sum[t] > k) {
		    				// cout << j << " " << t << " " << sum[t] << endl;
		    				cant = 1;
		    				break;
		    			}
	    				
	    			
	    		}
    		}
    		if(cant == 1) break;
    	}
    	if(cant == 0) {
    		if(cnt+__builtin_popcount(msk) == 1000) {
    			cout << msk << " " << cnt << endl;
    		}
	    	ans = min(ans, cnt+__builtin_popcount(msk));
    	}
    }
    cout << ans << "\n";




    return 0;
    
}

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

public class Main {
  public static void main(String[] args) {
    FastScanner fs = new FastScanner();

    int N = fs.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++) A[i] = fs.nextInt();
    Arrays.sort(A);

    int b = 1;
    for (int i = 0; i + 1 < N; i++) if (A[i] == A[i + 1]) b = 0;
    System.out.println((b == 1) ? "YES" : "NO");
  }
}

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;

  private boolean hasNextByte() {
    if (ptr < buflen) {
      return true;
    } else {
      ptr = 0;
      try {
        buflen = in.read(buffer);
      } catch (IOException e) {
        e.printStackTrace();
      }
      if (buflen <= 0) {
        return false;
      }
    }
    return true;
  }

  private int readByte() {
    if (hasNextByte())
    return buffer[ptr++];
    else
    return -1;
  }

  private static boolean isPrintableChar(int c) {
    return 33 <= c && c <= 126;
  }

  public boolean hasNext() {
    while (hasNextByte() && !isPrintableChar(buffer[ptr]))
    ptr++;
    return hasNextByte();
  }

  public String next() {
    if (!hasNext())
    throw new NoSuchElementException();
    StringBuilder sb = new StringBuilder();
    int b = readByte();
    while (isPrintableChar(b)) {
      sb.appendCodePoint(b);
      b = readByte();
    }
    return sb.toString();
  }

  public long nextLong() {
    if (!hasNext())
    throw new NoSuchElementException();
    long n = 0;
    boolean minus = false;
    int b = readByte();
    if (b == '-') {
      minus = true;
      b = readByte();
    }
    if (b < '0' || '9' < b) {
      throw new NumberFormatException();
    }
    while (true) {
      if ('0' <= b && b <= '9') {
        n *= 10;
        n += b - '0';
      } else if (b == -1 || !isPrintableChar(b)) {
        return minus ? -n : n;
      } else {
      throw new NumberFormatException();
      }
      b = readByte();
    }
  }

  public int nextInt() {
    long nl = nextLong();
    if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
    throw new NumberFormatException();
    return (int) nl;
  }

  public double nextDouble() {
    return Double.parseDouble(next());
  }
}

Measured memory_bytes: 25636
array =[]
for i in (0..2)
  array[i]=gets.split(" ").map{|a| a.to_i}
end
answer ="YES"
for i in(1..4)
  num =0
  array.each{|a|
  if a.include?(i) then
    num +=1
  end
  if num ==3
    answer = "NO"
  end
  }
end
puts answer


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define int long long
#define stoi stoll
//#define _GLIBCXX_DEBUG

signed main() {
  string S; cin >> S;
  int N = S.size() + 1;
  
  int ans = 0;
  int k = 0;
  char c = '0';
  int K = 0;
  rep(i, N-1) {
    if(S[i] == '<') {
      if(c == '>') {
        k = 0;
      }
      k++;
      //cout << k;
      ans += k;
      c = '<';
    }
    if(S[i] == '>') {
      if(c == '<') {
        K = k;
        k = -1;
      }
      k++;
      if(k == K) k++;
      //cout << k;
      ans += k;
      c = '>';
    }
  }
  cout << ans << endl;
  
  

}

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

#define ll long long
#define fore(i, n) for(i=0;i<n;i++)

template<typename T>
void output_vector(const vector<T>&v, int start=-1, int end=-1)
{
	if(start<0)start=0;
	if(end<0)end=v.size();
	
	for (int i = start; i < end; i++)
        cout << v[i]<<"\n";
}

int main() {
	
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll n, i, j, k, ctr=0; cin>>n;
	ll a[n];
	fore(i, n)
	    cin>>a[i];
	sort(a, a+n);
	for(i=0;i<n;i++)
	    for(j=i+1; j<n; j++)
	        for(k=j+1; k<n; k++){
	            if(a[i]+a[j]>a[k] && a[i]!=a[j] && a[j]!=a[k]) ctr++;
	        }
	cout<<ctr<<endl;
	return 0;
}

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

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

template<class T, class U> bool chmax(T &a, U b) { if (a < b) a = b; return true; }
template<class T, class U> bool chmin(T &a, U b) { if (a > b) a = b; return true; }

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

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  string s; cin >> s;
  if (s[0] == 'S') cout << "Cloudy\n";
  else if (s[0] == 'C') cout << "Rainy\n";
  else cout << "Sunny\n";

  return (0);
}


Measured memory_bytes: 3624
using System;
using System.Linq;
using System.Collections.Generic;
using System.IO;

namespace atcorder2
{
    class Program
    {
        public static long Read()
        {
            return long.Parse(Console.ReadLine());
        }

        public static long[] Reads()
        {

            return Console.ReadLine().Split().Select(long.Parse).ToArray();
        }

        public static long C(long n, long k)
        {
            long bunbo = 1;
            long bunsi = 1;
            for (long i = n - k; i <= n; i++)
                bunsi *= i;
            for (long i = 1; i <= n - k; i++)
                bunbo *= i;
            return bunsi / bunbo;
        }
        bool f = false;
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            var input = Reads();
            var n = input[0];
            var m = input[1];
            var f = new bool[n];
           
            var pcount =new long[n];
            var acount = 0;
            long ansp = 0;
            for (int i = 0; i < m; i++)
            {
                var str = Console.ReadLine().Split();
                var p = long.Parse(str[0]);
                var s = str[1];
                if (!f[p - 1])
                {
                    if (s == "AC")
                    {
                        acount++;
                        f[p - 1] = true;
                        ansp += pcount[p - 1];
                    }
                    else pcount[p - 1]++;
                }
            }

        
            Console.WriteLine("{0} {1}", acount, ansp);
            
            

          

      


            Console.Out.Flush();
        }
    }
}

Measured memory_bytes: 18132
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
)

var (
	readString func() string
	stdout     *bufio.Writer
)

func init() {
	readString = newReadString(os.Stdin)
	stdout = bufio.NewWriter(os.Stdout)
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
			panic("Scan failed")
		}
		return r.Text()
	}
}

func readInt() int {
	return int(readInt64())
}

func readInt64() int64 {
	i, err := strconv.ParseInt(readString(), 0, 64)
	if err != nil {
		panic(err.Error())
	}
	return i
}

func readIntSlice(n int) []int {
	b := make([]int, n)
	for i := 0; i < n; i++ {
		b[i] = readInt()
	}
	return b
}

func readLengthAndSlice() (int, []int) {
	n := readInt()
	return n, readIntSlice(n)
}

func printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(stdout, f, args...)
}

func println(args ...interface{}) (int, error) {
	return fmt.Fprintln(stdout, args...)
}

func eprintln(args ...interface{}) (int, error) {
	return fmt.Fprintln(os.Stderr, args...)
}

// readString() string
// readInt() int
// readIntSlice(n int) []int
// readLengthAndSlice() []int

// -----------------------------------------------------------------------------

func main() {
	defer stdout.Flush()
	n, v := readLengthAndSlice()
	m := make([]map[int]int, 3)
	m[0] = make(map[int]int)
	m[1] = make(map[int]int)
	m[2] = make(map[int]int)
	i := 0
	for _, x := range v {
		m[i][x]++
		m[2][x]++
		i = 1 - i
	}

	if len(m[2]) == 1 {
		println(n / 2)
		return
	}
	count := make([][]sortTarget0, 2)
	for i := 0; i < 2; i++ {
		for x, c := range m[i] {
			count[i] = append(count[i], sortTarget0{x, c})
		}
		sort.Sort(sortTarget0Slice(count[i]))
	}
	// (1, 100), (2, 50)
	// (1, 99), (2, 2)
	c := count[0][0].count + count[1][0].count
	if count[0][0].val == count[1][0].val {
		if len(count[0]) == 1 {
			c = count[0][0].count + count[1][1].count
		} else if len(count[1]) == 1 {
			c = count[0][1].count + count[1][0].count
		} else {
			a := count[0][0].count + count[1][1].count
			b := count[0][1].count + count[1][0].count
			if a < b {
				c = b
			} else {
				c = a
			}
		}
	}
	println(n - c)
}

// -----------------------------------------------------------------------------

type sortTarget0 struct {
	val, count int
}

type sortTarget0Slice []sortTarget0

func (s sortTarget0Slice) Len() int {
	return len(s)
}

func (s sortTarget0Slice) Less(i, j int) bool {
	return s[i].count > s[j].count
}

func (s sortTarget0Slice) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}


Measured memory_bytes: 15488
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define TEST int t = 1; while(t--) solve()

void solve(){
    
   int n;
   cin>>n;
   set<string> st;
   for(int i=0;i<n;i++)
   {
   	 string s;
   	 cin>>s;
   	 st.insert(s);
   }

   cout<<st.size()<<"\n";
}

signed main(){
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); TEST; return 0;
}

Measured memory_bytes: 19216
#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(ll i=ll(a);i<ll(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define PRINT(V) cout << V << "\n"
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())
using namespace std;
using ll = long long int;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll INF = 1e11;
const ll MOD = 1000000007;
typedef pair<ll,ll> P;
int main(){
    int n,m,k,a;
    int food[31] = {0};
    cin >> n >> m;
    rep(i,n){
        cin >> k;
        rep(j,k){
            cin >> a;
            food[a]++;
        }
    }
    int cnt = 0;
    rep(i,m){
        if (food[i+1] == n) cnt++;
    }
    PRINT(cnt);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=2e5+5;
ll n,a[maxn],b[maxn],c[maxn],cost;
int main()
{
	std::ios::sync_with_stdio(false);
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i]>>b[i];
	}
	sort(a, a + n);
	sort(b, b + n);
	if (n % 2) {
		cout << b[n/2]-a[n/2]+1;
	}
	else {
		cout <<b[n/2-1]+ b[n / 2] - a[n/2]-a[n / 2 - 1] + 1;

	}
}


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

int main() {
  string S, T;
  cin >> S;
  cin >> T;
  
  int N = S.size();
  
  int sum = 0;
  
  for(int i = 0; i < N; i++){
    if(S.at(i) != T.at(i)){
        sum += 1;
    }
  }
  cout << sum << endl;
}


Measured memory_bytes: 3832
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    ll x, y;
    cin >> x >> y;
    if (x % y == 0) cout << -1 << '\n';
    else cout << x * (y - 1) << '\n';
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n,m;
vvi g;
vi vis;

void dfs(int v,int t=0){
	vis[v]=t;
	for(auto u:g[v]) if(vis[u]<0) dfs(u,1-t);
}

int main(){
	cin>>n>>m;
	g=vvi(n);
	for(int i=0;i<m;i++){
		int u,v;
		cin>>u>>v;
		u--,v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	vis=vi(n,-1);
	dfs(0);
	bool B=1;
	for(int i=0;i<n;i++) for(auto j:g[i]) if(vis[i]==vis[j]) B=0;
	if(B){
		cout<<-1<<endl;
		return 0;
	}
	vi d(2*n,inf);
	d[0]=0;
	queue<int> q;
	q.push(0);
	while(!q.empty()){
		int id=q.front(),v=id%n;
		q.pop();
		for(auto u:g[v]){
			int nx=(id<n?u+n:u);
			if(d[nx]==inf){
				d[nx]=d[id]+1;
				q.push(nx);
			}
		}
	}
	int l=0,r=inf;
	while(r-l>1){
		int mid=(l+r)/2;
		bool B=1;
		for(int i=0;i<n;i++) if(d[i+mid%2*n]>mid) B=0;
		if(B) r=mid;
		else l=mid;
	}
	cout<<r<<endl;
}


Measured memory_bytes: 12616
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n,x;
  cin>>n>>x;
  
  vector<int> l(n);
  for(int i=0;i<n;i++){
    cin>>l[i];
  }
  
  int d=0,ans=1;
  
  for(int i=1;i<n+1;i++){
	d+=l[i-1];
    if(d>x){
      cout<<ans<<endl;
      return 0;
    }
    ans++;
  }

  	cout<<n+1<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,m,a,b,count=0;
    std::deque<int> deq;
    cin>>n>>m;
    for (int i=0;i<m;i++) {
        cin>>a>>b;
        if (a<n) {
            deq.emplace_back(b-n);
        } else {
            count++;
        }
    }
    sort(deq.begin(),deq.end());
    int sum=0;
    if (count!=m-1) {
        for (int j=0;j<deq.size()-1;j++) {
            sum+=deq[j];
        }
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 3120
#include <stdio.h>
#include <algorithm>
#include <vector>
using namespace std;

typedef long long ll;

vector<pair<ll, ll> > v[111111];
ll dist[111111];

void dfs(ll parent, ll node, ll len)
{
	ll i;

	dist[node] = len;

	for (i = 0; i < v[node].size(); i++)
		if (parent != v[node][i].first)
            dfs(node, v[node][i].first, len + v[node][i].second);
}

int main(void)
{
    ll n, q, k, i;

    scanf("%lld" ,&n);
    for (i = 1; i < n; i++)
	{
		ll a, b, c;

		scanf("%lld %lld %lld" ,&a, &b, &c);

		v[a].push_back(make_pair(b, c));
		v[b].push_back(make_pair(a, c));
	}
	scanf("%lld %lld" ,&q, &k);

	dfs(0, k, 0);

    while (q--)
	{
		ll x, y;

		scanf("%lld %lld" ,&x, &y);

        printf("%lld\n" ,dist[x] + dist[y]);
	}
	return 0;
}

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

class Main {
    private static final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int n = Integer.parseInt(sc.nextLine());
        int[] nums = Arrays.stream(sc.nextLine().split(" +")).mapToInt(Integer::parseInt).toArray();

        int[] evenCount = new int[100001];
        int[] oddCount = new int[100001];

        for (int i = 0; i < n; i++) {
            if (i % 2 == 0) {
                evenCount[nums[i]]++;
            }
            else {
                oddCount[nums[i]]++;
            }
        }

        int evenMax1 = 0;
        int evenMax2 = 0;
        int oddMax1 = 0;
        int oddMax2 = 0;
        for (int i = 1; i <= 100000; i++) {
            if (evenCount[i] > evenCount[evenMax1]) {
                evenMax2 = evenMax1;
                evenMax1 = i;
            }
            else if (evenCount[i] > evenCount[evenMax2]) {
                evenMax2 = i;
            }

            if (oddCount[i] > oddCount[oddMax1]) {
                oddMax2 = oddMax1;
                oddMax1 = i;
            }
            else if (oddCount[i] > oddCount[oddMax2]) {
                oddMax2 = i;
            }
        }

        if (evenMax1 != oddMax1) {
            System.out.println(n - evenCount[evenMax1] - oddCount[oddMax1]);
        }
        else if (evenCount[evenMax2] >= oddCount[oddMax2]) {
            System.out.println(n - evenCount[evenMax2] - oddCount[oddMax1]);
        }
        else {
            System.out.println(n - evenCount[evenMax1] - oddCount[oddMax2]);
        }


        sc.close();
    }
}


Measured memory_bytes: 50724
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;
public static class P
{
    public static void Main()
    {
        var nc = Console.ReadLine().Split().Select(int.Parse).ToArray();
        var n = nc[0];
        var c = nc[1];
        var d = Enumerable.Repeat(0, c).Select(_ => Console.ReadLine().Split().Select(int.Parse).ToArray()).ToArray();
        var map = Enumerable.Repeat(0, n).Select(_ => Console.ReadLine().Split().Select(x => int.Parse(x) - 1).ToArray()).ToArray();
        List<int>[] count = new[]
        {
            new List<int>(),
            new List<int>(),
            new List<int>()
        };
        for (int i = 0; i < n; i++)
            for (int j = 0; j < n; j++)
                count[(i + j) % 3].Add(map[i][j]);
        int[][] minCost = Enumerable.Repeat(0, 3).Select(x => new int[c]).ToArray();
        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < c; j++)
            {
                minCost[i][j] = count[i].Sum(x => d[x][j]);
            }
        }
        var min = int.MaxValue;
        for (int i = 0; i < c; i++)
        {
            for (int j = 0; j < c; j++)
            {
                if (i == j) continue;
                for (int k = 0; k < c; k++)
                {
                    if (i == k || j == k) continue;
                    var res = 0;
                    res += minCost[0][i];
                    res += minCost[1][j];
                    res += minCost[2][k];
                    min = Min(min, res);
                }
            }
        }
        Console.WriteLine(min);
    }

    static IEnumerable<T[]> Permutations<T>(T[] array) where T : IComparable<T>
    {
        int index = 0;
        yield return array;
        while (true)
        {
            for (int i = array.Length - 1; i > 0; i--)
            {
                if (array[i - 1].CompareTo(array[i]) >= 0) continue;
                int j = Array.FindLastIndex(array, x => array[i - 1].CompareTo(x) < 0);
                T tmp = array[i - 1]; array[i - 1] = array[j]; array[j] = tmp;
                Array.Reverse(array, i, array.Length - i);
                yield return array;
                goto end;
            }
            Array.Reverse(array, index, array.Length);
            yield break;
            end:;
        }
    }
}

Measured memory_bytes: 21584
package main

import (
	"fmt"
	"sort"
)

func main() {
	a := make([]int, 3)

	for i := 0; i < 3; i++ {
		fmt.Scan(&a[i])
	}
	sort.Ints(a)
	ans := a[2] - a[1]
	ans += (a[2] - (a[0] + ans)) / 2
	if (a[1]-a[0])%2 == 1 {
		ans += 2
	}
	fmt.Println(ans)

}


Measured memory_bytes: 512
def slove():
    import sys
    input = sys.stdin.readline
    n = str(input().rstrip('\n'))
    t = 0
    for i in range(len(n)):
        t += int(n[i])
    print("Yes" if int(n) % t == 0 else "No")


if __name__ == '__main__':
    slove()


Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
int ans=10000000;
string s;
int main()
{
   cin>>s;
   int len=s.size();
   for(int i=1;i<len;i++)
   {
       if(s[i]!=s[i-1])
        ans=min(ans,max(i,len-i));
   }
   printf("%d",min(ans,len));
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF = 0x3f3f3f3f;
const int N = 1e5+10;

int main () {
    int h,a;
    cin >>h >> a;
    cout << (h%a==0?h/a:h/a+1)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<utility>
#include<queue>
#include<tuple>
#include<stdio.h>
#define rep(i, n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int long long a, b, c;
	cin>>a>>b>>c;
	if(a+b<c-2*sqrtl(a*b))
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <string>
#include <sstream>
#include <iomanip>
#include <complex>
using namespace std;

#define ll long long
#define vvi vector< vector<int> >
#define All(X) X.begin(),X.end()
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back 
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
	int n,m;
	while(cin >> n >> m){
		cout << (int)log10(n+m)+1 << endl;
	}
}

Measured memory_bytes: 1204
#include <stdio.h>

#define MAX_N 1000000

int isPrime[ MAX_N + 1 ] = { 0, 0, 1 }, num_p[ MAX_N + 1 ] = {};

int main( void ) {
    int i, j, n;

    for ( i = 3; i <= MAX_N; i += 2 )
        isPrime[ i ] = 1;

    for ( i = 3; i * i <= MAX_N; i += 2 )
        if ( isPrime[ i ] )
            for ( j = i * 2; j <= MAX_N; j += i )
                isPrime[ j ] = 0;

    for ( i = 1; i <= MAX_N; i++ )
        num_p[ i ] = num_p[ i - 1 ] + isPrime[ i ];

    for ( ; scanf( "%d", &n ) == 1; printf( "%d\n", num_p[ n ] ) ) ;

    return 0;
}

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

using namespace std;

int main(){
char a, b;
cin >> a >> b;
if(a == 'H' && b == 'H'){
        cout <<"H";
}
else if(a == 'D' && b == 'D'){
    cout <<"H";
}
else if(a == 'D' && b == 'H'){
    cout <<"D";
}
else if(a == 'H' && b == 'D'){
    cout <<"D";
}
}


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

using namespace std;

const int Mod = 924844033;
const int N = 5e3 + 10;

int n, k, mark[N], g[N][N][2];
int fac[N], tot = 0;

int add(int a, int b) {
  return (a += b) >= Mod ? a - Mod : a;
}

int sub(int a, int b) {
  return (a -= b) < 0 ? a + Mod : a;
}

int mul(int a, int b) {
  return 1ll * a * b % Mod;
}

int main() {
  scanf("%d %d", &n, &k);
  fac[0] = 1;
  for (int i = 1; i <= n; i++) {
    fac[i] = mul(fac[i - 1], i);
  }
  for (int i = 1; i <= k; i++) {
    for (int j = i; j <= n; j += k) {
      mark[++tot] = (j != i);
    }
    for (int j = i; j <= n; j += k) {
      mark[++tot] = (j != i);
    }
  }
  g[0][0][0] = 1;
  for (int i = 1; i <= 2 * n; i++) {
    for (int j = 0; j <= i; j++) {
      g[i][j][0] = add(g[i - 1][j][1], g[i - 1][j][0]);
      if (mark[i]) g[i][j][1] = g[i - 1][j - 1][0];
    }
  }
  int ans = 0;
  for (int i = 0; i <= n; i++) {
    if (i & 1) {
      ans = sub(ans, mul(fac[n - i], add(g[2 * n][i][0], g[2 * n][i][1])));
    } else {
      ans = add(ans, mul(fac[n - i], add(g[2 * n][i][0], g[2 * n][i][1])));
    }
  }
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 156160
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
using P = pair<int,int>;
using ivec = vector<int>;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }


const int MOD=1000000007;
int INF=100100100100100;
int add(int a,int b){
  return (a+b)%MOD;
}
int prod(int a,int b){
  return (a*b)%MOD;
}
int a[1010],b[1010];
signed main(){
  int n,m;cin>>n>>m;
  rep(i,n)cin>>a[i];
  rep(i,m)cin>>b[i];
  sort(a,a+n);sort(b,b+m);
  rep(i,n-1){
    if(a[i]==a[i+1]){
      cout<<0<<endl;
      return 0;
    }
  }
  rep(i,m-1){
    if(b[i]==b[i+1]){
      cout<<0<<endl;
      return 0;
    }
  }
  int ans=1;
  for(int num=m*n;num>=1;num--){
    int po1=lower_bound(a,a+n,num)-a;
    int po2=lower_bound(b,b+m,num)-b;
    if(a[po1]!=num && b[po2]!=num){
      (ans*=add(prod(n-po1,m-po2),MOD-(n*m-num)))%=MOD;
    }
    else {
    int res1=n-po1,res2=m-po2;
    if(a[po1]==num)res1=1;
    if(b[po2]==num)res2=1;
    (ans*=prod(res1,res2))%=MOD;
    }
    //cout<<add(prod(n-po1,m-po2),MOD-(n*m-num))<<endl;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;

int main(void)
{
  LL a,b;
  cin >> a >> b;
  // l(4*x), l+1, .. , a, a+1, ... , r(4*y), r+1, ..b;
  // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ <--- XOR is 0
  LL l = a/4*4;
  LL r = b/4*4;
  LL answer = 0ll;
  for(LL i = l; i<a; ++i) answer ^= i;
  for(LL i = r; i<=b; ++i) answer ^= i;
  cout << answer << endl;
  return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
//#include<list>
#include<queue>
#include<deque>
#include<algorithm>
//#include<numeric>
#include<utility>
//#include<memory>
#include<functional>
#include<cassert>
#include<set>
#include<stack>
#include<random>

const int dx[] = { 1, 0, -1, 0 };
const int dy[] = { 0, -1, 0, 1 };
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;

const int MAXN = 200200;
const int MAXM = 2022;
const int MOD = 1e9 + 7;
const int inv2 = 5e8 + 4;
int A[MAXN], B[MAXN];

ll fact[4 * MAXM], rfact[4 * MAXM];
ll dp[2 * MAXM][2 * MAXM];

ll mod_pow(ll x, ll p, ll MOD) {
    ll a = 1;
    while (p) {
        if (p%2) a = a*x%MOD;
        x = x*x%MOD;
        p/=2;
    }
    return a;
}

// mod_inverse
ll mod_inverse(ll a, ll m) {
    return mod_pow(a, m-2, m);
}

ll nCr(int n, int r) {
	return fact[n] * rfact[r] % MOD * rfact[n - r]%MOD;
}

int main() {
	fact[0] = rfact[0] = 1;
	for (int i = 1; i < 4 * MAXM; i++) {
		fact[i] = (fact[i - 1] * i) % MOD;
		rfact[i] = mod_inverse(fact[i], MOD);
	}
	int N;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i] >> B[i];
		dp[MAXM - A[i]][MAXM - B[i]] += 1;
	}
	for (int x = 1; x < 2 * MAXM; x++) for (int y = 1; y < 2 * MAXM; y++) {
		dp[x][y] += dp[x - 1][y] + dp[x][y - 1];
		dp[x][y] %= MOD;
	}
	ll ans = 0;
	for (int i = 0; i < N; i++) {
		(ans += dp[MAXM + A[i]][MAXM + B[i]]) %= MOD;
		(ans -= nCr(2 * A[i] + 2 * B[i], 2 * A[i])) %= MOD;
		if (ans < 0) ans += MOD;
	}
	(ans *= inv2) %= MOD;
	cout << ans << endl;
	return 0;
}


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

using int64 = long long;
using uint64 = unsigned long long;

using namespace std;

map<int64, int64> memo;

int64 solve(int64 n, int64 a, int64 b, int64 c, int64 d) {
    if (memo.count(n)) {
        return memo[n];
    }
    if (n == 0) {
        return memo[n] = 0;
    }

    int nums[] = {2, 3, 5};
    int64 cost[] = {a, b, c};

    memo[n] = (1LL << 60);
    for (int i = 0; i < 3; i++) {
        int64 prev = (n / nums[i]) * nums[i],
              next = (n + nums[i] - 1) / nums[i] * nums[i];
        if (prev / nums[i] != n) {
            memo[n] = min(memo[n], cost[i] + abs(prev - n) * d + solve(prev / nums[i], a, b, c, d));
        }
        if (next / nums[i] != n) {
            memo[n] = min(memo[n], cost[i] + abs(next - n) * d + solve(next / nums[i], a, b, c, d));
        }
    }
    if (n < (memo[n] + d - 1) / d) {
        memo[n] = min(memo[n], n * d);
    }
    return memo[n];
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int t;
    cin >> t;

    for (int _ = 0; _ < t; _++) {
        int64 n, a, b, c, d;
        cin >> n >> a >> b >> c >> d;
        memo.clear();
        cout << solve(n, a, b, c, d) << endl;
    }

    return 0;
}



Measured memory_bytes: 4312
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <random>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define rep(x, b, e) for(int x=(b); x<(e); ++x)
#define ford(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define all(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

int main() {
	ios_base::sync_with_stdio(false);
	ll h, w, tot;
	cin >> h >> w;
	if (h > w) {
		swap(h, w);
	}
	if (h == 1) {
		cout << 1 << endl;
		return 0;
	}
	cout << (h * w + 1) / 2 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <ctime>
#include <bitset>
#include <complex>
#include <chrono>
#include <random>
#include <functional>

using namespace std;

typedef long long ll;

const int N = 3e5 + 8;
const ll INF = 1e18 + 239;

int a[N];
ll f[N];
ll s[N];

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

	int n;
	cin >> n;
	n *= 3;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	{
		multiset<int> ms;
		ll cs = 0;
		for (int i = 0; i < n; i++) {
			ms.insert(a[i]);
			cs += a[i];
			while ((int)ms.size() > n / 3) {
				cs -= *ms.begin();
				ms.erase(ms.begin());
			}
			if ((int)ms.size() < n / 3) {
				f[i] = -1;
			} else {
				f[i] = cs;
			}
		}
	}
	{
		multiset<int> ms;
		ll cs = 0;
		for (int i = n - 1; i >= 0; i--) {
			ms.insert(a[i]);
			cs += a[i];
			while ((int)ms.size() > n / 3) {
				cs -= *ms.rbegin();
				ms.erase(--ms.end());
			}
			if ((int)ms.size() < n / 3) {
				s[i] = -1;
			} else {
				s[i] = cs;
			}
		}
	}
	ll ans = -INF;
	for (int i = 0; i + 1 < n; i++) {
		if (f[i] != -1 && s[i + 1] != -1) {
			ans = max(ans, f[i] - s[i + 1]);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 10880
#include<bits/stdc++.h>
using namespace std;
int main(){
	long long A,B,K;
  	cin>>A>>B>>K;
  	if(A >= K){
    	A-=K;
      	cout<<A<<" "<<B<<"\n";
    }
  	else{
    	K-=A;
      	if(B >= K){
          	B-=K;
        	cout<<0<<" "<<B<<"\n";
        }
      	else{
        	cout<<0<<" "<<0<<"\n";
        }
    }
	return 0;
}

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

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

  vector<pair<int,int> > AB(N);
  for (int i=0; i<N; i++)
    cin >> AB[i].first >> AB[i].second;

  sort(AB.begin(), AB.end());

  ll ret = 0;
  int i = 0;
  while (M > 0) {
    ret += (ll)AB[i].first * ((M < AB[i].second) ? M : AB[i].second);
    M -= AB[i].second;
    i++;
  }

  cout << ret << endl;
} 


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int a[n],sum=0;
  for(int i=0;i<n;i++)
    cin>>a[i];
     for(int i=0;i<n;i++)
       sum+=a[i];
  int t=0,sum1=0,sum2=0,min=12376540;
  while(n>t)
  {
    for(int i=0;i<=t;i++)
      sum1=sum1+a[i];
      sum2=sum-sum1;
    
    if(min>abs(sum2-sum1))
      min=abs(sum2-sum1);
    
    t++;
    sum1=0;sum2=0;
  }
  
  cout<<min;
  return 0;
}
    

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

int main(){
    int N, M;
    cin >> N >> M;
    vector<int> a(M);
    vector<int> b(M);
    vector<int> ans(N);
    for(int i = 0; i < M; i++){
        cin >> a.at(i) >> b.at(i);
        ans.at(a.at(i) - 1)++;
        ans.at(b.at(i) - 1)++;
    }
    for(int i = 0; i < N; i++){
        cout << ans.at(i) << endl;
    }
}

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

typedef int_fast32_t int32;
typedef int_fast64_t int64;

const int32 inf = 1e9+7;
const int32 MOD = 1000000007;
const int64 llinf = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define all(obj) (obj).begin(),(obj).end()
#define rall(obj) (obj).rbegin(),(obj).rend()
#define fi first
#define se second
#define pb(a) push_back(a)
typedef pair<int32,int32> pii;
typedef pair<int64,int64> pll;

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int32 n;
  cin >> n;
  vector<int32> a(n);
  REP(i,n)cin >> a[i];
  sort(a.rbegin(),a.rend());
  int64 ans = 0;
  REP(i,n-1){
    ans += a[(i+1)/2];
  }
  ANS(ans);
  return 0;
}

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

//https://atcoder.jp/contests/agc044/tasks/agc044_a

int t, a, b, c, d;
long long n;
map<long long, long long> m;

long long f(long long n) {
	if (n < 2)
		return n * d;
	if (m[n])
		return m[n];
	long long rv;
	if (n % 2)
		rv = d + a + min(f(n / 2), f(n / 2 + 1));
	else
		rv = a + f(n / 2);
	if (n % 3 < 2)
		rv = min(rv, n % 3 * d + b + +f(n / 3));
	else
		rv = min(rv, d + b + +f(n / 3 + 1));
	if (n % 5 < 3)
		rv = min(rv, n % 5 * d + c + +f(n / 5));
	else
		rv = min(rv, (5 - n % 5) * d + c + +f(n / 5 + 1));

	if (rv / d >= n)
		rv = d * n;
	m[n] = rv;
	return rv;
}

int main() {
	cin >> t;
	for (int i = 0; i < t; i++) {
		m.clear();
		cin >> n >> a >> b >> c >> d;
		cout << f(n) << endl;
	}
}


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

using namespace std;
int main(){

	int N;
	cin >> N;

	bool flag = false;
	for (int i = 1; i <= 9; i++)
		for (int j = 1; j <= 9; j++)
			if (i*j == N){
				flag = true;
				break;
			}

	flag ? cout << "Yes" : cout << "No";
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil,pi,factorial
    from operator import itemgetter
    def I(): return int(input())
    def MI(): return map(int, input().split())
    def LI(): return list(map(int, input().split()))
    def LI2(): return [int(input()) for i in range(n)]
    def MXI(): return [[LI()]for i in range(n)]
    def SI(): return input().rstrip()
    def printns(x): print('\n'.join(x))
    def printni(x): print('\n'.join(list(map(str,x))))
    inf = 10**17
    mod = 10**9 + 7
#main code here!
    n=I()
    newx=[0 for i in range(n)]
    newy=[0 for i in range(n)]
    for i in range(n):
        x,y=MI()
        newx[i]=x-y
        newy[i]=x+y
    print(max(max(newx)-min(newx),max(newy)-min(newy)))

        
        
        
        
    
if __name__=="__main__":
    main()



Measured memory_bytes: 100584
#include <bits/stdc++.h>
using namespace std;
int d[10] = {0};
int main()
{
	int n, x;
	
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &x);
		if (x < 400) {
			d[0]++;
		} else if (x < 800) {
			d[1]++;
		} else if (x < 1200) {
			d[2]++;
		} else if (x < 1600) {
			d[3]++;
		} else if (x < 2000) {
			d[4]++;
		} else if (x < 2400) {
			d[5]++;
		} else if (x < 2800) {
			d[6]++;
		} else if (x < 3200) {
			d[7]++;
		} else {
			d[8]++;
		}
	}
	int s = 0;
	for (int i = 0; i < 8; i++) {
		if (d[i]) {
			s++;
		}
	} 
	int p = s;
	if (p == 0) {
		p = 1;
	}
	printf("%d ", p);
	s = s + d[8];
	printf("%d\n", s);
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <typeinfo>
#include <numeric>
#include <functional>
#include <unordered_map>
#include <bitset>
#include <stack>


using namespace std;
using ll = long long;
using ull = unsigned long long;

const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define REP(i, n) for(ll i = 0; i < n; i++)






int main() {
    ll n;
    cin >> n;
    if(n == 3){
        cout << "2 5 63" << endl;
        return 0;
    }
    if(n == 4){
        cout << "2 5 20 63" << endl;
        return 0;
    }
    if(n == 5){
        cout << "2 3 4 6 9" << endl;
        return 0;
    }
    ll cnt = 0, sum = 0;
    vector<ll> a;
    for(ll i = 2; i <= 30000; i++){
        if(i % 2 == 0 || i % 3 == 0){
            a.push_back(i);
            sum += i;
            cnt++;
        }
        if(cnt == n) break;
    }
    if(sum % 6 == 2){
        a[4] = a.back() + (6 - (a.back() % 6));
    }
    else if(sum % 6 == 3){
        a[5] = a.back() + (6 - (a.back() % 6));
    }
    else if(sum % 6 == 5){
        ll t = a.back() + 1;
        while(t % 6 != 4){
            t++;
        }
        a[5] = t;
    }
    REP(i, n){
        cout << a[i] << " \n"[i == n - 1];
    }
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<list>
#include <array>
using namespace std;
#define i64  long long
#define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define INF I64_MAX
#define MOD 1000000007


void solve(void)
{ 
  int a,b;
  cin>>a>>b;
  int x;
  cin>>x;
  
  int mod_a = a%x;
  int mod_b = b%x;
  if(mod_a == 0) mod_a = x;
  a = a  - mod_a;

  cout<<b/x - a/x<<endl;
  
}



int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  // std::cout << std::fixed;
  // std::cout << std::setprecision(8);

  solve();

 
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
		using namespace std;
		typedef long long ll;
		#define PI 3.14159265358979
		#define EPS 1e-8
		#define mod 
		#define fi first
		#define se second
		#define mp make_pair
		#define pb push_back
		#define endl "\n"
			 
		const ll INF=1e15;	
		const int N=2e5+50;
		 

		 
		long long binpow(long long a, long long b, long long m) {
			a %= m;
			long long res = 1;
			while (b > 0) {
				if (b & 1)
					res = res * a % m;
				a = a * a % m;
				b >>= 1;
			}
			return res;
		}
		
		
		int main()
		{
			ios_base::sync_with_stdio(false);
			cin.tie(NULL);cout.tie(0);
			
			ll n;
			cin>>n;
			
			vector<ll> a(n+1),b(n+1);
			vector<ll> v1,v2;
			for(ll i=1;i<=n;i++)
			{
				cin>>a[i]>>b[i];
				v1.pb(a[i]);
				v2.pb(b[i]);
			}
			
			sort(v1.begin(),v1.end());
			
			sort(v2.begin(),v2.end());
			
			if(n%2==1)
			{
				ll lo=v1[n/2];
				ll hi=v2[n/2];
				
				cout<<(hi-lo+1);
			}
			else
			{
				long double lo=v1[n/2-1];
				long double hi=v1[n/2];
				
				long double l1=lo+(hi-lo)/2;
				
				lo=v2[n/2];
				hi = v2[n/2-1];
				
				long double l2=hi+(lo-hi)/2;
				
		
				cout<<(ll)(((abs(l2-l1)+0.5)/0.5));
				
			}
			
			
			
		}
			
			
		


Measured memory_bytes: 9816
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>

using namespace std;

#define trace(...) __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...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 30;
const int MOD = 1e9 + 7;

const int N = 1e5 + 10;
vector<int> a[N];
int dp[N], ret[N];

void DFS(int u, int parent) {
  int sum = 0, common = 0;
  for (auto& v : a[u]) {
    if (v == parent) continue;
    DFS(v, u);
    common |= dp[v] & sum;
    sum |= dp[v];
  }
  int k;
  for (k = 0; (sum & (1 << k)) || (1 << k) <= common; ++k);
  ret[u] = k;
  dp[u] = ((sum >> k) | 1) << k;
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x; --y;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  DFS(0, -1);
  int ans = *max_element(ret, ret + n);
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 12160