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

using namespace std;
using ll = long long;

#pragma region Macros
#define FOR(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define rep(i, n) FOR(i, 0, n)

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

template <class T> string join(const T &v, const string delim = ",")
{
    if (v.empty())
        return "";

    ostringstream res;
    res << v[0];
    for (int i = 1; i < v.size(); i++)
    {
        res << delim << v[i];
    }
    return res.str();
}

#ifdef LOCAL
#define dbg(x) cerr << __LINE__ << ":" << #x << " = " << (x) << endl;
#else
#define dbg
#endif

#pragma endregion Macros

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

    ll c = 0;
    ll ans = 0;
    rep(i, N) {
        if(c > A[i]){
            ans += c - A[i];
        }else{
            c = A[i];
        }
    }

    cout << ans << endl;
}


Measured memory_bytes: 4820
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
    ll nowa,nowb;
    ll a[1000][2];
    cin>>n;
    for(ll i=0;i<n;i++){
        cin>>a[i][0]>>a[i][1];
        if(i!=0){
            if(a[i][0]==1 && a[i][1]==1){
                nowa=max(nowa,nowb);
                nowb=max(nowa,nowb);
            }else{
                ll b;
                b=max((nowa+a[i][0]-1)/a[i][0],(nowb+a[i][1]-1)/a[i][1]);
                
                nowa=a[i][0]*b;
                nowb=a[i][1]*b;
            }
        }
        else {nowa=a[i][0];nowb=a[i][1];}
        //cout<<nowa<<" "<<nowb<<endl;
    }
    cout<<nowa+nowb<<endl;
    
    return 0;
}


Measured memory_bytes: 256
import kotlin.math.abs

fun main(args: Array<String>) {
    val (X, N) = readLine()!!.split(" ").map{it.toInt()}
    if(N < 1) {
      println(X)
      return
    }
    val numbers = readLine()!!.split(" ").map { it.toInt() }.sorted()
  
    val firstNum = numbers[0] - 1
    fun absCalc(counter: Int, minNum: Int, nums: List<Int> = numbers, target: Int = X): Int {
        val newMinNum = if (!nums.contains(counter) && abs(target - counter) < abs(target - minNum)) {
            counter
        } else minNum

        return if (numbers.last() + 1 < counter) newMinNum else absCalc(counter + 1, newMinNum)
    }
    println(absCalc(firstNum, firstNum))
}


Measured memory_bytes: 39020
package main

import (
	"bufio"
	"fmt"
	"strings"
)

func main() {
	var n int64
	fmt.Scan(&n)
	aArray := scanNums(n)

	var sumVal int64 = 0
	for _, a := range aArray {
		sumVal += a
	}

	var leftLen int64 = 0
	var rightLen int64 = sumVal
	var leftRightDiff int64 = sumVal

	for _, a := range aArray {
		leftLen += a
		rightLen -= a
		var curDiff int64 = 0
		if leftLen > rightLen {
			curDiff = leftLen - rightLen
		} else {
			curDiff = rightLen - leftLen
		}
		if leftRightDiff > curDiff {
			leftRightDiff = curDiff
		}
	}

	fmt.Println(leftRightDiff)
}

func scanNums(len int64) (nums []int64) {
	var num int64
	var i int64
	for i = 0; i < len; i++ {
		fmt.Scan(&num)
		nums = append(nums, num)
	}
	return
}

func splitInput(scanner *bufio.Scanner, sep string) []string {
	scanner.Scan()
	return strings.Split(scanner.Text(), sep)
}


Measured memory_bytes: 7700
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long  ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000003;
typedef double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;

bool b[2000][2000];

