akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define ll long long int
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
bool sortbysec(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
    return (a.second < b.second);
}
int main()
{
    FAST();
    ll t,i,j,k,n,l,x,y;
    vector<ll>v;
    map<ll,ll>m;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>x;
        v.push_back(x);
    }
    sort(v.begin(),v.end());
    y=v[n-1];
    for(i=0;i<n;i++)
    {
        k=v[i];
        for(j=k;j<=y;j+=k)
        {
            m[j]++;
        }
    }
    ll cnt=0;
    for(i=0;i<n;i++)
    {
        if(m[v[i]]<=1)
        {
            cnt++;
        }
    }
    cout<<cnt<<endl;
    return 0;
}


Measured memory_bytes: 66988
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#include <sstream>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
#define Mod 1000000007
#define eps 1e-6
#define ll long long
#define INF 0x3f3f3f3f 
#define MEM(x,y) memset(x,y,sizeof(x))
#define Maxn 10005
#define P pair<int,int>
using namespace std;
int main()
{
	
	int h, a;
	cin >> h >> a;
	int ans =1;
	int b=0; 
	b+=a;
	while (b<h)
	{
		b += a;
		ans++;
	}
	cout << ans << endl;
}



Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long answer = 0;
		int max = 0;
		for (int i = 0; i < n; i++) {
			int height = sc.nextInt();
			if (height < max) {
				answer = answer + max - height;
				continue;
			}
			max = height;
		}
		sc.close();
		print(answer);
	}

	public static void print(Object obj) {
		System.out.println(obj);
	}

}


Measured memory_bytes: 58512
def gcd(a,b):
    if b == 1:
        return 1
    elif b == 0:
        return a
    else:
        return gcd(b,a%b)

a,b = map(int, raw_input().split(' '))
if a > b:
    print gcd(a,b)
else:
    print gcd(b,a)

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

using namespace std;

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

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;
mt19937 mrand(random_device{}());
int rnd(int x) { return mrand() % x; }

int main() {
  int n;
  scanf("%d", &n);
  vector<int> c(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &c[i]);
  }
  sort(c.begin(), c.end());
  if (n == 1) {
    printf("%lld\n", c[0] * 2LL % MOD);
    return 0;
  }
  vector<int64> p2(n + 1);
  p2[0] = 1;
  for (int i = 1; i <= n; ++i) p2[i] = p2[i - 1] * 2LL % MOD;
  int ret = 0;
  for (int i = 0; i < n; ++i) {
    ret += (p2[n - 1] + (n - 1 - i) * p2[n - 2]) % MOD * c[i] % MOD;
    ret %= MOD;
  }
  ret = ret * p2[n] % MOD;
  printf("%d\n", ret);
  return 0;
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

template<int NV> class SegTree_Lazy {
public:
	vector<int> num[2],op;
	vector<ll> inv[2];
	SegTree_Lazy(){
		num[0].resize(NV*2,1);
		num[1].resize(NV*2);
		op.resize(NV*2);
		inv[0].resize(NV*2);
		inv[1].resize(NV*2);
		for(int i=NV-1;i>0;i--) num[0][i]=num[0][2*i]+num[0][2*i+1];
	};

	pair<pair<int,int>,pair<ll,ll>> getval(int x,int y,int l=0,int r=NV,int k=1) {
		if(r<=x || y<=l) return {{0,0},{0LL,0LL}};
		if(x<=l && r<=y) return {{num[0][k],num[1][k]},{inv[0][k],inv[1][k]}};
		auto a=getval(x,y,l,(l+r)/2,k*2);
		auto b=getval(x,y,(l+r)/2,r,k*2+1);
		pair<int,int> p={a.first.first+b.first.first,a.first.second+b.first.second};
		pair<ll,ll> q;
		q.first=a.second.first+b.second.first+1LL*a.first.second*b.first.first;
		q.second=a.second.second+b.second.second+1LL*a.first.first*b.first.second;
		
		if(op[k]) {
			swap(p.first,p.second);
			swap(q.first,q.second);
		}
		
		return {p,q};
	}

	void update(int x,int y,int l=0,int r=NV,int k=1) {
		if(l>=r) return;
		if(x<=l && r<=y) {
			op[k]^=1;
			swap(num[0][k],num[1][k]);
			swap(inv[0][k],inv[1][k]);
		}
		else if(l < y && x < r) {
			update(x,y,l,(l+r)/2,k*2);
			update(x,y,(l+r)/2,r,k*2+1);
			num[0][k]=num[0][2*k]+num[0][2*k+1];
			num[1][k]=num[1][2*k]+num[1][2*k+1];
			inv[0][k]=inv[0][2*k]+inv[0][2*k+1]+1LL*num[1][2*k]*num[0][2*k+1];
			inv[1][k]=inv[1][2*k]+inv[1][2*k+1]+1LL*num[0][2*k]*num[1][2*k+1];
			if(op[k]) {
				swap(num[0][k],num[1][k]);
				swap(inv[0][k],inv[1][k]);
			}
			
		}
	}
};
SegTree_Lazy<1<<20> st;
int N,Q;
int T,L,R;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>Q;
	FOR(i,N) {
		cin>>x;
		if(x) st.update(i,i+1);
	}
	while(Q--) {
		cin>>T>>L>>R;
		L--;
		if(T==1) {
			st.update(L,R);
		}
		else {
			auto a=st.getval(L,R);
			cout<<a.second.first<<endl;
		}
	}
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


Measured memory_bytes: 60376
#include <stdio.h>

