akhauriyash/Code-Regression huggingface dataset:
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdio>
#include<cmath>
#define re register
using namespace std;
int n,m;
int mp[2052][2052];
inline void work(re int x,re int y,re int X,re int Y){
	if(x==X&&y==Y){
		mp[x][y]=1;
		return;
	}
	mp[x+X>>1][y+Y>>1]=1;
	int midx=x+X>>1,midy=y+Y>>1;
	work(x,y,midx-1,midy-1);
	work(midx+1,y,X,midy-1);
	work(x,midy+1,midx-1,Y);
	work(midx+1,midy+1,X,Y);
}
signed main(){
	int tmp=0;
	scanf("%d%d",&n,&m);
	if(n<m){
		for(re int i=1;i<=(1<<m);i+=(1<<n)){
			work(1,i,(1<<n)-1,i+(1<<n)-2);
		}
	}
	else{
		for(re int i=1;i<=(1<<n);i+=(1<<m)){
			work(i,1,i+(1<<m)-2,(1<<m)-1);
		}
	}
	for(re int i=1;i<(1<<n);++i){
		for(re int j=1;j<(1<<m);++j)
		printf("%d",mp[i][j]);
		putchar('\n');
	}
}

Measured memory_bytes: 11520
def solve(string):
    s, k = map(int, string.split())
    counter = 0
    for _s in str(s):
        if _s == "1":
            counter += 1
            continue
        break
    return str(s) if len(str(s)) == 1 else "1" if k <= counter else str(s)[counter]


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))


Measured memory_bytes: 38384
#include<iostream>
using namespace std;
int main()
{
    int n;
    cin>>n;
    long long int count=0,i,j,c;
    for(i=1;i<=n;i++)
    {
        for(j=1;j<=n;j++)
        {
            c=n-(i*j);
            count++;
            if(c<=0)
            {
                count--;
                break;
            }
        }
    }
    cout<<count<<"\n";
}

Measured memory_bytes: 3628
ri = lambda: int(input())
rl = lambda: list(map(int,input().split()))
rr = lambda N: [ri() for _ in range(N)]
YN = lambda b: print('YES') if b else print('NO')
yn = lambda b: print('Yes') if b else print('No')
OE = lambda x: print('Odd') if x%2 else print('Even')
INF = 10**18

N,i=rl()
print(N-i+1)

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

