akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<n; ++i)
using namespace std;
using ll = long long;

int main() {
  ll a,b;
  cin >>a>>b;
  int x,y;
  
  for(int i=1; i<=20000; i++){
    if(a==i*8/100 && b==i*10/100){
      cout << i << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s  = sc.next();
		if(s.length() == 3) {
			String s1 = "";
			for(int i = 2;i >= 0;i --) {
				s1 += s.charAt(i);
			}
			System.out.println(s1);
			return;
		}
		System.out.println(s);
	}
}

Measured memory_bytes: 23636
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define ll long long

ll gcd(ll x, ll y){
    ll tmp;
    if(x>y){
        tmp = x;
        x = y;
        y = tmp;
    }
    if(x == 0) return y;
    else return gcd(y%x,x);
}

int main(){
    ll a,b;
    cin>>a>>b;
    ll ans = 1;
    ll g = gcd(a,b);
    auto f = [&](){
        for(ll i=2;i*i<=g;i++){
            if(g%i==0){
                ans++;
                while(g%i==0) g/=i;
            }
        }
    };
    f();
    if(g>1) ans++;
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod2 = 1000000007;
constexpr ll mod = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[6] = {1, 0, -1, 0,1,1};
const int dy[6] = {0, 1, 0, -1,1,-1};
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; }
// ---------------------------------------------------------------------------

int main(){
    int N,S;
    cin >> N >> S;
    vector<int> A(N);
    rep(i,N) cin >> A[i];
    vector<vector<ll>> dp(N+1, vector<ll> (S+1,0));
    dp[0][0] = 1;
    for(int i=0; i<N; i++){
        for(int j=0; j<=S; j++){
            dp[i+1][j] += dp[i][j]*2;
            dp[i+1][j] %= mod;
            if(j+A[i] <= S){
                dp[i+1][j+A[i]] += dp[i][j];
                dp[i+1][j+A[i]] %= mod;
            }
        }
    }
    cout << dp[N][S] << "\n";
    return 0;
}

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

#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf
#define sf(num) scanf("%d",&num)
#define sff(num1,num2) scanf("%d %d",&num1,&num2)
#define sfff(num1,num2,num3) scanf("%d %d %d",&num1,&num2,&num3);
#define sl(num) scanf("%lld",&num)
#define sll(num1,num2) scanf("%lld %lld",&num1,&num2)
#define slll(num1,num2,num3) scanf("%lld %lld %lld",&num1,&num2,&num3);
#define rep(i,n) for(i=1;i<=n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define reps(i,a,n) for(i=a;i<=n;i++)
#define pb push_back
#define mpp make_pair
#define MOD 1000000007
#define fi first
#define se second
#define N 100005
#define mem(ara,n) memset(ara,n,sizeof(ara))
#define memb(ara) memset(ara,false,sizeof(ara))
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define pi pair<int,int>
#define pii pair<pair<int,int>,pair<int,int> >
#define db(x) cout<<#x<<" :: "<<x<<"\n";
#define dbb(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\n";
#define fr freopen("input.txt","r",stdin);
#define fw freopen("output.txt","w",stdout);
#define TIME cerr<<"Time : "<<(double)clock()/(double)CLOCKS_PER_SEC<<"s\n";
typedef long long int ll;
using namespace std;
int main()
{
    ll n,m;
    sll(n,m);
    ll k=max(n,m)-min(n,m);
    if(k&1)
        puts("IMPOSSIBLE");
    else
        pf("%lld",(n+m)/2);

}


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

int calc(int from, set<int> pass, vector<int>* e, int N)
{
	pass.insert(from);
	if (pass.size() == N)
	{
		return 1;
	}

	auto sum = 0;
	for (auto to : e[from])
	{
		if (pass.find(to) == pass.end())
		{
			sum += calc(to, pass, e, N);
		}
	}
	return sum;
};

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

	vector<int> e[9];
	for (auto i = 0; i < M; ++i)
	{
		int a, b;
		cin >> a >> b;
		e[a].push_back(b);
		e[b].push_back(a);
	}

	set<int> s;
	cout << calc(1, s, e, N) << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{
    
     char str[100];
     int i,l,ind;
     scanf("%s",str);
     l=strlen(str);
     int t=0;
     if(str[0]=='A')
     {
          
          int c=0;
          for(i=2;i<l-1;i++)
          {
                if(str[i]=='C'&&c==0)
                {
                  c=1;
                  ind =i;
                }
                else if(str[i]=='C'&&c==1)
                {

                    c=2;

                }
             

          }
          if(c==1)
          {
            int shotti =1;
            for(i=1;i<l;i++)
            {
               if(i!=ind&&(str[i]>='A'&&str[i]<='Z'))
               {
                shotti = 0 ;
               }

            }
            if(shotti ==1)
            {
              t=1;
            }

          }

     }

   if(t==1)
   {

     printf("AC\n");
   }

   else
   {
       printf("WA\n");


   }

return 0;
}




Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(long long i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(long long i=int(n);i>0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+5  
using ll = long long;
using P = pair<int, int>;
using lP = pair<ll, ll>;
using fP = pair<double, double>;
using PPI = pair<P, int>;
//ll const mod=998244353;
ll const mod = 1e9 + 7;
const ll MAX = 1000005;
using vi = vector<int>;
using vl = vector<ll>;
using vc = vector<char>;
using vd = vector<double>;
using vs = vector<string>;
using vp = vector<P>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvd = vector<vector<double>>;
using vvc = vector<vector<char>>;
using vvp = vector<vector<P>>;
using vvb = vector<vector<bool>>;
template <typename T>
bool chmax(T& a, const T b) { if (a < b) { a = b; return true; } return false; }
template <typename T>
bool chmin(T& a, const T b) { if (a > b) { a = b; return true; } return false; }
using Ps = pair<int, string>;

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    vvc c(h, vc(w));
    rep(i, h)rep(j, w)cin >> c[i][j];
    int ans = 0;
    rep(i, 1 << (h + w)) {
        vi hr(h), wr(w);
        rep(j, h) {
            if (i >> j & 1)hr[j] = 1;
        }
        rep(j, w) {
            if (i >> (j + h) & 1)wr[j] = 1;
        }
        int cnt = 0;
        rep(i, h)rep(j, w) {
            if (hr[i] == 1 || wr[j] == 1)continue;
            if (c[i][j] == '#') {
                cnt++;
            }
        }
        if (cnt == k)ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3596
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#define REP(X, Y, Z) for (ll(X) = (Y); (X) < (Z); (X)++)
#define REV(X, Y, Z) for (ll(X) = (Y); (X) > (Z); (X)--)

using namespace std;
using ld = long double;
using ll = long long;
using dll = deque<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using usll = unordered_set<ll>;
using umll = unordered_map<ll, ll>;
using sll = stack<int>;
using vll = vector<ll>;
using vvll = vector<vll>;

constexpr ll kMax = 1e12 + 1;
constexpr ll kMod = 1e9 + 7;
constexpr long double kPI = 3.14159265358979323846;

ll gcd(ll a, ll b) {
  if (a < b) {
    return gcd(b, a);
  }
  ll c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

void init() {
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

int main() {
  init();

  ll L, R, D;
  cin >> L >> R>>D;
  ll ans = 0;
  REP(i, L, R+1) {
    if (i % D == 0) {
      ans++;
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3648
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {k: u32};
    let mut base = 7;
    let mut l = 1;
    let k: u32 = k;

    if k % 2 == 0 {
        println!("-1")
    } else {
        while k > base {
            base = base * 10 + 7;
            l += 1;
        }

        let mut m = base % k;

        let mut limit = 0;
        while m != 0 && limit < k {
            m = (m * 10 + 7) % k;
            limit += 1;
            l += 1;
        }

        if limit == k {
            println!("-1")
        } else {
            println!("{}", l)
        }
    }
}


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

int cut(int x){
    rep(i, x){
        x -=i;
        if(x< 0){
            return i-1;
        }
    }
}

int main(){
    ll n;
    cin >> n;
    ll sum =0;
    vector<int> x(0);
    for(int i =2; i <=1000000; i ++){
        int a=0;
        while(n%i ==0){
            a ++;
            n /= i;
        }
        if( a!=0){
            x.push_back(a);
        }

    }
  if(n!=1){
        x.push_back(1);
      }
    ll ans =0;
    rep(i, x.size()){
        ans += cut(x[i]);
    }
    cout << ans << endl;
} 

Measured memory_bytes: 3604
n = int(input())
T = 0
H = 0

for _ in range(n):
    a, b = [str(i) for i in input().split()]
    if a == b:
        T += 1
        H += 1
    elif a<b:
        H += 3
    elif a>b:
        T += 3
print(T, H)


Measured memory_bytes: 5600
using System;
using System.Collections.Generic;
using System.Linq;

namespace AtCoder
{
    class Abc167A
    {
        public static void Main()
        {
            var s = Console.ReadLine();
            var t = Console.ReadLine();

            if (s.Length + 1 == t.Length && s == t.Substring(0, s.Length))
                Console.WriteLine("Yes");
            else
                Console.WriteLine("No");
        }
    }
}


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

int main() {
    ll X, cur = 100;
    int i = 0;
    cin >> X;
    while(cur < X){
        cur *= 1.01;
        i++;
    }
    cout << i << endl;
}


Measured memory_bytes: 3676
from scipy.sparse import *
from itertools import *

n,m,r = [int(x) for x in input().split()]
R = [int(i)-1 for i in input().split()]
route_list = [[0]*n for i in range(n)]
ans = 10**9
for j in range(m):
  a,b,c = map(int,input().split())
  route_list[a-1][b-1] = c
  route_list[b-1][a-1] = c
 
Co = csgraph.floyd_warshall(csr_matrix(route_list))
 
for v in permutations(R):
  temp = 0
  for i in range(1,r):
    temp += Co[v[i-1]][v[i]]
  ans = min(ans,temp)
print(int(ans))

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

int main() {
    int n, cnt[100005]{}, ans = 0, r = 0;
    cin >> n;
    for(int i=0; i<n; i++){
        int a;
        cin >> a;
        cnt[a]++;
    }
    for(int i=0; i<=100000; i++){
        if(cnt[i] > 0){
            ans++;
            r = r + cnt[i]-1;
        }
    }
    if(r % 2 == 1){
        ans--;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

 
public class Main {
 
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		
		for(int i = 1; i <= 1250; i++) {
			if(Math.floor(i * 0.08) == A && Math.floor(i * 0.1) == B) {
				System.out.print(i);	
				sc.close();
				return;
			}
		}
		
		System.out.print(-1);		
		sc.close();
	}
	
}

Measured memory_bytes: 23764
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use itertools::Itertools;
use num::clamp;
use proconio::{input, marker::*, fastout};
use superslice::*;

#[fastout()]
fn main() {
    input! {
        s: Chars,
        t: Chars,
    }

    let mut ans = 0;
    for i in 0..s.len() {
        if s[i] != t[i] {
            ans += 1;
        }
    }
    println!("{}",ans);
}


Measured memory_bytes: 4016
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

class Program
{
    public static void Main()
    {
        string S = Console.ReadLine();
        long K = long.Parse(Console.ReadLine());
        for(int i = 0; i < K; i++)
        {
            if (S[i] != '1')
            {
                Console.WriteLine(S[i]);
                return;
            }
        }
        Console.WriteLine('1');
    }
}

Measured memory_bytes: 13140
#include<iostream>

using namespace std;

const int MAX_N=1e5+5;

long long dp[MAX_N];
long long h[MAX_N];

/*long long abs(long long x){
  if(x>0)return x;
  else return -x;
}*/

int main(){
  int n;
  cin>>n;
  for(int i=0;i<n;i++){
    cin>>h[i];
  }
  dp[0]=0;
  dp[1]=abs(h[1]-h[0]);
  for(int i=0;i<n;i++){
    dp[i+2]=min(dp[i]+abs(h[i+2]-h[i]),dp[i+1]+abs(h[i+2]-h[i+1]));
  }
  cout<<dp[n-1]<<endl;

}


Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static int ReadInt() { return int.Parse(Console.ReadLine()); }
    static int[] ReadInts() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return Console.ReadLine().Split(); }

    static void Main() {
        var ab = ReadInts();
        int a = ab[0], b = ab[1];

        if (a + b >= 10)
            Console.WriteLine("error");
        else
            Console.WriteLine(a + b);
    }
}

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

long long A,B,K;

int main() {
  cin >> A >> B >> K;
  if (K<=A) cout << A-K << " " << B << endl;
  else if (K>A && K<=A+B) cout << 0 << " " << A+B-K << endl;
  else if (K>A+B) cout << 0 << " " << 0 << endl;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
    static boolean search(String tar , String str){
        boolean f = false;
        for(int j=0;j<str.length();j++){
            if(tar.equals(str))return true;
            if(tar.charAt(0)==str.charAt(j)){//ターゲットの先頭文字と一致する文字をstrから探す
                int cnt=0;
//              System.out.println(j + "   " +" " +tar.charAt(0) + " " + str.charAt(j));
                for(int i=j+1;i<str.length();i++){//２文字目の探索
                    cnt++;
                    if(str.length()<j+cnt)continue;
                    if(tar.charAt(1)==str.charAt(i)){
                        if((j+tar.length()-1*cnt)>str.length())break;//
//                      System.out.println(j + "   " +" " +tar.charAt(1) + " " + str.charAt(i));
                        for(int k=2;k<tar.length();k++){//３文字目以降の文字の探索
                            if(j+k*cnt>=str.length()){f=false;break;}//
//                          System.out.println(j + " " + cnt + " "+ tar.charAt(k) + " " + str.charAt(j+k*cnt));
                            if(tar.charAt(k)==str.charAt(j+k*cnt))f = true;
                            else {
                                f = false;
                                break;
                            }
                        }
                        if(f==true) return f;
                    }
                }
            }
        }       
        return f;
    }
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = 0;
        String tar = sc.next();
        for(int i=0;i<n;++i){
            String s = sc.next();
            if(search(tar,s))ans++;
//          System.out.println("----" + i + " " + ans);
        }
        System.out.println(ans);
    }
}

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

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int[][] sheets = {
				{1,2,1,2,1,4,1,4}, 
                {1,2,1,4,1,4,1,2},
                {1,4,1,2,1,2,1,4},
                {1,4,1,4,1,2,1,2},
                {2,1,2,1,4,1,4,1},
                {2,1,4,1,4,1,2,1},
                {4,1,2,1,2,1,4,1},
                {4,1,4,1,2,1,2,1}};
		int[] wait = new int[8];
		StringBuilder sb = new StringBuilder();
		while (in.hasNext()) {
			String[] nums = in.nextLine().split("\\s");
			Arrays.fill(wait, 0);
			for (int i = 0; i < 8; i++) {
				wait[i] = Integer.parseInt(nums[i]);
			}
			int[] ans = null;
			int min = Integer.MAX_VALUE;
			for (int[] set : sheets) {
				int amari = 0;
				for (int i = 0; i < 8; i++) {
					amari += Math.max(0, wait[i] - set[i]);
				}
				if (min > amari) {
					ans = set;
					min = amari;
				}
			}
			sb.setLength(0);
			for (int i : ans) {
				sb.append(i);
				sb.append(" ");
			}
			sb.setLength(sb.length() - 1);
			System.out.println(sb.toString());
		}
		in.close();
	}

}

Measured memory_bytes: 19732
#include<cstdio>
#include<algorithm>
#include<cmath>
using namespace std;
const int maxn=100005;
int a[maxn],k,n;
int Min=2147483647;
int main()
{
    scanf("%d %d",&n,&k);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);
    }
    for(int i=1;i<=n-k+1;i++)
    {
        int l=i,r=i+k-1;
        Min=min(Min,a[r]-a[l]+min(abs(a[l]),abs(a[r])));
    }
    printf("%d",Min);
    return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int main()
{
    
    int w, a, b;
    cin >> w >> a >> b;
 
    int ab = abs(a-b);
    if(ab > w)
        cout << ab - w << endl;
    else
        cout << 0 << endl;

	 return 0; 
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = nextInt()
    val A = listOfLong().toLongArray()
    var ans = 0
    for (n in 0 until N) {
        while (A[n] % 2L == 0L) {
            A[n] /= 2L
            ans += 1
        }
    }
    println(ans)
}
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun nextLong() = java.lang.Long.parseLong(next())
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }
fun listOfLong() = listOfString().map { java.lang.Long.parseLong(it) }


Measured memory_bytes: 41708
N, M = gets.split.map(&:to_i)
S = gets.strip

(puts -1; exit ) if S =~ /1{#{M}}/
i, is = N, [N]
while i > 0
  i = ([i - M, 0].max ... i).find{|j| S[j] == '0'}
  is << i
end
puts is.reverse.each_cons(2).map{|a, b| b - a}.join(' ')

Measured memory_bytes: 4988
#include <bits/stdc++.h>
using namespace std;
long long n, a, b;
int main()
{
	scanf("%lld%lld%lld", &n, &a, &b);
	if(abs(a - b) % 2 == 0) printf("%lld\n", abs(a - b) / 2);
	else {
		if(a > b) swap(a, b);
		long long ans = (a - 1) + 1 + abs(a - b) / 2;
		ans = min(ans, n - b + 1 + abs(a - b) / 2);
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N=5005;
const ll inf=0x3f3f3f3f3f3f;
struct person
{
	int h;int p;ll key;
}people[N];
int n;
bool cmp(person x,person y)
{
	return x.h+x.p<y.h+y.p;
}
int ans;
ll dp[N];
int main() 
{
	cin>>n;
	for (int i=1;i<=n;i++)
	{
		cin>>people[i].h>>people[i].p;
//		people[i].key=people[i].h+people[i].p+people[i].h*people[i].p;
	}
	sort(people+1,people+n+1,cmp);
	for (int i=1;i<=n;i++) dp[i]=inf;
	for (int i=1;i<=n;i++)
	{
		for (int j=i;j>=1;j--)
		{
			if (dp[j-1]<=people[i].h) 
				dp[j]=min(dp[j],dp[j-1]+people[i].p);
		}
	}
	for (int i=0;i<=n;i++)
	{
		if (dp[i]<inf) ans=i;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3728
// AOJ 2618: Trip to Kyoto
// 2018.1.25 bal4u@uu

#include <stdio.h>

int x1[10002], y1[10002], x2[10002], y2[10002];
char *msg[2] = { "%d\n", "%d.5\n" };

#define getchar_unlocked()  getchar()
int in()
{
	int n = 0;
	int c = getchar_unlocked();
	if (c == '-') {
		c = getchar_unlocked();
		do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
		while (c >= '0');
		return -n;
	}
	do n = (n<<3)+(n<<1) + (c & 0xf), c = getchar_unlocked();
	while (c >= '0');
	return n;
}

int calc(int x1, int y1, int x2, int y2)
{
	int dx, dy, x20, y20, t;

	dx = x1-x2; if (dx < 0) dx = -dx;
	dy = y1-y2; if (dy < 0) dy = -dy;
	x20 = x1 % 20 + x2 % 20;
	y20 = y1 % 20 + y2 % 20;
	if (!x20) {
		if (x1 == x2) return dy;
		else if (y1/20 == y2/20) {
			t = 40 - y20; if (t > y20) t = y20;
			return dx + t;
		}
	} else if (!y20) {
		if (y1 == y2) return dx;
		else if (x1/20 == x2/20) {
			t = 40 - x20; if (t > x20) t = x20;
			return dy + t;
		}
	}
	return dx+dy;
}

int main()
{
	int n, x, y, i, j, k, s, t, ans;
	int xmin, xmax, ymin, ymax;
	int x0, y0;

	n = in();
	x = (in()+100000000) << 1, y = (in()+100000000) << 1;
	x1[0] = x, y1[0] = y, xmin = xmax = x2[0] = x+y, ymin = ymax = y2[0] = x-y;
	for (i = 1; i < n; i++) {
		x = (in()+100000000) << 1, y = (in()+100000000) << 1;
		x1[i] = x,   y1[i] = y;
		x2[i] = x+y, y2[i] = x-y;
		if      (x2[i] < xmin) xmin = x2[i];
		else if (x2[i] > xmax) xmax = x2[i];
		if      (y2[i] < ymin) ymin = y2[i];
		else if (y2[i] > ymax) ymax = y2[i];
	}
 
	x = (xmin + xmax) >> 1, y = (ymin + ymax) >> 1;
	x0 = (x + y) >> 1, y0 = (x - y) >> 1;

#define OFF 10
	ans = 0x7fffffff;
	for (i = x0-OFF; i <= x0+OFF; i++)for (j = y0-OFF; j <= y0+OFF; j++) {
		if (i%20 && j%20) continue;
		t = 0; for (k = 0; k < n; k++) if (t < (s = calc(i, j, x1[k], y1[k]))) t = s;
		if (ans > t) ans = t;
	}
	printf(msg[ans & 1], ans >> 1);
	return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); ++i)

using namespace std;

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

// 最大公約数を計算( gcd.cpp 参照)
ll gcd(ll a, ll b) {
  if (b == 0) {
    return a;
  } else {
    return gcd(b, a % b);
  }
}

// 最小公倍数を計算
ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

int main() {
  int n;
  cin >> n;
  vector<ll> t(n);
  rep(i, n) cin >> t[i];

  ll res = t[0];
  for (int i = 1; i < n; ++i) {
    res = lcm(res, t[i]);
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 256
lines = readlines.map{|line| line.split(' ').map(&:to_i)}
a=[]
for i in 1..lines[0][0]
  b=lines[i][0]-lines[i][1]
  c=lines[i][0]+lines[i][1]
  a.push([b,c])
end
a=a.sort_by(&:last)
j=0
k=0
while j<lines[0][0]-1-k do
  if a[j].last!=nil&&a[j+1]!=nil&&a[j].last>a[j+1].first then
    a.delete_at(j+1)
    k=k+1
  else
    j=j+1
  end
end
puts a.size

Measured memory_bytes: 23200
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = (0); i < (n); ++i)
#define ALL(obj) (obj).begin(), (obj).end()
#define DEBUG(val) cout << #val << " : " << val << endl
#define MOD 1000000007

int main() {
  int n;
  cin >> n;
  map<int, int> data;
  REP(i, n - 1) {
    int x;
    cin >> x;
    data[x] += 1;
  }
  FOR(i, 1, n + 1) { cout << data[i] << endl; }
}

Measured memory_bytes: 12972
#include<bits/stdc++.h>
#define FOR(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define FORN(i,b,a)for(int i=(b);_a=(a);i>=_a;i--)
#define REP(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define re return
#define vi vector<int>
#define pb push_back
#define si set<int>
#define in insert
#define fl float
#define db double
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define size(s) s.size()
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
ll n,d,a;
ll now;
ll ans;
ll c[200100];
pii m[200100];
ll k;
int main()
{
    cin>>n>>d>>a;
    d*=2;
    REP(i,n)
    {
    	cin>>m[i].X>>m[i].Y;
        m[i].Y=(m[i].Y+a-1)/a;
    }
    sort(m,m+n);
    now=0;
    REP(i,n)
    {
        while(now<i&&m[i].X-m[now].X>d)
          k-=c[now++];
        c[i]=m[i].Y-k;
        if(c[i]<0)
          c[i]=0;
        ans+=c[i];
        k+=c[i];
    }
    cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int i,j,n,k,sum=0;
  cin >> n >> k;
  vector<int> vec(n);
  for(i=0;i<n;i++)cin >> vec[i];
  sort(vec.begin(), vec.end());
  for(i=0;i<k;i++){
    sum += vec[i];
  }
  cout << sum << endl;
}

Measured memory_bytes: 3632
#include<algorithm>
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;

#define rep(i,n) for(int i=0; i<n; i++)
int main(){
	 int a, b, c, d, e, f;
	while(cin >>a>>b>>c>>d>>e>>f){
		double x = (double) (e*c-b*f)/(a*e-b*d);
		double y = (double) (-d*c+a*f)/(a*e-b*d);
		if(x==0) x=0;
		if(y==0) y=0;
		printf("%.3f %.3f\n", x, y);
	}
		

    return 0;
}

Measured memory_bytes: 1192
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = IR(5)
    k = II()
    if max(a) - min(a) > k:
        print(":(")
    else:
        print("Yay!")
    return

#B
def B():
    a = IR(5)
    b = a[0]
    ans = 0
    for a_ in a:
        if a_ % 10 != 0:
            if b % 10> a_ % 10:
                b = a_
    flg = 0
    for a_ in a:
        if a_ != b or flg:
            ans += math.ceil(a_ / 10) * 10
        else:
            ans += b
            flg = 1
    print(ans)
            
    
    return

#C
def C():
    n = II()
    ai = IR(5)
    print(math.ceil(n / min(ai)) + 4)
        
        
    return

#D
def D():
    x, y, z, K = LI()
    a = LI()
    a.sort(reverse=True)
    b = LI()
    b.sort(reverse = True)
    c = LI()
    c.sort(reverse=True)
    ab = []
    for a_ in a:
        for b_ in b:
            ab.append(a_ + b_)
    ab.sort(reverse = True)
    ab = ab[:K]
    ans = []
    for ab_ in ab:
        for c_ in c:
            ans.append(ab_ + c_)
    ans.sort(reverse = True)
    for k in range(K):
        print(ans[k])



        
                    

    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    D()

Measured memory_bytes: 137048
#[allow(unused_imports)]
use itertools::Itertools;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

fn main() {
    input! {
        n: i64,
        m: i32,
        d: i64,
    }

    if d == 0 {
        println!("{}", (1. / (n as f64)) * (m - 1) as f64);
        return;
    }

    let e = std::cmp::min(n, 2 * d);
    let x = (2 * n - e) as f64 / (n * n) as f64;

    println!("{}", x * (m - 1) as f64);
}


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

#define ll long long

int main() {
  int N;
  cin >> N;
  
  vector<ll> lucas(N+2, 0);
  lucas[0] = 2;
  lucas[1] = 1;
  for (int i = 0; i < N; i++) {
    lucas[i+2] = lucas[i+1] + lucas[i];
  }
  
  cout << lucas[N] << endl;
      
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

int cmp(int x,int y)
{
	return x>y;
}
int main(){
	int n,a[100005],c[100005];
	while(~scanf("%d",&n)){
	memset(c,0,sizeof(c));
		for(int i=0;i<n;i++){
			scanf("%d",&a[i]);
				c[a[i]]++;
				c[a[i]+1]++;
				c[a[i]-1]++;			
				if(i==n-1){
				sort(c,c+100005,cmp);
				printf("%d\n",c[0]);
				}	
		}
	}
	return 0;
} 

Measured memory_bytes: 3980
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;

template<typename Abel> struct BIT2D {
    vector<vector<Abel>> dat;
    BIT2D(int h, int w) : dat(h + 1, vector<Abel>(w + 1)) { }
    inline void add_point(int a, int b, Abel x) {
        int h = dat.size(), w = dat[0].size();
        for (int i = a; i < h; i += i & -i)
            for (int j = b; j < w; j += j & -j) dat[i][j] += x;
    }
    inline Abel sum(int a, int b) {
        Abel res = Abel(0);
        for (int i = a; i > 0; i -= i & -i)
            for (int j = b; j > 0; j -= j & -j) res += dat[i][j];
        return res;
    }
    // [si, ti) x [sj, tj), 1-indexed
    inline Abel sum(int si, int ti, int sj, int tj) {
        si--, ti--, sj--, tj--;
        return sum(ti, tj) - sum(si, tj) - sum(ti, sj) + sum(si, sj);
    }
    Abel operator()(int i, int j) { return sum(i, i + 1, j, j + 1); }
};

int main() {
    int H, W, T, Q; cin >> H >> W >> T >> Q;
    BIT2D<int> done(H, W), cont(H, W);
    queue<pair<int, pair<int, int>>> que;
    while (Q--) {
        int t, c, h, w; cin >> t >> c >> h >> w;
        while (!que.empty()) {
            pair<int, pair<int, int>> p = que.front();
            if (p.first > t) break;
            que.pop();
            int x = p.second.first, y = p.second.second;
            cont.add_point(x, y, -1), done.add_point(x, y, 1);
        }
        if (c == 0) {
            cont.add_point(h, w, 1);
            que.emplace(t + T, make_pair(h, w));
        }
        if (c == 1) {
            if (done(h, w)) done.add_point(h, w, -1);
        }
        if (c == 2) {
            int h2, w2; cin >> h2 >> w2;
            cout << done.sum(h, h2 + 1, w, w2 + 1) << " ";
            cout << cont.sum(h, h2 + 1, w, w2 + 1) << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 35556
#include <iostream>

// buying-sweets.cpp
// author: Seong Yong-ju ( @sei40kr )
// Copyright (c) 2018 Seong Yong-ju

using namespace std;

int main() {
  int x, a, b;
  cin >> x >> a >> b;

  cout << (x - a) % b << endl;
}


Measured memory_bytes: 256
#CODE FES 2016 C
n, m = map(int, input().split())

par=[i for i in range(n+m)]
size=[1 for _ in range(n+m)]
rank=[0 for _ in range(n+m)]
 
def find(x):#木の根を求める
    if par[x]==x:
        return x
    else:
        par[x]=find(par[x])
        return par[x]
    
def merge(x,y):#併合
    x=find(x)
    y=find(y)
    if x==y:
        return
    if rank[x]>rank[y]:
        par[y]=x
        size[x]+=size[y]
    else:
        par[x]=y
        size[y]+=size[x]
        if rank[x]==rank[y]:
            rank[y]+=1
            
def same(x,y):
    return find(x)==find(y)

for i in range(n):
    l = list(map(int, input().split()))[1:]
    for j in range(len(l)):
        merge(i, l[j]+n-1)
flg = True
for i in range(1, n):
    if not same(0, i):
        flg = False
print('YES' if flg else 'NO')

Measured memory_bytes: 14228
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		long k = sc.nextLong();
		long sum = 0;
		for (int a = 1; a <= k; ++a) {
			for (int b = 1; b <= k; ++b) {
				long g1 = findGcd(a, b);
				for (int c = 1; c <= k; ++c) {
					long g2 = findGcd(g1, c);
					sum += g2;
				}
			}
		}

		System.out.println(sum);
	}

	public static long findGcd(long a, long b) {
		if (b == 0L) {
			return a;
		}
		return findGcd(b, a % b);
	}

}


Measured memory_bytes: 35668
#include<iostream>

int main(){
  int W, a, b;
  std::cin >> W >> a >> b;
  int aR = a + W;
  int bR = b + W;
  if(a == b) std::cout << 0 << std::endl;
  else if(a < b){
    if(aR > b) std::cout << 0 << std::endl;
    else std::cout << b - aR << std::endl;
  }else{
    if(a < bR) std::cout << 0 << std::endl;
    else std::cout << a - bR << std::endl;
  }
}

Measured memory_bytes: 384
let n = Scanf.scanf " %d" (+) 0
let xs = Array.init n @@ fun i -> Scanf.scanf " %d" (+) 0
let rs = Array.copy xs
let _ = Array.(sort (-) rs; iter (fun x -> Printf.printf "%d\n" @@ if rs.(n / 2 - 1) < x then rs.(n / 2 - 1) else rs.(n / 2)) xs)

Measured memory_bytes: 7808
// Copyright (C) 2017 __debug.

// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; version 3

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; If not, see <http://www.gnu.org/licenses/>.


#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/priority_queue.hpp>

#define x first
#define y second
#define MP std::make_pair
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#ifdef __linux__
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif

using std::pair;
using std::vector;
using std::string;

typedef long long LL;
typedef pair<int, int> Pii;

const int oo = 0x3f3f3f3f;

template<typename T> inline bool chkmax(T &a, T b) { return a < b ? a = b, true : false; }
template<typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, true : false; }
string procStatus()
{
    std::ifstream t("/proc/self/status");
    return string(std::istreambuf_iterator<char>(t), std::istreambuf_iterator<char>());
}
template<typename T> T read(T &x)
{
    int f = 1;
    char ch = getchar();
    for (; !isdigit(ch); ch = getchar())
        f = (ch == '-' ? -1 : 1);
    for (x = 0; isdigit(ch); ch = getchar())
        x = 10 * x + ch - '0';
    return x *= f;
}
template<typename T> void write(T x)
{
    if (x == 0) {
        putchar('0');
        return;
    }
    if (x < 0) {
        putchar('-');
        x = -x;
    }
    static char s[20];
    int top = 0;
    for (; x; x /= 10)
        s[++top] = x % 10 + '0';
    while (top)
        putchar(s[top--]);
}
// EOT

const int MAXN = 2e5 + 5;

int N, T;
int A[MAXN];

void input()
{
    read(N); read(T);
    for (int i = 1; i <= N; ++i) {
        read(A[i]);
    }
}

void solve()
{
    int end = 0;
    int ans = 0;
    for (int i = 1; i <= N; ++i) {
        ans += std::min(0, A[i] - end) + T;
        end = A[i] + T;
    }
    printf("%d\n", ans);
}

int main()
{
#ifdef __DEBUG
    freopen("C.in", "r", stdin);
    freopen("C.out", "w", stdout);
#endif

    input();
    solve();

    return 0;
}

// 瑶草一何碧，春入武陵溪。
//     -- 黄庭坚《水调歌头·游览》


Measured memory_bytes: 1024
from itertools import accumulate
from collections import defaultdict
N, K = map(int, input().split())
A = list(map(int, input().split()))
A_cum = [0] + list(accumulate(A))
ans = 0
dd = defaultdict(int)
q = []
for i, a in enumerate(A_cum):
    a -= i
    a %= K
    if i-K >= 0:
        dd[q[i-K]] -= 1
    ans += dd[a]
    dd[a] += 1
    q.append(a)
print(ans)


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

int main() {
  int a,b;
  cin >> a >> b;
  int count;
  for(int i=a; i<b+1; i++){
    string k = to_string(i);
    string tk;
    for(int j=k.length(); j>0; j--){
      tk += k[j-1];
    }
    if(k == tk){
      count++;
    }
  }
  
  cout << count << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
const int Mod=1000000007;
inline void add(int &x,int y)
{
    if((x+=y)>=Mod)x-=Mod;
    if(x<0)x+=Mod;
}
inline int cmp(int x,int y)
{
    return (x<y ? 0 : (x>y ? 2 : 1));
}
int num[65],dp[65][3][3][2];
int main()
{
    long long n;
    scanf("%lld",&n);
    for(int i=1;i<=60;i++)
        num[i]=n%2,n/=2;
    dp[0][1][1][0]=1;
    for(int i=1;i<=60;i++)
    for(int j=0;j<3;j++)
    for(int k=0;k<3;k++)
    for(int l=0;l<2;l++)
    for(int p=0;p<2;p++)
    for(int q=0;q<=p;q++)
    {
        int tj=cmp(p^q,num[i]);
        int tk=cmp((p+q+l)%2,num[i]);
        if(tj==1)tj=j;
        if(tk==1)tk=k;
        int tl=(p+q+l)/2;
        add(dp[i][tj][tk][tl],dp[i-1][j][k][l]);
    }
    int res=0;
    for(int j=0;j<2;j++)
    for(int k=0;k<2;k++)
        add(res,dp[60][j][k][0]);
    return 0*printf("%d\n",res);
}

Measured memory_bytes: 256
function myout(text){console.log(text);}//standard output
function Main(input) {
	//input = parseInt(input);
	//input = input.trim().split(" ");
	input = input.trim().split("\n");
	//input = input.trim().split(" ").map((a)=>Number(a));
	//input = input.trim().split("\n").map((a)=>Number(a));
  
  /*
  abcd→一番左は3パターン
  abcd→以降は2パターン
  ---------
  aac→左上3パターン、左下2パターン＝6パターン
  bbc→次の縦並びは必ず1パターンしか選べない
  ---------
  aacc→左上は3パターン、左下2パターン
  bbdd→右側は「左側の上下逆」「上だけ別」「下だけ別」の3パターン
  ---------
  abb→左側が決まってるので
  acc→上下まとめて2パターン
  */
  
  var N = parseInt(input[0]);
  var list1 = input[1].split("");
  var list2 = input[2].split("");
  var output = 1;
  var mod = 1000000007;
  var mae = true;//一つ前が縦並びか横並びか（true:縦、false:横）
  for(var i = 0; i < N; i++){
    if(i == 0){
       if(list1[i] == list2[i]){
          output = output * 3 % mod;
       }else{
          output = output * 6 % mod;
          i++;
          mae = false;
       }
    }else{
      if(mae){
        output = output * 2 % mod;
         if(list1[i] == list2[i]){
      	    mae = true;
     	  }else{
            i++;
            mae = false;
         }
      }else{
        if(list1[i] == list2[i]){
      	   mae = true;
     	}else{
          output = output * 3 % mod;
          i++;
            mae = false;
        }
      }
    }
    //myout(list1[i]+list2[i] + ":" + output);
  }
  myout(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim());


Measured memory_bytes: 11468
n,m = map(int, input().split(" "))
xList = [int(i) for i in input().split(" ")]
xList = sorted(xList)
dList = [0]
for i in range(len(xList) -1) :
    dList.append(xList[i+1] - xList[i])
dList = sorted(dList, reverse=True)    

for i in range(n-1) :
    dList[i] = 0
    if(i == len(dList) -1) :
        break
print(sum(dList))

Measured memory_bytes: 19868
N = int(input())
A = list(map(int, input().split()))
import statistics

def comb(a, b):
  s = 1
  for i in range(a, b, -1):
    s *= i
  return s/2
import math

MA = max(A)
A.remove(MA)
SA = sorted(A)

h = MA // 2

da = 10**10
ans = 0
for a in SA:
  diff = abs(a-h)
  if da >= diff:
    da = diff
    ans = a
print(MA, ans)



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

int main() {
	int N, K;
	string S;
	cin >> N >> K >> S;
	S[K - 1] += 32;
	cout << S << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

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

vector<ll> divisor(ll n) {
  vector<ll> ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

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

  int ans = 0;
  for (int i = 1; i <= N; i += 2) {
    vector<ll> div = divisor(i);
    if (div.size() == 8) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
 
using namespace __gnu_pbds;
using namespace std;

#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")

#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long int
#define ull unsigned long long
#define ld long double

#define mod 1000000007
#define EULER 2.7182818284
#define INF 1000000000

#define pb push_back
#define ins insert
#define IT iterator
#define PQ priority_queue
#define    nl           "\n"
#define fi first
#define se second
#define maxe max_element
#define mine min_element
#define er erase
#define lb lower_bound
#define ub upper_bound

#define vi vector<int>
#define vll vector<ll>
#define vb vector<bool>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define all(v) v.begin(),v.end()

#define mem(v,i) memset(v,i,sizeof(v)) // v is array. To set all elements to 0 or -1 only. mem(arr,0);


#define repab(i,a,b) for(int i=(a);i<=(b);i++)
#define reprab(i,a,b) for(int i=(a);i>=(b);i--)
#define repll(i,a,b) for(ll i=(a);i<=(b);i++)
#define rep(i,n) for(int i=(0);i<(n);i++)
#define repr(i,n) for(int i=(n);i>=0;i--)
#define bs bitset
#define bpc(a) __builtin_popcount(a)
#define tc int t;cin>>t;while(t--)
template<typename T> void TIME(T start, T end)
{
#ifndef ONLINE_JUDGE
    double time_taken =  chrono::duration_cast<chrono::nanoseconds>(end - start).count();
    time_taken *= 1e-9;
    cout << "\nExecuted in: " << fixed
         << time_taken << setprecision(9);
    cout << " sec";
#endif
}

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

ll max(ll a,ll b)
{
    if(a>b)return a;return b;
}
ll min(ll a,ll b)
{
    if(a<b)return a;return b;
}

ll mypow(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if(b==0)
    return a;
    return gcd(b,a%b);
}
//..............................!!!!!!Get ready to fight!!!!!!............................


int main()
{   
     auto start = chrono::high_resolution_clock::now();
    fast
    string s,t;
    cin>>s>>t;
    ll cnt=0;
    ll n=s.length();
    for(ll i=0;i<n;i++){
        if(s[i]!=t[i])
        cnt++;
    }
    cout<<cnt<<nl;
    auto end = chrono::high_resolution_clock::now();
    TIME(start, end);
    return 0;
}

Measured memory_bytes: 3820
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const double PI=3.14159265358979323846;
const int64_t waru = 1000000007;
const in INF=1<<30;
using vec = vector<vector<in>>;

int main(){
 int n,m;
  cin>>n>>m;
  vector<pair<int,string>> a(m);
  int x;
  string y;
  rep(i,m){cin>>x>>y; a.at(i) =make_pair(x,y);}
  
  vector<int> ac(n+1,0);
  vector<int> wa(n+1,0);
  
  
  rep(i,m){
     x=a.at(i).first;
    y=a.at(i).second;
    if(ac.at(x)>0) continue;
    if(y=="AC") ac.at(x) ++;
    else wa.at(x) ++;
  }
  
  int aac=0;
  int awa=0;
  rep(i,n+1){
    aac += ac.at(i);
    if(ac.at(i)==1) awa += wa.at(i);
  }
  
  cout<<aac<<" "<<awa;
}


Measured memory_bytes: 7296
#define	_USE_MATH_DEFINES
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cfloat>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <string>
#include <set>
using namespace std;
int main(){
	
	string s;
	while(getline(cin,s)){
		for(int i=0;i<26;i++){
			for(int j=0;j<s.size();j++){
				if(s[j]>='a'&&s[j]<='y'){
					s[j]++;
				}
				else if(s[j]=='z')
					s[j]='a';
			}
			if(s.find("the")!=string::npos||s.find("this")!=string::npos||s.find("that")!=string::npos){
				cout<<s<<endl;
				break;
			}
			
		}
	}
	
	
	
}

Measured memory_bytes: 1176
s = input()
k = int(input())
li = list(s)
lee = len(s)

if len(list(set(li))) == 1:
    print((lee)*k//2)
    exit()


def motome(n,list):
    count = 0
    kaihi_flag = False
    li = list*n
    for i,l in enumerate(li):
        if i == 0:
            continue
        if l == li[i-1] and not kaihi_flag:
            count += 1
            kaihi_flag = True
        else:
            kaihi_flag = False
    #print(count)
    #print(count*k)
    return count

if k >= 5 and k%2 == 1:
    a = motome(3,li)
    b = motome(5,li)
    diff = b - a
    ans = b + (k-5)//2*diff
    print(ans)
elif k >=5 and k%2 == 0:
    a = motome(2,li)
    b = motome(4,li)
    diff = b - a
    ans = b + (k-4)//2*diff
    print(ans)
else:
    count = 0
    kaihi_flag = False
    li = li*k
    for i,l in enumerate(li):
        if i == 0:
            continue
        if l == li[i-1] and not kaihi_flag:
            count += 1
            kaihi_flag = True
        else:
            kaihi_flag = False
    #print(count)
    #print(count*k)
    print(count)


Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#define N 100
using namespace std;
int a[N];
int n;
int main()
{
    cin>>n;
    for (int i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+1+n);
    for (int i=n;i>=1;i--)
        if (i%2==0)
          a[i]=24-a[i];
    sort(a+1,a+1+n);
    int maxn=24;
    for (int i=1;i<=n;i++)
        maxn=min(maxn,a[i]-a[i-1]);
    cout << maxn << endl;
    return 0;
}


Measured memory_bytes: 256
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define is_even(z) (((z) & 1) == 0)

int main(int argc, char **argv) {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int a;
    scanf("%d", &a);
    if (is_even(a) && a % 3 != 0 && a % 5 != 0) {
      printf("DENIED\n");
      return 0;
    }
  }
  printf("APPROVED\n");
  return EXIT_SUCCESS;
}


Measured memory_bytes: 128
n,w = gets.split.map(&:to_i)
dp = Array.new(n+1).map{Array.new(n+1).map{Array.new(310,0)}}
p,q = 2.times.map{Array.new(n)}
n.times do |i|
    p[i],q[i] = gets.split.map(&:to_i)
end

for i in 0..n-1
    for j in 0..i
        for k in 0..3*j
            dp[i+1][j][k] = dp[i][j][k] if dp[i+1][j][k] < dp[i][j][k]
            dp[i+1][j+1][k+p[i]-p[0]] = dp[i][j][k]+q[i] if dp[i+1][j+1][k+p[i]-p[0]] < dp[i][j][k]+q[i]
        end
    end
end

ans = 0
for i in 0..[w/p[0],n].min
    for j in 0..3*n
        break if i*p[0]+j > w
        ans = dp[n][i][j] if ans < dp[n][i][j]
    end
end
puts ans

Measured memory_bytes: 29052
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s,t;
    cin>>s>>t;
	if (s == t) {
    cout << "EQUAL" << endl;
  } else if (s.size() > t.size()) {
    cout << "GREATER" << endl;
  } else if (s.size() < t.size()) {
    cout << "LESS" << endl;
  } else if (s > t) {
    cout << "GREATER" << endl;
  } else {
    cout << "LESS" << endl;
  }



	return 0;
}


Measured memory_bytes: 256