int main(void){
  long r,c,i,j,sum;
  long table[101][101]={0};
  scanf(" %ld %ld",&r,&c);
  for(i=0;i<r;i++){
      sum=0;
      for(j=0;j<c;j++){
          scanf("%ld",&table[i][j]);
          sum+=table[i][j];
      }
      table[i][c]=sum;
  }
  for(i=0;i<c+1;i++){
      sum=0;
      for(j=0;j<r;j++){
          sum+=table[j][i];
      }
      table[r][i]=sum;
  }
  for(i=0;i<r+1;i++){
    for(j=0;j<c+1;j++){
      if(j!=0) printf(" ");
      printf("%ld",table[i][j]);
  }
  puts("");
  }
  return 0;
}



Measured memory_bytes: 2104
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

n = inn()
a = []
for i in range(n):
    a.append(inn())
sm = a[0]-1
px = 1
#ddprint(f"i {0} inc {0} sm {sm} px {px}")
for i in range(1,n):
    #if px==1:
    #    inc = a[i]-px-1
    #else:
    inc = (a[i]-px)//(px+1) + (1 if (a[i]-px)%(px+1)>=2 else 0)
    sm += inc
    if a[i]==px+1:
        px += 1
    #ddprint(f"i {i} inc {inc} sm {sm} px {px}")
print(sm)


Measured memory_bytes: 50136
n = int(input())
a = list(map(int, input().split()))
negative = []
positive = []
cnt=0
for i in range(n):
  if a[i] < 0:
    cnt += 1
    negative.append(a[i])
  else:
    positive.append(a[i])
if cnt % 2 == 0:
  print(sum(map(lambda x: abs(x), a)))
elif cnt == len(a):
  a.sort()
  b = a[-1]
  a.remove(a[-1])
  print(b+sum(map(lambda x: abs(x), a)))
else:
  negative.sort()
  positive.sort()
  if abs(negative[-1]) < positive[0]:
    a.remove(negative[-1])
    print(negative[-1]+sum(map(lambda x: abs(x), a)))
  else:
    a.remove(positive[0])
    print(-positive[0]+sum(map(lambda x: abs(x), a)))

Measured memory_bytes: 14496
#include<iostream>
#include<math.h>
#include<cstdio>
using namespace std;

struct point{double x,y;};

void koch(int n,point a,point b)
{
    if (n==0) return;
    point s,t,u;

    double th = M_PI *60.0/180.0;

    s.x=(2.0*a.x+b.x)/3.0;
    s.y=(2.0*a.y+b.y)/3.0;
    t.x=(a.x+2.0*b.x)/3.0;
    t.y=(a.y+2.0*b.y)/3.0;
    u.x=(t.x-s.x)*cos(th)-(t.y-s.y)*sin(th)+s.x;
    u.y=(t.x-s.x)*sin(th)+(t.y-s.y)*cos(th)+s.y;

    koch(n-1,a,s);
    printf("%.8f %.8f\n",s.x,s.y);
    koch(n-1,s,u);
    printf("%.8f %.8f\n",u.x,u.y);
    koch(n-1,u,t);
    printf("%.8f %.8f\n",t.x,t.y);
    koch(n-1,t,b);
}

int main()
{
    point a,b;
    int n;
    cin>>n;
    a.x=0;
    a.y=0;
    b.x=100;
    b.y=0;

    printf("%.8f %.8f\n",a.x,a.y);
    koch(n,a,b);
    printf("%.8f %.8f\n",b.x,b.y);
    return 0;
}

Measured memory_bytes: 3188
#include <bits/stdc++.h>
#include <fstream>
#include <cstdio>
using namespace std;
// vector<pair<int,int> > v;
// cin.ignore();//twice getline(cin,s);
// g++ iterator.cpp -std=c++17
// cout<<(A + B == C ? "YES" : "NO")<<endl;
// __gcd(a,b)
// string s=to_string(n);
// string p=s.substr(0,len);
// string q=s.insert(0,str);
// sort(arr, arr+n, greater<int>());
// cout<<fixed<<setprecision(9)<<pi<<endl
// const  double pi = acos(-1.0);
#define ff first
#define ss second
#define pb push_back
#define mk make_pair
#define vll vector<ll>
#define mll map<ll,ll >
#define mlli map<ll,ll>::iterator
#define size size()
#define endl "\n"
#define ll long long int
#define ld long double
void fast(){ios_base::sync_with_stdio(false);
cin.tie(NULL);cout.tie(NULL);}


int main(void)
{
	fast();
	int x;
	cin>>x;
	if(x>=30)
	{
		cout<<"Yes"<<endl;
	}	
	else
	{
		cout<<"No"<<endl;
	}
}

Measured memory_bytes: 3580
import math
from functools import reduce
 
k = int(input())
 
def gcd(*numbers):
    return reduce(math.gcd, numbers)
 
kotae = 0
for i in range(k):
    a = i + 1
    for j in range(k):
        b = j + 1
        for l in range(k):
            c = l + 1
            koyakusu = gcd(a, b, c)
            kotae += koyakusu
print(kotae)

Measured memory_bytes: 70008
// https://atcoder.jp/contests/abc177/tasks/abc177_a
#include<bits/stdc++.h>
using namespace std;