bool le[2000][2000], ri[2000][2000];
void solve() {
	int n; cin >> n;
	rep1(i, n - 1) {
		rep(j, i) {
			char t; cin >> t;
			if (t == '1') {
				b[i][j] = true;
			}
			else {
				b[j][i] = true;
			}
		}
	}
	rep(i, n)le[i][i] = ri[i][i] = true;

	int ans = 0;
	Rep1(i, 2, n) {
		rep(j, n - i + 1) {
			int l = j;
			int r = j + i - 1;
			bool fl = false, fr = false;
			Rep1(k, l + 1, r) {
				fl |= b[l][k] & ri[l + 1][k] & le[r][k];
			}
			Rep(k, l, r) {
				fr |= b[r][k] & ri[l][k] & le[r - 1][k];
			}
			le[r][l] = fl, ri[l][r] = fr;
		}
	}
	rep(i, n) {
		if (ri[0][i] && le[n - 1][i])ans++;
	}
	cout << ans << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(5);
	//while (cin >> n)solve();
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 12032
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <unordered_map>
#include <set>
#include <map>
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(0), cout << fixed << setprecision(20);
#define rep(i,n) for (int i=0; i<n;++i)
#define ALL(a)  (a).begin(),(a).end()
#define PI 3.14159265358979
typedef long long ll;
using namespace std;
const ll MOD = 1e9+7LL;
const int INF = 2e9;
string N;

int main() {
  INCANT;
  cin >> N;
  int md=0;
  rep(i, N.size()) {
    md+=N[i]-'0';
    md%=9;
  }
  string ans = md%9==0?"Yes":"No";
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 3748
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
constexpr ll mod=1e9+7;

ll bin_pow(ll a,ll n)
{
  ll ans=1;
  while(n>0)
  {
    if(n&1) ans=ans*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return ans%mod;
}
set<ll> div(ll n)
{
  std::set<ll> ans;
  for (ll i = 1; i <= sqrt(n); ++i)
  {
    if(n%i==0)
    {
      ans.insert(i);
      ans.insert(n/i);
    }
  }
  ans.erase(n);
  return ans;
}

int main()
{
  ll k,n;
  cin>>n>>k;
  vector<ll> cnt(k+1,0);
  for (ll x = k; x >= 1; --x)
  {
    cnt[x]+=bin_pow((k/x),n);
    for(const auto& e: div(x)) 
    {
      cnt[e]-=cnt[x];
    }
  }
  ll ans=0;
  for (ll i = 1; i <= k; ++i)
  {
    ans+=i*cnt[i]%mod;
  }
  cout<<ans%mod<<endl;
}

Measured memory_bytes: 4052
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=0;
void Main(){
    ll n;cin>>n;
    vector<ll> a(n),num(n+10);
    For(i,0,n) {
        cin>>a[i];
        num[a[i]]++;
    }
    map<ll,ll> mp;
    For(i,1,n+1){
        mp[i]=num[i]*(num[i]-1)/2;
    }
    for(auto p:mp){
        ans+=p.second;
    }
    For(i,0,n){
        ll ansi=ans-mp[a[i]]+(num[a[i]]-1)*(num[a[i]]-2)/2;
        cout<<ansi<<endl;
    }
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 18304
def main():
    _ = int(input())
    A = list(map(int, input().split()))

    allXOR = 0
    for a in A:
        allXOR = allXOR ^ a  # 全てのスカーフの論理和

    R = []
    for a in A:
        R.append(a ^ allXOR)

    print(*R)


if __name__ == '__main__':
    main()


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

const int N = 3e5 + 9;

int32_t main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n, k; cin >> n >> k;
	vector<int> a(n, 0);
	for (int i = 0; i < n; i++) cin >> a[i];
	while (k--) {
		vector<int> sum(n + 1, 0);
		for (int i = 0; i < n; i++) {
			sum[max(0, i - a[i])]++;
			sum[min(n, i + a[i] + 1)]--;
		}
		for (int i = 1; i < n; i++) {
			sum[i] += sum[i - 1];
		}
		int all = 1;
		for (int i = 0; i < n; i++) {
			a[i] = min(n, sum[i]);
			all &= a[i] == n;
		}
		if (all) break;
	}
	for (int i = 0; i < n; i++) cout << a[i] << ' '; cout << '\n';
    return 0;
}

Measured memory_bytes: 4940
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;

int main(){
	char a[111];
	int n, m, i, b[111], ans, j;
	while(~scanf("%d", &n)){
		getchar();
		scanf("%s", a);
		ans = 0, b[0] = ans, j = 1;
		m = strlen(a);
		for(i = 0; i < m; i++){
			if(a[i] == 'I')  ans++;
			else  ans--;
			b[j] = ans;
			j++;
		}
		sort(b, b + j);
		printf("%d\n", b[j - 1]);
		getchar();
	}
	return 0;
}

Measured memory_bytes: 256
#include <string>
#include <vector>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <map>
#include <list>
#include <set>
#include <numeric>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <climits>
#include <cfloat>
#include <ctime>
#include <complex>
#include <cassert>
#include <iomanip>
using namespace std;
typedef long long LL;
typedef pair<int,int> P;

int table[102][102];
bool done[102][102];
int H,W;
int ret=0;
int dx[2][6]={{0,1,0,-1,-1,-1},{1,1,1,0,-1,0}};
int dy[2][6]={{-1,0,1,1,0,-1},{-1,0,1,1,0,-1}};
void search(int i, int j)
{
	done[i][j]=true;
	for(int k=0;k<6;k++){
		int x=i+dx[j%2][k];
		int y=j+dy[j%2][k];
		if(0<=x&&x<=W&&
		   0<=y&&y<=H){
			if(table[x][y]==1){
				ret++;
			}
			else if(!done[x][y]) 
			{
				search(x,y);
			}
		}
	}
}
int main() {
	cin >> W >> H;
	for(int i=1;i<=H;i++){
		for(int j=1;j<=W;j++){
			cin >> table[j][i];
		}
	}
	H+=1;
	W+=1;
	search(0,0);
	cout << ret << endl;
}

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


int main()
{
	long long n;
	long long ii;
	long kotae;
	int i;
	int j;
	int k;
	int a[66];


	k=1;
	a[0]=0;
	a[1]=0;
	for(i=1;i<11;i++){
		a[k] = a[k-1] + 1;
		k++;
		for(j=0;j<i;j++){
			a[k]=a[k-1];
			k++;
		}
	}

	cin >> n;

	kotae = 0;

	for(ii=2;i<1000001;ii++){
		i = 0;
		while (n > 0) {
    			// iiで割り切れなければループを抜ける
			if (n % ii > 0) {
				break;
			}
			n = n / ii;
			i++;
		}
		kotae=kotae+a[i];
		if(ii*ii>n){
          break;
        }
	}
	if(n>1) kotae++;
	cout <<  kotae << endl; 
	return 0; 
}


Measured memory_bytes: 3600
# coding: utf-8
# Here your code !
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import numpy as np
import copy as cp
S = input()
T = input()
s = len(S)
t = len(T)

rst = []
for i in range(t) : 
    #１文字ずつ検索していく
    #検索範囲は iから(t - i)まで
    flag = False
    for j in reversed(range(i , s + i - t + 1)): 
        if (T[i] != S[j]) & (S[j] != "?") : continue
        else:
            #マッチしたら他の部分もあうか考える
            flag = True
            for k in range(t) : 
                if (T[k] == S[j - i + k]) | (S[j - i + k] == "?"): continue
                else : 
                    flag = False
                    break
            if flag : 
                #これでoKなのでブレイクしてあとはaで埋めます
                x = cp.deepcopy(S)
                for k in range(t) : 
                    if x[j - i + k] == "?" : x = x[ : (j-i+k)] + T[k] + x[(j -i +k + 1) : ]
                x = x.replace("?" , "a")
                rst.append(x)

              
if len(rst) != 0 : 
    
    print(min(rst))
else : 
    print("UNRESTORABLE")
    

Measured memory_bytes: 12516
package main

import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  var line, buffer []byte
  var isPrefix bool = true
  var err error
  for isPrefix {
    line, isPrefix, err = reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
  }
  return string(buffer)
}
func NextInt() int {
  var n int
  n, _ = strconv.Atoi(NextLine())
  return n
}
func NextIntVec() []int {
  L := strings.Split(NextLine(), " ")
  N := make([]int, len(L))
  for i := range N {
    N[i], _ = strconv.Atoi(L[i])
  }
  return N
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func Output() {
  _ = writer.Flush()
}

func Sort(A *[][]int) {
  N := len((*A))
  for i := 0; i < N - 1; i++ {
    for j := i + 1; j < N; j++ {
      if float64((*A)[i][1]) / float64((*A)[i][0]) < float64((*A)[j][1]) / float64((*A)[j][0]) {
        (*A)[i], (*A)[j] = (*A)[j], (*A)[i]
      }
    }
  }
}

func Exchange(A *[][]int, N int) int {
  ans := N
  if len((*A)) == 1 {
    k0 := N / (*A)[0][0]
    ans += (*A)[0][2] * k0
  }
  if len((*A)) == 2 {
    for k0 := 0; k0 <= N / (*A)[0][0]; k0++ {
      n := N - k0 * (*A)[0][0]
      k1 := n / (*A)[1][0]
      if ans < N + k0 * (*A)[0][2] + k1 * (*A)[1][2] {
        ans = N + k0 * (*A)[0][2] + k1 * (*A)[1][2]
      }
    }
  }
  if len((*A)) == 3 {
    for k0 := 0; k0 <= N / (*A)[0][0]; k0++ {
      n := N - k0 * (*A)[0][0]
      for k1 := 0; k1 <= n / (*A)[1][0]; k1++ {
        k2 := (n - k1 * (*A)[1][0]) / (*A)[2][0]
        if ans < N + k0 * (*A)[0][2] + k1 * (*A)[1][2] + k2 * (*A)[2][2] {
          ans = N + k0 * (*A)[0][2] + k1 * (*A)[1][2] + k2 * (*A)[2][2]
        }
      }
    }
  }
  return ans
}

func main() {
  N := NextInt()
  A := NextIntVec()
  B := NextIntVec()
  AB := make([][]int, 0)
  BA := make([][]int, 0)
  for i, _ := range A {
    if A[i] < B[i] { AB = append(AB, []int{A[i], B[i], B[i] - A[i]}) }
    if B[i] < A[i] { BA = append(BA, []int{B[i], A[i], A[i] - B[i]}) }
  }
  Sort(&AB)
  N = Exchange(&AB, N)
  Sort(&BA)
  N = Exchange(&BA, N)
  Write(N)
  Output()
}

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

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

  N = N % 500;
  if (N == 0) {
    cout << "Yes" << endl;
  }
  else {
    if ((A - N) >= 0) {
      cout << "Yes" << endl;
    }
    else {
      cout << "No" << endl;
    }
  }

}

Measured memory_bytes: 256
import java.util.*;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int A = sc.nextInt();
   int B = sc.nextInt();
   int C = sc.nextInt();
   boolean b = false;
   
   for(int i = 1;i<=B;i++)
   {
     if(i*A%B==C)
     {
       b = true;
       break;
     }
   }
   String ans;
   if(b) ans = "YES";
   else ans = "NO";
   System.out.println(ans);     
 }
}

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

