akhauriyash/Code-Regression huggingface dataset:
#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;
 
#define ll              long long int
#define ld              long double
#define F               first
#define S               second
#define pb              push_back
#define si              set <int>
#define vi              vector <int>
#define pii             pair <int, int>
#define vpi             vector <pii>
#define vpp             vector <pair<int, pii>>
#define mii             map <int, int>
#define mpi             map <pii, int>
#define spi             set <pii>
#define endl            "\n"
#define sz(x)           ((int) x.size())
#define all(p)          p.begin(), p.end()
#define que_max         priority_queue <int>
#define que_min         priority_queue <int, vi, greater<int>>
#define print(a)        for (auto x : a) cout << x << " "; cout << endl
#define Print(a,x,y)    for (int i=x; i<y; i++) cout<< a[i]<< " "; cout << endl
#define fast            ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

inline ll power(ll a, ll b)
{
     ll x = 1;
     while (b)
     {
          if (b & 1) x *= a;
          a *= a;
          b >>= 1;
     }
     return x;
}
////// Variables //////
int tc;

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

void solve(){
    int n,k;
    cin >> n >> k;
    int A[10] = {0};
    
    for(int i=0;i<k;i++){
        int u;
        cin >> u;
        A[u]++;
    }
    
    int ans = n;
    
    while(true){
        int s = 1,ss=ans;
        while(ss){
            if(A[ss%10] == 1){
                s=0;
                break;
            }
            ss/=10;
        }
        if(s==1){
            cout<<ans;
            return ;
        }
        ans++;
    }
}
int32_t main(){
    fast
    cout<< setprecision(10) << fixed;
    tc=1;
    clock_t z = clock();
    //cin >> tc;
    while(tc--){
        solve();
    }
   // cerr << "Runtime: "<<((double)(clock()-z)/CLOCKS_PER_SEC);
    return 0;
}

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

int main(){
    string O, E;
    cin >> O >> E;
    
    for(int i = 0; i < E.size(); i++){
        cout << O[i] << E[i];
    }
    if(O.size() != E.size()){
        cout << O[O.size() - 1];
    }
    
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
	ll n,ans=0;cin>>n;
	ll mini=pow(10,17);
	for (int i = 0; i < n; ++i)
	{
		ll x;cin>>x;
		if(x<mini){
			ans++;
			mini=x;
		}
	}
	cout<<ans<<"\n";
}    

Measured memory_bytes: 256
import java.util.Scanner;

public class Main
{
	public static void main(String arg[])
	{
		Scanner sc = new Scanner(System.in);
		String str = sc.nextLine();
		char ch[] = str.toCharArray();

		for(int i=0 ; i<ch.length-4;i++)
		{
			if(ch[i] =='a'&&ch[i+1] =='p'&&ch[i+2] =='p'&&ch[i+3] =='l'&&ch[i+4] =='e')
			{
				ch[i]='p';
				ch[i+1]='e';
				ch[i+2]='a';
				ch[i+3]='c';
				ch[i+4]='h';
			}
			else if(ch[i] =='p'&&ch[i+1] =='e'&&ch[i+2] =='a'&&ch[i+3] =='c'&&ch[i+4] =='h')
			{
				ch[i]='a';
				ch[i+1]='p';
				ch[i+2]='p';
				ch[i+3]='l';
				ch[i+4]='e';
			}
		}
		System.out.println(ch);
	}
}

Measured memory_bytes: 12000
#include <bits/stdc++.h>
#include<algorithm>
using namespace std;
#define ll long long 
const int MAX = 510000;
const ll mod = 1000000007;
int main() {
  int n;
  cin >> n;
  
  int res = 0;
  for(int i = 1;i<n;i++){
    for(int j = 1;j<=sqrt(i);j++){
      if(i%j == 0 && i/j != j){
        res += 2;
      }else if(i%j == 0 && i/j == j){
        res++;
      }
    }
  }
  
  cout << res;
}


Measured memory_bytes: 3676
#include <bits/stdc++.h>
#include <iostream>
#include <utility>
#include <algorithm>
#include <numeric>
#define load ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
#define ll long long
#define ull unsigned long long
#define fori(i,n) for (int i=0; i<int(n);i++)
#define srt(v) sort(v.begin(), v.end())
#define MOD 1000000007
const int INF = 1e9;
const double PI = 3.14159265358979323846;

ll gcd(ll a, ll b) {
    return b != 0 ? gcd(b, a % b) : a;
}
 
ll lcm(ll a, ll b) {
    return (a * b) / gcd(a, b);
}

void solve(){

}

int main(){
	load;
    ll a;
    double b;
    cin >> a >> b;
    ll temp = b*100+0.5;
    cout << (a*temp)/100 << "\n";
	return 0;
}



Measured memory_bytes: 3732
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

int N,K;
string s;
vector<int> v;

int main(){
    cin >> N >> K;
    cin >> s;
    char c = '1';
    int l = 0;
    for(int i=0;i<s.size();i++){
        if(c != s[i]){
            c = s[i];
            v.push_back(l);
            l = 1;
        }else{
            l++;
        }
    }
    v.push_back(l);
    if(s[s.size()-1] != '1') v.push_back(0);
    if(v.size()/2 + 1 <= K){
        cout << N << endl;
        return 0;
    }
    int sum = 0;
    for(int i=0;i<2*K+1;i++){
        sum += v[i];
    }
    int m = sum;
    int a = 0;
    int b = 2*K+1;
    while(true){
        if(b+1 > v.size()) break;
        sum -= v[a] + v[a+1];
        sum += v[b] + v[b+1];
        m = max(m,sum);
        a += 2;
        b += 2;
    }
    cout << m << endl;
    return 0;
}

Measured memory_bytes: 1020
using System;
using System.Collections.Generic;

namespace ConsoleApplication1
{

    class Program
    {

        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            if(n == 25)
            {
                Console.WriteLine("Christmas");
            }
            else if(n == 24)
            {
                Console.WriteLine("Christmas Eve");
            }
            else if (n == 23)
            {
                Console.WriteLine("Christmas Eve Eve");
            }
            else
            {
                Console.WriteLine("Christmas Eve Eve Eve");
            }
        }
    }
}