int main(int argc, char* argv[]) {
	int d, t, s;
	cin >> d >> t >> s;
	string ans = (d > s*t) ? "No" : "Yes";
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
#include<cassert>
using namespace std;
int INF = (1<<24);

vector<int> U;
map < int,bool > used;

map < char , vector<int> > t;

string str;
int pos;

bool input();

vector<int> calc(vector<int>,char ch,vector<int>);

vector<int> compute();
vector<int> get();

int main(){
  vector<int> ans;
  while(input()){
    pos=0;
    ans=compute();
    for(int i=0;i<(int)ans.size();i++){
      if(i)cout<<' ';
      cout<<ans[i];
    }
    if(ans.size()==0)cout<<"NULL";
    cout<<endl;
  }
  return 0;
}


bool input(){
  int n,a;
  char ch;
  U.clear();
  used.clear();
  t.clear();
  while(1){
    if(cin>>ch){
    }else{
      return false; 
    }
    cin>>n;
    if(ch=='R'&&n==0)break;
    for(int i=0;i<n;i++){
      cin>>a;

      if(used[a]==false){U.push_back(a);used[a]=true;}

      t[ch].push_back(a);
    }
    sort(t[ch].begin(),t[ch].end());
  }
  sort(U.begin(),U.end());
  cin>>str;
  str.push_back('=');
  return true;
}

vector<int> calc(vector<int> A,char ch,vector<int> B){

  int a=0,b=0,Asize=A.size(),Bsize=B.size(),nowA,nowB; 
  vector<int> res;

  if(ch=='u'){
    while(a<Asize||b<Bsize){
      nowA=(a<Asize?A[a]:INF);
      nowB=(b<Bsize?B[b]:INF);
      if(nowA==nowB){
	res.push_back(nowA);
	a++;b++;
      }else if(nowA<nowB){
	res.push_back(nowA);
	a++;
      }else{
	res.push_back(nowB);
	b++;
      }
    }

  }else if(ch=='i'){
    while(a<Asize||b<Bsize){
      nowA=(a<Asize?A[a]:INF);
      nowB=(b<Bsize?B[b]:INF);
      if(nowA==nowB){
	res.push_back(nowA);
	a++;b++;
      }else if(nowA<nowB){
	a++;
      }else{
	b++;
      }
    }

  }else if(ch=='d'){
    while(a<Asize||b<Bsize){
      nowA=(a<Asize?A[a]:INF);
      nowB=(b<Bsize?B[b]:INF);
      if(nowA==nowB){
	a++;b++;
      }else if(nowA<nowB){
	res.push_back(nowA);
	a++;
      }else{
	b++;
      }
    }
    
  }else if(ch=='s'){
    while(a<Asize||b<Bsize){
      nowA=(a<Asize?A[a]:INF);
      nowB=(b<Bsize?B[b]:INF);
      if(nowA==nowB){
	a++;b++;
      }else if(nowA<nowB){
	res.push_back(nowA);
	a++;
      }else{
	res.push_back(nowB);
	b++;
      }
    }
  }

  return res;
}


vector<int> compute(){

  vector<int> res,X;
  char ch;
  res=get();

  while(1){
    ch=str[pos++];
    if(ch=='='||ch==')')break;
    X=get();
    res=calc(res,ch,X);
  }

  return res;
}


vector<int> get(){
  if(str[pos]=='('){
    pos++;
    return compute();
  }else if(str[pos]=='c'){
    pos++;
    return calc(U,'d',get());
  }else{
    pos++;
    return t[str[pos-1]];
  }
}

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

using namespace std;

const int N = 1e3+5;

const int mod = 1e9 +7;

long long s , c;

int main(){
    cin >> s >> c;
    long long dec = min(s , c / 2);
    long long ans = dec;
    s -= dec;
    c -= dec * 2;

    //cout << s << " " << c << " " << ans << "\n";
    ans += c / 4;
    //c -= (c / 3) * 3;

    cout << ans << "\n";

    return 0;
}


Measured memory_bytes: 3596
using System;

class Program {
  static void Main(string[] args) {
    int N = int.Parse(Console.ReadLine());
    bool ok = true;
    for (int i = 0; i < N; ++i) {
      string[] val = Console.ReadLine().Split();
      int t = int.Parse(val[0]);
      int x = int.Parse(val[1]);
      int y = int.Parse(val[2]);
      if (t < x + y || t % 2 != (x + y) % 2) {
        ok = false;
        break;
      }
    }

    if (ok) {
      Console.WriteLine("Yes");
    }
    else {
      Console.WriteLine("No");
    }
  }
}


Measured memory_bytes: 15188
#include <iostream>
#include <cstdio>
#include <map>
using namespace std;



int length = 0;





int main(){
    int n; 
    string s;
    cin >> n;
    cin >> s;

    map<char, long long> T;
    long long mod = 1000000007;
                    

    

    for(int i = 0; i < s.size(); i++){
        if(T.find(s[i]) == T.end()){
            T[s[i]]= 1;
        }
        else{
            T[s[i]]++;
        }
       
    }

    long long sum = 1;

    map<char, long long>::iterator it;

    for(it = T.begin(); it != T.end(); it++){
        sum = sum*(it->second+1);
        sum = sum%mod;
    }
    

    printf("%lld\n", sum-1);

    return 0;

}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define rep(i,a) for(int (i)=0; (i)<(a); (i)++)
#define rrep(i,a) for(int (i)=a-1; (i)>=(0); (i)--)
#define rep2(i,a,b) for(int (i)=(a); (i)<(b); (i)++)
#define MOD 1000000007
#define all(v) v.begin(), v.end()
#define m0(x) memset(x,0,sizeof(x))
typedef long long ll;
using namespace std;


bool red[100500];
int num[100500];

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  
  int n,m; cin >> n >> m;
  
  memset(red,false,sizeof(red));
  rep(i,100500) num[i] = 1;
  red[0] = true;
  rep(i,m){
    int x , y; cin >> x >> y; x--; y--;
    num[x]--; num[y]++;
  	if(red[x]) red[y] = true;  
    if(num[x] == 0) red[x] = false;
  }
  
  int ans = 0;
  rep(i,n) if(red[i]) ans++;  
  cout << ans << endl;
  
  
  return 0;
}