//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
//typedef unsigned long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
typedef pair<int, int> P;
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<string> &s, string a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;

vector<pair<ll, int >> factorize(ll n) {
    vector<pair<ll, int >> res;

    for (ll i = 2; i * i <= n; i++) {
        if (n % i != 0) {
            continue;
        }
        res.emplace_back(i, 0);
        while (n % i == 0) {
            n /= i;
            res.back().second++;
        }
    }

    if (n != 1) res.emplace_back(n, 1);
    return res;

}

ll comb(ll l, ll r) {
    vector<ll> factors(50);
    for (ll j = l; j > (l - r); j--) {
        auto fs = factorize(j);
        for (auto f : fs) {
            factors[f.first] += f.second;
        }
    }

    for (ll j = 1; j <= r; j++) {
        auto fs = factorize(j);
        for (auto f : fs) {
            factors[f.first] -= f.second;
        }
    }

    ll s = 1;

    for (int j = 1; j < 50; j++) {
        for (int k = 0; k < factors[j]; k++) {
            s *= j;
        }
    }

    return s;

}


int main() {
    int n;


    cin >> n;
    int odd = 0, b2 = 0, b4 = 0;
    rep(i, n) {
        ll a;
        cin >> a;
        if (a % 4 == 0) b4++;
        else if (a % 2 == 0) b2++;
        else odd++;
    }
    if (odd > 0 && b2 >= 1) {
        odd++;
    }

    if (b4 == 0 && odd > 0) {
        cout << "No" << endl;
    } else if (odd - 1 > b4) {
        cout << "No" << endl;
    } else {
        cout << "Yes" << endl;
    }


}



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

namespace ABC142D
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputArr = Console.ReadLine().Split().Select(long.Parse).ToArray();
            //var inputInt = int.Parse(Console.ReadLine());

            long A = inputArr[0];
            long B = inputArr[1];

            //最大公約数の算出
            long gcd = GCD(A, B);

            //素因数分解
            List<long> prime = Primes(gcd);

            Console.WriteLine(prime.Distinct().Count() + 1);
            Console.ReadKey();
        }

        static long GCD(long A, long B)
        {
            long ans;
            if (B != 0) return ans = GCD(B, A % B);
            else return A;
        }

        static List<long> Primes(long A)
        {
            List<long> ans = new List<long>();

            long max = A;
            for(long i = 2; i * i <= max; i++)
            {
                if (A % i == 0)
                {
                    A /= i;
                    ans.Add(i);
                    i--;
                    continue;
                }
            }

            if (A != 1) ans.Add(A);
            return ans;
        }
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define rrep(i,a,b) for(int i=(a);i>=(b);--i)
#define PB push_back
typedef long long LL;
const LL P = 1e9+7;
const LL INF = 1e18;
const int N = 1e6+5;
const double pi = acos(-1);
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n, k;