Measured memory_bytes: 11092
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <vector>
#include <limits.h>
using namespace std;
int N;
long long int K;
int P[5001];
long long int C[5001];
long long int Max=LLONG_MIN;
int main(){
	cin >> N >> K;
	for(int i=1;i<=N;i++)cin >> P[i];
	for(int i=1;i<=N;i++)cin >> C[i];

	for(int i=1;i<=N;i++){
		//printf("i=%d\n",i);
		int start =i;
		int now=0;
		long long int cy_sum=0;
		long long int cy_len=0;
		//cy_sum = C[start];
		while(start!=now){
			if(now == 0)now = P[start];
			else now=P[now];
			cy_sum += C[now];
			cy_len++;
		}
		start =i;
		now=P[start];
		//printf("len=%lld\n",cy_len);
		//printf("sum=%lld\n",cy_sum);
		
		long long int Sum=0;
		
		//printf(" d = %d Cycle_d_Sum = %lld\n",d,d*cy_sum);
		//if(d>0)Max = max(Max,Sum+(d-1)*cy_sum);
		for(int j=1;j<=cy_len && j<=K;j++){
			Sum+=C[now];
			Max = max(Sum,Max);
			//printf("j= %d start = %d now = %d Sum =%lld Max = %lld\n",j,start,now,Sum,Max);
			long long int d = (K-j)/cy_len;
			Max = max(Max,Sum+d*cy_sum);
			now = P[now];
		}
		//printf("Max = %lld\n",Max);
		
	}
	cout << Max << endl;
	return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using p = pair<lint, lint>;
#define REP(i, end) for(int i=0,i##_end_=(end);i<i##_end_;i++)

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<p> LR(N);
    REP(i, N) cin >> LR[i].first >> LR[i].second;
    sort(LR.begin(), LR.end(), [](p l, p r) { return l.first + l.second > r.first + r.second; });

    vector<pint> w(N, {N / 2, N / 2});
    REP(i, N / 2) w[i] = make_pair(i, i + 1), w[N - 1 - i] = make_pair(i + 1, i);
    vector<lint> dp(N + 1, 1e18);
    dp[0] = 0;
    REP(i, N)
    {
        for (int j = i; j >= 0; j--)
        {
            lint t = dp[j] + LR[i].first * w[j].first + LR[i].second * w[j].second;
            if (dp[j + 1] > t) dp[j + 1] = t;
            dp[j] += LR[i].first * w[N - 1 - i + j].first + LR[i].second * w[N - 1 - i + j].second;
        }
    }
    cout << *min_element(dp.begin(), dp.end()) << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
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; }
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 const INF = 1001001001;
ll const MOD = 1000000007;


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

string S;
cin >> S;

set<char> st;
string T = "abcdefghijklmnopqrstuvwxyz";
rep(i,T.size()) {
    st.insert(T[i]);
}

rep(i,S.size()) {
    int c = st.erase(S[i]);
}

if(st.size() == 0) cout << "None" << endl;
else cout << *st.begin() << endl;

return 0;
}

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

int main(){
  int n;
  int sum=0;
  string s;

  while(1){
    
    cin >> s;
    if(s == "0")break;

    for(int i=0;i < s.size();i++)
      {
	sum += s[i] - '0';
      }
    
    cout << sum << endl;
    sum = 0;
  }
}



Measured memory_bytes: 3208
#include<bits/stdc++.h> 
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;
#define fi first
#define se second
map<ll,ll> mp;
const ll mod=1000000007;
int main(){
    int n,x;
    cin>>n>>x;
    vector<int> a(n);
    for(int i=0;i<n;i++)cin>>a.at(i);
    sort(a.begin(),a.end());
    int cnt=0;
    for(int i=0;i<n;i++){

        if(i!=n-1&&x>=a.at(i)){
            cnt++;
            x-=a.at(i);
        }
        else if(x==a.at(i))cnt++;
        else break;
    }
    cout<<cnt<<endl;
}



Measured memory_bytes: 256
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

ans = 0

for a in A:
    ans += B[a-1]

for i in range(n-1):
    if A[i] + 1 == A[i+1]:
        ans += C[A[i]-1]

print(ans)

Measured memory_bytes: 38256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n, k, x, y;
  cin >> n >> k >> x >> y;
  
  int ans;
  if (n <= k) ans = x * n;
  else ans = x*k + y*(n-k);
  
  cout << ans << endl;
}

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

  int N,L;
  cin>>N>>L;
  int min=999999;
  for(int i=0;i<=N-1;i++){
  
    if(abs(min)>abs(L+i)){
    
      min=L+i;
    }
  }
  int allsum=0;
  for(int i=0;i<=N-1;i++){
  
    allsum+=L+i;
  }
  cout<<allsum-min;
}

Measured memory_bytes: 3644
#include<iostream>
#include <algorithm>
#include <string>
using namespace std;
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
typedef long long ll;
const int INF = numeric_limits<int>::max();
const int MOD = (1e9 + 7);


int main(){
  ll a, b, x, c;
  cin >> a >> b >> x;
  if(a%x) a += x - a%x;
  if(b%x) b -= b%x;
  c = (b - a)/ x;
  cout << c+1 << endl;
 
 }


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long int
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair(x,y)
#define mem(a,val) memset(a,val,sizeof(a))
#define eb emplace_back
#define f first
#define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define s second
#define rep(i, a, b) for(int i = int(a); i <= int(b); ++i)
using namespace std;

int arr[100005];

int main(){
    faster
    int T = 1;
    while(T--){
        int n,l;
        cin>>n>>l;
        
        rep(i,0,n-1) {
            cin>>arr[i];
        }
        
        int ind;
        
        int f = 0;
        rep(i,0,n-2){
            if(arr[i]+arr[i+1] >= l){
                f = 1;
                ind = i;
                break;
            }
        }
        
        
        if(!f){
            cout<<"Impossible";
        } else{
            cout<<"Possible\n";
            for(int i=0; i<ind; i++){
                cout<<i+1<<" ";
            }
            for(int i=n-2; i>ind; i--){
                cout<<i+1<<" ";
            }
            cout<<ind+1;
        }
        
        
    }
    return 0;
}