Measured memory_bytes: 768
#include <bits/stdc++.h>
    using namespace std;
    void init(){
    cin.tie(0);
    cin.sync_with_stdio(0);
   }

    int main()
    {   init();
        int a,b,k,count=0;
        cin>>k>>a>>b;
        for(int i=a;i<=b;i++){
            if(i%k==0){
                count++;break;
            }
        }if(count==0)cout<<"NG";
        else cout<<"OK";


        return 0;}

Measured memory_bytes: 3652
#include <iostream>

const char* yes	= "Yes";
const char* no	= "No";
int main(int argc, char* argv[] ){
	int a,b,c;
	std::cin >> a >> b >> c;
	const char* exp = (a >= b) ? no: 
	 (b>=c)? no : yes ;
	std::cout<<exp<<std::endl;
	}

Measured memory_bytes: 1160
<?php
  fscanf(STDIN,"%d%d%d",$a,$b,$c);
  $num = [$a,$b,$c];
  $count = 0;
  while($num[0] != $num[1] || $num[1] != $num[2]){
      $count++;
      rsort($num);
      //print_r($num);
      if($num[0]-$num[1] == 1){
          $num[1]++; $num[2]++;
      }else{
          $num[2] += 2;
      }
  }
  echo $count;

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

using namespace std;

using int64 = long long;
const int mod = 998244353;

const int64 infll = (1LL << 60) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int K, X;
  cin >> K >> X;
  if(K * 500 >= X) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>

using namespace std;

int n;
long double d, x, ans = 0;

int main()
{
	ios::sync_with_stdio(false);
	// freopen("1.in", "r", stdin);
	// freopen("1.out", "w", stdout);

	cin >> n >> d >> x;
	for(int i = n; i >= 1; i--)
	{
		ans += d + (2 * i - 1) / 2.0 * x;
		if(i == 1) continue;
		d = ((2 * i + 2) * d + 5 * x) / (2 * i);
		x = ((i + 2) * x) / i;
	}
	cout << fixed << setprecision(10) << ans << endl;

	return 0;
}


Measured memory_bytes: 384
using namespace std; 
#include<bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define vect vector<ll>
#define maap map<ll,ll>  
#define MOD 998244353
#define mit map::iterator
#define MOD1 1000000007 
#define pii pair<ll,ll>
#define rep(i,a,b)	for(ll i=a;i< b;i++)
#define fast  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
typedef  long long   int  ll;
//stringstream convert; 
  //  convert << number; 
  //  string s = convert.str(); 