void print(int i,int top,int diff){
	cout<<i-diff<<" "<<top-i-diff<<" "<<top-diff<<endl;
}

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin>>n>>k;
	if(n<k*2-1){
		cout<<"-1\n";
		return 0;
	}
	if(n%2==1){
		int k1 = n+1>>1;
		int top = k1 + 3 * n - 1;
		rep(i,n,n+k1-1){
			print(i,top,k1-k);
			top--;
		}
		rep(i,k1,n-1){
			print(i,top,k1-k);
			top--;
		}
	}else{
		int k1 = n>>1;
		int top = k1 + 3 * n - 1;
		rep(i,n,n+k1-1){
			print(i,top,k1-k);
			top--;
		}
		rep(i,k1+1,n-1){
			print(i,top,k1-k);
			top--;
		}
		cout<<k<<" "<<top-n-(k1-k)<<" "<<top-(k1-k)<<endl;
	}
	return 0;
}

Measured memory_bytes: 2304
#include <iostream>
#include <algorithm>
using namespace std;
int n,cl,a,st,ans;

int main(){
	cin>>n;
	for(int i=0;i<n;i++){
		if(i==0){
			cin>>a;
			cl=a;
			st=1;
		}else{
			cin>>a;
			if(a==cl){
				st++;
			}else{
				ans+=st/2;
				st=1;
				cl=a;
			}
		}
	}
	ans+=st/2;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
int mod = 1000000007;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
ll modpow(ll a, ll b, ll _mod) { return b ? modpow(a * a % _mod, b / 2, _mod) * (b % 2 ? a : 1) % _mod : 1; }
template<class T> ostream& operator << (ostream& os, const vector<T>& vec) { for (auto &vi: vec) os << vi << " "; return os; }
template<class T, class U> ostream& operator << (ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<typename T >inline istream& operator >> (istream& is, vector<T>& v) { rep(j, sz(v)) is >> v[j]; return is; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }


void solve();

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

    int T;
    // cin >> T;
    T = 1;

    while (T--) {
        solve();
    }
}

void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  cin >> a;
  rep(i, n) {
    if (a[i] % 2) continue;
    if (a[i] % 3 == 0 || a[i] % 5 == 0) continue;
    cout << "DENIED" << endl;
    return;
  }
  cout << "APPROVED" << endl;
}


Measured memory_bytes: 256
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

#define MP make_pair
#define PB push_back
#define ALL(x) (x).begin(),(x).end()
#define REP(i,n) for(int i=0;i<(n);i++)
#define REP1(i,n) for(int i=1;i<(n);i++)
#define REP2(i,d,n) for(int i=(d);i<(n);i++)
#define RREP(i,n) for(int i=(n);i>=0;i--)
#define CLR(a) memset((a),0,sizeof(a))
#define MCLR(a) memset((a),-1,sizeof(a))
#define RANGE(x,y,maxX,maxY) (0 <= (x) && 0 <= (y) && (x) < (maxX) && (y) < (maxY))

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI > VVI;
typedef vector<string> VS;
typedef vector<LL> VLL;
typedef pair<int,int> PII;

const int INF = 0x3f3f3f3f;
const LL INFL = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-9;

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


struct edge {
    LL to, cost;
    edge(LL _to, LL _cost) {to = _to; cost=_cost;}
};
typedef pair<LL, LL> P;

int score[100000];
vector<VI> G;

int main(){
    int N;
    cin >> N;
    REP(i, N){
        VI x;
        G.PB(x);
    }

    REP(i, N-1){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        G[a].PB(b);
        G[b].PB(a);
    }

    score[0] = 1;
    score[N-1] = -1;

    VI fs_move;
    fs_move.PB(0);
    fs_move.PB(N-1);
    while(!fs_move.empty()){
        VI next_move;
        REP(i, fs_move.size()){
            REP(j, G[fs_move[i]].size()){
                int idx = G[fs_move[i]][j];
                if(score[idx] != 0){
                    continue;
                }
                score[idx] = score[fs_move[i]];
                next_move.PB(idx);
            }
        }
        fs_move = next_move;
    }

    int ans = 0;
    REP(i, N){
        ans += score[i];
    }
    cout << (ans <= 0 ? "Snuke" : "Fennec") << endl;
}