int main()
{
    string s, t;
    cin >> s;
    cin >> t;
    int r = 1;
    int temp;

    for (int i = 0; i < s.length(); i++)
    {
        if (s[i] == t[0])
        {
            r = 1;
            for (int j = 0; j < s.length(); j++)
            {
                if (i + j >= s.length())
                {
                    temp = i - s.length();
                }
                else
                {
                    temp = i;
                }
                if (s[temp + j] != t[j])
                {
                    r = 0;
                    break;
                }
            }
            if (r == 1)
            {
                break;
            }
        }
    }
    if (r == 1)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#include<stdint.h>
#include<vector>
#include<deque>
#include<stack>
#include<string>
#include<cstring>
#include<time.h>
#include<iomanip>
#include<list>
#include<set>
#include<unordered_map>
#include<unordered_set>
#include<random>
#include<bitset>
#include <queue>
#include <map>


using namespace std;
using ll = long long;
using ull = unsigned long long;
using uint = unsigned int;
using ldouble = long double;


#define repi(i,a,b) for(ll i = (a); i < (b); i++)
#define rep(i, n) for(ll i = 0; i < (n); ++i)


ll MOD = 1000000007;
ll inf = 1e18;
int main() {
	int N;
	cin >> N;
	vector<ll> R(N + 1);
	vector<ll> C(N + 1);
	repi(i, 1, N + 1) cin >> R[i] >> C[i];
	vector<vector<ll>> dp(N + 1);
	rep(i, N + 1) {
		dp[i].resize(N + 2);
		rep(j, N + 2)dp[i][j] = (i == j || i +1 == j) ? 0 : inf;
	}
	repi(x, 2, N+1) {
		repi(r, 1, N + 1) {
			int l = r + x;
			if (l > N + 1) break;
			ll m = inf;
			repi(j, r + 1, l) {
				m = min(m, dp[r][j] + dp[j][l] + (R[r] * R[j] * C[l - 1]));
			}
			dp[r][l] = m;
		}
	}
	cout << dp[1][N + 1] << endl;
	return 0;
}



Measured memory_bytes: 3148
s = list(input())
flag = False
while s:
    if "".join(s[-5:]) == "dream":
        del(s[-5:])
    elif "".join(s[-5:]) == "erase":
        del(s[-5:])
    elif "".join(s[-7:]) == "dreamer":
        del(s[-7:])
    elif "".join(s[-6:]) == "eraser":
        del(s[-6:])
    else:
        flag = False
        break
    
    if len(s) == 0:
       flag = True 
if flag:
   print("YES")
else:
    print("NO")

Measured memory_bytes: 3956
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

using namespace std;
typedef long long ll;
typedef pair<int, int> pp;

int main(void) {
	ll num, i, ans = 0;
	cin >> num;
	rep(i, num + 1) {
		if (i % 3 == 0 || i % 5 == 0)
			continue;
		ans += i;
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 3624
// https://ynucpc.github.io/blog/2018/04/15/cp_vscode/
// http://www.atmarkit.co.jp/ait/articles/1509/08/news019.html

#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep1(i,n) for(ll i=1;i<=(ll)(n);i++)
#define rep3(i,n,m) for(ll i=(n);i<(ll)(m);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
// #define max(a, b) ((a) > (b) ? (a) : (b))
// #define min(a, b) ((a) < (b) ? (a) : (b)) 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;
int stoi (string s, int tmp=10){
	istringstream stm(s);
	int res;
	stm >> res;
	return res;
}
double stod(string s, int tmp=10){
	istringstream stm(s);
	double res;
	stm >> res;
	return res;
}


// 配列の総和
// greater


ll H[101010];
ll dp[101010];

int main(){	
	// ll A;
    // cin >> A;
	// cout << "hello" << endl;
	// cout << stoi("14") << endl;
	// cout << max({1,3}) << endl;
	ll N, K;
	cin >> N >> K;
	rep(i, N)cin >> H[i];
	dp[0] = 0;
	rep3(i, 1, N){
		ll mi = LLONG_MAX;
		rep3(j, max(0ll, i-K), i)chmin(mi, dp[j]+abs(H[j]-H[i]));
		dp[i] = mi;
	}
	cout << dp[N-1] << endl;

}








Measured memory_bytes: 1792
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<time.h>
#include<math.h>
#include<assert.h>
#define inf 1072114514
#define llinf 4154118101919364364
#define mod 1000000007
#define pi 3.1415926535897932384
int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int nHr(int a,int b){return nCr(a+b-1,b);}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int dsum(int x){int r=0;while(x){r+=(x%10);x/=10;}return r;}
int dsumb(int x,int b){int r=0;while(x){r+=(x%b);x/=b;}return r;}
int sankaku(int x){return ((1+x)*x)/2;}
void swap(int *a,int *b){int c;c=(*a);(*a)=(*b);(*b)=c;}
//小さい順
int compareInt(const void* a, const void* b){int aNum = *(int*)a;int bNum = *(int*)b;return aNum - bNum;}

int main(void){
    int N,K,X,Y;
    scanf("%d%d%d%d",&N,&K,&X,&Y);
    if(N<=K){
        printf("%d",N*X);
        return 0;
    }else{
        printf("%d",K*X+(N-K)*Y);
        return 0;
    }
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }

int main(){
    int n;ll x;
    cin>>n>>x;
    ll a[n];
    rep(i,n) cin>>a[i];
    ll ans=0;
    if(a[0]>x){
        ans+=a[0]-x;
        a[0]=x;
    }
    for(int i=1;i<n;i++){
       ll num=a[i]+a[i-1];
        if(num>x){
            ans+=num-x;
            a[i]-=num-x;
        }
    }
    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 1024
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <iostream>
#include <string>

#include <algorithm>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define PB push_back
#define MP make_pair

#define FOR(i, b, e) for(int i=(b);i<(e);i++)
#define REP(i, n) FOR(i,0,n)

#define ALL(v) (v).begin(),(v).end()

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

typedef pair<int, int> PII;

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VPII;

const int MOD = 1000000007;
const int INF = 1e9;

const double EPS = 1e-9;
const double PI = acos(-1.0);

const int DX[4] = {1, 0, -1, 0};
const int DY[4] = {0, 1, 0, -1};

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

long double a, b, c;

int main() {
    cin >> a >> b >> c;
    if (a + b + sqrtl(a * b)*2 < c) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
/*
***************************************************************************
 name  : ITP1_02_B.cpp
 title : Range
 make  : 2018/08/01 tanabe
***************************************************************************
*/

// Library
#include <iostream> // standard input output object

main(void){
  int a,b,c; // integers

  std::cin >> a >> b >> c; // input "a b c"

  if(a-b < 0){
    if(b-c < 0){
      std::cout << "Yes" << std::endl; // output "Yes"
    }
    else{
      std::cout << "No" << std::endl; // output "No"
    }
  }
  else{
    std::cout << "No" << std::endl; // output "No"
  }

}



Measured memory_bytes: 3096
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <functional>
#include <queue>
//#include <stack>
#include <climits>
#include <map>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,n1,n2) for(int i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
#define all(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
using namespace std;
typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> P;

int n;
ll max(ll a,ll b){
    if(a>b)return a;
    else return b;
}
int ma;
int mi;
int d[200010];

int main() {
    cin >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    REP(i,n){
        cin >> a[i];
    }
    sort(all(a));
    ll res = 0;
    //ll res2 = 0;
    /*REP(i,n){
        if(i%2==0){
            b[i] = a[n-i/2-1];
        }else{
            b[i] = a[i/2];
        }
    }*/
    
    if(n%2==1){
        if((a[n/2+1]-a[n/2])>(a[n/2]-a[n/2-1])){
            REP(i,n/2){
                res+=2*a[n-1-i];
            }
            REP(i,n/2-1){
                res-=2*a[i];
            }
            res-=a[n/2]+a[n/2-1];
        }else{
            REP(i,n/2-1){
                res+=2*a[n-1-i];
            }
            REP(i,n/2){
                res-=2*a[i];
            }
            res+=a[n/2]+a[n/2+1];
        }
    }else{
        REP(i,n/2-1){
            res += 2*a[n-1-i];
        }
        REP(i,n/2-1){
            res -= 2*a[i];
        }
        res+=a[n/2];
        res-=a[n/2-1];
    }
    put(res);
    /*ma = a[0];
    mi = a[1];
    res += abs(a[0]-a[1]);
    FOR(i,2,n){
        if(abs(ma-a[i])>abs(mi-a[i])){
            res+=abs(mi-a[i]);
            mi = a[i];
        }else{
            res+=abs(ma-a[i]);
            ma = a[i];
        }
    }
    put(res);
    /*REP(i,n){
        if(i%2==0){
            c[i] = a[i/2];
        }else{
            c[i] = a[n-i/2-1];
        }
    }
    REP(i,n){
        put(b[i]);
    }
    REP(i,n-1){
        res += abs(b[i]-b[i+1]);
    }
    REP(i,n-1){
        res2 += abs(c[i]-c[i+1]);
    }
    put(max(res,res2));*/
    return 0;
}



Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#define int             long long
#define no_of_test(x)   int x; cin>>x; while(x--)
const int mod = 1e9 + 7;
void very_fast()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
}
int gcd(int a, int b)
{
	if (b == 0) return a;
	return gcd(b, a % b);
}
int binary_exponentation(int a, int b)
{
	int ret = 1;
	while (b)
	{
		if (b & 1) ret = (ret * a) % mod;
		b >>= 1;
		a = (a * a) % mod;
	}
	return ret;
}

int32_t main()
{
	very_fast();
//	no_of_test(x)
	{
		char s;
		cin >> s;
		//char w=
		cout << char(s + 1)  << "\n";
	}
	return 0;

}


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

int main() {
  int A, B , N  ;
  cin >> N >> A >> B ;
  
  if ( (A * N ) >= B ) {
    cout << B << endl;
  }

  if ( (A * N ) < B ) {
    cout << A * N << endl;
  }
}

 

Measured memory_bytes: 3588
import java.util.Scanner;

public class Main {
	public static void main(String... args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
int ans=0;
		if(a>b){
	ans=ans+a;
			a=a-1;
}else{
	ans=ans+b;
	b=b-1;
}

		if(a>b){
			ans=ans+a;
					a=a-1;
		}else{
			ans=ans+b;
			b=b-1;
		}

		System.out.println(ans);

	}
}

Measured memory_bytes: 25044
(* O(k M^2) (M = min n k) *)
Scanf.scanf " %d %d" @@ fun n k ->
  let vs = Array.init n @@ fun _ -> Scanf.scanf " %d" @@ (+) 0 in
  let ans = ref 0 in
  let m = min n k in
  for l = 0 to m do
    for r = 0 to m - l do
      let c = l + r in
      for b = 0 to k - c do
        if b <= c then
          let a = Array.make c 0 in
          let a_i = ref 0 in
          let rec loop acc f i rest =
            if rest <= 0 then acc
            else
              let v = vs.(f i) in
              a.(!a_i) <- v; incr a_i;
              loop (acc + v) f (i + 1) (rest - 1) in
          let sum = ref @@ loop 0 ((+) 0) 0 l + loop 0 ((-) (n - 1)) 0 r in
          Array.sort (-) a;
          for i = 0 to b - 1 do
            sum := !sum - a.(i)
          done;
          ans := max !ans !sum
      done
    done
  done;
  Printf.printf "%d\n" !ans

Measured memory_bytes: 2560
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include <numeric>
#include <sstream>
#include <string>
#include <string.h>
#include <tuple>
#include <vector>

#define REP(i,x) for(int i{ 0 }; i < (int)(x); i++)
#define REPC(i,x) for(int i{ 0 }; i <= (int)(x); i++)
#define RREP(i,x) for(int i{ (int)(x) - 1 }; i >= 0 ;i--)
#define RREPC(i,x) for(int i{ (int)(x)}; i >= 0; i--)
#define REP1O(i,x) for(int i{ 1 }; i < (int)(x); i++)
#define REP1C(i,x) for(int i{ 1 }; i <= (int)(x); i++)

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()

using namespace std;

typedef int64_t ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef pair<int, int> pii;
typedef tuple<int, int, int> tupiii;
typedef tuple<ll, ll, ll> tuplll;

const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INTMAX = 2147483647;
const ll LLMAX = 9223372036854775807;

template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
void SWAP(ll& a, ll& b) { a ^= b; b ^= a; a ^= b; }
void SWAP(int& a, int& b) { a ^= b; b ^= a; a ^= b; }


template <class T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }

template <class T>
T lcm(T a, T b)
{
	return a / gcd(a, b) * b;
}


class C {
	int n;
public:
	C()
	{
		cin >> n;
	}
	void solve()
	{

		if (n == 1)
		{
			ll ans;
			cin >> ans;
			cout << ans << endl;
			return;
		}

		ll ans;
		cin >> ans;

		REP(i, n - 1)
		{
			ll tmp;
			cin >> tmp;

			ans = lcm(ans, tmp);
		}

		cout << ans << endl;
	}
};


int main()
{
	C solution;
	solution.solve();

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define db(a) cout << fixed << #a << " = " << a << endl;

using namespace std;

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


int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	ll n, x, m;
	cin >> n >> x >> m;
	vector<ll> A;
	A.push_back(x);
	set<ll> F;
	F.insert(x);
	ll st = -1;
	while (true) {
		ll next = (A.back() * A.back()) % m;
		if (F.find(next) != F.end()) {
			st = next;
			break;
		} else {
			A.push_back(next);
			F.insert(next);
		}
	}
	ll ans = 0;
	vector<ll> B;
	for (int i = 0; i < (int) A.size(); i++) {
		if (A[i] == st) {
			for (int j = i; j < (int) A.size(); j++) B.push_back(A[j]);
			break;
		} else {
			n--;
			ans += A[i];
			if (n == 0) {
				cout << ans << "\n";
				return 0;
			}
		}
	}
	ll sum = 0;
	for (ll b: B) sum += b;
	ll k = n / (ll) B.size();
	ll r = n % (ll) B.size();
	ans += sum * k;
	for (int i = 0; i < r; i++) {
		ans += B[i];
	}
	cout << ans << endl;
}



Measured memory_bytes: 6752
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  string a;
  cin >> a;
  rep(i,0,3){
    if (a[i] == '1') cout << 9;
    else
      cout << 1;
  }
  cout << endl;
}

Measured memory_bytes: 3524
import io,sys
def main():
    x,n = map(int,sys.stdin.readline().rstrip().split())
    p = list(map(int,sys.stdin.readline().rstrip().split()))

    x_pos = x
    x_neg = x
    while True:
        if x_neg not in p:
            print(x_neg)
            sys.exit()
        if x_pos not in p:
            print(x_pos)
            sys.exit()
        
        x_pos+=1
        x_neg-=1
main()

Measured memory_bytes: 9184
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    int n;
    cin >> n;
    vector<vector<int>> g(n);
    vector<int> lf;
    for(int i = 0; i < n; i++)
    {
        int leaf = 0;
        for(int j = 0; j < n; j++)
        {
            char a;
            cin >> a;
            if(a == '1')
            {
                g[i].push_back(j);
                leaf++;
            }
        }
        if(leaf == 1)
        {
            lf.push_back(i);
        }
    }
    int ans = 0;
    for(int v = 0; v < n; v++)
    {
        queue<int> que;
        que.push(v);
        vector<int> d(n);
        d[v] = 1;
        bool flag = true;
        while(que.size())
        {
            int pos = que.front();
            que.pop();
            for(int nx : g[pos])
            {
                if(d[nx] == 0)
                {
                    d[nx] = d[pos] + 1;
                    que.push(nx);
                }
                else if(d[nx] == d[pos]-1 || d[nx] == d[pos]+1) continue;
                else
                {
                        flag = false;
                        break;
                }
            }
            if(!flag)
            {
                break;
            }
        }
        int tmp = 0;
        for(int i = 0; i < n; i++)
        {
            tmp = max(tmp, d[i]);
        }
        if(!flag) tmp = 0;
        ans = max(ans, tmp);
    }
    if(ans == 0) cout << -1 << endl;
    else cout << ans << endl;
}


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

using ll = long long;
using pii = pair<int, int>;
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (int i = m; i < (n); i++)
#define per(i, b) per2(i, 0, b)
#define per2(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define ALL(c) (c).begin(), (c).end()
#define SZ(x) ((int)(x).size())

constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }

template <class T, class U>
void chmin(T& t, const U& u) {
    if (t > u) t = u;
}
template <class T, class U>
void chmax(T& t, const U& u) {
    if (t < u) t = u;
}

template <class T, class U>
ostream& operator<<(ostream& os, const pair<T, U>& p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
    os << "{";
    rep(i, v.size()) {
        if (i) os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

#ifdef LOCAL
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << H;
    debug_out(T...);
}
#define debug(...) \
    cerr << __LINE__ << " [" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl
#else
#define debug(...) (void(0))
#define dump(x) (void(0))
#endif

const int MX = 1000010;

int cnt[MX], dv[MX];

int main() {
    int N;
    cin >> N;
    V<int> A(N);
    rep(i, N) {
        cin >> A[i];
        cnt[A[i]]++;
    }

    for (int i = 1; i < MX; ++i) {
        if (cnt[i]) {
            for (int j = i; j < MX; j += i) {
                dv[j] += cnt[i];
            }
        }
    }

    int ans = 0;
    rep(i, N) {
        if (dv[A[i]] <= 1) {
            ans++;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 11884
import java.io.*;
import java.util.*;
public class Main
{
	
	private void solve()throws IOException
	{
		int n=nextInt();
		int m=nextInt();
		PriorityQueue<Integer> pq=new PriorityQueue<>(11,Collections.reverseOrder());
		while(n-->0)
			pq.add(nextInt());
		while(m-->0)
		{
			int x=pq.remove();
			x=x/2;
			pq.add(x);
		}
		long ans=0;
		while(!pq.isEmpty())
			ans+=pq.remove();
		out.println(ans);
	}

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

	public void run()throws IOException
	{
		br=new BufferedReader(new InputStreamReader(System.in));
		st=null;
		out=new PrintWriter(System.out);

		solve();
		
		br.close();
		out.close();
	}
	public static void main(String args[])throws IOException{
		new Main().run();
	}
	BufferedReader br;
	StringTokenizer st;
	PrintWriter out;
	String nextToken()throws IOException{
		while(st==null || !st.hasMoreTokens())
		st=new StringTokenizer(br.readLine());
		return st.nextToken();
	}
	String nextLine()throws IOException{
		return br.readLine();
	}
	int nextInt()throws IOException{
		return Integer.parseInt(nextToken());
	}
	long nextLong()throws IOException{
		return Long.parseLong(nextToken());
	}
	double nextDouble()throws IOException{
		return Double.parseDouble(nextToken());
	}
}

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

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long,long> pll;
typedef vector<int> vi;
typedef vector<long long> vll;

#define forn(i, n) for(int i=0; i<n; i++)
#define mp makepair
#define pb push_back



int main(){
    ll N, W;
    scanf("%lld%lld", &N, &W);
    vll dp(W+1);
    for(int item = 0; item < N; item++) {
        int weight, value;
        scanf("%d%d",&weight,&value);
        for(ll weight_already = W - weight; weight_already >= 0; weight_already--) {
            dp[weight_already + weight] = max(dp[weight_already + weight], dp[weight_already] + value);
        }
    }
    
    ll ans = 0;
    forn(i,W+1){
        ans = max(ans, dp[i]);
    }

    printf("%lld\n",ans);
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <class T> using treap = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define REP(i, n) for (long long i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (long long i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) begin(obj), end(obj)
#define RALL(obj) rbegin(obj), rend(obj)
#define fi first
#define se second
using ii = pair<int, int>;
vector<ii> dirs = {
  {1, 0}, {0, 1}, {-1, 0}, {0, -1},  // 4方向
  {1, 1}, {-1, 1}, {-1, -1}, {1, -1},  // 斜め
  {0, 0},  // 自身
};
template <class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template <class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <class T, class S> vector<T> make_vec(size_t n, S x) { return vector<T>(n, x); }
template <class T, class... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(n, make_vec<T>(ts...)); }

// debug
template <class T> ostream& operator<<(ostream& s, vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; }
template <class T> ostream& operator<<(ostream& s, vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; }
template <class T, class S> ostream& operator<<(ostream& s, pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
template <class T, class S> ostream& operator<<(ostream& s, map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
template <class T, class S> ostream& operator<<(ostream& s, unordered_map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
#ifdef _MY_DEBUG
  #define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n";
#else
  #define dump(...)
  #define endl "\n"
#endif
void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); }

struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
constexpr int MOD = 1000000007;
// *************** TEMPLATE END *************** 

int cnt(int n, int x) {
  return n / x;
}
int cnt2(int a, int b, int x) {
  return cnt(b, x) - cnt(a - 1, x);
}
signed main() {
  int a, b, c, d; cin >> a >> b >> c >> d;
  int g = c / __gcd(c, d) * d;
  cout << (b - a + 1) - (cnt2(a, b, c) + cnt2(a, b, d) - cnt2(a, b, g)) << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
using namespace std;

typedef long long LL;

namespace INPUT {
	const int L = 1 << 15;
	char _buf[L], *S, *T, c; int n;
	#define _gc (S == T ? (T = (S = _buf) + fread (_buf, 1, L, stdin), (S == T ? EOF : (*S++))) : (*S++))
	void readi (int &X) {
		for (c = _gc; c < '0' || c > '9'; c = _gc); X = c & 15;
		for (c = _gc; c >= '0' && c <= '9'; X = X * 10 + (c & 15), c = _gc);
	}
	void reads (char *s) {
		for (c = _gc; c != '#' && c != '.'; c = _gc); s[n = 1] = c;
		for (c = _gc; c == '#' || c == '.'; s[++n] = c, c = _gc);
	}
}
using INPUT :: readi;
using INPUT :: reads;

const int Maxn = 2005;

int N, M;
char a[Maxn][Maxn];
int st[Maxn], len[Maxn];
int Ans;

int main() {
	readi (N), readi (M);
	for (int i = 1; i <= N; i++) {
		reads (a[i]);
		for (int j = 1; j <= M; ++j)
			a[i][j] = (a[i][j] == '#' ? 1 : 0);
	}
	Ans = max (N, M);
	for (int i = 1; i <= N; i++) {
		for (int j = 1; j < M; j++) {
			if (i > 1 && !(a[i - 1][j] ^ a[i][j] ^ a[i - 1][j + 1] ^ a[i][j + 1]))
				len[j]++; 
			else
				len[j] = 1; 
		}
		int tp = 0; 
		for (int j = 1; j <= M; j++) {
			while (tp && len[st[tp - 1]] >= len[j]) {
				int x = st[--tp]; 
				if (!tp)
					Ans = max(Ans, j * len[x]); 
				else
					Ans = max(Ans, (j - st[tp - 1]) * len[x]); 
			}
			st[tp++] = j; 
		}
	}
	printf ("%d\n", Ans);
	return 0; 
}


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

void solve()
{
    int n; cin >> n;
    long long t[n], a[n];
    for(int i = 0; i < n; ++i){
        cin >> t[i] >> a[i];
    }

    for(int i = 1; i < n; i++){
        long long n = max((t[i-1]-1)/t[i]+1, (a[i-1]-1)/a[i]+1);
        t[i] *= n;
        a[i] *= n;  
    }
    cout << t[n-1]+a[n-1] << endl;
}

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

Measured memory_bytes: 3612
n = gets.to_i
nums = gets.split(' ').map(&:to_i)
num_counts = {}
nums.each do |i|
  num_counts[i] = 0 if !num_counts.has_key?(i)
  num_counts[i] = num_counts[i] + 1
end

total = 0
num_counts.each do |_, value|
    total = total + (value * (value - 1)) / 2 if value > 1
end

nums.each do |i|
  value = num_counts[i]
  a = (value * (value - 1)) / 2
  value = value - 1
  b = (value * (value - 1)) / 2
  p total - (a - b)
end



Measured memory_bytes: 37764
#include <iostream>
#include <vector>
#include <utility>
#include <numeric>
#include <functional>
#include <stdio.h>
#include <math.h>
#include <string>
#include <algorithm>
#include <deque>
#include <queue>
#include <map>
#include <chrono>
using namespace std;
using ll = long long;

ll eat(ll x, ll i, ll s[51], ll p[51]) {
	if (x <= 0) {
		return 0;
	}
	if (i == 0) {
		return 1;
	}
	if (x >= s[i] - i + 1) {
		return p[i];
	}
	else if (x >= s[i-1] + 1) {
		ll r = 0;
		if (x >= s[i-1] + 2) {
			++r;
		}
		r += p[i-1];
		return r + eat(x - s[i-1] - 2, i-1, s, p);
	}
	else {
		return eat(x - 1, i-1, s, p);
	}
}

int main() {
	ll N, X;
	cin >> N >> X;
	ll s[51];
	s[0] = 1; 
	for (ll i = 1; i <= N; ++i) {
		s[i] = 2 * s[i - 1] + 3;
	}
	ll p[51];
	p[0] = 1; 
	for (ll i = 1; i <= N; ++i) {
		p[i] = 2 * p[i - 1] + 1;
	}
	cout << eat(X, N, s, p) << endl;
	return 0;
}


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

using namespace std;

vector<string> im, pat;

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

    int n, m;
    cin >> n >> m;
    im.resize(n);
    for (int i = 0; i < n; i++) cin >> im[i];
    pat.resize(m);
    for (int i = 0; i < m; i++) cin >> pat[i];
    for (int sx = 0; sx <= n - m; sx++) {
        for (int sy = 0; sy <= n - m; sy++) {
            bool ok = true;
            for (int i = 0; i< m && ok; i++) {
                for (int j = 0; j < m && ok; j++) {
                    if (im[sx + i][sy + j] != pat[i][j]) {
                        ok = false;
                    }
                }
            }
            if (ok ) {
                cout << "Yes\n";
                exit(0);
            }
        }
    }
    cout << "No";
    exit(0);
}


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

bool tab[1000100];
vector<int> primes;

void primetab() {
	for(int i = 0; i < 1000100; i++)
		tab[i] = true;
	tab[0] = tab[1] = false;
	for(int i = 0; i < 1000100; i++) {
		if(tab[i]) {
			primes.push_back(i);
			for(int j = 2; j * i < 1000100; j++) {
				tab[j*i] = false;
			}
		}
	}
}

int main() {
	int n;
	primetab();
	while(cin >> n, n) {
		int ans = 0;
		for(int i = 0; primes[i] <= n / 2; i++) {
			if(tab[n-primes[i]])
				ans++;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 2564
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int k,s, res = 0;
    cin >> k >> s;
    for(int x=0; x<k+1; x++){
        for(int y=0; y<k+1; y++){
            int z = s - x - y;
            if(z>=0 && z<=k) res++;
        }
    }
    cout << res << endl;
}


Measured memory_bytes: 256
/*
Author: CNYALI_LK
LANG: C++
PROG: b.cpp
Mail: cnyalilk@vip.qq.com
*/
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define DEBUG printf("Passing [%s] in LINE %lld\n",__FUNCTION__,__LINE__)
#define Debug debug("Passing [%s] in LINE %lld\n",__FUNCTION__,__LINE__)
#define all(x) x.begin(),x.end()
using namespace std;
const double eps=1e-8;
const double pi=acos(-1.0);
typedef long long ll;
typedef pair<ll,ll> pii;
template<class T>ll chkmin(T &a,T b){return a>b?a=b,1:0;}
template<class T>ll chkmax(T &a,T b){return a<b?a=b,1:0;}
template<class T>T sqr(T a){return a*a;}
template<class T>T mmin(T a,T b){return a<b?a:b;}
template<class T>T mmax(T a,T b){return a>b?a:b;}
template<class T>T aabs(T a){return a<0?-a:a;}
#define min mmin
#define max mmax
#define abs aabs
ll read(){
	ll s=0,base=1;
	char c;
	while(!isdigit(c=getchar()))if(c=='-')base=-base;
	while(isdigit(c)){s=s*10+(c^48);c=getchar();}
	return s*base;
}
char WritellBuffer[1024];
template<class T>void write(T a,char end){
	ll cnt=0,fu=1;
	if(a<0){putchar('-');fu=-1;}
	do{WritellBuffer[++cnt]=fu*(a%10)+'0';a/=10;}while(a);
	while(cnt){putchar(WritellBuffer[cnt]);--cnt;}
	putchar(end);
}
int main(){
#ifdef cnyali_lk
	freopen("b.in","r",stdin);
	freopen("b.out","w",stdout);
#endif
	ll n=read(),k=read(),s=0;
	if(k){
		for(ll i=k+1;i<=n;++i){
			s+=(i-k)*((n-i+1)/i+1);
			if((n-k)/i!=(n-i+1)/i)s+=(n-k)%i+1;
		}	
		printf("%lld\n",s);
	}
	else{
		printf("%lld\n",n*n);
	}
	return 0;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner in = new Scanner(System.in);

		int a = in.nextInt();
		int b = in.nextInt();
		int c = in.nextInt();
		int ans = 0;

		for(a=a; a <= b; a++){
			if(c % a == 0){
				ans++;
			}
		}
		System.out.println(ans);

	}

}



Measured memory_bytes: 26392
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
A, B = map(int,input().split(' '))
if A < B:
  A,B = B,A
while A%B != 0:
  A,B = B,A % B
gcd = B
if gcd == 1:
  print(1)
  exit()
else:
  ans = set(prime_factorize(gcd))
  print(len(ans)+1)

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

int main() {
  int N, sum=1; cin >> N;
  vector<int> d(N);
  for(int i=0; i<N; i++) cin >> d.at(i);
  
  sort(d.begin(), d.end());
  
 // cout << d.at(0) << endl;
  for(int i=0; i<N-1; i++){
    if (d.at(i) != d.at(i+1)) sum ++;
  }
  cout << sum;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline
import numpy as np

def main():
    N = int(input())
    S = input().strip()
    rgb = [list() for i in range(3)]
    for i in range(N):
        if S[i] == "R":
            rgb[0].append(i)
        elif S[i] == "G":
            rgb[1].append(i)
        elif S[i] == "B":
            rgb[2].append(i)
    
    for i in range(3):
        rgb[i] = np.array(rgb[i])

    ans = 0
    for c in range(3):
        cm = c%3
        c1 = (c+1)%3
        c2 = (c+2)%3
        for m in rgb[cm]:
            tmp = len(set(np.abs(rgb[c1]-m)) & set(np.abs(rgb[c2]-m)))
            ans += tmp
    print(len(rgb[0])*len(rgb[1])*len(rgb[2])-ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 27624
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;

// const
// 円周率
const double pi = M_PI;
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
ll continuousmod(ll n, ll b, ll r) {
  ll d = b;
  ll res = 0;
  while (n / d>0) {
    res += n / d;
    d *= r;
  }
  return res;
}

int main() {
  // faster
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  ll n;
  cin >> n;
  if(n%2!=0){
    cout << 0 << endl;
    return 0;
  }
  cout << min(continuousmod(n, 10, 5), continuousmod(n, 2, 2)) << endl;

  return 0;
}


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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define pb push_back
#define ALL(obj) (obj).begin(), (obj).end()      //昇順
#define RALL(obj) (obj).rbegin(), (obj).rend()   //降順
#define print(obj) cout << obj << endl
#define scan(obj) cin >> obj

typedef long long ll;

using namespace std;

int main(void){
    int n, m;
    cin >> n >> m;
    int a[m] = {};
    rep(i, n){
        int k;
        cin >> k;
        rep(j, k){
            int temp;
            cin >> temp;
            a[temp - 1]++;
        }
    }
    int ans = 0;
    rep(i, m){
        if(a[i] == n){
            ans++;
        }
    }
    print(ans);
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll , ll> P;
typedef pair<ll, ll> PL;
const ll INT_INF = 2147483646;
const ll ll_INF = 9223372036854775807;
ll mod = 1e9+7;

bool SecondCompare(const pair<ll,ll> &a,const pair<ll,ll> &b)
{
       return a.second<b.second;
}
 
bool SecondCompareDes(const pair<ll,ll> &a,const pair<ll,ll> &b)
{
       return a.second>b.second;
}


double t,a,h[10010];
int n;

int main(){
    cin >> n >> t >> a;
    double min = 1000000;
    int ans;
    for(int i = 0; i < n; i++)
    {
        cin >> h[i];
        h[i] = t- h[i] * 0.006;
        if(abs(h[i]-a) < abs(min)){
            min = abs(h[i]-a);
            ans = i+1;
        }
    }
    cout << ans << endl;
}

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

int main(){
    int N,i,j;
    string output = "Yes";
    cin>>N;
    string list[N];
    for (i=0;i<N;i++){
        cin>>list[i];
        if(i!=0){
            if(list[i][0] != list[i-1][list[i-1].size()-1]){
                output = "No";
            }
        }
        for (j=0;j<i;j++){
            if (list[i]==list[j]){
                output = "No";
            }
        }
    }
    cout<<output<<endl;
}

Measured memory_bytes: 3632
def dividable(N,A):
    wareru = True
    for i in range(N):
        if A[i] % 2 != 0:
            wareru = False
            break
    return wareru

def divide(N,A):
    for i in range(N):
        A[i] = A[i] // 2
    return A


N = int(input())
A = [int(i) for i in input().split()]

times = 0

while dividable(N,A):
    A = divide(N,A)
    times += 1

print(times)


Measured memory_bytes: 3060
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int[] n = new int[6];
        int one=0;
        int two=0;
        int three=0;
        int four=0;
        
        for(int i=0; i<6; i++){
            n[i] = sc.nextInt();
            if(n[i]==1){
                one++;
            }else if(n[i]==2){
                two++;
            }else if(n[i]==3){
                three++;
            }else{
                four++;
            }
        }
        
        if(one<3 & two<3 && three<3 && four<3){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
        
        
        
        
   }
}


Measured memory_bytes: 35932
def main():
  import sys
  n,*d=map(int,sys.stdin.buffer.read().split())
  e=[0]*n
  for i in d:e[i]+=1
  a=1if d[0]<1else 0
  for i in d[1:]:a=a*e[i-1]%998244353
  print(a)
main()

Measured memory_bytes: 11628
#include<bits/stdc++.h>
using namespace std;
#define forr(i,a,n)	for(long long int i=a; i<n; i++)
#define loop(i,a,n)	for(long long int i=a; i>=n; i--)

int main() 
{
	ios_base :: sync_with_stdio(false),cin.tie(NULL),cout.tie(0);
	
	int a;
	cin>>a;
	cout<<a+a*a+a*a*a;
	
	return 0; 	
}

Measured memory_bytes: 3592
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

int main(){
  int n,k,v;
  int x[10000],a[10];
  bool use[10000];

  scanf("%d %d",&n,&k);

  if(n==k){
    for(int i=0;i<k;i++)a[i] = i;
  }else{
    for(int i=0;i<n;i++)use[i] = false;
    while(k--){
      for(int i=0;i<n;i++)x[i] = 1&i;
      while(1){
	bool f = true;
	for(int i=0;i<n;i++){
	  if(use[i] && x[i])f = false;
	}
	if(f){
	  printf("?");
	  for(int i=0;i<n;i++)printf("%d",x[i]);
	  printf("\n");
	  fflush(stdout);
	  scanf("%d",&v);
	  if(v)break;
	}
	random_shuffle(x,x+n);
      }
      vector<int> cand;
      for(int i=0;i<n;i++){
	if(x[i])cand.push_back(i);
      }

      while(cand.size()!=1){
	vector<int> c1,c2;
	for(int i=0;i<(int)cand.size()/2;i++)c1.push_back(cand[i]);
	for(int i=(int)cand.size()/2;i<(int)cand.size();i++)c2.push_back(cand[i]);
	cand.clear();

	for(int i=0;i<n;i++)x[i] = 0;
	for(int i=0;i<(int)c1.size();i++)x[c1[i]] = 1;

	printf("?");
	for(int i=0;i<n;i++)printf("%d",x[i]);
	printf("\n");
	fflush(stdout);
	scanf("%d",&v);
	if(v){
	  for(int i=0;i<(int)c1.size();i++)cand.push_back(c1[i]);
	}else{
	  for(int i=0;i<(int)c2.size();i++)cand.push_back(c2[i]);
	}
      }
      use[cand[0]] = true;
    }
    k = 0;
    for(int i=0;i<n;i++){
      if(use[i])a[k++] = i;
    }
  }

  printf("!%d",a[0]+1);
  for(int i=1;i<k;i++)printf(" %d",a[i]+1);
  printf("\n");
  fflush(stdout);
}

Measured memory_bytes: 940
#include "bits/stdc++.h"

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL << (n))
#define sz(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );
#define en '\n'
#define pb push_back
#define P pair<int, int>

typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { ll g = gcd(a, b); return a / g * b; }
const int dx[4] = { 1, 0, -1,  0 };
const int dy[4] = { 0, 1,  0, -1 };
const int INF = (int)1e9;
const ll  inf = (ll)1e18;
const int mod = 1000000007;

int N;
int A, B, C;
vector<int> L;

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

int rec(int i, int a, int b, int c) {
	if (i == N) {
		if (!a || !b || !c) return INF;
		return abs(a - A) + abs(b - B) + abs(c - C);
	}

	int res = rec(i + 1, a, b, c);

	chmin(res, rec(i + 1, a + L[i], b, c) + (a ? 10 : 0));
	chmin(res, rec(i + 1, a, b + L[i], c) + (b ? 10 : 0));
	chmin(res, rec(i + 1, a, b, c + L[i]) + (c ? 10 : 0));

	return res;
}

int main() {
	cin >> N;
	cin >> A >> B >> C;
	L.resize(N);
	for (int i = 0; i < N; i++) {
		cin >> L[i];
	}
	cout << rec(0, 0, 0, 0) << endl;
}

Measured memory_bytes: 256
n,k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
if k == 1:
  print(0)
  exit()
  
b = [int(i)+1 for i in range(n-1)]
ans = float('inf')
import itertools
for j in itertools.combinations(b, k-1):
  s = list(j)
  now_high = a[0]
  cost = 0
  for l in range(1,n):
    if l in s:
      if a[l] > now_high:
        now_high = a[l]
        continue
      else:
        cost += (now_high-a[l]+1)
        now_high += 1
    now_high = max(now_high, a[l])
  ans =  min(ans,cost)
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define MAX 99999999999ll
#define MIN -99999999999ll
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
int main() {
cout << fixed << setprecision(30);
  ll n;
  string s;
  cin2(n,s);
  vec a(n);
  vec b(n);
  vec c(n);
  ll Ecount=0,Wcount=0;
  loop(i,n){
    a[i]+=Ecount;
    if(s[i]=='E')Ecount++;
  }
  pool(i,n){
    b[i]+=Wcount;
    if(s[i]=='W')Wcount++;
  }
  loop(i,n){
    c[i]=a[i]+b[i];
  }
  sort(all(c));
  putout(n-1-c[n-1]);
}

Measured memory_bytes: 7684
abc_list = [chr(i) for i in range(97,97+26)]
input_list = list(input())
p_flag = 0
for i in abc_list:
    try:
        input_list.remove(i)
    except:
        print(i)
        p_flag = 1
        break
if(p_flag == 0):
    print("None")

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

using namespace std;

int main(void){
	int n , a[3];
	cin >> n;
	for (int i=0; i<n; i++){
		cin >> a[0] >> a[1] >> a[2];
		sort(a,a+3);
		if (a[0]*a[0]+a[1]*a[1]==a[2]*a[2]){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}


	return 0;
}

Measured memory_bytes: 1168
a, b = map(int, input().split())

pa = 0 - -a//0.08
pb = b/0.1

ref = max(pa, pb)
refmin = min(pa, pb)

ta = int(ref*0.08)
tb = int(ref*0.1)

flag = 0

for i in range(2000):
    if i == 1999:
        print(-1)
    elif ta != a or tb != b and flag == 0:
        ref -= 1
        ta = int(ref*0.08)
        tb = int(ref*0.1)
        if ta == a and tb == b:
            flag += 1

    elif ta == a and tb == b:
        flag += 1
        ref -= 1
        ta = int(ref*0.08)
        tb = int(ref*0.1)
        if ta != a or tb != b:
            print(int(ref + 1))
            break
    else:
        print(-1)
        break

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[]args) {
		try(Scanner scan = new Scanner(System.in)){

			int N = scan.nextInt();
			int M = scan.nextInt();
			int K = scan.nextInt();



			int goukei = 0;
			int ok = 0;
			for(int i = 0;i<=N;i++) {
				for(int j = 0;j<=M;j++) {
					goukei =  i*M+j*N-2*i*j;
					if(goukei==K) {
						ok=1;break;
					}
				}
			}

			if(ok==1)System.out.println("Yes");
			else System.out.println("No");

		}


	}


}


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

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()

typedef long long ll;

const char nl = '\n' ;


int main()
{
   ios_base::sync_with_stdio(0); cin.tie(0);
   int n;
   cin >> n;
   int a[n+1];
   int sum = 0;
   for(int i = 1; i <= n; i++)
   {
      cin >> a[i];
      sum += a[i];
   }

   int m; cin >> m;
   for(int i = 0; i < m; i++)
   {
      int x, y; cin >> x >> y;
      cout << sum - a[x] + y << nl;
   }

	return 0;
}


Measured memory_bytes: 3616