ll  C(ll n,ll k) {
      ll res = 1;
    for (ll i = 1; i <= k; ++i)
    {
        res = res * (n - k + i) / i;
        res=res%MOD;
    }
    return (ll)(res);
}
ll gcd(ll a, ll b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 
bool isPrime(int n) {
 
    if (n <= 1) return false;
    if (n <= 3) return true;
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (int i = 5; i * i <= n; i = i + 6)
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    return true;
} 
ll power( ll base, ll exp) {
    ll res=1;
    while(exp>0) {
       if(exp%2==1) res=(res*base)%MOD;
       base=(base*base)%MOD;
       exp/=2;
    }
    return res%MOD;
}
ll fact[200005],invfact[200005];
void init(){
	ll p=MOD;
	fact[0]=1;
	ll i;
	for(i=1;i<200005;i++){
		fact[i]=(i*fact[i-1])%p;
	}
	i--;
	invfact[i]=power(fact[i],p-2);
	for(i--;i>=0;i--){
		invfact[i]=(invfact[i+1]*(i+1))%p;
	}
}
ll ncr(ll n,ll r){
	return (((fact[n]*invfact[r])%MOD)*invfact[n-r])%MOD;
}
priority_queue < pair<ll,ll> , vector<pair<ll,ll> >,greater<pair<ll,ll> > > gq;
void ghost()
{  
 ll i,j,k=0,n,l=0,q=0,t=0;
  cin>>n;
  map<ll,ll>mp;
  k=n;
  for(i=2;i*i<=k;i++)
  {
    if(n%i==0)
    {
    	while(n%i==0)
    	{
    		n=n/i;
    		mp[i]++;
		}
	}
}
if(n!=1)
l=1;
   for(i=2;i<=1000002;i++)
   {
   	 	t=sqrt(2*mp[i]);
   	 	if((t*(t+1))<=2*mp[i])
   	 	l=l+t;
   	 	else
   	 	l=l+t-1;
   }
   cout<<l<<endl;
}
signed main()
{int test=1;
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
fast
//cin>>test;
while(test--)
ghost();
return 0;
}

  

Measured memory_bytes: 66068
#include<iostream>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#include<set>
#include<iomanip>
#include<cmath>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define MAX_T 1001
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
const long double PI = acos(-1);
const ll DEP = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int main(){
    char x,y; cin >> x >> y;
    if(x < y) cout << '<' << endl;
    else if (x > y) cout << '>' << endl;
    else cout << '=' << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
using namespace __gnu_pbds;
using namespace std;
typedef tree<
    pair<int, int>,
    null_type,
    less_equal<pair<int, int>>,
    rb_tree_tag,
    tree_order_statistics_node_update>
    ordered_set;
#define int long long
#define double long double
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define lb(v, z) lower_bound(all(v), z)
#define ub(v, z) upper_bound(all(v), z)
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define rdp(i, a, b) for (int i = (a); i >= (b); i--)
#define rlt(i, a, b) for (int i = (a); i < (b); i++)
#define cns(z) cout << (z) << ' '
#define cnl(z) cout << (z) << '\n'
#define M1 1000000007
#define M2 998244353
#define MAXN 300005
#define INF (1ll << 60)
#define endl "\n"
#define garr(ip)       \
    for (auto &x : ip) \
        cin >> x;
#define parr(ip)          \
    for (auto &x : ip)    \
        cout << x << " "; \
    cout << endl;
#define nl cout << endl
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vp;

void solve(int testCaseNumber = 1)
{
    int n, a, b;
    cin >> n >> a >> b;
    vi nop(n);
    rep(i, 1, n)
        rep(j, i + 1, n)
    {
        int dis = j - i;
        dis = min(abs(j - a) + abs(i - b) + 1, dis);
        dis = min(abs(j - b) + abs(i - a) + 1, dis);
        nop[dis]++;
    }
    rep(i, 1, n - 1)
        cnl(nop[i]);
}

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

Measured memory_bytes: 3628
#!/usr/bin/env python3
import math
def is_not_prime(n):
    for i in range(2, math.ceil(n**0.5)):
        if n % i == 0:
            return True
    else:
        print(n)
        return False

X = int(input())
while is_not_prime(X):
    X += 1

Measured memory_bytes: 3060
import platform
ver = platform.python_version_tuple()
if int(ver[1]) < 5:
    from fractions import gcd
else:
    from math import gcd
from sys import stdin

def main():
    A, B, C, D = map(int, input().split())

    lcm = lambda x, y: x * y // gcd(x, y)
    n = 0
    for a, b, x in ((A, B, C), (A, B, D)):
        if a % x:
            n += b // x - a // x
        else:
            n += b // x - (a // x - 1)

    lcm_ = lcm(C, D)
    if a % lcm_:
        n -= b // lcm_ - a // lcm_
    else:
        n -= b // lcm_ - (a // lcm_ - 1)

    print(B - A + 1 - n)

input = lambda: stdin.readline()
main()


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

#define sz(s) int(s.size())
const int MOD = 1000000000 + 7;
const int MAXN = 110;
int dp[MAXN][4][4][4];

string f1[] = { "AGC", "ACG", "GAC" };
int cnt;

bool forbidden(string s){
    if(sz(s) == 3) return s == "AGC" || s == "ACG" || s == "GAC";

    bool res = false;
    for(int i=0; i<3; i++) if(s.find(f1[i]) != string::npos) res = true;

    string s2 = s;
    swap(s2[0], s2[1]);
    if(s2.find("AGC") != string::npos) res = true;
    swap(s2[0], s2[1]);

    swap(s2[2], s2[3]);
    if(s2.find("AGC") != string::npos) res = true;

    //if(res) cout << ++cnt << ": " << s << "\n";
    return res;
}

int main(){

    //cout << (forbidden("GATC") ? "true" : "false");

    int N; cin >> N;

    map<int, string> m = { {0, "A"}, {1, "C"}, {2, "G"}, {3, "T"} };

    for(int i=0; i<4; i++)
        for(int j=0; j<4; j++)
            for(int z=0; z<4; z++){
                string stato = m[i] + m[j] + m[z];
                dp[3][i][j][z] = forbidden(stato) ? 0 : 1;
            }

    for(int len=4; len<=N; len++)
        for(int t=0; t<4; t++)
            for(int p=0; p<4; p++)
                for(int u=0; u<4; u++)
                    for(int x=0; x<4; x++){
                        string stato = m[t] + m[p] + m[u] + m[x];
                        if(forbidden(stato)) continue;
                        dp[len][p][u][x] = (dp[len][p][u][x] + dp[len-1][t][p][u]) % MOD;
                    }


    int sum = 0;
    for(int i=0; i<4; i++)
        for(int j=0; j<4; j++)
            for(int z=0; z<4; z++)
                sum = (sum + dp[N][i][j][z]) % MOD;

    cout << sum << "\n";
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Fri Jun  5 09:50:00 2020

@author: NEC-PCuser
"""

H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))

gazo = [[0] * W  for i in range(H)]

count = 0
start_H = 0
start_W = 0
direction = 0
for i in range(len(a)):
    for j in range(a[i]):
        gazo[start_H][start_W] = i + 1
        if (start_W < W - 1 and direction == 0):
            start_W += 1
        elif (start_W == W - 1 and direction == 0):
            start_H += 1
            direction = 1
        elif (start_W > 0 and direction == 1):
            start_W -= 1
        elif (start_W == 0 and direction == 1):
            start_H += 1
            direction = 0
    
for i in range(len(gazo)):
    print(' '.join(map(str, gazo[i])))
    

Measured memory_bytes: 3572
#include <stdio.h>

char S[30];

int main() {

	int A,B;

	scanf("%d %d",&A,&B);

	scanf("%s",S);

	int i;

	int ans=1;

	for(i=0;i<A;i++){
	if('0'<=S[i]&&S[i]<='9');
	else{ans=0;}
	}

	if(S[A]!='-'){ans=0;}

	for(i=A+1;i<A+B+1;i++){
	if('0'<=S[i]&&S[i]<='9');
	else{ans=0;}
	}

	if(ans==1){
		printf("Yes\n");
	}
	else{
	printf("No\n");
	}

	return 0;
}

Measured memory_bytes: 128
#pragma region Macros

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

using ll = long long;
#define int ll
using vi = vector<int>;
using vvi = vector<vi>;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

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

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

#pragma endregion

void Main() {
    int N;
    cin >> N;
    vi a1(N);
    vi a2(N);

    REP(i, N) {
        cin >> a1[i];
    }

    REP(i, N) {
        cin >> a2[i];
    }

    vi a1Sum(N);
    vi a2Sum(N);

    a1Sum[0] = a1[0];
    REP(i, N - 1) {
        a1Sum[i + 1] = a1Sum[i] + a1[i + 1];
        debug(a1Sum[i + 1], a1Sum[i], a1[i + 1]);
    }

    a2Sum[N - 1] = a2[N - 1];
    REP(i, N - 1) {
        a2Sum[N - 1 - i - 1] = a2[N - 1 - i - 1] + a2Sum[N - 1 - i];
        debug(a2[N - 1 - i - 1], a2Sum[N - 1 - i], a2Sum[N - 1 - i - 1]);
    }

    int sum = 0;
    REP(i, N) {
        chmax(sum, a1Sum[i] + a2Sum[i]);
        debug(sum);
    }

    cout << sum;
}

#pragma region main
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    Main();
    cout << flush;
}
#pragma endregion


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

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

int MOD=1e9+7;
ll INF=1e18;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};

ll mod_pow(ll a, ll b){
    if(b==0) return 1;
    else if(b%2==0){
        ll d=mod_pow(a, b/2)%MOD;
        return (d*d)%MOD;
    }
    else{
        return (a*mod_pow(a, b-1))%MOD;
    }
}

ll fact[200010], finv[200010];
ll comb(int n, int r){
    if(n<r || r<0) return 0;
    return fact[n]*finv[n-r]%MOD*finv[r]%MOD;
}

ll calc(int n){
    fact[0]=finv[0]=1;
    for(int i=1; i<=n; i++){
        fact[i]=(fact[i-1]*i)%MOD;
        finv[i]=mod_pow(fact[i], MOD-2);
    }
}

int main(){
    int n, m; cin>>n>>m;
    int num=m;
    ll ans=1;

    calc(200005);

    for(ll i=2; i*i<=m; i++){
        int cnt=0;
        while(num%i==0){
            num/=i;
            cnt++;
        }
        ans*=comb(n-1+cnt, cnt);
        ans%=MOD;
    }

    if(num>1){
        ans*=comb(n, n-1);
        ans%=MOD;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3328
#include<stdio.h>

int main(){
  int a, b, c;
  int temp;
  
  scanf("%d %d %d", &a, &b, &c);

  if(a > b){
    temp = a;
    a = b;
    b = temp;
  }

  if(b > c){
    temp = b;
    b = c;
    c = temp;
  }

  if(a > b){
    temp = a;
    a = b;
    b = temp;
  }

  printf("%d %d %d\n", a, b, c);

  return 0;
}



Measured memory_bytes: 2072
#include <iostream>
#include <tuple>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
using namespace std;
void init();
#define REP(var, num) for(sll var = 0; var < num; var++)
typedef signed long long sll;
typedef unsigned long long ull;
/*
numeric_limits<sll>::max()
*/

int main() {
    init();
    sll d;
    cin >> d;
    cout << "Christmas";
    REP(i, abs(d - 25)) {
        cout << " Eve";
    }
    cout << endl;
    return 0;
}

void init() {
    cin.tie(0);
    ios::sync_with_stdio(false);
}

Measured memory_bytes: 256
import sys
import itertools
input = sys.stdin.readline

_n = int(input())


def chker(n):
    for i in range(1, 10):
        if n % i == 0:
            m = n // i
            if 0 < m and m < 10:
                print('Yes')
                return

    print('No')


chker(_n)


Measured memory_bytes: 3060
// #pragma GCC target("avx2")
// #pragma GCC optimize("O3")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

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

//for loop関係
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define repe(i,a,n) for(int i=(a);i<=(n);++i)
#define rrep(i,n,a) for(int i=(n);n>(a);--i)
#define rrepe(i,n,a) for(int i=(n);n>=(a);--i)

//略記
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ENDL << "\n"

using ll = long long;
using P = pair<int,int>;
using itn = int;

//定数
const int INF = 1<<30;
const ll MOD = 1000000007;
const long double PI =(acos(-1));

//Degree <-> Radian
double toRad(double d){ double rad; rad=d*PI/180; return rad; }
double toDegree(double rad){ double d; d=rad*180/PI; return d; }
//The least common multiple : lcm
ll lcm(int a,int b){ return a*b/__gcd(a,b); }
//素数判定
bool isPrime(int n){
    int i; 
    if(n<2) return 0;
    else if(n==2) return 1;
    if(n%2==0) return 0;
    for(i=3;i*i<=n;i+=2) if(n%i==0) return 0;
    return 1;
}


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a,b,c;
    cin >> a >> b >> c;
    if(a==b && a!=c){
        cout << "Yes" ENDL;
    }else if(b==c && a!=b){
        cout << "Yes" ENDL;
    }else if(a==c && a!=b){
        cout << "Yes" ENDL;
    }else {
        cout << "No" ENDL;
    }
    
    return 0;
}

Measured memory_bytes: 3660
#include<stdio.h>
#include<stdbool.h>

int a[20]={};
int n;

bool solve(int i, int x){
	bool res;
	if(x==0) return true;
	if(i>=n) return false;
	res = solve(i+1,x) || solve(i+1,x-a[i]);
	return res;
}

int main(){
	int i,q;
	int m;

	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d",&a[i]);
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&m);
		if(solve(0,m)) printf("yes\n");
		else printf("no\n");
	}

	return 0;
}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
vector <int> s1,s2;
int a;

int main(){

    for(int i=0;i<10;i++){
        cin >> a;
        s1.push_back(a);
    }
    sort(s1.begin(),s1.end());
    for(int i=0;i<10;i++){
        cin >> a;
        s2.push_back(a);
    }
    sort(s2.begin(),s2.end());

    cout << s1[9]+s1[8]+s1[7] << " " << s2[9]+s2[8]+s2[7] << endl;

return 0;
}

Measured memory_bytes: 3080
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int N;
    cin >> N;
    for (int i = 1; i < 10; i++) {
        if (N / i < 10 && N % i == 0) {
            cout << "Yes" << endl;
            return 0;
        }
        if (i == 9) {
            cout << "No" << endl; 
        }
    }
}

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

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);++i)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);--i)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
using ll = long long;
using ull = unsigned long long;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
//constexpr long long MOD = (ll) 1e9 + 7;
constexpr long long MOD = 998244353LL;
using ld=long double;
static const ld pi = 3.141592653589793L;
typedef vector<ll> Array;
typedef vector<Array> Matrix;


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

struct Edge {
	ll to, rev;
    long double cap;
	Edge(ll _to, long double _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;

void add_edge(Graph& G, ll from, ll to, long double cap, bool revFlag, long double revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

void solve(){
    ll a,b,v,w,t;
    cin>>a>>v>>b>>w>>t;
    if(w>=v) cout<<"NO"<<en;
    else if((v-w)*t>=abs(b-a)) cout<<"YES"<<en;
    else cout<<"NO"<<en;
}

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
	
	solve();
	//ll t;cin>>t;REP(i,t) solve();

    return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int a=0;
  for(int i=0;i<s.size();i++)
    if(a==0&&s[i]=='C')a++;
    else if(a==1&&s[i]=='F')a++;
  if(a==2)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define MODV 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(ll i=0, i##_len=(ll)(n); i<i##_len; i++)
#define repf(i, n) for(ll i=1, i##_len=(ll)(n+1); i<i##_len; i++)
#define per(i, n) for(ll i=((ll)(n))-1; i>=0; i--)
#define perf(i, n) for(ll i=((ll)(n)); i>0; i--)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<ll>
#define vvi vector<vector<ll>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
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; }
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    ll n, sum = 0;
    cin >> n;
    vi w(n);
    rep(i, n){
        cin >> w[i];
        sum += w[i];
    }
    ll sum2 = 0, ans = INFLL;
    rep(i, n){
        sum2 += w[i];
        chmin(ans, abs((sum-sum2)-sum2));
    }
    cout << ans << endl;
}

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

using namespace std;

namespace {

    typedef double real;
    typedef long long ll;

    int N;
    vector<string> A;
    vector<int> X;
    map<string, int> Z;
    int M;
    vector< vector<int> > G;
    void input() {
        cin >> N;
        A.resize(N); X.resize(N);
        for (int i = 0; i < N; i++) {
            cin >> A[i] >> X[i];
            Z[ A[i] ] = i;
        }
        cin >> M;
        G.resize(N);
        for (int i = 0; i < M; i++) {
            string s, t; cin >> s >> t;
            int a = Z[s], b = Z[t];
            G[a].push_back(b);
            G[b].push_back(a);
        }
    }

    const int INF = 1<<28;

    vector<int> C;
    void find_cheapest(int v) {
        if (C[v] != INF) return;
        vector<bool> used(N, false);
        used[v] = true;
        queue<int> Q;
        Q.push(v);
        int ret = X[v];
        while (!Q.empty()) {
            int c = Q.front(); Q.pop();
            ret = min(ret, X[c]);
            for (int i = 0; i < G[c].size(); i++) {
                int u = G[c][i];
                if (used[u]) continue;
                Q.push(u);
                used[u] = true;
            }
        }
        for (int i = 0; i < N; i++) {
            if (used[i]) {
                C[i] = ret;
            }
        }
    }

    void solve() {
        C = vector<int>(N, INF);
        for (int i = 0; i < N; i++) {
            find_cheapest(i);
        }
        int ans = 0;
        for (int i = 0; i < N; i++) ans += C[i];
        cout << ans << endl;
    }
}

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

Measured memory_bytes: 2004
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
typedef pair<int,int> P;
typedef vector<int> vi;

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

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

int main(){
    ios::sync_with_stdio(false);
    int a,b,h,m;
    cin >> a >> b >> h >> m;
    long double x=30*h-5.5*m;
    if(x>=180){
        x=360-x;
    }
    long double l=0;
    l=pow(a,2)+pow(b,2)-2*a*b*cos(x*pi/180);
    cout << fixed << setprecision(15) << pow(l,0.5) << endl;
    return 0;
}

Measured memory_bytes: 4168
import java.util.Scanner;
public class Main{
	public static void main(String args[]){
	Scanner scan = new Scanner(System.in);
	System.out.println(""+countDivisors(scan.nextInt(),scan.nextInt(),scan.nextInt()));
	}
	
	static int countDivisors(int first, int last, int num){
		int count = 0;
		for(int i=first; i<=last; i++)
			if(num%i==0)
				count++;
		return count;
	}
}

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

int main() {
    ll n, k;
    cin >> n >> k;
    ll A[n+1];
    A[0] = 0;
    for (ll i = 0; i < n; i++)cin >> A[i+1];
    for (ll i = k + 1; i <= n; i++)
    {
        string ans = "No";
        if (A[i-k] < A[i]) ans = "Yes";
        cout << ans << endl;
    }
    
    
    return 0;
}

Measured memory_bytes: 5080
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <complex>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <limits>
#include <time.h>
#include <cstdint>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rRep(i,a,b) for(ll i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

int main(){
  ll N,K,ANS=0;
  cin >> N >> K;
  ll L=0,R=0;
  rep(i,N+1){
    R+=N-i;
    L+=i;
    if(i>=K-1){
      ANS+=R-L+1;
      ANS%=MOD;
    }
  }
  cout << ANS << endl;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  
  vector<int> ans(N);
  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;
    vector<int> A(d);
    for (int j = 0; j < d; j++) {
      cin >> A.at(j);
      ans.at(A.at(j) - 1)  = 1;
    }
  }
    
  int s = 0;
  for (int i = 0; i < N; i++) {
    s += ans.at(i);
  }
    
  cout << N - s << endl;
}
      
      
      








Measured memory_bytes: 3576
/*
これを入れて実行
g++ code.cpp
./a.out
 */
 
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>
 
using namespace std;
typedef long long ll;
typedef long double ld;
 
int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};
 
const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;
 
bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}
 
ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}
 
ll lcm(ll a, ll b){
    return a / gcd(a, b) * b;
}
 
ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}
 
ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}
 
//-----------------------ここから-----------

int main(void){
    ld a, b, x;
 
    cin >> a >> b >> x;
 
    ld total = a * a * b;
 
    ld tmp = x / total;
 
    ld h = b * tmp;
 
    x /= a;

    ld totalarea = a * b;
 
    ld area = a * h;
 
 
    if(h <= b / 2){
        ld c = area / b * 2.0;
        ld d = sqrt(b * b + c * c);
 
        ld ans = atan(c / b);
        ld ansd = ans * 180.0 / M_PI;
 
        cout << fixed <<setprecision(10) << 90.0 - ansd << endl;
    } else {
        ld restarea = totalarea - area;

        ld c = restarea / a * 2.0;

        ld ans = atan(a / c);
        ld ansd = ans * 180.0 / M_PI;

        cout << fixed << setprecision(10) <<  90.0 - ansd << endl;

    }
    
 
 
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define MOD 1000000007
#define INF 11234567890
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int x, a, b;

int main()
{
	in >> x >> a >> b;
	if (abs(x - a) < abs(x - b)) { out << "A" << std::endl; }
	else { out << "B" << std::endl; }
	return 0;
}

Measured memory_bytes: 256
fun main(args:Array<String>){
    val n = readLine()!!.toInt()
    val p = readLine()!!.split(" ").map{it.toInt()}
    val k = p.zip((1 .. n)).count{it.first != it.second}
    println(if(k == 2 || k == 0) "YES" else "NO")
}


Measured memory_bytes: 36248
#define _GLIBCXX_DEBUG//TLEの原因になるので注意！！！！！！！！！！！
#include<cmath>
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
vector<int> arr;
stack<int> st;
queue<int> qu;
queue<pair<int,int> > qu2;
priority_queue<int> pq;
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define rep2(i,n) for(int i=1; i<=(int)(n); i++)
#define mins(x,y) x=min(x,y)
#define maxs(x,y) x=max(x,y)
typedef set<int> set_t;
typedef set<string> set_g;
typedef complex<double> xy_t;
static const int NIL = -1;
static const int INF = 1000000007;
#define mp make_pair
#define sz(x) int(x.sise())
#define mod 1000000007
#define reps(i,s,n) for(int i = s; i < n; i++)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
deque<int> deq;
#define fi first
#define se second
//#define int long long

//cerrはコメントアウトしなくても通る//ただしTLEを引き起こすことがある

//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
//const ll INF = 1LL << 60;
//typedef pair<ll,ll> P;
typedef pair<int, int> P;
bool chmx(int &a, int b) {
	if (b > a) {
		a = b;
		return true;
	}
	return false;
}

bool chmn(int &a, int b) {
	if (b < a) {
		a = b;
		return true;
	}
	return false;
}

int main(){
    ll x;
    cin >> x;
    ll y=0;
    for(int a=0;a<1000;a++){
        for(int b=-999;b<1000;b++){
            y=pow(a,5)-pow(b,5);
            if(x==y){
                cout<<a<<' '<<b<<endl;
                return 0;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 4112
INF=float('inf')
N,Ma,Mb=map(int,input().split())

abc=[]
dp=[[INF]*401 for i in range(401)]
dp[0][0]=0

for i in range(N):
    a,b,c=map(int,input().split())
    for A in reversed(range(401)):
        for B in reversed(range(401)):
            if B-b>=0 and A-a>=0:
                dp[A][B]=min(dp[A][B],dp[A-a][B-b]+c)
ans=INF
for i in range(1,401):
    if i*Ma>400 or i*Mb>400:
        break
    ans=min(ans,dp[Ma*i][Mb*i])
print(ans if ans!=INF else -1)

Measured memory_bytes: 76132