Measured memory_bytes: 6768
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	long maxflow(long[][] cap) {
		int n = cap.length;
		int[][] flow = new int[n][n];
		long ret = 0;
		int s = n - 2;
		int t = n - 1;
		while (true) {
			int[] pre = new int[n];
			Arrays.fill(pre, -1);
			ArrayDeque<Integer> q = new ArrayDeque<>();
			q.add(s);
			out: while (!q.isEmpty()) {
				int v = q.pollFirst();
				for (int i = 0; i < n; ++i) {
					if (cap[v][i] - flow[v][i] <= 0 || pre[i] != -1 || i == s) {
						continue;
					}
					pre[i] = v;
					if (i == t)
						break out;
					q.addLast(i);
				}
			}
			if (pre[t] == -1)
				break;
			long inc = Long.MAX_VALUE / 3;
			for (int i = t; i != s; i = pre[i]) {
				inc = Math.min(inc, cap[pre[i]][i] - flow[pre[i]][i]);
			}
			for (int i = t; i != s; i = pre[i]) {
				flow[pre[i]][i] += inc;
				flow[i][pre[i]] -= inc;
			}
			ret += inc;
		}
		return ret;
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		long[] a = new long[n];
		long base = 0;
		for (int i = 0; i < n; ++i) {
			a[i] = sc.nextLong();
			if (a[i] > 0)
				base += a[i];
		}
		long[][] cap = new long[n + 2][n + 2];
		for (int i = 1; i <= n; ++i) {
			for (int j = 2 * i; j <= n; j += i) {
				cap[i - 1][j - 1] = Long.MAX_VALUE / 3;
			}
		}
		for (int i = 0; i < n; ++i) {
			if (a[i] >= 0) {
				cap[i][n + 1] = a[i];
			} else {
				cap[n][i] = -a[i];
			}
		}
		System.out.println(base - maxflow(cap));

	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

Measured memory_bytes: 23380
N, H = map(int, input().split())
A = []
B = []
for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
A.sort(reverse=True)
B.sort(reverse=True)

"""
a_max, a_max, ..., a_max, b, b, ..., b　となる

a_maxより強いbは強い順に投げておいて、まだ倒せなかったらa_maxを振ると考える
実際には計算された回数だけa_maxを振り、その後bを投げれば良い
"""

cnt = 0
a_max = max(A)

for b in B:
    if b < a_max:
        break
    H -= b
    cnt += 1
    if H <= 0:
        break

if H > 0:
    if H % a_max == 0:
        cnt += H // a_max
    else:
        cnt += H // a_max + 1

print(cnt)


Measured memory_bytes: 86816
/*
	submission # - User: herp_sy
	https://atcoder.jp/contests/

	coding: utf-8
	lang: C (GCC 5.4.1)
*/

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <stdbool.h>

#define _CRT_SECURE_NO_WARNINGS
#define TLong long long
#define TBMod 1000000007

int main(int argc, char const *argv[])
{
	TLong n, a[300002];
	TLong ans = 0;
	TLong c, d = 1;

	scanf("%lld", &n);
	for (int i = 0; i < n; ++i) scanf("%lld", &a[i]);

	for (int i = 0; i < 60; ++i) {
		c = 0;
		for (int j = 0; j < n; ++j) {
			if (a[j] & 1) ++c;
			a[j] >>= 1;
		}
		ans += (d * ((c * (n - c)) % TBMod)) % TBMod;
		d = (d << 1) % TBMod;
	}
	printf("%lld\n", ans % TBMod);
	return 0;
}


Measured memory_bytes: 2560
import java.io.*;
import java.math.BigInteger;
import java.util.*;
import java.util.Stack;
import java.util.regex.Pattern;

public class Main {
	
	public static class FastReader {
		BufferedReader br;
		StringTokenizer st;
		//it reads the data about the specified point and divide the data about it ,it is quite fast
		//than using direct 

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (Exception r) {
					r.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());//converts string to integer
		}

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

		long nextLong() {
			return Long.parseLong(next());
		}

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (Exception r) {
				r.printStackTrace();
			}
			return str;
		}
	}
	
	public static PrintWriter out = new PrintWriter (new BufferedOutputStream(System.out));
	static long mod = (long) (1e9+7);
	static int N = (int) 1e5;
//	Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		 FastReader sc = new FastReader();

		 long a = sc.nextLong(),b=sc.nextLong(),c=sc.nextLong(),k=sc.nextLong();
		 if(k%2 == 0)out.print(a-b);
		 else out.print(b-a);
		 out.close();
	}
}

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

int main() {
       long int n;
       cin>>n;
       long long int a[n];
       for(long int i=0;i<n;i++)
       cin>>a[i];
       sort(a,a+n,greater<long long int>());
       long int temp=1;
       long long int ans=a[0];
       for(long int i=1;i<n && (n-1-temp)>0;i++)
       {
           if(n-1-temp>=2)
           {
               ans+=2*a[i];
               temp+=2;
           }
           else
           {
               ans+=a[i];
               break ;
           }
       }
       cout<<ans;
	// your code goes here
	return 0;
}


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

int main() {
	int N; cin >> N;
	int a[100010], b[100010];
	for(int i=0; i<N; ++i){
	    cin >> a[i];
	    b[i+1]=0;
	}
	int S=0;
	for(int i=0; i<N; ++i){
	    if(a[i]>N) ++S;
	    else ++b[a[i]];
	}
	for(int i=1; i<=N; ++i){
	    if(b[i]>=i) S += b[i]-i;
	    else S += b[i];
	}
	cout << S << endl;
	return 0;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String args[]) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		char[] c = br.readLine().toCharArray();
		char[] rev = new char[c.length];
		
		for(int i=c.length-1, j=0;i>=0;i--,j++){
			rev[j]=c[i];
		}
		
		System.out.println(String.valueOf(rev));
	}
}

Measured memory_bytes: 15020
#include<stdio.h>
int main(){
	int a,b;
	scanf("%d %d",&a,&b);
		if(a<b){printf("a < b\n");
	}else if(a>b){printf("a > b\n");
	}else if(a==b){printf("a == b\n");}
	
	return 0;
}

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


typedef long long ll;
ll t,i,j,n,k,x,y,a,b;
string s,s1,s2;
int main()
{
   ll d,s,t;
   cin>>d>>t>>s;
   if(((float)d/s) <=t)
   cout<<"Yes";
   else
   cout<<"No";
   
   
   
   return 0;
    
}

Measured memory_bytes: 3632
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <cmath>
#include <iomanip>
#define rep(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

int main() {
    int N;
    cin >> N;
    vector<int> x(N);
    rep(i, N) {
        cin >> x[i];
        --x[i];
    }
    vector<int> a(N * N, -1), b(N * N, -1);
    rep(i, N) {
        a[x[i]] = i;
        b[x[i]] = i;
    }
    rep(i, N * N) {
        if (a[i] == -1) continue;
        int now = 0;
        rep(j, a[i]) {
            while (b[now] != -1) ++now;
            if (now > i) {
                cout << "No\n";
                return 0;
            }
            b[now] = a[i];
        }
    }
    for (int i = N * N - 1; i >= 0; --i) {
        if (a[i] == -1) continue;
        int now = N * N - 1;
        rep(j, N - 1 - a[i]) {
            while (b[now] != -1) --now;
            if (now < i) {
                cout << "No\n";
                return 0;
            }
            b[now] = a[i];
        }
    }
    cout << "Yes\n";
    rep(i, N * N) cout << b[i] + 1 << "\n";
    return 0;
}


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

using namespace std;

#define ll long long
#define endl '\n'
const int N = 1e6 + 5;
ll a[N];
int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(0);
        if (fopen("BONUS.INP", "r")){
                freopen("BONUS.INP", "r", stdin);
                freopen("BONUS.OUT", "w", stdout);
        }
        ll t;
        cin >> t;
        while (t--){
                ll n;
                cin >> n;
                for (int i = 0; i < n; i++){
                        cin >> a[i];
                }
                string s;
                cin >> s;
                vector<ll> now;
                bool flag = true;
                for (int i = n - 1; i >= 0; i--){
                        for (auto j : now) a[i] = min(a[i], a[i] ^ j);
                        now.push_back(a[i]);
                        if (s[i] == '1' && a[i]){
                                flag = false;
                                break;
                        }
                }
                if (flag) cout << 0 << endl;
                else cout << 1 << endl;
        }
}


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

