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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define show(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define show(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<62;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    ll n,p,q;
    cin >> n >> p >> q;

    vector<ll> c(n);
    ll sum=0;
    vector<ll> v;
    rep(i,0,n){
        cin >> c[i];
        sum+=c[i];
        v.push_back(-c[i]+p*(q-i));
    }
    sort(v.rbegin(),v.rend());

    ll ans=sum;
    rep(i,0,n){
        sum+=v[i];
        sum+=2*p*i;
        ans=max(ans,sum);
    }
    cout << ans << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}

Measured memory_bytes: 11028
n = int(input())
a = []
s = []

for i in range(n):
    x = int(input())
    a.append(x * n + i)
    s.append(1)

a.sort()
a.reverse()
a.append(-1)
Sum = 0

Have = True

result = []

for i in range(n - 1):
    l = 0
    r = n

    val = (a[i] // n) + s[i] + s[i] - n

    while (l < r):
        m = (l + r + 2) // 2

        if (a[m] >= val * n):
            l = m
        else:
            r = m - 1

    if((a[l] // n) != val):
        Have = False
        break

    s[l] += s[i]
    Sum  += s[i]
    result.append([a[i] % n,a[l] % n])

if (Sum != (a[n - 1] // n)):
    Have = False

if (Have == False):
    print("-1")
else:
    for e in result:
        print(e[0] + 1,end = " ")
        print(e[1] + 1)


Measured memory_bytes: 29728
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

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

const int MAX_V = 330;
int V;

long long dist[MAX_V][MAX_V];

void init_dist() {
  for (int i = 0; i < MAX_V; ++i) {
    for (int j = 0; j < MAX_V; ++j) {
      if (i == j) {
        dist[i][j] = 0;
      } else {
        dist[i][j] = INF;
      }
    }
  }
}

void warshall_floyd() {
  // 1-indexed
  for (int k = 1; k <= V; ++k) {
    for (int i = 1; i <= V; ++i) {
      for (int j = 1; j <= V; ++j) {
        dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
      }
    }
  }
}

int N;
ll A[330][330];

int main() {
  cin >> N;
  V = N;
  init_dist();

  repe(i, 1, N) {
    repe(j, 1, N) {
      cin >> A[i][j];
      dist[i][j] = A[i][j];
    }
  }

  warshall_floyd();

  ll ans = 0;
  repe(i, 1, N) {
    repe(j, 1, N) {
      ll dd = INF;
      repe(k, 1, N) {
        if (k == i || k == j) continue;

        chmin(dd, dist[i][k] + dist[k][j]);
      }

      if (dd < A[i][j]) {
        cout << -1 << endl;
        return 0;
      }

      if (dd > A[i][j]) {
        ans += A[i][j];
      }
    }
  }

  cout << ans / 2 << endl;
}


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

using namespace std;
using ll = long long int;

ll attack_count(ll H){
    if (H == 1){
        return 1;
    }else{
        return attack_count(H / 2) * 2 + 1;
    }
}

int main() {
    ll H;
    cin >> H;
    cout << attack_count(H) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void)
{
	int a,b=0;
	for (int c=0;c<4;c++){
		cin>>a;
		b=b+a;
	}
	int c=0;
	for (int d=0;d<4;d++){
		cin>>a;
		c=c+a;
	}
	if (c>b) cout<<c<<endl;
	else cout<<b<<endl;
	return 0;
}

Measured memory_bytes: 3096
#include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using VI = vector<int>;

int main(){
  int n;cin >> n;
  vector<int> a(n);
  for(auto &i:a) cin >> i;
  sort(a.begin(),a.end());
  cout << a.back()-a[0] << endl;
  return 0;
}


Measured memory_bytes: 256
fn main() {
    let s = {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        s.trim_right().to_owned()
    };

    match &*s {
        "Sunny" => println!("Cloudy"),
        "Cloudy" => println!("Rainy"),
        "Rainy" => println!("Sunny"),
        _ => (),
    }
}


Measured memory_bytes: 4352
EASY_ODD_STR = %w[R U D].freeze
EASY_EVEN_STR = %w[L U D].freeze

s = gets.chomp

result = []
s.each_char.with_index(1){|c, index|
  if index.odd?
    result << c unless EASY_ODD_STR.include?(c)
    next
  else
    result << c  unless EASY_EVEN_STR.include?(c)
    next
  end
}

if result.empty?
   puts 'Yes'
else
  puts 'No'
end

Measured memory_bytes: 1788
import std.stdio, std.conv, std.string, std.algorithm.comparison, std.algorithm.searching, std.algorithm.sorting, std.algorithm.iteration, std.math, std.random, std.range;

void main()
{
    int N = readln().strip.to!(int);
    int[] input = readln().split.to!(int[]);
    int T = input[0];
    int A = input[1];
    auto HList = readln().strip.split.to!(int[]);
    double g = (T-A)/0.006;
    int index = -1;
    double v = double.max;
    foreach(i,h; HList.map!(a=>abs(a-g)).enumerate(1))
    {
        if(h < v)
        {
            index = i;
            v = h;
        }
    }
    writeln(index);
}

Measured memory_bytes: 2300
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();

		String relation;

		if(a > b){
			relation = ">";
		}else if(a < b){
			relation = "<";
		}else{
			relation = "==";
		}

		System.out.printf("a %s b\n", relation);
	}
}


Measured memory_bytes: 26204
#create date: 2020-03-28 21:26

import sys
stdin = sys.stdin
import bisect

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    x, y, a, b, c = na()
    p = na()
    q = na()
    r = na()
    p.sort(reverse=True)
    q.sort(reverse=True)
    l = p[:x]
    l += q[:y]
    l += r
    l.sort(reverse=True)
    ans = sum(l[:(x+y)])
    print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 23272
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <numeric>
#include <vector>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<P,int> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-8;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

int n;

int main(){
	cin>>n;
	ll t=0,s=0;
	for(int i=0;i<n;i++){
		ll x;
		cin>>x;
		(t+=x*x%mod*(mod-1))%=mod;
		(s+=x)%=mod;
	}
	cout<<(t+s*s)%mod*(mod/2+1)%mod<<endl;
}

Measured memory_bytes: 3608
N,T=map(int,input().split())
t=input().split()
a=[int(b) for b in t]
time=0
for c in range(N-1):
    if a[c+1]-a[c]>=T:
        time+=T
    else:
        time+=a[c+1]-a[c]
time+=T
print(time)


Measured memory_bytes: 25196
//vec[i]の範囲外エラー表示
#define _GLIBCXX_DEBUG
//includeとusing
#include <bits/stdc++.h>
using namespace std;
//型名省略
using ll = long long;
using st = string;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vs = vector<string>;
using pll = pair<ll, ll>;
using pcc = pair<char, char>;
//定数
const ll INF = 1e9;
const ll MOD = 1e9+7;
const vl dx = {1,0,-1,0,1,0,-1,0};
const vl dy = {0,1,0,-1,0,1,0,-1};
//マクロ
#define rep(i,n) for(ll i = 0; i < (ll) n; i++)
#define rrep(i,n) for(ll i = (ll) n - 1; i >= 0;i--)
#define REP(i,x,n) for(ll i = (ll) x; i < (ll) n; i++)
#define RREP(i,x,n) for(ll i = (ll) n - 1; i >= x; i--)
#define each(i,A) for(ll i: (vl) A)
#define all(A) A.begin(), A.end()
#define Size(A) ll(A.size())
//入力
template<typename T> T input() {T x; cin >> x; return x;}
//正誤判定
void Yes(bool ans){cout << (ans? "Yes" : "No") << endl;}
void YES(bool ans){cout << (ans? "YES" : "NO") << endl;}
//余り切り上げ
ll ceil(ll a,ll b) {return (a + b - 1) / b;}
//最大値・最小値
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;}
//最大公約数
ll gcd(ll a,ll b){if(a<b)swap(a,b); if(a%b==0)return b; return gcd(b,a%b);}
//最小公倍数
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
//n乗の余り
ll modPow(ll x,ll n,ll mod){if(n==0)return 1; if(n%2==0)return modPow(x*x,n/2,mod)%mod; return x%mod*modPow(x,n-1,mod)%mod;}


/*--------------------------------------------------------------------------*/

//main関数
int main() {
    st s; cin >> s;
    Yes(s[2] == s[3] && s[4] == s[5]);
}



Measured memory_bytes: 3640
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        System.out.println((int)Math.pow(N,3));
    }
}

// cool function

//     public static boolean isPrime(int n) {
//        return !new String(new char[n]).matches(".?|(..+?)\\1+");
//    }


Measured memory_bytes: 22484
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

int n, m;
int A[8][8]={};

int loop(int ind, vector<int> used){
  int flag=0;
  for(int i=1;i<n;i++){
    if (used[i]==0){
      flag=1;
      break;
    }
  }
  if (flag == 0){
    return 1;
  }
  int ans=0;
  for(int i=1;i<n;i++){
    if(used[i]==1) continue;
    if(A[ind][i]==1){
      used[i]=1;
      ans+=loop(i, used);
      used[i]=0;
    }
  }
  return ans;
}

int main(){
  cin >> n >> m;
  for(int i=0;i<m;i++){
    int a, b;
    cin >> a >> b;
    A[a-1][b-1]=A[b-1][a-1]=1;
  }
  int ans=0;
  vector<int> used(n, 0);
  used[0]=1;
  for(int i=1;i<n;i++){
    if (A[0][i] == 1){
      used[i]=1;
      ans += loop(i, used);
      used[i]=0;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
/*
AIZU ONLINE JUDGE ??????
How Many Ways?
---------------------------------------------------------------------*/

/*??????????????????*/
#include<iostream>
using namespace std;

/*???????????¢??°*/
int main(){
	
	/*?????°?????????*/
	int n,x;
	
	while(1){
	
		cin>>n>>x;
		if(n==0&&x==0)break;
		int count=0;
	
		/*??????????????????*/
		for(int i=1;i<=n-2;i++){
		
			for(int j=i+1;j<=n-1;j++){
			
				for(int k=j+1;k<=n;k++){
				
					if(i+j+k==x){if(i!=j&&j!=k&&k!=i)count+=1;}
				
				}
			}
		}
		
		cout<<count<<"\n";
		
	}
	
	return 0;
	
}	

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

void chmin(int &x, int y) {
  x = min(x, y);
}

int popcount(int x) {
  int res = 0;
  while (x > 0) {
    res++;
    x &= x - 1;
  }
  return res;
}

int main() {
  int N; cin >> N;
  vector<int> A(N); rep(i, N) cin >> A[i];
  vector<int> B(N); rep(i, N) cin >> B[i];
  vector<vector<int>> dp(1 << N, vector<int>(N, INT_MAX));
  dp[0][0] = 0;
  auto f = [&](int i, int j) {
    return abs(j - i) % 2 == 0 ? A[i] : B[i];
  };
  rep(i, 1 << N) rep(j, N) if (dp[i][j] != INT_MAX) {
    int pos = popcount(i);
    rep(k, N) if (~i >> k & 1) {
      int cost = 0;
      rep(l, N) if ((i >> l & 1) and k < l) cost++;
      if (i == 0 or f(j, pos - 1) <= f(k, pos)) {
        chmin(dp[i | 1 << k][k], dp[i][j] + cost);
      }
    }
  }
  int ans = INT_MAX;
  rep(j, N) chmin(ans, dp[(1 << N) - 1][j]);
  if (ans == INT_MAX) ans = -1;
  cout << ans << endl;
}

Measured memory_bytes: 26880
#include <iostream>
#include <bitset>
#include <fstream>
#include <string>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
//#include <boost/multiprecision/cpp_int.hpp>

const double EPS = (1e-10);


using namespace std;
using Int = long long;
//using namespace boost::multiprecision;

const Int MOD = 1000000007;

Int mod_pow(Int x, Int n){
    Int res = 1;
    for(int i = 0;i < 60; i++){
        if(n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

Int gcd(Int a, Int b) {
    return b != 0 ? gcd(b, a % b) : a;
}
Int lcm(Int a, Int b) {
    return a * b / gcd(a, b);
}
// a x + b y = gcd(a, b)
Int extgcd(Int a, Int b, Int &x, Int &y) {
    Int g = a; x = 1; y = 0;
    if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
    return g;
}


int main(){
    cin.tie(0);
    int N;
    cin >> N;
    cout << (N%2?N*2:N) << endl;
    return 0;
} 


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((lint)(x).size())
#define POW2(n) (1LL << (n))
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)

int main() {
    int n, d;
    cin >> n >> d;
    
    if ((n % (2 * d + 1)) == 0) {
        cout << n / (2 * d + 1) << endl;
    } else {
        cout << (n / (2 * d + 1)) + 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.nextLine();
	    	    char[] ch = S.toCharArray();
	    	    
	    for(char test:ch){
	    if(Character.isUpperCase(test)) 
          System.out.print(Character.toLowerCase(test));
	    else System.out.print(Character.toUpperCase(test));
	    }
	    System.out.println();
	  }
}



Measured memory_bytes: 26880
package main

import (
	"bufio"
	"fmt"
	basicIO "io"
	"os"
	"strconv"
)

func main() {
	protagonist(os.Stdin, os.Stdout)
}

func protagonist(r basicIO.Reader, w basicIO.Writer) {
	io := NewIO(r, w)
	//	S := io.nextString()
	var S string
	fmt.Scan(&S)

	turnF1 := 0
	//1010101010101
	for i, v := range S {
		if i%2 == 0 {
			if v != '1' {
				turnF1++
			}
		} else {
			if v != '0' {
				turnF1++
			}
		}
	}

	//0101010101010
	turnF0 := 0
	for i, v := range S {
		if i%2 == 0 {
			if v != '0' {
				turnF0++
			}
		} else {
			if v != '1' {
				turnF0++
			}
		}
	}

	min := turnF1
	if turnF1 > turnF0 {
		min = turnF0
	}
	io.PutInt(min)
}

type IO struct {
	Scanner *bufio.Scanner
	Writer  basicIO.Writer
}

func NewIO(r basicIO.Reader, w basicIO.Writer) *IO {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	return &IO{
		Scanner: s,
		Writer:  w,
	}
}

func (io *IO) nextString() string {
	io.Scanner.Scan()
	return io.Scanner.Text()
}

func (io *IO) nextInt() (int, error) {
	io.Scanner.Scan()
	i, err := strconv.Atoi(io.Scanner.Text())
	return i, err
}

func (io *IO) PutInt(v int) {
	fmt.Fprintf(io.Writer, "%d\n", v)
}

func (io *IO) PutString(s string) {
	fmt.Fprintf(io.Writer, "%s\n", s)
}


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

#define ll long long
#define print(x) cout << "[" << #x << ":" << x << "] "; 
#define println(x) cout << "[" << #x << ":" << x << "]\n";

int main(){
    ll n; cin >> n;
    ll a[n+1];
    ll m = 1000, s = 0;
    for(int i=1; i<=n; i++)
	cin >> a[i];
    for(int i=1; i+1<=n; i++){
	//print(s) println(m);
	if(a[i+1] > a[i]){
	    s += m/a[i];
	    m = m%a[i];
	}
	else{
	    m += s * a[i];
	    s = 0;
	}
    }
   // print(s) println(m)
    if(s > 0)
	m = m + s*a[n];
    cout << m << "\n";
    return 0;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int n;
    cin >> n;
    const ll MOD = 1000000007;
    ll dp[n+1] = {};
    srep(i,3,n+1) dp[i] = 1;

    rep(i,n){
        srep(j,i+3,n+1){
            dp[j] += dp[i];
            dp[j] %= MOD;
        }
    }

    cout << dp[n] << endl;
    return 0;
}




Measured memory_bytes: 3620
N = int(input())
A = list(map(int, input().split()))

answer = 'DENIED'
for i in range(0, N):
    if A[i] % 2 == 0:
        if A[i] % 3 == 0 or A[i] % 5 == 0:
            answer = 'APPROVED'
        else:
            answer = 'DENIED'
            break
    else:
        answer = 'APPROVED'

print(answer)

Measured memory_bytes: 9164
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
ll a[55];
int main() {
	ll n;
	cin >> n;
	ll count = 1,sum = 1;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		if (a[i] % 2 == 0) {
			count *= 2;
		}
		sum *= 3;
	}
	cout << sum - count << endl;

	return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b&&a==c)
	{
		cout<<0;
		return 0;
	}
	if((a+b+c)%2==(max(a,max(b,c))*3)%2)
		cout<<(max(a,max(b,c))*3-a-b-c)/2;
	else
		cout<<(max(a,max(b,c))*3+3-a-b-c)/2;
}

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

using namespace std;

const long long MOD = 1000000007LL;
long long GCD(long long a, long long b){return b == 0 ? a : GCD(b, a % b);}
long long fast_exp(int base, int exp) {
    long long tot = 1;
    for(;exp > 0;exp >>= 1) {
       if(exp & 1 == 0) tot = tot * base % MOD;
       base = base * base % MOD;
    }
    return tot;
}

long long p[10][10];

bool issquare(long long n){

    for(int i = 0; i * i <= n; ++i){
        if(i * i == n)
            return true;
    }

    return false;

}

int main(){

    cin.sync_with_stdio(0); cin.tie(0); cout.tie(0);

    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    int n, d;
    cin >> n >> d;

    int tot = 0;

    for(int i = 0; i < n; ++i){
        for(int j = 0; j < d; ++j){
            cin >> p[i][j];
        }
        for(int j = 0; j < i; ++j){
            long long T = 0;
            for(int k = 0; k < d; ++k)
                T += (p[i][k] - p[j][k]) * (p[i][k] - p[j][k]);
            if(issquare(T))
                ++tot;
        }
    }

    cout << tot;

    return 0;
}


Measured memory_bytes: 256
import Foundation

let n = Int(readLine()!)!
let a = readLine()!.components(separatedBy: " ")

var acc = 0
var sub = 0
var mem = 0

for str in a {
  let tmp = Int(str)!
  sub = mem + sub - tmp
  sub = sub > 0 ? sub : 0
  acc = acc + sub
  mem = tmp
}

print(acc)


Measured memory_bytes: 22728
N= int(input())
bit = bin(N)[2:]
k = len(bit)
dp = [[0] * 2 for i in range(len(bit) + 1)]
dp[0][0] = 1
dp[0][1] = 1
for i in range(k):
	j = int(bit[k-i-1])
	a,b,c = [(1,0,0),(1,1,0)][j]
	d,e,f = [(1, 1, 1),(0, 1, 2)][j]
	dp[i+1][0] = (a * dp[i][0] + b * dp[i][1] + c * 3**i) % 1000000007
	dp[i+1][1] = d * dp[i][0] + e * dp[i][1] + f * 3**i % 1000000007

print(dp[k][0])
    
      

Measured memory_bytes: 3064
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;

#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define EPS 1e-8
#define DEB 0


int main(){
	int m,sikin,year,n,type,tesuu,ans;
	double ritu;
	scanf("%d",&m);
	while(m--){
		ans = 0;
		scanf("%d%d%d",&sikin,&year,&n);
		rep(i,n){
			scanf("%d%lf%d",&type,&ritu,&tesuu);
#if DEB			
			printf("%d %lf %d\n",type,ritu,tesuu);
#endif
			int init = sikin;
			if( type==0 ){ //tanri
				int sum = 0;
				rep(j,year){
					double risi = (double)init * ritu;
					init = init - tesuu;
					sum += (int)floor(risi);
#if DEB					
					printf("init:%d  , sum:%d\n",init,sum);
#endif					
				}
				ans = max(ans, sum+init);
			}else{ // hukuri
				rep(j,year){
					double risi = (double)init * ritu;
					init = init + (int)floor(risi) - tesuu;
#if DEB
					printf("init:%d\n",init);
#endif					
				}
				ans = max(ans, init);
			}
		}
		printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define rep(i , n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;
int main(){
    string S;
    int Q;
    cin >> S >> Q;
    vector<string> A(2 , "");
    int f = 0;
    for(int i = 0; i < Q; i++){
        int T;
        cin >> T;
        if(T == 1){
            f = 1 - f;
        }
        else{
            int F;
            char C;
            cin >> F >> C;
            A[(f + F - 1) % 2] += C;
        }
    }
    reverse(A[f].begin() , A[f].end());
    if(f == 1){
        reverse(S.begin() , S.end());
    }
    cout << A[f] << S << A[1 - f] << endl;
}

Measured memory_bytes: 3992
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    M = I()

    print((24-M)+24)

if __name__ == '__main__':
    resolve()

Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <map>
#include <set>
#include <math.h>
#define rep(i,a,b) for(int i=(a); i<(b); ++i)
typedef long long ll;
using namespace std;

int main() {
  string s;
  cin >> s;
  int n=s.size();
  long long res=0;
  for (int bit=0; bit<(1<<(n-1)); ++bit) {
    long long tmp=0;
    rep(i,0,n-1) { //十の位までループを周す
      tmp*=10;
      tmp+=s[i]-'0';
      if (bit&(1<<i)) { //ビットbitにi番目のフラグがたってるかどうかの判定
        res+=tmp;
        //cout << tmp << endl;
        tmp=0;
      }
    }
    tmp*=10;
    tmp+=s.back()-'0'; //標準入力したときの一の位(固定)
    res+=tmp;
    //cout << tmp << endl;
    //cout << res << endl;
  }
  cout << res << endl;
}


Measured memory_bytes: 628
def loop_pow(x,n,mod):
    if n==0:
        return 1
    if n%2==0:
        t=loop_pow(x,n//2,mod)
        return (t*t)%mod
    return x*loop_pow(x,n-1,mod)

def com(N,K,mod):
    n=N
    k=K
    up=1
    down=1
    for _ in range(K):
        up*=n
        up%=mod
        n-=1
    for _ in range(K):
        down*=k
        down%=mod
        k-=1
    down=loop_pow(down,10**9+5,mod)
    return up*down%mod

def main():
    N,a,b=map(int,input().split())
    mod=10**9+7
    t=(loop_pow(2,N,mod)-1-com(N,a,mod)-com(N,b,mod))%mod
    print(t)

if __name__=="__main__":
    main()

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

typedef long long ll;

const int MAX_N = 20000;
const int MAX_M = 16;
const ll INF = 1e12;
const int y0 = 128;
int N, M;
int C[MAX_M + 1], x[MAX_N + 1];
ll dp[MAX_N + 10][260];

int main()
{
    while (cin >> N >> M, N || M) {
        // Input
        for (int i = 0; i < M; ++i)
            cin >> C[i];
        for (int i = 0; i < N; ++i)
            cin >> x[i];

        // Init
        for (int i = 0; i <= N; ++i)
            fill(dp[i], dp[i] + 259, INF);
        dp[0][128] = 0;

        // Solve
        for (int n = 0; n < N; ++n) {
            for (int y = 0; y <= 255; ++y) {
                for (int i = 0; i < M; ++i) {
                    int next_y = y + C[i];
                    if (next_y < 0)
                        next_y = 0;
                    else if (next_y > 255)
                        next_y = 255;

                    dp[n + 1][next_y] = min(dp[n + 1][next_y],
                                            dp[n][y] + (x[n] - next_y) * (x[n] - next_y));
                }
            }
        }

        ll ans = INF;
        for (int i = 0; i <= 255; ++i)
            ans = min(ans, dp[N][i]);

        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 41864
#include<bits/stdc++.h>
#define bye return 0
#define Yes cout << "Yes" << "\n"
#define No  cout << "No" << "\n"
#define YES cout << "YES" << "\n"
#define NO cout << "NO" << "\n"
#define endl cout << "\n"
using namespace std;
int main(){
	ios::sync_with_stdio(false);
    cin.tie(NULL);
    vector<int> v;
    set<int> s;
    int t, a, b, c, cnt=0;
     double d, d1, d2;
    cin >> a;
    d = double(a);

    if(a%2==0){
    	d1=d/2.0;
    	printf("%.9lf", d1/d);
    
    }else{
    	d1 = (d/2.0)+0.5;
    	printf("%.9lf", d1/d);
    }

   bye;

}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int N, M;
    cin >> N >> M;
    vector<long long> H(N);
    for(int i = 0; i < N; ++i){
        cin >> H.at(i);
    }
    int a, b;
    vector<vector<int>> G(N, vector<int>(0));
    for(int i = 0; i < M; ++i){
        cin >> a >> b;
        G.at(a - 1).push_back(b - 1);
        G.at(b - 1).push_back(a - 1);
    }
    int ans = N;
    for(int i = 0; i < N; ++i){
        for(int j = 0; j < G.at(i).size(); ++j){
            if(H.at(i) <= H.at(G.at(i).at(j))){
                ans--;
                break;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 9068
#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7  
using ll = long long;
using P = pair<int, int>;
using lP = pair<ll, ll>;
using fP = pair<double, double>;

int n;
vector<vector<int>>ans;

void dfs(vector<int> A) {
    if (A.size() == n + 1) {
        ans.push_back(A);
        return;
    }

    A.push_back(0);
    while (A.back() <= 3) {
        dfs(A);
        A.back()++;
    }
}

int main() {
    
    vector<int>t(3);
    cin >> n;
    rep(i, 3)cin >> t[i];
    vector<int>l(n);
    rep(i, n)cin >> l[i];
    dfs(vector<int>(1, 0));
    int res = INF;
    rep(i, 1 << (2 * n)) {
        vector<int>now = ans[i];
        vector<int>abc(3);
        int sum = 0;
        arep(j, 1, n + 1) {
            if (now[j] == 3)continue;
            abc[now[j]] += l[j - 1];
            sum += 10;
        }
        if (abc[0] == 0 || abc[1] == 0 || abc[2] == 0)continue;
        sum -= 30;
        int a = abs(t[0] - abc[0]);
        int b = abs(t[1] - abc[1]);
        int c = abs(t[2] - abc[2]);

        res = min(res, sum+a + b + c);
    }
    cout << res << endl;


    return 0;
}

Measured memory_bytes: 4916
import numpy as np

def Speed_Anag_Count(String):
    count = {}
    for i in String:
        i = sorted(i)
        i = str(''.join(i))
        if count.get(i) is None:
            count[i] = 0
        count[i] += 1
    
    return count

N = int(input())

S = [str(input()) for _ in range(N)]

count = Speed_Anag_Count(S)

ans=0
for i in count.values():
    ans += (i*(i-1)/2)
    
print(int(ans))
    




Measured memory_bytes: 34260
#include <stdio.h>

int main(int argc, char const *argv[]) {
	char str[201];
	char S[200];
	unsigned long long int K;
	char ans;

	scanf("%s", &S);
	scanf("%llu", &K);

	int i;

	for (i = 0; S[i] == '1'; i++) ;

	if (S[i] == 0) {
		ans = '1';
	} else {
		ans = (K-1 < i) ? '1' : S[i];
	}


	printf("%c\n", ans);

	return 0;
}


Measured memory_bytes: 128
#include<cstdio>
bool ispow[1001];
int main(){
    int x;
    scanf("%d",&x);
    for(int i=0;i<=x;i++)ispow[i]=false;
    ispow[1]=true;
    for(int i=2;i<=31;i++){
        for(int j=i*i;j<=x;j*=i){
            ispow[j]=true;
        }
    }
    for(int i=x;i>0;i--){
        if(ispow[i]){
            printf("%d",i);
            return 0;
        }
    }
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
#ifdef XVENOM
	#define errp(...) fprintf(stderr, __VA_ARGS__)
	#define dbg(...) errp("[%s]: ", #__VA_ARGS__), dbg_str(__VA_ARGS__)
#else
	#define errp(...)
	#define dbg(...)
#endif
template <typename U, typename V> string to_string (pair<U, V>);
string to_string (const string& e_) { return "\"" + e_ + "\""; }
string to_string (char e_) { return "\'" + string(1, e_) + "\'"; }
string to_string (bool e_) { return e_ ? "true" : "false"; }
template <typename T> string to_string (T e_) {
	string s_ = "[ ";
	for (const auto& x_ : e_) s_ += to_string(x_) + " ";
	return s_ + "]";
}
template <typename U, typename V> string to_string (pair<U, V> e_) {
	return "(" + to_string(e_.first) + ", " + to_string(e_.second) + ")";
}
void dbg_str () { errp(" \n"); }
template <typename U, typename... V> void dbg_str (U u, V... v) {
	errp(" %s", to_string(u).c_str()); dbg_str(v...);
}
/* --- */
int main () {
	ios_base::sync_with_stdio(0); cin.tie(0);
	/* --- */
	int n;
	cin >> n;
	vector<pair<int,int>> v;

	int x;
	for(int i = 0; i < n; i++){
		cin >> x;
		v.push_back({x,i+1});
	}
	sort(v.begin(), v.end());
	for(int i = 0; i < n; i++){
		cout << v[i].second << " ";
	}
}

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

int main(){
  int x1, y1, x2, y2;
  cin >> x1 >> y1 >> x2 >> y2;

  cout << x2 - (y2-y1) << " " << y2 + (x2-x1) << " ";
  cout << x1 - (y2-y1) << " " << y1 + (x2-x1) << endl;

  return 0;

}


Measured memory_bytes: 256
//------------------------------>> tsukasa_diary's template <<------------------------------//
#include <bits/stdc++.h>
using namespace std;

#define for_(i,a,b) for(int i=(a);i<(b);++i)
#define for_rev(i,a,b) for(int i=(a);i>=(b);--i)
#define allof(a) (a).begin(),(a).end()
#define minit(a,b) memset(a,b,sizeof(a))

using lint = long long;
using pii = pair< int, int >;

template< typename T > using Vec = vector< T >;

template< typename T > bool in_range(T x, T lb, T ub) { return lb <= x && x < ub; }
template< typename T > bool in_range(T x, T y, T lb, T ub) { return in_range(x, lb, ub) && in_range(y, lb, ub); }

template< typename T > void modAdd(T& a, T b, T mod) { a = (a + b + mod) % mod; }
template< typename T > void modMul(T& a, T b, T mod) { a = (a * b) % mod; }
template< typename T > void minUpdate(T& a, T b) { a = min(a, b); }
template< typename T > void maxUpdate(T& a, T b) { a = max(a, b); }

int bitCount(int x) { return __builtin_popcount(x); }
int bitCount(lint x) { return __builtin_popcountll(x); }

const int dx[4] = {0,1,0,-1}, dy[4] = {-1,0,1,0};
const int Dx[8] = {0,1,1,1,0,-1,-1,-1}, Dy[8] = {-1,-1,0,1,1,1,0,-1};
const double EPS = 1e-9;
const double PI = acos(-1);

//--------------8---------------->> coding space <<-----------------8-------------//



int main() {
	string S;
	cin >> S;
	puts(S.find("AC") != S.npos ? "Yes" : "No");
}
//--------------8---------------->> coding space <<-----------------8-------------//

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

const int mod = 1000000007;

int main(){
    string n;
    int k;
    cin>>n>>k;
    int len=n.size();
    vector<int[5][2]>dp(len+1);
    dp[0][0][0]=1;
    for(int i=0;i<len;i++){
        int d=n[i]-'0';
        for(int j=0;j<=k;j++){
            for(int s=0;s<=1;s++){
                for(int c=0;c<=9;c++){
                    if(s==0&&c>d)continue;
                    if(c==0){
                        if(s==0){
                            if(c<d){
                                dp[i+1][j][1]+=dp[i][j][s];
                            }else{
                                dp[i+1][j][0]+=dp[i][j][s];
                            }
                        }else{
                            dp[i+1][j][1]+=dp[i][j][s];
                        }
                    }else{
                        if(s==0){
                            if(c<d){
                                dp[i+1][j+1][1]+=dp[i][j][s];
                            }else{
                                dp[i+1][j+1][0]+=dp[i][j][s];
                            }
                        }else{
                            dp[i+1][j+1][1]+=dp[i][j][s];
                        }
                    }
                }
            }
        }
    }
    ll ans=dp[len][k][0]+dp[len][k][1];
    cout<<ans<<endl;
}

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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

const int32_t inf = 1001001001;
const int64_t infll = 1001001001001001001ll;
const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};

template <typename T> using vector2d = vector<vector<T>>;

// clang-format off
template <typename T> void sort(vector<T> &v) { sort(all(v)); }
// ostream &operator<<(ostream &os, __int128_t value) { if (ostream::sentry(os)) { __uint128_t tmp = value < 0 ? -value : value; char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __int128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } if (in[0] == '-') value *= -1; return is; }
// ostream &operator<<(ostream &os, __uint128_t value) { if (ostream::sentry(os)) { char buffer[64]; char *d = end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(ios_base::badbit); }} return os; }
// istream &operator>>(istream &is, __uint128_t &value) { string in; is >> in; value = 0; for (const char &c : in) { if ('0' <= c && c <= '9') value = 10 * value + (c - '0'); } return is; }
template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { os << v[0]; for (int i = 1; i < v.size(); ++i) os << " " << v[i]; return os; }
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

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

inline int64_t in() { int64_t x = 0; cin >> x; return x; }
template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }
// clang-format on

signed main(int argc, char *argv[]) {
  int n = in();

  vector<pair<int, int>> v;
  int64_t mini = inf, ans = 0;
  for (int i = 0; i < n; ++i) {
    int a = in(), b = in();
    ans += a;
    if (a > b) chmin(mini, b);
  }

  if (mini != inf)
    cout << ans - mini << endl;
  else
    cout << 0 << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

x, y, a, b, c = list(map(int, input().split()))
p = sorted(sorted(list(map(int, input().split())), reverse=True)[:x])
q = sorted(sorted(list(map(int, input().split())), reverse=True)[:y])
r = list(map(int, input().split()))
print(sum(sorted(p + q + r, reverse=True)[:x+y]))

Measured memory_bytes: 98028
# import sys
# sys.setrecursionlimit
from queue import PriorityQueue

getarr = lambda _f: list(map(_f, input().split()))

n, m = getarr(int)
a = getarr(int)

q = PriorityQueue()
for ai in a:
    q.put(-ai)

for _ in range(m):
    ai = (-q.get()) / 2
    q.put(-ai)

ans = 0
while not q.empty():
    ans += int(-q.get())

print(ans)

Measured memory_bytes: 130196
N=int(input())
S=input()
max_1=0
for i in range(1,N):
  count=0
  counted=[]
  A=S[:i]
  B=S[i:]
  for j in A:
    if j not in counted and j in B:
      count+=1
      counted.append(j)
  max_1=max(max_1,count)

print(max_1)
   


Measured memory_bytes: 3060
sunukeCount, k = map(int, input().split())

sunukeJudgeList = [0] * sunukeCount
for i in range(k):
    ninzu = int(input())
    sunukeNumberList = input().split()
    for p in range(len(sunukeNumberList)):
        sunukeJudgeList[(int(sunukeNumberList[p]) - 1)] = 1

list = []
for i in range(len(sunukeJudgeList)):
    if sunukeJudgeList[i] == 0:
        list.append(1)

print(len(list))


Measured memory_bytes: 9200
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
const int INF = 1e8;
using namespace std;

template <class T> class CumulativeSum2D {
	public:
		vector<vector<T>> s;
		int h, w;
		CumulativeSum2D(const vector<vector<T>> &a) {
			h = a.size();
			w = a[0].size();
			s = vector<vector<T>>(h + 1, vector<T>(w + 1, 0));
			rep(i, h) rep(j, w) s[i + 1][j + 1] = a[i][j];
			rep(i, h + 1) rep(j, w) s[i][j + 1] += s[i][j];
			rep(i, h) rep(j, w + 1) s[i + 1][j] += s[i][j];
		}

		int sum(int i, int j, int h, int w) {
			return s[i + h][j + w] - s[i][j + w] + s[i][j] - s[i + h][j];
		}

		int maximumSubMatrix(){
			int ret = -INF;
			rep(i,h + 1) rep(j,w + 1) range(k,1,h - i + 1) range(l,1,w - j + 1){
				ret = max(ret, sum(i,j,k,l));
			}
			return ret;
		}
		void output(){
			rep(i,h + 1){
				rep(j,w + 1){
					cout << s[i][j] << ' ';
				}
				cout << endl;
			}
		}
};

int main(){
	int n, m, q;
	cin >> n >> m >> q;

	vector<vector<int>> va(n, vector<int>(m,0));
	rep(i,n){
		rep(j,m){
			char a;
			cin >> a;
			va[i][j] = a - '0';
		}
	}

	vector<vector<int>> hol(n, vector<int>(m,0));
	vector<vector<int>> var(n, vector<int>(m,0));
	rep(i,n - 1){
		rep(j,m){
			if(va[i][j] && va[i + 1][j]) var[i][j] = 1;
			//cout << var[i][j];
		}
		//cout << endl;
	}
	rep(i,n){
		rep(j,m - 1){
			if(va[i][j] && va[i][j + 1]) hol[i][j] = 1;
			//cout << hol[i][j];
		}
		//cout << endl;
	}


	CumulativeSum2D<int> s(va), h(hol), v(var);
	//v.output();
	//h.output();

	rep(i,q){
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		a--; b--; c--; d--;
		//show(s.sum(a,b,c - a + 1,d - b + 1))
		//show(h.sum(a,b,c - a + 1,d - b))
		//show(v.sum(a,b,c - a,d - b + 1))
		cout << s.sum(a,b,c - a + 1,d - b + 1) -
			h.sum(a,b,c - a + 1,d - b) -
			v.sum(a,b,c - a,d - b + 1) << endl;
	}
}


Measured memory_bytes: 96896
prime = []
numberlist = []
for i in range(2, 31623):
	numberlist.append(i)
while numberlist[0] < 178:
	now = numberlist.pop(0)
	prime.append(now)
	newnumberlist = []
	for i in range(0, len(numberlist)):
		if numberlist[i] % now != 0:
			newnumberlist.append(numberlist[i])
	numberlist = newnumberlist
prime = prime + numberlist

N = int(input())
ans = str(N)+':'
for i in range(0, len(prime)):
	while True:
		if N % prime[i] == 0:
			ans = ans + ' ' + str(prime[i])
			N //= prime[i]
		else:
			break
if N != 1: ans = ans + ' ' + str(N)
print(ans)


Measured memory_bytes: 6768
import sys
input = sys.stdin.readline
 
############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))#might need to remove the -1
def invr():
    return(map(int,input().split()))

d, t, s = invr()

if d/s<=t:
	print('Yes')
else:
	print('No')

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

using namespace std;

const int DMAX = 1e5+10;

struct nume{
    int node,cost;
};

vector <nume> V[5*DMAX];
priority_queue <nume> heap;
vector <int> dp(5*DMAX);
vector <bool> uz(5*DMAX);
map <pair<int,int>,int> has;

int n,m,cates;

void dijkstra();

inline bool operator<(nume x,nume y){
    return x.cost>y.cost;
}

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

    int i,x,y,z;

    cin>>n>>m;
    cates=n;
    for(i=1;i<=m;i++){
        cin>>x>>y>>z;
        if(!has[{x,z}])
           has[{x,z}]=++cates;
        if(!has[{y,z}])
           has[{y,z}]=++cates;
        V[has[{x,z}]].push_back({has[{y,z}],0});
        V[has[{y,z}]].push_back({has[{x,z}],0});
        V[has[{x,z}]].push_back({x,0});
        V[has[{y,z}]].push_back({y,0});
        V[x].push_back({has[{x,z}],1});
        V[y].push_back({has[{y,z}],1});
    }
    for(i=2;i<=cates;i++)
        dp[i]=INT_MAX/2;
    dijkstra();
    if(dp[n] == INT_MAX/2)
       cout<<"-1\n";
    else
       cout<<dp[n]<<'\n';

    return 0;
}
void dijkstra(){
    int i;
    int node;

    heap.push({1,0});
    uz[1]=true;
    while(!heap.empty()){
        node=heap.top().node;
        heap.pop();
        uz[node]=false;
        for(i=0;i<V[node].size();i++){
            if(dp[node] + V[node][i].cost < dp[V[node][i].node]){
                dp[V[node][i].node] = dp[node] + V[node][i].cost;
                if (!uz[V[node][i].node]){
                    heap.push({V[node][i].node, dp[V[node][i].node]});
                    uz[V[node][i].node] = true;
                }
            }
        }
    }
}


Measured memory_bytes: 59252
#import math
#import bisect
#import numpy as np
#import itertools
#import copy
import sys

ipti = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)

def main():
    n = int(input())
    h = [[0] * 3 for _ in range(n)]

    for i in range(n):
        h[i] = list(map(int,ipti().split()))

    dp = [[0] * 3 for _ in range(n)]
    dp[0][0] = h[0][0]
    dp[0][1] = h[0][1]
    dp[0][2] = h[0][2]

    for i in range(1, n):
        for j in range(3):
            dp[i][j] = max(dp[i-1][(j+1)%3] + h[i][j], dp[i-1][(j+2)%3] + h[i][j])

    print(max(dp[n-1]))

if __name__ == '__main__':
    main()

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

int main() {

	int N, K, Q;
	cin >> N >> K >> Q;

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

	vector<int> S(N);
	for (int i = 0; i < Q; i++)
	{
		S[A[i]-1]++;
	}

	for (int i = 0; i < N; i++)
	{
		if (K - (Q - S[i]) > 0) {
			cout << "Yes" << endl;
		}
		else {
			cout << "No" << endl;
		}
	}
	   
	return 0;
}

Measured memory_bytes: 1536
#include "bits/stdc++.h"
using namespace std;
#define MAX 500000
#define SENTINEL 2000000000

int L[MAX/2+2],R[MAX/2+2];
int cnt;

void merge(int A[],int n,int left,int mid,int right){
	int n1=mid-left;
	int n2=right-mid;
	for (int i = 0; i < n1; ++i) {L[i]=A[left  +i];}
	for (int i = 0; i < n2; ++i) {R[i]=A[mid +i];}
	L[n1]=R[n2]=SENTINEL;
	int i=0,j=0;
	for (int k = left; k < right; ++k) {
		cnt++;
		if (L[i]<=R[j]) {
			A[k]=L[i++];
		} else {
			A[k]=R[j++];
		}
	}
}

void mergeSort(int A[],int n,int left,int right){
	if(left+1<right){
		int mid=(left+right)/2;
		mergeSort(A,n,left,mid);
		mergeSort(A,n,mid,right);
		merge(A,n,left,mid,right);
	}
}



int main(){
int A[MAX],n,i;
cnt=0;
cin>>n;
for (int i = 0; i < n; ++i) {cin>>A[i];}
mergeSort(A,n,0,n);
for (int i = 0; i < n; ++i) {
	if(i)cout<<" ";
	cout<<A[i];
}
cout<<endl;
cout<<cnt<<endl;
}

Measured memory_bytes: 6980
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String[] s = sc.nextLine().split(" ");
        List<String> list = Arrays.asList(s);
        List<String> list2 = new ArrayList<String>(new HashSet<>(list));
        System.out.println(list2.size());


        


        
    }

}


Measured memory_bytes: 23636
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for(ll i=0; i<n; i++)
#define repr(i, s, e) for(ll i=s; i>=e; i--)
#define reps(i, s, e) for(ll i=s; i<=e; i++)
#define inf 1e18
#define all(v) v.begin(),v.end()
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
void ans(bool b){ cout << (b ? "Yes" : "No") << endl; }
void ans2(bool b){ cout << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b) a=b; return a<b; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a) a=b; return b<a; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    fill((T*)array, (T*)(array+N), val);
}
template<typename T> void vdeb(T v){
    cout << "#vector set debug" << endl;
    for(auto vv : v) cout << vv << " ";
    cout << endl;
}
template<typename T1, typename T2> void adeb(T1 arr[], T2 n){
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}
template<typename T1> void mdeb(T1 mp){
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};


class DPredictionAndRestriction {
public:
	void solve(std::istream& in, std::ostream& out) {
        int n, k, r, s, p;
        string t;
        in >> n >> k >> r >> s >> p >> t;

        ll res = 0;
        char last;
        rep(i, k){
            ll mx = 0;
            ll cnt;
            rep(j, 3){
                cnt = 0;
                if(j == 0) last = 'r';
                if(j == 1) last = 's';
                if(j == 2) last = 'p';

                int ind = i;
                while(ind < n){
                    if(t[ind] == 'r' && last != 'p'){
                        cnt += p;
                        last = 'p';
                    }
                    else if(t[ind] == 's' && last != 'r'){
                        cnt += r;
                        last = 'r';
                    }
                    else if(t[ind] == 'p' && last != 's'){
                        cnt += s;
                        last = 's';
                    }else{
                        last = '-1';
                    }
                    ind += k;
                }
                chmax(mx, cnt);
            }
            res += mx;
        }

        out << res << endl;
	}
};


int main() {
	DPredictionAndRestriction solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 512
using System;
class Program
{
	static void Main(string[] args)
	{
		while(true){
			string[] s = Console.ReadLine().Split();
			int X = int.Parse(s[0]);
			int W = int.Parse(s[1]);
			if(X==0 && W==0){
				break;
			} else {
				for(var i=0;i<X;i++){
					string str = "";
					for(var j=0;j<W;j++){
						if((i+j)%2==0){
							str += "#";
						} else {
							str += ".";
						}
					}
					Console.WriteLine(str);
				}
				Console.WriteLine();
			}
		}
	}
}


Measured memory_bytes: 9276