Measured memory_bytes: 1280
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const double PI = 3.14159265358979323846264338327950288;
//========================================================================

ll gcd(ll a, ll b) {
	if (a < b) {
		ll tmp = a;
		a = b;
		b = tmp;
	}

	ll r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}

	return b;
}

int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	//==================================


	int N;
	cin >> N;

	vll A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}


	vll L(N), R(N);
	L[0] = A[0];
	R[N-1] = A[N-1];

	// A[0]-A[i]の最大公約数
	for (int i = 1; i < N; i++) {
		L[i] = gcd(L[i - 1], A[i]);
	}

	// A[i]-A[N-1]の最大公約数
	for (int i = N - 2; i >= 0; i--) {
		R[i] = gcd(R[i + 1], A[i]);
	}

	vll ans(N);
	ans[0] = R[1];
	ans[N - 1] = L[N - 2];
	for(int i = 1;i<N-1;i++){
		ans[i] = gcd(L[i - 1], R[i + 1]);
	}

	ll fin = 0;
	for (int i = 0; i < N; i++) {
		fin = max(fin, ans[i]);
	}

	cout << fin;

}


Measured memory_bytes: 3456
n, k = map(int, input().split())
a_s = list(map(int, input().split()))
dp = ["Second"] * (k + 1)
for i in range(k + 1):
    if dp[i] == "Second":
        for a in a_s:
            ii = i + a
            if ii <= k:
                dp[ii] = "First"
print(dp[-1])


Measured memory_bytes: 3828
s = input()
t = input()
ans = 10 ** 10
ls = len(s)
lt = len(t)
for i in range(ls - lt + 1):
    cnt = 0
    for j in range(lt):
        if s[i + j] != t[j]:
            cnt += 1
    ans = min(ans, cnt)
print(ans)


Measured memory_bytes: 9052
#include <iostream>
using namespace std;
int main(void){
    int N, T, min = 1001;
    cin >> N >> T;
    
    for (int i = 0; i < N; ++i)
    {
        int Ni, Ti;
        cin >> Ni >> Ti;
        
        if (Ti > T) continue;
        if (min > Ni) min = Ni;
    }
    
    if (min == 1001)
    {
        cout << "TLE";
        return 0;
    }
    
    cout << min;
}


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

using namespace std;

#ifdef Adrian
#include "debug.h"
#else
#define debug(...) 9999
#endif

typedef long long ll;
typedef long double ld;
typedef complex<ld> point;
#define F first
#define S second
#define ii pair<ll,ll>
template <typename G>
struct triple{G F, S, T;};
#define iii triple<int>



int main()
{

#ifdef Adrian
    //freopen("test.txt", "r", stdin);
#else
    ios_base::sync_with_stdio(0); cin.tie(0);cout.tie(0);
#endif


    int n;
    cin>>n;

    cout<<360 / __gcd(n, 360)<<'\n';



    return 0;
}


Measured memory_bytes: 3648
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

N, K = reads()
x = reads()

ans = 1 << 60

for i in range(N-K+1):
  ans = min(ans, abs(x[i]) + x[i+K-1] - x[i])
  ans = min(ans, abs(x[i+K-1]) + x[i+K-1] - x[i])

print(ans)

Measured memory_bytes: 14748
#include<bits/stdc++.h>
using namespace std;
#define int     long long
#define ld      long double
#define F       first
#define S       second
long double PI = 2*acos(0.0);
#define _READ   freopen("input.txt","r", stdin);
#define _FAST   ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
void solve()
{
    ld a,b,h,m;
    cin>>a>>b>>h>>m;
    ld angle_min=m*6;
    ld angle_hr=h*30+((ld)30/360)*angle_min;
    ld angle=angle_hr-angle_min;
    //cout<<cos(angle*PI/180.0)<<"\n";
    ld ans=sqrt(a*a+b*b-2*a*b*cos(angle*PI/180.0));
    cout<<fixed<<setprecision(15)<<ans;
}
int32_t main()
{
    clock_t tStart = clock();
    #ifndef ONLINE_JUDGE
    _READ
    #endif
    
    int t;
    t=1;
    while(t--)
        solve();
    
    #ifndef ONLINE_JUDGE
    cout<<fixed<<setprecision(5)<<"\nTime taken: "<<(double)(clock() - tStart)/CLOCKS_PER_SEC;
    #endif
    
    return 0;
}
/*
===FOR N-Dimensional Vector===
https://codeforces.com/blog/entry/76149
g++ -std=c++17 -Wshadow -Wall -g -fsanitize=address -fsanitize=undefined a.cpp -o a -D_GLIBCXX_DEBUG
*/

Measured memory_bytes: 4112
//use itertools::Itertools;
use std::cmp;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
use std::collections::BinaryHeap;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::io::Read;
use std::usize::MAX;