using namespace std;

#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 rep3(i,n) for(int i=0;i<=(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
#define INF 1e9  //
#define INFLL 4e18  //
#define MOD (1e9)+7
#define MP make_pair
#define PB(a) push_back(a)
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl

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

// a 0x61  z 0x7a  0 0x30

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

int main() {
    int n, k, x, y;
    cin >> n >> k >> x >> y;
    if (n <= k) cout << n * x << endl;
    else cout << x * k + (n - k) * y << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main() {
  char ch[250]={0};
  char a[250] ={0};
  int h;
  int i,j,k,l,n,m;
 
 
  while(1){
    i=0;
    while(1){
       
      scanf("%c",&ch[i]);
      if(ch[i] == '\n') {    
    break;
      }
       
      i++;
    }
    
    if ( i == 1 && ch[0] == '-' ) break;
 
    //  printf("%d",i);
     
    scanf("%d",&m);
     
    for(j=0;j<m;j++){
      scanf("%d", &h );
       
      for(k=0;k<i-h;k++) {
    a[k] = ch[h+k];
    //    printf("a[%d] = ch[%d]の%c\n",k ,h+k,ch[h+k]);
      }
      for(k=0;k<h;k++){
    a[i-h+k] = ch[k];
    //   printf("a[%d] = ch[%d]の%c\n",i-h+k,k,ch[k]);
      }
      for(k=0; k<i; k++){
    ch[k] = a[k];
    // printf("ch[%d] = a[%d]の%c\n",k,k,a[k]);
      }
    }
    for(k=0;k<i;k++) {
      printf("%c",ch[k]);
    }
    printf("\n");
      scanf("%c",&ch[0]);
  }
   
   
  return 0;
   
}


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

#define int long long
#define rep(i, a, n) for (int i = a; i < n; i++)
#define pb push_back
#define eb emplace_back
#define dump(x) cout << #x << " = " << (x) << endl
#define chk() cout << "now" << endl;
#define ALL(x) (x).begin(), (x).end()
#define SORT(c) sort((c).begin(), (c).end())
#define SORTG(c) sort(ALL(c), greater<int>());
#define fi first
#define se second
int INF = 1e9 + 7;

typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vector<int>> mat;

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

void solve() {
  double A, B, H, M;
  cin >> A >> B >> H >> M;

  const double PI = acos(-1);

  double argA = (H * 60 + M) * 2 * PI / (12 * 60);
  double argB = M * 2 * PI / 60;

  double argDiff = abs(argA - argB);
  if (argDiff > 180) {
    argDiff = argDiff - 180;
  }

  double ret = sqrt(A * A + B * B - 2 * A * B * cos(argDiff));
  cout << ret << endl;
}

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

  cout << fixed << setprecision(10);

  solve();

  return 0;
}


Measured memory_bytes: 4240
from collections import OrderedDict


def main():
    n = int(input())
    ans_dict = OrderedDict({
        'AC': 0,
        'WA': 0,
        'TLE': 0,
        'RE': 0,
    })
    for idx in range(n):
        s = input().strip('\n')
        ans_dict[s] += 1

    for k, v in ans_dict.items():
        print(f'{k} x {v}')


if __name__ == "__main__":
    main()


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

//https://atcoder.jp/contests/abc142/tasks/abc142_e

const int mm = 1e3, infty = 1e9;

int n, m;
int dp[4096];
pair<int, int> key[mm];

int main() {
	cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		int a, b, c, d = 0;
		cin >> a >> b;
		for (int j = 0; j < b; ++j) {
			cin >> c;
			d |= 1 << c - 1;
		}
		key[i] = make_pair(a, d);
	}

	fill(dp + 1, dp + 4096, infty);

	for (int i = 0; i < m; ++i)
		for (int j = 0; j < 4095; ++j)
			dp[j | key[i].second] = min(dp[j | key[i].second],
					dp[j] + key[i].first);

	cout << (dp[(1 << n) - 1] < infty ? dp[(1 << n) - 1] : -1) << endl;

}


Measured memory_bytes: 3656
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;

int N, A[1 << 18], R[1 << 18];
pair<int, int> T[1 << 18];
map<int, int> Map;

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) cin >> T[i].second;
	for (int i = 0; i < N; i++) cin >> T[i].first;
	sort(T, T + N);
	for (int i = 0; i < N; i++) A[i] = T[i].second;
	sort(A, A + N);

	// ステップ 1.
	for (int i = 0; i < N; i++) {
		if (A[i] > T[i].first) { cout << "No" << endl; return 0; }
	}

	// ステップ 2.
	for (int i = 0; i < N - 1; i++) {
		swap(A[i], A[i + 1]); bool flag = false;
		if (A[i] > T[i].first) flag = true;
		if (A[i + 1] > T[i + 1].first) flag = true;
		if (flag == false) { cout << "Yes" << endl; return 0; }
		swap(A[i], A[i + 1]);
	}

	// ステップ 3.
	for (int i = 0; i < N; i++) {
		int pos1 = lower_bound(A, A + N, T[i].second) - A;
		pos1 += Map[A[i]];
		R[i] = pos1; Map[A[i]]++;
	}

	int cnt = 0, cx = 0;
	while (true) {
		cx = R[cx]; cnt++;
		if (cx == 0) break;
	}
	if (cnt != N) { cout << "Yes" << endl; }
	else { cout << "No" << endl; }
	return 0;
}

Measured memory_bytes: 7680
#include<stdio.h>

int main(void)
{
	int l[10],x[2];
	int s,i;
	double t;

	while(scanf("%d",&l[0])!=EOF)
	{
		s=l[0];
		for(i=1;i<10;i++){
			scanf(",%d",&l[i]);
			s+=l[i];
		}
		scanf(",%d,%d",&x[0],&x[1]);

		t=s*x[0]/(x[0]+x[1]);
		for(i=0;i<10;i++){
			t-=l[i];
			if(t<=0){
				printf("%d\n",i+1);
				break;
			}
		}

	}
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
#include<cstring>
#include<stdio.h>
#include<cstring>
#include<math.h>
using namespace std;
int main()
{
	string a,b;
	int minn=30000;
	cin>>a>>b;
	int maxn=0;
	int x=a.size();
	int y=b.size();
	for(int i=0;i<=x-y;i++)
	{
		int sum=0;
		for(int j=0;j<y;j++)
		{
			if(a[j+i]==b[j])sum++;
		}
		maxn=max(maxn,sum);
	}
	cout<<b.size()-maxn;
}

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

#define ii pair<int, int>
#define lli long long int
#define ll pair<lli, lli>
#define pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

int main() {
	string s, t;
	cin >> s >> t;
	cout << t << s << "\n";
	return 0;
}

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

#define ll long long 
#define int ll
#define endl "\n"

vector <int> lunlun;
int n;
int to_num(string number){
	int temp = 1;
	int ans = 0;
	
	for (int i=number.size()-1; i>=0; i--){
		ans += (number[i] - '0')*temp;
		temp *= 10;
	}
	
	return ans;
}

void generate(string now){
	if (now.size() == 11) return;
	lunlun.push_back(to_num(now));
	
	char this_ = now[(int)now.size()-1];
	if (this_ != '0'){
		this_--;
		generate(now + this_);
		this_++;
	}	
	
	if (this_ != '9'){
		this_++;
		generate(now + this_);
		this_--;
	} 
	
	generate(now + this_);
}

signed main(){
	
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	
	for (int i=1; i<10; i++){
		generate(to_string(i));
	}
	sort(lunlun.begin(), lunlun.end());
	

	cin >> n;
//	for (int i=0; i<n; i++){
//		cout << lunlun[i] << endl;
//	}
	
	cout << lunlun[n-1] << endl;
	
	return 0;
}

Measured memory_bytes: 5340
#[test]
fn check_solve() {
   println!("input:\n1 2 10 20 15 200\n\noutput:\n{}", solve("1 2 10 20 15 200\n"));
   println!("input:\n1 2 1 2 100 1000\n\noutput:\n{}", solve("1 2 1 2 100 1000\n"));
   println!("input:\n17 19 22 26 55 2802\n\noutput:\n{}", solve("17 19 22 26 55 2802\n"));
}

fn solve(src: &str) -> String {
    let mut sc = Scanner::from_str(src);

    let a: usize = sc.read();
    let b: usize = sc.read();
    let c: usize = sc.read();
    let d: usize = sc.read();
    let e: usize = sc.read();
    let f: usize = sc.read();

    let mut wat = Vec::new();
    let mut sug = Vec::new();
    for i in 0..f {
        for j in 0..f {
            let w = 100*a*i + 100*b*j;
            let s = c*i + d*j;
            if w <= f {
                wat.push(w);
            }
            if s <= f{
                sug.push(s);
            }
        }
    }
    
    let mut ans = (100*a, 0);
    let mut con = 0.;
    for &w in &wat {
        for &s in &sug {
            if w + s > f || s > w / 100 * e {
                continue;
            }
            let c = s as f64 / (w + s) as f64;
            if c > con {
                con = c;
                ans = (w + s, s);
            }
        }
    }
    format!("{} {}\n", ans.0, ans.1)
}
fn main() {
    let mut buf = String::new();
    use std::io::{Read, Write};
    std::io::stdin().read_to_string(&mut buf).unwrap();
    std::io::stdout().write_all(solve(&buf).as_bytes()).unwrap();
}
struct Scanner<'a>(std::str::SplitWhitespace<'a>);
impl<'a> Scanner<'a> {
    fn from_str(src: &str) -> Scanner {
        Scanner(src.split_whitespace())
    }
    fn get(&mut self) -> &str {
        self.0.next().unwrap()
    }
    fn read<T: std::str::FromStr>(&mut self) -> T {
        self.get().parse().ok().unwrap()
    }
}

Measured memory_bytes: 6396
n, k = map(int, input().split())
mod = MOD = 10**9 + 7