macro_rules! input {(source = $s:expr, $($r:tt)*) => {let mut iter = $s.split_whitespace();let mut next = || { iter.next().unwrap() };input_inner!{next, $($r)*}};($($r:tt)*) => {let stdin = std::io::stdin();let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));let mut next = move || -> String{bytes.by_ref().map(|r|r.unwrap() as char).skip_while(|c|c.is_whitespace()).take_while(|c|!c.is_whitespace()).collect()};input_inner!{next, $($r)*}};}
macro_rules! input_inner {($next:expr) => {};($next:expr, ) => {};($next:expr, $var:ident : $t:tt $($r:tt)*) => {let $var = read_value!($next, $t);input_inner!{$next $($r)*}};}
macro_rules! read_value {($next:expr, ( $($t:tt),* )) => {( $(read_value!($next, $t)),* )};($next:expr, [ $t:tt ; $len:expr ]) => {(0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()};($next:expr, chars) => {read_value!($next, String).chars().collect::<Vec<char>>()};($next:expr, usize1) => {read_value!($next, usize) - 1};($next:expr, [ $t:tt ]) => {{let len = read_value!($next, usize);(0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()}};($next:expr, $t:ty) => {$next().parse::<$t>().expect("Parse error")};}

fn solve() {
    input! {
        n: usize,
        d: usize,
        pos :[(i64,i64);n]
    }

    let mut ans = 0;

    for i in 0..n {
        let dist = ((pos[i].0.abs().pow(2) + pos[i].1.abs().pow(2)) as f64)
            .sqrt()
            .ceil() as usize;

        if dist <= d {
            ans += 1;
        }
    }

    println!("\n{}", ans);
}

fn main() {
    let thd = std::thread::Builder::new().stack_size(104_857_600);
    thd.spawn(|| solve()).unwrap().join().unwrap();

    /*
    // 入力を一括で読み込む場合
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut input = buf.split_whitespace();

    // inputに対しnext()で読み込んでいく
    let q: usize = input.next().unwrap().parse().unwrap();
    */
}

const LARGE_PRIME: u64 = 1_000_000_007;

// @〜でsnippet


Measured memory_bytes: 4332
<?php

while (true) {
	$s = explode(" ", rtrim(fgets(STDIN)));
	if ($s[1] == "+") {
		echo intval($s[0]) + intval($s[2]), PHP_EOL;
	} else if ($s[1] == "-") {
		echo intval($s[0]) - intval($s[2]), PHP_EOL;
	} else if ($s[1] == "*") {
		echo intval($s[0]) * intval($s[2]), PHP_EOL;
	} else if ($s[1] == "/") {
		echo floor(intval($s[0]) / intval($s[2])), PHP_EOL;
	} else if ($s[1] == "?") {
		break;
	} else {
		break;
	}
}

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

vector<int> enum_prime(int n){   // containing n
    vector<int> res;
    if (n <= 1) return res;
    vector<bool> p(n + 1);
    fill(p.begin() + 2, p.end(), true);
    for(int i = 2; i <= n; i++){
        if(p[i]){
            res.push_back(i);
            for(int j = i * 2; j <= n; j += i) p[j] = false;
        }
    }
    return res;
}

int main()
{
    int n;
    cin >> n;
    vector<int> prime = enum_prime(320);
    int l = prime.size();
    map<vector<int>, map<ll, int>> mp;
    for(int i = 0; i < n; i++){
        ll s;
        cin >> s;
        vector<int> v(l);
        for(int j = 0; j < l; j++){
            int p = prime[j];
            while(s % p == 0){
                s /= p;
                v[j]++;
            }
            v[j] %= 3;
        }
        mp[v][s]++;
    }
    int ans = n;
    map<vector<int>, bool> mpb;
    for(auto itr1 = mp.begin(); itr1 != mp.end(); itr1++){
        map<ll, int> mp1 = itr1->second;
        vector<int> v = itr1->first;
        mpb[v] = true;
        bool f = true;
        for(int i = 0; i < l; i++){
            v[i] = (3 - v[i]) % 3;
            if(v[i] != 0) f = false;
        }
        if(f){
            for(auto itr2 = mp1.begin(); itr2 != mp1.end(); itr2++){
                if(itr2->first == 1) ans -= max(0, itr2->second - 1);
                else if(itr2->first < 1000000) ans -= min(itr2->second, mp1[itr2->first * itr2->first]);
            }
            continue;
        }
        map<ll, int> mp2 = mp[v];
        for(auto itr2 = mp1.begin(); itr2 != mp1.end(); itr2++){
            if(itr2->first == 1 && mpb[v]) continue;
            if(itr2->first >= 1000000) continue;
            ans -= min(itr2->second, mp2[itr2->first * itr2->first]);
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 41344
#include<bits/stdc++.h>
#define __  ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);


using namespace std;

int main()
{
    __

    int n,cnt=0;
    string a,b,c;
    cin>>n>>a>>b>>c;

    for(int i=0;i<n;i++)
    {
        if(a[i]!=b[i] && b[i]!=c[i] && c[i]!=a[i]) cnt+=2;
        else if((a[i]==b[i] && b[i]!=c[i])|| (a[i]==c[i] && c[i]!=b[i]) || (b[i]==c[i] && c[i]!=a[i])) cnt++;

    }
        cout<<cnt<<endl;

    return 0;

}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <unordered_map>
#include <vector>

using namespace std;

typedef long long lint;

constexpr int MAXN = 2e5;

int memo[MAXN][2 + 1];

int solve(const string& s, int i, int last_id) {
  if (i == s.size()) {
    return 0;
  }
  if (last_id != -1 && memo[i][i - last_id] != -1)
    return memo[i][i - last_id];
  int result = INT_MIN / 2;
  for (int l = 1; l <= 2 && i + l <= s.size(); ++l) {
    if (last_id != -1 && i - last_id == l &&
        equal(s.begin() + last_id, s.begin() + i, s.begin() + i)) {
      continue;
    }
    result = max(result, 1 + solve(s, i + l, i));
  }
  return memo[i][i - last_id] = result;
}

int main() {
  memset(memo, -1, sizeof(memo));

  string s;
  cin >> s;
  printf("%d\n", solve(s, 0, -1));
  return 0;
}


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

/**
|||||||||||||       |||||     |||||    ||||||||||
||||||||||||||      |||||     |||||  |||||
|||||     |||||     |||||     |||||  |||||
||||||||||||||||    |||||||||||||||    ||||||||||
|||||||||||||||||   |||||||||||||||           |||||
|||||        |||||  |||||     |||||           |||||
|||||         ||||| |||||     |||||    ||||||||||
AHMED;HASSAN;SAEED;
*/

using namespace std;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string ds[3]={"Sunny","Cloudy","Rainy"};
    string s;
    cin>>s;
    string *in=find(ds,ds+3,s);

    cout << ds[((in-ds)+1)%3] << endl;
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int N, M;
	scanf("%d%d",&N, &M);
	int K[N];
	int i = 0;
	int j,k;
	int A[N + 1][M + 1];
	i = 0;
	while (i < N)
	{
		scanf("%d", &K[i]);
		j = 0;
		while (j < K[i])
			scanf("%d", &A[i][j++]);
		i++;
	}
	// i = 0;
	// while (i < N)
	// {
	// 	j = 0;
	// 	while (j < K[i])
	// 	{
	// 		printf("%d ", A[i][j]);
	// 		j++;
	// 	}
	// 	printf("\n");
	// 	i++;
	// }
	i = 1;
	int count;
	int ans = 0;
	while (i <= M)
	{
		j = 0;
		count = 0;
		while (j < N)
		{
			k = 0;
			while (k <= K[j])
			{
				if (i == A[j][k])
				{
					count++;
					break ;
				}
				k++;
			}
			j++;
		}
		if (count == N)
			ans++;
		i++;
	}
	printf("%d\n", ans);
	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,b) FOR(i,0,b)
#define BE(c) c.begin(),c.end()
#define PB push_back
#define F first
#define S second
#define BEB(s) s
using namespace std;
int main(){
	string s;
	int ans=0;
	while(cin>>s){
		bool f=true;
		REP(i,s.size()/2){
			if(s[i]!=s[s.size()-i-1])f=false;
		}
		if(f)ans++;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1184
n,k = map(int,input().split())
a = []
a.append(n+1)
for i in range(n):
  t = a[i] + n - 2*i - 2
  a.append(t)
  
total = 0
for i in range(k-1,n+1):
  total += a[i]
  total = total % 1000000007

print(total)

Measured memory_bytes: 16904
#include<algorithm>
#include<cmath>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using namespace std;
using uint = unsigned int;
using ll = long long;
const int M = 1e9 + 7;
const ll MLL = 1e18L + 9;
#pragma unused(M)
#pragma unused(MLL)
#ifdef LOCAL
#include"rprint.hpp"
#else
template <ostream& out = cout, class... T> void prints(T&&...){ }
template <ostream& out = cout, class... T> void printd(T&&...){ }
template <ostream& out = cout, class... T> void printb(T&&...){ }
template <ostream& out = cout, class... T> void printArr(T&&...){ }
#endif

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    vector<int> hs(n);
    for(int i = 0; i < n; i++){
        // cin >> hs[i];
        scanf("%d", &hs[i]);
    }
    sort(hs.rbegin(), hs.rend());
    auto solve = [&](int num){
        int cnt = num;
        for(int i = 0; i < n; i++){
            ll hp = hs[i] - b * num;
            if(hp <= 0){ break; }
            cnt -= (hp + a - b - 1) / (a - b);
            if(cnt < 0){
                break;
            }
        }
        return cnt >= 0;
    };
    int l = 0, r = 1e9;
    while(l < r){
        int piv = (l + r) / 2;
        if(solve(piv)){
            r = piv;
        }else{
            l = piv + 1;
        }
        prints(l, r);
    }
    cout << l << '\n';
    return 0;
}


Measured memory_bytes: 640
fun main(args: Array<String>) {
    val (a, b, c, d) = readLine()!!.split(" ").map(String::toLong)

    println((b-(a-1)) - (b/c-(a-1)/c) - (b/d-(a-1)/d) + b/lcm(c, d)-(a-1)/lcm(c, d))
}

fun lcm(a: Long, b: Long): Long {
    return a * b / gcd(a, b)
}

fun gcd(a: Long, b: Long): Long {
    return if (b == 0L) a else gcd(b, a % b)
}

Measured memory_bytes: 37796
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
int main(){
    int a,b,c,d,e;
    cin >> a >> b >> c >> d >> e;
    int ans;
    if(a == 0) ans = 1;
    if(b == 0) ans = 2;
    if(c == 0) ans = 3;
    if(d == 0) ans = 4;
    if(e == 0) ans = 5;
    cout << ans << endl;
    return 0;
    
}

Measured memory_bytes: 3620
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
string YesNo[] = {"No","Yes"};
#define loop(i,N) for(int i=0; i<(N); i++)
#define sort_all(v) sort(v.begin(),v.end())
template<typename T>
auto input(int N) {
    vector<T> v(N);
    loop(i,N)
        cin >> v[i];
    return move(v);
}

string BadGood[] = {"Good","Bad"};

int main(void)
{
    string S;
    cin >> S;

    cout << BadGood[int(S[0]==S[1] || S[1]==S[2] || S[2]==S[3])] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define ll long long
#define ull unsigned long long
#define ld long double
#define vl vector<long long>
#define vvl vector<vector<long long>>
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rrep(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define pll pair<long long,long long>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define vvc vector<vector<char>>
#define vc vector<char>
#define vvb vector<vector<bool>>
#define vb vector<bool>
#define maxe(x) *max_element(all(x))
#define mine(x) *min_element(all(x))
#define Size(x) ((int)(x).size())
#define umap unordered_map
const long long INF = 1LL << 60;
const long double pi = 3.1415926535897932;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

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

//lis,modpow,uf,modncr,soinsubunkai,yakusurekkyo,gyakugen
//mint,dijkstra

    signed main(){
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        ll a,b,c,d;
        cin>>a>>b>>c>>d;
        ll l1=(a-1)/c;
        ll l2=(a-1)/d;
        ll r1=b/c;
        ll r2=b/d;
        ll cd=c*d/__gcd(c,d);
        ll l4=b/cd;
        ll l3=(a-1)/cd;
        cout<<b-r1-r2+l4-(a-1-l1-l2+l3)<<endl;
    }

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

int main(){

  int x, y, z[12]={0,3,0,1,0,1,0,0,1,0,1,0};

  cin>>x>>y;

  if(z[x-1]==z[y-1]) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  
  return 0;
}


Measured memory_bytes: 256
n,s=parse.(readlines());A=3n;f(b,n)=n<b?n:f(b,n÷b)+n%b;g(b)=A>b>1&&f(b,n)==s?b:A;A=g(n+1);for b=1:isqrt(n);A=g(b);A=g((n-s)÷b+1);end;show(A>2n?-1:A)

Measured memory_bytes: 154376
#include<stdio.h>
int main(void){
	int n,T;
	int c,t,min=1001;
	for(scanf("%d %d",&n,&T);n;n--){
		scanf("%d %d",&c,&t);
			if(t<=T&&c<min){min=c;}
	}
	min!=1001?printf("%d",min):printf("TLE");
	return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-        
import numpy as np
from collections import Counter

h, w = list(map(int,input().split()))
graph = np.zeros((10,10)).astype('int32')
a = np.zeros((h,w)).astype('int32')
for i in range(10):
    graph[i] = list(map(int,input().split()))
for i in range(h):
    a[i] = list(map(int,input().split()))

e, v = 90, 10
path = np.zeros((v,v)).astype('uint32')

for i in range(v):
    for j in range(v):
            path[i][j] = j
            
for k in range(v):
    for i in range(v):
        for j in range(v):
            if(graph[i][k]+graph[k][j]<graph[i][j]):
                graph[i][j] = graph[i][k]+graph[k][j]
                path[i][j] = path[i][k]
                
            
apy = a.ravel().tolist()
cnt = Counter(apy)
ans = 0
for i in range(10):
    ans += cnt[i]*graph[i][1]
print(ans)

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

const int maxn(1e5 + 5);

int n, k;
vector <int> st[maxn];

int main() {
	scanf("%d", &n);
	for (k = 1; ; ++k) if ((k * (k - 1) >> 1) > n) break;
	--k;
	if (n != (k * (k - 1) >> 1)) return puts("No"), 0;
	puts("Yes"), printf("%d\n", k);
	register int i, j, t = 0, l;
	for (i = 1; i <= k; ++i)
		for (j = i + 1; j <= k; ++j)
			st[i].push_back(++t), st[j].push_back(t);
	for (i = 1; i <= k; ++i, puts("")) {
		printf("%d ", l = st[i].size());
		for (j = 0; j < l; ++j) printf("%d ", st[i][j]);
	}
    return 0;
}

Measured memory_bytes: 4608
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
int vc[10000][730];
bool al[10000];
int main(){
	while(true){
		int n,m;
		cin >> n >> m;
		if(n==0) break;
		rep(i,m) rep(j,730) vc[i][j]=0;
		rep(i,m) al[i]=0;
		int r;
		cin >> r;
		rep(i,r){
			int t,pc,st,s;
			cin >> t >> pc>>st>>s;
			st--,t-=540;
			if(s==1) vc[st][t]++;
			else vc[st][t]--;
		}
		int q;
		cin >> q;
		rep(i,q){
			int s,t,p,cnt=0;
			cin >> s>>t>>p;
			p--,s-=540,t-=540;
			if(!al[p]){
				rep(j,725) vc[p][j+1]+=vc[p][j];
				al[p]=true;
			}
			for(int j=s;j<t;j++) if(vc[p][j]>0) cnt++;
			cout << cnt << endl;
		}
	}
}

Measured memory_bytes: 28784
#include <bits/stdc++.h>
using namespace std;
int main(){
    int N,M;
    cin>>N>>M;
    int vec[10005];
    int counter=0;
    for(int i=0; i<M; i++){
     cin>>vec[i];
     counter+=vec[i];} 
    if(counter<=N)
     cout<<N-counter<<endl;
    else
      
     
  
    cout << -1<< endl;
  return 0;
    }

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define endl '\n'

using namespace std;
template<class T> inline void chkmax(T &x, const T &y) { if(x < y) x = y; }
template<class T> inline void chkmin(T &x, const T &y) { if(x > y) x = y; }
const int MAXN = (1 << 20);

int n;
int a[MAXN];

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

int answer = 0;
int b[MAXN];

void rec(int pos)
{
	if(pos == n)
	{
		int prod = 1;
		for(int i = 0; i < n; i++)
			prod = (prod * b[i]) % 2;

		if(prod == 0) answer++;
		return;
	}

	b[pos] = a[pos];
	rec(pos + 1);
	b[pos] = a[pos] + 1;
	rec(pos + 1);
	if(a[pos] >= 1) 
	{
		b[pos] = a[pos] - 1;
		rec(pos + 1);
	}
}

void solve()
{
	rec(0);
	cout << answer << endl;
}

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

	read();
	solve();
	return 0;
}



Measured memory_bytes: 2304
#include "bits/stdc++.h"
using namespace std;
using ll=long long;
#define print(n) cout<<n<<endl
#define rep(i,a,n) for(int i=a;i<n;i++)
#define ALL(s) s.begin(),s.end()
#define P pair<ll,ll>
#define vl vector<ll>
#define vi vector<int>
#define vvl vector<vector<ll>>
#define vvi vector<vector<int>>
const int M=200111;
const int inf=1000000007;
const int mod=1000000007;
const long long INF=1e18;
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int ddx[8]={1,-1,0,0,1,-1,-1,1},ddy[8]={0,0,1,-1,1,-1,1,-1};


struct UnionFind {
	vector<int> par;
	UnionFind(int n) : par(n, -1) { }

	int root(int x) {
		if (par[x] < 0) return x;
		else return par[x] = root(par[x]);
	}

	bool same(int x, int y) {
		return root(x) == root(y);
	}

	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y); // merge technique
		par[x] += par[y];
		par[y] = x;
		return true;
	}

	int size(int x) {
		return -par[root(x)];
	}
};

vvl comb(int n) {
	vvl v(n + 1,vl(n + 1, 0));
	for (int i = 0; i < v.size(); i++) {
		v[i][0] = 1;
		v[i][i] = 1;
	}
	for (int j = 1; j < v.size(); j++) {
		for (int k = 1; k < j; k++) {
			v[j][k] = (v[j - 1][k - 1] + v[j - 1][k])%mod;
		}
	}
	return v;
}

void sosu(ll x,bool f[]){
	ll y=x;
	for(ll i=2;i<=sqrt(y);i++){
		if(x%i==0){
			x/=i;
			f[i]=true;
			i--;
		}
	}
}

ll __gcd(ll x,ll y){
	if(x<y)swap(x,y);
	while(1){
		ll tmp=x%y;
		x=y;
		y=tmp;
		if(y==0)break;
	}
	return x;
}

int keta(ll a){
	int ke=1;
	while(a/=10)ke++;
	return ke;
}

vector<long long> enum_divisors(long long N) {
	vector<long long> res;
	for (long long i = 1; i * i <= N; ++i) {
		if (N % i == 0) {
			res.push_back(i);
			// 重複しないならば i の相方である N/i も push
			if (N/i != i) res.push_back(N/i);
		}
	}
	// 小さい順に並び替える
	sort(res.begin(), res.end());
	return res;
}

ll zyou(ll x,ll n){
	ll y=1;
	rep(i,0,n){
		y*=x;
	}
	return y;
}

int main() {
	int n;
	int a[2*M];
	cin>>n;
	rep(i,0,n-1)cin>>a[i];
	int b[2*M]={};
	rep(i,0,n-1){
		b[a[i]]++;
	}
	rep(i,1,n+1){
		print(b[i]);
	}

}


Measured memory_bytes: 6076
n = int(input())

x,y,z =1,1,1
a = 0
for i in range(1,101):
    if i**2+1**2+1**2+i*1+1*1+1*i >n:
        a = i
        break
    

L = {}

for x in range(1,a):
    for y in range(1,a):
        for z in range(1,a):
            b = x**2+y**2+z**2+x*y+y*z+z*x
            if b <= n:
                if b in L:
                    L[b] = L[b] +1
                else:
                    L[b] = 1

#print(L)
            
for i in range(1,n+1):
    if i in L:
        print(L[i])
    else:
        print(0)





Measured memory_bytes: 9704
import sys

def solve():
    n = int(sys.stdin.readline())

    ans = sum(is_prime(int(sys.stdin.readline())) for i in range(n))

    print(ans)

def is_prime(n):
    if n < 2 or (n > 2 and not(n & 1)):
        return False

    for p in range(3, n, 2):
        if p*p > n:
            break
        if not(n % p):
            return False

    return True

if __name__ == '__main__':
    solve()

Measured memory_bytes: 7608
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,(n)-1,0)
#define all(v) v.begin(), v.end()
#define endk '\n'
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
const ll mod2 = 998244353;
const ld eps = 1e-10;
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b){if(a>b) a=b;}
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b){if(a<b) a=b;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n; cin >> n;
  set<ll> st;
  vector<ll> A(n);
  rep(i, n) {
    cin >> A[i];
    if(st.count(A[i])) st.erase(A[i]);
    else st.insert(A[i]);
  }
  cout << st.size() << endk;
  return 0;
}


Measured memory_bytes: 8612
#include <iostream>

#define N 100

using namespace std;

void debug_print(int n, int a[]) {
    for (int i=0; i<n; i++) {
        if (i>0) { cout<<" "; }
        cout<<a[i];
    }
    cout<<endl;
}

void insertion_sort(int n, int a[]) {
    for (int i=1; i<n; i++) {
        int key = a[i];
        int j = i - 1;
        while (j>=0 && a[j]>key) {
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = key;
        debug_print(n, a);
    }
}

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

    debug_print(n, a);
    insertion_sort(n, a);

    return 0;
}



Measured memory_bytes: 3088
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
#include<map>
#include<cmath>
using namespace std;
double cnt;
double p,t;
int K; 
double e;
double ll,rr;
double dfs(double l,double r,int k,double tl,double tr)
{
     double mid=(l+r)/2.00;
     if(l>tl-1e-12&&r<tr+1e-12)
     return 1.0;
     if(r<tl+1e-12||l>tr-1e-12)
     return 0.0;
    if(k==K)
    {
     if(mid<tr+1e-12&&mid>tl-1e-12)
      return 1.0;
     else return 0.0;
    }
    double pp;
    if(mid>=t-1e-12) pp=1.00-p;
    else pp=p;
    return pp*dfs(l,mid,k+1,tl,tr)+(1-pp)*dfs(mid,r,k+1,tl,tr);
    
}
int main()
{
  //freopen("aaa.txt","r",stdin);
  //freopen("bbb.txt","w",stdout);
  while(cin>>K>>ll>>rr)
  {    
    cin>>p>>e>>t;   
    double kk=dfs(ll,rr,0,t-e,t+e);
    printf("%.12lf\n",kk);
  }
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    ll N = n;

    ll s = 0;

    while(n > 0)
    {
        s += n%10;
        n /= 10;
    }

    if(N % s == 0)
        cout << "Yes" << endl;
    else
    {
        cout << "No" << endl;
    }
    
}

Measured memory_bytes: 256
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <iostream> 
#include <iomanip>  
#include <string>
#include <sstream>  
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <cstring>
#include <cmath>
#include <cassert>


#define INF              (int)1000000007
#define EPS              1e-9
#define pb               push_back
#define mp               make_pair
#define all(c)           c.begin(), c.end()
#define forall(i,a,b)    for(int i=a;i<(b);++i)
#define trav(a,x)        for(auto & a: x)
#define in(a,b)          ((b).find(a) != (b).end())
#define sz(c)            (int)(c).size()
#define input(a)         for(auto & x : a) cin >> x;

using namespace std;

typedef vector<int>      vi;
typedef pair<int,int>    ii;
typedef vector<vi>       vvi;
typedef vector<ii>       vii;
typedef long long        ll;

#ifdef DEBUG
#define trace(...)       __f(#__VA_ARGS__, __VA_ARGS__)
#define debug(args...)   {dbg,args; clog<<endl;}
#define print_( a )      for( auto & x : a ) clog << x << ' '; clog << '\n';
#define printPair_( a )  for( auto & x : a ) clog << '(' << x.first << ',' << x.second << ')' << ' '; clog << '\n';
#else
#define trace(...)       
#define debug(args...)            
#define print_( a )               
#define printPair_( a )           
#endif

struct debugger {
  template<typename T> debugger& operator , (const T& x) {    
    clog << x << " ";    return *this;    
  }
}dbg;

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

auto ____ =[]() { std::ios::sync_with_stdio(0); cin.tie(0); return nullptr; }();

int main( int argc, char * argv[] ){
  string s,t;
  cin >> s;
  cin >> t;
  int n = sz(s), m = sz(t);
  vvi dp(n+1, vi(m+1,0));
  forall(i,1,n+1){
    forall(j,1,m+1){
      if( s[i-1] == t[j-1] ){
        dp[i][j] = dp[i-1][j-1] + 1;
      }else{
        dp[i][j] = max( dp[i-1][j], dp[i][j-1] );
      }
    }
  }
  string ans;
  int x = n, y = m;
  while(x != 0 and y != 0){
    if( s[x-1] == t[y-1] ){
      ans.pb(s[x-1]);
      --x, --y;
    }else{
      if( dp[x][y] == dp[x-1][y] ){
        --x;
      }else{
        --y;
      }
    }
  }
  reverse(all(ans));
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 35584
n = int(input())
p = [int(_) for _ in input().split()]

ans = 0
for i in range(n-1):
    if p[i] == i+1:
        ans += 1
        tmp = p[i]
        p[i] = p[i+1]
        p[i+1] = tmp
    #print(i+1, ans, p)

if p[n-1] == n:
    ans += 1

print(ans)

Measured memory_bytes: 13880
import sys
input=sys.stdin.readline
n=int(input())
mod=10**9+7
a=list(map(int,input().split()))
s=[0]*61
for i in range(n):
  c=format(a[i], 'b')
  L=len(c)
  for j in range(L)[::-1]:
    s[L-j-1]+=int(c[j])
ans=0
for i in range(61):
  ans+=2**(i)*(s[i])*(n-s[i])
  ans%=mod
print(ans)


Measured memory_bytes: 123132
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
#define rep1(i,N) for(int i=1;i<int(N);++i)
#define all(a) (a).begin(),(a).end()		//sort(all(vi S)) sort(all(string S))
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }

using P = pair<int, int>;		//P.first, P.second
typedef long long ll;
typedef vector<int> vi;
typedef set<int> seti;
typedef vector<string> vs;

const int MOD = 1e9+7;
const int INF = 1e9;
ll dp[43][432][432];
int main() {
	ll N,Ma,Mb;
	cin>>N>>Ma>>Mb;
	rep(i,N+2)rep(j,410)rep(k,410){
		dp[i][j][k] = INF;
	}
	dp[0][0][0] = 0;
	rep(i,N){
		ll a,b,c;
		cin>>a>>b>>c;
		rep(j,410)rep(k,410){
		//i番目を選ぶとき
		dp[i+1][j+a][k+b] = min(dp[i+1][j+a][k+b], dp[i][j][k] + c);
		//i番目を選ばないとき
		dp[i+1][j][k] = min(dp[i+1][j][k], dp[i][j][k]);
		}
	}
	ll ans = INF;
	rep1(i,N+1)rep1(j,410)rep1(k,410){
		//j:k = Ma:Mbであるか
		if(j*Mb == k*Ma){
			ans = min(ans, dp[i][j][k]);
		}
	}
	if(ans == INF)ans = -1;
	cout<<ans<<endl;
}

Measured memory_bytes: 61568
# coding: utf-8
import re
from datetime import datetime as dt
if __name__ == '__main__':
    s = dt.strptime(raw_input(), '%Y/%m/%d')
    a = dt(2019, 4, 30, 0, 0,0)
    if (s - a).days <= 0:
        print 'Heisei'
    else:
        print 'TBD'


Measured memory_bytes: 3436
from collections import Counter

def get_prime_factors(x):
    out = []
    if x < 1:
        return out
    while not x%2:
        out.append(2)
        x //= 2
    i = 3
    while i*i <= x:
        if not x%i:
            out.append(i)
            x //= i
        else:
            i += 2
    if x != 1:
        out.append(x)
    return out
    
def main():
    n = int(input())
    primes = Counter(get_prime_factors(n))
    ans = 0
    for k, v in primes.items():
        num = 1
        while v >= num:
            v -= num
            ans += 1
            num += 1
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 66008
#include <iostream>
#include <stdio.h>
#include<string.h>
#include<vector>
using namespace std;

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

int main(void) {
	ll n, a[100005], b[100000], i, j, count = 0;

	cin >> n;
	for (i = 0; i < n + 1; i++) {
		cin >> a[i];
	}
	rpt(i, n) {
		cin >> b[i];
	}

	rpt(i, n) {
		if (a[i] >= b[i]) {
			count += b[i];
		}
		else {
			if (b[i] >= (a[i] + a[i + 1])) {
				count += (a[i] + a[i + 1]);
				a[i + 1] = 0;
			}
			else {
				count += b[i];
				a[i + 1] -= (b[i] - a[i]);
			}
		}
	}

	printf("%lld", count);

	return 0;
}

Measured memory_bytes: 1792
import java.util.*;
 
public class Main{
	public static void main(String arg[]){
		Scanner sc=new Scanner(System.in);
		long n=sc.nextLong();
		long k=sc.nextLong();
		int a[]=new int[(int)n];
		long sum =0;
		for(int i=0;i<n;i++)
			a[i]=sc.nextInt();
		Arrays.sort(a);
		if(n < k)
			System.out.println("0");
		else{
			for(int i=0;i<n-k;i++)
				sum+=a[i];
			System.out.println(sum);
		}
	}
}

Measured memory_bytes: 66128
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(H: int, W: int, s: "List[str]"):
    def is_valid(i, j):
        if (i > 0 and s[i - 1][j] == '#' or 
            i < H - 1 and s[i + 1][j] == '#' or 
            j > 0 and s[i][j - 1] == '#' or 
            j < W - 1 and s[i][j + 1] == '#'):
            return True
        return False

    for i, R in enumerate(s):
        for j, c in enumerate(R):
            if c == '#' and not is_valid(i, j):
                print(NO)
                return
    print(YES)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    s = [ next(tokens) for _ in range(H) ]  # type: "List[str]"
    solve(H, W, s)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
import java.util.Scanner;


public class Main {
    static int a;
    static String s;
    public static void main(String[] args){
        Scanner stdIn = new Scanner(System.in);
        a = stdIn.nextInt();
        s = stdIn.next();
        System.out.print(check());
    }
    private static String check(){
        if(a>=3200) return s;
        return String.valueOf("red");
    }
}

Measured memory_bytes: 20556
import java.util.Scanner;


public class Main {

	public static void main(String [] args) {

		Scanner sc = new Scanner(System.in);
long sum = 0;
String moji = "";
long kou = 0;


		while(true) {

			String i = sc.next();
			moji = i;
			
			if(moji.length() == 1) {
				if(Integer.parseInt(i) == 0)break;
			}

			
			
			 
			 
			 int len = moji.length();
			 
			 
			
			for(int k = 0;k < len;k++) {
				
				char ichi;
				
				
				ichi = moji.charAt(k);
				
				
				kou = Character.getNumericValue(ichi);
				
				sum = sum + kou;
				
				
				
			}
			
			System.out.println(sum);
			
			
			sum = 0;
			moji = "";
			kou = 0;
			

		}

		}



}



Measured memory_bytes: 26376