G = [0] + [pow(k//i, n, mod) for i in range(1,k+1)]
for i in range(k, 0, -1):
  for j in range(2, k//i+1):
    G[i] -= G[j*i]

print(sum([i*f for i,f in enumerate(G)]) % mod)

Measured memory_bytes: 15172
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))

    if sum(A) < sum(B):
        return -1

    C = [a-b for a,b in zip(A,B)]
    plus = [x for x in C if x > 0]
    minus = [x for x in C if x < 0]
    change = sum(minus)
    count = 0
    if change == 0:
        return 0

    for i in sorted(plus,reverse=True):
        if change >= 0:
            break
        change += i
        count += 1
    return count + len(minus)

print(solve())

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

using namespace std;
using ll = long long;
using Lll = list<ll>;
using Vll = vector<ll>;

#define rep(a,x,i,f) for(ll a = i; a < f; a+=x )
#define repR(a,x,i,f) for(ll a = i; a > f; a-=x )

ll ms = 1123456789;

ll frog(Vll& s, Vll& ci, int cur,int k)
{
  ll p,min = ms;

  if(cur < 2)
  {
    return ci[cur];
  }

  rep(i,1,1,k+1)
  {
    if(cur - i < 0) break;
    p = abs(s[cur] - s[cur-i]) + (ci[cur-i] != -1 ? ci[cur-i] : frog(s,ci,cur-i,k));
    min = p < min ? p : min;
  }
  
  ci[cur] = min;

  return ci[cur];
}

int main() 
{
  ll n,m,k,p,min;
  cin >> n >> k;
  Vll s(n);
  Vll ci(n,-1);

  rep(i,1,0,n)
    cin >> s[i];

  ci[0] = 0;
  ci[1] = abs(s[0] - s[1]);

  rep(i,1,2,n)
  {
    min = ms;
    rep(j,1,1,k+1)
    {
      if(i - j < 0) break;
      p = ci[i-j] + abs(s[i] - s[i-j]);
      min = p < min ? p : min;
    }
    
    ci[i] = min;
  }

  cout << ci[n-1] << endl;
}


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

using ll = long long int;

const int MAX = (int)(1e5 + 5);
const ll INF = (ll)(1e10 + 5);

const int MAX_N = (int)(1e4 + 5);

int n;

ll a[MAX_N], b[MAX_N];

int main(void) {
  // Here your code !
  scanf("%d", &n);

  for (int i = 0; i < n; ++i) {
    scanf("%lld", &(a[i]));
  }

  for (int i = 0; i < n; ++i) {
    scanf("%lld", &(b[i]));
  }

  ll bank_a = 0LL;
  ll bank_b = 0LL;

  for (int i = 0; i < n; ++i) {
    ll diff = a[i] - b[i];

    // printf("diff: %lld\n", diff);

    if (diff == 0LL) continue;

    if (diff < 0LL) {
      ll need_a = abs(diff / 2LL);

      ll use_a = min(bank_a, need_a);

      bank_a -= use_a;

      bank_b += need_a - use_a;
    } else {
      ll need_b = diff;

      ll use_b = min(bank_b, need_b);

      bank_b -= use_b;

      bank_a += need_b - use_b;
    }
  }

  // printf("bank_a: %lld, bank_b: %lld\n", bank_a, bank_b);

  string ans = (bank_a * 2 <= bank_b) ? "Yes" : "No";

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 384
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;
const double PI=2*asin(1);

int main() {
  int N, M;
  cin>>N>>M;
  int K;
  vector<vector<int> > L(N);
  map<int, vector<int> > amap;
  int tmp;
  for(int i=0;i<N;++i){
    cin>>K;
    for(int j=0;j<K;++j){
      cin>>tmp;
      L[i].push_back(tmp);
      amap[tmp].push_back(i);
    }
  }
  map<int, int> bmap;
  map<int, int> cmap;
  vector<int> ansarr;
  ansarr.push_back(0);
  bmap[0]++;
  queue<int> que;
  que.push(0);
  int state;
  while(!que.empty()){
    state = que.front();que.pop();
    for(int i=0;i<L[state].size();++i){
      if(cmap[L[state][i]]>0) continue;
      cmap[L[state][i]]++;
      for(int j=0;j<amap[L[state][i]].size();++j){
        if(bmap[amap[L[state][i]][j]]>0) continue;
        ansarr.push_back(amap[L[state][i]][j]);
        que.push(amap[L[state][i]][j]);
        bmap[amap[L[state][i]][j]]++;
      }
    }
  }
  if(ansarr.size()==N) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}



Measured memory_bytes: 13816
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC089B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var S = Console.ReadLine().Split();

            bool ans = false;//3
            for(int i = 0; i < S.Count(); i++)
            {
                if (S[i] == "Y") ans = true;
            }

            if (ans == true) Console.WriteLine("Four");
            else Console.WriteLine("Three");
            Console.ReadKey();
        }
    }
}


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

int N, M, Q;
vi a(50), b(50), c(50), d(50);

int point(vi &A){
  //配列Aのポイントを返す
  int point = 0;
  for(int i=0; i<Q; i++){
    if(A[b[i]]-A[a[i]]==c[i])point+=d[i];
  }
  return point;
}

int dfs(){
  //最大ポイントを返す
  int ans = 0;
  vector<vi> uncalced;//発見したけど計算してない配列の情報

  uncalced.push_back({});

  while(!uncalced.empty()){
    vi current = uncalced.back();//最後尾を読む
    //for(int x: current)cout<<x<<",";cout<<endl;
    uncalced.pop_back();
    //いずれにせよcurrentについての操作はもうしないので捨てる
    if(current.size()==N){
      //N桁になってたら
      //ポイント求めて
      //最大値更新
      ans = max(ans, point(current));
    }else{
      //短かったら伸ばしたのを積む
      int last = (current.empty()? 1: current.back());
      //空になったところに0を積まれると0,0,0,...ができてしまう
      //空になってここの処理に来るのは一番最初{}を引っこ抜いたとき
      for(int i=M; i>=last; i--){
        //currentにiをくっつけて積む
        vi next = current;
        next.push_back(i);
        uncalced.push_back(next);
      }
    }
  }
  
  return ans;
}

int main(){
    cin>>N>>M>>Q;
  for(int i=0; i<Q; i++){
    cin>>a[i]>>b[i]>>c[i]>>d[i];
    a[i]--;
    b[i]--;
  }

  int ans = dfs();

  cout<<ans<<endl;
}

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

int main(){

	int d[11];
	for(int i = 0;i < 10;i++)cin >> d[i];
	sort(d,d+10);
	cout << d[7]+d[8]+d[9] << " ";
	for(int i = 0;i < 10;i++)cin >> d[i];
	sort(d,d+10);
	cout << d[7]+d[8]+d[9] << endl;

	return 0;
}


Measured memory_bytes: 1180
#include<stdio.h>
 
int main(){
  int box[55555]={},a[55],i,j,n,cnt=0;
  scanf("%d",&n);
  for(i=2;i<55555;i++)box[i]=1;
  for(i=2;i<55555;i++){
    if(box[i]){
      if(i%10==1) a[cnt++]=i;
      for(j=i;j<55555;j+=i) box[j]=0;
    }
    if(cnt==n) break;
  }
  for(i=0;i<n;i++){
    printf("%d ",a[i]);
  }
  printf("\n");
}

Measured memory_bytes: 384
def judge(n,a):
    table = {}
    for i in range(n):
        if a[i] in table.keys():
            print('NO')
            return
        else:
            table[a[i]] = 1
    print('YES')
    return
    
n = int(input())
a = list(map(int,input().split()))

judge(n,a)

Measured memory_bytes: 35172